summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--Auxiliary/cmake-mode.el2
-rw-r--r--Auxiliary/vim/syntax/cmake.vim6
-rw-r--r--CMakeLists.txt5
-rw-r--r--CONTRIBUTING.rst18
-rw-r--r--CTestCustom.cmake.in2
-rw-r--r--Help/command/LINK_OPTIONS_LINKER.txt10
-rw-r--r--Help/command/OPTIONS_SHELL.txt (renamed from Help/command/COMPILE_OPTIONS_SHELL.txt)2
-rw-r--r--Help/command/add_compile_options.rst2
-rw-r--r--Help/command/add_library.rst1
-rw-r--r--Help/command/add_link_options.rst26
-rw-r--r--Help/command/ctest_submit.rst10
-rw-r--r--Help/command/ctest_update.rst9
-rw-r--r--Help/command/export.rst8
-rw-r--r--Help/command/find_package.rst76
-rw-r--r--Help/command/include_directories.rst6
-rw-r--r--Help/command/install.rst12
-rw-r--r--Help/command/list.rst22
-rw-r--r--Help/command/math.rst18
-rw-r--r--Help/command/option.rst4
-rw-r--r--Help/command/string.rst14
-rw-r--r--Help/command/target_compile_options.rst2
-rw-r--r--Help/command/target_link_libraries.rst3
-rw-r--r--Help/command/target_link_options.rst42
-rw-r--r--Help/command/target_sources.rst7
-rw-r--r--Help/command/unset.rst13
-rw-r--r--Help/cpack_gen/archive.rst35
-rw-r--r--Help/cpack_gen/bundle.rst64
-rw-r--r--Help/cpack_gen/cygwin.rst23
-rw-r--r--Help/cpack_gen/deb.rst537
-rw-r--r--Help/cpack_gen/dmg.rst101
-rw-r--r--Help/cpack_gen/external.rst283
-rw-r--r--Help/cpack_gen/freebsd.rst138
-rw-r--r--Help/cpack_gen/ifw.rst335
-rw-r--r--Help/cpack_gen/nsis.rst130
-rw-r--r--Help/cpack_gen/nuget.rst189
-rw-r--r--Help/cpack_gen/packagemaker.rst23
-rw-r--r--Help/cpack_gen/productbuild.rst68
-rw-r--r--Help/cpack_gen/rpm.rst955
-rw-r--r--Help/cpack_gen/wix.rst284
-rw-r--r--Help/dev/maint.rst9
-rw-r--r--Help/dev/testing.rst3
-rw-r--r--Help/generator/Green Hills MULTI.rst40
-rw-r--r--Help/generator/Visual Studio 10 2010.rst6
-rw-r--r--Help/generator/Visual Studio 11 2012.rst6
-rw-r--r--Help/generator/Visual Studio 12 2013.rst6
-rw-r--r--Help/generator/Visual Studio 14 2015.rst6
-rw-r--r--Help/generator/Visual Studio 15 2017.rst6
-rw-r--r--Help/index.rst1
-rw-r--r--Help/manual/cmake-buildsystem.7.rst2
-rw-r--r--Help/manual/cmake-commands.7.rst2
-rw-r--r--Help/manual/cmake-developer.7.rst6
-rw-r--r--Help/manual/cmake-language.7.rst7
-rw-r--r--Help/manual/cmake-modules.7.rst35
-rw-r--r--Help/manual/cmake-packages.7.rst50
-rw-r--r--Help/manual/cmake-policies.7.rst10
-rw-r--r--Help/manual/cmake-properties.7.rst29
-rw-r--r--Help/manual/cmake-server.7.rst7
-rw-r--r--Help/manual/cmake-variables.7.rst20
-rw-r--r--Help/manual/cpack-generators.7.rst29
-rw-r--r--Help/module/CPackArchive.rst5
-rw-r--r--Help/module/CPackBundle.rst5
-rw-r--r--Help/module/CPackCygwin.rst5
-rw-r--r--Help/module/CPackDMG.rst5
-rw-r--r--Help/module/CPackDeb.rst5
-rw-r--r--Help/module/CPackFreeBSD.rst5
-rw-r--r--Help/module/CPackNSIS.rst5
-rw-r--r--Help/module/CPackNuGet.rst5
-rw-r--r--Help/module/CPackPackageMaker.rst5
-rw-r--r--Help/module/CPackProductBuild.rst5
-rw-r--r--Help/module/CPackRPM.rst5
-rw-r--r--Help/module/CPackWIX.rst5
-rw-r--r--Help/policy/CMP0076.rst26
-rw-r--r--Help/policy/CMP0077.rst16
-rw-r--r--Help/policy/CMP0078.rst22
-rw-r--r--Help/prop_dir/LINK_OPTIONS.rst17
-rw-r--r--Help/prop_tgt/DEPLOYMENT_ADDITIONAL_FILES.rst18
-rw-r--r--Help/prop_tgt/INTERFACE_LINK_DEPENDS.rst31
-rw-r--r--Help/prop_tgt/INTERFACE_LINK_OPTIONS.rst9
-rw-r--r--Help/prop_tgt/LINK_DEPENDS.rst9
-rw-r--r--Help/prop_tgt/LINK_FLAGS.rst15
-rw-r--r--Help/prop_tgt/LINK_FLAGS_CONFIG.rst9
-rw-r--r--Help/prop_tgt/LINK_OPTIONS.rst24
-rw-r--r--Help/prop_tgt/STATIC_LIBRARY_FLAGS.rst15
-rw-r--r--Help/prop_tgt/STATIC_LIBRARY_FLAGS_CONFIG.rst10
-rw-r--r--Help/prop_tgt/STATIC_LIBRARY_OPTIONS.rst20
-rw-r--r--Help/prop_tgt/VS_DEBUGGER_COMMAND.rst2
-rw-r--r--Help/prop_tgt/VS_DEBUGGER_COMMAND_ARGUMENTS.rst11
-rw-r--r--Help/prop_tgt/VS_DEBUGGER_ENVIRONMENT.rst11
-rw-r--r--Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst2
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER.rst12
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN.rst12
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_ARGUMENTS.rst10
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER.rst12
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS.rst12
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE.rst12
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_ENVIRONMENT.rst12
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_EXECUTABLE.rst9
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_GUARD_MALLOC.rst12
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP.rst13
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_MALLOC_GUARD_EDGES.rst12
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_MALLOC_SCRIBBLE.rst12
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_MALLOC_STACK.rst12
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_THREAD_SANITIZER.rst12
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_THREAD_SANITIZER_STOP.rst12
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER.rst12
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP.rst13
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_ZOMBIE_OBJECTS.rst12
-rw-r--r--Help/release/3.1.rst4
-rw-r--r--Help/release/3.10.rst26
-rw-r--r--Help/release/3.11.rst4
-rw-r--r--Help/release/3.12.rst4
-rw-r--r--Help/release/3.2.rst10
-rw-r--r--Help/release/3.3.rst14
-rw-r--r--Help/release/3.4.rst10
-rw-r--r--Help/release/3.5.rst22
-rw-r--r--Help/release/3.6.rst60
-rw-r--r--Help/release/3.7.rst21
-rw-r--r--Help/release/3.8.rst22
-rw-r--r--Help/release/3.9.rst21
-rw-r--r--Help/release/dev/0-sample-topic.rst7
-rw-r--r--Help/release/dev/CMAKE_AUTOGEN_VERBOSE.rst6
-rw-r--r--Help/release/dev/FindCURL-per-config.rst5
-rw-r--r--Help/release/dev/FindMatlab-mcc.rst5
-rw-r--r--Help/release/dev/INTERFACE_LINK_DEPENDS-property.rst4
-rw-r--r--Help/release/dev/LINK_DEPENDS-property.rst5
-rw-r--r--Help/release/dev/LINK_OPTIONS.rst11
-rw-r--r--Help/release/dev/STATIC_LIBRARY_OPTIONS.rst4
-rw-r--r--Help/release/dev/UseSWIG-USE_TARGET_INCLUDE_DIRECTORIES.rst5
-rw-r--r--Help/release/dev/UseSWIG-target-name-policy.rst5
-rw-r--r--Help/release/dev/cpack-deb-source-date-epoch.rst6
-rw-r--r--Help/release/dev/cpack-external.rst8
-rw-r--r--Help/release/dev/cpack-generator-documentation.rst9
-rw-r--r--Help/release/dev/ghs.rst20
-rw-r--r--Help/release/dev/install-code-script-genex.rst5
-rw-r--r--Help/release/dev/list_sort.rst5
-rw-r--r--Help/release/dev/math-hex.rst4
-rw-r--r--Help/release/dev/option-normal-variable.rst5
-rw-r--r--Help/release/dev/pkgc-global.rst5
-rw-r--r--Help/release/dev/subdirectory-installing.rst5
-rw-r--r--Help/release/dev/subdirectory-sources.rst8
-rw-r--r--Help/release/dev/vs-debugger-improvements.rst14
-rw-r--r--Help/release/dev/vs-deployment-files.rst7
-rw-r--r--Help/release/dev/xcode_schemes_config.rst5
-rw-r--r--Help/release/index.rst2
-rw-r--r--Help/variable/CACHE.rst17
-rw-r--r--Help/variable/CMAKE_ANDROID_STL_TYPE.rst3
-rw-r--r--Help/variable/CMAKE_AUTOGEN_VERBOSE.rst13
-rw-r--r--Help/variable/CMAKE_GENERATOR_PLATFORM.rst2
-rw-r--r--Help/variable/CMAKE_GENERATOR_TOOLSET.rst1
-rw-r--r--Help/variable/CMAKE_LANG_CLANG_TIDY.rst2
-rw-r--r--Help/variable/CMAKE_LANG_LINKER_WRAPPER_FLAG.rst39
-rw-r--r--Help/variable/CMAKE_LANG_LINKER_WRAPPER_FLAG_SEP.rst9
-rw-r--r--Help/variable/CMAKE_MAKE_PROGRAM.rst8
-rw-r--r--Help/variable/CMAKE_SYSTEM_PROCESSOR.rst2
-rw-r--r--Help/variable/CMAKE_VS_WINRT_BY_DEFAULT.rst8
-rw-r--r--Help/variable/CMAKE_XCODE_GENERATE_SCHEME.rst28
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER.rst12
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN.rst12
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER.rst12
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS.rst12
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE.rst12
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_GUARD_MALLOC.rst12
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP.rst13
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES.rst12
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE.rst12
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_MALLOC_STACK.rst12
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER.rst12
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP.rst12
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER.rst12
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP.rst13
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS.rst12
-rw-r--r--Help/variable/ENV.rst7
-rw-r--r--Modules/BundleUtilities.cmake5
-rw-r--r--Modules/CMakeCUDAInformation.cmake2
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake6
-rw-r--r--Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake6
-rw-r--r--Modules/CMakeFindDependencyMacro.cmake2
-rw-r--r--Modules/CMakePackageConfigHelpers.cmake12
-rw-r--r--Modules/CMakeParseImplicitLinkInfo.cmake5
-rw-r--r--Modules/CPackArchive.cmake39
-rw-r--r--Modules/CPackBundle.cmake70
-rw-r--r--Modules/CPackCygwin.cmake27
-rw-r--r--Modules/CPackDMG.cmake105
-rw-r--r--Modules/CPackFreeBSD.cmake248
-rw-r--r--Modules/CPackIFW.cmake996
-rw-r--r--Modules/CPackNSIS.cmake138
-rw-r--r--Modules/CPackPackageMaker.cmake27
-rw-r--r--Modules/CPackProductBuild.cmake72
-rw-r--r--Modules/CPackWIX.cmake307
-rw-r--r--Modules/CheckIPOSupported.cmake15
-rw-r--r--Modules/Compiler/ARMCC.cmake2
-rw-r--r--Modules/Compiler/Absoft-Fortran.cmake1
-rw-r--r--Modules/Compiler/Bruce-C.cmake2
-rw-r--r--Modules/Compiler/Clang.cmake2
-rw-r--r--Modules/Compiler/Cray-CXX.cmake4
-rw-r--r--Modules/Compiler/G95-Fortran.cmake2
-rw-r--r--Modules/Compiler/GNU.cmake11
-rw-r--r--Modules/Compiler/HP-C.cmake3
-rw-r--r--Modules/Compiler/HP-CXX.cmake3
-rw-r--r--Modules/Compiler/HP-Fortran.cmake3
-rw-r--r--Modules/Compiler/Intel.cmake8
-rw-r--r--Modules/Compiler/NAG-Fortran.cmake1
-rw-r--r--Modules/Compiler/PGI.cmake3
-rw-r--r--Modules/Compiler/QCC.cmake11
-rw-r--r--Modules/Compiler/SCO.cmake3
-rw-r--r--Modules/Compiler/SunPro-C.cmake3
-rw-r--r--Modules/Compiler/SunPro-CXX.cmake3
-rw-r--r--Modules/Compiler/SunPro-Fortran.cmake3
-rw-r--r--Modules/Compiler/TinyCC-C.cmake3
-rw-r--r--Modules/Compiler/XL.cmake4
-rw-r--r--Modules/CompilerId/Xcode-3.pbxproj.in1
-rw-r--r--Modules/FindBLAS.cmake1024
-rw-r--r--Modules/FindBoost.cmake16
-rw-r--r--Modules/FindCUDA.cmake3
-rw-r--r--Modules/FindCURL.cmake58
-rw-r--r--Modules/FindLua.cmake9
-rw-r--r--Modules/FindMatlab.cmake51
-rw-r--r--Modules/FindOpenCL.cmake31
-rw-r--r--Modules/FindPackageHandleStandardArgs.cmake4
-rw-r--r--Modules/FindPkgConfig.cmake47
-rw-r--r--Modules/FindProtobuf.cmake242
-rw-r--r--Modules/FindXercesC.cmake17
-rw-r--r--Modules/FindZLIB.cmake8
-rw-r--r--Modules/GetPrerequisites.cmake18
-rw-r--r--Modules/Internal/CPack/CPackDeb.cmake (renamed from Modules/CPackDeb.cmake)531
-rw-r--r--Modules/Internal/CPack/CPackExt.cmake53
-rw-r--r--Modules/Internal/CPack/CPackFreeBSD.cmake107
-rw-r--r--Modules/Internal/CPack/CPackNuGet.cmake (renamed from Modules/CPackNuGet.cmake)195
-rw-r--r--Modules/Internal/CPack/CPackRPM.cmake (renamed from Modules/CPackRPM.cmake)959
-rw-r--r--Modules/Internal/CPack/CPackWIX.cmake20
-rw-r--r--Modules/Internal/CPack/CPackZIP.cmake (renamed from Modules/CPackZIP.cmake)1
-rw-r--r--Modules/Platform/Android-Common.cmake4
-rw-r--r--Modules/Platform/Android/Determine-Compiler-NDK.cmake13
-rw-r--r--Modules/Platform/Apple-Intel.cmake3
-rw-r--r--Modules/Platform/GHS-MULTI-Initialize.cmake60
-rw-r--r--Modules/Platform/Generic-ADSP-C.cmake4
-rw-r--r--Modules/Platform/Generic-ADSP-CXX.cmake4
-rw-r--r--Modules/Platform/Generic-SDCC-C.cmake3
-rw-r--r--Modules/Platform/Linux-Intel.cmake3
-rw-r--r--Modules/Platform/Windows-Embarcadero.cmake2
-rw-r--r--Modules/Platform/Windows-Intel.cmake2
-rw-r--r--Modules/Platform/Windows-NVIDIA-CUDA.cmake2
-rw-r--r--Modules/Platform/WindowsPhone-Clang-C.cmake1
-rw-r--r--Modules/Platform/WindowsPhone-Clang-CXX.cmake1
-rw-r--r--Modules/Platform/WindowsPhone-GNU-C.cmake1
-rw-r--r--Modules/Platform/WindowsPhone-GNU-CXX.cmake1
-rw-r--r--Modules/Platform/WindowsStore-Clang-C.cmake1
-rw-r--r--Modules/Platform/WindowsStore-Clang-CXX.cmake1
-rw-r--r--Modules/Platform/WindowsStore-GNU-C.cmake1
-rw-r--r--Modules/Platform/WindowsStore-GNU-CXX.cmake1
-rw-r--r--Modules/UseSWIG.cmake63
-rw-r--r--README.rst4
-rw-r--r--Source/CMakeLists.txt7
-rw-r--r--Source/CMakeVersion.cmake4
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx4
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx2
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.cxx2
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.cxx2
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx6
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.cxx12
-rw-r--r--Source/CPack/cmCPackComponentGroup.h25
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx22
-rw-r--r--Source/CPack/cmCPackExtGenerator.cxx321
-rw-r--r--Source/CPack/cmCPackExtGenerator.h88
-rw-r--r--Source/CPack/cmCPackFreeBSDGenerator.cxx2
-rw-r--r--Source/CPack/cmCPackGenerator.cxx580
-rw-r--r--Source/CPack/cmCPackGenerator.h14
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.cxx5
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx10
-rw-r--r--Source/CPack/cmCPackNuGetGenerator.cxx2
-rw-r--r--Source/CPack/cmCPackProductBuildGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackRPMGenerator.cxx4
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx7
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx16
-rw-r--r--Source/CTest/cmCTestLaunch.cxx4
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx4
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx5
-rw-r--r--Source/CTest/cmCTestRunTest.cxx10
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx4
-rw-r--r--Source/CTest/cmCTestStartCommand.cxx2
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx4
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx6
-rw-r--r--Source/Checks/cm_cxx14_check.cmake2
-rw-r--r--Source/Checks/cm_cxx14_check.cpp5
-rw-r--r--Source/Checks/cm_cxx17_check.cmake2
-rw-r--r--Source/Checks/cm_cxx17_check.cpp4
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.cxx2
-rw-r--r--Source/LexerParser/cmCommandArgumentParser.cxx109
-rw-r--r--Source/LexerParser/cmCommandArgumentParser.y3
-rw-r--r--Source/LexerParser/cmDependsJavaParser.cxx1435
-rw-r--r--Source/LexerParser/cmDependsJavaParser.y3
-rw-r--r--Source/LexerParser/cmExprLexer.cxx126
-rw-r--r--Source/LexerParser/cmExprLexer.in.l7
-rw-r--r--Source/LexerParser/cmExprParser.cxx109
-rw-r--r--Source/LexerParser/cmExprParser.y7
-rw-r--r--Source/LexerParser/cmFortranParser.cxx121
-rw-r--r--Source/LexerParser/cmFortranParser.y3
-rw-r--r--Source/LexerParser/cmFortranParserTokens.h2
-rw-r--r--Source/QtDialog/CMakeSetup.icnsbin138205 -> 195235 bytes
-rw-r--r--Source/QtDialog/CMakeSetup.icobin24542 -> 159613 bytes
-rw-r--r--Source/QtDialog/CMakeSetup128.pngbin13269 -> 10944 bytes
-rw-r--r--Source/QtDialog/CMakeSetup32.pngbin358 -> 2097 bytes
-rw-r--r--Source/QtDialog/CMakeSetup64.pngbin7213 -> 4676 bytes
-rw-r--r--Source/cmAddCustomCommandCommand.cxx2
-rw-r--r--Source/cmAddCustomTargetCommand.cxx2
-rw-r--r--Source/cmAddLinkOptionsCommand.cxx20
-rw-r--r--Source/cmAddLinkOptionsCommand.h31
-rw-r--r--Source/cmAddSubDirectoryCommand.cxx10
-rw-r--r--Source/cmArchiveWrite.cxx28
-rw-r--r--Source/cmBuildNameCommand.cxx4
-rw-r--r--Source/cmCPluginAPI.cxx8
-rw-r--r--Source/cmCTest.cxx7
-rw-r--r--Source/cmCTest.h4
-rw-r--r--Source/cmCacheManager.cxx2
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx2
-rw-r--r--Source/cmCommands.cxx5
-rw-r--r--Source/cmDependsC.cxx8
-rw-r--r--Source/cmDependsFortran.cxx4
-rw-r--r--Source/cmDocumentationFormatter.cxx2
-rw-r--r--Source/cmExportBuildAndroidMKGenerator.cxx6
-rw-r--r--Source/cmExportBuildFileGenerator.cxx6
-rw-r--r--Source/cmExportCommand.cxx10
-rw-r--r--Source/cmExportFileGenerator.cxx38
-rw-r--r--Source/cmExportFileGenerator.h4
-rw-r--r--Source/cmExportInstallFileGenerator.cxx7
-rw-r--r--Source/cmExportLibraryDependenciesCommand.cxx2
-rw-r--r--Source/cmExprParserHelper.cxx54
-rw-r--r--Source/cmExprParserHelper.h17
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx4
-rw-r--r--Source/cmExtraCodeLiteGenerator.cxx12
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx10
-rw-r--r--Source/cmExtraKateGenerator.cxx4
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx2
-rw-r--r--Source/cmFileCommand.cxx45
-rw-r--r--Source/cmFindPackageCommand.cxx6
-rw-r--r--Source/cmFindPackageCommand.h5
-rw-r--r--Source/cmFindProgramCommand.cxx34
-rw-r--r--Source/cmGeneratedFileStream.cxx31
-rw-r--r--Source/cmGeneratedFileStream.h12
-rw-r--r--Source/cmGeneratorExpression.cxx13
-rw-r--r--Source/cmGeneratorExpression.h40
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.h4
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.cxx4
-rw-r--r--Source/cmGeneratorExpressionNode.cxx2
-rw-r--r--Source/cmGeneratorTarget.cxx282
-rw-r--r--Source/cmGeneratorTarget.h18
-rw-r--r--Source/cmGlobVerificationManager.cxx9
-rw-r--r--Source/cmGlobVerificationManager.h3
-rw-r--r--Source/cmGlobalGenerator.cxx73
-rw-r--r--Source/cmGlobalGenerator.h11
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx289
-rw-r--r--Source/cmGlobalGhsMultiGenerator.h24
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx24
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx11
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx6
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx530
-rw-r--r--Source/cmGlobalXCodeGenerator.h7
-rw-r--r--Source/cmGraphVizWriter.cxx4
-rw-r--r--Source/cmHexFileConverter.cxx10
-rw-r--r--Source/cmInstallCommand.cxx36
-rw-r--r--Source/cmInstallDirectoryGenerator.cxx2
-rw-r--r--Source/cmInstallScriptGenerator.cxx40
-rw-r--r--Source/cmInstallScriptGenerator.h13
-rw-r--r--Source/cmInstallTargetGenerator.cxx6
-rw-r--r--Source/cmLinkLineDeviceComputer.cxx22
-rw-r--r--Source/cmListCommand.cxx198
-rw-r--r--Source/cmLocalGenerator.cxx167
-rw-r--r--Source/cmLocalGenerator.h15
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx10
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx94
-rw-r--r--Source/cmMakefile.cxx19
-rw-r--r--Source/cmMakefile.h7
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx38
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx68
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.h3
-rw-r--r--Source/cmMakefileTargetGenerator.cxx51
-rw-r--r--Source/cmMakefileTargetGenerator.h5
-rw-r--r--Source/cmMathCommand.cxx75
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx6
-rw-r--r--Source/cmNinjaTargetGenerator.cxx17
-rw-r--r--Source/cmNinjaTargetGenerator.h2
-rw-r--r--Source/cmOptionCommand.cxx76
-rw-r--r--Source/cmOutputConverter.cxx4
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx3
-rw-r--r--Source/cmPolicies.h10
-rw-r--r--Source/cmProjectCommand.cxx12
-rw-r--r--Source/cmQtAutoGen.h26
-rw-r--r--Source/cmQtAutoGenInitializer.cxx1911
-rw-r--r--Source/cmQtAutoGenInitializer.h144
-rw-r--r--Source/cmQtAutoGenerator.cxx22
-rw-r--r--Source/cmQtAutoGenerator.h11
-rw-r--r--Source/cmQtAutoGeneratorMocUic.cxx14
-rw-r--r--Source/cmQtAutoGeneratorRcc.cxx5
-rw-r--r--Source/cmRST.cxx2
-rw-r--r--Source/cmSearchPath.cxx11
-rw-r--r--Source/cmServerDictionary.h1
-rw-r--r--Source/cmServerProtocol.cxx234
-rw-r--r--Source/cmSourceFile.cxx13
-rw-r--r--Source/cmSourceFile.h3
-rw-r--r--Source/cmSourceFileLocation.cxx8
-rw-r--r--Source/cmState.cxx3
-rw-r--r--Source/cmStateDirectory.cxx70
-rw-r--r--Source/cmStateDirectory.h15
-rw-r--r--Source/cmStatePrivate.h4
-rw-r--r--Source/cmStateSnapshot.cxx7
-rw-r--r--Source/cmStringCommand.cxx2
-rw-r--r--Source/cmSubdirCommand.cxx7
-rw-r--r--Source/cmSystemTools.cxx101
-rw-r--r--Source/cmSystemTools.h2
-rw-r--r--Source/cmTarget.cxx126
-rw-r--r--Source/cmTarget.h9
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.cxx6
-rw-r--r--Source/cmTargetLinkOptionsCommand.cxx41
-rw-r--r--Source/cmTargetLinkOptionsCommand.h41
-rw-r--r--Source/cmTargetSourcesCommand.cxx86
-rw-r--r--Source/cmTargetSourcesCommand.h9
-rw-r--r--Source/cmTestGenerator.cxx2
-rw-r--r--Source/cmTryCompileCommand.h2
-rw-r--r--Source/cmTryRunCommand.h2
-rw-r--r--Source/cmUseMangledMesaCommand.cxx6
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx193
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx6
-rw-r--r--Source/cmVisualStudioGeneratorOptions.h2
-rw-r--r--Source/cmWriteFileCommand.cxx14
-rw-r--r--Source/cmXCodeScheme.cxx167
-rw-r--r--Source/cmXCodeScheme.h10
-rw-r--r--Source/cmXMLParser.cxx4
-rw-r--r--Source/cmake.cxx21
-rw-r--r--Source/cmake.h8
-rw-r--r--Source/cmcmd.cxx12
-rw-r--r--Source/kwsys/CMakeLists.txt16
-rw-r--r--Source/kwsys/SystemInformation.cxx36
-rw-r--r--Source/kwsys/SystemTools.cxx49
-rw-r--r--Source/kwsys/SystemTools.hxx.in8
-rw-r--r--Source/kwsys/Terminal.c49
-rw-r--r--Source/kwsys/testCommandLineArguments.cxx2
-rw-r--r--Source/kwsys/testSystemTools.cxx6
-rw-r--r--Templates/MSBuild/nasm.xml6
-rw-r--r--Tests/BuildDepends/CMakeLists.txt11
-rw-r--r--Tests/BuildDepends/Project/CMakeLists.txt7
-rw-r--r--Tests/CMakeCommands/add_link_options/CMakeLists.txt20
-rw-r--r--Tests/CMakeCommands/add_link_options/LinkOptionsExe.c4
-rw-r--r--Tests/CMakeCommands/target_link_options/CMakeLists.txt26
-rw-r--r--Tests/CMakeCommands/target_link_options/LinkOptionsLib.c7
-rw-r--r--Tests/CMakeCommands/target_sources/CMakeLists.txt36
-rw-r--r--Tests/CMakeCommands/target_sources/empty_1.cpp21
-rw-r--r--Tests/CMakeCommands/target_sources/empty_2.cpp7
-rw-r--r--Tests/CMakeCommands/target_sources/empty_3.cpp7
-rw-r--r--Tests/CMakeCommands/target_sources/main.cpp16
-rw-r--r--Tests/CMakeCommands/target_sources/subdir/CMakeLists.txt6
-rw-r--r--Tests/CMakeCommands/target_sources/subdir/subdir_empty_1.cpp21
-rw-r--r--Tests/CMakeCommands/target_sources/subdir/subdir_empty_2.cpp21
-rw-r--r--Tests/CMakeLib/testRST.expect1
-rw-r--r--Tests/CMakeLib/testRST.rst1
-rw-r--r--Tests/CMakeLists.txt42
-rw-r--r--Tests/CMakeTests/ListTest.cmake.in4
-rw-r--r--Tests/CudaOnly/CMakeLists.txt1
-rw-r--r--Tests/CudaOnly/CircularLinkLine/CMakeLists.txt34
-rw-r--r--Tests/CudaOnly/CircularLinkLine/file1.cu6
-rw-r--r--Tests/CudaOnly/CircularLinkLine/file2.cu6
-rw-r--r--Tests/CudaOnly/CircularLinkLine/file3.cu8
-rw-r--r--Tests/CudaOnly/CircularLinkLine/main.cu5
-rw-r--r--Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu6
-rw-r--r--Tests/ExportImport/Export/CMakeLists.txt30
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt12
-rw-r--r--Tests/ExportImport/Import/A/imp_testLinkOptions.cpp8
-rw-r--r--Tests/FindPackageModeMakefileTest/foo.cpp2
-rw-r--r--Tests/FindPackageModeMakefileTest/foo.h8
-rw-r--r--Tests/FindPackageTest/CMakeLists.txt2
-rw-r--r--Tests/MathTest/CMakeLists.txt33
-rw-r--r--Tests/MathTest/MathTestExec.cxx40
-rw-r--r--Tests/QtAutogen/AutogenTest.cmake4
-rw-r--r--Tests/QtAutogen/CommonTests.cmake9
-rw-r--r--Tests/QtAutogen/DefinesTest/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/MocOsMacros/CMakeLists.txt32
-rw-r--r--Tests/QtAutogen/MocOsMacros/TestClass.cpp77
-rw-r--r--Tests/QtAutogen/MocOsMacros/TestClass.hpp52
-rw-r--r--Tests/QtAutogen/MocOsMacros/main.cpp32
-rw-r--r--Tests/QtAutogen/RerunMocBasic/CMakeLists.txt1
-rw-r--r--Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt1
-rw-r--r--Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt4
-rw-r--r--Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt1
-rw-r--r--Tests/QtAutogen/RerunRccDepends/CMakeLists.txt1
-rw-r--r--Tests/QtAutogen/SameName/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/TestMacros.cmake3
-rw-r--r--Tests/RunCMake/Android/RunCMakeTest.cmake11
-rw-r--r--Tests/RunCMake/Android/common.cmake7
-rw-r--r--Tests/RunCMake/AndroidMK/AndroidMK.cmake6
-rw-r--r--Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt8
-rw-r--r--Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt8
-rw-r--r--Tests/RunCMake/CMakeLists.txt9
-rw-r--r--Tests/RunCMake/CPack/CPackTestHelpers.cmake34
-rw-r--r--Tests/RunCMake/CPack/DEB/Helpers.cmake2
-rw-r--r--Tests/RunCMake/CPack/Ext/Helpers.cmake31
-rw-r--r--Tests/RunCMake/CPack/Ext/Prerequirements.cmake0
-rw-r--r--Tests/RunCMake/CPack/RPM/default_expected_stderr.txt2
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake7
-rw-r--r--Tests/RunCMake/CPack/VerifyResult.cmake8
-rw-r--r--Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake7
-rw-r--r--Tests/RunCMake/CPack/tests/EXT/VerifyResult.cmake3
-rw-r--r--Tests/RunCMake/CPack/tests/EXT/bad_major-stderr.txt6
-rw-r--r--Tests/RunCMake/CPack/tests/EXT/bad_minor-stderr.txt6
-rw-r--r--Tests/RunCMake/CPack/tests/EXT/create_package.cmake24
-rw-r--r--Tests/RunCMake/CPack/tests/EXT/expected-json-1.0.txt176
-rw-r--r--Tests/RunCMake/CPack/tests/EXT/invalid_bad-stderr.txt6
-rw-r--r--Tests/RunCMake/CPack/tests/EXT/stage_and_package-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/tests/EXT/test.cmake86
-rw-r--r--Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake14
-rw-r--r--Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake7
-rw-r--r--Tests/RunCMake/CPack/tests/TIMESTAMPS/ExpectedFiles.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/TIMESTAMPS/VerifyResult.cmake58
-rw-r--r--Tests/RunCMake/CPack/tests/TIMESTAMPS/test.cmake3
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/CommandLine/Wizard-result.txt (renamed from Tests/RunCMake/list/SORT-TooManyArguments-result.txt)0
-rw-r--r--Tests/RunCMake/CommandLine/Wizard-stderr.txt1
-rw-r--r--Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake14
-rw-r--r--Tests/RunCMake/FindPkgConfig/target_subdir/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/LinkStatic/LinkOptionsLib.c7
-rw-r--r--Tests/RunCMake/LinkStatic/RunCMakeTest.cmake27
-rw-r--r--Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-check.cmake4
-rw-r--r--Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-result.txt1
-rw-r--r--Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-check.cmake7
-rw-r--r--Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-result.txt1
-rw-r--r--Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-check.cmake4
-rw-r--r--Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-result.txt1
-rw-r--r--Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS.cmake21
-rw-r--r--Tests/RunCMake/Ninja/PreventTargetAliasesDupBuildRule.cmake41
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake7
-rw-r--r--Tests/RunCMake/Syntax/QueryCache-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/QueryCache.cmake6
-rw-r--r--Tests/RunCMake/Syntax/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt1
-rw-r--r--Tests/RunCMake/TargetSources/CMP0076-OLD-result.txt (renamed from Tests/RunCMake/TargetSources/RelativePathInInterface-result.txt)0
-rw-r--r--Tests/RunCMake/TargetSources/CMP0076-OLD-stderr.txt (renamed from Tests/RunCMake/TargetSources/RelativePathInInterface-stderr.txt)0
-rw-r--r--Tests/RunCMake/TargetSources/CMP0076-OLD.cmake10
-rw-r--r--Tests/RunCMake/TargetSources/CMP0076-WARN-result.txt1
-rw-r--r--Tests/RunCMake/TargetSources/CMP0076-WARN-stderr.txt21
-rw-r--r--Tests/RunCMake/TargetSources/CMP0076-WARN.cmake8
-rw-r--r--Tests/RunCMake/TargetSources/CMP0076-WARN/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/TargetSources/CMP0076-WARN/subdir_empty_1.cpp7
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt1
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInInterface.cmake4
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt1
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx.cmake10
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp7
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt1
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirInclude.cmake8
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp7
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt1
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirInterface.cmake11
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp7
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp7
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt1
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate.cmake8
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp7
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp7
-rw-r--r--Tests/RunCMake/TargetSources/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/UseSWIG/CMP0078-NEW-stdout.txt2
-rw-r--r--Tests/RunCMake/UseSWIG/CMP0078-NEW.cmake2
-rw-r--r--Tests/RunCMake/UseSWIG/CMP0078-OLD-stdout.txt2
-rw-r--r--Tests/RunCMake/UseSWIG/CMP0078-OLD.cmake2
-rw-r--r--Tests/RunCMake/UseSWIG/CMP0078-WARN-stderr.txt9
-rw-r--r--Tests/RunCMake/UseSWIG/CMP0078-WARN-stdout.txt2
-rw-r--r--Tests/RunCMake/UseSWIG/CMP0078-WARN.cmake1
-rw-r--r--Tests/RunCMake/UseSWIG/CMP0078-common.cmake10
-rw-r--r--Tests/RunCMake/UseSWIG/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/UseSWIG/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/UseSWIG/example.i2
-rw-r--r--Tests/RunCMake/VS10Project/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake2
-rw-r--r--Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake2
-rw-r--r--Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake22
-rw-r--r--Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake5
-rw-r--r--Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake22
-rw-r--r--Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake5
-rw-r--r--Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake2
-rw-r--r--Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake2
-rw-r--r--Tests/RunCMake/XcodeProject/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake33
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake37
-rw-r--r--Tests/RunCMake/add_link_options/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/add_link_options/LINKER_SHELL_expansion-build-check.cmake2
-rw-r--r--Tests/RunCMake/add_link_options/LINKER_SHELL_expansion.cmake4
-rw-r--r--Tests/RunCMake/add_link_options/LINKER_expansion-build-check.cmake2
-rw-r--r--Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake36
-rw-r--r--Tests/RunCMake/add_link_options/LINKER_expansion-validation.cmake15
-rw-r--r--Tests/RunCMake/add_link_options/LINKER_expansion.cmake4
-rw-r--r--Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-check.cmake7
-rw-r--r--Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-result.txt1
-rw-r--r--Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-check.cmake7
-rw-r--r--Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-result.txt1
-rw-r--r--Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-check.cmake7
-rw-r--r--Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-result.txt1
-rw-r--r--Tests/RunCMake/add_link_options/LINK_OPTIONS.cmake17
-rw-r--r--Tests/RunCMake/add_link_options/LinkOptionsExe.c4
-rw-r--r--Tests/RunCMake/add_link_options/LinkOptionsLib.c7
-rw-r--r--Tests/RunCMake/add_link_options/RunCMakeTest.cmake38
-rw-r--r--Tests/RunCMake/add_link_options/bad_SHELL_usage-result.txt1
-rw-r--r--Tests/RunCMake/add_link_options/bad_SHELL_usage-stderr.txt4
-rw-r--r--Tests/RunCMake/add_link_options/bad_SHELL_usage.cmake6
-rw-r--r--Tests/RunCMake/add_link_options/dump.c13
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyAddressLeakSanitizer-result.txt1
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-result.txt1
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt1
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-result.txt1
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt1
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt1
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt1
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt1
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-result.txt1
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt1
-rw-r--r--Tests/RunCMake/export/ExportPropertiesUndefined.cmake11
-rw-r--r--Tests/RunCMake/export/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt6
-rw-r--r--Tests/RunCMake/find_program/RelAndAbsPath.cmake63
-rw-r--r--Tests/RunCMake/find_program/RunCMakeTest.cmake1
-rwxr-xr-xTests/RunCMake/find_program/testCWD1
-rw-r--r--Tests/RunCMake/install/CODE-genex-bad-result.txt1
-rw-r--r--Tests/RunCMake/install/CODE-genex-bad-stderr.txt6
-rw-r--r--Tests/RunCMake/install/CODE-genex-bad.cmake1
-rw-r--r--Tests/RunCMake/install/CODE-genex-check.cmake7
-rw-r--r--Tests/RunCMake/install/CODE-genex.cmake2
-rw-r--r--Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake1
-rw-r--r--Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/DIRECTORY-PATTERN.cmake36
-rw-r--r--Tests/RunCMake/install/Deprecated-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/Deprecated.cmake13
-rw-r--r--Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/FILES-OPTIONAL.cmake1
-rw-r--r--Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/FILES-PERMISSIONS.cmake5
-rw-r--r--Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt1
-rw-r--r--Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake10
-rw-r--r--Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake7
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake22
-rw-r--r--Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake1
-rw-r--r--Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake1
-rw-r--r--Tests/RunCMake/install/SCRIPT-COMPONENT.cmake5
-rw-r--r--Tests/RunCMake/install/SCRIPT-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/SCRIPT.cmake4
-rw-r--r--Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake2
-rw-r--r--Tests/RunCMake/install/TARGETS-InstallFromSubDir-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/TARGETS-InstallFromSubDir.cmake4
-rw-r--r--Tests/RunCMake/install/TARGETS-InstallFromSubDir/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt1
-rw-r--r--Tests/RunCMake/install/TARGETS-OPTIONAL.cmake4
-rw-r--r--Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake13
-rw-r--r--Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake27
-rw-r--r--Tests/RunCMake/install/TARGETS-Parts-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/TARGETS-Parts.cmake7
-rw-r--r--Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake14
-rw-r--r--Tests/RunCMake/install/TARGETS-RPATH.cmake14
-rw-r--r--Tests/RunCMake/install/install_script.cmake5
-rw-r--r--Tests/RunCMake/install/obj1.c5
-rw-r--r--Tests/RunCMake/install/obj1.h6
-rw-r--r--Tests/RunCMake/install/pattern/empty.c0
-rw-r--r--Tests/RunCMake/install/pattern/empty.h0
-rw-r--r--Tests/RunCMake/install/pattern/empty.txt0
-rw-r--r--Tests/RunCMake/install/postinstall.cmake1
-rw-r--r--Tests/RunCMake/install/preinstall.cmake1
-rwxr-xr-xTests/RunCMake/install/script (renamed from Tests/SimpleInstallS2/scripts/sample_script)0
-rwxr-xr-xTests/RunCMake/install/script.bat (renamed from Tests/SimpleInstallS2/scripts/sample_script.bat)0
-rw-r--r--Tests/RunCMake/install/testobj1.c9
-rw-r--r--Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt2
-rw-r--r--Tests/RunCMake/list/INSERT-InvalidIndex.cmake2
-rw-r--r--Tests/RunCMake/list/RunCMakeTest.cmake14
-rw-r--r--Tests/RunCMake/list/SORT-BadCaseOption-result.txt1
-rw-r--r--Tests/RunCMake/list/SORT-BadCaseOption-stderr.txt4
-rw-r--r--Tests/RunCMake/list/SORT-BadCaseOption.cmake1
-rw-r--r--Tests/RunCMake/list/SORT-BadCompareOption-result.txt1
-rw-r--r--Tests/RunCMake/list/SORT-BadCompareOption-stderr.txt5
-rw-r--r--Tests/RunCMake/list/SORT-BadCompareOption.cmake1
-rw-r--r--Tests/RunCMake/list/SORT-BadOrderOption-result.txt1
-rw-r--r--Tests/RunCMake/list/SORT-BadOrderOption-stderr.txt5
-rw-r--r--Tests/RunCMake/list/SORT-BadOrderOption.cmake1
-rw-r--r--Tests/RunCMake/list/SORT-DuplicateCaseOption-result.txt1
-rw-r--r--Tests/RunCMake/list/SORT-DuplicateCaseOption-stderr.txt4
-rw-r--r--Tests/RunCMake/list/SORT-DuplicateCaseOption.cmake2
-rw-r--r--Tests/RunCMake/list/SORT-DuplicateCompareOption-result.txt1
-rw-r--r--Tests/RunCMake/list/SORT-DuplicateCompareOption-stderr.txt4
-rw-r--r--Tests/RunCMake/list/SORT-DuplicateCompareOption.cmake2
-rw-r--r--Tests/RunCMake/list/SORT-DuplicateOrderOption-result.txt1
-rw-r--r--Tests/RunCMake/list/SORT-DuplicateOrderOption-stderr.txt4
-rw-r--r--Tests/RunCMake/list/SORT-DuplicateOrderOption.cmake2
-rw-r--r--Tests/RunCMake/list/SORT-NoCaseOption-result.txt1
-rw-r--r--Tests/RunCMake/list/SORT-NoCaseOption-stderr.txt4
-rw-r--r--Tests/RunCMake/list/SORT-NoCaseOption.cmake1
-rw-r--r--Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt4
-rw-r--r--Tests/RunCMake/list/SORT-WrongOption-result.txt1
-rw-r--r--Tests/RunCMake/list/SORT-WrongOption-stderr.txt4
-rw-r--r--Tests/RunCMake/list/SORT-WrongOption.cmake (renamed from Tests/RunCMake/list/SORT-TooManyArguments.cmake)0
-rw-r--r--Tests/RunCMake/list/SORT.cmake114
-rw-r--r--Tests/RunCMake/math/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/math/MATH-DivideByZero-result.txt1
-rw-r--r--Tests/RunCMake/math/MATH-DivideByZero-stderr.txt4
-rw-r--r--Tests/RunCMake/math/MATH-DivideByZero.cmake1
-rw-r--r--Tests/RunCMake/math/MATH-DoubleOption-result.txt1
-rw-r--r--Tests/RunCMake/math/MATH-DoubleOption-stderr.txt4
-rw-r--r--Tests/RunCMake/math/MATH-DoubleOption.cmake1
-rw-r--r--Tests/RunCMake/math/MATH-InvalidExpression-result.txt1
-rw-r--r--Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt5
-rw-r--r--Tests/RunCMake/math/MATH-InvalidExpression.cmake1
-rw-r--r--Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt8
-rw-r--r--Tests/RunCMake/math/MATH-ToleratedExpression.cmake4
-rw-r--r--Tests/RunCMake/math/MATH-TooManyArguments-result.txt1
-rw-r--r--Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt4
-rw-r--r--Tests/RunCMake/math/MATH-TooManyArguments.cmake1
-rw-r--r--Tests/RunCMake/math/MATH-WrongArgument-result.txt1
-rw-r--r--Tests/RunCMake/math/MATH-WrongArgument-stderr.txt4
-rw-r--r--Tests/RunCMake/math/MATH-WrongArgument.cmake1
-rw-r--r--Tests/RunCMake/math/MATH.cmake12
-rw-r--r--Tests/RunCMake/math/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/option/CMP0077-NEW.cmake14
-rw-r--r--Tests/RunCMake/option/CMP0077-OLD.cmake9
-rw-r--r--Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake14
-rw-r--r--Tests/RunCMake/option/CMP0077-WARN-stderr.txt7
-rw-r--r--Tests/RunCMake/option/CMP0077-WARN.cmake5
-rw-r--r--Tests/RunCMake/option/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/option/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/set_property/LINK_OPTIONS-stdout.txt2
-rw-r--r--Tests/RunCMake/set_property/LINK_OPTIONS.cmake3
-rw-r--r--Tests/RunCMake/set_property/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/target_link_options/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/target_link_options/LINKER_expansion-LINKER-check.cmake2
-rw-r--r--Tests/RunCMake/target_link_options/LINKER_expansion-LINKER_SHELL-check.cmake2
-rw-r--r--Tests/RunCMake/target_link_options/LINKER_expansion-validation.cmake15
-rw-r--r--Tests/RunCMake/target_link_options/LINKER_expansion.cmake49
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-check.cmake7
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-result.txt1
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-check.cmake7
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-result.txt1
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-check.cmake4
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-result.txt1
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-check.cmake4
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-result.txt1
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-check.cmake7
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-result.txt1
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-check.cmake7
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-result.txt1
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-static-check.cmake7
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-static-result.txt1
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake55
-rw-r--r--Tests/RunCMake/target_link_options/LinkOptionsExe.c4
-rw-r--r--Tests/RunCMake/target_link_options/LinkOptionsLib.c7
-rw-r--r--Tests/RunCMake/target_link_options/RunCMakeTest.cmake41
-rw-r--r--Tests/RunCMake/target_link_options/bad_SHELL_usage-result.txt1
-rw-r--r--Tests/RunCMake/target_link_options/bad_SHELL_usage-stderr.txt4
-rw-r--r--Tests/RunCMake/target_link_options/bad_SHELL_usage.cmake5
-rw-r--r--Tests/RunCMake/target_link_options/dump.c13
-rw-r--r--Tests/SimpleInstall/CMakeLists.txt398
-rw-r--r--Tests/SimpleInstall/InstallScript1.cmake5
-rw-r--r--Tests/SimpleInstall/InstallScript2.cmake14
-rw-r--r--Tests/SimpleInstall/InstallScript3.cmake12
-rw-r--r--Tests/SimpleInstall/InstallScript4.cmake22
-rw-r--r--Tests/SimpleInstall/PackageScript.cmake10
-rw-r--r--Tests/SimpleInstall/PostInstall.cmake6
-rw-r--r--Tests/SimpleInstall/PreInstall.cmake2
-rw-r--r--Tests/SimpleInstall/TestSubDir/CMakeLists.txt3
-rw-r--r--Tests/SimpleInstall/TestSubDir/TSD.cxx10
-rw-r--r--Tests/SimpleInstall/TestSubDir/TSD.h1
-rw-r--r--Tests/SimpleInstall/TestSubDir/TSD_utils.cxx9
-rw-r--r--Tests/SimpleInstall/foo.c6
-rw-r--r--Tests/SimpleInstall/foo.h10
-rw-r--r--Tests/SimpleInstall/inst.cxx34
-rw-r--r--Tests/SimpleInstall/inst2.cxx2
-rw-r--r--Tests/SimpleInstall/lib1.cxx6
-rw-r--r--Tests/SimpleInstall/lib1.h1
-rw-r--r--Tests/SimpleInstall/lib2.cxx6
-rw-r--r--Tests/SimpleInstall/lib2.h11
-rw-r--r--Tests/SimpleInstall/lib3.cxx6
-rw-r--r--Tests/SimpleInstall/lib3.h11
-rw-r--r--Tests/SimpleInstall/lib4.cxx6
-rw-r--r--Tests/SimpleInstall/lib4.h11
-rw-r--r--Tests/SimpleInstall/scripts/.gitattributes1
-rw-r--r--Tests/SimpleInstall/scripts/CMakeLists.txt1
-rwxr-xr-xTests/SimpleInstall/scripts/sample_script2
-rwxr-xr-xTests/SimpleInstall/scripts/sample_script.bat1
-rw-r--r--Tests/SimpleInstallS2/CMakeLists.txt397
-rw-r--r--Tests/SimpleInstallS2/InstallScript1.cmake5
-rw-r--r--Tests/SimpleInstallS2/InstallScript2.cmake14
-rw-r--r--Tests/SimpleInstallS2/InstallScript3.cmake12
-rw-r--r--Tests/SimpleInstallS2/InstallScript4.cmake22
-rw-r--r--Tests/SimpleInstallS2/PackageScript.cmake10
-rw-r--r--Tests/SimpleInstallS2/PostInstall.cmake6
-rw-r--r--Tests/SimpleInstallS2/PreInstall.cmake2
-rw-r--r--Tests/SimpleInstallS2/TestSubDir/CMakeLists.txt3
-rw-r--r--Tests/SimpleInstallS2/TestSubDir/TSD.cxx10
-rw-r--r--Tests/SimpleInstallS2/TestSubDir/TSD.h1
-rw-r--r--Tests/SimpleInstallS2/TestSubDir/TSD_utils.cxx9
-rw-r--r--Tests/SimpleInstallS2/foo.c6
-rw-r--r--Tests/SimpleInstallS2/foo.h10
-rw-r--r--Tests/SimpleInstallS2/inst.cxx34
-rw-r--r--Tests/SimpleInstallS2/inst2.cxx2
-rw-r--r--Tests/SimpleInstallS2/lib1.cxx6
-rw-r--r--Tests/SimpleInstallS2/lib1.h1
-rw-r--r--Tests/SimpleInstallS2/lib2.cxx6
-rw-r--r--Tests/SimpleInstallS2/lib2.h11
-rw-r--r--Tests/SimpleInstallS2/lib3.cxx6
-rw-r--r--Tests/SimpleInstallS2/lib3.h11
-rw-r--r--Tests/SimpleInstallS2/lib4.cxx6
-rw-r--r--Tests/SimpleInstallS2/lib4.h11
-rw-r--r--Tests/SimpleInstallS2/scripts/.gitattributes1
-rw-r--r--Tests/SimpleInstallS2/scripts/CMakeLists.txt1
-rw-r--r--Tests/UseSWIG/BasicConfiguration.cmake1
-rw-r--r--Tests/UseSWIG/BasicCsharp/CMakeLists.txt2
-rw-r--r--Tests/UseSWIG/BasicPerl/CMakeLists.txt2
-rw-r--r--Tests/UseSWIG/BasicPython/CMakeLists.txt2
-rw-r--r--Tests/UseSWIG/CMakeLists.txt11
-rw-r--r--Tests/UseSWIG/ModuleVersion2/CMakeLists.txt3
-rw-r--r--Tests/UseSWIG/MultipleModules/CMakeLists.txt3
-rw-r--r--Tests/UseSWIG/MultiplePython/CMakeLists.txt3
-rw-r--r--Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt45
-rw-r--r--Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/example.i9
-rw-r--r--Tests/VSNASM/CMakeLists.txt12
-rw-r--r--Tests/VSNASM/bar.asm13
-rw-r--r--Tests/VSNASM/include/foo-proc.asm2
-rw-r--r--Tests/VSNASM/main.c3
-rw-r--r--Utilities/IWYU/mapping.imp3
-rw-r--r--Utilities/Release/CMakeLogo.icobin24542 -> 17542 bytes
-rw-r--r--Utilities/Release/linux64_release.cmake1
-rw-r--r--Utilities/Release/osx_release.cmake1
-rwxr-xr-xUtilities/Scripts/update-liblzma.bash8
-rw-r--r--Utilities/Sphinx/cmake.py3
-rwxr-xr-xUtilities/Sphinx/create_identifiers.py1
-rw-r--r--Utilities/Sphinx/static/cmake-favicon.icobin1150 -> 1150 bytes
-rw-r--r--Utilities/Sphinx/static/cmake-logo-16.pngbin761 -> 893 bytes
-rw-r--r--Utilities/cmliblzma/CMakeLists.txt18
-rw-r--r--Utilities/cmliblzma/COPYING2
-rw-r--r--Utilities/cmliblzma/common/common_w32res.rc2
-rw-r--r--Utilities/cmliblzma/common/sysdefs.h15
-rw-r--r--Utilities/cmliblzma/common/tuklib_integer.h35
-rw-r--r--Utilities/cmliblzma/config.h.in28
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma.h26
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/base.h88
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/block.h74
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/container.h222
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/filter.h13
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/hardware.h14
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/index.h34
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/index_hash.h4
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/lzma12.h (renamed from Utilities/cmliblzma/liblzma/api/lzma/lzma.h)2
-rw-r--r--Utilities/cmliblzma/liblzma/api/lzma/version.h4
-rw-r--r--Utilities/cmliblzma/liblzma/check/check.c12
-rw-r--r--Utilities/cmliblzma/liblzma/check/check.h93
-rw-r--r--Utilities/cmliblzma/liblzma/check/crc32_fast.c8
-rw-r--r--Utilities/cmliblzma/liblzma/check/crc64_fast.c4
-rw-r--r--Utilities/cmliblzma/liblzma/check/sha256.c68
-rw-r--r--Utilities/cmliblzma/liblzma/common/alone_decoder.c73
-rw-r--r--Utilities/cmliblzma/liblzma/common/alone_decoder.h2
-rw-r--r--Utilities/cmliblzma/liblzma/common/alone_encoder.c68
-rw-r--r--Utilities/cmliblzma/liblzma/common/auto_decoder.c51
-rw-r--r--Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c10
-rw-r--r--Utilities/cmliblzma/liblzma/common/block_buffer_encoder.c134
-rw-r--r--Utilities/cmliblzma/liblzma/common/block_buffer_encoder.h24
-rw-r--r--Utilities/cmliblzma/liblzma/common/block_decoder.c67
-rw-r--r--Utilities/cmliblzma/liblzma/common/block_decoder.h2
-rw-r--r--Utilities/cmliblzma/liblzma/common/block_encoder.c52
-rw-r--r--Utilities/cmliblzma/liblzma/common/block_encoder.h2
-rw-r--r--Utilities/cmliblzma/liblzma/common/block_header_decoder.c37
-rw-r--r--Utilities/cmliblzma/liblzma/common/block_header_encoder.c19
-rw-r--r--Utilities/cmliblzma/liblzma/common/block_util.c13
-rw-r--r--Utilities/cmliblzma/liblzma/common/common.c103
-rw-r--r--Utilities/cmliblzma/liblzma/common/common.h138
-rw-r--r--Utilities/cmliblzma/liblzma/common/easy_buffer_encoder.c4
-rw-r--r--Utilities/cmliblzma/liblzma/common/easy_encoder.c1
-rw-r--r--Utilities/cmliblzma/liblzma/common/filter_buffer_decoder.c15
-rw-r--r--Utilities/cmliblzma/liblzma/common/filter_buffer_encoder.c18
-rw-r--r--Utilities/cmliblzma/liblzma/common/filter_common.c129
-rw-r--r--Utilities/cmliblzma/liblzma/common/filter_common.h2
-rw-r--r--Utilities/cmliblzma/liblzma/common/filter_decoder.c87
-rw-r--r--Utilities/cmliblzma/liblzma/common/filter_decoder.h2
-rw-r--r--Utilities/cmliblzma/liblzma/common/filter_encoder.c163
-rw-r--r--Utilities/cmliblzma/liblzma/common/filter_encoder.h6
-rw-r--r--Utilities/cmliblzma/liblzma/common/filter_flags_decoder.c8
-rw-r--r--Utilities/cmliblzma/liblzma/common/filter_flags_encoder.c3
-rw-r--r--Utilities/cmliblzma/liblzma/common/hardware_cputhreads.c (renamed from Utilities/cmliblzma/liblzma/common/stream_encoder.h)17
-rw-r--r--Utilities/cmliblzma/liblzma/common/index.c166
-rw-r--r--Utilities/cmliblzma/liblzma/common/index_decoder.c63
-rw-r--r--Utilities/cmliblzma/liblzma/common/index_encoder.c35
-rw-r--r--Utilities/cmliblzma/liblzma/common/index_encoder.h2
-rw-r--r--Utilities/cmliblzma/liblzma/common/index_hash.c16
-rw-r--r--Utilities/cmliblzma/liblzma/common/memcmplen.h175
-rw-r--r--Utilities/cmliblzma/liblzma/common/outqueue.c184
-rw-r--r--Utilities/cmliblzma/liblzma/common/outqueue.h156
-rw-r--r--Utilities/cmliblzma/liblzma/common/stream_buffer_decoder.c8
-rw-r--r--Utilities/cmliblzma/liblzma/common/stream_buffer_encoder.c25
-rw-r--r--Utilities/cmliblzma/liblzma/common/stream_decoder.c102
-rw-r--r--Utilities/cmliblzma/liblzma/common/stream_decoder.h5
-rw-r--r--Utilities/cmliblzma/liblzma/common/stream_encoder.c108
-rw-r--r--Utilities/cmliblzma/liblzma/common/stream_encoder_mt.c1143
-rw-r--r--Utilities/cmliblzma/liblzma/common/stream_flags_decoder.c8
-rw-r--r--Utilities/cmliblzma/liblzma/common/stream_flags_encoder.c8
-rw-r--r--Utilities/cmliblzma/liblzma/common/vli_decoder.c4
-rw-r--r--Utilities/cmliblzma/liblzma/common/vli_encoder.c2
-rw-r--r--Utilities/cmliblzma/liblzma/common/vli_size.c3
-rw-r--r--Utilities/cmliblzma/liblzma/delta/delta_common.c31
-rw-r--r--Utilities/cmliblzma/liblzma/delta/delta_decoder.c29
-rw-r--r--Utilities/cmliblzma/liblzma/delta/delta_decoder.h5
-rw-r--r--Utilities/cmliblzma/liblzma/delta/delta_encoder.c31
-rw-r--r--Utilities/cmliblzma/liblzma/delta/delta_encoder.h3
-rw-r--r--Utilities/cmliblzma/liblzma/delta/delta_private.h6
-rw-r--r--Utilities/cmliblzma/liblzma/liblzma.pc.in2
-rw-r--r--Utilities/cmliblzma/liblzma/lz/lz_decoder.c97
-rw-r--r--Utilities/cmliblzma/liblzma/lz/lz_decoder.h52
-rw-r--r--Utilities/cmliblzma/liblzma/lz/lz_encoder.c224
-rw-r--r--Utilities/cmliblzma/liblzma/lz/lz_encoder.h21
-rw-r--r--Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h21
-rw-r--r--Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c230
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/fastpos.h57
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c49
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.h5
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c85
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.h4
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma_common.h54
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c253
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma_decoder.h7
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c150
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h16
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c49
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c340
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c8
-rw-r--r--Utilities/cmliblzma/liblzma/lzma/lzma_encoder_private.h28
-rw-r--r--Utilities/cmliblzma/liblzma/rangecoder/range_common.h7
-rw-r--r--Utilities/cmliblzma/liblzma/rangecoder/range_decoder.h16
-rw-r--r--Utilities/cmliblzma/liblzma/rangecoder/range_encoder.h3
-rw-r--r--Utilities/cmliblzma/liblzma/simple/arm.c12
-rw-r--r--Utilities/cmliblzma/liblzma/simple/armthumb.c12
-rw-r--r--Utilities/cmliblzma/liblzma/simple/ia64.c32
-rw-r--r--Utilities/cmliblzma/liblzma/simple/powerpc.c10
-rw-r--r--Utilities/cmliblzma/liblzma/simple/simple_coder.c91
-rw-r--r--Utilities/cmliblzma/liblzma/simple/simple_coder.h36
-rw-r--r--Utilities/cmliblzma/liblzma/simple/simple_decoder.c7
-rw-r--r--Utilities/cmliblzma/liblzma/simple/simple_decoder.h2
-rw-r--r--Utilities/cmliblzma/liblzma/simple/simple_private.h15
-rw-r--r--Utilities/cmliblzma/liblzma/simple/sparc.c13
-rw-r--r--Utilities/cmliblzma/liblzma/simple/x86.c42
-rw-r--r--Utilities/cmlibrhash/librhash/rhash.c2
948 files changed, 19373 insertions, 11375 deletions
diff --git a/.gitignore b/.gitignore
index 22e9800..1a257d2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,6 @@ Testing
# Visual Studio work directory
.vs/
+
+# Visual Studio Code
+.vscode/
diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el
index 8ae57d4..e4fa6c1 100644
--- a/Auxiliary/cmake-mode.el
+++ b/Auxiliary/cmake-mode.el
@@ -55,7 +55,7 @@ set the path with these commands:
(* (or (not (any space "()#\\\n")) (and ?\\ nonl)))))
(defconst cmake-regex-token
(rx-to-string `(group (or (regexp ,cmake-regex-comment)
- ?( ?)
+ ?\( ?\)
(regexp ,cmake-regex-argument-unquoted)
(regexp ,cmake-regex-argument-quoted)))))
(defconst cmake-regex-indented
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim
index 98d6ef1..5c153c1 100644
--- a/Auxiliary/vim/syntax/cmake.vim
+++ b/Auxiliary/vim/syntax/cmake.vim
@@ -110,7 +110,7 @@ syn keyword cmakeKWctest_coverage contained
\ APPEND BUILD CAPTURE_CMAKE_ERROR LABELS QUIET RETURN_VALUE
syn keyword cmakeKWctest_memcheck contained
- \ APPEND BUILD DEFECT_COUNT EXCLUDE EXCLUDE_FIXTURE EXCLUDE_FIXTURE_CLEANUP EXCLUDE_FIXTURE_SETUP EXCLUDE_LABEL INCLUDE INCLUDE_LABEL OFF ON PARALLEL_LEVEL QUIET RETURN_VALUE SCHEDULE_RANDOM START STOP_TIME STRIDE TEST_LOAD
+ \ APPEND BUILD CAPTURE_CMAKE_ERROR DEFECT_COUNT EXCLUDE EXCLUDE_FIXTURE EXCLUDE_FIXTURE_CLEANUP EXCLUDE_FIXTURE_SETUP EXCLUDE_LABEL INCLUDE INCLUDE_LABEL OFF ON PARALLEL_LEVEL QUIET RETURN_VALUE SCHEDULE_RANDOM START STOP_TIME STRIDE TEST_LOAD
syn keyword cmakeKWctest_run_script contained
\ NEW_PROCESS RETURN_VALUE
@@ -119,13 +119,13 @@ syn keyword cmakeKWctest_start contained
\ APPEND QUIET TAG TRACK
syn keyword cmakeKWctest_submit contained
- \ API CDASH_UPLOAD CDASH_UPLOAD_TYPE CTEST_EXTRA_SUBMIT_FILES CTEST_NOTES_FILES FILES HTTPHEADER PARTS QUIET RETRY_COUNT RETRY_DELAY RETURN_VALUE
+ \ API CAPTURE_CMAKE_ERROR CDASH_UPLOAD CDASH_UPLOAD_TYPE CTEST_EXTRA_SUBMIT_FILES CTEST_NOTES_FILES FILES HTTPHEADER PARTS QUIET RETRY_COUNT RETRY_DELAY RETURN_VALUE
syn keyword cmakeKWctest_test contained
\ APPEND BUILD CAPTURE_CMAKE_ERROR CPU EXCLUDE EXCLUDE_FIXTURE EXCLUDE_FIXTURE_CLEANUP EXCLUDE_FIXTURE_SETUP EXCLUDE_LABEL INCLUDE INCLUDE_LABEL OFF ON PARALLEL_LEVEL QUIET RETURN_VALUE SCHEDULE_RANDOM START STOP_TIME STRIDE TEST_LOAD
syn keyword cmakeKWctest_update contained
- \ QUIET RETURN_VALUE SOURCE
+ \ CAPTURE_CMAKE_ERROR QUIET RETURN_VALUE SOURCE
syn keyword cmakeKWctest_upload contained
\ CAPTURE_CMAKE_ERROR FILES QUIET
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e20d770..7f16e79 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -285,7 +285,8 @@ if(CMake_RUN_IWYU)
message(FATAL_ERROR "CMake_RUN_IWYU is ON but include-what-you-use is not found!")
endif()
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE
- "${IWYU_COMMAND};-Xiwyu;--mapping_file=${CMake_SOURCE_DIR}/Utilities/IWYU/mapping.imp;-w;-DCMAKE_IWYU")
+ "${IWYU_COMMAND};-Xiwyu;--mapping_file=${CMake_SOURCE_DIR}/Utilities/IWYU/mapping.imp;-w")
+ list(APPEND CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${CMake_IWYU_OPTIONS})
endif()
@@ -497,7 +498,7 @@ macro (CMAKE_BUILD_UTILITIES)
#---------------------------------------------------------------------
# Build or use system libarchive for CMake and CTest.
if(CMAKE_USE_SYSTEM_LIBARCHIVE)
- find_package(LibArchive 3.0.0)
+ find_package(LibArchive 3.1.0)
if(NOT LibArchive_FOUND)
message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBARCHIVE is ON but LibArchive is not found!")
endif()
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 01987be..84f6abb 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -36,7 +36,9 @@ To contribute patches:
#. Push a topic branch to a personal repository fork on GitLab.
#. Create a GitLab Merge Request targeting the upstream ``master`` branch
(even if the change is intended for merge to the ``release`` branch).
- Check the box to allow edits from maintainers.
+ Check the box labelled "Allow commits from members who can merge to the
+ target branch". This will allow maintainers to make minor edits on your
+ behalf.
The merge request will enter the `CMake Review Process`_ for consideration.
@@ -47,6 +49,20 @@ The merge request will enter the `CMake Review Process`_ for consideration.
.. _`commit messages`: Help/dev/review.rst#commit-messages
.. _`CMake Review Process`: Help/dev/review.rst
+CMake Dashboard Client
+======================
+
+The *integration testing* step of the `CMake Review Process`_ uses a set of
+testing machines that follow an integration branch on their own schedule to
+drive testing and submit results to the `CMake CDash Page`_. Anyone is
+welcome to provide testing machines in order to help keep support for their
+platforms working.
+
+See documentation on `CMake Testing Process`_ for more information.
+
+.. _`CMake CDash Page`: https://open.cdash.org/index.php?project=CMake
+.. _`CMake Testing Process`: Help/dev/testing.rst
+
License
=======
diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in
index eb8b630..18e0078 100644
--- a/CTestCustom.cmake.in
+++ b/CTestCustom.cmake.in
@@ -2,6 +2,7 @@ list(APPEND CTEST_CUSTOM_ERROR_MATCH
"ERROR:")
list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
+ "warning: cast from 'char\\*' to 'cmCursesWidget\\*' increases required alignment of target type" # Occurs when using Solaris's system libform
"xtree.[0-9]+. : warning C4702: unreachable code"
"warning LNK4221"
"warning LNK4204" # Occurs by race condition with objects in small libs
@@ -92,6 +93,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
"cmFortranLexer.cxx:[0-9]+:[0-9]+: warning: Call to 'realloc' has an allocation size of 0 bytes"
"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"
+ "liblzma/common/index_encoder.c:[0-9]+:[0-9]+: warning: Value stored to .* during its initialization is never read"
"libuv/src/.*:[0-9]+:[0-9]+: warning: Dereference of null pointer"
"libuv/src/.*:[0-9]+:[0-9]+: warning: The left operand of '==' is a garbage value"
)
diff --git a/Help/command/LINK_OPTIONS_LINKER.txt b/Help/command/LINK_OPTIONS_LINKER.txt
new file mode 100644
index 0000000..76927be
--- /dev/null
+++ b/Help/command/LINK_OPTIONS_LINKER.txt
@@ -0,0 +1,10 @@
+To pass options to the linker tool, each compiler driver has is own syntax.
+The ``LINKER:`` prefix can be used to specify, in a portable way, options
+to pass to the linker tool. The ``LINKER:`` prefix is replaced by the required
+driver option and the rest of the option string defines linker arguments using
+``,`` as separator. These arguments will be formatted according to the
+:variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG` and
+:variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG_SEP` variables.
+
+For example, ``"LINKER:-z,defs"`` becomes ``-Xlinker -z -Xlinker defs`` for
+``Clang`` and ``-Wl,-z,defs`` for ``GNU GCC``.
diff --git a/Help/command/COMPILE_OPTIONS_SHELL.txt b/Help/command/OPTIONS_SHELL.txt
index a1316c8..530c012 100644
--- a/Help/command/COMPILE_OPTIONS_SHELL.txt
+++ b/Help/command/OPTIONS_SHELL.txt
@@ -1,4 +1,4 @@
-The final set of compile options used for a target is constructed by
+The final set of compile or link options used for a target is constructed by
accumulating options from the current target and the usage requirements of
it dependencies. The set of options is de-duplicated to avoid repetition.
While beneficial for individual options, the de-duplication step can break
diff --git a/Help/command/add_compile_options.rst b/Help/command/add_compile_options.rst
index c445608..350a1c0 100644
--- a/Help/command/add_compile_options.rst
+++ b/Help/command/add_compile_options.rst
@@ -22,4 +22,4 @@ the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
-.. include:: COMPILE_OPTIONS_SHELL.txt
+.. include:: OPTIONS_SHELL.txt
diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst
index f20b274..b7ba724 100644
--- a/Help/command/add_library.rst
+++ b/Help/command/add_library.rst
@@ -153,6 +153,7 @@ the interface target using the commands:
* :command:`set_property`,
* :command:`target_link_libraries(INTERFACE)`,
+* :command:`target_link_options(INTERFACE)`,
* :command:`target_include_directories(INTERFACE)`,
* :command:`target_compile_options(INTERFACE)`,
* :command:`target_compile_definitions(INTERFACE)`, and
diff --git a/Help/command/add_link_options.rst b/Help/command/add_link_options.rst
new file mode 100644
index 0000000..551d440
--- /dev/null
+++ b/Help/command/add_link_options.rst
@@ -0,0 +1,26 @@
+add_link_options
+----------------
+
+Adds options to the link of shared library, module and executable targets.
+
+::
+
+ add_link_options(<option> ...)
+
+Adds options to the link step for targets in the current directory and below
+that are added after this command is invoked. See documentation of the
+:prop_dir:`directory <LINK_OPTIONS>` and
+:prop_tgt:`target <LINK_OPTIONS>` ``LINK_OPTIONS`` properties.
+
+This command can be used to add any options, but alternative commands
+exist to add libraries (:command:`target_link_libraries` or
+:command:`link_libraries`).
+
+Arguments to ``add_link_options`` may use "generator expressions" with
+the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
+manual for available expressions. See the :manual:`cmake-buildsystem(7)`
+manual for more on defining buildsystem properties.
+
+.. include:: LINK_OPTIONS_LINKER.txt
+
+.. include:: OPTIONS_SHELL.txt
diff --git a/Help/command/ctest_submit.rst b/Help/command/ctest_submit.rst
index cc9612b..2ba6bef 100644
--- a/Help/command/ctest_submit.rst
+++ b/Help/command/ctest_submit.rst
@@ -10,6 +10,7 @@ Perform the :ref:`CTest Submit Step` as a :ref:`Dashboard Client`.
[RETRY_COUNT <count>]
[RETRY_DELAY <delay>]
[RETURN_VALUE <result-var>]
+ [CAPTURE_CMAKE_ERROR <result-var>]
[QUIET]
)
@@ -52,6 +53,10 @@ The options are:
Store in the ``<result-var>`` variable ``0`` for success and
non-zero on failure.
+``CAPTURE_CMAKE_ERROR <result-var>``
+ Store in the ``<result-var>`` variable -1 if there are any errors running
+ the command and prevent ctest from returning non-zero if an error occurs.
+
``QUIET``
Suppress all non-error messages that would have otherwise been
printed to the console.
@@ -65,6 +70,7 @@ Submit to CDash Upload API
[HTTPHEADER <header>]
[RETRY_COUNT <count>]
[RETRY_DELAY <delay>]
+ [RETURN_VALUE <result-var>]
[QUIET])
This second signature is used to upload files to CDash via the CDash
@@ -73,5 +79,5 @@ with a content hash of the file. If CDash does not already have the file,
then it is uploaded. Along with the file, a CDash type string is specified
to tell CDash which handler to use to process the data.
-This signature accepts the ``HTTPHEADER``, ``RETRY_COUNT``, ``RETRY_DELAY``, and
-``QUIET`` options as described above.
+This signature accepts the ``HTTPHEADER``, ``RETRY_COUNT``, ``RETRY_DELAY``,
+``RETURN_VALUE`` and ``QUIET`` options as described above.
diff --git a/Help/command/ctest_update.rst b/Help/command/ctest_update.rst
index b205bca..df1a4e5 100644
--- a/Help/command/ctest_update.rst
+++ b/Help/command/ctest_update.rst
@@ -5,7 +5,10 @@ Perform the :ref:`CTest Update Step` as a :ref:`Dashboard Client`.
::
- ctest_update([SOURCE <source-dir>] [RETURN_VALUE <result-var>] [QUIET])
+ ctest_update([SOURCE <source-dir>]
+ [RETURN_VALUE <result-var>]
+ [CAPTURE_CMAKE_ERROR <result-var>]
+ [QUIET])
Update the source tree from version control and record results in
``Update.xml`` for submission with the :command:`ctest_submit` command.
@@ -20,6 +23,10 @@ The options are:
Store in the ``<result-var>`` variable the number of files
updated or ``-1`` on error.
+``CAPTURE_CMAKE_ERROR <result-var>``
+ Store in the ``<result-var>`` variable -1 if there are any errors running
+ the command and prevent ctest from returning non-zero if an error occurs.
+
``QUIET``
Tell CTest to suppress most non-error messages that it would
have otherwise printed to the console. CTest will still report
diff --git a/Help/command/export.rst b/Help/command/export.rst
index 0c676c6..8c49328 100644
--- a/Help/command/export.rst
+++ b/Help/command/export.rst
@@ -51,15 +51,15 @@ unspecified.
::
- export(PACKAGE <name>)
+ export(PACKAGE <PackageName>)
Store the current build directory in the CMake user package registry
-for package ``<name>``. The find_package command may consider the
-directory while searching for package ``<name>``. This helps dependent
+for package ``<PackageName>``. The find_package command may consider the
+directory while searching for package ``<PackageName>``. This helps dependent
projects find and use a package from the current project's build tree
without help from the user. Note that the entry in the package
registry that this command creates works only in conjunction with a
-package configuration file (``<name>Config.cmake``) that works with the
+package configuration file (``<PackageName>Config.cmake``) that works with the
build tree. In some cases, for example for packaging and for system
wide installations, it is not desirable to write the user package
registry. If the :variable:`CMAKE_EXPORT_NO_PACKAGE_REGISTRY` variable
diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst
index a4416ab..bbe8c4d 100644
--- a/Help/command/find_package.rst
+++ b/Help/command/find_package.rst
@@ -5,12 +5,12 @@ Load settings for an external project.
::
- find_package(<package> [version] [EXACT] [QUIET] [MODULE]
+ find_package(<PackageName> [version] [EXACT] [QUIET] [MODULE]
[REQUIRED] [[COMPONENTS] [components...]]
[OPTIONAL_COMPONENTS components...]
[NO_POLICY_SCOPE])
-Finds and loads settings from an external project. ``<package>_FOUND``
+Finds and loads settings from an external project. ``<PackageName>_FOUND``
will be set to indicate whether the package was found. When the
package is found package-specific information is provided through
variables and :ref:`Imported Targets` documented by the package itself. The
@@ -44,7 +44,7 @@ are encouraged to read on.
The command has two modes by which it searches for packages: "Module"
mode and "Config" mode. Module mode is available when the command is
invoked with the above reduced signature. CMake searches for a file
-called ``Find<package>.cmake`` in the :variable:`CMAKE_MODULE_PATH`
+called ``Find<PackageName>.cmake`` in the :variable:`CMAKE_MODULE_PATH`
followed by the CMake installation. If the file is found, it is read
and processed by CMake. It is responsible for finding the package,
checking the version, and producing any needed messages. Many
@@ -54,7 +54,7 @@ option is not given the command proceeds to Config mode.
The complete Config mode command signature is::
- find_package(<package> [version] [EXACT] [QUIET]
+ find_package(<PackageName> [version] [EXACT] [QUIET]
[REQUIRED] [[COMPONENTS] [components...]]
[CONFIG|NO_MODULE]
[NO_POLICY_SCOPE]
@@ -82,29 +82,29 @@ mode is also implied by use of options not specified in the reduced
signature.
Config mode attempts to locate a configuration file provided by the
-package to be found. A cache entry called ``<package>_DIR`` is created to
+package to be found. A cache entry called ``<PackageName>_DIR`` is created to
hold the directory containing the file. By default the command
-searches for a package with the name ``<package>``. If the ``NAMES`` option
-is given the names following it are used instead of ``<package>``. The
-command searches for a file called ``<name>Config.cmake`` or
-``<lower-case-name>-config.cmake`` for each name specified. A
-replacement set of possible configuration file names may be given
+searches for a package with the name ``<PackageName>``. If the ``NAMES`` option
+is given the names following it are used instead of ``<PackageName>``.
+The command searches for a file called ``<PackageName>Config.cmake`` or
+``<lower-case-package-name>-config.cmake`` for each name specified.
+A replacement set of possible configuration file names may be given
using the ``CONFIGS`` option. The search procedure is specified below.
Once found, the configuration file is read and processed by CMake.
Since the file is provided by the package it already knows the
location of package contents. The full path to the configuration file
-is stored in the cmake variable ``<package>_CONFIG``.
+is stored in the cmake variable ``<PackageName>_CONFIG``.
All configuration files which have been considered by CMake while
searching for an installation of the package with an appropriate
-version are stored in the cmake variable ``<package>_CONSIDERED_CONFIGS``,
-the associated versions in ``<package>_CONSIDERED_VERSIONS``.
+version are stored in the cmake variable ``<PackageName>_CONSIDERED_CONFIGS``,
+the associated versions in ``<PackageName>_CONSIDERED_VERSIONS``.
If the package configuration file cannot be found CMake will generate
an error describing the problem unless the ``QUIET`` argument is
specified. If ``REQUIRED`` is specified and the package is not found a
fatal error is generated and the configure step stops executing. If
-``<package>_DIR`` has been set to a directory not containing a
+``<PackageName>_DIR`` has been set to a directory not containing a
configuration file CMake will ignore it and search from scratch.
When the ``[version]`` argument is given Config mode will only find a
@@ -127,7 +127,7 @@ version file is loaded in a nested scope in which the following
variables have been defined:
``PACKAGE_FIND_NAME``
- the ``<package>`` name
+ the ``<PackageName>``
``PACKAGE_FIND_VERSION``
full requested version string
``PACKAGE_FIND_VERSION_MAJOR``
@@ -158,17 +158,17 @@ whether the configuration file provides an acceptable version. They
are not available after the find_package call returns. If the version
is acceptable the following variables are set:
-``<package>_VERSION``
+``<PackageName>_VERSION``
full provided version string
-``<package>_VERSION_MAJOR``
+``<PackageName>_VERSION_MAJOR``
major version if provided, else 0
-``<package>_VERSION_MINOR``
+``<PackageName>_VERSION_MINOR``
minor version if provided, else 0
-``<package>_VERSION_PATCH``
+``<PackageName>_VERSION_PATCH``
patch version if provided, else 0
-``<package>_VERSION_TWEAK``
+``<PackageName>_VERSION_TWEAK``
tweak version if provided, else 0
-``<package>_VERSION_COUNT``
+``<PackageName>_VERSION_COUNT``
number of version components, 0 to 4
and the corresponding package configuration file is loaded.
@@ -192,7 +192,7 @@ Much of the interface is provided for completeness and for use
internally by find-modules loaded by Module mode. Most user code
should simply call::
- find_package(<package> [major[.minor]] [EXACT] [REQUIRED|QUIET])
+ find_package(<PackageName> [major[.minor]] [EXACT] [REQUIRED|QUIET])
in order to find a package. Package maintainers providing CMake
package configuration files are encouraged to name and install them
@@ -228,7 +228,7 @@ containing a configuration file::
<prefix>/<name>.app/Contents/Resources/CMake/ (A)
In all cases the ``<name>`` is treated as case-insensitive and corresponds
-to any of the names specified (``<package>`` or names given by ``NAMES``).
+to any of the names specified (``<PackageName>`` or names given by ``NAMES``).
Paths with ``lib/<arch>`` are enabled if the
:variable:`CMAKE_LIBRARY_ARCHITECTURE` variable is set. ``lib*`` includes one
@@ -286,7 +286,7 @@ enabled.
(``;`` on Windows and ``:`` on UNIX).
This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed::
- <package>_DIR
+ <PackageName>_DIR
CMAKE_PREFIX_PATH
CMAKE_FRAMEWORK_PATH
CMAKE_APPBUNDLE_PATH
@@ -329,7 +329,7 @@ enabled.
hard-coded guesses.
.. |FIND_XXX| replace:: find_package
-.. |FIND_ARGS_XXX| replace:: <package>
+.. |FIND_ARGS_XXX| replace:: <PackageName>
.. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace::
:variable:`CMAKE_FIND_ROOT_PATH_MODE_PACKAGE`
@@ -344,28 +344,28 @@ defines variables to provide information about the call arguments (and
restores their original state before returning):
``CMAKE_FIND_PACKAGE_NAME``
- the ``<package>`` name which is searched for
-``<package>_FIND_REQUIRED``
+ the ``<PackageName>`` which is searched for
+``<PackageName>_FIND_REQUIRED``
true if ``REQUIRED`` option was given
-``<package>_FIND_QUIETLY``
+``<PackageName>_FIND_QUIETLY``
true if ``QUIET`` option was given
-``<package>_FIND_VERSION``
+``<PackageName>_FIND_VERSION``
full requested version string
-``<package>_FIND_VERSION_MAJOR``
+``<PackageName>_FIND_VERSION_MAJOR``
major version if requested, else 0
-``<package>_FIND_VERSION_MINOR``
+``<PackageName>_FIND_VERSION_MINOR``
minor version if requested, else 0
-``<package>_FIND_VERSION_PATCH``
+``<PackageName>_FIND_VERSION_PATCH``
patch version if requested, else 0
-``<package>_FIND_VERSION_TWEAK``
+``<PackageName>_FIND_VERSION_TWEAK``
tweak version if requested, else 0
-``<package>_FIND_VERSION_COUNT``
+``<PackageName>_FIND_VERSION_COUNT``
number of version components, 0 to 4
-``<package>_FIND_VERSION_EXACT``
+``<PackageName>_FIND_VERSION_EXACT``
true if ``EXACT`` option was given
-``<package>_FIND_COMPONENTS``
+``<PackageName>_FIND_COMPONENTS``
list of requested components
-``<package>_FIND_REQUIRED_<c>``
+``<PackageName>_FIND_REQUIRED_<c>``
true if component ``<c>`` is required,
false if component ``<c>`` is optional
@@ -375,7 +375,7 @@ In Config mode ``find_package`` handles ``REQUIRED``, ``QUIET``, and
``[version]`` options automatically but leaves it to the package
configuration file to handle components in a way that makes sense
for the package. The package configuration file may set
-``<package>_FOUND`` to false to tell ``find_package`` that component
+``<PackageName>_FOUND`` to false to tell ``find_package`` that component
requirements are not satisfied.
See the :command:`cmake_policy` command documentation for discussion
diff --git a/Help/command/include_directories.rst b/Help/command/include_directories.rst
index f694934..e797b5d 100644
--- a/Help/command/include_directories.rst
+++ b/Help/command/include_directories.rst
@@ -33,3 +33,9 @@ Arguments to ``include_directories`` may use "generator expressions" with
the syntax "$<...>". See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
+
+.. note::
+
+ Prefer the :command:`target_include_directories` command to add include
+ directories to individual targets and optionally propagate/export them
+ to dependents.
diff --git a/Help/command/install.rst b/Help/command/install.rst
index 6cea996..8b2a971 100644
--- a/Help/command/install.rst
+++ b/Help/command/install.rst
@@ -280,6 +280,14 @@ targets that link to the object libraries in their implementation.
Installing a target with the :prop_tgt:`EXCLUDE_FROM_ALL` target property
set to ``TRUE`` has undefined behavior.
+:command:`install(TARGETS)` can install targets that were created in
+other directories. When using such cross-directory install rules, running
+``make install`` (or similar) from a subdirectory will not guarantee that
+targets from other directories are up-to-date. You can use
+:command:`target_link_libraries` or :command:`add_dependencies`
+to ensure that such out-of-directory targets are built before the
+subdirectory-specific install rules are run.
+
The install destination given to the target install ``DESTINATION`` may
use "generator expressions" with the syntax ``$<...>``. See the
:manual:`cmake-generator-expressions(7)` manual for available expressions.
@@ -427,6 +435,10 @@ example, the code
will print a message during installation.
+The contents of ``SCRIPT`` or ``CODE`` may use "generator expressions" with
+the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
+manual for available expressions.
+
Installing Exports
^^^^^^^^^^^^^^^^^^
diff --git a/Help/command/list.rst b/Help/command/list.rst
index 589e572..ad2c428 100644
--- a/Help/command/list.rst
+++ b/Help/command/list.rst
@@ -28,7 +28,7 @@ Synopsis
`Ordering`_
list(`REVERSE`_ <list>)
- list(`SORT`_ <list>)
+ list(`SORT`_ <list> [...])
Introduction
^^^^^^^^^^^^
@@ -253,7 +253,23 @@ Reverses the contents of the list in-place.
::
- list(SORT <list>)
-
+ list(SORT <list> [COMPARE <compare>] [CASE <case>] [ORDER <order>])
Sorts the list in-place alphabetically.
+Use the option ``<compare>`` to select the compare type for sorting.
+The ``<compare>`` option may be one of:
+
+* ``STRING``: Sorts a list of strings alphabetically.
+* ``FILE_BASENAME``: Sort a list of pathnames of files by their basenames.
+
+Use the option ``<case>`` to select a case sensitive or case insensitive sort mode.
+The ``<case>`` option may be one of:
+
+* ``SENSITIVE``: Sorts the list alphabetically.
+* ``INSENSITIVE``: Sorts the list alphabetically in descending order.
+
+Use the option ``<order>`` to select a case sensitive or case insensitive sort mode.
+The ``<order>`` option may be one of:
+
+* ``ASCENDING``: Sorts the list in ascending order.
+* ``DESCENDING``: Sorts the list in descending order.
diff --git a/Help/command/math.rst b/Help/command/math.rst
index f99dc3d..63af931 100644
--- a/Help/command/math.rst
+++ b/Help/command/math.rst
@@ -5,10 +5,26 @@ Mathematical expressions.
::
- math(EXPR <output-variable> <math-expression>)
+ math(EXPR <output-variable> <math-expression> [OUTPUT_FORMAT <format>])
``EXPR`` evaluates mathematical expression and returns result in the
output variable. Example mathematical expression is ``5 * (10 + 13)``.
Supported operators are ``+``, ``-``, ``*``, ``/``, ``%``, ``|``, ``&``,
``^``, ``~``, ``<<``, ``>>``, and ``(...)``. They have the same meaning
as they do in C code.
+
+Numeric constants are evaluated in decimal or hexadecimal representation.
+
+The result is formatted according to the option "OUTPUT_FORMAT" ,
+where ``<format>`` is one of:
+::
+
+ HEXADECIMAL = Result in output variable will be formatted in C code
+ Hexadecimal notation.
+ DECIMAL = Result in output variable will be formatted in decimal notation.
+
+
+For example::
+
+ math(EXPR value "100 * 0xA" DECIMAL) results in value is set to "1000"
+ math(EXPR value "100 * 0xA" HEXADECIMAL) results in value is set to "0x3e8"
diff --git a/Help/command/option.rst b/Help/command/option.rst
index 91cd0a7..4fabb87 100644
--- a/Help/command/option.rst
+++ b/Help/command/option.rst
@@ -9,7 +9,9 @@ Provides an option that the user can optionally select.
[initial value])
Provide an option for the user to select as ``ON`` or ``OFF``. If no
-initial value is provided, ``OFF`` is used.
+initial value is provided, ``OFF`` is used. If the option is already
+set as a normal variable then the command does nothing
+(see policy :policy:`CMP0077`).
If you have options that depend on the values of other options, see
the module help for :module:`CMakeDependentOption`.
diff --git a/Help/command/string.rst b/Help/command/string.rst
index efa923b..29a153a 100644
--- a/Help/command/string.rst
+++ b/Help/command/string.rst
@@ -151,6 +151,20 @@ has lower precedence than concatenation. This means that the regular
expression ``^ab+d$`` matches ``abbd`` but not ``ababd``, and the regular
expression ``^(ab|cd)$`` matches ``ab`` but not ``abd``.
+Backslash (``\``) characters in regular expressions are interpreted
+literally and do not escape anything or represent placeholders.
+However, CMake language :ref:`Escape Sequences` such as ``\t``,
+``\r``, ``\n``, and ``\\`` may be used to construct literal tabs,
+carriage returns, newlines, and backslashes (respectively) to pass
+in a regex. For example:
+
+* The quoted argument ``"[ \t\r\n]"`` specifies a regex that matches
+ any single whitespace character.
+* The quoted argument ``"[/\\]"`` specifies a regex that matches
+ a single forward slash ``/`` or backslash ``\``.
+* The quoted argument ``"[A-Za-z0-9_]"`` specifies a regex that matches
+ any single "word" character in the C locale.
+
Manipulation
^^^^^^^^^^^^
diff --git a/Help/command/target_compile_options.rst b/Help/command/target_compile_options.rst
index 194d008..88b7f15 100644
--- a/Help/command/target_compile_options.rst
+++ b/Help/command/target_compile_options.rst
@@ -39,4 +39,4 @@ with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
-.. include:: COMPILE_OPTIONS_SHELL.txt
+.. include:: OPTIONS_SHELL.txt
diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst
index fcc2c07..1f0d69e 100644
--- a/Help/command/target_link_libraries.rst
+++ b/Help/command/target_link_libraries.rst
@@ -70,7 +70,8 @@ Each ``<item>`` may be:
Link flags specified here are inserted into the link command in the same
place as the link libraries. This might not be correct, depending on
- the linker. Use the :prop_tgt:`LINK_FLAGS` target property to add link
+ the linker. Use the :prop_tgt:`LINK_OPTIONS` target property or
+ :command:`target_link_options` command to add link
flags explicitly. The flags will then be placed at the toolchain-defined
flag position in the link command.
diff --git a/Help/command/target_link_options.rst b/Help/command/target_link_options.rst
new file mode 100644
index 0000000..8f47180
--- /dev/null
+++ b/Help/command/target_link_options.rst
@@ -0,0 +1,42 @@
+target_link_options
+-------------------
+
+Add link options to a target.
+
+::
+
+ target_link_options(<target> [BEFORE]
+ <INTERFACE|PUBLIC|PRIVATE> [items1...]
+ [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
+
+Specify link options to use when linking a given target. The
+named ``<target>`` must have been created by a command such as
+:command:`add_executable` or :command:`add_library` and must not be an
+:ref:`ALIAS target <Alias Targets>`.
+
+If ``BEFORE`` is specified, the content will be prepended to the property
+instead of being appended.
+
+This command can be used to add any options, but
+alternative commands exist to add libraries
+(:command:`target_link_libraries` and :command:`link_libraries`).
+See documentation of the :prop_dir:`directory <LINK_OPTIONS>` and
+:prop_tgt:`target <LINK_OPTIONS>` ``LINK_OPTIONS`` properties.
+
+The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to
+specify the scope of the following arguments. ``PRIVATE`` and ``PUBLIC``
+items will populate the :prop_tgt:`LINK_OPTIONS` property of
+``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the
+:prop_tgt:`INTERFACE_LINK_OPTIONS` property of ``<target>``.
+(:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items.)
+The following arguments specify link options. Repeated calls for the same
+``<target>`` append items in the order called.
+
+Arguments to ``target_link_options`` may use "generator expressions"
+with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
+manual for available expressions. See the :manual:`cmake-buildsystem(7)`
+manual for more on defining buildsystem properties.
+
+.. include:: LINK_OPTIONS_LINKER.txt
+
+.. include:: OPTIONS_SHELL.txt
diff --git a/Help/command/target_sources.rst b/Help/command/target_sources.rst
index a4f5196..5dd8d86 100644
--- a/Help/command/target_sources.rst
+++ b/Help/command/target_sources.rst
@@ -9,7 +9,9 @@ Add sources to a target.
<INTERFACE|PUBLIC|PRIVATE> [items1...]
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
-Specify sources to use when compiling a given target. The
+Specify sources to use when compiling a given target. Relative
+source file paths are interpreted as being relative to the current
+source directory (i.e. :variable:`CMAKE_CURRENT_SOURCE_DIR`). The
named ``<target>`` must have been created by a command such as
:command:`add_executable` or :command:`add_library` and must not be an
:ref:`ALIAS target <Alias Targets>`.
@@ -27,3 +29,6 @@ Arguments to ``target_sources`` may use "generator expressions"
with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
+
+See also the :policy:`CMP0076` policy for older behavior related to the
+handling of relative source file paths.
diff --git a/Help/command/unset.rst b/Help/command/unset.rst
index a1fc95c..c19dd31 100644
--- a/Help/command/unset.rst
+++ b/Help/command/unset.rst
@@ -7,9 +7,16 @@ Unset a variable, cache variable, or environment variable.
unset(<variable> [CACHE | PARENT_SCOPE])
-Removes the specified variable causing it to become undefined. If
-``CACHE`` is present then the variable is removed from the cache instead
-of the current scope.
+Removes a normal variable from the current scope, causing it
+to become undefined. If ``CACHE`` is present, then a cache variable
+is removed instead of a normal variable. Note that when evaluating
+:ref:`Variable References` of the form ``${VAR}``, CMake first searches
+for a normal variable with that name. If no such normal variable exists,
+CMake will then search for a cache entry with that name. Because of this
+unsetting a normal variable can expose a cache variable that was previously
+hidden. To force a variable reference of the form ``${VAR}`` to return an
+empty string, use ``set(<variable> "")``, which clears the normal variable
+but leaves it defined.
If ``PARENT_SCOPE`` is present then the variable is removed from the scope
above the current scope. See the same option in the :command:`set` command
diff --git a/Help/cpack_gen/archive.rst b/Help/cpack_gen/archive.rst
new file mode 100644
index 0000000..b288aad
--- /dev/null
+++ b/Help/cpack_gen/archive.rst
@@ -0,0 +1,35 @@
+CPack Archive Generator
+-----------------------
+
+Archive CPack generator that supports packaging of sources and binaries in
+different formats:
+
+ - 7Z - 7zip - (.7z)
+ - TBZ2 (.tar.bz2)
+ - TGZ (.tar.gz)
+ - TXZ (.tar.xz)
+ - TZ (.tar.Z)
+ - ZIP (.zip)
+
+Variables specific to CPack Archive generator
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. variable:: CPACK_ARCHIVE_FILE_NAME
+ CPACK_ARCHIVE_<component>_FILE_NAME
+
+ Package file name without extension which is added automatically depending
+ on the archive format.
+
+ * Mandatory : YES
+ * Default : ``<CPACK_PACKAGE_FILE_NAME>[-<component>].<extension>`` with
+ spaces replaced by '-'
+
+.. variable:: CPACK_ARCHIVE_COMPONENT_INSTALL
+
+ Enable component packaging for CPackArchive
+
+ * Mandatory : NO
+ * Default : OFF
+
+ If enabled (ON) multiple packages are generated. By default a single package
+ containing files of all components is generated.
diff --git a/Help/cpack_gen/bundle.rst b/Help/cpack_gen/bundle.rst
new file mode 100644
index 0000000..4628968
--- /dev/null
+++ b/Help/cpack_gen/bundle.rst
@@ -0,0 +1,64 @@
+CPack Bundle Generator
+----------------------
+
+CPack Bundle generator (Mac OS X) specific options
+
+Variables specific to CPack Bundle generator
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Installers built on Mac OS X using the Bundle generator use the
+aforementioned DragNDrop (CPACK_DMG_xxx) variables, plus the following
+Bundle-specific parameters (CPACK_BUNDLE_xxx).
+
+.. variable:: CPACK_BUNDLE_NAME
+
+ The name of the generated bundle. This appears in the OSX finder as the
+ bundle name. Required.
+
+.. variable:: CPACK_BUNDLE_PLIST
+
+ Path to an OSX plist file that will be used for the generated bundle. This
+ assumes that the caller has generated or specified their own Info.plist
+ file. Required.
+
+.. variable:: CPACK_BUNDLE_ICON
+
+ Path to an OSX icon file that will be used as the icon for the generated
+ bundle. This is the icon that appears in the OSX finder for the bundle, and
+ in the OSX dock when the bundle is opened. Required.
+
+.. variable:: CPACK_BUNDLE_STARTUP_COMMAND
+
+ Path to a startup script. This is a path to an executable or script that
+ will be run whenever an end-user double-clicks the generated bundle in the
+ OSX Finder. Optional.
+
+.. variable:: CPACK_BUNDLE_APPLE_CERT_APP
+
+ The name of your Apple supplied code signing certificate for the application.
+ The name usually takes the form "Developer ID Application: [Name]" or
+ "3rd Party Mac Developer Application: [Name]". If this variable is not set
+ the application will not be signed.
+
+.. variable:: CPACK_BUNDLE_APPLE_ENTITLEMENTS
+
+ The name of the plist file that contains your apple entitlements for sandboxing
+ your application. This file is required for submission to the Mac App Store.
+
+.. variable:: CPACK_BUNDLE_APPLE_CODESIGN_FILES
+
+ A list of additional files that you wish to be signed. You do not need to
+ list the main application folder, or the main executable. You should
+ list any frameworks and plugins that are included in your app bundle.
+
+.. variable:: CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER
+
+ Additional parameter that will passed to codesign.
+ Default value: "--deep -f"
+
+.. variable:: CPACK_COMMAND_CODESIGN
+
+ Path to the codesign(1) command used to sign applications with an
+ Apple cert. This variable can be used to override the automatically
+ detected command (or specify its location if the auto-detection fails
+ to find it.)
diff --git a/Help/cpack_gen/cygwin.rst b/Help/cpack_gen/cygwin.rst
new file mode 100644
index 0000000..1c5f7af
--- /dev/null
+++ b/Help/cpack_gen/cygwin.rst
@@ -0,0 +1,23 @@
+CPack Cygwin Generator
+----------------------
+
+Cygwin CPack generator (Cygwin).
+
+Variables specific to CPack Cygwin generator
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The
+following variable is specific to installers build on and/or for
+Cygwin:
+
+.. variable:: CPACK_CYGWIN_PATCH_NUMBER
+
+ The Cygwin patch number. FIXME: This documentation is incomplete.
+
+.. variable:: CPACK_CYGWIN_PATCH_FILE
+
+ The Cygwin patch file. FIXME: This documentation is incomplete.
+
+.. variable:: CPACK_CYGWIN_BUILD_SCRIPT
+
+ The Cygwin build script. FIXME: This documentation is incomplete.
diff --git a/Help/cpack_gen/deb.rst b/Help/cpack_gen/deb.rst
new file mode 100644
index 0000000..37d750d
--- /dev/null
+++ b/Help/cpack_gen/deb.rst
@@ -0,0 +1,537 @@
+CPack Deb Generator
+-------------------
+
+The built in (binary) CPack Deb generator (Unix only)
+
+Variables specific to CPack Debian (DEB) generator
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The CPack Deb generator may be used to create Deb package using :module:`CPack`.
+The CPack Deb generator is a :module:`CPack` generator thus it uses the
+``CPACK_XXX`` variables used by :module:`CPack`.
+
+The CPack Deb 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.
+
+The CPack Deb generator 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.
+
+Here are some CPack Deb generator wiki resources that are here for historic
+reasons and are no longer maintained but may still prove useful:
+
+ - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/Configuration
+ - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/PackageGenerators#deb-unix-only
+
+List of CPack Deb generator specific variables:
+
+.. variable:: CPACK_DEB_COMPONENT_INSTALL
+
+ Enable component packaging for CPackDEB
+
+ * 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_DEBIAN_PACKAGE_NAME
+ CPACK_DEBIAN_<COMPONENT>_PACKAGE_NAME
+
+ Set Package control field (variable is automatically transformed to lower
+ case).
+
+ * Mandatory : YES
+ * Default :
+
+ - :variable:`CPACK_PACKAGE_NAME` for non-component based
+ installations
+ - :variable:`CPACK_DEBIAN_PACKAGE_NAME` suffixed with -<COMPONENT>
+ for component-based installations.
+
+ 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 the CPack Deb generator to generate
+ package file name by itself in deb format::
+
+ <PackageName>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb
+
+ Alternatively provided package file name must end
+ with either ``.deb`` or ``.ipk`` suffix.
+
+ .. note::
+
+ Preferred setting of this variable is ``DEB-DEFAULT`` but for backward
+ compatibility with the CPack Deb generator 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_EPOCH
+
+ The Debian package epoch
+
+ * Mandatory : No
+ * Default : -
+
+ Optional number that should be incremented when changing versioning schemas
+ or fixing mistakes in the version numbers of older packages.
+
+.. variable:: CPACK_DEBIAN_PACKAGE_VERSION
+
+ The Debian package version
+
+ * Mandatory : YES
+ * Default : :variable:`CPACK_PACKAGE_VERSION`
+
+ This variable may contain only alphanumerics (A-Za-z0-9) and the characters
+ . + - ~ (full stop, plus, hyphen, tilde) and should start with a digit. If
+ :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` is not set then hyphens are not
+ allowed.
+
+ .. note::
+
+ For backward compatibility with CMake 3.9 and lower a failed test of this
+ variable's content is not a hard error when both
+ :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` and
+ :variable:`CPACK_DEBIAN_PACKAGE_EPOCH` variables are not set. An author
+ warning is reported instead.
+
+.. variable:: CPACK_DEBIAN_PACKAGE_RELEASE
+
+ The Debian package release - Debian revision number.
+
+ * Mandatory : No
+ * Default : -
+
+ This is the numbering of the DEB package itself, i.e. the version of the
+ packaging and not the version of the content (see
+ :variable:`CPACK_DEBIAN_PACKAGE_VERSION`). One may change the default value
+ if the previous packaging was buggy and/or you want to put here a fancy Linux
+ distro specific numbering.
+
+.. variable:: CPACK_DEBIAN_PACKAGE_ARCHITECTURE
+ CPACK_DEBIAN_<COMPONENT>_PACKAGE_ARCHITECTURE
+
+ The Debian package architecture
+
+ * Mandatory : YES
+ * 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
+
+ Sets the Debian dependencies of this package.
+
+ * Mandatory : NO
+ * Default :
+
+ - An empty string for non-component based installations
+ - :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS` for component-based
+ installations.
+
+ .. note::
+
+ If :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` or
+ more specifically :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS`
+ is set for this component, the discovered dependencies will be appended
+ to :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` instead of
+ :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS`. If
+ :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` is an empty string,
+ only the automatically discovered dependencies will be set for this
+ component.
+
+ Example::
+
+ 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
+
+ The Debian package maintainer
+
+ * Mandatory : YES
+ * Default : :code:`CPACK_PACKAGE_CONTACT`
+
+.. variable:: CPACK_DEBIAN_PACKAGE_DESCRIPTION
+ CPACK_COMPONENT_<COMPONENT>_DESCRIPTION
+
+ The Debian package description
+
+ * Mandatory : YES
+ * Default :
+
+ - :variable:`CPACK_DEBIAN_PACKAGE_DESCRIPTION` if set or
+ - :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`
+
+
+.. variable:: CPACK_DEBIAN_PACKAGE_SECTION
+ CPACK_DEBIAN_<COMPONENT>_PACKAGE_SECTION
+
+ Set Section control field e.g. admin, devel, doc, ...
+
+ * Mandatory : YES
+ * Default : "devel"
+
+ See https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
+
+.. variable:: CPACK_DEBIAN_ARCHIVE_TYPE
+
+ The archive format used for creating the Debian package.
+
+ * Mandatory : YES
+ * Default : "paxr"
+
+ Possible values are:
+
+ - paxr
+ - gnutar
+
+ .. note::
+
+ Default pax archive format is the most portable format and generates
+ packages that do not treat sparse files specially.
+ GNU tar format on the other hand supports longer filenames.
+
+.. variable:: CPACK_DEBIAN_COMPRESSION_TYPE
+
+ The compression used for creating the Debian package.
+
+ * Mandatory : YES
+ * Default : "gzip"
+
+ Possible values are:
+
+ - lzma
+ - xz
+ - bzip2
+ - gzip
+
+.. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY
+ CPACK_DEBIAN_<COMPONENT>_PACKAGE_PRIORITY
+
+ Set Priority control field e.g. required, important, standard, optional,
+ extra
+
+ * Mandatory : YES
+ * 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
+ site from which the original source can be obtained and any additional
+ upstream documentation or information may be found.
+
+ * Mandatory : NO
+ * Default : :variable:`CMAKE_PROJECT_HOMEPAGE_URL`
+
+ .. note::
+
+ 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
+
+ May be set to ON in order to use :code:`dpkg-shlibdeps` to generate
+ better package dependency list.
+
+ * Mandatory : NO
+ * Default :
+
+ - :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` if set or
+ - OFF
+
+ .. note::
+
+ You may need set :variable:`CMAKE_INSTALL_RPATH` to an appropriate value
+ if you use this feature, because if you don't :code:`dpkg-shlibdeps`
+ may fail to find your own shared libs.
+ See https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling
+
+.. variable:: CPACK_DEBIAN_PACKAGE_DEBUG
+
+ May be set when invoking cpack in order to trace debug information
+ during the CPack Deb generator run.
+
+ * Mandatory : NO
+ * Default : -
+
+.. variable:: CPACK_DEBIAN_PACKAGE_PREDEPENDS
+ CPACK_DEBIAN_<COMPONENT>_PACKAGE_PREDEPENDS
+
+ Sets the `Pre-Depends` field of the Debian package.
+ Like :variable:`Depends <CPACK_DEBIAN_PACKAGE_DEPENDS>`, except that it
+ also forces :code:`dpkg` to complete installation of the packages named
+ before even starting the installation of the package which declares the
+ pre-dependency.
+
+ * Mandatory : NO
+ * Default :
+
+ - An empty string for non-component based installations
+ - :variable:`CPACK_DEBIAN_PACKAGE_PREDEPENDS` for component-based
+ installations.
+
+ See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
+
+.. variable:: CPACK_DEBIAN_PACKAGE_ENHANCES
+ CPACK_DEBIAN_<COMPONENT>_PACKAGE_ENHANCES
+
+ Sets the `Enhances` field of the Debian package.
+ Similar to :variable:`Suggests <CPACK_DEBIAN_PACKAGE_SUGGESTS>` but works
+ in the opposite direction: declares that a package can enhance the
+ functionality of another package.
+
+ * Mandatory : NO
+ * Default :
+
+ - An empty string for non-component based installations
+ - :variable:`CPACK_DEBIAN_PACKAGE_ENHANCES` for component-based
+ installations.
+
+ See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
+
+.. variable:: CPACK_DEBIAN_PACKAGE_BREAKS
+ CPACK_DEBIAN_<COMPONENT>_PACKAGE_BREAKS
+
+ Sets the `Breaks` field of the Debian package.
+ When a binary package (P) declares that it breaks other packages (B),
+ :code:`dpkg` will not allow the package (P) which declares `Breaks` be
+ **unpacked** unless the packages that will be broken (B) are deconfigured
+ first.
+ As long as the package (P) is configured, the previously deconfigured
+ packages (B) cannot be reconfigured again.
+
+ * Mandatory : NO
+ * Default :
+
+ - An empty string for non-component based installations
+ - :variable:`CPACK_DEBIAN_PACKAGE_BREAKS` for component-based
+ installations.
+
+ See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-breaks
+
+.. variable:: CPACK_DEBIAN_PACKAGE_CONFLICTS
+ CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONFLICTS
+
+ Sets the `Conflicts` field of the Debian package.
+ When one binary package declares a conflict with another using a `Conflicts`
+ field, :code:`dpkg` will not allow them to be unpacked on the system at
+ the same time.
+
+ * Mandatory : NO
+ * Default :
+
+ - An empty string for non-component based installations
+ - :variable:`CPACK_DEBIAN_PACKAGE_CONFLICTS` for component-based
+ installations.
+
+ See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-conflicts
+
+ .. note::
+
+ This is a stronger restriction than
+ :variable:`Breaks <CPACK_DEBIAN_PACKAGE_BREAKS>`, which prevents the
+ broken package from being configured while the breaking package is in
+ the "Unpacked" state but allows both packages to be unpacked at the same
+ time.
+
+.. variable:: CPACK_DEBIAN_PACKAGE_PROVIDES
+ CPACK_DEBIAN_<COMPONENT>_PACKAGE_PROVIDES
+
+ Sets the `Provides` field of the Debian package.
+ A virtual package is one which appears in the `Provides` control field of
+ another package.
+
+ * Mandatory : NO
+ * Default :
+
+ - An empty string for non-component based installations
+ - :variable:`CPACK_DEBIAN_PACKAGE_PROVIDES` for component-based
+ installations.
+
+ See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-virtual
+
+.. variable:: CPACK_DEBIAN_PACKAGE_REPLACES
+ CPACK_DEBIAN_<COMPONENT>_PACKAGE_REPLACES
+
+ Sets the `Replaces` field of the Debian package.
+ Packages can declare in their control file that they should overwrite
+ files in certain other packages, or completely replace other packages.
+
+ * Mandatory : NO
+ * Default :
+
+ - An empty string for non-component based installations
+ - :variable:`CPACK_DEBIAN_PACKAGE_REPLACES` for component-based
+ installations.
+
+ See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
+
+.. variable:: CPACK_DEBIAN_PACKAGE_RECOMMENDS
+ CPACK_DEBIAN_<COMPONENT>_PACKAGE_RECOMMENDS
+
+ Sets the `Recommends` field of the Debian package.
+ Allows packages to declare a strong, but not absolute, dependency on other
+ packages.
+
+ * Mandatory : NO
+ * Default :
+
+ - An empty string for non-component based installations
+ - :variable:`CPACK_DEBIAN_PACKAGE_RECOMMENDS` for component-based
+ installations.
+
+ See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
+
+.. variable:: CPACK_DEBIAN_PACKAGE_SUGGESTS
+ CPACK_DEBIAN_<COMPONENT>_PACKAGE_SUGGESTS
+
+ Sets the `Suggests` field of the Debian package.
+ Allows packages to declare a suggested package install grouping.
+
+ * Mandatory : NO
+ * Default :
+
+ - An empty string for non-component based installations
+ - :variable:`CPACK_DEBIAN_PACKAGE_SUGGESTS` for component-based
+ installations.
+
+ See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
+
+.. variable:: CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS
+
+ * Mandatory : NO
+ * Default : OFF
+
+ Allows to generate shlibs control file automatically. Compatibility is defined by
+ :variable:`CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY` variable value.
+
+ .. note::
+
+ Libraries are only considered if they have both library name and version
+ 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 : "="
+
+ Defines compatibility policy for auto-generated shlibs control file.
+ Possible values: "=", ">="
+
+ 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
+
+ This variable allow advanced user to add custom script to the
+ control.tar.gz.
+ Typical usage is for conffiles, postinst, postrm, prerm.
+
+ * Mandatory : NO
+ * Default : -
+
+ Usage::
+
+ set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
+ "${CMAKE_CURRENT_SOURCE_DIR}/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
+
+ .. note::
+
+ The original permissions of the files will be used in the final
+ package unless the variable
+ :variable:`CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION` is set.
+ In particular, the scripts should have the proper executable
+ flag prior to the generation of the package.
+
+.. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION
+ CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONTROL_STRICT_PERMISSION
+
+ This variable indicates if the Debian policy on control files should be
+ strictly followed.
+
+ * Mandatory : NO
+ * Default : FALSE
+
+ Usage::
+
+ set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
+
+ .. note::
+
+ This overrides the permissions on the original files, following the rules
+ set by Debian policy
+ https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners
+
+.. variable:: CPACK_DEBIAN_PACKAGE_SOURCE
+ CPACK_DEBIAN_<COMPONENT>_PACKAGE_SOURCE
+
+ Sets the ``Source`` field of the binary Debian package.
+ When the binary package name is not the same as the source package name
+ (in particular when several components/binaries are generated from one
+ source) the source from which the binary has been generated should be
+ indicated with the field ``Source``.
+
+ * Mandatory : NO
+ * Default :
+
+ - An empty string for non-component based installations
+ - :variable:`CPACK_DEBIAN_PACKAGE_SOURCE` for component-based
+ installations.
+
+ See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source
+
+ .. note::
+
+ This value is not interpreted. It is possible to pass an optional
+ revision number of the referenced source package as well.
+
+Building Debian packages on Windows
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+To communicate UNIX file permissions from the install stage
+to the CPack DEB generator the "cmake_mode_t" NTFS
+alternate data stream (ADT) is used.
+
+When a filesystem without ADT support is used only owner read/write
+permissions can be preserved.
+
+Reproducible packages
+^^^^^^^^^^^^^^^^^^^^^
+
+The environment variable ``SOURCE_DATE_EPOCH`` may be set to a UNIX
+timestamp, defined as the number of seconds, excluding leap seconds,
+since 01 Jan 1970 00:00:00 UTC. If set, the CPack Deb generator will
+use its value for timestamps in the package.
diff --git a/Help/cpack_gen/dmg.rst b/Help/cpack_gen/dmg.rst
new file mode 100644
index 0000000..e4482ef
--- /dev/null
+++ b/Help/cpack_gen/dmg.rst
@@ -0,0 +1,101 @@
+CPack DMG Generator
+-------------------
+
+DragNDrop CPack generator (Mac OS X).
+
+Variables specific to CPack DragNDrop generator
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The following variables are specific to the DragNDrop installers built
+on Mac OS X:
+
+.. variable:: CPACK_DMG_VOLUME_NAME
+
+ The volume name of the generated disk image. Defaults to
+ CPACK_PACKAGE_FILE_NAME.
+
+.. variable:: CPACK_DMG_FORMAT
+
+ The disk image format. Common values are UDRO (UDIF read-only), UDZO (UDIF
+ zlib-compressed) or UDBZ (UDIF bzip2-compressed). Refer to hdiutil(1) for
+ more information on other available formats. Defaults to UDZO.
+
+.. variable:: CPACK_DMG_DS_STORE
+
+ Path to a custom DS_Store file. This .DS_Store file e.g. can be used to
+ specify the Finder window position/geometry and layout (such as hidden
+ toolbars, placement of the icons etc.). This file has to be generated by
+ the Finder (either manually or through AppleScript) using a normal folder
+ from which the .DS_Store file can then be extracted.
+
+.. variable:: CPACK_DMG_DS_STORE_SETUP_SCRIPT
+
+ Path to a custom AppleScript file. This AppleScript is used to generate
+ a .DS_Store file which specifies the Finder window position/geometry and
+ layout (such as hidden toolbars, placement of the icons etc.).
+ By specifying a custom AppleScript there is no need to use
+ CPACK_DMG_DS_STORE, as the .DS_Store that is generated by the AppleScript
+ will be packaged.
+
+.. variable:: CPACK_DMG_BACKGROUND_IMAGE
+
+ Path to an image file to be used as the background. This file will be
+ copied to .background/background.<ext>, where ext is the original image file
+ extension. The background image is installed into the image before
+ 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.
+ Setting this causes CPack to look for a ``<language>.menu.txt`` and
+ ``<language>.license.txt`` file for every language defined in
+ ``CPACK_DMG_SLA_LANGUAGES``. If both this variable and
+ ``CPACK_RESOURCE_FILE_LICENSE`` are set, CPack will only look for the menu
+ files and use the same license file for all languages.
+
+.. variable:: CPACK_DMG_SLA_LANGUAGES
+
+ Languages for which a license agreement is provided when mounting the
+ generated DMG. A menu file consists of 9 lines of text. The first line is
+ is the name of the language itself, uppercase, in English (e.g. German).
+ The other lines are translations of the following strings:
+
+ - Agree
+ - Disagree
+ - Print
+ - Save...
+ - You agree to the terms of the License Agreement when you click the
+ "Agree" button.
+ - Software License Agreement
+ - This text cannot be saved. The disk may be full or locked, or the file
+ may be locked.
+ - Unable to print. Make sure you have selected a printer.
+
+ For every language in this list, CPack will try to find files
+ ``<language>.menu.txt`` and ``<language>.license.txt`` in the directory
+ specified by the :variable:`CPACK_DMG_SLA_DIR` variable.
+
+.. variable:: CPACK_COMMAND_HDIUTIL
+
+ Path to the hdiutil(1) command used to operate on disk image files on Mac
+ OS X. This variable can be used to override the automatically detected
+ command (or specify its location if the auto-detection fails to find it.)
+
+.. variable:: CPACK_COMMAND_SETFILE
+
+ Path to the SetFile(1) command used to set extended attributes on files and
+ directories on Mac OS X. This variable can be used to override the
+ automatically detected command (or specify its location if the
+ auto-detection fails to find it.)
+
+.. variable:: CPACK_COMMAND_REZ
+
+ Path to the Rez(1) command used to compile resources on Mac OS X. This
+ variable can be used to override the automatically detected command (or
+ specify its location if the auto-detection fails to find it.)
diff --git a/Help/cpack_gen/external.rst b/Help/cpack_gen/external.rst
new file mode 100644
index 0000000..f98e1c9
--- /dev/null
+++ b/Help/cpack_gen/external.rst
@@ -0,0 +1,283 @@
+CPack External Generator
+------------------------
+
+CPack provides many generators to create packages for a variety of platforms
+and packaging systems. The intention is for CMake/CPack to be a complete
+end-to-end solution for building and packaging a software project. However, it
+may not always be possible to use CPack for the entire packaging process, due
+to either technical limitations or policies that require the use of certain
+tools. For this reason, CPack provides the "External" generator, which allows
+external packaging software to take advantage of some of the functionality
+provided by CPack, such as component installation and the dependency graph.
+
+Integration with External Packaging Tools
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The CPack External generator generates a .json file containing the
+CPack internal metadata, which gives external software information
+on how to package the software. External packaging software may itself
+invoke CPack, consume the generated metadata,
+install and package files as required.
+
+Alternatively CPack can invoke an external packaging software
+through an optional custom CMake script in
+:variable:`CPACK_EXT_PACKAGE_SCRIPT` instead.
+
+Staging of installation files may also optionally be
+taken care of by the generator when enabled through the
+:variable:`CPACK_EXT_ENABLE_STAGING` variable.
+
+JSON Format
+^^^^^^^^^^^
+
+The JSON metadata file contains a list of CPack components and component groups,
+the various options passed to :command:`cpack_add_component` and
+:command:`cpack_add_component_group`, the dependencies between the components
+and component groups, and various other options passed to CPack.
+
+The JSON's root object will always provide two fields:
+``formatVersionMajor`` and ``formatVersionMinor``, which are always integers
+that describe the output format of the generator. Backwards-compatible changes
+to the output format (for example, adding a new field that didn't exist before)
+cause the minor version to be incremented, and backwards-incompatible changes
+(for example, deleting a field or changing its meaning) cause the major version
+to be incremented and the minor version reset to 0. The format version is
+always of the format ``major.minor``. In other words, it always has exactly two
+parts, separated by a period.
+
+You can request one or more specific versions of the output format as described
+below with :variable:`CPACK_EXT_REQUESTED_VERSIONS`. The output format will
+have a major version that exactly matches the requested major version, and a
+minor version that is greater than or equal to the requested minor version. If
+no version is requested with :variable:`CPACK_EXT_REQUESTED_VERSIONS`, the
+latest known major version is used by default. Currently, the only supported
+format is 1.0, which is described below.
+
+Version 1.0
+***********
+
+In addition to the standard format fields, format version 1.0 provides the
+following fields in the root:
+
+``components``
+ The ``components`` field is an object with component names as the keys and
+ objects describing the components as the values. The component objects have
+ the following fields:
+
+ ``name``
+ The name of the component. This is always the same as the key in the
+ ``components`` object.
+
+ ``displayName``
+ The value of the ``DISPLAY_NAME`` field passed to
+ :command:`cpack_add_component`.
+
+ ``description``
+ The value of the ``DESCRIPTION`` field passed to
+ :command:`cpack_add_component`.
+
+ ``isHidden``
+ True if ``HIDDEN`` was passed to :command:`cpack_add_component`, false if
+ it was not.
+
+ ``isRequired``
+ True if ``REQUIRED`` was passed to :command:`cpack_add_component`, false if
+ it was not.
+
+ ``isDisabledByDefault``
+ True if ``DISABLED`` was passed to :command:`cpack_add_component`, false if
+ it was not.
+
+ ``group``
+ Only present if ``GROUP`` was passed to :command:`cpack_add_component`. If
+ so, this field is a string value containing the component's group.
+
+ ``dependencies``
+ An array of components the component depends on. This contains the values
+ in the ``DEPENDS`` argument passed to :command:`cpack_add_component`. If no
+ ``DEPENDS`` argument was passed, this is an empty list.
+
+ ``installationTypes``
+ An array of installation types the component is part of. This contains the
+ values in the ``INSTALL_TYPES`` argument passed to
+ :command:`cpack_add_component`. If no ``INSTALL_TYPES`` argument was
+ passed, this is an empty list.
+
+ ``isDownloaded``
+ True if ``DOWNLOADED`` was passed to :command:`cpack_add_component`, false
+ if it was not.
+
+ ``archiveFile``
+ The name of the archive file passed with the ``ARCHIVE_FILE`` argument to
+ :command:`cpack_add_component`. If no ``ARCHIVE_FILE`` argument was passed,
+ this is an empty string.
+
+``componentGroups``
+ The ``componentGroups`` field is an object with component group names as the
+ keys and objects describing the component groups as the values. The component
+ group objects have the following fields:
+
+ ``name``
+ The name of the component group. This is always the same as the key in the
+ ``componentGroups`` object.
+
+ ``displayName``
+ The value of the ``DISPLAY_NAME`` field passed to
+ :command:`cpack_add_component_group`.
+
+ ``description``
+ The value of the ``DESCRIPTION`` field passed to
+ :command:`cpack_add_component_group`.
+
+ ``parentGroup``
+ Only present if ``PARENT_GROUP`` was passed to
+ :command:`cpack_add_component_group`. If so, this field is a string value
+ containing the component group's parent group.
+
+ ``isExpandedByDefault``
+ True if ``EXPANDED`` was passed to :command:`cpack_add_component_group`,
+ false if it was not.
+
+ ``isBold``
+ True if ``BOLD_TITLE`` was passed to :command:`cpack_add_component_group`,
+ false if it was not.
+
+ ``components``
+ An array of names of components that are direct members of the group
+ (components that have this group as their ``GROUP``). Components of
+ subgroups are not included.
+
+ ``subgroups``
+ An array of names of component groups that are subgroups of the group
+ (groups that have this group as their ``PARENT_GROUP``).
+
+``installationTypes``
+ The ``installationTypes`` field is an object with installation type names as
+ the keys and objects describing the installation types as the values. The
+ installation type objects have the following fields:
+
+ ``name``
+ The name of the installation type. This is always the same as the key in
+ the ``installationTypes`` object.
+
+ ``displayName``
+ The value of the ``DISPLAY_NAME`` field passed to
+ :command:`cpack_add_install_type`.
+
+ ``index``
+ The integer index of the installation type in the list.
+
+``projects``
+ The ``projects`` field is an array of objects describing CMake projects which
+ comprise the CPack project. The values in this field are derived from
+ :variable:`CPACK_INSTALL_CMAKE_PROJECTS`. In most cases, this will be only a
+ single project. The project objects have the following fields:
+
+ ``projectName``
+ The project name passed to :variable:`CPACK_INSTALL_CMAKE_PROJECTS`.
+
+ ``component``
+ The name of the component or component set which comprises the project.
+
+ ``directory``
+ The build directory of the CMake project. This is the directory which
+ contains the ``cmake_install.cmake`` script.
+
+ ``subDirectory``
+ The subdirectory to install the project into inside the CPack package.
+
+``packageName``
+ The package name given in :variable:`CPACK_PACKAGE_NAME`. Only present if
+ this option is set.
+
+``packageVersion``
+ The package version given in :variable:`CPACK_PACKAGE_VERSION`. Only present
+ if this option is set.
+
+``packageDescriptionFile``
+ The package description file given in
+ :variable:`CPACK_PACKAGE_DESCRIPTION_FILE`. Only present if this option is
+ set.
+
+``packageDescriptionSummary``
+ The package description summary given in
+ :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`. Only present if this option is
+ set.
+
+``buildConfig``
+ The build configuration given to CPack with the ``-C`` option. Only present
+ if this option is set.
+
+``defaultDirectoryPermissions``
+ The default directory permissions given in
+ :variable:`CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS`. Only present if this
+ option is set.
+
+``setDestdir``
+ True if :variable:`CPACK_SET_DESTDIR` is true, false if it is not.
+
+``packagingInstallPrefix``
+ The install prefix given in :variable:`CPACK_PACKAGING_INSTALL_PREFIX`. Only
+ present if :variable:`CPACK_SET_DESTDIR` is true.
+
+``stripFiles``
+ True if :variable:`CPACK_STRIP_FILES` is true, false if it is not.
+
+``warnOnAbsoluteInstallDestination``
+ True if :variable:`CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION` is true, false
+ if it is not.
+
+``errorOnAbsoluteInstallDestination``
+ True if :variable:`CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION` is true,
+ false if it is not.
+
+Variables specific to CPack External generator
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. variable:: CPACK_EXT_REQUESTED_VERSIONS
+
+ This variable is used to request a specific version of the CPack External
+ generator. It is a list of ``major.minor`` values, separated by semicolons.
+
+ If this variable is set to a non-empty value, the CPack External generator
+ will iterate through each item in the list to search for a version that it
+ knows how to generate. Requested versions should be listed in order of
+ descending preference by the client software, as the first matching version
+ in the list will be generated.
+
+ The generator knows how to generate the version if it has a versioned
+ generator whose major version exactly matches the requested major version,
+ and whose minor version is greater than or equal to the requested minor
+ version. For example, if ``CPACK_EXT_REQUESTED_VERSIONS`` contains 1.0, and
+ the CPack External generator knows how to generate 1.1, it will generate 1.1.
+ If the generator doesn't know how to generate a version in the list, it skips
+ the version and looks at the next one. If it doesn't know how to generate any
+ of the requested versions, an error is thrown.
+
+ If this variable is not set, or is empty, the CPack External generator will
+ generate the highest major and minor version that it knows how to generate.
+
+ If an invalid version is encountered in ``CPACK_EXT_REQUESTED_VERSIONS`` (one
+ that doesn't match ``major.minor``, where ``major`` and ``minor`` are
+ integers), it is ignored.
+
+.. variable:: CPACK_EXT_ENABLE_STAGING
+
+ This variable can be set to true to enable optional installation
+ into a temporary staging area which can then be picked up
+ and packaged by an external packaging tool.
+ The top level directory used by CPack for the current packaging
+ task is contained in ``CPACK_TOPLEVEL_DIRECTORY``.
+ It is automatically cleaned up on each run before packaging is initiated
+ and can be used for custom temporary files required by
+ the external packaging tool.
+ It also contains the staging area ``CPACK_TEMPORARY_DIRECTORY``
+ into which CPack performs the installation when staging is enabled.
+
+.. variable:: CPACK_EXT_PACKAGE_SCRIPT
+
+ This variable can optionally specify the full path to
+ a CMake script file to be run as part of the CPack invocation.
+ It is invoked after (optional) staging took place and may
+ run an external packaging tool. The script has access to
+ the variables defined by the CPack config file.
diff --git a/Help/cpack_gen/freebsd.rst b/Help/cpack_gen/freebsd.rst
new file mode 100644
index 0000000..2419057
--- /dev/null
+++ b/Help/cpack_gen/freebsd.rst
@@ -0,0 +1,138 @@
+CPack FreeBSD Generator
+-----------------------
+
+The built in (binary) CPack FreeBSD (pkg) generator (Unix only)
+
+Variables specific to CPack FreeBSD (pkg) generator
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The CPack FreeBSD generator may be used to create pkg(8) packages -- these may
+be used on FreeBSD, DragonflyBSD, NetBSD, OpenBSD, but also on Linux or OSX,
+depending on the installed package-management tools -- using :module:`CPack`.
+
+The CPack FreeBSD generator is a :module:`CPack` generator and uses the
+``CPACK_XXX`` variables used by :module:`CPack`. It tries to re-use packaging
+information that may already be specified for Debian packages for the
+:cpack_gen:`CPack Deb Generator`. It also tries to re-use RPM packaging
+information when Debian does not specify.
+
+The CPack FreeBSD generator should work on any host with libpkg installed. The
+packages it produces are specific to the host architecture and ABI.
+
+The CPack FreeBSD generator sets package-metadata through
+:code:`CPACK_FREEBSD_XXX` variables. The CPack FreeBSD generator, unlike the
+CPack Deb generator, does not specially support componentized packages; a
+single package is created from all the software artifacts created through
+CMake.
+
+All of the variables can be set specifically for FreeBSD packaging in
+the CPackConfig file or in CMakeLists.txt, but most of them have defaults
+that use general settings (e.g. CMAKE_PROJECT_NAME) or Debian-specific
+variables when those make sense (e.g. the homepage of an upstream project
+is usually unchanged by the flavor of packaging). When there is no Debian
+information to fall back on, but the RPM packaging has it, fall back to
+the RPM information (e.g. package license).
+
+.. variable:: CPACK_FREEBSD_PACKAGE_NAME
+
+ Sets the package name (in the package manifest, but also affects the
+ output filename).
+
+ * Mandatory: YES
+ * Default:
+
+ - :variable:`CPACK_PACKAGE_NAME` (this is always set by CPack itself,
+ based on CMAKE_PROJECT_NAME).
+
+.. variable:: CPACK_FREEBSD_PACKAGE_COMMENT
+
+ Sets the package comment. This is the short description displayed by
+ pkg(8) in standard "pkg info" output.
+
+ * Mandatory: YES
+ * Default:
+
+ - :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` (this is always set
+ by CPack itself, if nothing else sets it explicitly).
+ - :variable:`PROJECT_DESCRIPTION` (this can be set with the DESCRIPTION
+ parameter for :command:`project`).
+
+.. variable:: CPACK_FREEBSD_PACKAGE_DESCRIPTION
+
+ Sets the package description. This is the long description of the package,
+ given by "pkg info" with a specific package as argument.
+
+ * Mandatory: YES
+ * Default:
+
+ - :variable:`CPACK_DEBIAN_PACKAGE_DESCRIPTION` (this may be set already
+ for Debian packaging, so we may as well re-use it).
+
+.. variable:: CPACK_FREEBSD_PACKAGE_WWW
+
+ The URL of the web site for this package, preferably (when applicable) the
+ site from which the original source can be obtained and any additional
+ upstream documentation or information may be found.
+
+ * Mandatory: YES
+ * Default:
+
+ - :variable:`CMAKE_PROJECT_HOMEPAGE_URL`, or if that is not set,
+ :variable:`CPACK_DEBIAN_PACKAGE_HOMEPAGE` (this may be set already
+ for Debian packaging, so we may as well re-use it).
+
+.. variable:: CPACK_FREEBSD_PACKAGE_LICENSE
+
+ The license, or licenses, which apply to this software package. This must
+ be one or more license-identifiers that pkg recognizes as acceptable license
+ identifiers (e.g. "GPLv2").
+
+ * Mandatory: YES
+ * Default:
+
+ - :variable:`CPACK_RPM_PACKAGE_LICENSE`
+
+.. variable:: CPACK_FREEBSD_PACKAGE_LICENSE_LOGIC
+
+ This variable is only of importance if there is more than one license.
+ The default is "single", which is only applicable to a single license.
+ Other acceptable values are determined by pkg -- those are "dual" or "multi" --
+ meaning choice (OR) or simultaneous (AND) application of the licenses.
+
+ * Mandatory: NO
+ * Default: single
+
+.. variable:: CPACK_FREEBSD_PACKAGE_MAINTAINER
+
+ The FreeBSD maintainer (e.g. kde@freebsd.org) of this package.
+
+ * Mandatory: YES
+ * Default: none
+
+.. variable:: CPACK_FREEBSD_PACKAGE_ORIGIN
+
+ The origin (ports label) of this package; for packages built by CPack
+ outside of the ports system this is of less importance. The default
+ puts the package somewhere under misc/, as a stopgap.
+
+ * Mandatory: YES
+ * Default: misc/<package name>
+
+.. variable:: CPACK_FREEBSD_PACKAGE_CATEGORIES
+
+ The ports categories where this package lives (if it were to be built
+ from ports). If none is set a single category is determined based on
+ the package origin.
+
+ * Mandatory: YES
+ * Default: derived from ORIGIN
+
+.. variable:: CPACK_FREEBSD_PACKAGE_DEPS
+
+ A list of package origins that should be added as package dependencies.
+ These are in the form <category>/<packagename>, e.g. x11/libkonq.
+ No version information needs to be provided (this is not included
+ in the manifest).
+
+ * Mandatory: NO
+ * Default: empty
diff --git a/Help/cpack_gen/ifw.rst b/Help/cpack_gen/ifw.rst
new file mode 100644
index 0000000..68776e1
--- /dev/null
+++ b/Help/cpack_gen/ifw.rst
@@ -0,0 +1,335 @@
+CPack IFW Generator
+-------------------
+
+See :module:`CPackIFW` for details on the CPackIFW module.
+
+.. _QtIFW: http://doc.qt.io/qtinstallerframework/index.html
+
+
+Overview
+^^^^^^^^
+
+CPack ``IFW`` generator helps you to create online and offline
+binary cross-platform installers with a graphical user interface.
+
+CPack IFW generator prepares project installation and generates configuration
+and meta information for QtIFW_ tools.
+
+The QtIFW_ provides a set of tools and utilities to create
+installers for the supported desktop Qt platforms: Linux, Microsoft Windows,
+and Mac OS X.
+
+You should also install QtIFW_ to use CPack ``IFW`` generator.
+
+Hints
+^^^^^
+
+Generally, the CPack ``IFW`` generator automatically finds QtIFW_ tools,
+but if you don't use a default path for installation of the QtIFW_ tools,
+the path may be specified in either a CMake or an environment variable:
+
+.. variable:: CPACK_IFW_ROOT
+
+ An CMake variable which specifies the location of the QtIFW_ tool suite.
+
+ The variable will be cached in the ``CPackConfig.cmake`` file and used at
+ CPack runtime.
+
+.. variable:: QTIFWDIR
+
+ An environment variable which specifies the location of the QtIFW_ tool
+ suite.
+
+.. note::
+ The specified path should not contain "bin" at the end
+ (for example: "D:\\DevTools\\QtIFW2.0.5").
+
+The :variable:`CPACK_IFW_ROOT` variable has a higher priority and overrides
+the value of the :variable:`QTIFWDIR` variable.
+
+Internationalization
+^^^^^^^^^^^^^^^^^^^^
+
+Some variables and command arguments support internationalization via
+CMake script. This is an optional feature.
+
+Installers created by QtIFW_ tools have built-in support for
+internationalization and many phrases are localized to many languages,
+but this does not apply to the description of the your components and groups
+that will be distributed.
+
+Localization of the description of your components and groups is useful for
+users of your installers.
+
+A localized variable or argument can contain a single default value, and a
+set of pairs the name of the locale and the localized value.
+
+For example:
+
+.. code-block:: cmake
+
+ set(LOCALIZABLE_VARIABLE "Default value"
+ en "English value"
+ en_US "American value"
+ en_GB "Great Britain value"
+ )
+
+Variables
+^^^^^^^^^
+
+You can use the following variables to change behavior of CPack ``IFW``
+generator.
+
+Debug
+"""""
+
+.. variable:: CPACK_IFW_VERBOSE
+
+ Set to ``ON`` to enable addition debug output.
+ By default is ``OFF``.
+
+Package
+"""""""
+
+.. variable:: CPACK_IFW_PACKAGE_TITLE
+
+ Name of the installer as displayed on the title bar.
+ By default used :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`.
+
+.. variable:: CPACK_IFW_PACKAGE_PUBLISHER
+
+ Publisher of the software (as shown in the Windows Control Panel).
+ By default used :variable:`CPACK_PACKAGE_VENDOR`.
+
+.. variable:: CPACK_IFW_PRODUCT_URL
+
+ URL to a page that contains product information on your web site.
+
+.. variable:: CPACK_IFW_PACKAGE_ICON
+
+ Filename for a custom installer icon. The actual file is '.icns' (Mac OS X),
+ '.ico' (Windows). No functionality on Unix.
+
+.. variable:: CPACK_IFW_PACKAGE_WINDOW_ICON
+
+ Filename for a custom window icon in PNG format for the Installer
+ application.
+
+.. variable:: CPACK_IFW_PACKAGE_LOGO
+
+ Filename for a logo is used as QWizard::LogoPixmap.
+
+.. variable:: CPACK_IFW_PACKAGE_WATERMARK
+
+ Filename for a watermark is used as QWizard::WatermarkPixmap.
+
+.. variable:: CPACK_IFW_PACKAGE_BANNER
+
+ Filename for a banner is used as QWizard::BannerPixmap.
+
+.. variable:: CPACK_IFW_PACKAGE_BACKGROUND
+
+ Filename for an image used as QWizard::BackgroundPixmap (only used by MacStyle).
+
+.. variable:: CPACK_IFW_PACKAGE_WIZARD_STYLE
+
+ Wizard style to be used ("Modern", "Mac", "Aero" or "Classic").
+
+.. variable:: CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH
+
+ Default width of the wizard in pixels. Setting a banner image will override this.
+
+.. variable:: CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT
+
+ Default height of the wizard in pixels. Setting a watermark image will override this.
+
+.. variable:: CPACK_IFW_PACKAGE_TITLE_COLOR
+
+ Color of the titles and subtitles (takes an HTML color code, such as "#88FF33").
+
+.. variable:: CPACK_IFW_PACKAGE_START_MENU_DIRECTORY
+
+ Name of the default program group for the product in the Windows Start menu.
+
+ By default used :variable:`CPACK_IFW_PACKAGE_NAME`.
+
+.. variable:: CPACK_IFW_TARGET_DIRECTORY
+
+ Default target directory for installation.
+ By default used
+ "@ApplicationsDir@/:variable:`CPACK_PACKAGE_INSTALL_DIRECTORY`"
+
+ You can use predefined variables.
+
+.. variable:: CPACK_IFW_ADMIN_TARGET_DIRECTORY
+
+ Default target directory for installation with administrator rights.
+
+ You can use predefined variables.
+
+.. variable:: CPACK_IFW_PACKAGE_GROUP
+
+ The group, which will be used to configure the root package
+
+.. variable:: CPACK_IFW_PACKAGE_NAME
+
+ The root package name, which will be used if configuration group is not
+ specified
+
+.. variable:: CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME
+
+ Filename of the generated maintenance tool.
+ The platform-specific executable file extension is appended.
+
+ By default used QtIFW_ defaults (``maintenancetool``).
+
+.. variable:: CPACK_IFW_PACKAGE_REMOVE_TARGET_DIR
+
+ Set to ``OFF`` if the target directory should not be deleted when uninstalling.
+
+ Is ``ON`` by default
+
+.. variable:: CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_INI_FILE
+
+ Filename for the configuration of the generated maintenance tool.
+
+ By default used QtIFW_ defaults (``maintenancetool.ini``).
+
+.. variable:: CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS
+
+ Set to ``ON`` if the installation path can contain non-ASCII characters.
+
+ Is ``ON`` for QtIFW_ less 2.0 tools.
+
+.. variable:: CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH
+
+ Set to ``OFF`` if the installation path cannot contain space characters.
+
+ Is ``ON`` for QtIFW_ less 2.0 tools.
+
+.. variable:: CPACK_IFW_PACKAGE_CONTROL_SCRIPT
+
+ Filename for a custom installer control script.
+
+.. variable:: CPACK_IFW_PACKAGE_RESOURCES
+
+ List of additional resources ('.qrc' files) to include in the installer
+ binary.
+
+ You can use :command:`cpack_ifw_add_package_resources` command to resolve
+ relative paths.
+
+.. variable:: CPACK_IFW_PACKAGE_FILE_EXTENSION
+
+ The target binary extension.
+
+ On Linux, the name of the target binary is automatically extended with
+ '.run', if you do not specify the extension.
+
+ On Windows, the target is created as an application with the extension
+ '.exe', which is automatically added, if not supplied.
+
+ On Mac, the target is created as an DMG disk image with the extension
+ '.dmg', which is automatically added, if not supplied.
+
+.. variable:: CPACK_IFW_REPOSITORIES_ALL
+
+ The list of remote repositories.
+
+ 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
+
+ If this is ``ON`` all components will be downloaded.
+ By default is ``OFF`` or used value
+ from ``CPACK_DOWNLOAD_ALL`` if set
+
+Components
+""""""""""
+
+.. variable:: CPACK_IFW_RESOLVE_DUPLICATE_NAMES
+
+ Resolve duplicate names when installing components with groups.
+
+.. variable:: CPACK_IFW_PACKAGES_DIRECTORIES
+
+ Additional prepared packages dirs that will be used to resolve
+ dependent components.
+
+.. variable:: CPACK_IFW_REPOSITORIES_DIRECTORIES
+
+ Additional prepared repository dirs that will be used to resolve and
+ repack dependent components. This feature available only
+ since QtIFW_ 3.1.
+
+Tools
+"""""
+
+.. variable:: CPACK_IFW_FRAMEWORK_VERSION
+
+ The version of used QtIFW_ tools.
+
+.. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE
+
+ The path to "binarycreator" command line client.
+
+ This variable is cached and may be configured if needed.
+
+.. variable:: CPACK_IFW_REPOGEN_EXECUTABLE
+
+ The path to "repogen" command line client.
+
+ This variable is cached and may be configured if needed.
+
+.. variable:: CPACK_IFW_INSTALLERBASE_EXECUTABLE
+
+ The path to "installerbase" installer executable base.
+
+ This variable is cached and may be configured if needed.
+
+.. variable:: CPACK_IFW_DEVTOOL_EXECUTABLE
+
+ The path to "devtool" command line client.
+
+ This variable is cached and may be configured if needed.
+
+
+Online installer
+^^^^^^^^^^^^^^^^
+
+By default CPack IFW generator makes offline installer. This means that all
+components will be packaged into a binary file.
+
+To make a component downloaded, you must set the ``DOWNLOADED`` option in
+:command:`cpack_add_component`.
+
+Then you would use the command :command:`cpack_configure_downloads`.
+If you set ``ALL`` option all components will be downloaded.
+
+You also can use command :command:`cpack_ifw_add_repository` and
+variable :variable:`CPACK_IFW_DOWNLOAD_ALL` for more specific configuration.
+
+CPack IFW generator creates "repository" dir in current binary dir. You
+would copy content of this dir to specified ``site`` (``url``).
+
+See Also
+^^^^^^^^
+
+Qt Installer Framework Manual:
+
+* Index page:
+ http://doc.qt.io/qtinstallerframework/index.html
+
+* Component Scripting:
+ http://doc.qt.io/qtinstallerframework/scripting.html
+
+* 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
diff --git a/Help/cpack_gen/nsis.rst b/Help/cpack_gen/nsis.rst
new file mode 100644
index 0000000..9f82a04
--- /dev/null
+++ b/Help/cpack_gen/nsis.rst
@@ -0,0 +1,130 @@
+CPack NSIS Generator
+--------------------
+
+CPack NSIS generator specific options
+
+Variables specific to CPack NSIS generator
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The following variables are specific to the graphical installers built
+on Windows using the Nullsoft Installation System.
+
+.. variable:: CPACK_NSIS_INSTALL_ROOT
+
+ The default installation directory presented to the end user by the NSIS
+ installer is under this root dir. The full directory presented to the end
+ user is: ${CPACK_NSIS_INSTALL_ROOT}/${CPACK_PACKAGE_INSTALL_DIRECTORY}
+
+.. variable:: CPACK_NSIS_MUI_ICON
+
+ An icon filename. The name of a ``*.ico`` file used as the main icon for the
+ generated install program.
+
+.. variable:: CPACK_NSIS_MUI_UNIICON
+
+ An icon filename. The name of a ``*.ico`` file used as the main icon for the
+ generated uninstall program.
+
+.. variable:: CPACK_NSIS_INSTALLER_MUI_ICON_CODE
+
+ undocumented.
+
+.. variable:: CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP
+
+ The filename of a bitmap to use as the NSIS MUI_WELCOMEFINISHPAGE_BITMAP.
+
+.. variable:: CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP
+
+ The filename of a bitmap to use as the NSIS MUI_UNWELCOMEFINISHPAGE_BITMAP.
+
+.. variable:: CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS
+
+ Extra NSIS commands that will be added to the beginning of the install
+ Section, before your install tree is available on the target system.
+
+.. variable:: CPACK_NSIS_EXTRA_INSTALL_COMMANDS
+
+ Extra NSIS commands that will be added to the end of the install Section,
+ after your install tree is available on the target system.
+
+.. variable:: CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS
+
+ Extra NSIS commands that will be added to the uninstall Section, before
+ your install tree is removed from the target system.
+
+.. variable:: CPACK_NSIS_COMPRESSOR
+
+ The arguments that will be passed to the NSIS SetCompressor command.
+
+.. variable:: CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL
+
+ Ask about uninstalling previous versions first. If this is set to "ON",
+ then an installer will look for previous installed versions and if one is
+ found, ask the user whether to uninstall it before proceeding with the
+ install.
+
+.. variable:: CPACK_NSIS_MODIFY_PATH
+
+ Modify PATH toggle. If this is set to "ON", then an extra page will appear
+ in the installer that will allow the user to choose whether the program
+ directory should be added to the system PATH variable.
+
+.. variable:: CPACK_NSIS_DISPLAY_NAME
+
+ The display name string that appears in the Windows Add/Remove Program
+ control panel
+
+.. variable:: CPACK_NSIS_PACKAGE_NAME
+
+ The title displayed at the top of the installer.
+
+.. variable:: CPACK_NSIS_INSTALLED_ICON_NAME
+
+ A path to the executable that contains the installer icon.
+
+.. variable:: CPACK_NSIS_HELP_LINK
+
+ URL to a web site providing assistance in installing your application.
+
+.. variable:: CPACK_NSIS_URL_INFO_ABOUT
+
+ URL to a web site providing more information about your application.
+
+.. variable:: CPACK_NSIS_CONTACT
+
+ Contact information for questions and comments about the installation
+ process.
+
+.. variable:: CPACK_NSIS_<compName>_INSTALL_DIRECTORY
+
+ Custom install directory for the specified component <compName> instead
+ of $INSTDIR.
+
+.. variable:: CPACK_NSIS_CREATE_ICONS_EXTRA
+
+ Additional NSIS commands for creating start menu shortcuts.
+
+.. variable:: CPACK_NSIS_DELETE_ICONS_EXTRA
+
+ Additional NSIS commands to uninstall start menu shortcuts.
+
+.. variable:: CPACK_NSIS_EXECUTABLES_DIRECTORY
+
+ Creating NSIS start menu links assumes that they are in 'bin' unless this
+ variable is set. For example, you would set this to 'exec' if your
+ executables are in an exec directory.
+
+.. variable:: CPACK_NSIS_MUI_FINISHPAGE_RUN
+
+ Specify an executable to add an option to run on the finish page of the
+ NSIS installer.
+
+.. variable:: CPACK_NSIS_MENU_LINKS
+
+ Specify links in [application] menu. This should contain a list of pair
+ "link" "link name". The link may be a URL or a path relative to
+ installation prefix. Like::
+
+ set(CPACK_NSIS_MENU_LINKS
+ "doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cmake.html"
+ "CMake Help" "https://cmake.org" "CMake Web Site")
diff --git a/Help/cpack_gen/nuget.rst b/Help/cpack_gen/nuget.rst
new file mode 100644
index 0000000..c8c481f
--- /dev/null
+++ b/Help/cpack_gen/nuget.rst
@@ -0,0 +1,189 @@
+CPack NuGet Generator
+---------------------
+
+When build a NuGet package there is no direct way to control an output
+filename due a lack of the corresponding CLI option of NuGet, so there
+is no ``CPACK_NUGET_PACKAGE_FILENAME`` variable. To form the output filename
+NuGet uses the package name and the version according to its built-in rules.
+
+Also, be aware that including a top level directory
+(``CPACK_INCLUDE_TOPLEVEL_DIRECTORY``) is ignored by this generator.
+
+
+Variables specific to CPack NuGet generator
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The CPack NuGet generator may be used to create NuGet packages using
+:module:`CPack`. The CPack NuGet generator is a :module:`CPack` generator thus
+it uses the ``CPACK_XXX`` variables used by :module:`CPack`.
+
+The CPack NuGet generator has specific features which are controlled by the
+specifics :code:`CPACK_NUGET_XXX` variables. In the "one per group" mode
+(see :variable:`CPACK_COMPONENTS_GROUPING`), ``<compName>`` placeholder
+in the variables below would contain a group name (uppercased and turned into
+a "C" identifier).
+
+List of CPack NuGet generator specific variables:
+
+.. variable:: CPACK_NUGET_COMPONENT_INSTALL
+
+ Enable component packaging for CPack NuGet generator
+
+ * Mandatory : NO
+ * Default : OFF
+
+.. variable:: CPACK_NUGET_PACKAGE_NAME
+ CPACK_NUGET_<compName>_PACKAGE_NAME
+
+ The NUGET package name.
+
+ * Mandatory : YES
+ * Default : :variable:`CPACK_PACKAGE_NAME`
+
+.. variable:: CPACK_NUGET_PACKAGE_VERSION
+ CPACK_NUGET_<compName>_PACKAGE_VERSION
+
+ The NuGet package version.
+
+ * Mandatory : YES
+ * Default : :variable:`CPACK_PACKAGE_VERSION`
+
+.. variable:: CPACK_NUGET_PACKAGE_DESCRIPTION
+ CPACK_NUGET_<compName>_PACKAGE_DESCRIPTION
+
+ A long description of the package for UI display.
+
+ * Mandatory : YES
+ * Default :
+ - :variable:`CPACK_COMPONENT_<compName>_DESCRIPTION`,
+ - ``CPACK_COMPONENT_GROUP_<groupName>_DESCRIPTION``,
+ - :variable:`CPACK_PACKAGE_DESCRIPTION`
+
+.. variable:: CPACK_NUGET_PACKAGE_AUTHORS
+ CPACK_NUGET_<compName>_PACKAGE_AUTHORS
+
+ A comma-separated list of packages authors, matching the profile names
+ on nuget.org_. These are displayed in the NuGet Gallery on
+ nuget.org_ and are used to cross-reference packages by the same
+ authors.
+
+ * Mandatory : YES
+ * Default : :variable:`CPACK_PACKAGE_VENDOR`
+
+.. variable:: CPACK_NUGET_PACKAGE_TITLE
+ CPACK_NUGET_<compName>_PACKAGE_TITLE
+
+ A human-friendly title of the package, typically used in UI displays
+ as on nuget.org_ and the Package Manager in Visual Studio. If not
+ specified, the package ID is used.
+
+ * Mandatory : NO
+ * Default :
+ - :variable:`CPACK_COMPONENT_<compName>_DISPLAY_NAME`,
+ - ``CPACK_COMPONENT_GROUP_<groupName>_DISPLAY_NAME``
+
+.. variable:: CPACK_NUGET_PACKAGE_OWNERS
+ CPACK_NUGET_<compName>_PACKAGE_OWNERS
+
+ A comma-separated list of the package creators using profile names
+ on nuget.org_. This is often the same list as in authors,
+ and is ignored when uploading the package to nuget.org_.
+
+ * Mandatory : NO
+ * Default : -
+
+.. variable:: CPACK_NUGET_PACKAGE_HOMEPAGE_URL
+ CPACK_NUGET_<compName>_PACKAGE_HOMEPAGE_URL
+
+ A URL for the package's home page, often shown in UI displays as well
+ as nuget.org_.
+
+ * Mandatory : NO
+ * Default : :variable:`CPACK_PACKAGE_HOMEPAGE_URL`
+
+.. variable:: CPACK_NUGET_PACKAGE_LICENSEURL
+ CPACK_NUGET_<compName>_PACKAGE_LICENSEURL
+
+ A URL for the package's license, often shown in UI displays as well
+ as nuget.org_.
+
+ * Mandatory : NO
+ * Default : -
+
+.. variable:: CPACK_NUGET_PACKAGE_ICONURL
+ CPACK_NUGET_<compName>_PACKAGE_ICONURL
+
+ A URL for a 64x64 image with transparency background to use as the
+ icon for the package in UI display.
+
+ * Mandatory : NO
+ * Default : -
+
+.. variable:: CPACK_NUGET_PACKAGE_DESCRIPTION_SUMMARY
+ CPACK_NUGET_<compName>_PACKAGE_DESCRIPTION_SUMMARY
+
+ A short description of the package for UI display. If omitted, a
+ truncated version of description is used.
+
+ * Mandatory : NO
+ * Default : :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`
+
+.. variable:: CPACK_NUGET_PACKAGE_RELEASE_NOTES
+ CPACK_NUGET_<compName>_PACKAGE_RELEASE_NOTES
+
+ A description of the changes made in this release of the package,
+ often used in UI like the Updates tab of the Visual Studio Package
+ Manager in place of the package description.
+
+ * Mandatory : NO
+ * Default : -
+
+.. variable:: CPACK_NUGET_PACKAGE_COPYRIGHT
+ CPACK_NUGET_<compName>_PACKAGE_COPYRIGHT
+
+ Copyright details for the package.
+
+ * Mandatory : NO
+ * Default : -
+
+.. variable:: CPACK_NUGET_PACKAGE_TAGS
+ CPACK_NUGET_<compName>_PACKAGE_TAGS
+
+ A space-delimited list of tags and keywords that describe the
+ package and aid discoverability of packages through search and
+ filtering.
+
+ * Mandatory : NO
+ * Default : -
+
+.. variable:: CPACK_NUGET_PACKAGE_DEPENDENCIES
+ CPACK_NUGET_<compName>_PACKAGE_DEPENDENCIES
+
+ A list of package dependencies.
+
+ * Mandatory : NO
+ * Default : -
+
+.. variable:: CPACK_NUGET_PACKAGE_DEPENDENCIES_<dependency>_VERSION
+ CPACK_NUGET_<compName>_PACKAGE_DEPENDENCIES_<dependency>_VERSION
+
+ A `version specification`_ for the particular dependency, where
+ ``<dependency>`` is an item of the dependency list (see above)
+ transformed with ``MAKE_C_IDENTIFIER`` function of :command:`string`
+ command.
+
+ * Mandatory : NO
+ * Default : -
+
+.. variable:: CPACK_NUGET_PACKAGE_DEBUG
+
+ Enable debug messages while executing CPack NuGet generator.
+
+ * Mandatory : NO
+ * Default : OFF
+
+
+.. _nuget.org: http://nuget.org
+.. _version specification: https://docs.microsoft.com/en-us/nuget/reference/package-versioning#version-ranges-and-wildcards
+
+.. NuGet spec docs https://docs.microsoft.com/en-us/nuget/reference/nuspec
diff --git a/Help/cpack_gen/packagemaker.rst b/Help/cpack_gen/packagemaker.rst
new file mode 100644
index 0000000..f9abdd8
--- /dev/null
+++ b/Help/cpack_gen/packagemaker.rst
@@ -0,0 +1,23 @@
+CPack PackageMaker Generator
+----------------------------
+
+PackageMaker CPack generator (Mac OS X).
+
+Variables specific to CPack PackageMaker generator
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The following variable is specific to installers built on Mac
+OS X using PackageMaker:
+
+.. variable:: CPACK_OSX_PACKAGE_VERSION
+
+ The version of Mac OS X that the resulting PackageMaker archive should be
+ compatible with. Different versions of Mac OS X support different
+ features. For example, CPack can only build component-based installers for
+ Mac OS X 10.4 or newer, and can only build installers that download
+ component son-the-fly for Mac OS X 10.5 or newer. If left blank, this value
+ will be set to the minimum version of Mac OS X that supports the requested
+ features. Set this variable to some value (e.g., 10.4) only if you want to
+ guarantee that your installer will work on that version of Mac OS X, and
+ don't mind missing extra features available in the installer shipping with
+ later versions of Mac OS X.
diff --git a/Help/cpack_gen/productbuild.rst b/Help/cpack_gen/productbuild.rst
new file mode 100644
index 0000000..1a6e0f8
--- /dev/null
+++ b/Help/cpack_gen/productbuild.rst
@@ -0,0 +1,68 @@
+CPack productbuild Generator
+----------------------------
+
+productbuild CPack generator (Mac OS X).
+
+Variables specific to CPack productbuild generator
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The following variable is specific to installers built on Mac
+OS X using ProductBuild:
+
+.. variable:: CPACK_COMMAND_PRODUCTBUILD
+
+ Path to the productbuild(1) command used to generate a product archive for
+ the OS X Installer or Mac App Store. This variable can be used to override
+ the automatically detected command (or specify its location if the
+ auto-detection fails to find it.)
+
+.. variable:: CPACK_PRODUCTBUILD_IDENTITY_NAME
+
+ Adds a digital signature to the resulting package.
+
+
+.. variable:: CPACK_PRODUCTBUILD_KEYCHAIN_PATH
+
+ Specify a specific keychain to search for the signing identity.
+
+
+.. variable:: CPACK_COMMAND_PKGBUILD
+
+ Path to the pkgbuild(1) command used to generate an OS X component package
+ on OS X. This variable can be used to override the automatically detected
+ command (or specify its location if the auto-detection fails to find it.)
+
+
+.. variable:: CPACK_PKGBUILD_IDENTITY_NAME
+
+ Adds a digital signature to the resulting package.
+
+
+.. variable:: CPACK_PKGBUILD_KEYCHAIN_PATH
+
+ Specify a specific keychain to search for the signing identity.
+
+
+.. variable:: CPACK_PREFLIGHT_<COMP>_SCRIPT
+
+ Full path to a file that will be used as the ``preinstall`` script for the
+ named ``<COMP>`` component's package, where ``<COMP>`` is the uppercased
+ component name. No ``preinstall`` script is added if this variable is not
+ defined for a given component.
+
+
+.. variable:: CPACK_POSTFLIGHT_<COMP>_SCRIPT
+
+ Full path to a file that will be used as the ``postinstall`` script for the
+ named ``<COMP>`` component's package, where ``<COMP>`` is the uppercased
+ component name. No ``postinstall`` script is added if this variable is not
+ defined for a given component.
+
+
+.. variable:: CPACK_PRODUCTBUILD_RESOURCES_DIR
+
+ If specified the productbuild generator copies files from this directory
+ (including subdirectories) to the ``Resources`` directory. This is done
+ before the :variable:`CPACK_RESOURCE_FILE_WELCOME`,
+ :variable:`CPACK_RESOURCE_FILE_README`, and
+ :variable:`CPACK_RESOURCE_FILE_LICENSE` files are copied.
diff --git a/Help/cpack_gen/rpm.rst b/Help/cpack_gen/rpm.rst
new file mode 100644
index 0000000..0214766
--- /dev/null
+++ b/Help/cpack_gen/rpm.rst
@@ -0,0 +1,955 @@
+CPack RPM Generator
+-------------------
+
+The built in (binary) CPack RPM generator (Unix only)
+
+Variables specific to CPack RPM generator
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The CPack RPM generator may be used to create RPM packages using :module:`CPack`.
+The CPack RPM generator is a :module:`CPack` generator thus it uses the
+``CPACK_XXX`` variables used by :module:`CPack`.
+
+The CPack RPM generator has specific features which are controlled by the specifics
+:code:`CPACK_RPM_XXX` variables.
+
+: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 variables correspond to RPM spec file
+entities. One may find information about spec files here
+http://www.rpm.org/wiki/Docs
+
+.. note::
+
+ `<COMPONENT>` part of variables is preferred to be in upper case (for e.g. if
+ component is named `foo` then use `CPACK_RPM_FOO_XXXX` variable name format)
+ as is with other `CPACK_<COMPONENT>_XXXX` variables.
+ For the purposes of back compatibility (CMake/CPack version 3.5 and lower)
+ support for same cased component (e.g. `fOo` would be used as
+ `CPACK_RPM_fOo_XXXX`) is still supported for variables defined in older
+ versions of CMake/CPack but is not guaranteed for variables that
+ will be added in the future. For the sake of back compatibility same cased
+ component variables also override upper cased versions where both are
+ present.
+
+Here are some CPack RPM generator wiki resources that are here for historic reasons and
+are no longer maintained but may still prove useful:
+
+ - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/Configuration
+ - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/PackageGenerators#rpm-unix-only
+
+List of CPack RPM generator specific variables:
+
+.. variable:: CPACK_RPM_COMPONENT_INSTALL
+
+ Enable component packaging for CPack RPM generator
+
+ * 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
+
+ The RPM package summary.
+
+ * Mandatory : YES
+ * Default : :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`
+
+.. variable:: CPACK_RPM_PACKAGE_NAME
+ CPACK_RPM_<component>_PACKAGE_NAME
+
+ The RPM package name.
+
+ * Mandatory : YES
+ * Default : :variable:`CPACK_PACKAGE_NAME`
+
+.. variable:: CPACK_RPM_FILE_NAME
+ CPACK_RPM_<component>_FILE_NAME
+
+ Package file name.
+
+ * Mandatory : YES
+ * Default : ``<CPACK_PACKAGE_FILE_NAME>[-<component>].rpm`` with spaces
+ replaced by '-'
+
+ 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.
+
+ .. note::
+
+ By using user provided spec file, rpm macro extensions such as for
+ generating debuginfo packages or by simply using multiple components more
+ than one rpm file may be generated, either from a single spec file or from
+ multiple spec files (each component execution produces it's own spec file).
+ In such cases duplicate file names may occur as a result of this variable
+ setting or spec file content structure. 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_RPM_MAIN_COMPONENT
+
+ Main component that is packaged without component suffix.
+
+ * Mandatory : NO
+ * Default : -
+
+ This variable can be set to any component or group name so that component or
+ group rpm package is generated without component suffix in filename and
+ package name.
+
+.. variable:: CPACK_RPM_PACKAGE_EPOCH
+
+ The RPM package epoch
+
+ * Mandatory : No
+ * Default : -
+
+ Optional number that should be incremented when changing versioning schemas
+ or fixing mistakes in the version numbers of older packages.
+
+.. variable:: CPACK_RPM_PACKAGE_VERSION
+
+ The RPM package version.
+
+ * Mandatory : YES
+ * Default : :variable:`CPACK_PACKAGE_VERSION`
+
+.. variable:: CPACK_RPM_PACKAGE_ARCHITECTURE
+ CPACK_RPM_<component>_PACKAGE_ARCHITECTURE
+
+ The RPM package architecture.
+
+ * Mandatory : YES
+ * Default : Native architecture output by ``uname -m``
+
+ This may be set to ``noarch`` if you know you are building a noarch package.
+
+.. variable:: CPACK_RPM_PACKAGE_RELEASE
+
+ The RPM package release.
+
+ * Mandatory : YES
+ * Default : 1
+
+ This is the numbering of the RPM package itself, i.e. the version of the
+ packaging and not the version of the content (see
+ :variable:`CPACK_RPM_PACKAGE_VERSION`). One may change the default value if
+ the previous packaging was buggy and/or you want to put here a fancy Linux
+ distro specific numbering.
+
+.. note::
+
+ This is the string that goes into the RPM ``Release:`` field. Some distros
+ (e.g. Fedora, CentOS) require ``1%{?dist}`` format and not just a number.
+ ``%{?dist}`` part can be added by setting :variable:`CPACK_RPM_PACKAGE_RELEASE_DIST`.
+
+.. variable:: CPACK_RPM_PACKAGE_RELEASE_DIST
+
+ The dist tag that is added RPM ``Release:`` field.
+
+ * Mandatory : NO
+ * Default : OFF
+
+ This is the reported ``%{dist}`` tag from the current distribution or empty
+ ``%{dist}`` if RPM macro is not set. If this variable is set then RPM
+ ``Release:`` field value is set to ``${CPACK_RPM_PACKAGE_RELEASE}%{?dist}``.
+
+.. variable:: CPACK_RPM_PACKAGE_LICENSE
+
+ The RPM package license policy.
+
+ * Mandatory : YES
+ * Default : "unknown"
+
+.. variable:: CPACK_RPM_PACKAGE_GROUP
+ CPACK_RPM_<component>_PACKAGE_GROUP
+
+ The RPM package group.
+
+ * Mandatory : YES
+ * Default : "unknown"
+
+.. variable:: CPACK_RPM_PACKAGE_VENDOR
+
+ The RPM package vendor.
+
+ * Mandatory : YES
+ * Default : CPACK_PACKAGE_VENDOR if set or "unknown"
+
+.. variable:: CPACK_RPM_PACKAGE_URL
+ CPACK_RPM_<component>_PACKAGE_URL
+
+ The projects URL.
+
+ * Mandatory : NO
+ * Default : :variable:`CMAKE_PROJECT_HOMEPAGE_URL`
+
+.. variable:: CPACK_RPM_PACKAGE_DESCRIPTION
+ CPACK_RPM_<component>_PACKAGE_DESCRIPTION
+
+ RPM package description.
+
+ * Mandatory : YES
+ * 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
+
+ RPM compression type.
+
+ * Mandatory : NO
+ * Default : -
+
+ May be used to override RPM compression type to be used to build the
+ RPM. For example some Linux distribution now default to lzma or xz
+ compression whereas older cannot use such RPM. Using this one can enforce
+ compression type to be used.
+
+ Possible values are:
+
+ - lzma
+ - xz
+ - bzip2
+ - gzip
+
+.. variable:: CPACK_RPM_PACKAGE_AUTOREQ
+ CPACK_RPM_<component>_PACKAGE_AUTOREQ
+
+ RPM spec autoreq field.
+
+ * Mandatory : NO
+ * Default : -
+
+ May be used to enable (1, yes) or disable (0, no) automatic shared libraries
+ dependency detection. Dependencies are added to requires list.
+
+ .. note::
+
+ By default automatic dependency detection is enabled by rpm generator.
+
+.. variable:: CPACK_RPM_PACKAGE_AUTOPROV
+ CPACK_RPM_<component>_PACKAGE_AUTOPROV
+
+ RPM spec autoprov field.
+
+ * Mandatory : NO
+ * Default : -
+
+ May be used to enable (1, yes) or disable (0, no) automatic listing of shared
+ libraries that are provided by the package. Shared libraries are added to
+ provides list.
+
+ .. note::
+
+ By default automatic provides detection is enabled by rpm generator.
+
+.. variable:: CPACK_RPM_PACKAGE_AUTOREQPROV
+ CPACK_RPM_<component>_PACKAGE_AUTOREQPROV
+
+ RPM spec autoreqprov field.
+
+ * Mandatory : NO
+ * Default : -
+
+ Variable enables/disables autoreq and autoprov at the same time.
+ See :variable:`CPACK_RPM_PACKAGE_AUTOREQ` and :variable:`CPACK_RPM_PACKAGE_AUTOPROV`
+ for more details.
+
+ .. note::
+
+ By default automatic detection feature is enabled by rpm.
+
+.. variable:: CPACK_RPM_PACKAGE_REQUIRES
+ CPACK_RPM_<component>_PACKAGE_REQUIRES
+
+ RPM spec requires field.
+
+ * Mandatory : NO
+ * Default : -
+
+ May be used to set RPM dependencies (requires). Note that you must enclose
+ the complete requires string between quotes, for example::
+
+ set(CPACK_RPM_PACKAGE_REQUIRES "python >= 2.5.0, cmake >= 2.8")
+
+ The required package list of an RPM file could be printed with::
+
+ rpm -qp --requires file.rpm
+
+.. variable:: CPACK_RPM_PACKAGE_CONFLICTS
+ CPACK_RPM_<component>_PACKAGE_CONFLICTS
+
+ RPM spec conflicts field.
+
+ * 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::
+
+ set(CPACK_RPM_PACKAGE_CONFLICTS "libxml2")
+
+ The conflicting package list of an RPM file could be printed with::
+
+ rpm -qp --conflicts file.rpm
+
+.. variable:: CPACK_RPM_PACKAGE_REQUIRES_PRE
+ CPACK_RPM_<component>_PACKAGE_REQUIRES_PRE
+
+ RPM spec requires(pre) field.
+
+ * 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::
+
+ set(CPACK_RPM_PACKAGE_REQUIRES_PRE "shadow-utils, initscripts")
+
+.. variable:: CPACK_RPM_PACKAGE_REQUIRES_POST
+ CPACK_RPM_<component>_PACKAGE_REQUIRES_POST
+
+ RPM spec requires(post) field.
+
+ * 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::
+
+ set(CPACK_RPM_PACKAGE_REQUIRES_POST "shadow-utils, initscripts")
+
+.. variable:: CPACK_RPM_PACKAGE_REQUIRES_POSTUN
+ CPACK_RPM_<component>_PACKAGE_REQUIRES_POSTUN
+
+ RPM spec requires(postun) field.
+
+ * 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::
+
+ set(CPACK_RPM_PACKAGE_REQUIRES_POSTUN "shadow-utils, initscripts")
+
+.. variable:: CPACK_RPM_PACKAGE_REQUIRES_PREUN
+ CPACK_RPM_<component>_PACKAGE_REQUIRES_PREUN
+
+ RPM spec requires(preun) field.
+
+ * 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::
+
+ set(CPACK_RPM_PACKAGE_REQUIRES_PREUN "shadow-utils, initscripts")
+
+.. variable:: CPACK_RPM_PACKAGE_SUGGESTS
+ CPACK_RPM_<component>_PACKAGE_SUGGESTS
+
+ RPM spec suggest field.
+
+ * Mandatory : NO
+ * Default : -
+
+ May be used to set weak RPM dependencies (suggests). Note that you must
+ enclose the complete requires string between quotes.
+
+.. variable:: CPACK_RPM_PACKAGE_PROVIDES
+ CPACK_RPM_<component>_PACKAGE_PROVIDES
+
+ RPM spec provides field.
+
+ * Mandatory : NO
+ * Default : -
+
+ May be used to set RPM dependencies (provides). The provided package list
+ of an RPM file could be printed with::
+
+ rpm -qp --provides file.rpm
+
+.. variable:: CPACK_RPM_PACKAGE_OBSOLETES
+ CPACK_RPM_<component>_PACKAGE_OBSOLETES
+
+ RPM spec obsoletes field.
+
+ * Mandatory : NO
+ * Default : -
+
+ May be used to set RPM packages that are obsoleted by this one.
+
+.. variable:: CPACK_RPM_PACKAGE_RELOCATABLE
+
+ build a relocatable RPM.
+
+ * Mandatory : NO
+ * Default : CPACK_PACKAGE_RELOCATABLE
+
+ If this variable is set to TRUE or ON, the CPack RPM generator will try
+ to build a relocatable RPM package. A relocatable RPM may
+ be installed using::
+
+ rpm --prefix or --relocate
+
+ in order to install it at an alternate place see rpm(8). Note that
+ currently this may fail if :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_SPEC_MORE_DEFINE` instead.
+
+ * Mandatory : NO
+ * Default : -
+ * Deprecated: YES
+
+ May be used to override the ``__spec_install_post`` section within the
+ generated spec file. This affects the install step during package creation,
+ not during package installation. For adding operations to be performed
+ during package installation, use
+ :variable:`CPACK_RPM_POST_INSTALL_SCRIPT_FILE` instead.
+
+.. variable:: CPACK_RPM_SPEC_MORE_DEFINE
+
+ RPM extended spec definitions lines.
+
+ * Mandatory : NO
+ * Default : -
+
+ May be used to add any ``%define`` lines to the generated spec file. An
+ example of its use is to prevent stripping of executables (but note that
+ this may also disable other default post install processing)::
+
+ set(CPACK_RPM_SPEC_MORE_DEFINE "%define __spec_install_post /bin/true")
+
+.. variable:: CPACK_RPM_PACKAGE_DEBUG
+
+ Toggle CPack RPM generator debug output.
+
+ * Mandatory : NO
+ * Default : -
+
+ May be set when invoking cpack in order to trace debug information
+ during CPack RPM run. For example you may launch CPack like this::
+
+ cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM
+
+.. variable:: CPACK_RPM_USER_BINARY_SPECFILE
+ CPACK_RPM_<componentName>_USER_BINARY_SPECFILE
+
+ A user provided spec file.
+
+ * Mandatory : NO
+ * Default : -
+
+ May be set by the user in order to specify a USER binary spec file
+ to be used by the CPack RPM generator instead of generating the file.
+ The specified file will be processed by configure_file( @ONLY).
+
+.. variable:: CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
+
+ Spec file template.
+
+ * Mandatory : NO
+ * Default : -
+
+ If set CPack will generate a template for USER specified binary
+ spec file and stop with an error. For example launch CPack like this::
+
+ cpack -D CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE=1 -G RPM
+
+ The user may then use this file in order to hand-craft is own
+ binary spec file which may be used with
+ :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 referred script file (or both) will be read and directly
+ put after the ``%pre`` or ``%preun`` section
+ If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the (un)install
+ script for each component can be overridden with
+ ``CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE`` and
+ ``CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE``.
+ One may verify which scriptlet has been included with::
+
+ rpm -qp --scripts package.rpm
+
+.. 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 referred script file (or both) will be read and directly
+ put after the ``%post`` or ``%postun`` section.
+ If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the (un)install
+ script for each component can be overridden with
+ ``CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE`` and
+ ``CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE``.
+ One may verify which scriptlet has been included with::
+
+ rpm -qp --scripts package.rpm
+
+.. variable:: CPACK_RPM_USER_FILELIST
+ CPACK_RPM_<COMPONENT>_USER_FILELIST
+
+ * Mandatory : NO
+ * Default : -
+
+ May be used to explicitly specify ``%(<directive>)`` file line
+ in the spec file. Like ``%config(noreplace)`` or any other directive
+ that be found in the ``%files`` section. You can have multiple directives
+ per line, as in ``%attr(600,root,root) %config(noreplace)``. Since
+ the CPack RPM generator is generating the list of files (and directories) the
+ user specified files of the ``CPACK_RPM_<COMPONENT>_USER_FILELIST`` list will
+ be removed from the generated list. If referring to directories do
+ not add a trailing slash.
+
+.. variable:: CPACK_RPM_CHANGELOG_FILE
+
+ RPM changelog file.
+
+ * Mandatory : NO
+ * Default : -
+
+ May be used to embed a changelog in the spec file.
+ The referred file will be read and directly put after the ``%changelog``
+ section.
+
+.. variable:: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST
+
+ list of path to be excluded.
+
+ * Mandatory : NO
+ * Default : /etc /etc/init.d /usr /usr/bin /usr/include /usr/lib
+ /usr/libx32 /usr/lib64 /usr/share /usr/share/aclocal
+ /usr/share/doc
+
+ May be used to exclude path (directories or files) from the auto-generated
+ list of paths discovered by CPack RPM. The default 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 the CPack RPM generator will NOT any of
+ the default 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
+
+ additional list of path to be excluded.
+
+ * Mandatory : NO
+ * Default : -
+
+ May be used to add more exclude path (directories or files) from the initial
+ 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 :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 :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.
+
+.. 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 :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
+
+ May be used to remove CPACK_PACKAGING_INSTALL_PREFIX and CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX
+ from relocatable RPM prefix paths.
+
+.. variable:: CPACK_RPM_ADDITIONAL_MAN_DIRS
+
+ * Mandatory : NO
+ * Default : -
+
+ May be used to set additional man dirs that could potentially be compressed
+ by brp-compress RPM macro. Variable content must be a list of regular
+ expressions that point to directories containing man files or to man files
+ directly. Note that in order to compress man pages a path must also be
+ present in brp-compress RPM script and that brp-compress script must be
+ added to RPM configuration by the operating system.
+
+ Regular expressions that are added by default were taken from brp-compress
+ RPM macro:
+
+ - /usr/man/man.*
+ - /usr/man/.*/man.*
+ - /usr/info.*
+ - /usr/share/man/man.*
+ - /usr/share/man/.*/man.*
+ - /usr/share/info.*
+ - /usr/kerberos/man.*
+ - /usr/X11R6/man/man.*
+ - /usr/lib/perl5/man/man.*
+ - /usr/share/doc/.*/man/man.*
+ - /usr/lib/.*/man/man.*
+
+.. variable:: CPACK_RPM_DEFAULT_USER
+ CPACK_RPM_<compName>_DEFAULT_USER
+
+ default user ownership of RPM content
+
+ * Mandatory : NO
+ * Default : root
+
+ Value should be user name and not UID.
+ Note that <compName> must be in upper-case.
+
+.. variable:: CPACK_RPM_DEFAULT_GROUP
+ CPACK_RPM_<compName>_DEFAULT_GROUP
+
+ default group ownership of RPM content
+
+ * Mandatory : NO
+ * Default : root
+
+ Value should be group name and not GID.
+ Note that <compName> must be in upper-case.
+
+.. variable:: CPACK_RPM_DEFAULT_FILE_PERMISSIONS
+ CPACK_RPM_<compName>_DEFAULT_FILE_PERMISSIONS
+
+ default permissions used for packaged files
+
+ * 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
+ - WORLD_EXECUTE
+
+ Note that <compName> must be in upper-case.
+
+.. variable:: CPACK_RPM_DEFAULT_DIR_PERMISSIONS
+ CPACK_RPM_<compName>_DEFAULT_DIR_PERMISSIONS
+
+ default permissions used for packaged directories
+
+ * Mandatory : NO
+ * Default : - (system default)
+
+ Accepted values are lists with PERMISSIONS. Valid permissions
+ are the same as for :variable:`CPACK_RPM_DEFAULT_FILE_PERMISSIONS`.
+ Note that <compName> must be in upper-case.
+
+.. variable:: CPACK_RPM_INSTALL_WITH_EXEC
+
+ force execute permissions on programs and shared libraries
+
+ * Mandatory : NO
+ * Default : - (system default)
+
+ Force set owner, group and world execute permissions on programs and shared
+ libraries. This can be used for creating valid rpm packages on systems such
+ as Debian where shared libraries do not have execute permissions set.
+
+.. note::
+
+ Programs and shared libraries without execute permissions are ignored during
+ separation of debug symbols from the binary for debuginfo packages.
+
+Packaging of Symbolic Links
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The CPack RPM generator supports packaging of symbolic links::
+
+ execute_process(COMMAND ${CMAKE_COMMAND}
+ -E create_symlink <relative_path_location> <symlink_name>)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/<symlink_name>
+ DESTINATION <symlink_location> COMPONENT libraries)
+
+Symbolic links will be optimized (paths will be shortened if possible)
+before being added to the package or if multiple relocation paths are
+detected, a post install symlink relocation script will be generated.
+
+Symbolic links may point to locations that are not packaged by the same
+package (either a different component or even not packaged at all) but
+those locations will be treated as if they were a part of the package
+while determining if symlink should be either created or present in a
+post install script - depending on relocation paths.
+
+Symbolic links that point to locations outside packaging path produce a
+warning and are treated as non relocatable permanent symbolic links.
+
+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
+ a different component are treated the same way as if pointing to location
+ that will not be packaged.
+
+* Symbolic links pointing to a location through one or more intermediate
+ symbolic links will not be handled differently - if the intermediate
+ symbolic link(s) is also on a relocatable path, relocating it during
+ package installation may cause initial symbolic link to point to an
+ invalid location.
+
+Packaging of debug information
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Debuginfo packages contain debug symbols and sources for debugging packaged
+binaries.
+
+Debuginfo RPM packaging has it's own set of variables:
+
+.. variable:: CPACK_RPM_DEBUGINFO_PACKAGE
+ CPACK_RPM_<component>_DEBUGINFO_PACKAGE
+
+ Enable generation of debuginfo RPM package(s).
+
+ * Mandatory : NO
+ * Default : OFF
+
+.. note::
+
+ Binaries must contain debug symbols before packaging so use either ``Debug``
+ or ``RelWithDebInfo`` for :variable:`CMAKE_BUILD_TYPE` variable value.
+
+.. note::
+
+ Packages generated from packages without binary files, with binary files but
+ without execute permissions or without debug symbols will cause packaging
+ termination.
+
+.. variable:: CPACK_BUILD_SOURCE_DIRS
+
+ Provides locations of root directories of source files from which binaries
+ were built.
+
+ * Mandatory : YES if :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is set
+ * Default : -
+
+.. note::
+
+ For CMake project :variable:`CPACK_BUILD_SOURCE_DIRS` is set by default to
+ point to :variable:`CMAKE_SOURCE_DIR` and :variable:`CMAKE_BINARY_DIR` paths.
+
+.. note::
+
+ Sources with path prefixes that do not fall under any location provided with
+ :variable:`CPACK_BUILD_SOURCE_DIRS` will not be present in debuginfo package.
+
+.. variable:: CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX
+ CPACK_RPM_<component>_BUILD_SOURCE_DIRS_PREFIX
+
+ Prefix of location where sources will be placed during package installation.
+
+ * Mandatory : YES if :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is set
+ * Default : "/usr/src/debug/<CPACK_PACKAGE_FILE_NAME>" and
+ for component packaging "/usr/src/debug/<CPACK_PACKAGE_FILE_NAME>-<component>"
+
+.. note::
+
+ Each source path prefix is additionally suffixed by ``src_<index>`` where
+ index is index of the path used from :variable:`CPACK_BUILD_SOURCE_DIRS`
+ variable. This produces ``<CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX>/src_<index>``
+ replacement path.
+ Limitation is that replaced path part must be shorter or of equal
+ length than the length of its replacement. If that is not the case either
+ :variable:`CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX` variable has to be set to
+ a shorter path or source directories must be placed on a longer path.
+
+.. variable:: CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS
+
+ Directories containing sources that should be excluded from debuginfo packages.
+
+ * Mandatory : NO
+ * Default : "/usr /usr/src /usr/src/debug"
+
+ Listed paths are owned by other RPM packages and should therefore not be
+ deleted on debuginfo package uninstallation.
+
+.. variable:: CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS_ADDITION
+
+ Paths that should be appended to :variable:`CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS`
+ for exclusion.
+
+ * Mandatory : NO
+ * Default : -
+
+.. variable:: CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE
+
+ Create a single debuginfo package even if components packaging is set.
+
+ * Mandatory : NO
+ * Default : OFF
+
+ When this variable is enabled it produces a single debuginfo package even if
+ component packaging is enabled.
+
+ When using this feature in combination with components packaging and there is
+ more than one component this variable requires :variable:`CPACK_RPM_MAIN_COMPONENT`
+ to be set.
+
+.. note::
+
+ If none of the :variable:`CPACK_RPM_<component>_DEBUGINFO_PACKAGE` variables
+ is set then :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is automatically set to
+ ``ON`` when :variable:`CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE` is set.
+
+.. variable:: CPACK_RPM_DEBUGINFO_FILE_NAME
+ CPACK_RPM_<component>_DEBUGINFO_FILE_NAME
+
+ Debuginfo package file name.
+
+ * Mandatory : NO
+ * Default : rpmbuild tool generated package file name
+
+ Alternatively provided debuginfo package file name must end with ``.rpm``
+ suffix and should differ from file names of other generated packages.
+
+ Variable may contain ``@cpack_component@`` placeholder which will be
+ replaced by component name if component packaging is enabled otherwise it
+ deletes the placeholder.
+
+ Setting the variable to ``RPM-DEFAULT`` may be used to explicitly set
+ filename generation to default.
+
+.. note::
+
+ :variable:`CPACK_RPM_FILE_NAME` also supports rpmbuild tool generated package
+ file name - disabled by default but can be enabled by setting the variable to
+ ``RPM-DEFAULT``.
+
+Packaging of sources (SRPM)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+SRPM packaging is enabled by setting :variable:`CPACK_RPM_PACKAGE_SOURCES`
+variable while usually using :variable:`CPACK_INSTALLED_DIRECTORIES` variable
+to provide directory containing CMakeLists.txt and source files.
+
+For CMake projects SRPM package would be produced by executing::
+
+ cpack -G RPM --config ./CPackSourceConfig.cmake
+
+.. note::
+
+ Produced SRPM package is expected to be built with :manual:`cmake(1)` executable
+ and packaged with :manual:`cpack(1)` executable so CMakeLists.txt has to be
+ located in root source directory and must be able to generate binary rpm
+ packages by executing ``cpack -G`` command. The two executables as well as
+ rpmbuild must also be present when generating binary rpm packages from the
+ produced SRPM package.
+
+Once the SRPM package is generated it can be used to generate binary packages
+by creating a directory structure for rpm generation and executing rpmbuild
+tool::
+
+ mkdir -p build_dir/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
+ rpmbuild --define "_topdir <path_to_build_dir>" --rebuild <SRPM_file_name>
+
+Generated packages will be located in build_dir/RPMS directory or its sub
+directories.
+
+.. note::
+
+ SRPM package internally uses CPack/RPM generator to generate binary packages
+ so CMakeScripts.txt can decide during the SRPM to binary rpm generation step
+ what content the package(s) should have as well as how they should be packaged
+ (monolithic or components). CMake can decide this for e.g. by reading environment
+ variables set by the package manager before starting the process of generating
+ binary rpm packages. This way a single SRPM package can be used to produce
+ different binary rpm packages on different platforms depending on the platform's
+ packaging rules.
+
+Source RPM packaging has it's own set of variables:
+
+.. variable:: CPACK_RPM_PACKAGE_SOURCES
+
+ Should the content be packaged as a source rpm (default is binary rpm).
+
+ * Mandatory : NO
+ * Default : OFF
+
+.. note::
+
+ For cmake projects :variable:`CPACK_RPM_PACKAGE_SOURCES` variable is set
+ to ``OFF`` in CPackConfig.cmake and ``ON`` in CPackSourceConfig.cmake
+ generated files.
+
+.. variable:: CPACK_RPM_SOURCE_PKG_BUILD_PARAMS
+
+ Additional command-line parameters provided to :manual:`cmake(1)` executable.
+
+ * Mandatory : NO
+ * Default : -
+
+.. variable:: CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX
+
+ Packaging install prefix that would be provided in :variable:`CPACK_PACKAGING_INSTALL_PREFIX`
+ variable for producing binary RPM packages.
+
+ * Mandatory : YES
+ * Default : "/"
+
+.. VARIABLE:: CPACK_RPM_BUILDREQUIRES
+
+ List of source rpm build dependencies.
+
+ * Mandatory : NO
+ * Default : -
+
+ May be used to set source RPM build dependencies (BuildRequires). Note that
+ you must enclose the complete build requirements string between quotes, for
+ example::
+
+ set(CPACK_RPM_BUILDREQUIRES "python >= 2.5.0, cmake >= 2.8")
diff --git a/Help/cpack_gen/wix.rst b/Help/cpack_gen/wix.rst
new file mode 100644
index 0000000..fc8a098
--- /dev/null
+++ b/Help/cpack_gen/wix.rst
@@ -0,0 +1,284 @@
+CPack WiX Generator
+-------------------
+
+CPack WiX generator specific options
+
+Variables specific to CPack WiX generator
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The following variables are specific to the installers built on
+Windows using WiX.
+
+.. variable:: CPACK_WIX_UPGRADE_GUID
+
+ Upgrade GUID (``Product/@UpgradeCode``)
+
+ Will be automatically generated unless explicitly provided.
+
+ It should be explicitly set to a constant generated globally unique
+ identifier (GUID) to allow your installers to replace existing
+ installations that use the same GUID.
+
+ You may for example explicitly set this variable in your
+ CMakeLists.txt to the value that has been generated per default. You
+ should not use GUIDs that you did not generate yourself or which may
+ belong to other projects.
+
+ A GUID shall have the following fixed length syntax::
+
+ XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
+
+ (each X represents an uppercase hexadecimal digit)
+
+.. variable:: CPACK_WIX_PRODUCT_GUID
+
+ Product GUID (``Product/@Id``)
+
+ Will be automatically generated unless explicitly provided.
+
+ If explicitly provided this will set the Product Id of your installer.
+
+ The installer will abort if it detects a pre-existing installation that
+ uses the same GUID.
+
+ The GUID shall use the syntax described for CPACK_WIX_UPGRADE_GUID.
+
+.. variable:: CPACK_WIX_LICENSE_RTF
+
+ RTF License File
+
+ If CPACK_RESOURCE_FILE_LICENSE has an .rtf extension it is used as-is.
+
+ If CPACK_RESOURCE_FILE_LICENSE has an .txt extension it is implicitly
+ converted to RTF by the WiX Generator.
+ The expected encoding of the .txt file is UTF-8.
+
+ With CPACK_WIX_LICENSE_RTF you can override the license file used by the
+ WiX Generator in case CPACK_RESOURCE_FILE_LICENSE is in an unsupported
+ format or the .txt -> .rtf conversion does not work as expected.
+
+.. variable:: CPACK_WIX_PRODUCT_ICON
+
+ The Icon shown next to the program name in Add/Remove programs.
+
+ If set, this icon is used in place of the default icon.
+
+.. variable:: CPACK_WIX_UI_REF
+
+ This variable allows you to override the Id of the ``<UIRef>`` element
+ in the WiX template.
+
+ The default is ``WixUI_InstallDir`` in case no CPack components have
+ been defined and ``WixUI_FeatureTree`` otherwise.
+
+.. variable:: CPACK_WIX_UI_BANNER
+
+ The bitmap will appear at the top of all installer pages other than the
+ welcome and completion dialogs.
+
+ If set, this image will replace the default banner image.
+
+ This image must be 493 by 58 pixels.
+
+.. variable:: CPACK_WIX_UI_DIALOG
+
+ Background bitmap used on the welcome and completion dialogs.
+
+ If this variable is set, the installer will replace the default dialog
+ image.
+
+ This image must be 493 by 312 pixels.
+
+.. variable:: CPACK_WIX_PROGRAM_MENU_FOLDER
+
+ Start menu folder name for launcher.
+
+ If this variable is not set, it will be initialized with CPACK_PACKAGE_NAME
+
+.. variable:: CPACK_WIX_CULTURES
+
+ Language(s) of the installer
+
+ Languages are compiled into the WixUI extension library. To use them,
+ simply provide the name of the culture. If you specify more than one
+ culture identifier in a comma or semicolon delimited list, the first one
+ that is found will be used. You can find a list of supported languages at:
+ http://wix.sourceforge.net/manual-wix3/WixUI_localization.htm
+
+.. variable:: CPACK_WIX_TEMPLATE
+
+ Template file for WiX generation
+
+ If this variable is set, the specified template will be used to generate
+ the WiX wxs file. This should be used if further customization of the
+ output is required.
+
+ If this variable is not set, the default MSI template included with CMake
+ will be used.
+
+.. variable:: CPACK_WIX_PATCH_FILE
+
+ Optional list of XML files with fragments to be inserted into
+ generated WiX sources
+
+ This optional variable can be used to specify an XML file that the
+ WiX generator will use to inject fragments into its generated
+ source files.
+
+ Patch files understood by the CPack WiX generator
+ roughly follow this RELAX NG compact schema:
+
+ .. code-block:: none
+
+ start = CPackWiXPatch
+
+ CPackWiXPatch = element CPackWiXPatch { CPackWiXFragment* }
+
+ CPackWiXFragment = element CPackWiXFragment
+ {
+ attribute Id { string },
+ fragmentContent*
+ }
+
+ fragmentContent = element * - CPackWiXFragment
+ {
+ (attribute * { text } | text | fragmentContent)*
+ }
+
+ Currently fragments can be injected into most
+ Component, File, Directory and Feature elements.
+
+ The following additional special Ids can be used:
+
+ * ``#PRODUCT`` for the ``<Product>`` element.
+ * ``#PRODUCTFEATURE`` for the root ``<Feature>`` element.
+
+ The following example illustrates how this works.
+
+ Given that the WiX generator creates the following XML element:
+
+ .. code-block:: xml
+
+ <Component Id="CM_CP_applications.bin.my_libapp.exe" Guid="*"/>
+
+ The following XML patch file may be used to inject an Environment element
+ into it:
+
+ .. code-block:: xml
+
+ <CPackWiXPatch>
+ <CPackWiXFragment Id="CM_CP_applications.bin.my_libapp.exe">
+ <Environment Id="MyEnvironment" Action="set"
+ Name="MyVariableName" Value="MyVariableValue"/>
+ </CPackWiXFragment>
+ </CPackWiXPatch>
+
+.. variable:: CPACK_WIX_EXTRA_SOURCES
+
+ Extra WiX source files
+
+ This variable provides an optional list of extra WiX source files (.wxs)
+ that should be compiled and linked. The full path to source files is
+ required.
+
+.. variable:: CPACK_WIX_EXTRA_OBJECTS
+
+ Extra WiX object files or libraries
+
+ This variable provides an optional list of extra WiX object (.wixobj)
+ and/or WiX library (.wixlib) files. The full path to objects and libraries
+ is required.
+
+.. variable:: CPACK_WIX_EXTENSIONS
+
+ This variable provides a list of additional extensions for the WiX
+ tools light and candle.
+
+.. variable:: CPACK_WIX_<TOOL>_EXTENSIONS
+
+ This is the tool specific version of CPACK_WIX_EXTENSIONS.
+ ``<TOOL>`` can be either LIGHT or CANDLE.
+
+.. variable:: CPACK_WIX_<TOOL>_EXTRA_FLAGS
+
+ This list variable allows you to pass additional
+ flags to the WiX tool ``<TOOL>``.
+
+ Use it at your own risk.
+ Future versions of CPack may generate flags which may be in conflict
+ with your own flags.
+
+ ``<TOOL>`` can be either LIGHT or CANDLE.
+
+.. variable:: CPACK_WIX_CMAKE_PACKAGE_REGISTRY
+
+ If this variable is set the generated installer will create
+ an entry in the windows registry key
+ ``HKEY_LOCAL_MACHINE\Software\Kitware\CMake\Packages\<PackageName>``
+ The value for ``<PackageName>`` is provided by this variable.
+
+ Assuming you also install a CMake configuration file this will
+ allow other CMake projects to find your package with
+ the :command:`find_package` command.
+
+.. variable:: CPACK_WIX_PROPERTY_<PROPERTY>
+
+ This variable can be used to provide a value for
+ the Windows Installer property ``<PROPERTY>``
+
+ The following list contains some example properties that can be used to
+ customize information under
+ "Programs and Features" (also known as "Add or Remove Programs")
+
+ * ARPCOMMENTS - Comments
+ * ARPHELPLINK - Help and support information URL
+ * ARPURLINFOABOUT - General information URL
+ * ARPURLUPDATEINFO - Update information URL
+ * ARPHELPTELEPHONE - Help and support telephone number
+ * ARPSIZE - Size (in kilobytes) of the application
+
+.. variable:: CPACK_WIX_ROOT_FEATURE_TITLE
+
+ Sets the name of the root install feature in the WIX installer. Same as
+ CPACK_COMPONENT_<compName>_DISPLAY_NAME for components.
+
+.. variable:: CPACK_WIX_ROOT_FEATURE_DESCRIPTION
+
+ Sets the description of the root install feature in the WIX installer. Same as
+ CPACK_COMPONENT_<compName>_DESCRIPTION for components.
+
+.. variable:: CPACK_WIX_SKIP_PROGRAM_FOLDER
+
+ If this variable is set to true, the default install location
+ of the generated package will be CPACK_PACKAGE_INSTALL_DIRECTORY directly.
+ The install location will not be located relatively below
+ ProgramFiles or ProgramFiles64.
+
+ .. note::
+ Installers created with this feature do not take differences
+ between the system on which the installer is created
+ and the system on which the installer might be used into account.
+
+ It is therefore possible that the installer e.g. might try to install
+ onto a drive that is unavailable or unintended or a path that does not
+ follow the localization or convention of the system on which the
+ installation is performed.
+
+.. variable:: CPACK_WIX_ROOT_FOLDER_ID
+
+ This variable allows specification of a custom root folder ID.
+ The generator specific ``<64>`` token can be used for
+ folder IDs that come in 32-bit and 64-bit variants.
+ In 32-bit builds the token will expand empty while in 64-bit builds
+ it will expand to ``64``.
+
+ When unset generated installers will default installing to
+ ``ProgramFiles<64>Folder``.
+
+.. variable:: CPACK_WIX_ROOT
+
+ This variable can optionally be set to the root directory
+ of a custom WiX Toolset installation.
+
+ When unspecified CPack will try to locate a WiX Toolset
+ installation via the ``WIX`` environment variable instead.
diff --git a/Help/dev/maint.rst b/Help/dev/maint.rst
index ec76479..a8942cd 100644
--- a/Help/dev/maint.rst
+++ b/Help/dev/maint.rst
@@ -51,15 +51,18 @@ using a local branch named ``release-$ver``, where ``$ver`` is the version
number of the current release in the form ``$major.$minor``. It is always
merged into ``master`` before publishing.
-To merge some ``$topic`` branch into ``release``, first create the local
-branch:
+Before merging a ``$topic`` branch into ``release``, verify that the
+``$topic`` branch has already been merged to ``master`` via the usual
+``Do: merge`` process. Then, to merge the ``$topic`` branch into
+``release``, start by creating the local branch:
.. code-block:: shell
git fetch origin
git checkout -b release-$ver origin/release
-Merge the ``$topic`` branch into the local ``release-$ver`` branch:
+Merge the ``$topic`` branch into the local ``release-$ver`` branch, making
+sure to include a ``Merge-request: !xxxx`` footer in the commit message:
.. code-block:: shell
diff --git a/Help/dev/testing.rst b/Help/dev/testing.rst
index 1b29acf..23d0ca3 100644
--- a/Help/dev/testing.rst
+++ b/Help/dev/testing.rst
@@ -26,13 +26,14 @@ commands to set up a new integration testing client:
$ git clone https://gitlab.kitware.com/cmake/dashboard-scripts.git CMakeScripts
$ cd CMakeScripts
-The ``cmake_common.cmake`` script contains comments at the top with
+The `cmake_common.cmake`_ script contains comments at the top with
instructions to set up a testing client. As it instructs, create a
CTest script with local settings and include ``cmake_common.cmake``.
.. _`CMake Review Process`: review.rst
.. _`CMake CDash Page`: https://open.cdash.org/index.php?project=CMake
.. _`CMake Dashboard Scripts Repository`: https://gitlab.kitware.com/cmake/dashboard-scripts
+.. _`cmake_common.cmake`: https://gitlab.kitware.com/cmake/dashboard-scripts/blob/master/cmake_common.cmake
Nightly Start Time
------------------
diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst
index 4d31690..1b4960d 100644
--- a/Help/generator/Green Hills MULTI.rst
+++ b/Help/generator/Green Hills MULTI.rst
@@ -3,12 +3,48 @@ Green Hills MULTI
Generates Green Hills MULTI project files (experimental, work-in-progress).
-Customizations are available through the following cache variables:
+Customizations that are used to pick toolset and target system:
+
+The ``-A <arch>`` can be supplied for setting the target architecture.
+``<arch>`` usually is one of "arm", "ppc", "86", etcetera. If the target architecture
+is not specified then the default architecture of "arm" will be used.
+
+The ``-T <toolset>`` can be supplied for setting the toolset to be used.
+All toolsets are expected to be located at ``GHS_TOOLSET_ROOT``.
+If the toolset is not specified then the latest toolset will be used.
+
+* ``GHS_TARGET_PLATFORM``
+
+Default to ``integrity``.
+Usual values are ``integrity``, ``threadx``, ``uvelosity``,
+``velosity``, ``vxworks``, ``standalone``.
+
+* ``GHS_PRIMARY_TARGET``
+
+Sets ``primaryTarget`` field in project file.
+Defaults to ``<arch>_<GHS_TARGET_PLATFORM>.tgt``.
+
+* ``GHS_TOOLSET_ROOT``
+
+Default to ``C:/ghs``. Root path for ``toolset``.
+
+* ``GHS_OS_ROOT``
+
+Default to ``C:/ghs``. Root path for RTOS searches.
+
+* ``GHS_OS_DIR``
+
+Default to latest platform OS installation at ``GHS_OS_ROOT``. Set this value if
+a specific RTOS is to be used.
* ``GHS_BSP_NAME``
+
+Defaults to ``sim<arch>`` if not set by user.
+
+Customizations are available through the following cache variables:
+
* ``GHS_CUSTOMIZATION``
* ``GHS_GPJ_MACROS``
-* ``GHS_OS_DIR``
.. note::
This generator is deemed experimental as of CMake |release|
diff --git a/Help/generator/Visual Studio 10 2010.rst b/Help/generator/Visual Studio 10 2010.rst
index 04eef10..b8d6872 100644
--- a/Help/generator/Visual Studio 10 2010.rst
+++ b/Help/generator/Visual Studio 10 2010.rst
@@ -18,6 +18,12 @@ a target platform name optionally at the end of this generator name:
For compatibility with CMake versions prior to 3.0, one may specify this
generator using the name ``Visual Studio 10`` without the year component.
+Project Types
+^^^^^^^^^^^^^
+
+Only Visual C++ and C# projects may be generated. Other types of
+projects (Database, Website, etc.) are not supported.
+
Toolset Selection
^^^^^^^^^^^^^^^^^
diff --git a/Help/generator/Visual Studio 11 2012.rst b/Help/generator/Visual Studio 11 2012.rst
index 347a153..8e9998a 100644
--- a/Help/generator/Visual Studio 11 2012.rst
+++ b/Help/generator/Visual Studio 11 2012.rst
@@ -21,6 +21,12 @@ a target platform name optionally at the end of this generator name:
For compatibility with CMake versions prior to 3.0, one may specify this
generator using the name "Visual Studio 11" without the year component.
+Project Types
+^^^^^^^^^^^^^
+
+Only Visual C++ and C# projects may be generated. Other types of
+projects (JavaScript, Database, Website, etc.) are not supported.
+
Toolset Selection
^^^^^^^^^^^^^^^^^
diff --git a/Help/generator/Visual Studio 12 2013.rst b/Help/generator/Visual Studio 12 2013.rst
index 5071b20..03f7586 100644
--- a/Help/generator/Visual Studio 12 2013.rst
+++ b/Help/generator/Visual Studio 12 2013.rst
@@ -18,6 +18,12 @@ a target platform name optionally at the end of this generator name:
For compatibility with CMake versions prior to 3.0, one may specify this
generator using the name "Visual Studio 12" without the year component.
+Project Types
+^^^^^^^^^^^^^
+
+Only Visual C++ and C# projects may be generated. Other types of
+projects (JavaScript, Powershell, Python, etc.) are not supported.
+
Toolset Selection
^^^^^^^^^^^^^^^^^
diff --git a/Help/generator/Visual Studio 14 2015.rst b/Help/generator/Visual Studio 14 2015.rst
index 64254b5..e55bc73 100644
--- a/Help/generator/Visual Studio 14 2015.rst
+++ b/Help/generator/Visual Studio 14 2015.rst
@@ -15,6 +15,12 @@ a target platform name optionally at the end of this generator name:
``Visual Studio 14 2015 ARM``
Specify target platform ``ARM``.
+Project Types
+^^^^^^^^^^^^^
+
+Only Visual C++ and C# projects may be generated. Other types of
+projects (JavaScript, Powershell, Python, etc.) are not supported.
+
Toolset Selection
^^^^^^^^^^^^^^^^^
diff --git a/Help/generator/Visual Studio 15 2017.rst b/Help/generator/Visual Studio 15 2017.rst
index 2cf1aa0..809be4b 100644
--- a/Help/generator/Visual Studio 15 2017.rst
+++ b/Help/generator/Visual Studio 15 2017.rst
@@ -15,6 +15,12 @@ a target platform name optionally at the end of this generator name:
``Visual Studio 15 2017 ARM``
Specify target platform ``ARM``.
+Project Types
+^^^^^^^^^^^^^
+
+Only Visual C++ and C# projects may be generated. Other types of
+projects (JavaScript, Powershell, Python, etc.) are not supported.
+
Instance Selection
^^^^^^^^^^^^^^^^^^
diff --git a/Help/index.rst b/Help/index.rst
index fa5273c..fe1b73c 100644
--- a/Help/index.rst
+++ b/Help/index.rst
@@ -41,6 +41,7 @@ Reference Manuals
/manual/cmake-server.7
/manual/cmake-toolchains.7
/manual/cmake-variables.7
+ /manual/cpack-generators.7
.. only:: html or text
diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst
index 49375e9..dd7934a 100644
--- a/Help/manual/cmake-buildsystem.7.rst
+++ b/Help/manual/cmake-buildsystem.7.rst
@@ -784,7 +784,7 @@ A *library* output artifact of a buildsystem target may be:
with the ``MODULE`` option.
* On non-DLL platforms: the shared library file (e.g. ``.so`` or ``.dylib``)
- of a shared shared library target created by the :command:`add_library`
+ of a shared library target created by the :command:`add_library`
command with the ``SHARED`` option.
The :prop_tgt:`LIBRARY_OUTPUT_DIRECTORY` and :prop_tgt:`LIBRARY_OUTPUT_NAME`
diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst
index 408a3a0..753647d 100644
--- a/Help/manual/cmake-commands.7.rst
+++ b/Help/manual/cmake-commands.7.rst
@@ -78,6 +78,7 @@ These commands are available only in CMake projects.
/command/add_dependencies
/command/add_executable
/command/add_library
+ /command/add_link_options
/command/add_subdirectory
/command/add_test
/command/aux_source_directory
@@ -111,6 +112,7 @@ These commands are available only in CMake projects.
/command/target_compile_options
/command/target_include_directories
/command/target_link_libraries
+ /command/target_link_options
/command/target_sources
/command/try_compile
/command/try_run
diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst
index 32e8cfc..f05c4b1 100644
--- a/Help/manual/cmake-developer.7.rst
+++ b/Help/manual/cmake-developer.7.rst
@@ -579,11 +579,11 @@ file and the ``Help/manual/cmake-modules.7.rst`` toctree entry.
Find Modules
------------
-A "find module" is a ``Modules/Find<package>.cmake`` file to be loaded
-by the :command:`find_package` command when invoked for ``<package>``.
+A "find module" is a ``Modules/Find<PackageName>.cmake`` file to be loaded
+by the :command:`find_package` command when invoked for ``<PackageName>``.
The primary task of a find module is to determine whether a package
-exists on the system, set the ``<package>_FOUND`` variable to reflect
+exists on the system, set the ``<PackageName>_FOUND`` variable to reflect
this and provide any variables, macros and imported targets required to
use the package. A find module is useful in cases where an upstream
library does not provide a
diff --git a/Help/manual/cmake-language.7.rst b/Help/manual/cmake-language.7.rst
index 87f8f9d..591f73d 100644
--- a/Help/manual/cmake-language.7.rst
+++ b/Help/manual/cmake-language.7.rst
@@ -399,6 +399,11 @@ and how their values are set.
An *environment variable reference* has the form ``$ENV{VAR}`` and
is evaluated in the same contexts as a normal variable reference.
+See :variable:`ENV` for more information.
+
+A *cache variable reference* has the form ``$CACHE{VAR}`` and
+is evaluated in the same contexts as a normal variable reference.
+See :variable:`CACHE` for more information.
Comments
--------
@@ -543,6 +548,8 @@ to the binding in the current directory scope, if any. If a
is found, or no binding is found, CMake then searches for a
cache entry. If a cache entry is found, its value is used.
Otherwise, the variable reference evaluates to an empty string.
+The ``$CACHE{VAR}`` syntax can be used to do direct cache entry
+lookups.
The :manual:`cmake-variables(7)` manual documents many variables
that are provided by CMake or have meaning to CMake when set
diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst
index 8ef4d7d..b7276b6 100644
--- a/Help/manual/cmake-modules.7.rst
+++ b/Help/manual/cmake-modules.7.rst
@@ -54,22 +54,10 @@ All Modules
/module/CMakePrintSystemInformation
/module/CMakePushCheckState
/module/CMakeVerifyManifest
- /module/CPackArchive
- /module/CPackBundle
/module/CPackComponent
- /module/CPackCygwin
- /module/CPackDeb
- /module/CPackDMG
- /module/CPackFreeBSD
/module/CPackIFW
/module/CPackIFWConfigureFile
- /module/CPackNSIS
- /module/CPackNuGet
- /module/CPackPackageMaker
- /module/CPackProductBuild
- /module/CPackRPM
/module/CPack
- /module/CPackWIX
/module/CSharpUtilities
/module/CTest
/module/CTestCoverageCollectGCOV
@@ -263,3 +251,26 @@ All Modules
/module/Use_wxWindows
/module/WriteBasicConfigVersionFile
/module/WriteCompilerDetectionHeader
+
+Legacy CPack Modules
+====================
+
+These modules used to be mistakenly exposed to the user, and have been moved
+out of user visibility. They are for CPack internal use, and should never be
+used directly.
+
+.. toctree::
+ :maxdepth: 1
+
+ /module/CPackArchive
+ /module/CPackBundle
+ /module/CPackCygwin
+ /module/CPackDeb
+ /module/CPackDMG
+ /module/CPackFreeBSD
+ /module/CPackNSIS
+ /module/CPackNuGet
+ /module/CPackPackageMaker
+ /module/CPackProductBuild
+ /module/CPackRPM
+ /module/CPackWIX
diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst
index c9442bc..876ca84 100644
--- a/Help/manual/cmake-packages.7.rst
+++ b/Help/manual/cmake-packages.7.rst
@@ -73,7 +73,7 @@ Handling of ``COMPONENTS`` and ``OPTIONAL_COMPONENTS`` is defined by the
package.
By setting the :variable:`CMAKE_DISABLE_FIND_PACKAGE_<PackageName>` variable to
-``TRUE``, the ``PackageName`` package will not be searched, and will always
+``TRUE``, the ``<PackageName>`` package will not be searched, and will always
be ``NOTFOUND``.
.. _`Config File Packages`:
@@ -92,9 +92,9 @@ packages, that is, they belong with the header files and any other files
provided to assist downstreams in using the package.
A set of variables which provide package status information are also set
-automatically when using a config-file package. The ``<Package>_FOUND``
+automatically when using a config-file package. The ``<PackageName>_FOUND``
variable is set to true or false, depending on whether the package was
-found. The ``<Package>_DIR`` cache variable is set to the location of the
+found. The ``<PackageName>_DIR`` cache variable is set to the location of the
package configuration file.
Find-module Packages
@@ -108,10 +108,10 @@ file, it is not shipped with upstream, but is used by downstream to find the
files by guessing locations of files with platform-specific hints.
Unlike the case of an upstream-provided package configuration file, no single point
-of reference identifies the package as being found, so the ``<Package>_FOUND``
+of reference identifies the package as being found, so the ``<PackageName>_FOUND``
variable is not automatically set by the :command:`find_package` command. It
can still be expected to be set by convention however and should be set by
-the author of the Find-module. Similarly there is no ``<Package>_DIR`` variable,
+the author of the Find-module. Similarly there is no ``<PackageName>_DIR`` variable,
but each of the artifacts such as library locations and header file locations
provide a separate cache variable.
@@ -197,7 +197,7 @@ When the :command:`find_package` command loads a version file it first sets the
following variables:
``PACKAGE_FIND_NAME``
- The <package> name
+ The ``<PackageName>``
``PACKAGE_FIND_VERSION``
Full requested version string
@@ -240,26 +240,26 @@ variables. When the version file claims to be an acceptable match for the
requested version the find_package command sets the following variables for
use by the project:
-``<package>_VERSION``
+``<PackageName>_VERSION``
Full provided version string
-``<package>_VERSION_MAJOR``
+``<PackageName>_VERSION_MAJOR``
Major version if provided, else 0
-``<package>_VERSION_MINOR``
+``<PackageName>_VERSION_MINOR``
Minor version if provided, else 0
-``<package>_VERSION_PATCH``
+``<PackageName>_VERSION_PATCH``
Patch version if provided, else 0
-``<package>_VERSION_TWEAK``
+``<PackageName>_VERSION_TWEAK``
Tweak version if provided, else 0
-``<package>_VERSION_COUNT``
+``<PackageName>_VERSION_COUNT``
Number of version components, 0 to 4
The variables report the version of the package that was actually found.
-The ``<package>`` part of their name matches the argument given to the
+The ``<PackageName>`` part of their name matches the argument given to the
:command:`find_package` command.
.. _`Creating Packages`:
@@ -347,8 +347,8 @@ The :module:`CMakePackageConfigHelpers` module provides a macro for creating
a simple ``ConfigVersion.cmake`` file. This file sets the version of the
package. It is read by CMake when :command:`find_package` is called to
determine the compatibility with the requested version, and to set some
-version-specific variables ``<Package>_VERSION``, ``<Package>_VERSION_MAJOR``,
-``<Package>_VERSION_MINOR`` etc. The :command:`install(EXPORT)` command is
+version-specific variables ``<PackageName>_VERSION``, ``<PackageName>_VERSION_MAJOR``,
+``<PackageName>_VERSION_MINOR`` etc. The :command:`install(EXPORT)` command is
used to export the targets in the ``ClimbingStatsTargets`` export-set, defined
previously by the :command:`install(TARGETS)` command. This command generates
the ``ClimbingStatsTargets.cmake`` file to contain :prop_tgt:`IMPORTED`
@@ -432,8 +432,8 @@ the dependency is not found, along with a diagnostic that the ``ClimbingStats``
package can not be used without the ``Stats`` package.
If ``COMPONENTS`` are specified when the downstream uses :command:`find_package`,
-they are listed in the ``<Package>_FIND_COMPONENTS`` variable. If a particular
-component is non-optional, then the ``<Package>_FIND_REQUIRED_<comp>`` will
+they are listed in the ``<PackageName>_FIND_COMPONENTS`` variable. If a particular
+component is non-optional, then the ``<PackageName>_FIND_REQUIRED_<comp>`` will
be true. This can be tested with logic in the package configuration file:
.. code-block:: cmake
@@ -580,8 +580,8 @@ non-standard install locations or directly in their own build trees.
A project may populate either the user or system registry (using its own
means, see below) to refer to its location.
In either case the package should store at the registered location a
-`Package Configuration File`_ (``<package>Config.cmake``) and optionally a
-`Package Version File`_ (``<package>ConfigVersion.cmake``).
+`Package Configuration File`_ (``<PackageName>Config.cmake``) and optionally a
+`Package Version File`_ (``<PackageName>ConfigVersion.cmake``).
The :command:`find_package` command searches the two package registries
as two of the search steps specified in its documentation. If it has
@@ -603,18 +603,18 @@ must be manually taught to register their packages if desired.
On Windows the user package registry is stored in the Windows registry
under a key in ``HKEY_CURRENT_USER``.
-A ``<package>`` may appear under registry key::
+A ``<PackageName>`` may appear under registry key::
- HKEY_CURRENT_USER\Software\Kitware\CMake\Packages\<package>
+ HKEY_CURRENT_USER\Software\Kitware\CMake\Packages\<PackageName>
as a ``REG_SZ`` value, with arbitrary name, that specifies the directory
containing the package configuration file.
On UNIX platforms the user package registry is stored in the user home
-directory under ``~/.cmake/packages``. A ``<package>`` may appear under
+directory under ``~/.cmake/packages``. A ``<PackageName>`` may appear under
the directory::
- ~/.cmake/packages/<package>
+ ~/.cmake/packages/<PackageName>
as a file, with arbitrary name, whose content specifies the directory
containing the package configuration file.
@@ -629,10 +629,10 @@ CMake currently provides no interface to add to the system package registry.
Installers must be manually taught to register their packages if desired.
On Windows the system package registry is stored in the Windows registry
-under a key in ``HKEY_LOCAL_MACHINE``. A ``<package>`` may appear under
+under a key in ``HKEY_LOCAL_MACHINE``. A ``<PackageName>`` may appear under
registry key::
- HKEY_LOCAL_MACHINE\Software\Kitware\CMake\Packages\<package>
+ HKEY_LOCAL_MACHINE\Software\Kitware\CMake\Packages\<PackageName>
as a ``REG_SZ`` value, with arbitrary name, that specifies the directory
containing the package configuration file.
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 631f75b..32a0118 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -51,6 +51,16 @@ The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used
to determine whether to report an error on use of deprecated macros or
functions.
+Policies Introduced by CMake 3.13
+=================================
+
+.. toctree::
+ :maxdepth: 1
+
+ CMP0078: UseSWIG generates standard target names. </policy/CMP0078>
+ CMP0077: option() honors normal variables. </policy/CMP0077>
+ CMP0076: target_sources() command converts relative paths to absolute. </policy/CMP0076>
+
Policies Introduced by CMake 3.12
=================================
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 9f9c53f..8ccd7f6 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -77,6 +77,7 @@ Properties on Directories
/prop_dir/INTERPROCEDURAL_OPTIMIZATION
/prop_dir/LABELS
/prop_dir/LINK_DIRECTORIES
+ /prop_dir/LINK_OPTIONS
/prop_dir/LISTFILE_STACK
/prop_dir/MACROS
/prop_dir/PARENT_DIRECTORY
@@ -172,6 +173,7 @@ Properties on Targets
/prop_tgt/DEBUG_POSTFIX
/prop_tgt/DEFINE_SYMBOL
/prop_tgt/DEPLOYMENT_REMOTE_DIRECTORY
+ /prop_tgt/DEPLOYMENT_ADDITIONAL_FILES
/prop_tgt/DOTNET_TARGET_FRAMEWORK_VERSION
/prop_tgt/EchoString
/prop_tgt/ENABLE_EXPORTS
@@ -197,6 +199,7 @@ Properties on Targets
/prop_tgt/IMPORTED_LIBNAME_CONFIG
/prop_tgt/IMPORTED_LIBNAME
/prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES_CONFIG
+ /prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES_CONFIG
/prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES
/prop_tgt/IMPORTED_LINK_INTERFACE_LANGUAGES_CONFIG
/prop_tgt/IMPORTED_LINK_INTERFACE_LANGUAGES
@@ -224,7 +227,9 @@ Properties on Targets
/prop_tgt/INTERFACE_COMPILE_FEATURES
/prop_tgt/INTERFACE_COMPILE_OPTIONS
/prop_tgt/INTERFACE_INCLUDE_DIRECTORIES
+ /prop_tgt/INTERFACE_LINK_DEPENDS
/prop_tgt/INTERFACE_LINK_LIBRARIES
+ /prop_tgt/INTERFACE_LINK_OPTIONS
/prop_tgt/INTERFACE_POSITION_INDEPENDENT_CODE
/prop_tgt/INTERFACE_SOURCES
/prop_tgt/INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
@@ -254,6 +259,7 @@ Properties on Targets
/prop_tgt/LINK_INTERFACE_MULTIPLICITY_CONFIG
/prop_tgt/LINK_INTERFACE_MULTIPLICITY
/prop_tgt/LINK_LIBRARIES
+ /prop_tgt/LINK_OPTIONS
/prop_tgt/LINK_SEARCH_END_STATIC
/prop_tgt/LINK_SEARCH_START_STATIC
/prop_tgt/LINK_WHAT_YOU_USE
@@ -295,13 +301,16 @@ Properties on Targets
/prop_tgt/SOVERSION
/prop_tgt/STATIC_LIBRARY_FLAGS_CONFIG
/prop_tgt/STATIC_LIBRARY_FLAGS
+ /prop_tgt/STATIC_LIBRARY_OPTIONS
/prop_tgt/SUFFIX
/prop_tgt/TYPE
/prop_tgt/VERSION
/prop_tgt/VISIBILITY_INLINES_HIDDEN
/prop_tgt/VS_CONFIGURATION_TYPE
- /prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY
/prop_tgt/VS_DEBUGGER_COMMAND
+ /prop_tgt/VS_DEBUGGER_COMMAND_ARGUMENTS
+ /prop_tgt/VS_DEBUGGER_ENVIRONMENT
+ /prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY
/prop_tgt/VS_DESKTOP_EXTENSIONS_VERSION
/prop_tgt/VS_DOTNET_REFERENCE_refname
/prop_tgt/VS_DOTNET_REFERENCEPROP_refname_TAG_tagname
@@ -331,6 +340,24 @@ Properties on Targets
/prop_tgt/XCODE_ATTRIBUTE_an-attribute
/prop_tgt/XCODE_EXPLICIT_FILE_TYPE
/prop_tgt/XCODE_PRODUCT_TYPE
+ /prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER
+ /prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN
+ /prop_tgt/XCODE_SCHEME_THREAD_SANITIZER
+ /prop_tgt/XCODE_SCHEME_THREAD_SANITIZER_STOP
+ /prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER
+ /prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP
+ /prop_tgt/XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER
+ /prop_tgt/XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP
+ /prop_tgt/XCODE_SCHEME_MALLOC_SCRIBBLE
+ /prop_tgt/XCODE_SCHEME_MALLOC_GUARD_EDGES
+ /prop_tgt/XCODE_SCHEME_GUARD_MALLOC
+ /prop_tgt/XCODE_SCHEME_ZOMBIE_OBJECTS
+ /prop_tgt/XCODE_SCHEME_MALLOC_STACK
+ /prop_tgt/XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE
+ /prop_tgt/XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS
+ /prop_tgt/XCODE_SCHEME_EXECUTABLE
+ /prop_tgt/XCODE_SCHEME_ARGUMENTS
+ /prop_tgt/XCODE_SCHEME_ENVIRONMENT
/prop_tgt/XCTEST
.. _`Test Properties`:
diff --git a/Help/manual/cmake-server.7.rst b/Help/manual/cmake-server.7.rst
index 25d364c..b4c1436 100644
--- a/Help/manual/cmake-server.7.rst
+++ b/Help/manual/cmake-server.7.rst
@@ -308,6 +308,9 @@ which will result in a response type "reply"::
indicating that the server is ready for action.
+Protocol version 1.3 introduces an optional flag on the target filegroup
+that indicates if the filegroup represents :prop_tgt:`INTERFACE_SOURCES`.
+
Type "globalSettings"
^^^^^^^^^^^^^^^^^^^^^
@@ -524,6 +527,8 @@ FileGroups are used to group sources using similar settings together.
Each fileGroup object may contain the following keys:
+"isInterfaceSources"
+ true if the fileGroup represents :prop_tgt:`INTERFACE_SOURCES`.
"language"
contains the programming language used by all files in the group.
"compileFlags"
@@ -538,6 +543,8 @@ Each fileGroup object may contain the following keys:
"defines"
with a list of defines in the form "SOMEVALUE" or "SOMEVALUE=42". This
value is encoded in the system's native shell format.
+"isGenerated"
+ true if the files were generated.
"sources"
with a list of source files.
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index f6bf0bd..3eea8a2 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -204,6 +204,21 @@ Variables that Change Behavior
/variable/CMAKE_WARN_DEPRECATED
/variable/CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION
/variable/CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY
+ /variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER
+ /variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN
+ /variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER
+ /variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP
+ /variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER
+ /variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP
+ /variable/CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER
+ /variable/CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP
+ /variable/CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE
+ /variable/CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES
+ /variable/CMAKE_XCODE_SCHEME_GUARD_MALLOC
+ /variable/CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS
+ /variable/CMAKE_XCODE_SCHEME_MALLOC_STACK
+ /variable/CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE
+ /variable/CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS
/variable/PackageName_ROOT
Variables that Describe the System
@@ -215,6 +230,7 @@ Variables that Describe the System
/variable/ANDROID
/variable/APPLE
/variable/BORLAND
+ /variable/CACHE
/variable/CMAKE_CL_64
/variable/CMAKE_COMPILER_2005
/variable/CMAKE_HOST_APPLE
@@ -291,6 +307,7 @@ Variables that Control the Build
/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY
/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CONFIG
/variable/CMAKE_AUTOGEN_PARALLEL
+ /variable/CMAKE_AUTOGEN_VERBOSE
/variable/CMAKE_AUTOMOC
/variable/CMAKE_AUTOMOC_COMPILER_PREDEFINES
/variable/CMAKE_AUTOMOC_DEPEND_FILTERS
@@ -384,6 +401,7 @@ Variables that Control the Build
/variable/CMAKE_VS_SDK_LIBRARY_WINRT_DIRECTORIES
/variable/CMAKE_VS_SDK_REFERENCE_DIRECTORIES
/variable/CMAKE_VS_SDK_SOURCE_DIRECTORIES
+ /variable/CMAKE_VS_WINRT_BY_DEFAULT
/variable/CMAKE_WIN32_EXECUTABLE
/variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS
/variable/CMAKE_XCODE_ATTRIBUTE_an-attribute
@@ -461,6 +479,8 @@ Variables for Languages
/variable/CMAKE_LANG_LIBRARY_ARCHITECTURE
/variable/CMAKE_LANG_LINKER_PREFERENCE
/variable/CMAKE_LANG_LINKER_PREFERENCE_PROPAGATES
+ /variable/CMAKE_LANG_LINKER_WRAPPER_FLAG
+ /variable/CMAKE_LANG_LINKER_WRAPPER_FLAG_SEP
/variable/CMAKE_LANG_LINK_EXECUTABLE
/variable/CMAKE_LANG_OUTPUT_EXTENSION
/variable/CMAKE_LANG_PLATFORM_ID
diff --git a/Help/manual/cpack-generators.7.rst b/Help/manual/cpack-generators.7.rst
new file mode 100644
index 0000000..ade9149
--- /dev/null
+++ b/Help/manual/cpack-generators.7.rst
@@ -0,0 +1,29 @@
+.. cmake-manual-description: CPack Generator Reference
+
+cpack-generators(7)
+*******************
+
+.. only:: html
+
+ .. contents::
+
+Generators
+==========
+
+.. toctree::
+ :maxdepth: 1
+
+ /cpack_gen/archive
+ /cpack_gen/bundle
+ /cpack_gen/cygwin
+ /cpack_gen/deb
+ /cpack_gen/dmg
+ /cpack_gen/external
+ /cpack_gen/freebsd
+ /cpack_gen/ifw
+ /cpack_gen/nsis
+ /cpack_gen/nuget
+ /cpack_gen/packagemaker
+ /cpack_gen/productbuild
+ /cpack_gen/rpm
+ /cpack_gen/wix
diff --git a/Help/module/CPackArchive.rst b/Help/module/CPackArchive.rst
index eb8d9d2..8616098 100644
--- a/Help/module/CPackArchive.rst
+++ b/Help/module/CPackArchive.rst
@@ -1 +1,4 @@
-.. cmake-module:: ../../Modules/CPackArchive.cmake
+CPackArchive
+------------
+
+The documentation for the CPack Archive generator has moved here: :cpack_gen:`CPack Archive Generator`
diff --git a/Help/module/CPackBundle.rst b/Help/module/CPackBundle.rst
index 651e874..5134884 100644
--- a/Help/module/CPackBundle.rst
+++ b/Help/module/CPackBundle.rst
@@ -1 +1,4 @@
-.. cmake-module:: ../../Modules/CPackBundle.cmake
+CPackBundle
+-----------
+
+The documentation for the CPack Bundle generator has moved here: :cpack_gen:`CPack Bundle Generator`
diff --git a/Help/module/CPackCygwin.rst b/Help/module/CPackCygwin.rst
index 21f4473..719dfce 100644
--- a/Help/module/CPackCygwin.rst
+++ b/Help/module/CPackCygwin.rst
@@ -1 +1,4 @@
-.. cmake-module:: ../../Modules/CPackCygwin.cmake
+CPackCygwin
+-----------
+
+The documentation for the CPack Cygwin generator has moved here: :cpack_gen:`CPack Cygwin Generator`
diff --git a/Help/module/CPackDMG.rst b/Help/module/CPackDMG.rst
index 784262c..a597002 100644
--- a/Help/module/CPackDMG.rst
+++ b/Help/module/CPackDMG.rst
@@ -1 +1,4 @@
-.. cmake-module:: ../../Modules/CPackDMG.cmake
+CPackDMG
+--------
+
+The documentation for the CPack DMG generator has moved here: :cpack_gen:`CPack DMG Generator`
diff --git a/Help/module/CPackDeb.rst b/Help/module/CPackDeb.rst
index d1526ee..73e59a2 100644
--- a/Help/module/CPackDeb.rst
+++ b/Help/module/CPackDeb.rst
@@ -1 +1,4 @@
-.. cmake-module:: ../../Modules/CPackDeb.cmake
+CPackDeb
+--------
+
+The documentation for the CPack Deb generator has moved here: :cpack_gen:`CPack Deb Generator`
diff --git a/Help/module/CPackFreeBSD.rst b/Help/module/CPackFreeBSD.rst
index 083f0cb..69701b8 100644
--- a/Help/module/CPackFreeBSD.rst
+++ b/Help/module/CPackFreeBSD.rst
@@ -1 +1,4 @@
-.. cmake-module:: ../../Modules/CPackFreeBSD.cmake
+CPackFreeBSD
+------------
+
+The documentation for the CPack FreeBSD generator has moved here: :cpack_gen:`CPack FreeBSD Generator`
diff --git a/Help/module/CPackNSIS.rst b/Help/module/CPackNSIS.rst
index bb35ed6..2cb407a 100644
--- a/Help/module/CPackNSIS.rst
+++ b/Help/module/CPackNSIS.rst
@@ -1 +1,4 @@
-.. cmake-module:: ../../Modules/CPackNSIS.cmake
+CPackNSIS
+---------
+
+The documentation for the CPack NSIS generator has moved here: :cpack_gen:`CPack NSIS Generator`
diff --git a/Help/module/CPackNuGet.rst b/Help/module/CPackNuGet.rst
index a4cbb59..4f39b3a 100644
--- a/Help/module/CPackNuGet.rst
+++ b/Help/module/CPackNuGet.rst
@@ -1 +1,4 @@
-.. cmake-module:: ../../Modules/CPackNuGet.cmake
+CPackNuGet
+----------
+
+The documentation for the CPack NuGet generator has moved here: :cpack_gen:`CPack NuGet Generator`
diff --git a/Help/module/CPackPackageMaker.rst b/Help/module/CPackPackageMaker.rst
index de55448..226b6fd 100644
--- a/Help/module/CPackPackageMaker.rst
+++ b/Help/module/CPackPackageMaker.rst
@@ -1 +1,4 @@
-.. cmake-module:: ../../Modules/CPackPackageMaker.cmake
+CPackPackageMaker
+-----------------
+
+The documentation for the CPack PackageMaker generator has moved here: :cpack_gen:`CPack PackageMaker Generator`
diff --git a/Help/module/CPackProductBuild.rst b/Help/module/CPackProductBuild.rst
index 6081fe4..8cd9198 100644
--- a/Help/module/CPackProductBuild.rst
+++ b/Help/module/CPackProductBuild.rst
@@ -1 +1,4 @@
-.. cmake-module:: ../../Modules/CPackProductBuild.cmake
+CPackProductBuild
+-----------------
+
+The documentation for the CPack productbuild generator has moved here: :cpack_gen:`CPack productbuild Generator`
diff --git a/Help/module/CPackRPM.rst b/Help/module/CPackRPM.rst
index 28d0e69..00b7e0a 100644
--- a/Help/module/CPackRPM.rst
+++ b/Help/module/CPackRPM.rst
@@ -1 +1,4 @@
-.. cmake-module:: ../../Modules/CPackRPM.cmake
+CPackRPM
+--------
+
+The documentation for the CPack RPM generator has moved here: :cpack_gen:`CPack RPM Generator`
diff --git a/Help/module/CPackWIX.rst b/Help/module/CPackWIX.rst
index 1f5e451..e1d4a03 100644
--- a/Help/module/CPackWIX.rst
+++ b/Help/module/CPackWIX.rst
@@ -1 +1,4 @@
-.. cmake-module:: ../../Modules/CPackWIX.cmake
+CPackWIX
+--------
+
+The documentation for the CPack WiX generator has moved here: :cpack_gen:`CPack WiX Generator`
diff --git a/Help/policy/CMP0076.rst b/Help/policy/CMP0076.rst
new file mode 100644
index 0000000..dd25f80
--- /dev/null
+++ b/Help/policy/CMP0076.rst
@@ -0,0 +1,26 @@
+CMP0076
+-------
+
+The :command:`target_sources` command converts relative paths to absolute.
+
+In CMake 3.13 and above, the :command:`target_sources` command now converts
+relative source file paths to absolute paths in the following cases:
+
+* Source files are added to the target's :prop_tgt:`INTERFACE_SOURCES`
+ property.
+* The target's :prop_tgt:`SOURCE_DIR` property differs from
+ :variable:`CMAKE_CURRENT_SOURCE_DIR`.
+
+A path that begins with a generator expression is always left unmodified.
+
+This policy provides compatibility with projects that have not been updated
+to expect this behavior. The ``OLD`` behavior for this policy is to leave
+all relative source file paths unmodified. The ``NEW`` behavior of this
+policy is to convert relative paths to absolute according to above rules.
+
+This policy was introduced in CMake version 3.13. CMake version
+|release| warns when the policy is not set and uses ``OLD`` behavior.
+Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW``
+explicitly.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0077.rst b/Help/policy/CMP0077.rst
new file mode 100644
index 0000000..8efe198
--- /dev/null
+++ b/Help/policy/CMP0077.rst
@@ -0,0 +1,16 @@
+CMP0077
+-------
+
+:command:`option` honors normal variables.
+
+The ``OLD`` behavior for this policy is to clear any existing normal variables
+with the same name. The ``NEW`` behavior for this policy is to not create
+a cache entry or modify any existing normal variables if a normal variable
+with the same name already exists.
+
+This policy was introduced in CMake version 3.13. CMake version
+|release| warns when the policy is not set and uses ``OLD`` behavior.
+Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW``
+explicitly.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0078.rst b/Help/policy/CMP0078.rst
new file mode 100644
index 0000000..54cdc9c
--- /dev/null
+++ b/Help/policy/CMP0078.rst
@@ -0,0 +1,22 @@
+CMP0078
+-------
+
+Starting with CMake 3.13, :module:`UseSWIG` generates now standard target
+names. This policy provides compatibility with projects that expect the legacy
+behavior.
+
+The ``OLD`` behavior for this policy relies on
+``UseSWIG_TARGET_NAME_PREFERENCE`` variable that can be used to specify an
+explicit preference. The value may be one of:
+
+* ``LEGACY``: legacy strategy is applied. Variable
+ ``SWIG_MODULE_<name>_REAL_NAME`` must be used to get real target name.
+ This is the default if not specified.
+* ``STANDARD``: target name matches specified name.
+
+This policy was introduced in CMake version 3.13. CMake version
+|release| warns when the policy is not set and uses ``OLD`` behavior.
+Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW``
+explicitly.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/prop_dir/LINK_OPTIONS.rst b/Help/prop_dir/LINK_OPTIONS.rst
new file mode 100644
index 0000000..15c555f
--- /dev/null
+++ b/Help/prop_dir/LINK_OPTIONS.rst
@@ -0,0 +1,17 @@
+LINK_OPTIONS
+------------
+
+List of options to use for the link step of shared library, module
+and executable targets.
+
+This property holds a :ref:`;-list <CMake Language Lists>` of options
+given so far to the :command:`add_link_options` command.
+
+This property is used to initialize the :prop_tgt:`LINK_OPTIONS` target
+property when a target is created, which is used by the generators to set
+the options for the compiler.
+
+Contents of ``LINK_OPTIONS`` may use "generator expressions" with the
+syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual
+for available expressions. See the :manual:`cmake-buildsystem(7)` manual
+for more on defining buildsystem properties.
diff --git a/Help/prop_tgt/DEPLOYMENT_ADDITIONAL_FILES.rst b/Help/prop_tgt/DEPLOYMENT_ADDITIONAL_FILES.rst
new file mode 100644
index 0000000..5e9c191
--- /dev/null
+++ b/Help/prop_tgt/DEPLOYMENT_ADDITIONAL_FILES.rst
@@ -0,0 +1,18 @@
+DEPLOYMENT_ADDITIONAL_FILES
+---------------------------
+
+Set the WinCE project ``AdditionalFiles`` in ``DeploymentTool`` in ``.vcproj``
+files generated by the :generator:`Visual Studio 9 2008` generator.
+This is useful when you want to debug on remote WinCE device.
+Specify additional files that will be copied to the device.
+For example:
+
+.. code-block:: cmake
+
+ set_property(TARGET ${TARGET} PROPERTY
+ DEPLOYMENT_ADDITIONAL_FILES "english.lng|local_folder|remote_folder|0"
+ "german.lng|local_folder|remote_folder|0")
+
+produces::
+
+ <DeploymentTool AdditionalFiles="english.lng|local_folder|remote_folder|0;german.lng|local_folder|remote_folder|0" ... />
diff --git a/Help/prop_tgt/INTERFACE_LINK_DEPENDS.rst b/Help/prop_tgt/INTERFACE_LINK_DEPENDS.rst
new file mode 100644
index 0000000..d07f8ea
--- /dev/null
+++ b/Help/prop_tgt/INTERFACE_LINK_DEPENDS.rst
@@ -0,0 +1,31 @@
+INTERFACE_LINK_DEPENDS
+----------------------
+
+Additional public interface files on which a target binary depends for linking.
+
+This property is supported only by Makefile and Ninja generators. It is
+intended to specify dependencies on "linker scripts" for custom Makefile link
+rules.
+
+When target dependencies are specified using :command:`target_link_libraries`,
+CMake will read this property from all target dependencies to determine the
+build properties of the consumer.
+
+Contents of ``INTERFACE_LINK_DEPENDS`` may use "generator expressions"
+with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
+manual for available expressions. See the :manual:`cmake-buildsystem(7)`
+-manual for more on defining buildsystem properties.
+
+Link dependency files usage requirements commonly differ between the build-tree
+and the install-tree. The ``BUILD_INTERFACE`` and ``INSTALL_INTERFACE``
+generator expressions can be used to describe separate usage requirements
+based on the usage location. Relative paths are allowed within the
+``INSTALL_INTERFACE`` expression and are interpreted relative to the
+installation prefix. For example:
+
+.. code-block:: cmake
+
+ set_property(TARGET mylib PROPERTY INTERFACE_LINK_DEPENDS
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/mylinkscript>
+ $<INSTALL_INTERFACE:mylinkscript> # <prefix>/mylinkscript
+ )
diff --git a/Help/prop_tgt/INTERFACE_LINK_OPTIONS.rst b/Help/prop_tgt/INTERFACE_LINK_OPTIONS.rst
new file mode 100644
index 0000000..c293b98
--- /dev/null
+++ b/Help/prop_tgt/INTERFACE_LINK_OPTIONS.rst
@@ -0,0 +1,9 @@
+INTERFACE_LINK_OPTIONS
+----------------------
+
+.. |property_name| replace:: link options
+.. |command_name| replace:: :command:`target_link_options`
+.. |PROPERTY_INTERFACE_NAME| replace:: ``INTERFACE_LINK_OPTIONS``
+.. |PROPERTY_LINK| replace:: :prop_tgt:`LINK_OPTIONS`
+.. |PROPERTY_GENEX| replace:: ``$<TARGET_PROPERTY:foo,INTERFACE_LINK_OPTIONS>``
+.. include:: INTERFACE_BUILD_PROPERTY.txt
diff --git a/Help/prop_tgt/LINK_DEPENDS.rst b/Help/prop_tgt/LINK_DEPENDS.rst
index 5576b85..3ab8658 100644
--- a/Help/prop_tgt/LINK_DEPENDS.rst
+++ b/Help/prop_tgt/LINK_DEPENDS.rst
@@ -7,6 +7,11 @@ Specifies a semicolon-separated list of full-paths to files on which
the link rule for this target depends. The target binary will be
linked if any of the named files is newer than it.
-This property is ignored by non-Makefile generators. It is intended
-to specify dependencies on "linker scripts" for custom Makefile link
+This property is supported only by Makefile and Ninja generators. It is
+intended to specify dependencies on "linker scripts" for custom Makefile link
rules.
+
+Contents of ``LINK_DEPENDS`` may use "generator expressions" with
+the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
+manual for available expressions. See the :manual:`cmake-buildsystem(7)`
+manual for more on defining buildsystem properties.
diff --git a/Help/prop_tgt/LINK_FLAGS.rst b/Help/prop_tgt/LINK_FLAGS.rst
index b09e7c1..92cd3c0 100644
--- a/Help/prop_tgt/LINK_FLAGS.rst
+++ b/Help/prop_tgt/LINK_FLAGS.rst
@@ -1,9 +1,16 @@
LINK_FLAGS
----------
-Additional flags to use when linking this target.
+Additional flags to use when linking this target if it is a shared library,
+module library, or an executable. Static libraries need to use
+:prop_tgt:`STATIC_LIBRARY_OPTIONS` or :prop_tgt:`STATIC_LIBRARY_FLAGS`
+properties.
-The LINK_FLAGS property can be used to add extra flags to the link
-step of a target. :prop_tgt:`LINK_FLAGS_<CONFIG>` will add to the
-configuration ``<CONFIG>``, for example, ``DEBUG``, ``RELEASE``,
+The ``LINK_FLAGS`` property, managed as a string, can be used to add extra
+flags to the link step of a target. :prop_tgt:`LINK_FLAGS_<CONFIG>` will add
+to the configuration ``<CONFIG>``, for example, ``DEBUG``, ``RELEASE``,
``MINSIZEREL``, ``RELWITHDEBINFO``, ...
+
+.. note::
+
+ This property has been superseded by :prop_tgt:`LINK_OPTIONS` property.
diff --git a/Help/prop_tgt/LINK_FLAGS_CONFIG.rst b/Help/prop_tgt/LINK_FLAGS_CONFIG.rst
index ba7adc8..e3918ca 100644
--- a/Help/prop_tgt/LINK_FLAGS_CONFIG.rst
+++ b/Help/prop_tgt/LINK_FLAGS_CONFIG.rst
@@ -1,6 +1,11 @@
LINK_FLAGS_<CONFIG>
-------------------
-Per-configuration linker flags for a target.
+Per-configuration linker flags for a shared library, module or executable
+target.
-This is the configuration-specific version of LINK_FLAGS.
+This is the configuration-specific version of :prop_tgt:`LINK_FLAGS`.
+
+.. note::
+
+ This property has been superseded by :prop_tgt:`LINK_OPTIONS` property.
diff --git a/Help/prop_tgt/LINK_OPTIONS.rst b/Help/prop_tgt/LINK_OPTIONS.rst
new file mode 100644
index 0000000..bd5e937
--- /dev/null
+++ b/Help/prop_tgt/LINK_OPTIONS.rst
@@ -0,0 +1,24 @@
+LINK_OPTIONS
+------------
+
+List of options to use for the link step of shared library, module
+and executable targets. Targets that are static libraries need to use
+the :prop_tgt:`STATIC_LIBRARY_OPTIONS` target property.
+
+
+This property holds a :ref:`;-list <CMake Language Lists>` of options
+specified so far for its target. Use the :command:`target_link_options`
+command to append more options.
+
+This property is initialized by the :prop_dir:`LINK_OPTIONS` directory
+property when a target is created, and is used by the generators to set
+the options for the compiler.
+
+Contents of ``LINK_OPTIONS`` may use "generator expressions" with the
+syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual
+for available expressions. See the :manual:`cmake-buildsystem(7)` manual
+for more on defining buildsystem properties.
+
+.. note::
+
+ This property must be used in preference to :prop_tgt:`LINK_FLAGS` property.
diff --git a/Help/prop_tgt/STATIC_LIBRARY_FLAGS.rst b/Help/prop_tgt/STATIC_LIBRARY_FLAGS.rst
index d3b2cd4..66e0e8b 100644
--- a/Help/prop_tgt/STATIC_LIBRARY_FLAGS.rst
+++ b/Help/prop_tgt/STATIC_LIBRARY_FLAGS.rst
@@ -1,6 +1,17 @@
STATIC_LIBRARY_FLAGS
--------------------
-Extra flags to use when linking static libraries.
+Archiver (or MSVC librarian) flags for a static library target.
+Targets that are shared libraries, modules, or executables need to use
+the :prop_tgt:`LINK_OPTIONS` or :prop_tgt:`LINK_FLAGS` target properties.
-Extra flags to use when linking a static library.
+The ``STATIC_LIBRARY_FLAGS`` property, managed as a string, can be used to add
+extra flags to the link step of a static library target.
+:prop_tgt:`STATIC_LIBRARY_FLAGS_<CONFIG>` will add to the configuration
+``<CONFIG>``, for example, ``DEBUG``, ``RELEASE``, ``MINSIZEREL``,
+``RELWITHDEBINFO``, ...
+
+.. note::
+
+ This property has been superseded by :prop_tgt:`STATIC_LIBRARY_OPTIONS`
+ property.
diff --git a/Help/prop_tgt/STATIC_LIBRARY_FLAGS_CONFIG.rst b/Help/prop_tgt/STATIC_LIBRARY_FLAGS_CONFIG.rst
index cca353d..5b97941 100644
--- a/Help/prop_tgt/STATIC_LIBRARY_FLAGS_CONFIG.rst
+++ b/Help/prop_tgt/STATIC_LIBRARY_FLAGS_CONFIG.rst
@@ -1,6 +1,12 @@
STATIC_LIBRARY_FLAGS_<CONFIG>
-----------------------------
-Per-configuration flags for creating a static library.
+Per-configuration archiver (or MSVC librarian) flags for a static library
+target.
-This is the configuration-specific version of STATIC_LIBRARY_FLAGS.
+This is the configuration-specific version of :prop_tgt:`STATIC_LIBRARY_FLAGS`.
+
+.. note::
+
+ This property has been superseded by :prop_tgt:`STATIC_LIBRARY_OPTIONS`
+ property.
diff --git a/Help/prop_tgt/STATIC_LIBRARY_OPTIONS.rst b/Help/prop_tgt/STATIC_LIBRARY_OPTIONS.rst
new file mode 100644
index 0000000..6e03185
--- /dev/null
+++ b/Help/prop_tgt/STATIC_LIBRARY_OPTIONS.rst
@@ -0,0 +1,20 @@
+STATIC_LIBRARY_OPTIONS
+----------------------
+
+Archiver (or MSVC librarian) flags for a static library target.
+Targets that are shared libraries, modules, or executables need to use
+the :prop_tgt:`LINK_OPTIONS` target property.
+
+This property holds a :ref:`;-list <CMake Language Lists>` of options
+specified so far for its target. Use :command:`set_target_properties` or
+:command:`set_property` commands to set its content.
+
+Contents of ``STATIC_LIBRARY_OPTIONS`` may use "generator expressions" with the
+syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual
+for available expressions. See the :manual:`cmake-buildsystem(7)` manual
+for more on defining buildsystem properties.
+
+.. note::
+
+ This property must be used in preference to :prop_tgt:`STATIC_LIBRARY_FLAGS`
+ property.
diff --git a/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst b/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst
index f898750..ba5fd0a 100644
--- a/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst
+++ b/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst
@@ -2,6 +2,8 @@ VS_DEBUGGER_COMMAND
-------------------
Sets the local debugger command for Visual Studio C++ targets.
+The property value may use
+:manual:`generator expressions <cmake-generator-expressions(7)>`.
This is defined in ``<LocalDebuggerCommand>`` in the Visual Studio
project file.
diff --git a/Help/prop_tgt/VS_DEBUGGER_COMMAND_ARGUMENTS.rst b/Help/prop_tgt/VS_DEBUGGER_COMMAND_ARGUMENTS.rst
new file mode 100644
index 0000000..06ef5d5
--- /dev/null
+++ b/Help/prop_tgt/VS_DEBUGGER_COMMAND_ARGUMENTS.rst
@@ -0,0 +1,11 @@
+VS_DEBUGGER_COMMAND_ARGUMENTS
+-----------------------------
+
+Sets the local debugger command line arguments for Visual Studio C++ targets.
+The property value may use
+:manual:`generator expressions <cmake-generator-expressions(7)>`.
+This is defined in ``<LocalDebuggerCommandArguments>`` in the Visual Studio
+project file.
+
+This property only works for Visual Studio 2010 and above;
+it is ignored on other generators.
diff --git a/Help/prop_tgt/VS_DEBUGGER_ENVIRONMENT.rst b/Help/prop_tgt/VS_DEBUGGER_ENVIRONMENT.rst
new file mode 100644
index 0000000..f55ac7b
--- /dev/null
+++ b/Help/prop_tgt/VS_DEBUGGER_ENVIRONMENT.rst
@@ -0,0 +1,11 @@
+VS_DEBUGGER_ENVIRONMENT
+-----------------------
+
+Sets the local debugger environment for Visual Studio C++ targets.
+The property value may use
+:manual:`generator expressions <cmake-generator-expressions(7)>`.
+This is defined in ``<LocalDebuggerEnvironment>`` in the Visual Studio
+project file.
+
+This property only works for Visual Studio 2010 and above;
+it is ignored on other generators.
diff --git a/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst b/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst
index fb0389e..008bbf6 100644
--- a/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst
+++ b/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst
@@ -2,6 +2,8 @@ VS_DEBUGGER_WORKING_DIRECTORY
-----------------------------
Sets the local debugger working directory for Visual Studio C++ targets.
+The property value may use
+:manual:`generator expressions <cmake-generator-expressions(7)>`.
This is defined in ``<LocalDebuggerWorkingDirectory>`` in the Visual Studio
project file.
diff --git a/Help/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER.rst b/Help/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER.rst
new file mode 100644
index 0000000..694cd77
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER.rst
@@ -0,0 +1,12 @@
+XCODE_SCHEME_ADDRESS_SANITIZER
+------------------------------
+
+Whether to enable ``Address Sanitizer`` in the Diagnostics
+section of the generated Xcode scheme.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER` if it is set
+when a target is created.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN.rst b/Help/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN.rst
new file mode 100644
index 0000000..2803da0
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN.rst
@@ -0,0 +1,12 @@
+XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN
+-----------------------------------------------
+
+Whether to enable ``Detect use of stack after return``
+in the Diagnostics section of the generated Xcode scheme.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN`
+if it is set when a target is created.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/prop_tgt/XCODE_SCHEME_ARGUMENTS.rst b/Help/prop_tgt/XCODE_SCHEME_ARGUMENTS.rst
new file mode 100644
index 0000000..2eac4a9
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_ARGUMENTS.rst
@@ -0,0 +1,10 @@
+XCODE_SCHEME_ARGUMENTS
+----------------------
+
+Specify command line arguments that should be added to the Arguments
+section of the generated Xcode scheme.
+
+If set to a list of arguments those will be added to the scheme.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/prop_tgt/XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER.rst b/Help/prop_tgt/XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER.rst
new file mode 100644
index 0000000..75fc326
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER.rst
@@ -0,0 +1,12 @@
+XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER
+----------------------------------------
+
+Whether to disable the ``Main Thread Checker``
+in the Diagnostics section of the generated Xcode scheme.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER`
+if it is set when a target is created.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/prop_tgt/XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS.rst b/Help/prop_tgt/XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS.rst
new file mode 100644
index 0000000..a7fab66
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS.rst
@@ -0,0 +1,12 @@
+XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS
+----------------------------------
+
+Whether to enable ``Dynamic Library Loads``
+in the Diagnostics section of the generated Xcode scheme.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS` if it is set
+when a target is created.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/prop_tgt/XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE.rst b/Help/prop_tgt/XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE.rst
new file mode 100644
index 0000000..162fc45
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE.rst
@@ -0,0 +1,12 @@
+XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE
+-------------------------------------
+
+Whether to enable ``Dynamic Linker API usage``
+in the Diagnostics section of the generated Xcode scheme.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE` if it is set
+when a target is created.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/prop_tgt/XCODE_SCHEME_ENVIRONMENT.rst b/Help/prop_tgt/XCODE_SCHEME_ENVIRONMENT.rst
new file mode 100644
index 0000000..1dbd6c4
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_ENVIRONMENT.rst
@@ -0,0 +1,12 @@
+XCODE_SCHEME_ENVIRONMENT
+------------------------
+
+Specify environment variables that should be added to the Arguments
+section of the generated Xcode scheme.
+
+If set to a list of environment variables and values of the form
+``MYVAR=value`` those environment variables will be added to the
+scheme.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/prop_tgt/XCODE_SCHEME_EXECUTABLE.rst b/Help/prop_tgt/XCODE_SCHEME_EXECUTABLE.rst
new file mode 100644
index 0000000..d0427e2
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_EXECUTABLE.rst
@@ -0,0 +1,9 @@
+XCODE_SCHEME_EXECUTABLE
+-----------------------
+
+Specify path to executable in the Info section of the generated
+Xcode scheme. If not set the schema generator will select the
+current target if it is actually executable.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/prop_tgt/XCODE_SCHEME_GUARD_MALLOC.rst b/Help/prop_tgt/XCODE_SCHEME_GUARD_MALLOC.rst
new file mode 100644
index 0000000..64e1990
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_GUARD_MALLOC.rst
@@ -0,0 +1,12 @@
+XCODE_SCHEME_GUARD_MALLOC
+------------------------------
+
+Whether to enable ``Guard Malloc``
+in the Diagnostics section of the generated Xcode scheme.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_GUARD_MALLOC` if it is set
+when a target is created.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/prop_tgt/XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP.rst b/Help/prop_tgt/XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP.rst
new file mode 100644
index 0000000..99c112f
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP.rst
@@ -0,0 +1,13 @@
+XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP
+-------------------------------------
+
+Whether to enable the ``Main Thread Checker`` option
+``Pause on issues``
+in the Diagnostics section of the generated Xcode scheme.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP` if it is set
+when a target is created.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/prop_tgt/XCODE_SCHEME_MALLOC_GUARD_EDGES.rst b/Help/prop_tgt/XCODE_SCHEME_MALLOC_GUARD_EDGES.rst
new file mode 100644
index 0000000..ef3852a
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_MALLOC_GUARD_EDGES.rst
@@ -0,0 +1,12 @@
+XCODE_SCHEME_MALLOC_GUARD_EDGES
+-------------------------------
+
+Whether to enable ``Malloc Guard Edges``
+in the Diagnostics section of the generated Xcode scheme.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES` if it is set
+when a target is created.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/prop_tgt/XCODE_SCHEME_MALLOC_SCRIBBLE.rst b/Help/prop_tgt/XCODE_SCHEME_MALLOC_SCRIBBLE.rst
new file mode 100644
index 0000000..75baba2
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_MALLOC_SCRIBBLE.rst
@@ -0,0 +1,12 @@
+XCODE_SCHEME_MALLOC_SCRIBBLE
+------------------------------
+
+Whether to enable ``Malloc Scribble``
+in the Diagnostics section of the generated Xcode scheme.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE` if it is set
+when a target is created.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/prop_tgt/XCODE_SCHEME_MALLOC_STACK.rst b/Help/prop_tgt/XCODE_SCHEME_MALLOC_STACK.rst
new file mode 100644
index 0000000..984022c
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_MALLOC_STACK.rst
@@ -0,0 +1,12 @@
+XCODE_SCHEME_MALLOC_STACK
+-------------------------
+
+Whether to enable ``Malloc Stack`` in the Diagnostics
+section of the generated Xcode scheme.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_MALLOC_STACK` if it is set
+when a target is created.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/prop_tgt/XCODE_SCHEME_THREAD_SANITIZER.rst b/Help/prop_tgt/XCODE_SCHEME_THREAD_SANITIZER.rst
new file mode 100644
index 0000000..825ac5b
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_THREAD_SANITIZER.rst
@@ -0,0 +1,12 @@
+XCODE_SCHEME_THREAD_SANITIZER
+-----------------------------
+
+Whether to enable ``Thread Sanitizer`` in the Diagnostics
+section of the generated Xcode scheme.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_THREAD_SANITIZER` if it is set
+when a target is created.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/prop_tgt/XCODE_SCHEME_THREAD_SANITIZER_STOP.rst b/Help/prop_tgt/XCODE_SCHEME_THREAD_SANITIZER_STOP.rst
new file mode 100644
index 0000000..86f894e
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_THREAD_SANITIZER_STOP.rst
@@ -0,0 +1,12 @@
+XCODE_SCHEME_THREAD_SANITIZER_STOP
+----------------------------------
+
+Whether to enable ``Thread Sanitizer - Pause on issues``
+in the Diagnostics section of the generated Xcode scheme.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP` if it is set
+when a target is created.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER.rst b/Help/prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER.rst
new file mode 100644
index 0000000..829a62e
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER.rst
@@ -0,0 +1,12 @@
+XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER
+------------------------------------------
+
+Whether to enable ``Undefined Behavior Sanitizer``
+in the Diagnostics section of the generated Xcode scheme.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER`
+if it is set when a target is created.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP.rst b/Help/prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP.rst
new file mode 100644
index 0000000..5e382ca
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP.rst
@@ -0,0 +1,13 @@
+XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP
+-----------------------------------------------
+
+Whether to enable ``Undefined Behavior Sanitizer`` option
+``Pause on issues``
+in the Diagnostics section of the generated Xcode scheme.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP`
+if it is set when a target is created.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/prop_tgt/XCODE_SCHEME_ZOMBIE_OBJECTS.rst b/Help/prop_tgt/XCODE_SCHEME_ZOMBIE_OBJECTS.rst
new file mode 100644
index 0000000..80b954a
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_ZOMBIE_OBJECTS.rst
@@ -0,0 +1,12 @@
+XCODE_SCHEME_ZOMBIE_OBJECTS
+------------------------------
+
+Whether to enable ``Zombie Objects``
+in the Diagnostics section of the generated Xcode scheme.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS` if it is set
+when a target is created.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/release/3.1.rst b/Help/release/3.1.rst
index dca42cd..8278353 100644
--- a/Help/release/3.1.rst
+++ b/Help/release/3.1.rst
@@ -289,12 +289,12 @@ CPack
-----
* :manual:`cpack(1)` gained an ``IFW`` generator to package using
- Qt Framework Installer tools. See the :module:`CPackIFW` module.
+ Qt Framework Installer tools. See the :cpack_gen:`CPack IFW Generator`.
* :manual:`cpack(1)` gained ``7Z`` and ``TXZ`` generators supporting
lzma-compressed archives.
-* The :module:`CPackDeb` module learned a new
+* The :cpack_gen:`CPack Deb Generator` learned a new
:variable:`CPACK_DEBIAN_COMPRESSION_TYPE` variable to set the
tarball compression type.
diff --git a/Help/release/3.10.rst b/Help/release/3.10.rst
index 1205b17..66a1d09 100644
--- a/Help/release/3.10.rst
+++ b/Help/release/3.10.rst
@@ -184,37 +184,35 @@ CTest
CPack
-----
-* CPack gained a ``FREEBSD`` generator for FreeBSD ``pkg(8)``, configured
- by the :module:`CPackFreeBSD` module.
+* A :cpack_gen:`CPack FreeBSD Generator` was added for FreeBSD ``pkg(8)``.
-* The CPack ``DEB`` generator, configured by the :module:`CPackDeb` module,
- was enabled on Windows. While not fully featured (due to the lack of
- external UNIX tools) this will allow building basic cross-platform Debian
- packages.
+* The :cpack_gen:`CPack Deb Generator` was enabled on Windows. While not
+ fully featured (due to the lack of external UNIX tools) this will allow
+ building basic cross-platform Debian packages.
-* The :module:`CPackDeb` module learned to set package release version in
- ``Version`` info property.
+* The :cpack_gen:`CPack Deb Generator` learned to set package release
+ version in ``Version`` info property.
See the :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` variable.
-* The :module:`CPackDeb` module learned more strict package version checking
- that complies with Debian rules.
+* The :cpack_gen:`CPack Deb Generator` learned more strict package
+ version checking that complies with Debian rules.
* The :module:`CPackIFW` module :command:`cpack_ifw_configure_component` and
:command:`cpack_ifw_configure_component_group` commands gained a new
``REPLACES`` and ``CHECKABLE`` options.
-* The :module:`CPackIFW` module gained new
+* The :cpack_gen:`CPack IFW Generator` gained new
:variable:`CPACK_IFW_PACKAGE_FILE_EXTENSION` variable to customize
target binary format.
-* The :module:`CPackIFW` module gained new
+* The :cpack_gen:`CPack IFW Generator` gained new
:variable:`CPACK_IFW_REPOSITORIES_DIRECTORIES` variable to specify
additional repositories dirs that will be used to resolve and
repack dependent components. This feature is only available when
using QtIFW 3.1 or later.
-* Modules :module:`CPackRPM` and :module:`CPackDeb` learned to set package epoch
- version.
+* The :cpack_gen:`CPack RPM Generator` and :cpack_gen:`CPack Deb Generator`
+ learned to set the package epoch version.
See :variable:`CPACK_RPM_PACKAGE_EPOCH` and
:variable:`CPACK_DEBIAN_PACKAGE_EPOCH` variables.
diff --git a/Help/release/3.11.rst b/Help/release/3.11.rst
index 214da0d..a80657d 100644
--- a/Help/release/3.11.rst
+++ b/Help/release/3.11.rst
@@ -200,11 +200,11 @@ CPack
* :manual:`cpack(1)` gained ``--trace`` and ``--trace-expand`` options.
-* The :module:`CPackIFW` module gained new
+* The :cpack_gen:`CPack IFW Generator` gained new
:variable:`CPACK_IFW_PACKAGE_REMOVE_TARGET_DIR` variable to control
if the target directory should not be deleted when uninstalling.
-* The :module:`CPackRPM` module learned to enable enforcing of execute
+* The :cpack_gen:`CPack RPM Generator` learned to enable enforcing of execute
privileges on programs and shared libraries.
See :variable:`CPACK_RPM_INSTALL_WITH_EXEC` variable.
diff --git a/Help/release/3.12.rst b/Help/release/3.12.rst
index f00be3e..481027e 100644
--- a/Help/release/3.12.rst
+++ b/Help/release/3.12.rst
@@ -239,8 +239,8 @@ CPack
:variable:`CMAKE_PROJECT_VERSION_PATCH`
to initialize corresponding CPack variables.
-* :manual:`cpack(1)` gained basic support for `NuGet`_.
- See the :module:`CPackNuGet` module.
+* A :cpack_gen:`CPack NuGet Generator` was was added with basic
+ support for `NuGet`_.
.. _NuGet: https://docs.microsoft.com/en-us/nuget/what-is-nuget
diff --git a/Help/release/3.2.rst b/Help/release/3.2.rst
index 8abb1ca..992d44b 100644
--- a/Help/release/3.2.rst
+++ b/Help/release/3.2.rst
@@ -156,27 +156,27 @@ CTest
CPack
-----
-* The :module:`CPackRPM` module learned options to set per-component
+* The :cpack_gen:`CPack RPM Generator` learned options to set per-component
descriptions and summaries. See the
:variable:`CPACK_RPM_<component>_PACKAGE_DESCRIPTION` and
:variable:`CPACK_RPM_<component>_PACKAGE_SUMMARY` variables.
-* The :module:`CPackRPM` module learned options to specify
+* The :cpack_gen:`CPack RPM Generator` learned options to specify
requirements for pre- and post-install scripts. See the
:variable:`CPACK_RPM_PACKAGE_REQUIRES_PRE` and
:variable:`CPACK_RPM_PACKAGE_REQUIRES_POST` variables.
-* The :module:`CPackRPM` module learned options to specify
+* The :cpack_gen:`CPack RPM Generator` learned options to specify
requirements for pre- and post-uninstall scripts. See the
:variable:`CPACK_RPM_PACKAGE_REQUIRES_PREUN` and
:variable:`CPACK_RPM_PACKAGE_REQUIRES_POSTUN` variables.
-* The :module:`CPackRPM` module learned a new
+* The :cpack_gen:`CPack RPM Generator` learned a new
:variable:`CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX` variable to
specify a component-specific value to use instead of
:variable:`CPACK_PACKAGING_INSTALL_PREFIX`.
-* The :module:`CPackRPM` module learned a new
+* The :cpack_gen:`CPack RPM Generator` learned a new
:variable:`CPACK_RPM_RELOCATION_PATHS` variable to
specify multiple relocation prefixes for a single rpm package.
diff --git a/Help/release/3.3.rst b/Help/release/3.3.rst
index 0beb354..11f0c60 100644
--- a/Help/release/3.3.rst
+++ b/Help/release/3.3.rst
@@ -169,26 +169,26 @@ CTest
CPack
-----
-* The :manual:`cpack(1)` ``IFW`` generator and the :module:`CPackIFW`
- module learned to support Qt Framework Installer 2.0 tools.
+* The :cpack_gen:`CPack IFW Generator` learned to support
+ Qt Framework Installer 2.0 tools.
-* The :module:`CPackDeb` module learned a new
+* The :cpack_gen:`CPack Deb Generator` learned a new
:variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS`
variable to specify per-component use of ``dpkg-shlibdeps``.
-* The :module:`CPackDeb` module learned a new
+* The :cpack_gen:`CPack Deb Generator` learned a new
:variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS`
option to specify per-component dependencies.
-* The :module:`CPackRPM` module learned to package symbolic links
+* The :cpack_gen:`CPack RPM Generator` learned to package symbolic links
more cleanly and now supports directory symlinks with recent
``rpmbuild`` versions.
-* The :module:`CPackRPM` module learned a new
+* The :cpack_gen:`CPack RPM Generator` learned a new
:variable:`CPACK_RPM_ADDITIONAL_MAN_DIRS` variable to specify
directories containing man pages for the brp-compress RPM macro.
-* The :module:`CPackRPM` module learned a new
+* The :cpack_gen:`CPack RPM Generator` learned a new
:variable:`CPACK_RPM_<component>_PACKAGE_ARCHITECTURE` variable
to specify a component-specific package architecture.
diff --git a/Help/release/3.4.rst b/Help/release/3.4.rst
index 468627e..0a0e6df 100644
--- a/Help/release/3.4.rst
+++ b/Help/release/3.4.rst
@@ -197,7 +197,7 @@ CTest
CPack
-----
-* The :module:`CPackDeb` module learned to set package dependencies
+* The :cpack_gen:`CPack Deb Generator` learned to set package dependencies
per component. See variables:
* :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_BREAKS`
@@ -249,11 +249,11 @@ Other Changes
:module:`CheckSymbolExists`, and :module:`FindThreads` modules learned to
work in environments where only CXX is enabled.
-* The :module:`CPackDeb` module now correctly excludes symlinks during package
- checksum calculation.
+* The :cpack_gen:`CPack Deb Generator` now correctly excludes symlinks
+ during package checksum calculation.
-* The :module:`CPackDeb` no longer uses fakeroot and system tar program for
- packaging.
+* The :cpack_gen:`CPack Deb Generator` no longer uses fakeroot and
+ system tar program for packaging.
* The :module:`CPack` module no longer mangles settings with CMake-special
characters when they're used as defaults for other settings. The macro
diff --git a/Help/release/3.5.rst b/Help/release/3.5.rst
index 009eb3c..f988908 100644
--- a/Help/release/3.5.rst
+++ b/Help/release/3.5.rst
@@ -120,31 +120,33 @@ Platforms
CPack
-----
-* The :module:`CPackDMG` module learned new variable to specify AppleScript
- file run to customize appearance of ``DragNDrop`` installer folder,
- including background image setting using supplied PNG or multi-resolution
- TIFF file. See the :variable:`CPACK_DMG_DS_STORE_SETUP_SCRIPT` and
+* The :cpack_gen:`CPack DMG Generator` learned new variable to
+ specify AppleScript file run to customize appearance of ``DragNDrop``
+ installer folder, including background image setting using supplied
+ PNG or multi-resolution TIFF file.
+ See the :variable:`CPACK_DMG_DS_STORE_SETUP_SCRIPT` and
:variable:`CPACK_DMG_BACKGROUND_IMAGE` variables.
-* The :module:`CPackDeb` module learned to set the optional config
+* The :cpack_gen:`CPack Deb Generator` learned to set the optional config
file ``Source`` field using a monolithic or per-component variable.
See :variable:`CPACK_DEBIAN_PACKAGE_SOURCE`.
-* The :module:`CPackDeb` module learned to set Package, Section
+* The :cpack_gen:`CPack Deb Generator` learned to set Package, Section
and Priority control fields per-component.
See variables :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_SECTION` and
:variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_PRIORITY`.
-* The :module:`CPack DragNDrop generator <CPackDMG>` learned to add
+* The :cpack_gen:`CPack DMG Generator` learned to add
multi-lingual SLAs to a DMG which is presented to the user when they try to
mount the DMG. See the :variable:`CPACK_DMG_SLA_LANGUAGES` and
:variable:`CPACK_DMG_SLA_DIR` variables for details.
-* The :module:`CPackNSIS` module learned new variables to add bitmaps to the
- installer. See the :variable:`CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP`
+* The :cpack_gen:`CPack NSIS Generator` learned new variables to
+ add bitmaps to the installer.
+ See the :variable:`CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP`
and :variable:`CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP` variables.
-* The :module:`CPackRPM` module learned to set Name and Group
+* The :cpack_gen:`CPack RPM Generator` learned to set Name and Group
control fields per-component.
See :variable:`CPACK_RPM_<component>_PACKAGE_NAME`
and :variable:`CPACK_RPM_<component>_PACKAGE_GROUP`.
diff --git a/Help/release/3.6.rst b/Help/release/3.6.rst
index a542b77..c796d70 100644
--- a/Help/release/3.6.rst
+++ b/Help/release/3.6.rst
@@ -165,25 +165,25 @@ CTest
CPack
-----
-* The :module:`CPackDeb` module learned how to handle ``$ORIGIN``
+* The :cpack_gen:`CPack Deb Generator` 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 :cpack_gen:`CPack Deb Generator` 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 :cpack_gen:`CPack Deb Generator` 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
+* The :cpack_gen:`CPack Deb Generator` 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::
+* The :cpack_gen:`CPack Deb Generator` learned how to set custom package
+ file names including how to generate properly-named Debian packages::
<PackageName>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb
@@ -191,42 +191,44 @@ CPack
: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 :cpack_gen:`CPack Deb Generator` 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 :cpack_gen:`CPack Deb Generator` 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.
+* The :cpack_gen:`CPack DMG Generator` learned a new option 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).
+* The :cpack_gen:`CPack RPM Generator` 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.
+* The :cpack_gen:`CPack RPM Generator` 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.
+* The :cpack_gen:`CPack RPM Generator` 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
+* The :cpack_gen:`CPack RPM Generator` learned how to correctly handle symlinks
that are pointing outside generated packages.
Other
@@ -296,7 +298,7 @@ Other Changes
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
+* The :cpack_gen:`CPack RPM Generator` 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
diff --git a/Help/release/3.7.rst b/Help/release/3.7.rst
index d4d374b..fae10f5 100644
--- a/Help/release/3.7.rst
+++ b/Help/release/3.7.rst
@@ -221,13 +221,12 @@ CTest
CPack
-----
-* CPack gained a ``productbuild`` generator on OS X, configured by
- the :module:`CPackProductBuild` module.
+* CPack gained a :cpack_gen:`CPack productbuild Generator` on OS X.
* CPack gained a new :variable:`CPACK_PACKAGE_CHECKSUM` variable to
enable generation of a checksum file for each package file.
-* The :module:`CPackDeb` module learned to support long file names
+* The :cpack_gen:`CPack Deb Generator` learned to support long file names
when archive format is set to GNU tar.
See :variable:`CPACK_DEBIAN_ARCHIVE_TYPE`
@@ -240,32 +239,32 @@ CPack
``USER_INTERFACES`` option to add a list of additional pages to the IFW
installer.
-* The :module:`CPackRPM` module learned to generate debuginfo
+* The :cpack_gen:`CPack RPM Generator` learned to generate debuginfo
packages on demand. See :variable:`CPACK_RPM_DEBUGINFO_PACKAGE`
and its per component version.
-* The :module:`CPackRPM` module learned to generate source rpm
+* The :cpack_gen:`CPack RPM Generator` learned to generate source rpm
(SRPM) packages on demand. See :variable:`CPACK_RPM_PACKAGE_SOURCES`,
:variable:`CPACK_RPM_SOURCE_PKG_BUILD_PARAMS` and
:variable:`CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX`.
-* The CPack NSIS generator now supports
+* The :cpack_gen:`CPack NSIS Generator` now supports
:variable:`CPACK_NSIS_<compName>_INSTALL_DIRECTORY`.
This can be used to set component specific installation directories.
-* The CPack WIX generator now supports
+* The :cpack_gen:`CPack WiX Generator` now supports
:variable:`CPACK_WIX_SKIP_PROGRAM_FOLDER` to allow specification
of a custom absolute installation prefix outside
of the ProgramFiles folders.
-* The CPack WIX generator now supports
+* The :cpack_gen:`CPack WiX Generator` now supports
:variable:`CPACK_COMPONENT_<compName>_DISABLED`.
This can be used to deselect a component from being installed by default.
-* The CPack WIX generator now supports :variable:`CPACK_WIX_PATCH_FILE`
- fragments for Feature elements.
+* The :cpack_gen:`CPack WiX Generator` now supports
+ :variable:`CPACK_WIX_PATCH_FILE` fragments for Feature elements.
-* The CPack WIX generator now supports
+* The :cpack_gen:`CPack WiX Generator` now supports
:variable:`CPACK_WIX_ROOT_FEATURE_TITLE` and
:variable:`CPACK_WIX_ROOT_FEATURE_DESCRIPTION` to allow the specification
of a custom title and description for the root feature element.
diff --git a/Help/release/3.8.rst b/Help/release/3.8.rst
index efb2aa5..de51a7b 100644
--- a/Help/release/3.8.rst
+++ b/Help/release/3.8.rst
@@ -307,7 +307,7 @@ CPack
option now is deprecated and will be removed in a future version of CMake.
Please use new ``SORTING_PRIORITY`` option instead.
-* The :module:`CPackIFW` module gained new
+* The :cpack_gen:`CPack IFW Generator` gained new
:variable:`CPACK_IFW_PACKAGE_WATERMARK`,
:variable:`CPACK_IFW_PACKAGE_BANNER`,
:variable:`CPACK_IFW_PACKAGE_BACKGROUND`,
@@ -317,26 +317,26 @@ CPack
:variable:`CPACK_IFW_PACKAGE_TITLE_COLOR`
variables to customize a QtIFW installer look.
-* The :module:`CPackProductBuild` module gained options to sign packages.
+* The :cpack_gen:`CPack productbuild Generator` gained options to sign packages.
See the variables :variable:`CPACK_PRODUCTBUILD_IDENTITY_NAME`,
:variable:`CPACK_PRODUCTBUILD_KEYCHAIN_PATH`,
:variable:`CPACK_PKGBUILD_IDENTITY_NAME`, and
:variable:`CPACK_PKGBUILD_KEYCHAIN_PATH`.
-* The :module:`CPackRPM` module learned to omit tags that are not supported by
- provided ``rpmbuild`` tool. If unsupported tags are set they are ignored
- and a developer warning is printed out.
+* The :cpack_gen:`CPack RPM Generator` learned to omit tags that are not
+ supported by provided ``rpmbuild`` tool. If unsupported tags are set they
+ are ignored and a developer warning is printed out.
-* The :module:`CPackRPM` module learned to generate main component package
- which forces generation of a rpm for defined component without component
- suffix in filename and package name.
+* The :cpack_gen:`CPack RPM Generator` learned to generate main component
+ package which forces generation of a rpm for defined component without
+ component suffix in filename and package name.
See :variable:`CPACK_RPM_MAIN_COMPONENT` variable.
-* The :module:`CPackRPM` module learned to generate a single ``debuginfo``
- package on demand even if components packaging is used.
+* The :cpack_gen:`CPack RPM Generator` learned to generate a single
+ ``debuginfo`` package on demand even if components packaging is used.
See :variable:`CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE` variable.
-* The :module:`CPackRPM` module learned to support
+* The :cpack_gen:`CPack RPM Generator` learned to support
multiple directives per file when using
:variable:`CPACK_RPM_USER_FILELIST` variable.
diff --git a/Help/release/3.9.rst b/Help/release/3.9.rst
index 897e268..5001e90 100644
--- a/Help/release/3.9.rst
+++ b/Help/release/3.9.rst
@@ -206,7 +206,7 @@ CTest
CPack
-----
-* The :module:`CPackArchive` module learned to modify the filename
+* The :cpack_gen:`CPack Archive Generator` learned to modify the filename
per-component. See the :variable:`CPACK_ARCHIVE_FILE_NAME` variable and
its per-component version :variable:`CPACK_ARCHIVE_<component>_FILE_NAME`.
@@ -220,23 +220,24 @@ CPack
internationalization support for ``DISPLAY_NAME`` and ``DESCRIPTION``
options.
-* The :module:`CPackIFW` module learned the new hint :variable:`CPACK_IFW_ROOT`
- variable for finding the QtIFW tool suite installed in a non-standard place.
+* The :cpack_gen:`CPack IFW Generator` learned the new hint
+ :variable:`CPACK_IFW_ROOT` variable for finding the QtIFW tool suite
+ installed in a non-standard place.
-* The :module:`CPackProductBuild` module gained a new
+* The :cpack_gen:`CPack productbuild Generator` gained a new
:variable:`CPACK_PRODUCTBUILD_RESOURCES_DIR` variable to
specify resources to be copied into the ``Resources``
directory.
-* The :module:`CPackRPM` module learned to modify the ``debuginfo`` package
- name. See the :variable:`CPACK_RPM_DEBUGINFO_FILE_NAME` variable.
+* The :cpack_gen:`CPack RPM Generator` learned to modify the ``debuginfo``
+ package name. See the :variable:`CPACK_RPM_DEBUGINFO_FILE_NAME` variable.
-* The :module:`CPackWIX` module patching system now has the ability to set
- additional attributes. This can be done by specifying attributes with
- the ``CPackWiXFragment`` XML tag after the ``Id`` attribute.
+* The :cpack_gen:`CPack WiX Generator` patching system now has the
+ ability to set additional attributes. This can be done by specifying
+ attributes with the ``CPackWiXFragment`` XML tag after the ``Id`` attribute.
See the :variable:`CPACK_WIX_PATCH_FILE` variable.
-* The CPack WIX generator implemented a new
+* The :cpack_gen:`CPack WiX Generator` implemented a new
:variable:`CPACK_WIX_ROOT_FOLDER_ID` variable which allows
using a custom root folder ID instead of the default
``ProgramFilesFolder`` / ``ProgramFiles64Folder``.
diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst
new file mode 100644
index 0000000..e4cc01e
--- /dev/null
+++ b/Help/release/dev/0-sample-topic.rst
@@ -0,0 +1,7 @@
+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/CMAKE_AUTOGEN_VERBOSE.rst b/Help/release/dev/CMAKE_AUTOGEN_VERBOSE.rst
new file mode 100644
index 0000000..da559cc
--- /dev/null
+++ b/Help/release/dev/CMAKE_AUTOGEN_VERBOSE.rst
@@ -0,0 +1,6 @@
+CMAKE_AUTOGEN_VERBOSE
+---------------------
+
+* The new variable :variable:`CMAKE_AUTOGEN_VERBOSE` allows
+ to increase the verbosity of :prop_tgt:`AUTOMOC`, :prop_tgt:`AUTOUIC` and
+ :prop_tgt:`AUTORCC` from within CMakeLists.txt.
diff --git a/Help/release/dev/FindCURL-per-config.rst b/Help/release/dev/FindCURL-per-config.rst
new file mode 100644
index 0000000..5ba1425
--- /dev/null
+++ b/Help/release/dev/FindCURL-per-config.rst
@@ -0,0 +1,5 @@
+FindCURL-per-config
+-------------------
+
+* The :module:`FindCURL` module learned to find debug and release variants
+ separately.
diff --git a/Help/release/dev/FindMatlab-mcc.rst b/Help/release/dev/FindMatlab-mcc.rst
new file mode 100644
index 0000000..71387f3
--- /dev/null
+++ b/Help/release/dev/FindMatlab-mcc.rst
@@ -0,0 +1,5 @@
+FindMatlab-mcc
+--------------
+
+* The :module:`FindMatlab` module gained a new ``MCC_COMPILER``
+ component to request finding the Matlab Compiler add-on.
diff --git a/Help/release/dev/INTERFACE_LINK_DEPENDS-property.rst b/Help/release/dev/INTERFACE_LINK_DEPENDS-property.rst
new file mode 100644
index 0000000..9527c97
--- /dev/null
+++ b/Help/release/dev/INTERFACE_LINK_DEPENDS-property.rst
@@ -0,0 +1,4 @@
+INTERFACE_LINK_DEPENDS-property
+-------------------------------
+
+* Binary targets gained new :prop_tgt:`INTERFACE_LINK_DEPENDS` property.
diff --git a/Help/release/dev/LINK_DEPENDS-property.rst b/Help/release/dev/LINK_DEPENDS-property.rst
new file mode 100644
index 0000000..83beba8
--- /dev/null
+++ b/Help/release/dev/LINK_DEPENDS-property.rst
@@ -0,0 +1,5 @@
+LINK_DEPENDS-property
+---------------------
+
+* The :prop_tgt:`LINK_DEPENDS` target property learned to support
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
diff --git a/Help/release/dev/LINK_OPTIONS.rst b/Help/release/dev/LINK_OPTIONS.rst
new file mode 100644
index 0000000..e40dab2
--- /dev/null
+++ b/Help/release/dev/LINK_OPTIONS.rst
@@ -0,0 +1,11 @@
+LINK_OPTIONS
+------------
+
+* CMake gained new capabilities to manage link step:
+
+ * :prop_dir:`LINK_OPTIONS` directory property.
+ * :prop_tgt:`LINK_OPTIONS` and :prop_tgt:`INTERFACE_LINK_OPTIONS` target
+ properties.
+ * :command:`add_link_options` command to add link options in the current
+ directory.
+ * :command:`target_link_options` command to add link options to targets.
diff --git a/Help/release/dev/STATIC_LIBRARY_OPTIONS.rst b/Help/release/dev/STATIC_LIBRARY_OPTIONS.rst
new file mode 100644
index 0000000..087dc76
--- /dev/null
+++ b/Help/release/dev/STATIC_LIBRARY_OPTIONS.rst
@@ -0,0 +1,4 @@
+STATIC_LIBRARY_OPTIONS
+----------------------
+
+* static library targets gained new :prop_tgt:`STATIC_LIBRARY_OPTIONS` property.
diff --git a/Help/release/dev/UseSWIG-USE_TARGET_INCLUDE_DIRECTORIES.rst b/Help/release/dev/UseSWIG-USE_TARGET_INCLUDE_DIRECTORIES.rst
new file mode 100644
index 0000000..2a2721f
--- /dev/null
+++ b/Help/release/dev/UseSWIG-USE_TARGET_INCLUDE_DIRECTORIES.rst
@@ -0,0 +1,5 @@
+UseSWIG-USE_TARGET_INCLUDE_DIRECTORIES
+--------------------------------------
+
+* Module ``UseSWIG`` gains capability to manage target property
+ :prop_tgt:`INCLUDE_DIRECTORIES` for ``SWIG`` compilation.
diff --git a/Help/release/dev/UseSWIG-target-name-policy.rst b/Help/release/dev/UseSWIG-target-name-policy.rst
new file mode 100644
index 0000000..bb9011d
--- /dev/null
+++ b/Help/release/dev/UseSWIG-target-name-policy.rst
@@ -0,0 +1,5 @@
+UseSWIG-target-name-policy
+--------------------------
+
+* The :module:`UseSWIG` module has changed strategy for target naming.
+ See policy :policy:`CMP0078`.
diff --git a/Help/release/dev/cpack-deb-source-date-epoch.rst b/Help/release/dev/cpack-deb-source-date-epoch.rst
new file mode 100644
index 0000000..b276569
--- /dev/null
+++ b/Help/release/dev/cpack-deb-source-date-epoch.rst
@@ -0,0 +1,6 @@
+cpack-deb-source-date-epoch
+---------------------------
+
+* The :cpack_gen:`CPack Deb Generator` learned to honor the ``SOURCE_DATE_EPOCH``
+ environment variable when packaging files. This is useful for generating
+ reproducible packages.
diff --git a/Help/release/dev/cpack-external.rst b/Help/release/dev/cpack-external.rst
new file mode 100644
index 0000000..fb9a061
--- /dev/null
+++ b/Help/release/dev/cpack-external.rst
@@ -0,0 +1,8 @@
+cpack-external
+--------------
+
+* CPack gained a new :cpack_gen:`CPack External Generator` which is used to
+ export the CPack metadata in a format that other software can understand. The
+ intention of this generator is to allow external packaging software to take
+ advantage of CPack's features when it may not be possible to use CPack for
+ the entire packaging process.
diff --git a/Help/release/dev/cpack-generator-documentation.rst b/Help/release/dev/cpack-generator-documentation.rst
new file mode 100644
index 0000000..c3c5193
--- /dev/null
+++ b/Help/release/dev/cpack-generator-documentation.rst
@@ -0,0 +1,9 @@
+cpack-generator-documentation
+-----------------------------
+
+* The CPack generators have been moved into their own separate section in the
+ documentation, rather than having the documentation in their internal
+ implementation modules.
+* These internal implementation modules are also no longer available to scripts
+ that may have been incorrectly including them, because they should never have
+ been available in the first place.
diff --git a/Help/release/dev/ghs.rst b/Help/release/dev/ghs.rst
new file mode 100644
index 0000000..d3bec95
--- /dev/null
+++ b/Help/release/dev/ghs.rst
@@ -0,0 +1,20 @@
+ghs
+---
+
+* The :generator:`Green Hills MULTI` generator is updated:
+
+ - Added support for architecture selection through
+ :variable:`CMAKE_GENERATOR_PLATFORM`:
+ e.g. ``arm``, ``ppc``, and ``86``.
+
+ - Added support for toolset selection through
+ :variable:`CMAKE_GENERATOR_TOOLSET`,
+ e.g. ``comp_201205``, ``comp_201510``, ``comp_201722_beta``.
+
+ - Added support for platform selection through ``GHS_TARGET_PLATFORM``,
+ e.g. ``integrity``, ``linux``, ``standalone``, etc.
+
+ - No longer checks that ``arm`` based compilers are installed but ensures
+ that the correct ``gbuild.exe`` exists.
+
+ - No longer hard-codes ARM files, BSP, toolset, or OS locations.
diff --git a/Help/release/dev/install-code-script-genex.rst b/Help/release/dev/install-code-script-genex.rst
new file mode 100644
index 0000000..6532e7b
--- /dev/null
+++ b/Help/release/dev/install-code-script-genex.rst
@@ -0,0 +1,5 @@
+install-code-script-genex
+-------------------------
+
+* The :command:`install(CODE)` and :command:`install(SCRIPT)` commands
+ learned to support generator expressions.
diff --git a/Help/release/dev/list_sort.rst b/Help/release/dev/list_sort.rst
new file mode 100644
index 0000000..8971b78
--- /dev/null
+++ b/Help/release/dev/list_sort.rst
@@ -0,0 +1,5 @@
+list_sort
+---------
+
+* The :command:`list(SORT)` command gained options to control the
+ comparison operation used to order the entries.
diff --git a/Help/release/dev/math-hex.rst b/Help/release/dev/math-hex.rst
new file mode 100644
index 0000000..16e21ec
--- /dev/null
+++ b/Help/release/dev/math-hex.rst
@@ -0,0 +1,4 @@
+math-hex
+--------
+
+* The :command:`math` command gained options for hexadecimal.
diff --git a/Help/release/dev/option-normal-variable.rst b/Help/release/dev/option-normal-variable.rst
new file mode 100644
index 0000000..19b9a64
--- /dev/null
+++ b/Help/release/dev/option-normal-variable.rst
@@ -0,0 +1,5 @@
+option-normal-variable
+----------------------
+
+* The :command:`option` command now honors existing normal variables instead
+ of replacing them with a cache entry. See policy :policy:`CMP0077`.
diff --git a/Help/release/dev/pkgc-global.rst b/Help/release/dev/pkgc-global.rst
new file mode 100644
index 0000000..0c07d9e
--- /dev/null
+++ b/Help/release/dev/pkgc-global.rst
@@ -0,0 +1,5 @@
+pkgc-global
+-----------
+
+* Module ``FindPkgConfig`` gains capability to create imported targets in
+ global scope.
diff --git a/Help/release/dev/subdirectory-installing.rst b/Help/release/dev/subdirectory-installing.rst
new file mode 100644
index 0000000..04e4676
--- /dev/null
+++ b/Help/release/dev/subdirectory-installing.rst
@@ -0,0 +1,5 @@
+subdirectory-installing
+-----------------------
+
+* The :command:`install(TARGETS)` command may now be used
+ to install targets created outside the current directory.
diff --git a/Help/release/dev/subdirectory-sources.rst b/Help/release/dev/subdirectory-sources.rst
new file mode 100644
index 0000000..880b321
--- /dev/null
+++ b/Help/release/dev/subdirectory-sources.rst
@@ -0,0 +1,8 @@
+subdirectory-sources
+--------------------
+
+* The :command:`target_sources` command now interprets relative source file
+ paths as relative to the current source directory. This simplifies
+ incrementally building up a target's sources from subdirectories. The
+ :policy:`CMP0076` policy was added to provide backward compatibility with
+ the old behavior where required.
diff --git a/Help/release/dev/vs-debugger-improvements.rst b/Help/release/dev/vs-debugger-improvements.rst
new file mode 100644
index 0000000..f1944bb
--- /dev/null
+++ b/Help/release/dev/vs-debugger-improvements.rst
@@ -0,0 +1,14 @@
+vs-debugger-improvements
+------------------------
+
+* A :prop_tgt:`VS_DEBUGGER_COMMAND_ARGUMENTS` target property was created to
+ set the debugging command line arguments with
+ :ref:`Visual Studio Generators` for VS 2010 and above.
+* A :prop_tgt:`VS_DEBUGGER_ENVIRONMENT` target property was created to
+ set the debugging environment with
+ :ref:`Visual Studio Generators` for VS 2010 and above.
+* :prop_tgt:`VS_DEBUGGER_COMMAND`
+ :prop_tgt:`VS_DEBUGGER_COMMAND_ARGUMENTS`
+ :prop_tgt:`VS_DEBUGGER_ENVIRONMENT`
+ :prop_tgt:`VS_DEBUGGER_WORKING_DIRECTORY`
+ target properties can use generator expressions.
diff --git a/Help/release/dev/vs-deployment-files.rst b/Help/release/dev/vs-deployment-files.rst
new file mode 100644
index 0000000..1590ed9
--- /dev/null
+++ b/Help/release/dev/vs-deployment-files.rst
@@ -0,0 +1,7 @@
+vs-deployment-files
+-------------------
+
+* The :prop_tgt:`DEPLOYMENT_ADDITIONAL_FILES` target property was
+ added to tell the :generator:`Visual Studio 9 2008` generator
+ to specify additional files for deployment to WinCE devices
+ for remote debugging.
diff --git a/Help/release/dev/xcode_schemes_config.rst b/Help/release/dev/xcode_schemes_config.rst
new file mode 100644
index 0000000..f9b5314
--- /dev/null
+++ b/Help/release/dev/xcode_schemes_config.rst
@@ -0,0 +1,5 @@
+xcode_schemes_config
+--------------------
+
+* The :generator:`Xcode` generator learned to configure more Xcode Scheme
+ fields. See the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable.
diff --git a/Help/release/index.rst b/Help/release/index.rst
index 4b32eab..4c9e96a 100644
--- a/Help/release/index.rst
+++ b/Help/release/index.rst
@@ -7,6 +7,8 @@ CMake Release Notes
This file should include the adjacent "dev.txt" file
in development versions but not in release versions.
+.. include:: dev.txt
+
Releases
========
diff --git a/Help/variable/CACHE.rst b/Help/variable/CACHE.rst
new file mode 100644
index 0000000..230739a
--- /dev/null
+++ b/Help/variable/CACHE.rst
@@ -0,0 +1,17 @@
+CACHE
+-----
+
+Read cache variables.
+
+Use the syntax ``$CACHE{VAR}`` to read cache entry ``VAR``.
+See the :ref:`cmake-language(7) variables <CMake Language Variables>`
+documentation for more complete documentation of the interaction of
+normal variables and cache entries.
+
+When evaluating :ref:`Variable References` of the form ``${VAR}``,
+CMake first searches for a normal variable with that name, and if not
+found CMake will search for a cache entry with that name.
+The ``$CACHE{VAR}`` syntax can be used to do direct cache lookup and
+ignore any existing normal variable.
+
+See the :command:`set` command to see how to write cache variables.
diff --git a/Help/variable/CMAKE_ANDROID_STL_TYPE.rst b/Help/variable/CMAKE_ANDROID_STL_TYPE.rst
index cfb76aa..d174575 100644
--- a/Help/variable/CMAKE_ANDROID_STL_TYPE.rst
+++ b/Help/variable/CMAKE_ANDROID_STL_TYPE.rst
@@ -30,7 +30,8 @@ set to specify the STL variant to be used. The value may be one of:
``stlport_shared``
STLport Shared
-The default value is ``gnustl_static``. Note that this default differs from
+The default value is ``gnustl_static`` on NDK versions that provide it
+and otherwise ``c++_static``. Note that this default differs from
the native NDK build system because CMake may be used to build projects for
Android that are not natively implemented for it and use the C++ standard
library.
diff --git a/Help/variable/CMAKE_AUTOGEN_VERBOSE.rst b/Help/variable/CMAKE_AUTOGEN_VERBOSE.rst
new file mode 100644
index 0000000..bad9cf2
--- /dev/null
+++ b/Help/variable/CMAKE_AUTOGEN_VERBOSE.rst
@@ -0,0 +1,13 @@
+CMAKE_AUTOGEN_VERBOSE
+---------------------
+
+Sets the verbosity of :prop_tgt:`AUTOMOC`, :prop_tgt:`AUTOUIC` and
+:prop_tgt:`AUTORCC`. A positive integer value or a true boolean value
+lets the ``AUTO*`` generators output additional processing information.
+
+Setting :variable:`CMAKE_AUTOGEN_VERBOSE` has the same effect
+as setting the ``VERBOSE`` environment variable during
+generation (e.g. by calling ``make VERBOSE=1``).
+The extra verbosity is limited to the ``AUTO*`` generators though.
+
+By default :variable:`CMAKE_AUTOGEN_VERBOSE` is unset.
diff --git a/Help/variable/CMAKE_GENERATOR_PLATFORM.rst b/Help/variable/CMAKE_GENERATOR_PLATFORM.rst
index 50412ff..963f0a4 100644
--- a/Help/variable/CMAKE_GENERATOR_PLATFORM.rst
+++ b/Help/variable/CMAKE_GENERATOR_PLATFORM.rst
@@ -19,6 +19,8 @@ Platform specification is supported only on specific generators:
* For :ref:`Visual Studio Generators` with VS 2005 and above this
specifies the target architecture.
+* For :generator:`Green Hills MULTI` this specifies the target architecture.
+
See native build system documentation for allowed platform names.
Visual Studio Platform Selection
diff --git a/Help/variable/CMAKE_GENERATOR_TOOLSET.rst b/Help/variable/CMAKE_GENERATOR_TOOLSET.rst
index 3220244..e9bc28b 100644
--- a/Help/variable/CMAKE_GENERATOR_TOOLSET.rst
+++ b/Help/variable/CMAKE_GENERATOR_TOOLSET.rst
@@ -18,6 +18,7 @@ Toolset specification is supported only on specific generators:
* :ref:`Visual Studio Generators` for VS 2010 and above
* The :generator:`Xcode` generator for Xcode 3.0 and above
+* The :generator:`Green Hills MULTI` generator
See native build system documentation for allowed toolset names.
diff --git a/Help/variable/CMAKE_LANG_CLANG_TIDY.rst b/Help/variable/CMAKE_LANG_CLANG_TIDY.rst
index d1fccbb..bd49de3 100644
--- a/Help/variable/CMAKE_LANG_CLANG_TIDY.rst
+++ b/Help/variable/CMAKE_LANG_CLANG_TIDY.rst
@@ -9,5 +9,5 @@ created. For example:
.. code-block:: cmake
- set(CMAKE_CXX_CLANG_TIDY clang-tidy checks=-*,readability-*)
+ set(CMAKE_CXX_CLANG_TIDY clang-tidy -checks=-*,readability-*)
add_executable(foo foo.cxx)
diff --git a/Help/variable/CMAKE_LANG_LINKER_WRAPPER_FLAG.rst b/Help/variable/CMAKE_LANG_LINKER_WRAPPER_FLAG.rst
new file mode 100644
index 0000000..0e52282
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_LINKER_WRAPPER_FLAG.rst
@@ -0,0 +1,39 @@
+CMAKE_<LANG>_LINKER_WRAPPER_FLAG
+--------------------------------
+
+Defines the syntax of compiler driver option to pass options to the linker
+tool. It will be used to translate the ``LINKER:`` prefix in the link options
+(see :command:`add_link_options` and :command:`target_link_options`).
+
+This variable holds a :ref:`;-list <CMake Language Lists>` of tokens.
+If a space (i.e. " ") is specified as last token, flag and ``LINKER:``
+arguments will be specified as separate arguments to the compiler driver.
+The :variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG_SEP` variable can be specified
+to manage concatenation of arguments.
+
+For example, for ``Clang`` we have:
+
+.. code-block:: cmake
+
+ set (CMAKE_C_LINKER_WRAPPER_FLAG "-Xlinker" " ")
+
+Specifying ``"LINKER:-z defs"`` will be transformed in
+``-Xlinker -z -Xlinker defs``.
+
+For ``GNU GCC``:
+
+.. code-block:: cmake
+
+ set (CMAKE_C_LINKER_WRAPPER_FLAG "-Wl,")
+ set (CMAKE_C_LINKER_WRAPPER_FLAG_SEP ",")
+
+Specifying ``"LINKER:-z defs"`` will be transformed in ``-Wl,-z,defs``.
+
+And for ``SunPro``:
+
+.. code-block:: cmake
+
+ set (CMAKE_C_LINKER_WRAPPER_FLAG "-Qoption" "ld" " ")
+ set (CMAKE_C_LINKER_WRAPPER_FLAG_SEP ",")
+
+Specifying ``"LINKER:-z defs"`` will be transformed in ``-Qoption ld -z,defs``.
diff --git a/Help/variable/CMAKE_LANG_LINKER_WRAPPER_FLAG_SEP.rst b/Help/variable/CMAKE_LANG_LINKER_WRAPPER_FLAG_SEP.rst
new file mode 100644
index 0000000..faf1481
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_LINKER_WRAPPER_FLAG_SEP.rst
@@ -0,0 +1,9 @@
+CMAKE_<LANG>_LINKER_WRAPPER_FLAG_SEP
+------------------------------------
+
+This variable is used with :variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG`
+variable to format ``LINKER:`` prefix in the link options
+(see :command:`add_link_options` and :command:`target_link_options`).
+
+When specified, arguments of the ``LINKER:`` prefix will be concatenated using
+this value as separator.
diff --git a/Help/variable/CMAKE_MAKE_PROGRAM.rst b/Help/variable/CMAKE_MAKE_PROGRAM.rst
index a3b997a..4f5a50f 100644
--- a/Help/variable/CMAKE_MAKE_PROGRAM.rst
+++ b/Help/variable/CMAKE_MAKE_PROGRAM.rst
@@ -55,9 +55,11 @@ to configure the project:
the CMake cache then CMake will use the specified value if
possible.
-* The :generator:`Green Hills MULTI` generator sets this to ``gbuild``.
- If a user or project explicitly adds ``CMAKE_MAKE_PROGRAM`` to
- the CMake cache then CMake will use the specified value.
+* The :generator:`Green Hills MULTI` generator sets this to the full
+ path to ``gbuild.exe`` based upon the toolset being used.
+
+ Once the generator has initialized a particular value for this
+ variable, changing the value has undefined behavior.
The ``CMAKE_MAKE_PROGRAM`` variable is set for use by project code.
The value is also used by the :manual:`cmake(1)` ``--build`` and
diff --git a/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst b/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst
index 09280de..8ad89f1 100644
--- a/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst
+++ b/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst
@@ -6,5 +6,3 @@ The name of the CPU CMake is building for.
This variable is the same as :variable:`CMAKE_HOST_SYSTEM_PROCESSOR` if
you build for the host system instead of the target system when
cross compiling.
-
-* The :generator:`Green Hills MULTI` generator sets this to ``ARM`` by default.
diff --git a/Help/variable/CMAKE_VS_WINRT_BY_DEFAULT.rst b/Help/variable/CMAKE_VS_WINRT_BY_DEFAULT.rst
new file mode 100644
index 0000000..2ba8fe2
--- /dev/null
+++ b/Help/variable/CMAKE_VS_WINRT_BY_DEFAULT.rst
@@ -0,0 +1,8 @@
+CMAKE_VS_WINRT_BY_DEFAULT
+-------------------------
+
+Tell :ref:`Visual Studio Generators` for VS 2010 and above that the
+target platform compiles as WinRT by default (compiles with ``/ZW``).
+
+This variable is meant to be set by a
+:variable:`toolchain file <CMAKE_TOOLCHAIN_FILE>` for such platforms.
diff --git a/Help/variable/CMAKE_XCODE_GENERATE_SCHEME.rst b/Help/variable/CMAKE_XCODE_GENERATE_SCHEME.rst
index c9fcc92..ed20bbe 100644
--- a/Help/variable/CMAKE_XCODE_GENERATE_SCHEME.rst
+++ b/Help/variable/CMAKE_XCODE_GENERATE_SCHEME.rst
@@ -9,3 +9,31 @@ actions from the command line.
The Xcode Schema Generator is still experimental and subject to
change.
+
+The following target properties overwrite the default of the
+corresponding settings on the "Diagnostic" tab for each schema file.
+Each of those is initialized by the respective ``CMAKE_`` variable
+at target creation time.
+
+- :prop_tgt:`XCODE_SCHEME_ADDRESS_SANITIZER`
+- :prop_tgt:`XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN`
+- :prop_tgt:`XCODE_SCHEME_THREAD_SANITIZER`
+- :prop_tgt:`XCODE_SCHEME_THREAD_SANITIZER_STOP`
+- :prop_tgt:`XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER`
+- :prop_tgt:`XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP`
+- :prop_tgt:`XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER`
+- :prop_tgt:`XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP`
+- :prop_tgt:`XCODE_SCHEME_MALLOC_SCRIBBLE`
+- :prop_tgt:`XCODE_SCHEME_MALLOC_GUARD_EDGES`
+- :prop_tgt:`XCODE_SCHEME_GUARD_MALLOC`
+- :prop_tgt:`XCODE_SCHEME_ZOMBIE_OBJECTS`
+- :prop_tgt:`XCODE_SCHEME_MALLOC_STACK`
+- :prop_tgt:`XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE`
+- :prop_tgt:`XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS`
+
+The following target properties will be applied on the
+"Info" and "Arguments" tab:
+
+- :prop_tgt:`XCODE_SCHEME_EXECUTABLE`
+- :prop_tgt:`XCODE_SCHEME_ARGUMENTS`
+- :prop_tgt:`XCODE_SCHEME_ENVIRONMENT`
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER.rst b/Help/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER.rst
new file mode 100644
index 0000000..37dc0ce
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER.rst
@@ -0,0 +1,12 @@
+CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER
+------------------------------------
+
+Whether to enable ``Address Sanitizer`` in the Diagnostics
+section of the generated Xcode scheme.
+
+This variable initializes the
+:prop_tgt:`XCODE_SCHEME_ADDRESS_SANITIZER`
+property on all targets.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN.rst b/Help/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN.rst
new file mode 100644
index 0000000..05949c3
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN.rst
@@ -0,0 +1,12 @@
+CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN
+-----------------------------------------------------
+
+Whether to enable ``Detect use of stack after return``
+in the Diagnostics section of the generated Xcode scheme.
+
+This variable initializes the
+:prop_tgt:`XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN`
+property on all targets.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER.rst b/Help/variable/CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER.rst
new file mode 100644
index 0000000..81f4974
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER.rst
@@ -0,0 +1,12 @@
+CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER
+----------------------------------------------
+
+Whether to disable the ``Main Thread Checker``
+in the Diagnostics section of the generated Xcode scheme.
+
+This variable initializes the
+:prop_tgt:`XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER`
+property on all targets.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS.rst b/Help/variable/CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS.rst
new file mode 100644
index 0000000..5e133ac
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS.rst
@@ -0,0 +1,12 @@
+CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS
+----------------------------------------
+
+Whether to enable ``Dynamic Library Loads``
+in the Diagnostics section of the generated Xcode scheme.
+
+This variable initializes the
+:prop_tgt:`XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS`
+property on all targets.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE.rst b/Help/variable/CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE.rst
new file mode 100644
index 0000000..33162d9
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE.rst
@@ -0,0 +1,12 @@
+CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE
+-------------------------------------------
+
+Whether to enable ``Dynamic Linker API usage``
+in the Diagnostics section of the generated Xcode scheme.
+
+This variable initializes the
+:prop_tgt:`XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE`
+property on all targets.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_GUARD_MALLOC.rst b/Help/variable/CMAKE_XCODE_SCHEME_GUARD_MALLOC.rst
new file mode 100644
index 0000000..03d88c2
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_SCHEME_GUARD_MALLOC.rst
@@ -0,0 +1,12 @@
+CMAKE_XCODE_SCHEME_GUARD_MALLOC
+-------------------------------
+
+Whether to enable ``Guard Malloc``
+in the Diagnostics section of the generated Xcode scheme.
+
+This variable initializes the
+:prop_tgt:`XCODE_SCHEME_GUARD_MALLOC`
+property on all targets.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP.rst b/Help/variable/CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP.rst
new file mode 100644
index 0000000..fd6135f
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP.rst
@@ -0,0 +1,13 @@
+CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP
+-------------------------------------------
+
+Whether to enable the ``Main Thread Checker`` option
+``Pause on issues``
+in the Diagnostics section of the generated Xcode scheme.
+
+This variable initializes the
+:prop_tgt:`XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP`
+property on all targets.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES.rst b/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES.rst
new file mode 100644
index 0000000..8fedc20
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES.rst
@@ -0,0 +1,12 @@
+CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES
+-------------------------------------
+
+Whether to enable ``Malloc Guard Edges``
+in the Diagnostics section of the generated Xcode scheme.
+
+This variable initializes the
+:prop_tgt:`XCODE_SCHEME_MALLOC_GUARD_EDGES`
+property on all targets.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE.rst b/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE.rst
new file mode 100644
index 0000000..cddca7c
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE.rst
@@ -0,0 +1,12 @@
+CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE
+----------------------------------
+
+Whether to enable ``Malloc Scribble``
+in the Diagnostics section of the generated Xcode scheme.
+
+This variable initializes the
+:prop_tgt:`XCODE_SCHEME_MALLOC_SCRIBBLE`
+property on all targets.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_STACK.rst b/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_STACK.rst
new file mode 100644
index 0000000..9c83698
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_STACK.rst
@@ -0,0 +1,12 @@
+CMAKE_XCODE_SCHEME_MALLOC_STACK
+-------------------------------
+
+Whether to enable ``Malloc Stack`` in the Diagnostics
+section of the generated Xcode scheme.
+
+This variable initializes the
+:prop_tgt:`XCODE_SCHEME_MALLOC_STACK`
+property on all targets.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER.rst b/Help/variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER.rst
new file mode 100644
index 0000000..c937369
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER.rst
@@ -0,0 +1,12 @@
+CMAKE_XCODE_SCHEME_THREAD_SANITIZER
+-----------------------------------
+
+Whether to enable ``Thread Sanitizer`` in the Diagnostics
+section of the generated Xcode scheme.
+
+This variable initializes the
+:prop_tgt:`XCODE_SCHEME_THREAD_SANITIZER`
+property on all targets.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP.rst b/Help/variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP.rst
new file mode 100644
index 0000000..eed796c
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP.rst
@@ -0,0 +1,12 @@
+CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP
+----------------------------------------
+
+Whether to enable ``Thread Sanitizer - Pause on issues``
+in the Diagnostics section of the generated Xcode scheme.
+
+This variable initializes the
+:prop_tgt:`XCODE_SCHEME_THREAD_SANITIZER_STOP`
+property on all targets.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER.rst b/Help/variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER.rst
new file mode 100644
index 0000000..d14ba3f
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER.rst
@@ -0,0 +1,12 @@
+CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER
+------------------------------------------------
+
+Whether to enable ``Undefined Behavior Sanitizer``
+in the Diagnostics section of the generated Xcode scheme.
+
+This variable initializes the
+:prop_tgt:`XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER`
+property on all targets.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP.rst b/Help/variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP.rst
new file mode 100644
index 0000000..f8df304
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP.rst
@@ -0,0 +1,13 @@
+CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP
+-----------------------------------------------------
+
+Whether to enable ``Undefined Behavior Sanitizer`` option
+``Pause on issues``
+in the Diagnostics section of the generated Xcode scheme.
+
+This variable initializes the
+:prop_tgt:`XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP`
+property on all targets.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS.rst b/Help/variable/CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS.rst
new file mode 100644
index 0000000..efc331a
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS.rst
@@ -0,0 +1,12 @@
+CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS
+---------------------------------
+
+Whether to enable ``Zombie Objects``
+in the Diagnostics section of the generated Xcode scheme.
+
+This variable initializes the
+:prop_tgt:`XCODE_SCHEME_ZOMBIE_OBJECTS`
+property on all targets.
+
+Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable
+documentation to see all Xcode schema related properties.
diff --git a/Help/variable/ENV.rst b/Help/variable/ENV.rst
index 368152a..98677dd 100644
--- a/Help/variable/ENV.rst
+++ b/Help/variable/ENV.rst
@@ -1,7 +1,8 @@
ENV
---
-Access environment variables.
+Read environment variables.
-Use the syntax ``$ENV{VAR}`` to read environment variable ``VAR``. See also
-the :command:`set` command to set ``ENV{VAR}``.
+Use the syntax ``$ENV{VAR}`` to read environment variable ``VAR``.
+
+See the :command:`set` command to see how to write environment variables.
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index 121a8f0..4727f03 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -421,7 +421,12 @@ function(get_item_rpaths item rpaths_var)
execute_process(
COMMAND "${otool_cmd}" -l "${item}"
OUTPUT_VARIABLE load_cmds_ov
+ RESULT_VARIABLE otool_rv
+ ERROR_VARIABLE otool_ev
)
+ if(NOT otool_rv STREQUAL "0")
+ message(FATAL_ERROR "otool -l failed: ${otool_rv}\n${otool_ev}")
+ endif()
string(REGEX REPLACE "[^\n]+cmd LC_RPATH\n[^\n]+\n[^\n]+path ([^\n]+) \\(offset[^\n]+\n" "rpath \\1\n" load_cmds_ov "${load_cmds_ov}")
string(REGEX MATCHALL "rpath [^\n]+" load_cmds_ov "${load_cmds_ov}")
string(REGEX REPLACE "rpath " "" load_cmds_ov "${load_cmds_ov}")
diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake
index 8e62941..43ae989 100644
--- a/Modules/CMakeCUDAInformation.cmake
+++ b/Modules/CMakeCUDAInformation.cmake
@@ -185,7 +185,7 @@ if(__IMPLICT_DLINK_DIRS)
endif()
set(__IMPLICT_DLINK_FLAGS )
foreach(dir ${__IMPLICT_DLINK_DIRS})
- if(EXISTS "${dir}/libcublas_device.a")
+ if(EXISTS "${dir}/libcurand_static.a")
string(APPEND __IMPLICT_DLINK_FLAGS " -L\"${dir}\"")
endif()
endforeach()
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 16dde65..dc4d9be 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -355,6 +355,12 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
else()
set(id_development_team "")
endif()
+ if(DEFINED CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY)
+ set(id_code_sign_identity
+ "CODE_SIGN_IDENTITY = \"${CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY}\";")
+ else()
+ set(id_code_sign_identity "")
+ endif()
configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-3.pbxproj.in
${id_dir}/CompilerId${lang}.xcodeproj/project.pbxproj @ONLY)
unset(_ENV_MACOSX_DEPLOYMENT_TARGET)
diff --git a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
index 3a72622..55e0373 100644
--- a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
+++ b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
@@ -66,10 +66,10 @@ macro(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _resultIncludeDirs _resultDefines
#message(STATUS "m1: -${CMAKE_MATCH_1}- m2: -${CMAKE_MATCH_2}- m3: -${CMAKE_MATCH_3}-")
list(APPEND ${_resultDefines} "${_name}")
- if(_value)
- list(APPEND ${_resultDefines} "${_value}")
- else()
+ if ("${_value}" STREQUAL "")
list(APPEND ${_resultDefines} " ")
+ else()
+ list(APPEND ${_resultDefines} "${_value}")
endif()
endforeach()
diff --git a/Modules/CMakeFindDependencyMacro.cmake b/Modules/CMakeFindDependencyMacro.cmake
index 6a89fff..de1a332 100644
--- a/Modules/CMakeFindDependencyMacro.cmake
+++ b/Modules/CMakeFindDependencyMacro.cmake
@@ -14,7 +14,7 @@ CMakeFindDependencyMacro
It is designed to be used in a
:ref:`Package Configuration File <Config File Packages>`
- (``<package>Config.cmake``). ``find_dependency`` forwards the correct
+ (``<PackageName>Config.cmake``). ``find_dependency`` forwards the correct
parameters for ``QUIET`` and ``REQUIRED`` which were passed to
the original :command:`find_package` call. Any additional arguments
specified are forwarded to :command:`find_package`.
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index 790d408..d5301d7 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -27,10 +27,10 @@
# )
#
# ``configure_package_config_file()`` should be used instead of the plain
-# :command:`configure_file()` command when creating the ``<Name>Config.cmake``
-# or ``<Name>-config.cmake`` file for installing a project or library. It helps
-# making the resulting package relocatable by avoiding hardcoded paths in the
-# installed ``Config.cmake`` file.
+# :command:`configure_file()` command when creating the ``<PackageName>Config.cmake``
+# or ``<PackageName>-config.cmake`` file for installing a project or library.
+# It helps making the resulting package relocatable by avoiding hardcoded paths
+# in the installed ``Config.cmake`` file.
#
# In a ``FooConfig.cmake`` file there may be code like this to make the install
# destinations know to the using project:
@@ -101,7 +101,7 @@
# When using the ``NO_SET_AND_CHECK_MACRO``, this macro is not generated
# into the ``FooConfig.cmake`` file.
#
-# ``check_required_components(<package_name>)`` should be called at the end of
+# ``check_required_components(<PackageName>)`` should be called at the end of
# the ``FooConfig.cmake`` file. This macro checks whether all requested,
# non-optional components have been found, and if this is not the case, sets
# the ``Foo_FOUND`` variable to ``FALSE``, so that the package is considered to
@@ -127,7 +127,7 @@
# COMPATIBILITY <AnyNewerVersion|SameMajorVersion|SameMinorVersion|ExactVersion> )
#
#
-# Writes a file for use as ``<package>ConfigVersion.cmake`` file to
+# Writes a file for use as ``<PackageName>ConfigVersion.cmake`` file to
# ``<filename>``. See the documentation of :command:`find_package()` for
# details on this.
#
diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake
index 935f92d..30659eb 100644
--- a/Modules/CMakeParseImplicitLinkInfo.cmake
+++ b/Modules/CMakeParseImplicitLinkInfo.cmake
@@ -1,6 +1,9 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
+cmake_policy(PUSH)
+cmake_policy(SET CMP0053 NEW)
+cmake_policy(SET CMP0054 NEW)
# Function parse implicit linker options.
# This is used internally by CMake and should not be included by user
@@ -185,3 +188,5 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
set(${fwk_var} "${implicit_fwks}" PARENT_SCOPE)
set(${log_var} "${log}" PARENT_SCOPE)
endfunction()
+
+cmake_policy(POP)
diff --git a/Modules/CPackArchive.cmake b/Modules/CPackArchive.cmake
deleted file mode 100644
index 741fb1f..0000000
--- a/Modules/CPackArchive.cmake
+++ /dev/null
@@ -1,39 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-#.rst:
-# CPackArchive
-# ------------
-#
-# Archive CPack generator that supports packaging of sources and binaries in
-# different formats:
-#
-# - 7Z - 7zip - (.7z)
-# - TBZ2 (.tar.bz2)
-# - TGZ (.tar.gz)
-# - TXZ (.tar.xz)
-# - TZ (.tar.Z)
-# - ZIP (.zip)
-#
-# Variables specific to CPack Archive generator
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# .. variable:: CPACK_ARCHIVE_FILE_NAME
-# CPACK_ARCHIVE_<component>_FILE_NAME
-#
-# Package file name without extension which is added automatically depending
-# on the archive format.
-#
-# * Mandatory : YES
-# * Default : ``<CPACK_PACKAGE_FILE_NAME>[-<component>].<extension>`` with
-# spaces replaced by '-'
-#
-# .. variable:: CPACK_ARCHIVE_COMPONENT_INSTALL
-#
-# Enable component packaging for CPackArchive
-#
-# * Mandatory : NO
-# * Default : OFF
-#
-# If enabled (ON) multiple packages are generated. By default a single package
-# containing files of all components is generated.
diff --git a/Modules/CPackBundle.cmake b/Modules/CPackBundle.cmake
deleted file mode 100644
index 8f37ef8..0000000
--- a/Modules/CPackBundle.cmake
+++ /dev/null
@@ -1,70 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-#.rst:
-# CPackBundle
-# -----------
-#
-# CPack Bundle generator (Mac OS X) specific options
-#
-# Variables specific to CPack Bundle generator
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# Installers built on Mac OS X using the Bundle generator use the
-# aforementioned DragNDrop (CPACK_DMG_xxx) variables, plus the following
-# Bundle-specific parameters (CPACK_BUNDLE_xxx).
-#
-# .. variable:: CPACK_BUNDLE_NAME
-#
-# The name of the generated bundle. This appears in the OSX finder as the
-# bundle name. Required.
-#
-# .. variable:: CPACK_BUNDLE_PLIST
-#
-# Path to an OSX plist file that will be used for the generated bundle. This
-# assumes that the caller has generated or specified their own Info.plist
-# file. Required.
-#
-# .. variable:: CPACK_BUNDLE_ICON
-#
-# Path to an OSX icon file that will be used as the icon for the generated
-# bundle. This is the icon that appears in the OSX finder for the bundle, and
-# in the OSX dock when the bundle is opened. Required.
-#
-# .. variable:: CPACK_BUNDLE_STARTUP_COMMAND
-#
-# Path to a startup script. This is a path to an executable or script that
-# will be run whenever an end-user double-clicks the generated bundle in the
-# OSX Finder. Optional.
-#
-# .. variable:: CPACK_BUNDLE_APPLE_CERT_APP
-#
-# The name of your Apple supplied code signing certificate for the application.
-# The name usually takes the form "Developer ID Application: [Name]" or
-# "3rd Party Mac Developer Application: [Name]". If this variable is not set
-# the application will not be signed.
-#
-# .. variable:: CPACK_BUNDLE_APPLE_ENTITLEMENTS
-#
-# The name of the plist file that contains your apple entitlements for sandboxing
-# your application. This file is required for submission to the Mac App Store.
-#
-# .. variable:: CPACK_BUNDLE_APPLE_CODESIGN_FILES
-#
-# A list of additional files that you wish to be signed. You do not need to
-# list the main application folder, or the main executable. You should
-# list any frameworks and plugins that are included in your app bundle.
-#
-# .. variable:: CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER
-#
-# Additional parameter that will passed to codesign.
-# Default value: "--deep -f"
-#
-# .. variable:: CPACK_COMMAND_CODESIGN
-#
-# Path to the codesign(1) command used to sign applications with an
-# Apple cert. This variable can be used to override the automatically
-# detected command (or specify its location if the auto-detection fails
-# to find it.)
-
-#Bundle Generator specific code should be put here
diff --git a/Modules/CPackCygwin.cmake b/Modules/CPackCygwin.cmake
deleted file mode 100644
index 6d203c3..0000000
--- a/Modules/CPackCygwin.cmake
+++ /dev/null
@@ -1,27 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-#.rst:
-# CPackCygwin
-# -----------
-#
-# Cygwin CPack generator (Cygwin).
-#
-# Variables specific to CPack Cygwin generator
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# The
-# following variable is specific to installers build on and/or for
-# Cygwin:
-#
-# .. variable:: CPACK_CYGWIN_PATCH_NUMBER
-#
-# The Cygwin patch number. FIXME: This documentation is incomplete.
-#
-# .. variable:: CPACK_CYGWIN_PATCH_FILE
-#
-# The Cygwin patch file. FIXME: This documentation is incomplete.
-#
-# .. variable:: CPACK_CYGWIN_BUILD_SCRIPT
-#
-# The Cygwin build script. FIXME: This documentation is incomplete.
diff --git a/Modules/CPackDMG.cmake b/Modules/CPackDMG.cmake
deleted file mode 100644
index bda600f..0000000
--- a/Modules/CPackDMG.cmake
+++ /dev/null
@@ -1,105 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-#.rst:
-# CPackDMG
-# --------
-#
-# DragNDrop CPack generator (Mac OS X).
-#
-# Variables specific to CPack DragNDrop generator
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# The following variables are specific to the DragNDrop installers built
-# on Mac OS X:
-#
-# .. variable:: CPACK_DMG_VOLUME_NAME
-#
-# The volume name of the generated disk image. Defaults to
-# CPACK_PACKAGE_FILE_NAME.
-#
-# .. variable:: CPACK_DMG_FORMAT
-#
-# The disk image format. Common values are UDRO (UDIF read-only), UDZO (UDIF
-# zlib-compressed) or UDBZ (UDIF bzip2-compressed). Refer to hdiutil(1) for
-# more information on other available formats. Defaults to UDZO.
-#
-# .. variable:: CPACK_DMG_DS_STORE
-#
-# Path to a custom DS_Store file. This .DS_Store file e.g. can be used to
-# specify the Finder window position/geometry and layout (such as hidden
-# toolbars, placement of the icons etc.). This file has to be generated by
-# the Finder (either manually or through AppleScript) using a normal folder
-# from which the .DS_Store file can then be extracted.
-#
-# .. variable:: CPACK_DMG_DS_STORE_SETUP_SCRIPT
-#
-# Path to a custom AppleScript file. This AppleScript is used to generate
-# a .DS_Store file which specifies the Finder window position/geometry and
-# layout (such as hidden toolbars, placement of the icons etc.).
-# By specifying a custom AppleScript there is no need to use
-# CPACK_DMG_DS_STORE, as the .DS_Store that is generated by the AppleScript
-# will be packaged.
-#
-# .. variable:: CPACK_DMG_BACKGROUND_IMAGE
-#
-# Path to an image file to be used as the background. This file will be
-# copied to .background/background.<ext>, where ext is the original image file
-# extension. The background image is installed into the image before
-# 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.
-# Setting this causes CPack to look for a ``<language>.menu.txt`` and
-# ``<language>.license.txt`` file for every language defined in
-# ``CPACK_DMG_SLA_LANGUAGES``. If both this variable and
-# ``CPACK_RESOURCE_FILE_LICENSE`` are set, CPack will only look for the menu
-# files and use the same license file for all languages.
-#
-# .. variable:: CPACK_DMG_SLA_LANGUAGES
-#
-# Languages for which a license agreement is provided when mounting the
-# generated DMG. A menu file consists of 9 lines of text. The first line is
-# is the name of the language itself, uppercase, in English (e.g. German).
-# The other lines are translations of the following strings:
-#
-# - Agree
-# - Disagree
-# - Print
-# - Save...
-# - You agree to the terms of the License Agreement when you click the
-# "Agree" button.
-# - Software License Agreement
-# - This text cannot be saved. The disk may be full or locked, or the file
-# may be locked.
-# - Unable to print. Make sure you have selected a printer.
-#
-# For every language in this list, CPack will try to find files
-# ``<language>.menu.txt`` and ``<language>.license.txt`` in the directory
-# specified by the :variable:`CPACK_DMG_SLA_DIR` variable.
-#
-# .. variable:: CPACK_COMMAND_HDIUTIL
-#
-# Path to the hdiutil(1) command used to operate on disk image files on Mac
-# OS X. This variable can be used to override the automatically detected
-# command (or specify its location if the auto-detection fails to find it.)
-#
-# .. variable:: CPACK_COMMAND_SETFILE
-#
-# Path to the SetFile(1) command used to set extended attributes on files and
-# directories on Mac OS X. This variable can be used to override the
-# automatically detected command (or specify its location if the
-# auto-detection fails to find it.)
-#
-# .. variable:: CPACK_COMMAND_REZ
-#
-# Path to the Rez(1) command used to compile resources on Mac OS X. This
-# variable can be used to override the automatically detected command (or
-# specify its location if the auto-detection fails to find it.)
diff --git a/Modules/CPackFreeBSD.cmake b/Modules/CPackFreeBSD.cmake
deleted file mode 100644
index b681d4f..0000000
--- a/Modules/CPackFreeBSD.cmake
+++ /dev/null
@@ -1,248 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-#[=======================================================================[.rst:
-CPackFreeBSD
-------------
-
-The built in (binary) CPack FreeBSD (pkg) generator (Unix only)
-
-Variables specific to CPack FreeBSD (pkg) generator
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-CPackFreeBSD may be used to create pkg(8) packages -- these may be used
-on FreeBSD, DragonflyBSD, NetBSD, OpenBSD, but also on Linux or OSX,
-depending on the installed package-management tools -- using :module:`CPack`.
-
-CPackFreeBSD is a :module:`CPack` generator and uses the ``CPACK_XXX``
-variables used by :module:`CPack`. It tries to re-use packaging information
-that may already be specified for Debian packages for the :module:`CPackDeb`
-generator. it also tries to re-use RPM packaging information when Debian
-does not specify.
-
-CPackFreeBSD generator should work on any host with libpkg installed. The
-packages it produces are specific to the host architecture and ABI.
-
-CPackFreeBSD sets package-metadata through :code:`CPACK_FREEBSD_XXX` variables.
-CPackFreeBSD, unlike CPackDeb, does not specially support componentized
-packages; a single package is created from all the software artifacts
-created through CMake.
-
-All of the variables can be set specifically for FreeBSD packaging in
-the CPackConfig file or in CMakeLists.txt, but most of them have defaults
-that use general settings (e.g. CMAKE_PROJECT_NAME) or Debian-specific
-variables when those make sense (e.g. the homepage of an upstream project
-is usually unchanged by the flavor of packaging). When there is no Debian
-information to fall back on, but the RPM packaging has it, fall back to
-the RPM information (e.g. package license).
-
-.. variable:: CPACK_FREEBSD_PACKAGE_NAME
-
- Sets the package name (in the package manifest, but also affects the
- output filename).
-
- * Mandatory: YES
- * Default:
-
- - :variable:`CPACK_PACKAGE_NAME` (this is always set by CPack itself,
- based on CMAKE_PROJECT_NAME).
-
-.. variable:: CPACK_FREEBSD_PACKAGE_COMMENT
-
- Sets the package comment. This is the short description displayed by
- pkg(8) in standard "pkg info" output.
-
- * Mandatory: YES
- * Default:
-
- - :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` (this is always set
- by CPack itself, if nothing else sets it explicitly).
- - :variable:`PROJECT_DESCRIPTION` (this can be set with the DESCRIPTION
- parameter for :command:`project`).
-
-.. variable:: CPACK_FREEBSD_PACKAGE_DESCRIPTION
-
- Sets the package description. This is the long description of the package,
- given by "pkg info" with a specific package as argument.
-
- * Mandatory: YES
- * Default:
-
- - :variable:`CPACK_DEBIAN_PACKAGE_DESCRIPTION` (this may be set already
- for Debian packaging, so we may as well re-use it).
-
-.. variable:: CPACK_FREEBSD_PACKAGE_WWW
-
- The URL of the web site for this package, preferably (when applicable) the
- site from which the original source can be obtained and any additional
- upstream documentation or information may be found.
-
- * Mandatory: YES
- * Default:
-
- - :variable:`CMAKE_PROJECT_HOMEPAGE_URL`, or if that is not set,
- :variable:`CPACK_DEBIAN_PACKAGE_HOMEPAGE` (this may be set already
- for Debian packaging, so we may as well re-use it).
-
-.. variable:: CPACK_FREEBSD_PACKAGE_LICENSE
-
- The license, or licenses, which apply to this software package. This must
- be one or more license-identifiers that pkg recognizes as acceptable license
- identifiers (e.g. "GPLv2").
-
- * Mandatory: YES
- * Default:
-
- - :variable:`CPACK_RPM_PACKAGE_LICENSE`
-
-.. variable:: CPACK_FREEBSD_PACKAGE_LICENSE_LOGIC
-
- This variable is only of importance if there is more than one license.
- The default is "single", which is only applicable to a single license.
- Other acceptable values are determined by pkg -- those are "dual" or "multi" --
- meaning choice (OR) or simultaneous (AND) application of the licenses.
-
- * Mandatory: NO
- * Default: single
-
-.. variable:: CPACK_FREEBSD_PACKAGE_MAINTAINER
-
- The FreeBSD maintainer (e.g. kde@freebsd.org) of this package.
-
- * Mandatory: YES
- * Default: none
-
-.. variable:: CPACK_FREEBSD_PACKAGE_ORIGIN
-
- The origin (ports label) of this package; for packages built by CPack
- outside of the ports system this is of less importance. The default
- puts the package somewhere under misc/, as a stopgap.
-
- * Mandatory: YES
- * Default: misc/<package name>
-
-.. variable:: CPACK_FREEBSD_PACKAGE_CATEGORIES
-
- The ports categories where this package lives (if it were to be built
- from ports). If none is set a single category is determined based on
- the package origin.
-
- * Mandatory: YES
- * Default: derived from ORIGIN
-
-.. variable:: CPACK_FREEBSD_PACKAGE_DEPS
-
- A list of package origins that should be added as package dependencies.
- These are in the form <category>/<packagename>, e.g. x11/libkonq.
- No version information needs to be provided (this is not included
- in the manifest).
-
- * Mandatory: NO
- * Default: empty
-#]=======================================================================]
-
-
-
-if(CMAKE_BINARY_DIR)
- message(FATAL_ERROR "CPackFreeBSD.cmake may only be used by CPack internally.")
-endif()
-
-if(NOT UNIX)
- message(FATAL_ERROR "CPackFreeBSD.cmake may only be used under UNIX.")
-endif()
-
-
-###
-#
-# These bits are copied from the Debian packaging file; slightly modified.
-# They are used for filling in FreeBSD-packaging variables that can take
-# on values from elsewhere -- e.g. the package description may as well be
-# copied from Debian.
-#
-function(_cpack_freebsd_fallback_var OUTPUT_VAR_NAME)
- set(FALLBACK_VAR_NAMES ${ARGN})
-
- set(VALUE "${${OUTPUT_VAR_NAME}}")
- if(VALUE)
- return()
- endif()
-
- foreach(variable_name IN LISTS FALLBACK_VAR_NAMES)
- if(${variable_name})
- set(${OUTPUT_VAR_NAME} "${${variable_name}}" PARENT_SCOPE)
- set(VALUE "${${variable_name}}")
- break()
- endif()
- endforeach()
- if(NOT VALUE)
- message(WARNING "Variable ${OUTPUT_VAR_NAME} could not be given a fallback value from any variable ${FALLBACK_VAR_NAMES}.")
- endif()
-endfunction()
-
-function(check_required_var VAR_NAME)
- if(NOT ${VAR_NAME})
- message(FATAL_ERROR "Variable ${VAR_NAME} is not set.")
- endif()
-endfunction()
-
-set(_cpack_freebsd_fallback_origin "misc/bogus")
-
-_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_NAME"
- "CPACK_PACKAGE_NAME"
- "CMAKE_PROJECT_NAME"
- )
-
-set(_cpack_freebsd_fallback_www "http://example.com/?pkg=${CPACK_FREEBSD_PACKAGE_NAME}")
-
-_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_COMMENT"
- "CPACK_PACKAGE_DESCRIPTION_SUMMARY"
- )
-
-# TODO: maybe read the PACKAGE_DESCRIPTION file for the longer
-# FreeBSD pkg-descr?
-_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_DESCRIPTION"
- "CPACK_DEBIAN_PACKAGE_DESCRIPTION"
- "CPACK_PACKAGE_DESCRIPTION_SUMMARY"
- "PACKAGE_DESCRIPTION"
- )
-
-# There's really only one homepage for a project, so
-# re-use the Debian setting if it's there.
-_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_WWW"
- "CMAKE_PROJECT_HOMEPAGE_URL"
- "CPACK_DEBIAN_PACKAGE_HOMEPAGE"
- "_cpack_freebsd_fallback_www"
- )
-
-_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_VERSION"
- "CMAKE_PROJECT_VERSION"
- "${CMAKE_PROJECT_NAME}_VERSION"
- "PROJECT_VERSION"
- "CPACK_PACKAGE_VERSION"
- "CPACK_PACKAGE_VERSION"
- )
-
-_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_MAINTAINER"
- "CPACK_PACKAGE_CONTACT"
- )
-
-_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_LICENSE"
- "CPACK_RPM_PACKAGE_LICENSE"
- )
-
-_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_ORIGIN"
- "_cpack_freebsd_fallback_origin"
- )
-
-if(NOT CPACK_FREEBSD_PACKAGE_CATEGORIES)
- string(REGEX REPLACE "/.*" "" CPACK_FREEBSD_PACKAGE_CATEGORIES ${CPACK_FREEBSD_PACKAGE_ORIGIN})
-endif()
-
-check_required_var("CPACK_FREEBSD_PACKAGE_NAME")
-check_required_var("CPACK_FREEBSD_PACKAGE_ORIGIN")
-check_required_var("CPACK_FREEBSD_PACKAGE_VERSION")
-check_required_var("CPACK_FREEBSD_PACKAGE_MAINTAINER")
-check_required_var("CPACK_FREEBSD_PACKAGE_COMMENT")
-check_required_var("CPACK_FREEBSD_PACKAGE_DESCRIPTION")
-check_required_var("CPACK_FREEBSD_PACKAGE_WWW")
-check_required_var("CPACK_FREEBSD_PACKAGE_LICENSE")
diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake
index 9d733dc..141e842 100644
--- a/Modules/CPackIFW.cmake
+++ b/Modules/CPackIFW.cmake
@@ -1,677 +1,331 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CPackIFW
-# --------
-#
-# .. _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_).
-#
-# The module also defines several commands to control the behavior of the
-# CPack ``IFW`` generator.
-#
-#
-# Overview
-# ^^^^^^^^
-#
-# CPack ``IFW`` generator helps you to create online and offline
-# binary cross-platform installers with a graphical user interface.
-#
-# CPack IFW generator prepares project installation and generates configuration
-# and meta information for QtIFW_ tools.
-#
-# The QtIFW_ provides a set of tools and utilities to create
-# installers for the supported desktop Qt platforms: Linux, Microsoft Windows,
-# and Mac OS X.
-#
-# You should also install QtIFW_ to use CPack ``IFW`` generator.
-#
-# Hints
-# ^^^^^
-#
-# Generally, the CPack ``IFW`` generator automatically finds QtIFW_ tools,
-# but if you don't use a default path for installation of the QtIFW_ tools,
-# the path may be specified in either a CMake or an environment variable:
-#
-# .. variable:: CPACK_IFW_ROOT
-#
-# An CMake variable which specifies the location of the QtIFW_ tool suite.
-#
-# The variable will be cached in the ``CPackConfig.cmake`` file and used at
-# CPack runtime.
-#
-# .. variable:: QTIFWDIR
-#
-# An environment variable which specifies the location of the QtIFW_ tool
-# suite.
-#
-# .. note::
-# The specified path should not contain "bin" at the end
-# (for example: "D:\\DevTools\\QtIFW2.0.5").
-#
-# The :variable:`CPACK_IFW_ROOT` variable has a higher priority and overrides
-# the value of the :variable:`QTIFWDIR` variable.
-#
-# Internationalization
-# ^^^^^^^^^^^^^^^^^^^^
-#
-# Some variables and command arguments support internationalization via
-# CMake script. This is an optional feature.
-#
-# Installers created by QtIFW_ tools have built-in support for
-# internationalization and many phrases are localized to many languages,
-# but this does not apply to the description of the your components and groups
-# that will be distributed.
-#
-# Localization of the description of your components and groups is useful for
-# users of your installers.
-#
-# A localized variable or argument can contain a single default value, and a
-# set of pairs the name of the locale and the localized value.
-#
-# For example:
-#
-# .. code-block:: cmake
-#
-# set(LOCALIZABLE_VARIABLE "Default value"
-# en "English value"
-# en_US "American value"
-# en_GB "Great Britain value"
-# )
-#
-# Variables
-# ^^^^^^^^^
-#
-# You can use the following variables to change behavior of CPack ``IFW``
-# generator.
-#
-# Debug
-# """"""
-#
-# .. variable:: CPACK_IFW_VERBOSE
-#
-# Set to ``ON`` to enable addition debug output.
-# By default is ``OFF``.
-#
-# Package
-# """""""
-#
-# .. variable:: CPACK_IFW_PACKAGE_TITLE
-#
-# Name of the installer as displayed on the title bar.
-# By default used :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`.
-#
-# .. variable:: CPACK_IFW_PACKAGE_PUBLISHER
-#
-# Publisher of the software (as shown in the Windows Control Panel).
-# By default used :variable:`CPACK_PACKAGE_VENDOR`.
-#
-# .. variable:: CPACK_IFW_PRODUCT_URL
-#
-# URL to a page that contains product information on your web site.
-#
-# .. variable:: CPACK_IFW_PACKAGE_ICON
-#
-# Filename for a custom installer icon. The actual file is '.icns' (Mac OS X),
-# '.ico' (Windows). No functionality on Unix.
-#
-# .. variable:: CPACK_IFW_PACKAGE_WINDOW_ICON
-#
-# Filename for a custom window icon in PNG format for the Installer
-# application.
-#
-# .. variable:: CPACK_IFW_PACKAGE_LOGO
-#
-# Filename for a logo is used as QWizard::LogoPixmap.
-#
-# .. variable:: CPACK_IFW_PACKAGE_WATERMARK
-#
-# Filename for a watermark is used as QWizard::WatermarkPixmap.
-#
-# .. variable:: CPACK_IFW_PACKAGE_BANNER
-#
-# Filename for a banner is used as QWizard::BannerPixmap.
-#
-# .. variable:: CPACK_IFW_PACKAGE_BACKGROUND
-#
-# Filename for an image used as QWizard::BackgroundPixmap (only used by MacStyle).
-#
-# .. variable:: CPACK_IFW_PACKAGE_WIZARD_STYLE
-#
-# Wizard style to be used ("Modern", "Mac", "Aero" or "Classic").
-#
-# .. variable:: CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH
-#
-# Default width of the wizard in pixels. Setting a banner image will override this.
-#
-# .. variable:: CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT
-#
-# Default height of the wizard in pixels. Setting a watermark image will override this.
-#
-# .. variable:: CPACK_IFW_PACKAGE_TITLE_COLOR
-#
-# Color of the titles and subtitles (takes an HTML color code, such as "#88FF33").
-#
-# .. variable:: CPACK_IFW_PACKAGE_START_MENU_DIRECTORY
-#
-# Name of the default program group for the product in the Windows Start menu.
-#
-# By default used :variable:`CPACK_IFW_PACKAGE_NAME`.
-#
-# .. variable:: CPACK_IFW_TARGET_DIRECTORY
-#
-# Default target directory for installation.
-# By default used
-# "@ApplicationsDir@/:variable:`CPACK_PACKAGE_INSTALL_DIRECTORY`"
-#
-# You can use predefined variables.
-#
-# .. variable:: CPACK_IFW_ADMIN_TARGET_DIRECTORY
-#
-# Default target directory for installation with administrator rights.
-#
-# You can use predefined variables.
-#
-# .. variable:: CPACK_IFW_PACKAGE_GROUP
-#
-# The group, which will be used to configure the root package
-#
-# .. variable:: CPACK_IFW_PACKAGE_NAME
-#
-# The root package name, which will be used if configuration group is not
-# specified
-#
-# .. variable:: CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME
-#
-# Filename of the generated maintenance tool.
-# The platform-specific executable file extension is appended.
-#
-# By default used QtIFW_ defaults (``maintenancetool``).
-#
-# .. variable:: CPACK_IFW_PACKAGE_REMOVE_TARGET_DIR
-#
-# Set to ``OFF`` if the target directory should not be deleted when uninstalling.
-#
-# Is ``ON`` by default
-#
-# .. variable:: CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_INI_FILE
-#
-# Filename for the configuration of the generated maintenance tool.
-#
-# By default used QtIFW_ defaults (``maintenancetool.ini``).
-#
-# .. variable:: CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS
-#
-# Set to ``ON`` if the installation path can contain non-ASCII characters.
-#
-# Is ``ON`` for QtIFW_ less 2.0 tools.
-#
-# .. variable:: CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH
-#
-# Set to ``OFF`` if the installation path cannot contain space characters.
-#
-# Is ``ON`` for QtIFW_ less 2.0 tools.
-#
-# .. variable:: CPACK_IFW_PACKAGE_CONTROL_SCRIPT
-#
-# Filename for a custom installer control script.
-#
-# .. variable:: CPACK_IFW_PACKAGE_RESOURCES
-#
-# List of additional resources ('.qrc' files) to include in the installer
-# binary.
-#
-# You can use :command:`cpack_ifw_add_package_resources` command to resolve
-# relative paths.
-#
-# .. variable:: CPACK_IFW_PACKAGE_FILE_EXTENSION
-#
-# The target binary extension.
-#
-# On Linux, the name of the target binary is automatically extended with
-# '.run', if you do not specify the extension.
-#
-# On Windows, the target is created as an application with the extension
-# '.exe', which is automatically added, if not supplied.
-#
-# On Mac, the target is created as an DMG disk image with the extension
-# '.dmg', which is automatically added, if not supplied.
-#
-# .. variable:: CPACK_IFW_REPOSITORIES_ALL
-#
-# The list of remote repositories.
-#
-# 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
-#
-# If this is ``ON`` all components will be downloaded.
-# By default is ``OFF`` or used value
-# from ``CPACK_DOWNLOAD_ALL`` if set
-#
-# Components
-# """"""""""
-#
-# .. variable:: CPACK_IFW_RESOLVE_DUPLICATE_NAMES
-#
-# Resolve duplicate names when installing components with groups.
-#
-# .. variable:: CPACK_IFW_PACKAGES_DIRECTORIES
-#
-# Additional prepared packages dirs that will be used to resolve
-# dependent components.
-#
-# .. variable:: CPACK_IFW_REPOSITORIES_DIRECTORIES
-#
-# Additional prepared repository dirs that will be used to resolve and
-# repack dependent components. This feature available only
-# since QtIFW_ 3.1.
-#
-# Tools
-# """""
-#
-# .. variable:: CPACK_IFW_FRAMEWORK_VERSION
-#
-# The version of used QtIFW_ tools.
-#
-# .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE
-#
-# The path to "binarycreator" command line client.
-#
-# This variable is cached and may be configured if needed.
-#
-# .. variable:: CPACK_IFW_REPOGEN_EXECUTABLE
-#
-# The path to "repogen" command line client.
-#
-# This variable is cached and may be configured if needed.
-#
-# .. variable:: CPACK_IFW_INSTALLERBASE_EXECUTABLE
-#
-# The path to "installerbase" installer executable base.
-#
-# This variable is cached and may be configured if needed.
-#
-# .. variable:: CPACK_IFW_DEVTOOL_EXECUTABLE
-#
-# The path to "devtool" command line client.
-#
-# This variable is cached and may be configured if needed.
-#
-# Commands
-# ^^^^^^^^^
-#
-# The module defines the following commands:
-#
-# .. command:: cpack_ifw_configure_component
-#
-# Sets the arguments specific to the CPack IFW generator.
-#
-# ::
-#
-# cpack_ifw_configure_component(<compname> [COMMON] [ESSENTIAL] [VIRTUAL]
-# [FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS]
-# [NAME <name>]
-# [DISPLAY_NAME <display_name>] # Note: Internationalization supported
-# [DESCRIPTION <description>] # Note: Internationalization supported
-# [UPDATE_TEXT <update_text>]
-# [VERSION <version>]
-# [RELEASE_DATE <release_date>]
-# [SCRIPT <script>]
-# [PRIORITY|SORTING_PRIORITY <sorting_priority>] # Note: PRIORITY is deprecated
-# [DEPENDS|DEPENDENCIES <com_id> ...]
-# [AUTO_DEPEND_ON <comp_id> ...]
-# [LICENSES <display_name> <file_path> ...]
-# [DEFAULT <value>]
-# [USER_INTERFACES <file_path> <file_path> ...]
-# [TRANSLATIONS <file_path> <file_path> ...]
-# [REPLACES <comp_id> ...]
-# [CHECKABLE <value>])
-#
-# 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.
-#
-# ``VIRTUAL``
-# if set, then the component will be hidden from the installer.
-# It is a equivalent of the ``HIDDEN`` option from the
-# :command:`cpack_add_component` command.
-#
-# ``FORCED_INSTALLATION``
-# if set, then the component must always be installed.
-# It is a equivalent of the ``REQUARED`` option from the
-# :command:`cpack_add_component` command.
-#
-# ``REQUIRES_ADMIN_RIGHTS``
-# set it if the component needs to be installed with elevated permissions.
-#
-# ``NAME``
-# is used to create domain-like identification for this component.
-# By default used origin component name.
-#
-# ``DISPLAY_NAME``
-# set to rewrite original name configured by
-# :command:`cpack_add_component` command.
-#
-# ``DESCRIPTION``
-# set to rewrite original description configured by
-# :command:`cpack_add_component` command.
-#
-# ``UPDATE_TEXT``
-# will be added to the component description if this is an update to
-# the component.
-#
-# ``VERSION``
-# is version of component.
-# By default used :variable:`CPACK_PACKAGE_VERSION`.
-#
-# ``RELEASE_DATE``
-# keep empty to auto generate.
-#
-# ``SCRIPT``
-# is a relative or absolute path to operations script
-# for this component.
-#
-# ``PRIORITY`` | ``SORTING_PRIORITY``
-# is priority of the component in the tree.
-# The ``PRIORITY`` option is deprecated and will be removed in a future
-# version of CMake. Please use ``SORTING_PRIORITY`` option instead.
-#
-# ``DEPENDS`` | ``DEPENDENCIES``
-# list of dependency component or component group identifiers in
-# QtIFW_ style.
-#
-# ``AUTO_DEPEND_ON``
-# list of identifiers of component or component group in QtIFW_ style
-# that this component has an automatic dependency on.
-#
-# ``LICENSES``
-# pair of <display_name> and <file_path> of license text for this
-# component. You can specify more then one license.
-#
-# ``DEFAULT``
-# Possible values are: TRUE, FALSE, and SCRIPT.
-# Set to FALSE to disable the component in the installer or to SCRIPT
-# to resolved during runtime (don't forget add the file of the script
-# as a value of the ``SCRIPT`` option).
-#
-# ``USER_INTERFACES``
-# is a list of <file_path> ('.ui' files) representing pages to load.
-#
-# ``TRANSLATIONS``
-# is a list of <file_path> ('.qm' files) representing translations to load.
-#
-# ``REPLACES``
-# list of identifiers of component or component group to replace.
-#
-# ``CHECKABLE``
-# Possible values are: TRUE, FALSE.
-# Set to FALSE if you want to hide the checkbox for an item.
-# This is useful when only a few subcomponents should be selected
-# instead of all.
-#
-#
-# .. command:: cpack_ifw_configure_component_group
-#
-# Sets the arguments specific to the CPack IFW generator.
-#
-# ::
-#
-# cpack_ifw_configure_component_group(<groupname> [VIRTUAL]
-# [FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS]
-# [NAME <name>]
-# [DISPLAY_NAME <display_name>] # Note: Internationalization supported
-# [DESCRIPTION <description>] # Note: Internationalization supported
-# [UPDATE_TEXT <update_text>]
-# [VERSION <version>]
-# [RELEASE_DATE <release_date>]
-# [SCRIPT <script>]
-# [PRIORITY|SORTING_PRIORITY <sorting_priority>] # Note: PRIORITY is deprecated
-# [DEPENDS|DEPENDENCIES <com_id> ...]
-# [AUTO_DEPEND_ON <comp_id> ...]
-# [LICENSES <display_name> <file_path> ...]
-# [DEFAULT <value>]
-# [USER_INTERFACES <file_path> <file_path> ...]
-# [TRANSLATIONS <file_path> <file_path> ...]
-# [REPLACES <comp_id> ...]
-# [CHECKABLE <value>])
-#
-# This command should be called after :command:`cpack_add_component_group`
-# command.
-#
-# ``VIRTUAL``
-# if set, then the group will be hidden from the installer.
-# Note that setting this on a root component does not work.
-#
-# ``FORCED_INSTALLATION``
-# if set, then the group must always be installed.
-#
-# ``REQUIRES_ADMIN_RIGHTS``
-# set it if the component group needs to be installed with elevated
-# permissions.
-#
-# ``NAME``
-# is used to create domain-like identification for this component group.
-# By default used origin component group name.
-#
-# ``DISPLAY_NAME``
-# set to rewrite original name configured by
-# :command:`cpack_add_component_group` command.
-#
-# ``DESCRIPTION``
-# set to rewrite original description configured by
-# :command:`cpack_add_component_group` command.
-#
-# ``UPDATE_TEXT``
-# will be added to the component group description if this is an update to
-# the component group.
-#
-# ``VERSION``
-# is version of component group.
-# By default used :variable:`CPACK_PACKAGE_VERSION`.
-#
-# ``RELEASE_DATE``
-# keep empty to auto generate.
-#
-# ``SCRIPT``
-# is a relative or absolute path to operations script
-# for this component group.
-#
-# ``PRIORITY`` | ``SORTING_PRIORITY``
-# is priority of the component group in the tree.
-# The ``PRIORITY`` option is deprecated and will be removed in a future
-# version of CMake. Please use ``SORTING_PRIORITY`` option instead.
-#
-# ``DEPENDS`` | ``DEPENDENCIES``
-# list of dependency component or component group identifiers in
-# QtIFW_ style.
-#
-# ``AUTO_DEPEND_ON``
-# list of identifiers of component or component group in QtIFW_ style
-# that this component group has an automatic dependency on.
-#
-# ``LICENSES``
-# pair of <display_name> and <file_path> of license text for this
-# component group. You can specify more then one license.
-#
-# ``DEFAULT``
-# Possible values are: TRUE, FALSE, and SCRIPT.
-# Set to TRUE to preselect the group in the installer
-# (this takes effect only on groups that have no visible child components)
-# or to SCRIPT to resolved during runtime (don't forget add the file of
-# the script as a value of the ``SCRIPT`` option).
-#
-# ``USER_INTERFACES``
-# is a list of <file_path> ('.ui' files) representing pages to load.
-#
-# ``TRANSLATIONS``
-# is a list of <file_path> ('.qm' files) representing translations to load.
-#
-# ``REPLACES``
-# list of identifiers of component or component group to replace.
-#
-# ``CHECKABLE``
-# Possible values are: TRUE, FALSE.
-# Set to FALSE if you want to hide the checkbox for an item.
-# This is useful when only a few subcomponents should be selected
-# instead of all.
-#
-#
-# .. command:: cpack_ifw_add_repository
-#
-# Add QtIFW_ specific remote repository to binary installer.
-#
-# ::
-#
-# cpack_ifw_add_repository(<reponame> [DISABLED]
-# URL <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`.
-#
-# ``DISABLED``
-# if set, then the repository will be disabled by default.
-#
-# ``URL``
-# is points to a list of available components.
-#
-# ``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.
-#
-#
-# .. 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.
-#
-#
-# .. command:: cpack_ifw_add_package_resources
-#
-# Add additional resources in the installer binary.
-#
-# ::
-#
-# cpack_ifw_add_package_resources(<file_path> <file_path> ...)
-#
-# This command will also add the specified files
-# to a variable :variable:`CPACK_IFW_PACKAGE_RESOURCES`.
-#
-#
-# Example usage
-# ^^^^^^^^^^^^^
-#
-# .. code-block:: cmake
-#
-# set(CPACK_PACKAGE_NAME "MyPackage")
-# set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MyPackage Installation Example")
-# set(CPACK_PACKAGE_VERSION "1.0.0") # Version of installer
-#
-# include(CPack)
-# include(CPackIFW)
-#
-# cpack_add_component(myapp
-# DISPLAY_NAME "MyApp"
-# DESCRIPTION "My Application") # Default description
-# cpack_ifw_configure_component(myapp
-# DESCRIPTION ru_RU "Мое Приложение" # Localized description
-# VERSION "1.2.3" # Version of component
-# SCRIPT "operations.qs")
-# cpack_add_component(mybigplugin
-# DISPLAY_NAME "MyBigPlugin"
-# DESCRIPTION "My Big Downloadable Plugin"
-# DOWNLOADED)
-# cpack_ifw_add_repository(myrepo
-# URL "http://example.com/ifw/repo/myapp"
-# DISPLAY_NAME "My Application Repository")
-#
-#
-# Online installer
-# ^^^^^^^^^^^^^^^^
-#
-# By default CPack IFW generator makes offline installer. This means that all
-# components will be packaged into a binary file.
-#
-# To make a component downloaded, you must set the ``DOWNLOADED`` option in
-# :command:`cpack_add_component`.
-#
-# Then you would use the command :command:`cpack_configure_downloads`.
-# If you set ``ALL`` option all components will be downloaded.
-#
-# You also can use command :command:`cpack_ifw_add_repository` and
-# variable :variable:`CPACK_IFW_DOWNLOAD_ALL` for more specific configuration.
-#
-# CPack IFW generator creates "repository" dir in current binary dir. You
-# would copy content of this dir to specified ``site`` (``url``).
-#
-# See Also
-# ^^^^^^^^
-#
-# Qt Installer Framework Manual:
-#
-# * Index page:
-# http://doc.qt.io/qtinstallerframework/index.html
-#
-# * Component Scripting:
-# http://doc.qt.io/qtinstallerframework/scripting.html
-#
-# * 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
-#
+#[=======================================================================[.rst:
+CPackIFW
+--------
+
+The documentation for the CPack IFW generator has moved here: :cpack_gen:`CPack IFW Generator`
+
+.. _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_).
+
+The module also defines several commands to control the behavior of the
+CPack ``IFW`` generator.
+
+Commands
+^^^^^^^^
+
+The module defines the following commands:
+
+.. command:: cpack_ifw_configure_component
+
+ Sets the arguments specific to the CPack IFW generator.
+
+ ::
+
+ cpack_ifw_configure_component(<compname> [COMMON] [ESSENTIAL] [VIRTUAL]
+ [FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS]
+ [NAME <name>]
+ [DISPLAY_NAME <display_name>] # Note: Internationalization supported
+ [DESCRIPTION <description>] # Note: Internationalization supported
+ [UPDATE_TEXT <update_text>]
+ [VERSION <version>]
+ [RELEASE_DATE <release_date>]
+ [SCRIPT <script>]
+ [PRIORITY|SORTING_PRIORITY <sorting_priority>] # Note: PRIORITY is deprecated
+ [DEPENDS|DEPENDENCIES <com_id> ...]
+ [AUTO_DEPEND_ON <comp_id> ...]
+ [LICENSES <display_name> <file_path> ...]
+ [DEFAULT <value>]
+ [USER_INTERFACES <file_path> <file_path> ...]
+ [TRANSLATIONS <file_path> <file_path> ...]
+ [REPLACES <comp_id> ...]
+ [CHECKABLE <value>])
+
+ 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.
+
+ ``VIRTUAL``
+ if set, then the component will be hidden from the installer.
+ It is a equivalent of the ``HIDDEN`` option from the
+ :command:`cpack_add_component` command.
+
+ ``FORCED_INSTALLATION``
+ if set, then the component must always be installed.
+ It is a equivalent of the ``REQUARED`` option from the
+ :command:`cpack_add_component` command.
+
+ ``REQUIRES_ADMIN_RIGHTS``
+ set it if the component needs to be installed with elevated permissions.
+
+ ``NAME``
+ is used to create domain-like identification for this component.
+ By default used origin component name.
+
+ ``DISPLAY_NAME``
+ set to rewrite original name configured by
+ :command:`cpack_add_component` command.
+
+ ``DESCRIPTION``
+ set to rewrite original description configured by
+ :command:`cpack_add_component` command.
+
+ ``UPDATE_TEXT``
+ will be added to the component description if this is an update to
+ the component.
+
+ ``VERSION``
+ is version of component.
+ By default used :variable:`CPACK_PACKAGE_VERSION`.
+
+ ``RELEASE_DATE``
+ keep empty to auto generate.
+
+ ``SCRIPT``
+ is a relative or absolute path to operations script
+ for this component.
+
+ ``PRIORITY`` | ``SORTING_PRIORITY``
+ is priority of the component in the tree.
+ The ``PRIORITY`` option is deprecated and will be removed in a future
+ version of CMake. Please use ``SORTING_PRIORITY`` option instead.
+
+ ``DEPENDS`` | ``DEPENDENCIES``
+ list of dependency component or component group identifiers in
+ QtIFW_ style.
+
+ ``AUTO_DEPEND_ON``
+ list of identifiers of component or component group in QtIFW_ style
+ that this component has an automatic dependency on.
+
+ ``LICENSES``
+ pair of <display_name> and <file_path> of license text for this
+ component. You can specify more then one license.
+
+ ``DEFAULT``
+ Possible values are: TRUE, FALSE, and SCRIPT.
+ Set to FALSE to disable the component in the installer or to SCRIPT
+ to resolved during runtime (don't forget add the file of the script
+ as a value of the ``SCRIPT`` option).
+
+ ``USER_INTERFACES``
+ is a list of <file_path> ('.ui' files) representing pages to load.
+
+ ``TRANSLATIONS``
+ is a list of <file_path> ('.qm' files) representing translations to load.
+
+ ``REPLACES``
+ list of identifiers of component or component group to replace.
+
+ ``CHECKABLE``
+ Possible values are: TRUE, FALSE.
+ Set to FALSE if you want to hide the checkbox for an item.
+ This is useful when only a few subcomponents should be selected
+ instead of all.
+
+
+.. command:: cpack_ifw_configure_component_group
+
+ Sets the arguments specific to the CPack IFW generator.
+
+ ::
+
+ cpack_ifw_configure_component_group(<groupname> [VIRTUAL]
+ [FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS]
+ [NAME <name>]
+ [DISPLAY_NAME <display_name>] # Note: Internationalization supported
+ [DESCRIPTION <description>] # Note: Internationalization supported
+ [UPDATE_TEXT <update_text>]
+ [VERSION <version>]
+ [RELEASE_DATE <release_date>]
+ [SCRIPT <script>]
+ [PRIORITY|SORTING_PRIORITY <sorting_priority>] # Note: PRIORITY is deprecated
+ [DEPENDS|DEPENDENCIES <com_id> ...]
+ [AUTO_DEPEND_ON <comp_id> ...]
+ [LICENSES <display_name> <file_path> ...]
+ [DEFAULT <value>]
+ [USER_INTERFACES <file_path> <file_path> ...]
+ [TRANSLATIONS <file_path> <file_path> ...]
+ [REPLACES <comp_id> ...]
+ [CHECKABLE <value>])
+
+ This command should be called after :command:`cpack_add_component_group`
+ command.
+
+ ``VIRTUAL``
+ if set, then the group will be hidden from the installer.
+ Note that setting this on a root component does not work.
+
+ ``FORCED_INSTALLATION``
+ if set, then the group must always be installed.
+
+ ``REQUIRES_ADMIN_RIGHTS``
+ set it if the component group needs to be installed with elevated
+ permissions.
+
+ ``NAME``
+ is used to create domain-like identification for this component group.
+ By default used origin component group name.
+
+ ``DISPLAY_NAME``
+ set to rewrite original name configured by
+ :command:`cpack_add_component_group` command.
+
+ ``DESCRIPTION``
+ set to rewrite original description configured by
+ :command:`cpack_add_component_group` command.
+
+ ``UPDATE_TEXT``
+ will be added to the component group description if this is an update to
+ the component group.
+
+ ``VERSION``
+ is version of component group.
+ By default used :variable:`CPACK_PACKAGE_VERSION`.
+
+ ``RELEASE_DATE``
+ keep empty to auto generate.
+
+ ``SCRIPT``
+ is a relative or absolute path to operations script
+ for this component group.
+
+ ``PRIORITY`` | ``SORTING_PRIORITY``
+ is priority of the component group in the tree.
+ The ``PRIORITY`` option is deprecated and will be removed in a future
+ version of CMake. Please use ``SORTING_PRIORITY`` option instead.
+
+ ``DEPENDS`` | ``DEPENDENCIES``
+ list of dependency component or component group identifiers in
+ QtIFW_ style.
+
+ ``AUTO_DEPEND_ON``
+ list of identifiers of component or component group in QtIFW_ style
+ that this component group has an automatic dependency on.
+
+ ``LICENSES``
+ pair of <display_name> and <file_path> of license text for this
+ component group. You can specify more then one license.
+
+ ``DEFAULT``
+ Possible values are: TRUE, FALSE, and SCRIPT.
+ Set to TRUE to preselect the group in the installer
+ (this takes effect only on groups that have no visible child components)
+ or to SCRIPT to resolved during runtime (don't forget add the file of
+ the script as a value of the ``SCRIPT`` option).
+
+ ``USER_INTERFACES``
+ is a list of <file_path> ('.ui' files) representing pages to load.
+
+ ``TRANSLATIONS``
+ is a list of <file_path> ('.qm' files) representing translations to load.
+
+ ``REPLACES``
+ list of identifiers of component or component group to replace.
+
+ ``CHECKABLE``
+ Possible values are: TRUE, FALSE.
+ Set to FALSE if you want to hide the checkbox for an item.
+ This is useful when only a few subcomponents should be selected
+ instead of all.
+
+
+.. command:: cpack_ifw_add_repository
+
+ Add QtIFW_ specific remote repository to binary installer.
+
+ ::
+
+ cpack_ifw_add_repository(<reponame> [DISABLED]
+ URL <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`.
+
+ ``DISABLED``
+ if set, then the repository will be disabled by default.
+
+ ``URL``
+ is points to a list of available components.
+
+ ``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.
+
+
+.. 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.
+
+
+.. command:: cpack_ifw_add_package_resources
+
+ Add additional resources in the installer binary.
+
+ ::
+
+ cpack_ifw_add_package_resources(<file_path> <file_path> ...)
+
+ This command will also add the specified files
+ to a variable :variable:`CPACK_IFW_PACKAGE_RESOURCES`.
+
+#]=======================================================================]
+
+# TODO:
+# All of the internal implementation CMake modules for other CPack generators
+# have been moved into the Internal/CPack directory. This one has not, because
+# it contains user-facing macros which would be lost if it were moved. At some
+# point, this module should be split into user-facing macros (which would live
+# in this module) and internal implementation details (which would live in
+# Internal/CPack/CPackIFW.cmake).
#=============================================================================
# Search Qt Installer Framework tools
diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake
deleted file mode 100644
index 5bc4395..0000000
--- a/Modules/CPackNSIS.cmake
+++ /dev/null
@@ -1,138 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-#.rst:
-# CPackNSIS
-# ---------
-#
-# CPack NSIS generator specific options
-#
-# Variables specific to CPack NSIS generator
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# The following variables are specific to the graphical installers built
-# on Windows using the Nullsoft Installation System.
-#
-# .. variable:: CPACK_NSIS_INSTALL_ROOT
-#
-# The default installation directory presented to the end user by the NSIS
-# installer is under this root dir. The full directory presented to the end
-# user is: ${CPACK_NSIS_INSTALL_ROOT}/${CPACK_PACKAGE_INSTALL_DIRECTORY}
-#
-# .. variable:: CPACK_NSIS_MUI_ICON
-#
-# An icon filename. The name of a ``*.ico`` file used as the main icon for the
-# generated install program.
-#
-# .. variable:: CPACK_NSIS_MUI_UNIICON
-#
-# An icon filename. The name of a ``*.ico`` file used as the main icon for the
-# generated uninstall program.
-#
-# .. variable:: CPACK_NSIS_INSTALLER_MUI_ICON_CODE
-#
-# undocumented.
-#
-# .. variable:: CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP
-#
-# The filename of a bitmap to use as the NSIS MUI_WELCOMEFINISHPAGE_BITMAP.
-#
-# .. variable:: CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP
-#
-# The filename of a bitmap to use as the NSIS MUI_UNWELCOMEFINISHPAGE_BITMAP.
-#
-# .. variable:: CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS
-#
-# Extra NSIS commands that will be added to the beginning of the install
-# Section, before your install tree is available on the target system.
-#
-# .. variable:: CPACK_NSIS_EXTRA_INSTALL_COMMANDS
-#
-# Extra NSIS commands that will be added to the end of the install Section,
-# after your install tree is available on the target system.
-#
-# .. variable:: CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS
-#
-# Extra NSIS commands that will be added to the uninstall Section, before
-# your install tree is removed from the target system.
-#
-# .. variable:: CPACK_NSIS_COMPRESSOR
-#
-# The arguments that will be passed to the NSIS SetCompressor command.
-#
-# .. variable:: CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL
-#
-# Ask about uninstalling previous versions first. If this is set to "ON",
-# then an installer will look for previous installed versions and if one is
-# found, ask the user whether to uninstall it before proceeding with the
-# install.
-#
-# .. variable:: CPACK_NSIS_MODIFY_PATH
-#
-# Modify PATH toggle. If this is set to "ON", then an extra page will appear
-# in the installer that will allow the user to choose whether the program
-# directory should be added to the system PATH variable.
-#
-# .. variable:: CPACK_NSIS_DISPLAY_NAME
-#
-# The display name string that appears in the Windows Add/Remove Program
-# control panel
-#
-# .. variable:: CPACK_NSIS_PACKAGE_NAME
-#
-# The title displayed at the top of the installer.
-#
-# .. variable:: CPACK_NSIS_INSTALLED_ICON_NAME
-#
-# A path to the executable that contains the installer icon.
-#
-# .. variable:: CPACK_NSIS_HELP_LINK
-#
-# URL to a web site providing assistance in installing your application.
-#
-# .. variable:: CPACK_NSIS_URL_INFO_ABOUT
-#
-# URL to a web site providing more information about your application.
-#
-# .. variable:: CPACK_NSIS_CONTACT
-#
-# Contact information for questions and comments about the installation
-# process.
-#
-# .. variable:: CPACK_NSIS_<compName>_INSTALL_DIRECTORY
-#
-# Custom install directory for the specified component <compName> instead
-# of $INSTDIR.
-#
-# .. variable:: CPACK_NSIS_CREATE_ICONS_EXTRA
-#
-# Additional NSIS commands for creating start menu shortcuts.
-#
-# .. variable:: CPACK_NSIS_DELETE_ICONS_EXTRA
-#
-# Additional NSIS commands to uninstall start menu shortcuts.
-#
-# .. variable:: CPACK_NSIS_EXECUTABLES_DIRECTORY
-#
-# Creating NSIS start menu links assumes that they are in 'bin' unless this
-# variable is set. For example, you would set this to 'exec' if your
-# executables are in an exec directory.
-#
-# .. variable:: CPACK_NSIS_MUI_FINISHPAGE_RUN
-#
-# Specify an executable to add an option to run on the finish page of the
-# NSIS installer.
-#
-# .. variable:: CPACK_NSIS_MENU_LINKS
-#
-# Specify links in [application] menu. This should contain a list of pair
-# "link" "link name". The link may be a URL or a path relative to
-# installation prefix. Like::
-#
-# set(CPACK_NSIS_MENU_LINKS
-# "doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cmake.html"
-# "CMake Help" "https://cmake.org" "CMake Web Site")
-#
-
-#FIXME we should put NSIS specific code here
-#FIXME but I'm not doing it because I'm not able to test it...
diff --git a/Modules/CPackPackageMaker.cmake b/Modules/CPackPackageMaker.cmake
deleted file mode 100644
index c2ca4c6..0000000
--- a/Modules/CPackPackageMaker.cmake
+++ /dev/null
@@ -1,27 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-#.rst:
-# CPackPackageMaker
-# -----------------
-#
-# PackageMaker CPack generator (Mac OS X).
-#
-# Variables specific to CPack PackageMaker generator
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# The following variable is specific to installers built on Mac
-# OS X using PackageMaker:
-#
-# .. variable:: CPACK_OSX_PACKAGE_VERSION
-#
-# The version of Mac OS X that the resulting PackageMaker archive should be
-# compatible with. Different versions of Mac OS X support different
-# features. For example, CPack can only build component-based installers for
-# Mac OS X 10.4 or newer, and can only build installers that download
-# component son-the-fly for Mac OS X 10.5 or newer. If left blank, this value
-# will be set to the minimum version of Mac OS X that supports the requested
-# features. Set this variable to some value (e.g., 10.4) only if you want to
-# guarantee that your installer will work on that version of Mac OS X, and
-# don't mind missing extra features available in the installer shipping with
-# later versions of Mac OS X.
diff --git a/Modules/CPackProductBuild.cmake b/Modules/CPackProductBuild.cmake
deleted file mode 100644
index ee78d8d..0000000
--- a/Modules/CPackProductBuild.cmake
+++ /dev/null
@@ -1,72 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-#.rst:
-# CPackProductBuild
-# -----------------
-#
-# productbuild CPack generator (Mac OS X).
-#
-# Variables specific to CPack productbuild generator
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# The following variable is specific to installers built on Mac
-# OS X using productbuild:
-#
-# .. variable:: CPACK_COMMAND_PRODUCTBUILD
-#
-# Path to the productbuild(1) command used to generate a product archive for
-# the OS X Installer or Mac App Store. This variable can be used to override
-# the automatically detected command (or specify its location if the
-# auto-detection fails to find it.)
-#
-# .. variable:: CPACK_PRODUCTBUILD_IDENTITY_NAME
-#
-# Adds a digital signature to the resulting package.
-#
-#
-# .. variable:: CPACK_PRODUCTBUILD_KEYCHAIN_PATH
-#
-# Specify a specific keychain to search for the signing identity.
-#
-#
-# .. variable:: CPACK_COMMAND_PKGBUILD
-#
-# Path to the pkgbuild(1) command used to generate an OS X component package
-# on OS X. This variable can be used to override the automatically detected
-# command (or specify its location if the auto-detection fails to find it.)
-#
-#
-# .. variable:: CPACK_PKGBUILD_IDENTITY_NAME
-#
-# Adds a digital signature to the resulting package.
-#
-#
-# .. variable:: CPACK_PKGBUILD_KEYCHAIN_PATH
-#
-# Specify a specific keychain to search for the signing identity.
-#
-#
-# .. variable:: CPACK_PREFLIGHT_<COMP>_SCRIPT
-#
-# Full path to a file that will be used as the ``preinstall`` script for the
-# named ``<COMP>`` component's package, where ``<COMP>`` is the uppercased
-# component name. No ``preinstall`` script is added if this variable is not
-# defined for a given component.
-#
-#
-# .. variable:: CPACK_POSTFLIGHT_<COMP>_SCRIPT
-#
-# Full path to a file that will be used as the ``postinstall`` script for the
-# named ``<COMP>`` component's package, where ``<COMP>`` is the uppercased
-# component name. No ``postinstall`` script is added if this variable is not
-# defined for a given component.
-#
-#
-# .. variable:: CPACK_PRODUCTBUILD_RESOURCES_DIR
-#
-# If specified the productbuild generator copies files from this directory
-# (including subdirectories) to the ``Resources`` directory. This is done
-# before the :variable:`CPACK_RESOURCE_FILE_WELCOME`,
-# :variable:`CPACK_RESOURCE_FILE_README`, and
-# :variable:`CPACK_RESOURCE_FILE_LICENSE` files are copied.
diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake
deleted file mode 100644
index 27737e5..0000000
--- a/Modules/CPackWIX.cmake
+++ /dev/null
@@ -1,307 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-#.rst:
-# CPackWIX
-# --------
-#
-# CPack WiX generator specific options
-#
-# Variables specific to CPack WiX generator
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# The following variables are specific to the installers built on
-# Windows using WiX.
-#
-# .. variable:: CPACK_WIX_UPGRADE_GUID
-#
-# Upgrade GUID (``Product/@UpgradeCode``)
-#
-# Will be automatically generated unless explicitly provided.
-#
-# It should be explicitly set to a constant generated globally unique
-# identifier (GUID) to allow your installers to replace existing
-# installations that use the same GUID.
-#
-# You may for example explicitly set this variable in your
-# CMakeLists.txt to the value that has been generated per default. You
-# should not use GUIDs that you did not generate yourself or which may
-# belong to other projects.
-#
-# A GUID shall have the following fixed length syntax::
-#
-# XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
-#
-# (each X represents an uppercase hexadecimal digit)
-#
-# .. variable:: CPACK_WIX_PRODUCT_GUID
-#
-# Product GUID (``Product/@Id``)
-#
-# Will be automatically generated unless explicitly provided.
-#
-# If explicitly provided this will set the Product Id of your installer.
-#
-# The installer will abort if it detects a pre-existing installation that
-# uses the same GUID.
-#
-# The GUID shall use the syntax described for CPACK_WIX_UPGRADE_GUID.
-#
-# .. variable:: CPACK_WIX_LICENSE_RTF
-#
-# RTF License File
-#
-# If CPACK_RESOURCE_FILE_LICENSE has an .rtf extension it is used as-is.
-#
-# If CPACK_RESOURCE_FILE_LICENSE has an .txt extension it is implicitly
-# converted to RTF by the WiX Generator.
-# The expected encoding of the .txt file is UTF-8.
-#
-# With CPACK_WIX_LICENSE_RTF you can override the license file used by the
-# WiX Generator in case CPACK_RESOURCE_FILE_LICENSE is in an unsupported
-# format or the .txt -> .rtf conversion does not work as expected.
-#
-# .. variable:: CPACK_WIX_PRODUCT_ICON
-#
-# The Icon shown next to the program name in Add/Remove programs.
-#
-# If set, this icon is used in place of the default icon.
-#
-# .. variable:: CPACK_WIX_UI_REF
-#
-# This variable allows you to override the Id of the ``<UIRef>`` element
-# in the WiX template.
-#
-# The default is ``WixUI_InstallDir`` in case no CPack components have
-# been defined and ``WixUI_FeatureTree`` otherwise.
-#
-# .. variable:: CPACK_WIX_UI_BANNER
-#
-# The bitmap will appear at the top of all installer pages other than the
-# welcome and completion dialogs.
-#
-# If set, this image will replace the default banner image.
-#
-# This image must be 493 by 58 pixels.
-#
-# .. variable:: CPACK_WIX_UI_DIALOG
-#
-# Background bitmap used on the welcome and completion dialogs.
-#
-# If this variable is set, the installer will replace the default dialog
-# image.
-#
-# This image must be 493 by 312 pixels.
-#
-# .. variable:: CPACK_WIX_PROGRAM_MENU_FOLDER
-#
-# Start menu folder name for launcher.
-#
-# If this variable is not set, it will be initialized with CPACK_PACKAGE_NAME
-#
-# .. variable:: CPACK_WIX_CULTURES
-#
-# Language(s) of the installer
-#
-# Languages are compiled into the WixUI extension library. To use them,
-# simply provide the name of the culture. If you specify more than one
-# culture identifier in a comma or semicolon delimited list, the first one
-# that is found will be used. You can find a list of supported languages at:
-# http://wix.sourceforge.net/manual-wix3/WixUI_localization.htm
-#
-# .. variable:: CPACK_WIX_TEMPLATE
-#
-# Template file for WiX generation
-#
-# If this variable is set, the specified template will be used to generate
-# the WiX wxs file. This should be used if further customization of the
-# output is required.
-#
-# If this variable is not set, the default MSI template included with CMake
-# will be used.
-#
-# .. variable:: CPACK_WIX_PATCH_FILE
-#
-# Optional list of XML files with fragments to be inserted into
-# generated WiX sources
-#
-# This optional variable can be used to specify an XML file that the
-# WiX generator will use to inject fragments into its generated
-# source files.
-#
-# Patch files understood by the CPack WiX generator
-# roughly follow this RELAX NG compact schema:
-#
-# .. code-block:: none
-#
-# start = CPackWiXPatch
-#
-# CPackWiXPatch = element CPackWiXPatch { CPackWiXFragment* }
-#
-# CPackWiXFragment = element CPackWiXFragment
-# {
-# attribute Id { string },
-# fragmentContent*
-# }
-#
-# fragmentContent = element * - CPackWiXFragment
-# {
-# (attribute * { text } | text | fragmentContent)*
-# }
-#
-# Currently fragments can be injected into most
-# Component, File, Directory and Feature elements.
-#
-# The following additional special Ids can be used:
-#
-# * ``#PRODUCT`` for the ``<Product>`` element.
-# * ``#PRODUCTFEATURE`` for the root ``<Feature>`` element.
-#
-# The following example illustrates how this works.
-#
-# Given that the WiX generator creates the following XML element:
-#
-# .. code-block:: xml
-#
-# <Component Id="CM_CP_applications.bin.my_libapp.exe" Guid="*"/>
-#
-# The following XML patch file may be used to inject an Environment element
-# into it:
-#
-# .. code-block:: xml
-#
-# <CPackWiXPatch>
-# <CPackWiXFragment Id="CM_CP_applications.bin.my_libapp.exe">
-# <Environment Id="MyEnvironment" Action="set"
-# Name="MyVariableName" Value="MyVariableValue"/>
-# </CPackWiXFragment>
-# </CPackWiXPatch>
-#
-# .. variable:: CPACK_WIX_EXTRA_SOURCES
-#
-# Extra WiX source files
-#
-# This variable provides an optional list of extra WiX source files (.wxs)
-# that should be compiled and linked. The full path to source files is
-# required.
-#
-# .. variable:: CPACK_WIX_EXTRA_OBJECTS
-#
-# Extra WiX object files or libraries
-#
-# This variable provides an optional list of extra WiX object (.wixobj)
-# and/or WiX library (.wixlib) files. The full path to objects and libraries
-# is required.
-#
-# .. variable:: CPACK_WIX_EXTENSIONS
-#
-# This variable provides a list of additional extensions for the WiX
-# tools light and candle.
-#
-# .. variable:: CPACK_WIX_<TOOL>_EXTENSIONS
-#
-# This is the tool specific version of CPACK_WIX_EXTENSIONS.
-# ``<TOOL>`` can be either LIGHT or CANDLE.
-#
-# .. variable:: CPACK_WIX_<TOOL>_EXTRA_FLAGS
-#
-# This list variable allows you to pass additional
-# flags to the WiX tool ``<TOOL>``.
-#
-# Use it at your own risk.
-# Future versions of CPack may generate flags which may be in conflict
-# with your own flags.
-#
-# ``<TOOL>`` can be either LIGHT or CANDLE.
-#
-# .. variable:: CPACK_WIX_CMAKE_PACKAGE_REGISTRY
-#
-# If this variable is set the generated installer will create
-# an entry in the windows registry key
-# ``HKEY_LOCAL_MACHINE\Software\Kitware\CMake\Packages\<package>``
-# The value for ``<package>`` is provided by this variable.
-#
-# Assuming you also install a CMake configuration file this will
-# allow other CMake projects to find your package with
-# the :command:`find_package` command.
-#
-# .. variable:: CPACK_WIX_PROPERTY_<PROPERTY>
-#
-# This variable can be used to provide a value for
-# the Windows Installer property ``<PROPERTY>``
-#
-# The following list contains some example properties that can be used to
-# customize information under
-# "Programs and Features" (also known as "Add or Remove Programs")
-#
-# * ARPCOMMENTS - Comments
-# * ARPHELPLINK - Help and support information URL
-# * ARPURLINFOABOUT - General information URL
-# * ARPURLUPDATEINFO - Update information URL
-# * ARPHELPTELEPHONE - Help and support telephone number
-# * ARPSIZE - Size (in kilobytes) of the application
-#
-# .. variable:: CPACK_WIX_ROOT_FEATURE_TITLE
-#
-# Sets the name of the root install feature in the WIX installer. Same as
-# CPACK_COMPONENT_<compName>_DISPLAY_NAME for components.
-#
-# .. variable:: CPACK_WIX_ROOT_FEATURE_DESCRIPTION
-#
-# Sets the description of the root install feature in the WIX installer. Same as
-# CPACK_COMPONENT_<compName>_DESCRIPTION for components.
-#
-# .. variable:: CPACK_WIX_SKIP_PROGRAM_FOLDER
-#
-# If this variable is set to true, the default install location
-# of the generated package will be CPACK_PACKAGE_INSTALL_DIRECTORY directly.
-# The install location will not be located relatively below
-# ProgramFiles or ProgramFiles64.
-#
-# .. note::
-# Installers created with this feature do not take differences
-# between the system on which the installer is created
-# and the system on which the installer might be used into account.
-#
-# It is therefore possible that the installer e.g. might try to install
-# onto a drive that is unavailable or unintended or a path that does not
-# follow the localization or convention of the system on which the
-# installation is performed.
-#
-# .. variable:: CPACK_WIX_ROOT_FOLDER_ID
-#
-# This variable allows specification of a custom root folder ID.
-# The generator specific ``<64>`` token can be used for
-# folder IDs that come in 32-bit and 64-bit variants.
-# In 32-bit builds the token will expand empty while in 64-bit builds
-# it will expand to ``64``.
-#
-# When unset generated installers will default installing to
-# ``ProgramFiles<64>Folder``.
-#
-# .. variable:: CPACK_WIX_ROOT
-#
-# This variable can optionally be set to the root directory
-# of a custom WiX Toolset installation.
-#
-# When unspecified CPack will try to locate a WiX Toolset
-# installation via the ``WIX`` environment variable instead.
-#
-
-if(NOT CPACK_WIX_ROOT)
- string(REPLACE "\\" "/" CPACK_WIX_ROOT "$ENV{WIX}")
-endif()
-
-find_program(CPACK_WIX_CANDLE_EXECUTABLE candle
- PATHS "${CPACK_WIX_ROOT}" PATH_SUFFIXES "bin")
-
-if(NOT CPACK_WIX_CANDLE_EXECUTABLE)
- message(FATAL_ERROR "Could not find the WiX candle executable.")
-endif()
-
-find_program(CPACK_WIX_LIGHT_EXECUTABLE light
- PATHS "${CPACK_WIX_ROOT}" PATH_SUFFIXES "bin")
-
-if(NOT CPACK_WIX_LIGHT_EXECUTABLE)
- message(FATAL_ERROR "Could not find the WiX light executable.")
-endif()
diff --git a/Modules/CheckIPOSupported.cmake b/Modules/CheckIPOSupported.cmake
index d8297d9..3344834 100644
--- a/Modules/CheckIPOSupported.cmake
+++ b/Modules/CheckIPOSupported.cmake
@@ -56,13 +56,14 @@ include(CMakeParseArguments) # cmake_parse_arguments
# X_RESULT - name of the final result variable
# X_OUTPUT - name of the variable with information about error
macro(_ipo_not_supported output)
- string(COMPARE EQUAL "${X_RESULT}" "" is_empty)
- if(is_empty)
+ if(NOT X_RESULT)
message(FATAL_ERROR "IPO is not supported (${output}).")
endif()
set("${X_RESULT}" NO PARENT_SCOPE)
- set("${X_OUTPUT}" "${output}" PARENT_SCOPE)
+ if(X_OUTPUT)
+ set("${X_OUTPUT}" "${output}" PARENT_SCOPE)
+ endif()
endmacro()
# Run IPO/LTO test
@@ -125,7 +126,13 @@ macro(_ipo_run_language_check language)
)
if(NOT result)
- _ipo_not_supported("${output}")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "${language} compiler IPO check failed with the following output:\n"
+ "${output}\n")
+ _ipo_not_supported("check failed to compile")
+ if(X_OUTPUT)
+ set("${X_OUTPUT}" "${output}" PARENT_SCOPE)
+ endif()
return()
endif()
endmacro()
diff --git a/Modules/Compiler/ARMCC.cmake b/Modules/Compiler/ARMCC.cmake
index 250a8f4..f949568 100644
--- a/Modules/Compiler/ARMCC.cmake
+++ b/Modules/Compiler/ARMCC.cmake
@@ -34,4 +34,6 @@ macro(__compiler_armcc lang)
set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> --create -cr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_DEPFILE_FLAGS_${lang} "--depend=<DEPFILE> --depend_single_line --no_depend_system_headers")
+
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Xlinker" " ")
endmacro()
diff --git a/Modules/Compiler/Absoft-Fortran.cmake b/Modules/Compiler/Absoft-Fortran.cmake
index da1fc80..76502dc 100644
--- a/Modules/Compiler/Absoft-Fortran.cmake
+++ b/Modules/Compiler/Absoft-Fortran.cmake
@@ -8,3 +8,4 @@ set(CMAKE_Fortran_MODPATH_FLAG "-p")
set(CMAKE_Fortran_VERBOSE_FLAG "-v")
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree")
+set(CMAKE_Fortran_LINKER_WRAPPER_FLAG "-X")
diff --git a/Modules/Compiler/Bruce-C.cmake b/Modules/Compiler/Bruce-C.cmake
index cfabe65..6b64e58 100644
--- a/Modules/Compiler/Bruce-C.cmake
+++ b/Modules/Compiler/Bruce-C.cmake
@@ -5,3 +5,5 @@ string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -g -DNDEBUG")
+
+set(CMAKE_C_LINKER_WRAPPER_FLAG "-X")
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index 7ce1adb..1653b55 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -30,6 +30,8 @@ else()
set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "--target=")
set(CMAKE_${lang}_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN "--gcc-toolchain=")
endif()
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Xlinker" " ")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP)
set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)
diff --git a/Modules/Compiler/Cray-CXX.cmake b/Modules/Compiler/Cray-CXX.cmake
index a1899e6..ff97e92 100644
--- a/Modules/Compiler/Cray-CXX.cmake
+++ b/Modules/Compiler/Cray-CXX.cmake
@@ -13,6 +13,10 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.4)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION -h std=c++11)
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -h std=c++11,gnu)
+ endif()
+ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.6)
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION -h std=c++14)
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION -h std=c++14,gnu)
endif ()
endif ()
diff --git a/Modules/Compiler/G95-Fortran.cmake b/Modules/Compiler/G95-Fortran.cmake
index 2c83fb8..03b7e08 100644
--- a/Modules/Compiler/G95-Fortran.cmake
+++ b/Modules/Compiler/G95-Fortran.cmake
@@ -7,3 +7,5 @@ set(CMAKE_Fortran_MODDIR_FLAG "-fmod=")
set(CMAKE_Fortran_VERBOSE_FLAG "-v")
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed-form")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form")
+set(CMAKE_Fortran_LINKER_WRAPPER_FLAG "-Wl,")
+set(CMAKE_Fortran_LINKER_WRAPPER_FLAG_SEP ",")
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake
index a3ef2bc..4491d4b 100644
--- a/Modules/Compiler/GNU.cmake
+++ b/Modules/Compiler/GNU.cmake
@@ -24,6 +24,9 @@ macro(__compiler_gnu lang)
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
set(CMAKE_${lang}_COMPILE_OPTIONS_SYSROOT "--sysroot=")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
+
# Older versions of gcc (< 4.5) contain a bug causing them to report a missing
# header file as a warning if depfiles are enabled, causing check_header_file
# tests to always succeed. Work around this by disabling dependency tracking
@@ -87,5 +90,11 @@ macro(__compiler_gnu lang)
)
endif()
- set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}" "-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp")
+ set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}")
+ if(CMAKE_${lang}_COMPILER_ARG1)
+ separate_arguments(_COMPILER_ARGS NATIVE_COMMAND "${CMAKE_${lang}_COMPILER_ARG1}")
+ list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND ${_COMPILER_ARGS})
+ unset(_COMPILER_ARGS)
+ endif()
+ list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp")
endmacro()
diff --git a/Modules/Compiler/HP-C.cmake b/Modules/Compiler/HP-C.cmake
index b42ba2b..8fa4c08 100644
--- a/Modules/Compiler/HP-C.cmake
+++ b/Modules/Compiler/HP-C.cmake
@@ -2,3 +2,6 @@ set(CMAKE_C_VERBOSE_FLAG "-v")
set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+
+set(CMAKE_C_LINKER_WRAPPER_FLAG "-Wl,")
+set(CMAKE_C_LINKER_WRAPPER_FLAG_SEP ",")
diff --git a/Modules/Compiler/HP-CXX.cmake b/Modules/Compiler/HP-CXX.cmake
index 7548754..5726b64 100644
--- a/Modules/Compiler/HP-CXX.cmake
+++ b/Modules/Compiler/HP-CXX.cmake
@@ -3,6 +3,9 @@ set(CMAKE_CXX_VERBOSE_FLAG "-v")
set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+set(CMAKE_CXX_LINKER_WRAPPER_FLAG "-Wl,")
+set(CMAKE_CXX_LINKER_WRAPPER_FLAG_SEP ",")
+
# HP aCC since version 3.80 supports the flag +hpxstd98 to get ANSI C++98
# template support. It is known that version 6.25 doesn't need that flag.
# Current assumption: the flag is needed for every version from 3.80 to 4
diff --git a/Modules/Compiler/HP-Fortran.cmake b/Modules/Compiler/HP-Fortran.cmake
index a6ca2c2..63a0331 100644
--- a/Modules/Compiler/HP-Fortran.cmake
+++ b/Modules/Compiler/HP-Fortran.cmake
@@ -4,3 +4,6 @@ set(CMAKE_Fortran_FORMAT_FREE_FLAG "+source=free")
set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+
+set(CMAKE_Fortran_LINKER_WRAPPER_FLAG "-Wl,")
+set(CMAKE_Fortran_LINKER_WRAPPER_FLAG ",")
diff --git a/Modules/Compiler/Intel.cmake b/Modules/Compiler/Intel.cmake
index 635ac4d..f2f16e0 100644
--- a/Modules/Compiler/Intel.cmake
+++ b/Modules/Compiler/Intel.cmake
@@ -25,6 +25,12 @@ else()
string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3")
string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g")
- set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}" "-QdM" "-P" "-Za" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp")
+ set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}")
+ if(CMAKE_${lang}_COMPILER_ARG1)
+ separate_arguments(_COMPILER_ARGS NATIVE_COMMAND "${CMAKE_${lang}_COMPILER_ARG1}")
+ list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND ${_COMPILER_ARGS})
+ unset(_COMPILER_ARGS)
+ endif()
+ list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-QdM" "-P" "-Za" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp")
endmacro()
endif()
diff --git a/Modules/Compiler/NAG-Fortran.cmake b/Modules/Compiler/NAG-Fortran.cmake
index 39aae18..9973feb 100644
--- a/Modules/Compiler/NAG-Fortran.cmake
+++ b/Modules/Compiler/NAG-Fortran.cmake
@@ -34,3 +34,4 @@ set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free")
set(CMAKE_Fortran_COMPILE_OPTIONS_PIC "-PIC")
set(CMAKE_Fortran_COMPILE_OPTIONS_PIE "-PIC")
+set(CMAKE_Fortran_RESPONSE_FILE_LINK_FLAG "-Wl,@")
diff --git a/Modules/Compiler/PGI.cmake b/Modules/Compiler/PGI.cmake
index d5a57ee..4f8b90b 100644
--- a/Modules/Compiler/PGI.cmake
+++ b/Modules/Compiler/PGI.cmake
@@ -25,6 +25,9 @@ macro(__compiler_pgi lang)
string(APPEND CMAKE_${lang}_FLAGS_INIT " -Bdynamic")
endif()
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG ",")
+
set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL ppc64le AND (NOT CMAKE_HOST_WIN32 OR CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 16.3))
set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)
diff --git a/Modules/Compiler/QCC.cmake b/Modules/Compiler/QCC.cmake
index a5e2b0b..9ba9900 100644
--- a/Modules/Compiler/QCC.cmake
+++ b/Modules/Compiler/QCC.cmake
@@ -13,10 +13,19 @@ macro(__compiler_qcc lang)
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,")
set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MD,<DEPFILE>,-MT,<OBJECT>,-MF,<DEPFILE>")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
+
set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE NO)
set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO)
- set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}" "-Wp,-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp")
+ set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}")
+ if(CMAKE_${lang}_COMPILER_ARG1)
+ separate_arguments(_COMPILER_ARGS NATIVE_COMMAND "${CMAKE_${lang}_COMPILER_ARG1}")
+ list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND ${_COMPILER_ARGS})
+ unset(_COMPILER_ARGS)
+ endif()
+ list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-Wp,-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp")
unset(CMAKE_${lang}_COMPILE_OPTIONS_IPO)
unset(CMAKE_${lang}_ARCHIVE_CREATE_IPO)
diff --git a/Modules/Compiler/SCO.cmake b/Modules/Compiler/SCO.cmake
index c55a048..7f643d9 100644
--- a/Modules/Compiler/SCO.cmake
+++ b/Modules/Compiler/SCO.cmake
@@ -15,4 +15,7 @@ macro(__compiler_sco lang)
set(CMAKE_${lang}_COMPILE_OPTIONS_DLL -belf)
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-Kpic -belf")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-belf -Wl,-Bexport")
+
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
endmacro()
diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake
index 8d0e6d6..047de43 100644
--- a/Modules/Compiler/SunPro-C.cmake
+++ b/Modules/Compiler/SunPro-C.cmake
@@ -29,6 +29,9 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Bdynamic")
endforeach()
+set(CMAKE_C_LINKER_WRAPPER_FLAG "-Qoption" "ld" " ")
+set(CMAKE_C_LINKER_WRAPPER_FLAG_SEP ",")
+
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.13)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=c89")
diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake
index 14196b7..4c1ac5b 100644
--- a/Modules/Compiler/SunPro-CXX.cmake
+++ b/Modules/Compiler/SunPro-CXX.cmake
@@ -29,6 +29,9 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
set(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Bdynamic")
endforeach()
+set(CMAKE_CXX_LINKER_WRAPPER_FLAG "-Qoption" "ld" " ")
+set(CMAKE_CXX_LINKER_WRAPPER_FLAG_SEP ",")
+
set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
diff --git a/Modules/Compiler/SunPro-Fortran.cmake b/Modules/Compiler/SunPro-Fortran.cmake
index 9b25c0b..2247dd0 100644
--- a/Modules/Compiler/SunPro-Fortran.cmake
+++ b/Modules/Compiler/SunPro-Fortran.cmake
@@ -18,6 +18,9 @@ string(APPEND CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT " -g -xO2 -DNDEBUG")
set(CMAKE_Fortran_MODDIR_FLAG "-moddir=")
set(CMAKE_Fortran_MODPATH_FLAG "-M")
+set(CMAKE_Fortran_LINKER_WRAPPER_FLAG "-Qoption" "ld" " ")
+set(CMAKE_Fortran_LINKER_WRAPPER_FLAG_SEP ",")
+
set(CMAKE_Fortran_PREPROCESS_SOURCE
"<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -F -fpp <SOURCE> -o <PREPROCESSED_SOURCE>")
diff --git a/Modules/Compiler/TinyCC-C.cmake b/Modules/Compiler/TinyCC-C.cmake
index fbd2841..6367695 100644
--- a/Modules/Compiler/TinyCC-C.cmake
+++ b/Modules/Compiler/TinyCC-C.cmake
@@ -6,3 +6,6 @@ string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -g -DNDEBUG")
+
+set(CMAKE_C_LINKER_WRAPPER_FLAG "-Wl,")
+set(CMAKE_C_LINKER_WRAPPER_FLAG_SEP ",")
diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake
index 3361f8f..21fe5e8 100644
--- a/Modules/Compiler/XL.cmake
+++ b/Modules/Compiler/XL.cmake
@@ -20,9 +20,13 @@ macro(__compiler_xl lang)
# Feature flags.
set(CMAKE_${lang}_VERBOSE_FLAG "-V")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-qpic")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-qpic")
set(CMAKE_${lang}_RESPONSE_FILE_FLAG "-qoptfile=")
set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-qoptfile=")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
+
string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O")
string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -O")
diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in
index 94bcbf8..4686b64 100644
--- a/Modules/CompilerId/Xcode-3.pbxproj.in
+++ b/Modules/CompilerId/Xcode-3.pbxproj.in
@@ -73,6 +73,7 @@
isa = XCBuildConfiguration;
buildSettings = {
@id_development_team@
+ @id_code_sign_identity@
PRODUCT_NAME = CompilerId@id_lang@;
};
name = Debug;
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index 5ee703a..39b9b74 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -22,7 +22,8 @@
# BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l
# and -L).
# BLAS_LIBRARIES - uncached list of libraries (using full path name) to
-# link against to use BLAS
+# link against to use BLAS (may be empty if compiler implicitly links
+# BLAS)
# BLAS95_LIBRARIES - uncached list of libraries (using full path name)
# to link against to use BLAS95 interface
# BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface
@@ -96,77 +97,81 @@ if(BLA_PREFER_PKGCONFIG)
endif()
macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
-# This macro checks for the existence of the combination of fortran libraries
-# given by _list. If the combination is found, this macro checks (using the
-# Check_Fortran_Function_Exists macro) whether can link against that library
-# combination using the name of a routine given by _name using the linker
-# flags given by _flags. If the combination of libraries is found and passes
-# the link test, LIBRARIES is set to the list of complete library paths that
-# have been found. Otherwise, LIBRARIES is set to FALSE.
-
-# N.B. _prefix is the prefix applied to the names of all cached variables that
-# are generated internally and marked advanced by this macro.
-
-set(_libdir ${ARGN})
-
-set(_libraries_work TRUE)
-set(${LIBRARIES})
-set(_combined_name)
-if (NOT _libdir)
- if (WIN32)
- set(_libdir ENV LIB)
- elseif (APPLE)
- set(_libdir ENV DYLD_LIBRARY_PATH)
- else ()
- set(_libdir ENV LD_LIBRARY_PATH)
+ # This macro checks for the existence of the combination of fortran libraries
+ # given by _list. If the combination is found, this macro checks (using the
+ # Check_Fortran_Function_Exists macro) whether can link against that library
+ # combination using the name of a routine given by _name using the linker
+ # flags given by _flags. If the combination of libraries is found and passes
+ # the link test, LIBRARIES is set to the list of complete library paths that
+ # have been found. Otherwise, LIBRARIES is set to FALSE.
+
+ # N.B. _prefix is the prefix applied to the names of all cached variables that
+ # are generated internally and marked advanced by this macro.
+
+ set(_libdir ${ARGN})
+
+ set(_libraries_work TRUE)
+ set(${LIBRARIES})
+ set(_combined_name)
+ if (NOT _libdir)
+ if (WIN32)
+ set(_libdir ENV LIB)
+ elseif (APPLE)
+ set(_libdir ENV DYLD_LIBRARY_PATH)
+ else ()
+ set(_libdir ENV LD_LIBRARY_PATH)
+ endif ()
endif ()
-endif ()
-foreach(_library ${_list})
- set(_combined_name ${_combined_name}_${_library})
+ foreach(_library ${_list})
+ set(_combined_name ${_combined_name}_${_library})
- if(_libraries_work)
- if (BLA_STATIC)
- if (WIN32)
- set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
- endif ()
- if (APPLE)
- set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ if(_libraries_work)
+ if (BLA_STATIC)
+ if (WIN32)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ endif ()
+ if (APPLE)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ else ()
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ endif ()
else ()
- set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
- endif ()
- else ()
- if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
- # for ubuntu's libblas3gf and liblapack3gf packages
- set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
+ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ # for ubuntu's libblas3gf and liblapack3gf packages
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
+ endif ()
endif ()
- endif ()
- find_library(${_prefix}_${_library}_LIBRARY
- NAMES ${_library}
- PATHS ${_libdir}
- )
- mark_as_advanced(${_prefix}_${_library}_LIBRARY)
- set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
- set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
+ find_library(${_prefix}_${_library}_LIBRARY
+ NAMES ${_library}
+ PATHS ${_libdir}
+ )
+ mark_as_advanced(${_prefix}_${_library}_LIBRARY)
+ set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
+ set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
+ endif()
+ endforeach()
+ if(_libraries_work)
+ # Test this combination of libraries.
+ set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread})
+ # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
+ if (CMAKE_Fortran_COMPILER_LOADED)
+ check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
+ else()
+ check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
+ endif()
+ set(CMAKE_REQUIRED_LIBRARIES)
+ mark_as_advanced(${_prefix}${_combined_name}_WORKS)
+ set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
endif()
-endforeach()
-if(_libraries_work)
- # Test this combination of libraries.
- set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread})
-# message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
- if (CMAKE_Fortran_COMPILER_LOADED)
- check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
+ if(_libraries_work)
+ if("${_list}" STREQUAL "")
+ set(${LIBRARIES} "${LIBRARIES}-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
+ endif()
else()
- check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
+ set(${LIBRARIES} FALSE)
endif()
- set(CMAKE_REQUIRED_LIBRARIES)
- mark_as_advanced(${_prefix}${_combined_name}_WORKS)
- set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
-endif()
-if(NOT _libraries_work)
- set(${LIBRARIES} FALSE)
-endif()
-#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
+ #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
endmacro()
set(BLAS_LINKER_FLAGS)
@@ -180,516 +185,533 @@ else ()
endif()
endif ()
+if (BLA_VENDOR STREQUAL "All")
+ if(NOT BLAS_LIBRARIES)
+ # Implicitly linked BLAS libraries
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ ""
+ ""
+ )
+ endif()
+endif ()
+
+#BLAS in intel mkl 10 library? (em64t 64bit)
+if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
+ if (NOT BLAS_LIBRARIES)
+ if (NOT WIN32)
+ set(LM "-lm")
+ endif ()
+ if (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)
+ if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
+ find_package(Threads)
+ else()
+ find_package(Threads REQUIRED)
+ endif()
+
+ set(BLAS_SEARCH_LIBS "")
+
+ if(BLA_F95)
+ set(BLAS_mkl_SEARCH_SYMBOL SGEMM)
+ set(_LIBRARIES BLAS95_LIBRARIES)
+ if (WIN32)
+ if (BLA_STATIC)
+ set(BLAS_mkl_DLL_SUFFIX "")
+ else()
+ set(BLAS_mkl_DLL_SUFFIX "_dll")
+ endif()
+
+ # Find the main file (32-bit or 64-bit)
+ set(BLAS_SEARCH_LIBS_WIN_MAIN "")
+ if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
+ "mkl_blas95${BLAS_mkl_DLL_SUFFIX} mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
+ endif()
+ if (BLA_VENDOR MATCHES "^Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
+ "mkl_blas95_lp64${BLAS_mkl_DLL_SUFFIX} mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}")
+ endif ()
+
+ # Add threading/sequential libs
+ set(BLAS_SEARCH_LIBS_WIN_THREAD "")
+ if (BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+ "mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
+ endif()
+ if (NOT BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All")
+ # old version
+ list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+ "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
+ # mkl >= 10.3
+ list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+ "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
+ endif()
+
+ # Cartesian product of the above
+ foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
+ foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
+ list(APPEND BLAS_SEARCH_LIBS
+ "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
+ endforeach()
+ endforeach()
+ else ()
+ if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide")
+ endif ()
+ if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
+ # old version
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide")
+
+ # mkl >= 10.3
+ if (CMAKE_C_COMPILER MATCHES ".+gcc")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core gomp")
+ else ()
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core iomp5")
+ endif ()
+ endif ()
+ if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_intel_lp64 mkl_sequential mkl_core")
+ endif ()
+ endif ()
+ else ()
+ set(BLAS_mkl_SEARCH_SYMBOL sgemm)
+ set(_LIBRARIES BLAS_LIBRARIES)
+ if (WIN32)
+ if (BLA_STATIC)
+ set(BLAS_mkl_DLL_SUFFIX "")
+ else()
+ set(BLAS_mkl_DLL_SUFFIX "_dll")
+ endif()
+
+ # Find the main file (32-bit or 64-bit)
+ set(BLAS_SEARCH_LIBS_WIN_MAIN "")
+ if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
+ "mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
+ endif()
+ if (BLA_VENDOR MATCHES "^Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
+ "mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}")
+ endif ()
+
+ # Add threading/sequential libs
+ set(BLAS_SEARCH_LIBS_WIN_THREAD "")
+ if (NOT BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All")
+ # old version
+ list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+ "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
+ # mkl >= 10.3
+ list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+ "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
+ endif()
+ if (BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+ "mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
+ endif()
+
+ # Cartesian product of the above
+ foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
+ foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
+ list(APPEND BLAS_SEARCH_LIBS
+ "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
+ endforeach()
+ endforeach()
+ else ()
+ if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_intel mkl_intel_thread mkl_core guide")
+ endif ()
+ if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
+
+ # old version
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_intel_lp64 mkl_intel_thread mkl_core guide")
+
+ # mkl >= 10.3
+ if (CMAKE_C_COMPILER MATCHES ".+gcc")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_intel_lp64 mkl_gnu_thread mkl_core gomp")
+ else ()
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_intel_lp64 mkl_intel_thread mkl_core iomp5")
+ endif ()
+ endif ()
+ if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_intel_lp64 mkl_sequential mkl_core")
+ endif ()
+
+ #older vesions of intel mkl libs
+ if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_ia32")
+ list(APPEND BLAS_SEARCH_LIBS
+ "mkl_em64t")
+ endif ()
+ endif ()
+ endif ()
+
+ foreach (IT ${BLAS_SEARCH_LIBS})
+ string(REPLACE " " ";" SEARCH_LIBS ${IT})
+ if (NOT ${_LIBRARIES})
+ check_fortran_libraries(
+ ${_LIBRARIES}
+ BLAS
+ ${BLAS_mkl_SEARCH_SYMBOL}
+ ""
+ "${SEARCH_LIBS}"
+ "${CMAKE_THREAD_LIBS_INIT};${LM}"
+ )
+ endif ()
+ endforeach ()
+
+ endif ()
+ endif ()
+endif ()
+
if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- # gotoblas (http://www.tacc.utexas.edu/tacc-projects/gotoblas2)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "goto2"
- ""
- )
- endif()
+ if(NOT BLAS_LIBRARIES)
+ # gotoblas (http://www.tacc.utexas.edu/tacc-projects/gotoblas2)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "goto2"
+ ""
+ )
+ endif()
endif ()
if (BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- # OpenBLAS (http://www.openblas.net)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "openblas"
- ""
- )
- endif()
+ if(NOT BLAS_LIBRARIES)
+ # OpenBLAS (http://www.openblas.net)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "openblas"
+ ""
+ )
+ endif()
endif ()
if (BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- # FLAME's blis library (https://github.com/flame/blis)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "blis"
- ""
- )
- endif()
+ if(NOT BLAS_LIBRARIES)
+ # FLAME's blis library (https://github.com/flame/blis)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "blis"
+ ""
+ )
+ endif()
endif ()
if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- dgemm
- ""
- "f77blas;atlas"
- ""
- )
- endif()
+ if(NOT BLAS_LIBRARIES)
+ # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ dgemm
+ ""
+ "f77blas;atlas"
+ ""
+ )
+ endif()
endif ()
# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "sgemm;dgemm;blas"
- ""
- )
- endif()
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "sgemm;dgemm;blas"
+ ""
+ )
+ endif()
endif ()
# BLAS in Alpha CXML library?
if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "cxml"
- ""
- )
- endif()
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "cxml"
+ ""
+ )
+ endif()
endif ()
# BLAS in Alpha DXML library? (now called CXML, see above)
if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "dxml"
- ""
- )
- endif()
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "dxml"
+ ""
+ )
+ endif()
endif ()
# BLAS in Sun Performance library?
if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- "-xlic_lib=sunperf"
- "sunperf;sunmath"
- ""
- )
- if(BLAS_LIBRARIES)
- set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf")
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ "-xlic_lib=sunperf"
+ "sunperf;sunmath"
+ ""
+ )
+ if(BLAS_LIBRARIES)
+ set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf")
+ endif()
endif()
- endif()
endif ()
# BLAS in SCSL library? (SGI/Cray Scientific Library)
if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "scsl"
- ""
- )
- endif()
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "scsl"
+ ""
+ )
+ endif()
endif ()
# BLAS in SGIMATH library?
if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "complib.sgimath"
- ""
- )
- endif()
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "complib.sgimath"
+ ""
+ )
+ endif()
endif ()
# BLAS in IBM ESSL library? (requires generic BLAS lib, too)
if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "essl;blas"
- ""
- )
- endif()
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "essl;blas"
+ ""
+ )
+ endif()
endif ()
#BLAS in acml library?
if (BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All")
- if( ((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR
- ((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR
- ((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS))
- )
- # try to find acml in "standard" paths
- if( WIN32 )
+ if( ((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR
+ ((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR
+ ((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS))
+ )
+ # try to find acml in "standard" paths
+ if( WIN32 )
file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" )
- else()
+ else()
file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" )
- endif()
- if( WIN32 )
+ endif()
+ if( WIN32 )
file( GLOB _ACML_GPU_ROOT "C:/AMD/acml*/GPGPUexamples" )
- else()
+ else()
file( GLOB _ACML_GPU_ROOT "/opt/acml*/GPGPUexamples" )
- endif()
- list(GET _ACML_ROOT 0 _ACML_ROOT)
- list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT)
- if( _ACML_ROOT )
+ endif()
+ list(GET _ACML_ROOT 0 _ACML_ROOT)
+ list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT)
+ if( _ACML_ROOT )
get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH )
if( SIZEOF_INTEGER EQUAL 8 )
- set( _ACML_PATH_SUFFIX "_int64" )
+ set( _ACML_PATH_SUFFIX "_int64" )
+ else()
+ set( _ACML_PATH_SUFFIX "" )
+ endif()
+ if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )
+ set( _ACML_COMPILER32 "ifort32" )
+ set( _ACML_COMPILER64 "ifort64" )
+ elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" )
+ set( _ACML_COMPILER32 "sun32" )
+ set( _ACML_COMPILER64 "sun64" )
+ elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" )
+ set( _ACML_COMPILER32 "pgi32" )
+ if( WIN32 )
+ set( _ACML_COMPILER64 "win64" )
+ else()
+ set( _ACML_COMPILER64 "pgi64" )
+ endif()
+ elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" )
+ # 32 bit builds not supported on Open64 but for code simplicity
+ # We'll just use the same directory twice
+ set( _ACML_COMPILER32 "open64_64" )
+ set( _ACML_COMPILER64 "open64_64" )
+ elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" )
+ set( _ACML_COMPILER32 "nag32" )
+ set( _ACML_COMPILER64 "nag64" )
else()
- set( _ACML_PATH_SUFFIX "" )
- endif()
- if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )
- set( _ACML_COMPILER32 "ifort32" )
- set( _ACML_COMPILER64 "ifort64" )
- elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" )
- set( _ACML_COMPILER32 "sun32" )
- set( _ACML_COMPILER64 "sun64" )
- elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" )
- set( _ACML_COMPILER32 "pgi32" )
- if( WIN32 )
- set( _ACML_COMPILER64 "win64" )
+ set( _ACML_COMPILER32 "gfortran32" )
+ set( _ACML_COMPILER64 "gfortran64" )
+ endif()
+
+ if( BLA_VENDOR STREQUAL "ACML_MP" )
+ set(_ACML_MP_LIB_DIRS
+ "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib"
+ "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" )
else()
- set( _ACML_COMPILER64 "pgi64" )
+ set(_ACML_LIB_DIRS
+ "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib"
+ "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" )
endif()
- elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" )
- # 32 bit builds not supported on Open64 but for code simplicity
- # We'll just use the same directory twice
- set( _ACML_COMPILER32 "open64_64" )
- set( _ACML_COMPILER64 "open64_64" )
- elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" )
- set( _ACML_COMPILER32 "nag32" )
- set( _ACML_COMPILER64 "nag64" )
- else()
- set( _ACML_COMPILER32 "gfortran32" )
- set( _ACML_COMPILER64 "gfortran64" )
- endif()
-
- if( BLA_VENDOR STREQUAL "ACML_MP" )
- set(_ACML_MP_LIB_DIRS
- "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib"
- "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" )
- else()
- set(_ACML_LIB_DIRS
- "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib"
- "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" )
- endif()
endif()
- elseif(BLAS_${BLA_VENDOR}_LIB_DIRS)
- set(_${BLA_VENDOR}_LIB_DIRS ${BLAS_${BLA_VENDOR}_LIB_DIRS})
- endif()
+elseif(BLAS_${BLA_VENDOR}_LIB_DIRS)
+ set(_${BLA_VENDOR}_LIB_DIRS ${BLAS_${BLA_VENDOR}_LIB_DIRS})
+endif()
- if( BLA_VENDOR STREQUAL "ACML_MP" )
+if( BLA_VENDOR STREQUAL "ACML_MP" )
foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS})
- check_fortran_libraries (
- BLAS_LIBRARIES
- BLAS
- sgemm
- "" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS}
- )
- if( BLAS_LIBRARIES )
- break()
- endif()
+ check_fortran_libraries (
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ "" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS}
+ )
+ if( BLAS_LIBRARIES )
+ break()
+ endif()
endforeach()
- elseif( BLA_VENDOR STREQUAL "ACML_GPU" )
+elseif( BLA_VENDOR STREQUAL "ACML_GPU" )
foreach( BLAS_ACML_GPU_LIB_DIRS ${_ACML_GPU_LIB_DIRS})
- check_fortran_libraries (
- BLAS_LIBRARIES
- BLAS
- sgemm
- "" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS}
- )
- if( BLAS_LIBRARIES )
- break()
- endif()
+ check_fortran_libraries (
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ "" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS}
+ )
+ if( BLAS_LIBRARIES )
+ break()
+ endif()
endforeach()
- else()
+else()
foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} )
- check_fortran_libraries (
- BLAS_LIBRARIES
- BLAS
- sgemm
- "" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS}
- )
- if( BLAS_LIBRARIES )
- break()
- endif()
+ check_fortran_libraries (
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ "" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS}
+ )
+ if( BLAS_LIBRARIES )
+ break()
+ endif()
endforeach()
- endif()
+endif()
- # Either acml or acml_mp should be in LD_LIBRARY_PATH but not both
- if(NOT BLAS_LIBRARIES)
+# Either acml or acml_mp should be in LD_LIBRARY_PATH but not both
+if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "acml;acml_mv"
- ""
- )
- endif()
- if(NOT BLAS_LIBRARIES)
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "acml;acml_mv"
+ ""
+ )
+endif()
+if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "acml_mp;acml_mv"
- ""
- )
- endif()
- if(NOT BLAS_LIBRARIES)
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "acml_mp;acml_mv"
+ ""
+ )
+endif()
+if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "acml;acml_mv;CALBLAS"
- ""
- )
- endif()
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "acml;acml_mv;CALBLAS"
+ ""
+ )
+endif()
endif () # ACML
# Apple BLAS library?
if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
-if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- dgemm
- ""
- "Accelerate"
- ""
- )
- endif()
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ dgemm
+ ""
+ "Accelerate"
+ ""
+ )
+ endif()
endif ()
if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
- if ( NOT BLAS_LIBRARIES )
+ if ( NOT BLAS_LIBRARIES )
check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- dgemm
- ""
- "vecLib"
- ""
- )
- endif ()
+ BLAS_LIBRARIES
+ BLAS
+ dgemm
+ ""
+ "vecLib"
+ ""
+ )
+ endif ()
endif ()
+
# Generic BLAS library?
if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "blas"
- ""
- )
- endif()
-endif ()
-
-#BLAS in intel mkl 10 library? (em64t 64bit)
-if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
- if (NOT WIN32)
- set(LM "-lm")
- endif ()
- if (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)
- if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
- find_package(Threads)
- else()
- find_package(Threads REQUIRED)
+ if(NOT BLAS_LIBRARIES)
+ check_fortran_libraries(
+ BLAS_LIBRARIES
+ BLAS
+ sgemm
+ ""
+ "blas"
+ ""
+ )
endif()
-
- set(BLAS_SEARCH_LIBS "")
-
- if(BLA_F95)
- set(BLAS_mkl_SEARCH_SYMBOL SGEMM)
- set(_LIBRARIES BLAS95_LIBRARIES)
- if (WIN32)
- if (BLA_STATIC)
- set(BLAS_mkl_DLL_SUFFIX "")
- else()
- set(BLAS_mkl_DLL_SUFFIX "_dll")
- endif()
-
- # Find the main file (32-bit or 64-bit)
- set(BLAS_SEARCH_LIBS_WIN_MAIN "")
- if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
- list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
- "mkl_blas95${BLAS_mkl_DLL_SUFFIX} mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
- endif()
- if (BLA_VENDOR MATCHES "^Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
- list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
- "mkl_blas95_lp64${BLAS_mkl_DLL_SUFFIX} mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}")
- endif ()
-
- # Add threading/sequential libs
- set(BLAS_SEARCH_LIBS_WIN_THREAD "")
- if (BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All")
- list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
- "mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
- endif()
- if (NOT BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All")
- # old version
- list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
- "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
- # mkl >= 10.3
- list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
- "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
- endif()
-
- # Cartesian product of the above
- foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
- foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
- list(APPEND BLAS_SEARCH_LIBS
- "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
- endforeach()
- endforeach()
- else ()
- if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
- list(APPEND BLAS_SEARCH_LIBS
- "mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide")
- endif ()
- if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
- # old version
- list(APPEND BLAS_SEARCH_LIBS
- "mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide")
-
- # mkl >= 10.3
- if (CMAKE_C_COMPILER MATCHES ".+gcc")
- list(APPEND BLAS_SEARCH_LIBS
- "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core gomp")
- else ()
- list(APPEND BLAS_SEARCH_LIBS
- "mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core iomp5")
- endif ()
- endif ()
- if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
- list(APPEND BLAS_SEARCH_LIBS
- "mkl_intel_lp64 mkl_sequential mkl_core")
- endif ()
- endif ()
- else ()
- set(BLAS_mkl_SEARCH_SYMBOL sgemm)
- set(_LIBRARIES BLAS_LIBRARIES)
- if (WIN32)
- if (BLA_STATIC)
- set(BLAS_mkl_DLL_SUFFIX "")
- else()
- set(BLAS_mkl_DLL_SUFFIX "_dll")
- endif()
-
- # Find the main file (32-bit or 64-bit)
- set(BLAS_SEARCH_LIBS_WIN_MAIN "")
- if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
- list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
- "mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
- endif()
- if (BLA_VENDOR MATCHES "^Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
- list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
- "mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}")
- endif ()
-
- # Add threading/sequential libs
- set(BLAS_SEARCH_LIBS_WIN_THREAD "")
- if (NOT BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All")
- # old version
- list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
- "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
- # mkl >= 10.3
- list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
- "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
- endif()
- if (BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All")
- list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
- "mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
- endif()
-
- # Cartesian product of the above
- foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
- foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
- list(APPEND BLAS_SEARCH_LIBS
- "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
- endforeach()
- endforeach()
- else ()
- if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
- list(APPEND BLAS_SEARCH_LIBS
- "mkl_intel mkl_intel_thread mkl_core guide")
- endif ()
- if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
-
- # old version
- list(APPEND BLAS_SEARCH_LIBS
- "mkl_intel_lp64 mkl_intel_thread mkl_core guide")
-
- # mkl >= 10.3
- if (CMAKE_C_COMPILER MATCHES ".+gcc")
- list(APPEND BLAS_SEARCH_LIBS
- "mkl_intel_lp64 mkl_gnu_thread mkl_core gomp")
- else ()
- list(APPEND BLAS_SEARCH_LIBS
- "mkl_intel_lp64 mkl_intel_thread mkl_core iomp5")
- endif ()
- endif ()
- if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
- list(APPEND BLAS_SEARCH_LIBS
- "mkl_intel_lp64 mkl_sequential mkl_core")
- endif ()
-
- #older vesions of intel mkl libs
- if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All")
- list(APPEND BLAS_SEARCH_LIBS
- "mkl")
- list(APPEND BLAS_SEARCH_LIBS
- "mkl_ia32")
- list(APPEND BLAS_SEARCH_LIBS
- "mkl_em64t")
- endif ()
- endif ()
- endif ()
-
- foreach (IT ${BLAS_SEARCH_LIBS})
- string(REPLACE " " ";" SEARCH_LIBS ${IT})
- if (NOT ${_LIBRARIES})
- check_fortran_libraries(
- ${_LIBRARIES}
- BLAS
- ${BLAS_mkl_SEARCH_SYMBOL}
- ""
- "${SEARCH_LIBS}"
- "${CMAKE_THREAD_LIBS_INIT};${LM}"
- )
- endif ()
- endforeach ()
-
- endif ()
endif ()
if(BLA_F95)
@@ -702,5 +724,11 @@ else()
find_package_handle_standard_args(BLAS REQUIRED_VARS BLAS_LIBRARIES)
endif()
+# On compilers that implicitly link BLAS (such as ftn, cc, and CC on Cray HPC machines)
+# we used a placeholder for empty BLAS_LIBRARIES to get through our logic above.
+if (BLAS_LIBRARIES STREQUAL "BLAS_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
+ set(BLAS_LIBRARIES "")
+endif()
+
cmake_pop_check_state()
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 4e5c45d..f65a493 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -881,7 +881,11 @@ function(_Boost_COMPONENT_HEADERS component _hdrs)
set(_Boost_CHRONO_HEADERS "boost/chrono.hpp")
set(_Boost_CONTAINER_HEADERS "boost/container/container_fwd.hpp")
set(_Boost_CONTRACT_HEADERS "boost/contract.hpp")
- set(_Boost_CONTEXT_HEADERS "boost/context/detail/fcontext.hpp")
+ if(Boost_VERSION VERSION_LESS 106100)
+ set(_Boost_CONTEXT_HEADERS "boost/context/all.hpp")
+ else()
+ set(_Boost_CONTEXT_HEADERS "boost/context/detail/fcontext.hpp")
+ endif()
set(_Boost_COROUTINE_HEADERS "boost/coroutine/all.hpp")
set(_Boost_DATE_TIME_HEADERS "boost/date_time/date.hpp")
set(_Boost_EXCEPTION_HEADERS "boost/exception/exception.hpp")
@@ -1480,14 +1484,14 @@ if(NOT "x${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "x" AND NOT Boost_VERSI
string(APPEND _boost_ARCHITECTURE_TAG "-")
# This needs to be kept in-sync with the section of CMakePlatformId.h.in
# inside 'defined(_WIN32) && defined(_MSC_VER)'
- if(${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} STREQUAL "IA64")
+ if(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "IA64")
string(APPEND _boost_ARCHITECTURE_TAG "i")
- elseif(${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} STREQUAL "X86"
- OR ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} STREQUAL "x64")
+ elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "X86"
+ OR CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "x64")
string(APPEND _boost_ARCHITECTURE_TAG "x")
- elseif(${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} MATCHES "^ARM")
+ elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID MATCHES "^ARM")
string(APPEND _boost_ARCHITECTURE_TAG "a")
- elseif(${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} STREQUAL "MIPS")
+ elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "MIPS")
string(APPEND _boost_ARCHITECTURE_TAG "m")
endif()
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 21cace3..1650e55 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -971,7 +971,8 @@ if(NOT CUDA_VERSION VERSION_LESS "3.2")
find_cuda_helper_libs(nvcuvid)
endif()
endif()
-if(CUDA_VERSION VERSION_GREATER "5.0")
+if(CUDA_VERSION VERSION_GREATER "5.0" AND CUDA_VERSION VERSION_LESS "9.2")
+ # In CUDA 9.2 cublas_device was deprecated
find_cuda_helper_libs(cublas_device)
endif()
diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake
index a549765..60ddf7b 100644
--- a/Modules/FindCURL.cmake
+++ b/Modules/FindCURL.cmake
@@ -34,17 +34,29 @@
find_path(CURL_INCLUDE_DIR NAMES curl/curl.h)
mark_as_advanced(CURL_INCLUDE_DIR)
-# Look for the library (sorted from most current/relevant entry to least).
-find_library(CURL_LIBRARY NAMES
- curl
- # Windows MSVC prebuilts:
- curllib
- libcurl_imp
- curllib_static
- # Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip):
- libcurl
-)
-mark_as_advanced(CURL_LIBRARY)
+if(NOT CURL_LIBRARY)
+ # Look for the library (sorted from most current/relevant entry to least).
+ find_library(CURL_LIBRARY_RELEASE NAMES
+ curl
+ # Windows MSVC prebuilts:
+ curllib
+ libcurl_imp
+ curllib_static
+ # Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip):
+ libcurl
+ )
+ mark_as_advanced(CURL_LIBRARY_RELEASE)
+
+ find_library(CURL_LIBRARY_DEBUG NAMES
+ # Windows MSVC CMake builds in debug configuration on vcpkg:
+ libcurl-d_imp
+ libcurl-d
+ )
+ mark_as_advanced(CURL_LIBRARY_DEBUG)
+
+ include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
+ select_library_configurations(CURL)
+endif()
if(CURL_INCLUDE_DIR)
foreach(_curl_version_header curlver.h curl.h)
@@ -69,7 +81,27 @@ if(CURL_FOUND)
if(NOT TARGET CURL::libcurl)
add_library(CURL::libcurl UNKNOWN IMPORTED)
- set_target_properties(CURL::libcurl PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}")
- set_property(TARGET CURL::libcurl APPEND PROPERTY IMPORTED_LOCATION "${CURL_LIBRARY}")
+ set_target_properties(CURL::libcurl PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}")
+
+ if(EXISTS "${CURL_LIBRARY}")
+ set_target_properties(CURL::libcurl PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${CURL_LIBRARY}")
+ endif()
+ if(CURL_LIBRARY_RELEASE)
+ set_property(TARGET CURL::libcurl APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(CURL::libcurl PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION_RELEASE "${CURL_LIBRARY_RELEASE}")
+ endif()
+ if(CURL_LIBRARY_DEBUG)
+ set_property(TARGET CURL::libcurl APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(CURL::libcurl PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION_DEBUG "${CURL_LIBRARY_DEBUG}")
+ endif()
endif()
endif()
diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake
index b57a46e..e86c15c 100644
--- a/Modules/FindLua.cmake
+++ b/Modules/FindLua.cmake
@@ -42,13 +42,6 @@ cmake_policy(SET CMP0012 NEW) # For while(TRUE)
unset(_lua_include_subdirs)
unset(_lua_library_names)
unset(_lua_append_versions)
-set(_lua_additional_paths
- ~/Library/Frameworks
- /Library/Frameworks
- /sw # Fink
- /opt/local # DarwinPorts
- /opt/csw # Blastwave
- /opt)
# this is a function only to have all the variables inside go away automatically
function(_lua_get_versions)
@@ -161,7 +154,6 @@ function(_lua_find_header)
HINTS
ENV LUA_DIR
PATH_SUFFIXES ${subdir}
- PATHS ${_lua_additional_paths}
)
if (LUA_INCLUDE_DIR)
break()
@@ -209,7 +201,6 @@ find_library(LUA_LIBRARY
HINTS
ENV LUA_DIR
PATH_SUFFIXES lib
- PATHS ${_lua_additional_paths}
)
unset(_lua_library_names)
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index 54e62db..f2ada3b 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -25,6 +25,7 @@
# available on the MCR version, and will yield an error if the MCR is found
# instead of the regular Matlab installation.
# * ``MEX_COMPILER`` the MEX compiler.
+# * ``MCC_COMPILER`` the MCC compiler, included with the Matlab Compiler add-on.
# * ``SIMULINK`` the Simulink environment.
#
# .. note::
@@ -110,7 +111,10 @@
# the whole set of libraries of Matlab
# ``Matlab_MEX_COMPILER``
# the mex compiler of Matlab. Currently not used.
-# Available only if the component ``MEX_COMPILER`` is asked
+# Available only if the component ``MEX_COMPILER`` is requested.
+# ``Matlab_MCC_COMPILER``
+# the mcc compiler of Matlab. Included with the Matlab Compiler add-on.
+# Available only if the component ``MCC_COMPILER`` is requested.
#
# Cached variables
# """"""""""""""""
@@ -1163,21 +1167,24 @@ function(_Matlab_get_version_from_root matlab_root matlab_or_mcr matlab_known_ve
# return the updated value
set(${matlab_final_version} ${Matlab_VERSION_STRING_INTERNAL} PARENT_SCOPE)
- else()
+ elseif(EXISTS "${matlab_root}/VersionInfo.xml")
# MCR
# we cannot run anything in order to extract the version. We assume that the file
# VersionInfo.xml exists under the MatlabRoot, we look for it and extract the version from there
set(_matlab_version_tmp "unknown")
file(STRINGS "${matlab_root}/VersionInfo.xml" versioninfo_string NEWLINE_CONSUME)
- # parses "<version>9.2.0.538062</version>"
- string(REGEX MATCH "<version>(.*)</version>"
- version_reg_match
- ${versioninfo_string}
- )
-
- if(NOT "${version_reg_match}" STREQUAL "")
- if("${CMAKE_MATCH_1}" MATCHES "(([0-9])\\.([0-9]))[\\.0-9]*")
- set(_matlab_version_tmp "${CMAKE_MATCH_1}")
+
+ if(versioninfo_string)
+ # parses "<version>9.2.0.538062</version>"
+ string(REGEX MATCH "<version>(.*)</version>"
+ version_reg_match
+ ${versioninfo_string}
+ )
+
+ if(NOT "${version_reg_match}" STREQUAL "")
+ if("${CMAKE_MATCH_1}" MATCHES "(([0-9])\\.([0-9]))[\\.0-9]*")
+ set(_matlab_version_tmp "${CMAKE_MATCH_1}")
+ endif()
endif()
endif()
set(${matlab_final_version} "${_matlab_version_tmp}" PARENT_SCOPE)
@@ -1185,8 +1192,7 @@ function(_Matlab_get_version_from_root matlab_root matlab_or_mcr matlab_known_ve
"${_matlab_version_tmp}"
CACHE INTERNAL "Matlab (MCR) version (automatically determined)"
FORCE)
-
- endif() # Matlab or MCR
+ endif() # Matlab or MCR
endfunction()
@@ -1369,7 +1375,7 @@ else()
# if the user does not specify the possible installation root, we look for
# one installation using the appropriate heuristics.
# There is apparently no standard way on Linux.
- if(WIN32)
+ if(CMAKE_HOST_WIN32)
_Matlab_find_instances_win32(_matlab_possible_roots_win32)
list(APPEND _matlab_possible_roots ${_matlab_possible_roots_win32})
elseif(APPLE)
@@ -1420,6 +1426,7 @@ if(DEFINED Matlab_ROOT_DIR_LAST_CACHED)
Matlab_INCLUDE_DIRS
Matlab_MEX_LIBRARY
Matlab_MEX_COMPILER
+ Matlab_MCC_COMPILER
Matlab_MAIN_PROGRAM
Matlab_MX_LIBRARY
Matlab_ENG_LIBRARY
@@ -1660,6 +1667,22 @@ if(_matlab_find_simulink GREATER -1)
endif()
unset(_matlab_find_simulink)
+# component MCC Compiler
+list(FIND Matlab_FIND_COMPONENTS MCC_COMPILER _matlab_find_mcc_compiler)
+if(_matlab_find_mcc_compiler GREATER -1)
+ find_program(
+ Matlab_MCC_COMPILER
+ "mcc"
+ PATHS ${Matlab_BINARIES_DIR}
+ DOC "Matlab MCC compiler"
+ NO_DEFAULT_PATH
+ )
+ if(Matlab_MCC_COMPILER)
+ set(Matlab_MCC_COMPILER_FOUND TRUE)
+ endif()
+endif()
+unset(_matlab_find_mcc_compiler)
+
unset(_matlab_lib_dir_for_search)
set(Matlab_LIBRARIES ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} ${Matlab_ENG_LIBRARY} ${Matlab_MAT_LIBRARY})
diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake
index 297a5fb..fe162b4 100644
--- a/Modules/FindOpenCL.cmake
+++ b/Modules/FindOpenCL.cmake
@@ -119,16 +119,27 @@ if(WIN32)
OpenCL/common/lib/x64)
endif()
else()
- find_library(OpenCL_LIBRARY
- NAMES OpenCL
- PATHS
- ENV AMDAPPSDKROOT
- ENV CUDA_PATH
- PATH_SUFFIXES
- lib/x86_64
- lib/x64
- lib
- lib64)
+ if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ find_library(OpenCL_LIBRARY
+ NAMES OpenCL
+ PATHS
+ ENV AMDAPPSDKROOT
+ ENV CUDA_PATH
+ PATH_SUFFIXES
+ lib/x86
+ lib)
+ elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ find_library(OpenCL_LIBRARY
+ NAMES OpenCL
+ PATHS
+ ENV AMDAPPSDKROOT
+ ENV CUDA_PATH
+ PATH_SUFFIXES
+ lib/x86_64
+ lib/x64
+ lib
+ lib64)
+ endif()
endif()
set(OpenCL_LIBRARIES ${OpenCL_LIBRARY})
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
index 67f6bd6..1722d6a 100644
--- a/Modules/FindPackageHandleStandardArgs.cmake
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -145,7 +145,7 @@ endmacro()
# internal helper macro to generate the failure message when used in CONFIG_MODE:
macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
- # <name>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found:
+ # <PackageName>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found:
if(${_NAME}_CONFIG)
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing:${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})")
else()
@@ -199,7 +199,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG")
endif()
- # In config-mode, we rely on the variable <package>_CONFIG, which is set by find_package()
+ # In config-mode, we rely on the variable <PackageName>_CONFIG, which is set by find_package()
# when it successfully found the config-file, including version checking:
if(FPHSA_CONFIG_MODE)
list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG)
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 775a9d7..3934867 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -114,12 +114,13 @@ macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp)
endmacro()
# Splits given arguments into options and a package list
-macro(_pkgconfig_parse_options _result _is_req _is_silent _no_cmake_path _no_cmake_environment_path _imp_target)
+macro(_pkgconfig_parse_options _result _is_req _is_silent _no_cmake_path _no_cmake_environment_path _imp_target _imp_target_global)
set(${_is_req} 0)
set(${_is_silent} 0)
set(${_no_cmake_path} 0)
set(${_no_cmake_environment_path} 0)
set(${_imp_target} 0)
+ set(${_imp_target_global} 0)
if(DEFINED PKG_CONFIG_USE_CMAKE_PREFIX_PATH)
if(NOT PKG_CONFIG_USE_CMAKE_PREFIX_PATH)
set(${_no_cmake_path} 1)
@@ -146,14 +147,22 @@ macro(_pkgconfig_parse_options _result _is_req _is_silent _no_cmake_path _no_cma
if (_pkg STREQUAL "IMPORTED_TARGET")
set(${_imp_target} 1)
endif()
+ if (_pkg STREQUAL "GLOBAL")
+ set(${_imp_target_global} 1)
+ endif()
endforeach()
+ if (${_imp_target_global} AND NOT ${_imp_target})
+ message(SEND_ERROR "the argument GLOBAL may only be used together with IMPORTED_TARGET")
+ endif()
+
set(${_result} ${ARGN})
list(REMOVE_ITEM ${_result} "REQUIRED")
list(REMOVE_ITEM ${_result} "QUIET")
list(REMOVE_ITEM ${_result} "NO_CMAKE_PATH")
list(REMOVE_ITEM ${_result} "NO_CMAKE_ENVIRONMENT_PATH")
list(REMOVE_ITEM ${_result} "IMPORTED_TARGET")
+ list(REMOVE_ITEM ${_result} "GLOBAL")
endmacro()
# Add the content of a variable or an environment variable to a list of
@@ -225,11 +234,16 @@ function(_pkg_find_libs _prefix _no_cmake_path _no_cmake_environment_path)
endfunction()
# create an imported target from all the information returned by pkg-config
-function(_pkg_create_imp_target _prefix)
+function(_pkg_create_imp_target _prefix _imp_target_global)
# only create the target if it is linkable, i.e. no executables
if (NOT TARGET PkgConfig::${_prefix}
AND ( ${_prefix}_INCLUDE_DIRS OR ${_prefix}_LINK_LIBRARIES OR ${_prefix}_CFLAGS_OTHER ))
- add_library(PkgConfig::${_prefix} INTERFACE IMPORTED)
+ if(${_imp_target_global})
+ set(_global_opt "GLOBAL")
+ else()
+ unset(_global_opt)
+ endif()
+ add_library(PkgConfig::${_prefix} INTERFACE IMPORTED ${_global_opt})
if(${_prefix}_INCLUDE_DIRS)
set_property(TARGET PkgConfig::${_prefix} PROPERTY
@@ -248,15 +262,15 @@ endfunction()
# recalculate the dynamic output
# this is a macro and not a function so the result of _pkg_find_libs is automatically propagated
-macro(_pkg_recalculate _prefix _no_cmake_path _no_cmake_environment_path _imp_target)
+macro(_pkg_recalculate _prefix _no_cmake_path _no_cmake_environment_path _imp_target _imp_target_global)
_pkg_find_libs(${_prefix} ${_no_cmake_path} ${_no_cmake_environment_path})
if(${_imp_target})
- _pkg_create_imp_target(${_prefix})
+ _pkg_create_imp_target(${_prefix} ${_imp_target_global})
endif()
endmacro()
###
-macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cmake_environment_path _imp_target _prefix)
+macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cmake_environment_path _imp_target _imp_target_global _prefix)
_pkgconfig_unset(${_prefix}_FOUND)
_pkgconfig_unset(${_prefix}_VERSION)
_pkgconfig_unset(${_prefix}_PREFIX)
@@ -474,7 +488,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags )
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other )
- _pkg_recalculate("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target})
+ _pkg_recalculate("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} ${_imp_target_global})
endif()
if(NOT "${_extra_paths}" STREQUAL "")
@@ -502,7 +516,7 @@ endmacro()
[REQUIRED] [QUIET]
[NO_CMAKE_PATH]
[NO_CMAKE_ENVIRONMENT_PATH]
- [IMPORTED_TARGET]
+ [IMPORTED_TARGET [GLOBAL]]
<moduleSpec> [<moduleSpec>...])
When the ``REQUIRED`` argument is given, the command will fail with an error
@@ -521,7 +535,8 @@ endmacro()
The ``IMPORTED_TARGET`` argument will create an imported target named
``PkgConfig::<prefix>`` that can be passed directly as an argument to
- :command:`target_link_libraries`.
+ :command:`target_link_libraries`. The ``GLOBAL`` argument will make the
+ imported target available in global scope.
Each ``<moduleSpec>`` must be in one of the following formats::
@@ -594,12 +609,12 @@ 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})
+ _pkgconfig_parse_options(_pkg_modules _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path _imp_target _imp_target_global "${_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 OR
(NOT "${ARGN}" STREQUAL "" AND NOT "${__pkg_config_arguments_${_prefix}}" STREQUAL "${_module0};${ARGN}") OR
( "${ARGN}" STREQUAL "" AND NOT "${__pkg_config_arguments_${_prefix}}" STREQUAL "${_module0}"))
- _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} "${_prefix}" ${_pkg_modules})
+ _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} ${_imp_target_global} "${_prefix}" ${_pkg_modules})
_pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
if (${_prefix}_FOUND)
@@ -607,7 +622,7 @@ macro(pkg_check_modules _prefix _module0)
endif()
else()
if (${_prefix}_FOUND)
- _pkg_recalculate("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target})
+ _pkg_recalculate("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} ${_imp_target_global})
endif()
endif()
endmacro()
@@ -624,7 +639,7 @@ endmacro()
[REQUIRED] [QUIET]
[NO_CMAKE_PATH]
[NO_CMAKE_ENVIRONMENT_PATH]
- [IMPORTED_TARGET]
+ [IMPORTED_TARGET [GLOBAL]]
<moduleSpec> [<moduleSpec>...])
Examples
@@ -634,7 +649,7 @@ 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})
+ _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path _imp_target _imp_target_global "${_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)
@@ -646,7 +661,7 @@ macro(pkg_search_module _prefix _module0)
# iterate through all modules and stop at the first working one.
foreach(_pkg_alt ${_pkg_modules_alt})
if(NOT _pkg_modules_found)
- _pkg_check_modules_internal(0 1 ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} "${_prefix}" "${_pkg_alt}")
+ _pkg_check_modules_internal(0 1 ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} ${_imp_target_global} "${_prefix}" "${_pkg_alt}")
endif()
if (${_prefix}_FOUND)
@@ -662,7 +677,7 @@ macro(pkg_search_module _prefix _module0)
_pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
elseif (${_prefix}_FOUND)
- _pkg_recalculate("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target})
+ _pkg_recalculate("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} ${_imp_target_global})
endif()
endmacro()
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index e1a715e..d6d1ec6 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -119,115 +119,140 @@
# ``ARGN``
# ``.proto`` filess
-function(PROTOBUF_GENERATE_CPP SRCS HDRS)
- cmake_parse_arguments(protobuf "" "EXPORT_MACRO;DESCRIPTORS" "" ${ARGN})
+function(protobuf_generate)
+ include(CMakeParseArguments)
- set(PROTO_FILES "${protobuf_UNPARSED_ARGUMENTS}")
- if(NOT PROTO_FILES)
- message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files")
+ set(_options APPEND_PATH DESCRIPTORS)
+ set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR)
+ if(COMMAND target_sources)
+ list(APPEND _singleargs TARGET)
+ endif()
+ set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS)
+
+ cmake_parse_arguments(protobuf_generate "${_options}" "${_singleargs}" "${_multiargs}" "${ARGN}")
+
+ if(NOT protobuf_generate_PROTOS AND NOT protobuf_generate_TARGET)
+ message(SEND_ERROR "Error: protobuf_generate called without any targets or source files")
return()
endif()
- if(protobuf_EXPORT_MACRO)
- set(DLL_EXPORT_DECL "dllexport_decl=${protobuf_EXPORT_MACRO}:")
+ if(NOT protobuf_generate_OUT_VAR AND NOT protobuf_generate_TARGET)
+ message(SEND_ERROR "Error: protobuf_generate called without a target or output variable")
+ return()
endif()
- if(PROTOBUF_GENERATE_CPP_APPEND_PATH)
- # Create an include path for each file specified
- foreach(FIL ${PROTO_FILES})
- get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
- get_filename_component(ABS_PATH ${ABS_FIL} PATH)
- list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
- if(${_contains_already} EQUAL -1)
- list(APPEND _protobuf_include_path -I ${ABS_PATH})
- endif()
- endforeach()
- else()
- set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
+ if(NOT protobuf_generate_LANGUAGE)
+ set(protobuf_generate_LANGUAGE cpp)
endif()
+ string(TOLOWER ${protobuf_generate_LANGUAGE} protobuf_generate_LANGUAGE)
- if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS)
- set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}")
+ if(NOT protobuf_generate_PROTOC_OUT_DIR)
+ set(protobuf_generate_PROTOC_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
endif()
- if(DEFINED Protobuf_IMPORT_DIRS)
- foreach(DIR ${Protobuf_IMPORT_DIRS})
- get_filename_component(ABS_PATH ${DIR} ABSOLUTE)
- list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
- if(${_contains_already} EQUAL -1)
- list(APPEND _protobuf_include_path -I ${ABS_PATH})
+ if(protobuf_generate_EXPORT_MACRO AND protobuf_generate_LANGUAGE STREQUAL cpp)
+ set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}:")
+ endif()
+
+ if(NOT protobuf_generate_GENERATE_EXTENSIONS)
+ if(protobuf_generate_LANGUAGE STREQUAL cpp)
+ set(protobuf_generate_GENERATE_EXTENSIONS .pb.h .pb.cc)
+ elseif(protobuf_generate_LANGUAGE STREQUAL python)
+ set(protobuf_generate_GENERATE_EXTENSIONS _pb2.py)
+ else()
+ message(SEND_ERROR "Error: protobuf_generate given unknown Language ${LANGUAGE}, please provide a value for GENERATE_EXTENSIONS")
+ return()
+ endif()
+ endif()
+
+ if(protobuf_generate_TARGET)
+ get_target_property(_source_list ${protobuf_generate_TARGET} SOURCES)
+ foreach(_file ${_source_list})
+ if(_file MATCHES "proto$")
+ list(APPEND protobuf_generate_PROTOS ${_file})
endif()
endforeach()
endif()
- set(${SRCS})
- set(${HDRS})
- if (protobuf_DESCRIPTORS)
- set(${protobuf_DESCRIPTORS})
+ if(NOT protobuf_generate_PROTOS)
+ message(SEND_ERROR "Error: protobuf_generate could not find any .proto files")
+ return()
endif()
- foreach(FIL ${PROTO_FILES})
- get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
- get_filename_component(FIL_WE ${FIL} NAME_WE)
- if(NOT PROTOBUF_GENERATE_CPP_APPEND_PATH)
- get_filename_component(FIL_DIR ${FIL} DIRECTORY)
- if(FIL_DIR)
- set(FIL_WE "${FIL_DIR}/${FIL_WE}")
+ if(protobuf_generate_APPEND_PATH)
+ # Create an include path for each file specified
+ foreach(_file ${protobuf_generate_PROTOS})
+ get_filename_component(_abs_file ${_file} ABSOLUTE)
+ get_filename_component(_abs_path ${_abs_file} PATH)
+ list(FIND _protobuf_include_path ${_abs_path} _contains_already)
+ if(${_contains_already} EQUAL -1)
+ list(APPEND _protobuf_include_path -I ${_abs_path})
endif()
+ endforeach()
+ else()
+ set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
+ endif()
+
+ foreach(DIR ${protobuf_generate_IMPORT_DIRS})
+ get_filename_component(ABS_PATH ${DIR} ABSOLUTE)
+ list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
+ if(${_contains_already} EQUAL -1)
+ list(APPEND _protobuf_include_path -I ${ABS_PATH})
endif()
+ endforeach()
- set(_protobuf_protoc_src "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc")
- set(_protobuf_protoc_hdr "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h")
- list(APPEND ${SRCS} "${_protobuf_protoc_src}")
- list(APPEND ${HDRS} "${_protobuf_protoc_hdr}")
+ set(_generated_srcs_all)
+ foreach(_proto ${protobuf_generate_PROTOS})
+ get_filename_component(_abs_file ${_proto} ABSOLUTE)
+ get_filename_component(_abs_dir ${_abs_file} DIRECTORY)
+ get_filename_component(_basename ${_proto} NAME_WE)
+ file(RELATIVE_PATH _rel_dir ${CMAKE_CURRENT_SOURCE_DIR} ${_abs_dir})
- if(protobuf_DESCRIPTORS)
- set(_protobuf_protoc_desc "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.desc")
- set(_protobuf_protoc_flags "--descriptor_set_out=${_protobuf_protoc_desc}")
- list(APPEND ${protobuf_DESCRIPTORS} "${_protobuf_protoc_desc}")
- else()
- set(_protobuf_protoc_desc "")
- set(_protobuf_protoc_flags "")
+ set(_generated_srcs)
+ foreach(_ext ${protobuf_generate_GENERATE_EXTENSIONS})
+ list(APPEND _generated_srcs "${protobuf_generate_PROTOC_OUT_DIR}/${_basename}${_ext}")
+ endforeach()
+
+ if(protobuf_generate_DESCRIPTORS AND protobuf_generate_LANGUAGE STREQUAL cpp)
+ set(_descriptor_file "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.desc")
+ set(_dll_desc_out "--descriptor_set_out=${_descriptor_file}")
+ list(APPEND _generated_srcs ${_descriptor_file})
endif()
+ list(APPEND _generated_srcs_all ${_generated_srcs})
add_custom_command(
- OUTPUT "${_protobuf_protoc_src}"
- "${_protobuf_protoc_hdr}"
- ${_protobuf_protoc_desc}
+ OUTPUT ${_generated_srcs}
COMMAND protobuf::protoc
- "--cpp_out=${DLL_EXPORT_DECL}${CMAKE_CURRENT_BINARY_DIR}"
- ${_protobuf_protoc_flags}
- ${_protobuf_include_path} ${ABS_FIL}
- DEPENDS ${ABS_FIL} protobuf::protoc
- COMMENT "Running C++ protocol buffer compiler on ${FIL}"
+ ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR} ${_dll_desc_out} ${_protobuf_include_path} ${_abs_file}
+ DEPENDS ${_abs_file} protobuf::protoc
+ COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}"
VERBATIM )
endforeach()
- set(${SRCS} "${${SRCS}}" PARENT_SCOPE)
- set(${HDRS} "${${HDRS}}" PARENT_SCOPE)
- if(protobuf_DESCRIPTORS)
- set(${protobuf_DESCRIPTORS} "${${protobuf_DESCRIPTORS}}" PARENT_SCOPE)
+ set_source_files_properties(${_generated_srcs_all} PROPERTIES GENERATED TRUE)
+ if(protobuf_generate_OUT_VAR)
+ set(${protobuf_generate_OUT_VAR} ${_generated_srcs_all} PARENT_SCOPE)
+ endif()
+ if(protobuf_generate_TARGET)
+ target_sources(${protobuf_generate_TARGET} PRIVATE ${_generated_srcs_all})
endif()
endfunction()
-function(PROTOBUF_GENERATE_PYTHON SRCS)
- if(NOT ARGN)
- message(SEND_ERROR "Error: PROTOBUF_GENERATE_PYTHON() called without any proto files")
+function(PROTOBUF_GENERATE_CPP SRCS HDRS)
+ cmake_parse_arguments(protobuf_generate_cpp "" "EXPORT_MACRO;DESCRIPTORS" "" ${ARGN})
+
+ set(_proto_files "${protobuf_generate_cpp_UNPARSED_ARGUMENTS}")
+ if(NOT _proto_files)
+ message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files")
return()
endif()
if(PROTOBUF_GENERATE_CPP_APPEND_PATH)
- # Create an include path for each file specified
- foreach(FIL ${ARGN})
- get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
- get_filename_component(ABS_PATH ${ABS_FIL} PATH)
- list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
- if(${_contains_already} EQUAL -1)
- list(APPEND _protobuf_include_path -I ${ABS_PATH})
- endif()
- endforeach()
- else()
- set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
+ set(_append_arg APPEND_PATH)
+ endif()
+
+ if(protobuf_generate_cpp_DESCRIPTORS)
+ set(_descriptors DESCRIPTORS)
endif()
if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS)
@@ -235,36 +260,55 @@ function(PROTOBUF_GENERATE_PYTHON SRCS)
endif()
if(DEFINED Protobuf_IMPORT_DIRS)
- foreach(DIR ${Protobuf_IMPORT_DIRS})
- get_filename_component(ABS_PATH ${DIR} ABSOLUTE)
- list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
- if(${_contains_already} EQUAL -1)
- list(APPEND _protobuf_include_path -I ${ABS_PATH})
- endif()
- endforeach()
+ set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS})
endif()
+ set(_outvar)
+ protobuf_generate(${_append_arg} ${_descriptors} LANGUAGE cpp EXPORT_MACRO ${protobuf_generate_cpp_EXPORT_MACRO} OUT_VAR _outvar ${_import_arg} PROTOS ${_proto_files})
+
set(${SRCS})
- foreach(FIL ${ARGN})
- get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
- get_filename_component(FIL_WE ${FIL} NAME_WE)
- if(NOT PROTOBUF_GENERATE_CPP_APPEND_PATH)
- get_filename_component(FIL_DIR ${FIL} DIRECTORY)
- if(FIL_DIR)
- set(FIL_WE "${FIL_DIR}/${FIL_WE}")
- endif()
- endif()
+ set(${HDRS})
+ if(protobuf_generate_cpp_DESCRIPTORS)
+ set(${protobuf_generate_cpp_DESCRIPTORS})
+ endif()
- list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py")
- add_custom_command(
- OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py"
- COMMAND protobuf::protoc --python_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL}
- DEPENDS ${ABS_FIL} protobuf::protoc
- COMMENT "Running Python protocol buffer compiler on ${FIL}"
- VERBATIM )
+ foreach(_file ${_outvar})
+ if(_file MATCHES "cc$")
+ list(APPEND ${SRCS} ${_file})
+ elseif(_file MATCHES "desc$")
+ list(APPEND ${protobuf_generate_cpp_DESCRIPTORS} ${_file})
+ else()
+ list(APPEND ${HDRS} ${_file})
+ endif()
endforeach()
-
set(${SRCS} ${${SRCS}} PARENT_SCOPE)
+ set(${HDRS} ${${HDRS}} PARENT_SCOPE)
+ if(protobuf_generate_cpp_DESCRIPTORS)
+ set(${protobuf_generate_cpp_DESCRIPTORS} "${${protobuf_generate_cpp_DESCRIPTORS}}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+function(PROTOBUF_GENERATE_PYTHON SRCS)
+ if(NOT ARGN)
+ message(SEND_ERROR "Error: PROTOBUF_GENERATE_PYTHON() called without any proto files")
+ return()
+ endif()
+
+ if(PROTOBUF_GENERATE_CPP_APPEND_PATH)
+ set(_append_arg APPEND_PATH)
+ endif()
+
+ if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS)
+ set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}")
+ endif()
+
+ if(DEFINED Protobuf_IMPORT_DIRS)
+ set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS})
+ endif()
+
+ set(_outvar)
+ protobuf_generate(${_append_arg} LANGUAGE python OUT_VAR _outvar ${_import_arg} PROTOS ${ARGN})
+ set(${SRCS} ${_outvar} PARENT_SCOPE)
endfunction()
diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake
index 51e68d5..55db7ae 100644
--- a/Modules/FindXercesC.cmake
+++ b/Modules/FindXercesC.cmake
@@ -59,6 +59,9 @@ function(_XercesC_GET_VERSION version_hdr)
endif()
set(XercesC_VERSION "${XercesC_MAJOR}.${XercesC_MINOR}.${XercesC_PATCH}" PARENT_SCOPE)
+ set(XercesC_VERSION_MAJOR "${XercesC_MAJOR}" PARENT_SCOPE)
+ set(XercesC_VERSION_MINOR "${XercesC_MINOR}" PARENT_SCOPE)
+ set(XercesC_VERSION_PATCH "${XercesC_PATCH}" PARENT_SCOPE)
else()
message(FATAL_ERROR "Include file ${version_hdr} does not exist or does not contain expected version information")
endif()
@@ -70,22 +73,26 @@ find_path(XercesC_INCLUDE_DIR
DOC "Xerces-C++ include directory")
mark_as_advanced(XercesC_INCLUDE_DIR)
+if(XercesC_INCLUDE_DIR)
+ _XercesC_GET_VERSION("${XercesC_INCLUDE_DIR}/xercesc/util/XercesVersion.hpp")
+endif()
+
if(NOT XercesC_LIBRARY)
# Find all XercesC libraries
find_library(XercesC_LIBRARY_RELEASE
- NAMES "xerces-c" "xerces-c_3"
+ NAMES "xerces-c" "xerces-c_${XercesC_VERSION_MAJOR}"
DOC "Xerces-C++ libraries (release)")
find_library(XercesC_LIBRARY_DEBUG
- NAMES "xerces-cd" "xerces-c_3D" "xerces-c_3_1D"
+ NAMES "xerces-cd" "xerces-c_${XercesC_VERSION_MAJOR}D" "xerces-c_${XercesC_VERSION_MAJOR}_${XercesC_VERSION_MINOR}D"
DOC "Xerces-C++ libraries (debug)")
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
select_library_configurations(XercesC)
mark_as_advanced(XercesC_LIBRARY_RELEASE XercesC_LIBRARY_DEBUG)
endif()
-if(XercesC_INCLUDE_DIR)
- _XercesC_GET_VERSION("${XercesC_INCLUDE_DIR}/xercesc/util/XercesVersion.hpp")
-endif()
+unset(XercesC_VERSION_MAJOR)
+unset(XercesC_VERSION_MINOR)
+unset(XercesC_VERSION_PATCH)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XercesC
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index a5c04ac..1a4635a 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -58,10 +58,12 @@ if(ZLIB_ROOT)
endif()
# Normal search.
+set(_ZLIB_x86 "(x86)")
set(_ZLIB_SEARCH_NORMAL
- PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]"
- "$ENV{PROGRAMFILES}/zlib"
- )
+ PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]"
+ "$ENV{ProgramFiles}/zlib"
+ "$ENV{ProgramFiles${_ZLIB_x86}}/zlib")
+unset(_ZLIB_x86)
list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL)
set(ZLIB_NAMES z zlib zdll zlib1)
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index d397791..ca71009 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -275,7 +275,6 @@ function(gp_item_default_embedded_path item default_embedded_path_var)
# as the executable by default:
#
set(path "@executable_path")
- set(overridden 0)
# On the Mac, relative to the executable depending on the type
# of the thing we are embedding:
@@ -294,20 +293,11 @@ function(gp_item_default_embedded_path item default_embedded_path_var)
#
set(path "@executable_path/../../Contents/MacOS")
- # Embed .dylibs right next to the main bundle executable:
+ # Embed frameworks and .dylibs in the embedded "Frameworks" directory
+ # (sibling of MacOS):
#
- if(item MATCHES "\\.dylib$")
- set(path "@executable_path/../MacOS")
- set(overridden 1)
- endif()
-
- # Embed frameworks in the embedded "Frameworks" directory (sibling of MacOS):
- #
- if(NOT overridden)
- if(item MATCHES "[^/]+\\.framework/")
- set(path "@executable_path/../Frameworks")
- set(overridden 1)
- endif()
+ if(item MATCHES "[^/]+\\.framework/" OR item MATCHES "\\.dylib$")
+ set(path "@executable_path/../Frameworks")
endif()
endif()
diff --git a/Modules/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake
index fdbae32..4ef4539 100644
--- a/Modules/CPackDeb.cmake
+++ b/Modules/Internal/CPack/CPackDeb.cmake
@@ -1,537 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CPackDeb
-# --------
-#
-# 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 :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.
-#
-# Here are some CPackDeb wiki resources that are here for historic reasons and
-# are no longer maintained but may still prove useful:
-#
-# - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/Configuration
-# - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/PackageGenerators#deb-unix-only
-#
-# List of CPackDEB specific variables:
-#
-# .. variable:: CPACK_DEB_COMPONENT_INSTALL
-#
-# Enable component packaging for CPackDEB
-#
-# * 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_DEBIAN_PACKAGE_NAME
-# CPACK_DEBIAN_<COMPONENT>_PACKAGE_NAME
-#
-# Set Package control field (variable is automatically transformed to lower
-# case).
-#
-# * Mandatory : YES
-# * Default :
-#
-# - :variable:`CPACK_PACKAGE_NAME` for non-component based
-# installations
-# - :variable:`CPACK_DEBIAN_PACKAGE_NAME` suffixed with -<COMPONENT>
-# for component-based installations.
-#
-# 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 either ``.deb`` or ``.ipk`` 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_EPOCH
-#
-# The Debian package epoch
-#
-# * Mandatory : No
-# * Default : -
-#
-# Optional number that should be incremented when changing versioning schemas
-# or fixing mistakes in the version numbers of older packages.
-#
-# .. variable:: CPACK_DEBIAN_PACKAGE_VERSION
-#
-# The Debian package version
-#
-# * Mandatory : YES
-# * Default : :variable:`CPACK_PACKAGE_VERSION`
-#
-# This variable may contain only alphanumerics (A-Za-z0-9) and the characters
-# . + - ~ (full stop, plus, hyphen, tilde) and should start with a digit. If
-# :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` is not set then hyphens are not
-# allowed.
-#
-# .. note::
-#
-# For backward compatibility with CMake 3.9 and lower a failed test of this
-# variable's content is not a hard error when both
-# :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` and
-# :variable:`CPACK_DEBIAN_PACKAGE_EPOCH` variables are not set. An author
-# warning is reported instead.
-#
-# .. variable:: CPACK_DEBIAN_PACKAGE_RELEASE
-#
-# The Debian package release - Debian revision number.
-#
-# * Mandatory : No
-# * Default : -
-#
-# This is the numbering of the DEB package itself, i.e. the version of the
-# packaging and not the version of the content (see
-# :variable:`CPACK_DEBIAN_PACKAGE_VERSION`). One may change the default value
-# if the previous packaging was buggy and/or you want to put here a fancy Linux
-# distro specific numbering.
-#
-# .. variable:: CPACK_DEBIAN_PACKAGE_ARCHITECTURE
-# CPACK_DEBIAN_<COMPONENT>_PACKAGE_ARCHITECTURE
-#
-# The Debian package architecture
-#
-# * Mandatory : YES
-# * 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
-#
-# Sets the Debian dependencies of this package.
-#
-# * Mandatory : NO
-# * Default :
-#
-# - An empty string for non-component based installations
-# - :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS` for component-based
-# installations.
-#
-# .. note::
-#
-# If :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` or
-# more specifically :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS`
-# is set for this component, the discovered dependencies will be appended
-# to :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` instead of
-# :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS`. If
-# :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` is an empty string,
-# only the automatically discovered dependencies will be set for this
-# component.
-#
-# Example::
-#
-# 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
-#
-# The Debian package maintainer
-#
-# * Mandatory : YES
-# * Default : :code:`CPACK_PACKAGE_CONTACT`
-#
-# .. variable:: CPACK_DEBIAN_PACKAGE_DESCRIPTION
-# CPACK_COMPONENT_<COMPONENT>_DESCRIPTION
-#
-# The Debian package description
-#
-# * Mandatory : YES
-# * Default :
-#
-# - :variable:`CPACK_DEBIAN_PACKAGE_DESCRIPTION` if set or
-# - :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`
-#
-#
-# .. variable:: CPACK_DEBIAN_PACKAGE_SECTION
-# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SECTION
-#
-# Set Section control field e.g. admin, devel, doc, ...
-#
-# * Mandatory : YES
-# * Default : "devel"
-#
-# See https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
-#
-# .. variable:: CPACK_DEBIAN_ARCHIVE_TYPE
-#
-# The archive format used for creating the Debian package.
-#
-# * Mandatory : YES
-# * Default : "paxr"
-#
-# Possible values are:
-#
-# - paxr
-# - gnutar
-#
-# .. note::
-#
-# Default pax archive format is the most portable format and generates
-# packages that do not treat sparse files specially.
-# GNU tar format on the other hand supports longer filenames.
-#
-# .. variable:: CPACK_DEBIAN_COMPRESSION_TYPE
-#
-# The compression used for creating the Debian package.
-#
-# * Mandatory : YES
-# * Default : "gzip"
-#
-# Possible values are:
-#
-# - lzma
-# - xz
-# - bzip2
-# - gzip
-#
-# .. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY
-# CPACK_DEBIAN_<COMPONENT>_PACKAGE_PRIORITY
-#
-# Set Priority control field e.g. required, important, standard, optional,
-# extra
-#
-# * Mandatory : YES
-# * 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
-# site from which the original source can be obtained and any additional
-# upstream documentation or information may be found.
-#
-# * Mandatory : NO
-# * Default : :variable:`CMAKE_PROJECT_HOMEPAGE_URL`
-#
-# .. note::
-#
-# 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
-#
-# May be set to ON in order to use :code:`dpkg-shlibdeps` to generate
-# better package dependency list.
-#
-# * Mandatory : NO
-# * Default :
-#
-# - :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` if set or
-# - OFF
-#
-# .. note::
-#
-# You may need set :variable:`CMAKE_INSTALL_RPATH` to an appropriate value
-# if you use this feature, because if you don't :code:`dpkg-shlibdeps`
-# may fail to find your own shared libs.
-# See https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling
-#
-# .. variable:: CPACK_DEBIAN_PACKAGE_DEBUG
-#
-# May be set when invoking cpack in order to trace debug information
-# during CPackDeb run.
-#
-# * Mandatory : NO
-# * Default : -
-#
-# .. variable:: CPACK_DEBIAN_PACKAGE_PREDEPENDS
-# CPACK_DEBIAN_<COMPONENT>_PACKAGE_PREDEPENDS
-#
-# Sets the `Pre-Depends` field of the Debian package.
-# Like :variable:`Depends <CPACK_DEBIAN_PACKAGE_DEPENDS>`, except that it
-# also forces :code:`dpkg` to complete installation of the packages named
-# before even starting the installation of the package which declares the
-# pre-dependency.
-#
-# * Mandatory : NO
-# * Default :
-#
-# - An empty string for non-component based installations
-# - :variable:`CPACK_DEBIAN_PACKAGE_PREDEPENDS` for component-based
-# installations.
-#
-# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-#
-# .. variable:: CPACK_DEBIAN_PACKAGE_ENHANCES
-# CPACK_DEBIAN_<COMPONENT>_PACKAGE_ENHANCES
-#
-# Sets the `Enhances` field of the Debian package.
-# Similar to :variable:`Suggests <CPACK_DEBIAN_PACKAGE_SUGGESTS>` but works
-# in the opposite direction: declares that a package can enhance the
-# functionality of another package.
-#
-# * Mandatory : NO
-# * Default :
-#
-# - An empty string for non-component based installations
-# - :variable:`CPACK_DEBIAN_PACKAGE_ENHANCES` for component-based
-# installations.
-#
-# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-#
-# .. variable:: CPACK_DEBIAN_PACKAGE_BREAKS
-# CPACK_DEBIAN_<COMPONENT>_PACKAGE_BREAKS
-#
-# Sets the `Breaks` field of the Debian package.
-# When a binary package (P) declares that it breaks other packages (B),
-# :code:`dpkg` will not allow the package (P) which declares `Breaks` be
-# **unpacked** unless the packages that will be broken (B) are deconfigured
-# first.
-# As long as the package (P) is configured, the previously deconfigured
-# packages (B) cannot be reconfigured again.
-#
-# * Mandatory : NO
-# * Default :
-#
-# - An empty string for non-component based installations
-# - :variable:`CPACK_DEBIAN_PACKAGE_BREAKS` for component-based
-# installations.
-#
-# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-breaks
-#
-# .. variable:: CPACK_DEBIAN_PACKAGE_CONFLICTS
-# CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONFLICTS
-#
-# Sets the `Conflicts` field of the Debian package.
-# When one binary package declares a conflict with another using a `Conflicts`
-# field, :code:`dpkg` will not allow them to be unpacked on the system at
-# the same time.
-#
-# * Mandatory : NO
-# * Default :
-#
-# - An empty string for non-component based installations
-# - :variable:`CPACK_DEBIAN_PACKAGE_CONFLICTS` for component-based
-# installations.
-#
-# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-conflicts
-#
-# .. note::
-#
-# This is a stronger restriction than
-# :variable:`Breaks <CPACK_DEBIAN_PACKAGE_BREAKS>`, which prevents the
-# broken package from being configured while the breaking package is in
-# the "Unpacked" state but allows both packages to be unpacked at the same
-# time.
-#
-# .. variable:: CPACK_DEBIAN_PACKAGE_PROVIDES
-# CPACK_DEBIAN_<COMPONENT>_PACKAGE_PROVIDES
-#
-# Sets the `Provides` field of the Debian package.
-# A virtual package is one which appears in the `Provides` control field of
-# another package.
-#
-# * Mandatory : NO
-# * Default :
-#
-# - An empty string for non-component based installations
-# - :variable:`CPACK_DEBIAN_PACKAGE_PROVIDES` for component-based
-# installations.
-#
-# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-virtual
-#
-# .. variable:: CPACK_DEBIAN_PACKAGE_REPLACES
-# CPACK_DEBIAN_<COMPONENT>_PACKAGE_REPLACES
-#
-# Sets the `Replaces` field of the Debian package.
-# Packages can declare in their control file that they should overwrite
-# files in certain other packages, or completely replace other packages.
-#
-# * Mandatory : NO
-# * Default :
-#
-# - An empty string for non-component based installations
-# - :variable:`CPACK_DEBIAN_PACKAGE_REPLACES` for component-based
-# installations.
-#
-# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-#
-# .. variable:: CPACK_DEBIAN_PACKAGE_RECOMMENDS
-# CPACK_DEBIAN_<COMPONENT>_PACKAGE_RECOMMENDS
-#
-# Sets the `Recommends` field of the Debian package.
-# Allows packages to declare a strong, but not absolute, dependency on other
-# packages.
-#
-# * Mandatory : NO
-# * Default :
-#
-# - An empty string for non-component based installations
-# - :variable:`CPACK_DEBIAN_PACKAGE_RECOMMENDS` for component-based
-# installations.
-#
-# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-#
-# .. variable:: CPACK_DEBIAN_PACKAGE_SUGGESTS
-# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SUGGESTS
-#
-# Sets the `Suggests` field of the Debian package.
-# Allows packages to declare a suggested package install grouping.
-#
-# * Mandatory : NO
-# * Default :
-#
-# - An empty string for non-component based installations
-# - :variable:`CPACK_DEBIAN_PACKAGE_SUGGESTS` for component-based
-# installations.
-#
-# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
-#
-# .. variable:: CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS
-#
-# * Mandatory : NO
-# * Default : OFF
-#
-# Allows to generate shlibs control file automatically. Compatibility is defined by
-# :variable:`CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY` variable value.
-#
-# .. note::
-#
-# Libraries are only considered if they have both library name and version
-# 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 : "="
-#
-# Defines compatibility policy for auto-generated shlibs control file.
-# Possible values: "=", ">="
-#
-# 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
-#
-# This variable allow advanced user to add custom script to the
-# control.tar.gz.
-# Typical usage is for conffiles, postinst, postrm, prerm.
-#
-# * Mandatory : NO
-# * Default : -
-#
-# Usage::
-#
-# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
-# "${CMAKE_CURRENT_SOURCE_DIR}/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
-#
-# .. note::
-#
-# The original permissions of the files will be used in the final
-# package unless the variable
-# :variable:`CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION` is set.
-# In particular, the scripts should have the proper executable
-# flag prior to the generation of the package.
-#
-# .. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION
-# CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONTROL_STRICT_PERMISSION
-#
-# This variable indicates if the Debian policy on control files should be
-# strictly followed.
-#
-# * Mandatory : NO
-# * Default : FALSE
-#
-# Usage::
-#
-# set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
-#
-# .. note::
-#
-# This overrides the permissions on the original files, following the rules
-# set by Debian policy
-# https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners
-#
-# .. variable:: CPACK_DEBIAN_PACKAGE_SOURCE
-# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SOURCE
-#
-# Sets the ``Source`` field of the binary Debian package.
-# When the binary package name is not the same as the source package name
-# (in particular when several components/binaries are generated from one
-# source) the source from which the binary has been generated should be
-# indicated with the field ``Source``.
-#
-# * Mandatory : NO
-# * Default :
-#
-# - An empty string for non-component based installations
-# - :variable:`CPACK_DEBIAN_PACKAGE_SOURCE` for component-based
-# installations.
-#
-# See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source
-#
-# .. note::
-#
-# This value is not interpreted. It is possible to pass an optional
-# revision number of the referenced source package as well.
-#
-# Building Debian packages on Windows
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# To communicate UNIX file permissions from the install stage
-# to the CPack DEB generator the "cmake_mode_t" NTFS
-# alternate data stream (ADT) is used.
-#
-# When a filesystem without ADT support is used only owner read/write
-# permissions can be preserved.
-
# CPack script for creating Debian package
# Author: Mathieu Malaterre
#
diff --git a/Modules/Internal/CPack/CPackExt.cmake b/Modules/Internal/CPack/CPackExt.cmake
new file mode 100644
index 0000000..e52d978
--- /dev/null
+++ b/Modules/Internal/CPack/CPackExt.cmake
@@ -0,0 +1,53 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+if(NOT "${CPACK_EXT_REQUESTED_VERSIONS}" STREQUAL "")
+ unset(_found_major)
+
+ foreach(_req_version IN LISTS CPACK_EXT_REQUESTED_VERSIONS)
+ if(_req_version MATCHES "^([0-9]+)\\.([0-9]+)$")
+ set(_req_major "${CMAKE_MATCH_1}")
+ set(_req_minor "${CMAKE_MATCH_2}")
+
+ foreach(_known_version IN LISTS CPACK_EXT_KNOWN_VERSIONS)
+ string(REGEX MATCH
+ "^([0-9]+)\\.([0-9]+)$"
+ _known_version_dummy
+ "${_known_version}"
+ )
+
+ set(_known_major "${CMAKE_MATCH_1}")
+ set(_known_minor "${CMAKE_MATCH_2}")
+
+ if(_req_major EQUAL _known_major AND NOT _known_minor LESS _req_minor)
+ set(_found_major "${_known_major}")
+ set(_found_minor "${_known_minor}")
+ break()
+ endif()
+ endforeach()
+
+ if(DEFINED _found_major)
+ break()
+ endif()
+ endif()
+ endforeach()
+
+ if(DEFINED _found_major)
+ set(CPACK_EXT_SELECTED_MAJOR "${_found_major}")
+ set(CPACK_EXT_SELECTED_MINOR "${_found_minor}")
+ set(CPACK_EXT_SELECTED_VERSION "${_found_major}.${_found_minor}")
+ else()
+ message(FATAL_ERROR
+ "Could not find a suitable version in CPACK_EXT_REQUESTED_VERSIONS"
+ )
+ endif()
+else()
+ list(GET CPACK_EXT_KNOWN_VERSIONS 0 CPACK_EXT_SELECTED_VERSION)
+ string(REGEX MATCH
+ "^([0-9]+)\\.([0-9]+)$"
+ _dummy
+ "${CPACK_EXT_SELECTED_VERSION}"
+ )
+ set(CPACK_EXT_SELECTED_MAJOR "${CMAKE_MATCH_1}")
+ set(CPACK_EXT_SELECTED_MINOR "${CMAKE_MATCH_2}")
+endif()
diff --git a/Modules/Internal/CPack/CPackFreeBSD.cmake b/Modules/Internal/CPack/CPackFreeBSD.cmake
new file mode 100644
index 0000000..16f906c
--- /dev/null
+++ b/Modules/Internal/CPack/CPackFreeBSD.cmake
@@ -0,0 +1,107 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+
+if(CMAKE_BINARY_DIR)
+ message(FATAL_ERROR "CPackFreeBSD.cmake may only be used by CPack internally.")
+endif()
+
+if(NOT UNIX)
+ message(FATAL_ERROR "CPackFreeBSD.cmake may only be used under UNIX.")
+endif()
+
+
+###
+#
+# These bits are copied from the Debian packaging file; slightly modified.
+# They are used for filling in FreeBSD-packaging variables that can take
+# on values from elsewhere -- e.g. the package description may as well be
+# copied from Debian.
+#
+function(_cpack_freebsd_fallback_var OUTPUT_VAR_NAME)
+ set(FALLBACK_VAR_NAMES ${ARGN})
+
+ set(VALUE "${${OUTPUT_VAR_NAME}}")
+ if(VALUE)
+ return()
+ endif()
+
+ foreach(variable_name IN LISTS FALLBACK_VAR_NAMES)
+ if(${variable_name})
+ set(${OUTPUT_VAR_NAME} "${${variable_name}}" PARENT_SCOPE)
+ set(VALUE "${${variable_name}}")
+ break()
+ endif()
+ endforeach()
+ if(NOT VALUE)
+ message(WARNING "Variable ${OUTPUT_VAR_NAME} could not be given a fallback value from any variable ${FALLBACK_VAR_NAMES}.")
+ endif()
+endfunction()
+
+function(check_required_var VAR_NAME)
+ if(NOT ${VAR_NAME})
+ message(FATAL_ERROR "Variable ${VAR_NAME} is not set.")
+ endif()
+endfunction()
+
+set(_cpack_freebsd_fallback_origin "misc/bogus")
+
+_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_NAME"
+ "CPACK_PACKAGE_NAME"
+ "CMAKE_PROJECT_NAME"
+ )
+
+set(_cpack_freebsd_fallback_www "http://example.com/?pkg=${CPACK_FREEBSD_PACKAGE_NAME}")
+
+_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_COMMENT"
+ "CPACK_PACKAGE_DESCRIPTION_SUMMARY"
+ )
+
+# TODO: maybe read the PACKAGE_DESCRIPTION file for the longer
+# FreeBSD pkg-descr?
+_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_DESCRIPTION"
+ "CPACK_DEBIAN_PACKAGE_DESCRIPTION"
+ "CPACK_PACKAGE_DESCRIPTION_SUMMARY"
+ "PACKAGE_DESCRIPTION"
+ )
+
+# There's really only one homepage for a project, so
+# re-use the Debian setting if it's there.
+_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_WWW"
+ "CMAKE_PROJECT_HOMEPAGE_URL"
+ "CPACK_DEBIAN_PACKAGE_HOMEPAGE"
+ "_cpack_freebsd_fallback_www"
+ )
+
+_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_VERSION"
+ "CMAKE_PROJECT_VERSION"
+ "${CMAKE_PROJECT_NAME}_VERSION"
+ "PROJECT_VERSION"
+ "CPACK_PACKAGE_VERSION"
+ "CPACK_PACKAGE_VERSION"
+ )
+
+_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_MAINTAINER"
+ "CPACK_PACKAGE_CONTACT"
+ )
+
+_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_LICENSE"
+ "CPACK_RPM_PACKAGE_LICENSE"
+ )
+
+_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_ORIGIN"
+ "_cpack_freebsd_fallback_origin"
+ )
+
+if(NOT CPACK_FREEBSD_PACKAGE_CATEGORIES)
+ string(REGEX REPLACE "/.*" "" CPACK_FREEBSD_PACKAGE_CATEGORIES ${CPACK_FREEBSD_PACKAGE_ORIGIN})
+endif()
+
+check_required_var("CPACK_FREEBSD_PACKAGE_NAME")
+check_required_var("CPACK_FREEBSD_PACKAGE_ORIGIN")
+check_required_var("CPACK_FREEBSD_PACKAGE_VERSION")
+check_required_var("CPACK_FREEBSD_PACKAGE_MAINTAINER")
+check_required_var("CPACK_FREEBSD_PACKAGE_COMMENT")
+check_required_var("CPACK_FREEBSD_PACKAGE_DESCRIPTION")
+check_required_var("CPACK_FREEBSD_PACKAGE_WWW")
+check_required_var("CPACK_FREEBSD_PACKAGE_LICENSE")
diff --git a/Modules/CPackNuGet.cmake b/Modules/Internal/CPack/CPackNuGet.cmake
index 05403bc..198ccad 100644
--- a/Modules/CPackNuGet.cmake
+++ b/Modules/Internal/CPack/CPackNuGet.cmake
@@ -1,199 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#[=======================================================================[.rst:
-CPackNuGet
-----------
-
-When build a NuGet package there is no direct way to control an output
-filename due a lack of the corresponding CLI option of NuGet, so there
-is no ``CPACK_NUGET_PACKAGE_FILENAME`` variable. To form the output filename
-NuGet uses the package name and the version according to its built-in rules.
-
-Also, be aware that including a top level directory
-(``CPACK_INCLUDE_TOPLEVEL_DIRECTORY``) is ignored by this generator.
-
-
-Variables specific to CPack NuGet generator
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-CPackNuGet may be used to create NuGet packages using :module:`CPack`.
-CPackNuGet is a :module:`CPack` generator thus it uses the ``CPACK_XXX``
-variables used by :module:`CPack`.
-
-CPackNuGet has specific features which are controlled by the specifics
-:code:`CPACK_NUGET_XXX` variables. In the "one per group" mode
-(see :variable:`CPACK_COMPONENTS_GROUPING`), ``<compName>`` placeholder
-in the variables below would contain a group name (uppercased and turned into
-a "C" identifier).
-
-List of CPackNuGet specific variables:
-
-.. variable:: CPACK_NUGET_COMPONENT_INSTALL
-
- Enable component packaging for CPackNuGet
-
- * Mandatory : NO
- * Default : OFF
-
-.. variable:: CPACK_NUGET_PACKAGE_NAME
- CPACK_NUGET_<compName>_PACKAGE_NAME
-
- The NUGET package name.
-
- * Mandatory : YES
- * Default : :variable:`CPACK_PACKAGE_NAME`
-
-.. variable:: CPACK_NUGET_PACKAGE_VERSION
- CPACK_NUGET_<compName>_PACKAGE_VERSION
-
- The NuGet package version.
-
- * Mandatory : YES
- * Default : :variable:`CPACK_PACKAGE_VERSION`
-
-.. variable:: CPACK_NUGET_PACKAGE_DESCRIPTION
- CPACK_NUGET_<compName>_PACKAGE_DESCRIPTION
-
- A long description of the package for UI display.
-
- * Mandatory : YES
- * Default :
- - :variable:`CPACK_COMPONENT_<compName>_DESCRIPTION`,
- - ``CPACK_COMPONENT_GROUP_<groupName>_DESCRIPTION``,
- - :variable:`CPACK_PACKAGE_DESCRIPTION`
-
-.. variable:: CPACK_NUGET_PACKAGE_AUTHORS
- CPACK_NUGET_<compName>_PACKAGE_AUTHORS
-
- A comma-separated list of packages authors, matching the profile names
- on nuget.org_. These are displayed in the NuGet Gallery on
- nuget.org_ and are used to cross-reference packages by the same
- authors.
-
- * Mandatory : YES
- * Default : :variable:`CPACK_PACKAGE_VENDOR`
-
-.. variable:: CPACK_NUGET_PACKAGE_TITLE
- CPACK_NUGET_<compName>_PACKAGE_TITLE
-
- A human-friendly title of the package, typically used in UI displays
- as on nuget.org_ and the Package Manager in Visual Studio. If not
- specified, the package ID is used.
-
- * Mandatory : NO
- * Default :
- - :variable:`CPACK_COMPONENT_<compName>_DISPLAY_NAME`,
- - ``CPACK_COMPONENT_GROUP_<groupName>_DISPLAY_NAME``
-
-.. variable:: CPACK_NUGET_PACKAGE_OWNERS
- CPACK_NUGET_<compName>_PACKAGE_OWNERS
-
- A comma-separated list of the package creators using profile names
- on nuget.org_. This is often the same list as in authors,
- and is ignored when uploading the package to nuget.org_.
-
- * Mandatory : NO
- * Default : -
-
-.. variable:: CPACK_NUGET_PACKAGE_HOMEPAGE_URL
- CPACK_NUGET_<compName>_PACKAGE_HOMEPAGE_URL
-
- A URL for the package's home page, often shown in UI displays as well
- as nuget.org_.
-
- * Mandatory : NO
- * Default : :variable:`CPACK_PACKAGE_HOMEPAGE_URL`
-
-.. variable:: CPACK_NUGET_PACKAGE_LICENSEURL
- CPACK_NUGET_<compName>_PACKAGE_LICENSEURL
-
- A URL for the package's license, often shown in UI displays as well
- as nuget.org_.
-
- * Mandatory : NO
- * Default : -
-
-.. variable:: CPACK_NUGET_PACKAGE_ICONURL
- CPACK_NUGET_<compName>_PACKAGE_ICONURL
-
- A URL for a 64x64 image with transparency background to use as the
- icon for the package in UI display.
-
- * Mandatory : NO
- * Default : -
-
-.. variable:: CPACK_NUGET_PACKAGE_DESCRIPTION_SUMMARY
- CPACK_NUGET_<compName>_PACKAGE_DESCRIPTION_SUMMARY
-
- A short description of the package for UI display. If omitted, a
- truncated version of description is used.
-
- * Mandatory : NO
- * Default : :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`
-
-.. variable:: CPACK_NUGET_PACKAGE_RELEASE_NOTES
- CPACK_NUGET_<compName>_PACKAGE_RELEASE_NOTES
-
- A description of the changes made in this release of the package,
- often used in UI like the Updates tab of the Visual Studio Package
- Manager in place of the package description.
-
- * Mandatory : NO
- * Default : -
-
-.. variable:: CPACK_NUGET_PACKAGE_COPYRIGHT
- CPACK_NUGET_<compName>_PACKAGE_COPYRIGHT
-
- Copyright details for the package.
-
- * Mandatory : NO
- * Default : -
-
-.. variable:: CPACK_NUGET_PACKAGE_TAGS
- CPACK_NUGET_<compName>_PACKAGE_TAGS
-
- A space-delimited list of tags and keywords that describe the
- package and aid discoverability of packages through search and
- filtering.
-
- * Mandatory : NO
- * Default : -
-
-.. variable:: CPACK_NUGET_PACKAGE_DEPENDENCIES
- CPACK_NUGET_<compName>_PACKAGE_DEPENDENCIES
-
- A list of package dependencies.
-
- * Mandatory : NO
- * Default : -
-
-.. variable:: CPACK_NUGET_PACKAGE_DEPENDENCIES_<dependency>_VERSION
- CPACK_NUGET_<compName>_PACKAGE_DEPENDENCIES_<dependency>_VERSION
-
- A `version specification`_ for the particular dependency, where
- ``<dependency>`` is an item of the dependency list (see above)
- transformed with ``MAKE_C_IDENTIFIER`` function of :command:`string`
- command.
-
- * Mandatory : NO
- * Default : -
-
-.. variable:: CPACK_NUGET_PACKAGE_DEBUG
-
- Enable debug messages while executing ``CPackNuGet.cmake``.
-
- * Mandatory : NO
- * Default : OFF
-
-
-.. _nuget.org: http://nuget.org
-.. _version specification: https://docs.microsoft.com/en-us/nuget/reference/package-versioning#version-ranges-and-wildcards
-
-.. NuGet spec docs https://docs.microsoft.com/en-us/nuget/reference/nuspec
-
-#]=======================================================================]
-
# Author: Alex Turbov
if(CMAKE_BINARY_DIR)
@@ -455,7 +262,7 @@ function(_cpack_nuget_render_spec)
# NuGet will name it properly.
_cpack_nuget_debug("Rendering `${CPACK_TEMPORARY_DIRECTORY}/CPack.NuGet.nuspec` file...")
configure_file(
- "${CMAKE_CURRENT_LIST_DIR}/CPack.NuGet.nuspec.in"
+ "${CMAKE_ROOT}/Modules/CPack.NuGet.nuspec.in"
"${CPACK_TEMPORARY_DIRECTORY}/CPack.NuGet.nuspec"
@ONLY
)
diff --git a/Modules/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake
index 60b3abe..06298d7 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/Internal/CPack/CPackRPM.cmake
@@ -1,963 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# CPackRPM
-# --------
-#
-# The built in (binary) CPack RPM generator (Unix only)
-#
-# Variables specific to CPack RPM generator
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# 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.
-#
-# :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 variables correspond to RPM spec file
-# entities. One may find information about spec files here
-# http://www.rpm.org/wiki/Docs
-#
-# .. note::
-#
-# `<COMPONENT>` part of variables is preferred to be in upper case (for e.g. if
-# component is named `foo` then use `CPACK_RPM_FOO_XXXX` variable name format)
-# as is with other `CPACK_<COMPONENT>_XXXX` variables.
-# For the purposes of back compatibility (CMake/CPack version 3.5 and lower)
-# support for same cased component (e.g. `fOo` would be used as
-# `CPACK_RPM_fOo_XXXX`) is still supported for variables defined in older
-# versions of CMake/CPack but is not guaranteed for variables that
-# will be added in the future. For the sake of back compatibility same cased
-# component variables also override upper cased versions where both are
-# present.
-#
-# Here are some CPackRPM wiki resources that are here for historic reasons and
-# are no longer maintained but may still prove useful:
-#
-# - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/Configuration
-# - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/PackageGenerators#rpm-unix-only
-#
-# List of CPackRPM specific variables:
-#
-# .. variable:: CPACK_RPM_COMPONENT_INSTALL
-#
-# 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
-#
-# The RPM package summary.
-#
-# * Mandatory : YES
-# * Default : :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`
-#
-# .. variable:: CPACK_RPM_PACKAGE_NAME
-# CPACK_RPM_<component>_PACKAGE_NAME
-#
-# The RPM package name.
-#
-# * Mandatory : YES
-# * Default : :variable:`CPACK_PACKAGE_NAME`
-#
-# .. variable:: CPACK_RPM_FILE_NAME
-# CPACK_RPM_<component>_FILE_NAME
-#
-# Package file name.
-#
-# * Mandatory : YES
-# * Default : ``<CPACK_PACKAGE_FILE_NAME>[-<component>].rpm`` with spaces
-# replaced by '-'
-#
-# 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.
-#
-# .. note::
-#
-# By using user provided spec file, rpm macro extensions such as for
-# generating debuginfo packages or by simply using multiple components more
-# than one rpm file may be generated, either from a single spec file or from
-# multiple spec files (each component execution produces it's own spec file).
-# In such cases duplicate file names may occur as a result of this variable
-# setting or spec file content structure. 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_RPM_MAIN_COMPONENT
-#
-# Main component that is packaged without component suffix.
-#
-# * Mandatory : NO
-# * Default : -
-#
-# This variable can be set to any component or group name so that component or
-# group rpm package is generated without component suffix in filename and
-# package name.
-#
-# .. variable:: CPACK_RPM_PACKAGE_EPOCH
-#
-# The RPM package epoch
-#
-# * Mandatory : No
-# * Default : -
-#
-# Optional number that should be incremented when changing versioning schemas
-# or fixing mistakes in the version numbers of older packages.
-#
-# .. variable:: CPACK_RPM_PACKAGE_VERSION
-#
-# The RPM package version.
-#
-# * Mandatory : YES
-# * Default : :variable:`CPACK_PACKAGE_VERSION`
-#
-# .. variable:: CPACK_RPM_PACKAGE_ARCHITECTURE
-# CPACK_RPM_<component>_PACKAGE_ARCHITECTURE
-#
-# The RPM package architecture.
-#
-# * Mandatory : YES
-# * Default : Native architecture output by ``uname -m``
-#
-# This may be set to ``noarch`` if you know you are building a noarch package.
-#
-# .. variable:: CPACK_RPM_PACKAGE_RELEASE
-#
-# The RPM package release.
-#
-# * Mandatory : YES
-# * Default : 1
-#
-# This is the numbering of the RPM package itself, i.e. the version of the
-# packaging and not the version of the content (see
-# :variable:`CPACK_RPM_PACKAGE_VERSION`). One may change the default value if
-# the previous packaging was buggy and/or you want to put here a fancy Linux
-# distro specific numbering.
-#
-# .. note::
-#
-# This is the string that goes into the RPM ``Release:`` field. Some distros
-# (e.g. Fedora, CentOS) require ``1%{?dist}`` format and not just a number.
-# ``%{?dist}`` part can be added by setting :variable:`CPACK_RPM_PACKAGE_RELEASE_DIST`.
-#
-# .. variable:: CPACK_RPM_PACKAGE_RELEASE_DIST
-#
-# The dist tag that is added RPM ``Release:`` field.
-#
-# * Mandatory : NO
-# * Default : OFF
-#
-# This is the reported ``%{dist}`` tag from the current distribution or empty
-# ``%{dist}`` if RPM macro is not set. If this variable is set then RPM
-# ``Release:`` field value is set to ``${CPACK_RPM_PACKAGE_RELEASE}%{?dist}``.
-#
-# .. variable:: CPACK_RPM_PACKAGE_LICENSE
-#
-# The RPM package license policy.
-#
-# * Mandatory : YES
-# * Default : "unknown"
-#
-# .. variable:: CPACK_RPM_PACKAGE_GROUP
-# CPACK_RPM_<component>_PACKAGE_GROUP
-#
-# The RPM package group.
-#
-# * Mandatory : YES
-# * Default : "unknown"
-#
-# .. variable:: CPACK_RPM_PACKAGE_VENDOR
-#
-# The RPM package vendor.
-#
-# * Mandatory : YES
-# * Default : CPACK_PACKAGE_VENDOR if set or "unknown"
-#
-# .. variable:: CPACK_RPM_PACKAGE_URL
-# CPACK_RPM_<component>_PACKAGE_URL
-#
-# The projects URL.
-#
-# * Mandatory : NO
-# * Default : :variable:`CMAKE_PROJECT_HOMEPAGE_URL`
-#
-# .. variable:: CPACK_RPM_PACKAGE_DESCRIPTION
-# CPACK_RPM_<component>_PACKAGE_DESCRIPTION
-#
-# RPM package description.
-#
-# * Mandatory : YES
-# * 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
-#
-# RPM compression type.
-#
-# * Mandatory : NO
-# * Default : -
-#
-# May be used to override RPM compression type to be used to build the
-# RPM. For example some Linux distribution now default to lzma or xz
-# compression whereas older cannot use such RPM. Using this one can enforce
-# compression type to be used.
-#
-# Possible values are:
-#
-# - lzma
-# - xz
-# - bzip2
-# - gzip
-#
-# .. variable:: CPACK_RPM_PACKAGE_AUTOREQ
-# CPACK_RPM_<component>_PACKAGE_AUTOREQ
-#
-# RPM spec autoreq field.
-#
-# * Mandatory : NO
-# * Default : -
-#
-# May be used to enable (1, yes) or disable (0, no) automatic shared libraries
-# dependency detection. Dependencies are added to requires list.
-#
-# .. note::
-#
-# By default automatic dependency detection is enabled by rpm generator.
-#
-# .. variable:: CPACK_RPM_PACKAGE_AUTOPROV
-# CPACK_RPM_<component>_PACKAGE_AUTOPROV
-#
-# RPM spec autoprov field.
-#
-# * Mandatory : NO
-# * Default : -
-#
-# May be used to enable (1, yes) or disable (0, no) automatic listing of shared
-# libraries that are provided by the package. Shared libraries are added to
-# provides list.
-#
-# .. note::
-#
-# By default automatic provides detection is enabled by rpm generator.
-#
-# .. variable:: CPACK_RPM_PACKAGE_AUTOREQPROV
-# CPACK_RPM_<component>_PACKAGE_AUTOREQPROV
-#
-# RPM spec autoreqprov field.
-#
-# * Mandatory : NO
-# * Default : -
-#
-# Variable enables/disables autoreq and autoprov at the same time.
-# See :variable:`CPACK_RPM_PACKAGE_AUTOREQ` and :variable:`CPACK_RPM_PACKAGE_AUTOPROV`
-# for more details.
-#
-# .. note::
-#
-# By default automatic detection feature is enabled by rpm.
-#
-# .. variable:: CPACK_RPM_PACKAGE_REQUIRES
-# CPACK_RPM_<component>_PACKAGE_REQUIRES
-#
-# RPM spec requires field.
-#
-# * Mandatory : NO
-# * Default : -
-#
-# May be used to set RPM dependencies (requires). Note that you must enclose
-# the complete requires string between quotes, for example::
-#
-# set(CPACK_RPM_PACKAGE_REQUIRES "python >= 2.5.0, cmake >= 2.8")
-#
-# The required package list of an RPM file could be printed with::
-#
-# rpm -qp --requires file.rpm
-#
-# .. variable:: CPACK_RPM_PACKAGE_CONFLICTS
-# CPACK_RPM_<component>_PACKAGE_CONFLICTS
-#
-# RPM spec conflicts field.
-#
-# * 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::
-#
-# set(CPACK_RPM_PACKAGE_CONFLICTS "libxml2")
-#
-# The conflicting package list of an RPM file could be printed with::
-#
-# rpm -qp --conflicts file.rpm
-#
-# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_PRE
-# CPACK_RPM_<component>_PACKAGE_REQUIRES_PRE
-#
-# RPM spec requires(pre) field.
-#
-# * 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::
-#
-# set(CPACK_RPM_PACKAGE_REQUIRES_PRE "shadow-utils, initscripts")
-#
-# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_POST
-# CPACK_RPM_<component>_PACKAGE_REQUIRES_POST
-#
-# RPM spec requires(post) field.
-#
-# * 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::
-#
-# set(CPACK_RPM_PACKAGE_REQUIRES_POST "shadow-utils, initscripts")
-#
-# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_POSTUN
-# CPACK_RPM_<component>_PACKAGE_REQUIRES_POSTUN
-#
-# RPM spec requires(postun) field.
-#
-# * 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::
-#
-# set(CPACK_RPM_PACKAGE_REQUIRES_POSTUN "shadow-utils, initscripts")
-#
-# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_PREUN
-# CPACK_RPM_<component>_PACKAGE_REQUIRES_PREUN
-#
-# RPM spec requires(preun) field.
-#
-# * 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::
-#
-# set(CPACK_RPM_PACKAGE_REQUIRES_PREUN "shadow-utils, initscripts")
-#
-# .. variable:: CPACK_RPM_PACKAGE_SUGGESTS
-# CPACK_RPM_<component>_PACKAGE_SUGGESTS
-#
-# RPM spec suggest field.
-#
-# * Mandatory : NO
-# * Default : -
-#
-# May be used to set weak RPM dependencies (suggests). Note that you must
-# enclose the complete requires string between quotes.
-#
-# .. variable:: CPACK_RPM_PACKAGE_PROVIDES
-# CPACK_RPM_<component>_PACKAGE_PROVIDES
-#
-# RPM spec provides field.
-#
-# * Mandatory : NO
-# * Default : -
-#
-# May be used to set RPM dependencies (provides). The provided package list
-# of an RPM file could be printed with::
-#
-# rpm -qp --provides file.rpm
-#
-# .. variable:: CPACK_RPM_PACKAGE_OBSOLETES
-# CPACK_RPM_<component>_PACKAGE_OBSOLETES
-#
-# RPM spec obsoletes field.
-#
-# * Mandatory : NO
-# * Default : -
-#
-# May be used to set RPM packages that are obsoleted by this one.
-#
-# .. variable:: CPACK_RPM_PACKAGE_RELOCATABLE
-#
-# build a relocatable RPM.
-#
-# * Mandatory : NO
-# * Default : CPACK_PACKAGE_RELOCATABLE
-#
-# If this variable is set to TRUE or ON CPackRPM will try
-# to build a relocatable RPM package. A relocatable RPM may
-# be installed using::
-#
-# rpm --prefix or --relocate
-#
-# in order to install it at an alternate place see rpm(8). Note that
-# currently this may fail if :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_SPEC_MORE_DEFINE` instead.
-#
-# * Mandatory : NO
-# * Default : -
-# * Deprecated: YES
-#
-# May be used to override the ``__spec_install_post`` section within the
-# generated spec file. This affects the install step during package creation,
-# not during package installation. For adding operations to be performed
-# during package installation, use
-# :variable:`CPACK_RPM_POST_INSTALL_SCRIPT_FILE` instead.
-#
-# .. variable:: CPACK_RPM_SPEC_MORE_DEFINE
-#
-# RPM extended spec definitions lines.
-#
-# * Mandatory : NO
-# * Default : -
-#
-# May be used to add any ``%define`` lines to the generated spec file. An
-# example of its use is to prevent stripping of executables (but note that
-# this may also disable other default post install processing)::
-#
-# set(CPACK_RPM_SPEC_MORE_DEFINE "%define __spec_install_post /bin/true")
-#
-# .. variable:: CPACK_RPM_PACKAGE_DEBUG
-#
-# Toggle CPackRPM debug output.
-#
-# * Mandatory : NO
-# * Default : -
-#
-# May be set when invoking cpack in order to trace debug information
-# during CPack RPM run. For example you may launch CPack like this::
-#
-# cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM
-#
-# .. variable:: CPACK_RPM_USER_BINARY_SPECFILE
-# CPACK_RPM_<componentName>_USER_BINARY_SPECFILE
-#
-# A user provided spec file.
-#
-# * Mandatory : NO
-# * Default : -
-#
-# May be set by the user in order to specify a USER binary spec file
-# to be used by CPackRPM instead of generating the file.
-# The specified file will be processed by configure_file( @ONLY).
-#
-# .. variable:: CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
-#
-# Spec file template.
-#
-# * Mandatory : NO
-# * Default : -
-#
-# If set CPack will generate a template for USER specified binary
-# spec file and stop with an error. For example launch CPack like this::
-#
-# cpack -D CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE=1 -G RPM
-#
-# The user may then use this file in order to hand-craft is own
-# binary spec file which may be used with
-# :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 referred script file (or both) will be read and directly
-# put after the ``%pre`` or ``%preun`` section
-# If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the (un)install
-# script for each component can be overridden with
-# ``CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE`` and
-# ``CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE``.
-# One may verify which scriptlet has been included with::
-#
-# rpm -qp --scripts package.rpm
-#
-# .. 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 referred script file (or both) will be read and directly
-# put after the ``%post`` or ``%postun`` section.
-# If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the (un)install
-# script for each component can be overridden with
-# ``CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE`` and
-# ``CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE``.
-# One may verify which scriptlet has been included with::
-#
-# rpm -qp --scripts package.rpm
-#
-# .. variable:: CPACK_RPM_USER_FILELIST
-# CPACK_RPM_<COMPONENT>_USER_FILELIST
-#
-# * Mandatory : NO
-# * Default : -
-#
-# May be used to explicitly specify ``%(<directive>)`` file line
-# in the spec file. Like ``%config(noreplace)`` or any other directive
-# that be found in the ``%files`` section. You can have multiple directives
-# per line, as in ``%attr(600,root,root) %config(noreplace)``. Since
-# CPackRPM is generating the list of files (and directories) the user
-# specified files of the ``CPACK_RPM_<COMPONENT>_USER_FILELIST`` list will
-# be removed from the generated list. If referring to directories do
-# not add a trailing slash.
-#
-# .. variable:: CPACK_RPM_CHANGELOG_FILE
-#
-# RPM changelog file.
-#
-# * Mandatory : NO
-# * Default : -
-#
-# May be used to embed a changelog in the spec file.
-# The referred file will be read and directly put after the ``%changelog``
-# section.
-#
-# .. variable:: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST
-#
-# list of path to be excluded.
-#
-# * Mandatory : NO
-# * Default : /etc /etc/init.d /usr /usr/bin /usr/include /usr/lib
-# /usr/libx32 /usr/lib64 /usr/share /usr/share/aclocal
-# /usr/share/doc
-#
-# May be used to exclude path (directories or files) from the auto-generated
-# list of paths discovered by CPack RPM. The default 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
-# :variable:`CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION` variable.
-#
-# .. variable:: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION
-#
-# additional list of path to be excluded.
-#
-# * Mandatory : NO
-# * Default : -
-#
-# May be used to add more exclude path (directories or files) from the initial
-# 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 :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 :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.
-#
-# .. 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 :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
-#
-# May be used to remove CPACK_PACKAGING_INSTALL_PREFIX and CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX
-# from relocatable RPM prefix paths.
-#
-# .. variable:: CPACK_RPM_ADDITIONAL_MAN_DIRS
-#
-# * Mandatory : NO
-# * Default : -
-#
-# May be used to set additional man dirs that could potentially be compressed
-# by brp-compress RPM macro. Variable content must be a list of regular
-# expressions that point to directories containing man files or to man files
-# directly. Note that in order to compress man pages a path must also be
-# present in brp-compress RPM script and that brp-compress script must be
-# added to RPM configuration by the operating system.
-#
-# Regular expressions that are added by default were taken from brp-compress
-# RPM macro:
-#
-# - /usr/man/man.*
-# - /usr/man/.*/man.*
-# - /usr/info.*
-# - /usr/share/man/man.*
-# - /usr/share/man/.*/man.*
-# - /usr/share/info.*
-# - /usr/kerberos/man.*
-# - /usr/X11R6/man/man.*
-# - /usr/lib/perl5/man/man.*
-# - /usr/share/doc/.*/man/man.*
-# - /usr/lib/.*/man/man.*
-#
-# .. variable:: CPACK_RPM_DEFAULT_USER
-# CPACK_RPM_<compName>_DEFAULT_USER
-#
-# default user ownership of RPM content
-#
-# * Mandatory : NO
-# * Default : root
-#
-# Value should be user name and not UID.
-# Note that <compName> must be in upper-case.
-#
-# .. variable:: CPACK_RPM_DEFAULT_GROUP
-# CPACK_RPM_<compName>_DEFAULT_GROUP
-#
-# default group ownership of RPM content
-#
-# * Mandatory : NO
-# * Default : root
-#
-# Value should be group name and not GID.
-# Note that <compName> must be in upper-case.
-#
-# .. variable:: CPACK_RPM_DEFAULT_FILE_PERMISSIONS
-# CPACK_RPM_<compName>_DEFAULT_FILE_PERMISSIONS
-#
-# default permissions used for packaged files
-#
-# * 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
-# - WORLD_EXECUTE
-#
-# Note that <compName> must be in upper-case.
-#
-# .. variable:: CPACK_RPM_DEFAULT_DIR_PERMISSIONS
-# CPACK_RPM_<compName>_DEFAULT_DIR_PERMISSIONS
-#
-# default permissions used for packaged directories
-#
-# * Mandatory : NO
-# * Default : - (system default)
-#
-# Accepted values are lists with PERMISSIONS. Valid permissions
-# are the same as for :variable:`CPACK_RPM_DEFAULT_FILE_PERMISSIONS`.
-# Note that <compName> must be in upper-case.
-#
-# .. variable:: CPACK_RPM_INSTALL_WITH_EXEC
-#
-# force execute permissions on programs and shared libraries
-#
-# * Mandatory : NO
-# * Default : - (system default)
-#
-# Force set owner, group and world execute permissions on programs and shared
-# libraries. This can be used for creating valid rpm packages on systems such
-# as Debian where shared libraries do not have execute permissions set.
-#
-# .. note::
-#
-# Programs and shared libraries without execute permissions are ignored during
-# separation of debug symbols from the binary for debuginfo packages.
-#
-# Packaging of Symbolic Links
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# CPackRPM supports packaging of symbolic links::
-#
-# execute_process(COMMAND ${CMAKE_COMMAND}
-# -E create_symlink <relative_path_location> <symlink_name>)
-# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/<symlink_name>
-# DESTINATION <symlink_location> COMPONENT libraries)
-#
-# Symbolic links will be optimized (paths will be shortened if possible)
-# before being added to the package or if multiple relocation paths are
-# detected, a post install symlink relocation script will be generated.
-#
-# Symbolic links may point to locations that are not packaged by the same
-# package (either a different component or even not packaged at all) but
-# those locations will be treated as if they were a part of the package
-# while determining if symlink should be either created or present in a
-# post install script - depending on relocation paths.
-#
-# Symbolic links that point to locations outside packaging path produce a
-# warning and are treated as non relocatable permanent symbolic links.
-#
-# 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
-# a different component are treated the same way as if pointing to location
-# that will not be packaged.
-#
-# * Symbolic links pointing to a location through one or more intermediate
-# symbolic links will not be handled differently - if the intermediate
-# symbolic link(s) is also on a relocatable path, relocating it during
-# package installation may cause initial symbolic link to point to an
-# invalid location.
-#
-# Packaging of debug information
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# Debuginfo packages contain debug symbols and sources for debugging packaged
-# binaries.
-#
-# Debuginfo RPM packaging has it's own set of variables:
-#
-# .. variable:: CPACK_RPM_DEBUGINFO_PACKAGE
-# CPACK_RPM_<component>_DEBUGINFO_PACKAGE
-#
-# Enable generation of debuginfo RPM package(s).
-#
-# * Mandatory : NO
-# * Default : OFF
-#
-# .. note::
-#
-# Binaries must contain debug symbols before packaging so use either ``Debug``
-# or ``RelWithDebInfo`` for :variable:`CMAKE_BUILD_TYPE` variable value.
-#
-# .. note::
-#
-# Packages generated from packages without binary files, with binary files but
-# without execute permissions or without debug symbols will cause packaging
-# termination.
-#
-# .. variable:: CPACK_BUILD_SOURCE_DIRS
-#
-# Provides locations of root directories of source files from which binaries
-# were built.
-#
-# * Mandatory : YES if :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is set
-# * Default : -
-#
-# .. note::
-#
-# For CMake project :variable:`CPACK_BUILD_SOURCE_DIRS` is set by default to
-# point to :variable:`CMAKE_SOURCE_DIR` and :variable:`CMAKE_BINARY_DIR` paths.
-#
-# .. note::
-#
-# Sources with path prefixes that do not fall under any location provided with
-# :variable:`CPACK_BUILD_SOURCE_DIRS` will not be present in debuginfo package.
-#
-# .. variable:: CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX
-# CPACK_RPM_<component>_BUILD_SOURCE_DIRS_PREFIX
-#
-# Prefix of location where sources will be placed during package installation.
-#
-# * Mandatory : YES if :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is set
-# * Default : "/usr/src/debug/<CPACK_PACKAGE_FILE_NAME>" and
-# for component packaging "/usr/src/debug/<CPACK_PACKAGE_FILE_NAME>-<component>"
-#
-# .. note::
-#
-# Each source path prefix is additionally suffixed by ``src_<index>`` where
-# index is index of the path used from :variable:`CPACK_BUILD_SOURCE_DIRS`
-# variable. This produces ``<CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX>/src_<index>``
-# replacement path.
-# Limitation is that replaced path part must be shorter or of equal
-# length than the length of its replacement. If that is not the case either
-# :variable:`CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX` variable has to be set to
-# a shorter path or source directories must be placed on a longer path.
-#
-# .. variable:: CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS
-#
-# Directories containing sources that should be excluded from debuginfo packages.
-#
-# * Mandatory : NO
-# * Default : "/usr /usr/src /usr/src/debug"
-#
-# Listed paths are owned by other RPM packages and should therefore not be
-# deleted on debuginfo package uninstallation.
-#
-# .. variable:: CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS_ADDITION
-#
-# Paths that should be appended to :variable:`CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS`
-# for exclusion.
-#
-# * Mandatory : NO
-# * Default : -
-#
-# .. variable:: CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE
-#
-# Create a single debuginfo package even if components packaging is set.
-#
-# * Mandatory : NO
-# * Default : OFF
-#
-# When this variable is enabled it produces a single debuginfo package even if
-# component packaging is enabled.
-#
-# When using this feature in combination with components packaging and there is
-# more than one component this variable requires :variable:`CPACK_RPM_MAIN_COMPONENT`
-# to be set.
-#
-# .. note::
-#
-# If none of the :variable:`CPACK_RPM_<component>_DEBUGINFO_PACKAGE` variables
-# is set then :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is automatically set to
-# ``ON`` when :variable:`CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE` is set.
-#
-# .. variable:: CPACK_RPM_DEBUGINFO_FILE_NAME
-# CPACK_RPM_<component>_DEBUGINFO_FILE_NAME
-#
-# Debuginfo package file name.
-#
-# * Mandatory : NO
-# * Default : rpmbuild tool generated package file name
-#
-# Alternatively provided debuginfo package file name must end with ``.rpm``
-# suffix and should differ from file names of other generated packages.
-#
-# Variable may contain ``@cpack_component@`` placeholder which will be
-# replaced by component name if component packaging is enabled otherwise it
-# deletes the placeholder.
-#
-# Setting the variable to ``RPM-DEFAULT`` may be used to explicitly set
-# filename generation to default.
-#
-# .. note::
-#
-# :variable:`CPACK_RPM_FILE_NAME` also supports rpmbuild tool generated package
-# file name - disabled by default but can be enabled by setting the variable to
-# ``RPM-DEFAULT``.
-#
-# Packaging of sources (SRPM)
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# SRPM packaging is enabled by setting :variable:`CPACK_RPM_PACKAGE_SOURCES`
-# variable while usually using :variable:`CPACK_INSTALLED_DIRECTORIES` variable
-# to provide directory containing CMakeLists.txt and source files.
-#
-# For CMake projects SRPM package would be produced by executing::
-#
-# cpack -G RPM --config ./CPackSourceConfig.cmake
-#
-# .. note::
-#
-# Produced SRPM package is expected to be built with :manual:`cmake(1)` executable
-# and packaged with :manual:`cpack(1)` executable so CMakeLists.txt has to be
-# located in root source directory and must be able to generate binary rpm
-# packages by executing ``cpack -G`` command. The two executables as well as
-# rpmbuild must also be present when generating binary rpm packages from the
-# produced SRPM package.
-#
-# Once the SRPM package is generated it can be used to generate binary packages
-# by creating a directory structure for rpm generation and executing rpmbuild
-# tool::
-#
-# mkdir -p build_dir/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
-# rpmbuild --define "_topdir <path_to_build_dir>" --rebuild <SRPM_file_name>
-#
-# Generated packages will be located in build_dir/RPMS directory or its sub
-# directories.
-#
-# .. note::
-#
-# SRPM package internally uses CPack/RPM generator to generate binary packages
-# so CMakeScripts.txt can decide during the SRPM to binary rpm generation step
-# what content the package(s) should have as well as how they should be packaged
-# (monolithic or components). CMake can decide this for e.g. by reading environment
-# variables set by the package manager before starting the process of generating
-# binary rpm packages. This way a single SRPM package can be used to produce
-# different binary rpm packages on different platforms depending on the platform's
-# packaging rules.
-#
-# Source RPM packaging has it's own set of variables:
-#
-# .. variable:: CPACK_RPM_PACKAGE_SOURCES
-#
-# Should the content be packaged as a source rpm (default is binary rpm).
-#
-# * Mandatory : NO
-# * Default : OFF
-#
-# .. note::
-#
-# For cmake projects :variable:`CPACK_RPM_PACKAGE_SOURCES` variable is set
-# to ``OFF`` in CPackConfig.cmake and ``ON`` in CPackSourceConfig.cmake
-# generated files.
-#
-# .. variable:: CPACK_RPM_SOURCE_PKG_BUILD_PARAMS
-#
-# Additional command-line parameters provided to :manual:`cmake(1)` executable.
-#
-# * Mandatory : NO
-# * Default : -
-#
-# .. variable:: CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX
-#
-# Packaging install prefix that would be provided in :variable:`CPACK_PACKAGING_INSTALL_PREFIX`
-# variable for producing binary RPM packages.
-#
-# * Mandatory : YES
-# * Default : "/"
-#
-# .. VARIABLE:: CPACK_RPM_BUILDREQUIRES
-#
-# List of source rpm build dependencies.
-#
-# * Mandatory : NO
-# * Default : -
-#
-# May be used to set source RPM build dependencies (BuildRequires). Note that
-# you must enclose the complete build requirements string between quotes, for
-# example::
-#
-# set(CPACK_RPM_BUILDREQUIRES "python >= 2.5.0, cmake >= 2.8")
-
# Author: Eric Noulard with the help of Alexander Neundorf.
function(get_file_permissions FILE RETURN_VAR)
@@ -2482,7 +1525,7 @@ ${TMP_DEBUGINFO_ADDITIONAL_SOURCES}
%build
mkdir cpack_rpm_build_dir
cd cpack_rpm_build_dir
-cmake ${CPACK_RPM_SOURCE_PKG_BUILD_PARAMS} -DCPACK_PACKAGING_INSTALL_PREFIX=${CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX} ../${CPACK_PACKAGE_FILE_NAME}
+'${CMAKE_COMMAND}' ${CPACK_RPM_SOURCE_PKG_BUILD_PARAMS} -DCPACK_PACKAGING_INSTALL_PREFIX=${CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX} ../${CPACK_PACKAGE_FILE_NAME}
make %{?_smp_mflags}" # %{?_smp_mflags} -> -j option
)
set(TMP_RPM_INSTALL
diff --git a/Modules/Internal/CPack/CPackWIX.cmake b/Modules/Internal/CPack/CPackWIX.cmake
new file mode 100644
index 0000000..d1875f2
--- /dev/null
+++ b/Modules/Internal/CPack/CPackWIX.cmake
@@ -0,0 +1,20 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+if(NOT CPACK_WIX_ROOT)
+ string(REPLACE "\\" "/" CPACK_WIX_ROOT "$ENV{WIX}")
+endif()
+
+find_program(CPACK_WIX_CANDLE_EXECUTABLE candle
+ PATHS "${CPACK_WIX_ROOT}" PATH_SUFFIXES "bin")
+
+if(NOT CPACK_WIX_CANDLE_EXECUTABLE)
+ message(FATAL_ERROR "Could not find the WiX candle executable.")
+endif()
+
+find_program(CPACK_WIX_LIGHT_EXECUTABLE light
+ PATHS "${CPACK_WIX_ROOT}" PATH_SUFFIXES "bin")
+
+if(NOT CPACK_WIX_LIGHT_EXECUTABLE)
+ message(FATAL_ERROR "Could not find the WiX light executable.")
+endif()
diff --git a/Modules/CPackZIP.cmake b/Modules/Internal/CPack/CPackZIP.cmake
index 376520c..f619de4 100644
--- a/Modules/CPackZIP.cmake
+++ b/Modules/Internal/CPack/CPackZIP.cmake
@@ -28,4 +28,3 @@ if(NOT ZIP_EXECUTABLE)
set(CPACK_ZIP_NEED_QUOTES FALSE)
endif()
endif()
-
diff --git a/Modules/Platform/Android-Common.cmake b/Modules/Platform/Android-Common.cmake
index 80a8f41..f8b9346 100644
--- a/Modules/Platform/Android-Common.cmake
+++ b/Modules/Platform/Android-Common.cmake
@@ -32,8 +32,10 @@ if(CMAKE_ANDROID_NDK)
)
endif()
unset(_ANDROID_STL_TYPE_FOUND)
- else()
+ elseif(IS_DIRECTORY ${CMAKE_ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++)
set(CMAKE_ANDROID_STL_TYPE "gnustl_static")
+ else()
+ set(CMAKE_ANDROID_STL_TYPE "c++_static")
endif()
unset(_ANDROID_STL_TYPES)
diff --git a/Modules/Platform/Android/Determine-Compiler-NDK.cmake b/Modules/Platform/Android/Determine-Compiler-NDK.cmake
index 0649925..5f2cc52 100644
--- a/Modules/Platform/Android/Determine-Compiler-NDK.cmake
+++ b/Modules/Platform/Android/Determine-Compiler-NDK.cmake
@@ -35,7 +35,18 @@ elseif(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION)
endif()
set(_ANDROID_TOOL_PATTERNS "*-${CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION}")
else()
- set(_ANDROID_TOOL_PATTERNS "*-[0-9].[0-9]")
+ # If we can find any gcc toolchains then use one by default.
+ # Otherwise we look for clang toolchains (e.g. NDK r18+).
+ file(GLOB _ANDROID_CONFIG_MKS_FOR_GCC
+ "${CMAKE_ANDROID_NDK}/build/core/toolchains/*-[0-9].[0-9]/config.mk"
+ "${CMAKE_ANDROID_NDK}/toolchains/*-[0-9].[0-9]/config.mk"
+ )
+ if(_ANDROID_CONFIG_MKS_FOR_GCC)
+ set(_ANDROID_TOOL_PATTERNS "*-[0-9].[0-9]")
+ else()
+ set(_ANDROID_TOOL_PATTERNS "*-clang")
+ endif()
+ unset(_ANDROID_CONFIG_MKS_FOR_GCC)
endif()
set(_ANDROID_CONFIG_MK_PATTERNS)
foreach(base "build/core/toolchains" "toolchains")
diff --git a/Modules/Platform/Apple-Intel.cmake b/Modules/Platform/Apple-Intel.cmake
index 2d4f7e5..a854be9 100644
--- a/Modules/Platform/Apple-Intel.cmake
+++ b/Modules/Platform/Apple-Intel.cmake
@@ -10,6 +10,9 @@ macro(__apple_compiler_intel lang)
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
+
if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0)
set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
endif()
diff --git a/Modules/Platform/GHS-MULTI-Initialize.cmake b/Modules/Platform/GHS-MULTI-Initialize.cmake
index bf61d7b..9b384df 100644
--- a/Modules/Platform/GHS-MULTI-Initialize.cmake
+++ b/Modules/Platform/GHS-MULTI-Initialize.cmake
@@ -1,40 +1,44 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
+#Setup Green Hills MULTI specific compilation information
-#Setup Greenhills MULTI specific compilation information
-
-if (NOT GHS_INT_DIRECTORY)
- #Assume the C:/ghs/int#### directory that is latest is preferred
- set(GHS_EXPECTED_ROOT "C:/ghs")
- if (EXISTS ${GHS_EXPECTED_ROOT})
- FILE(GLOB GHS_CANDIDATE_INT_DIRS RELATIVE
- ${GHS_EXPECTED_ROOT} ${GHS_EXPECTED_ROOT}/*)
- string(REGEX MATCHALL "int[0-9][0-9][0-9][0-9a-z]" GHS_CANDIDATE_INT_DIRS
- ${GHS_CANDIDATE_INT_DIRS})
- if (GHS_CANDIDATE_INT_DIRS)
- list(SORT GHS_CANDIDATE_INT_DIRS)
- list(GET GHS_CANDIDATE_INT_DIRS -1 GHS_INT_DIRECTORY)
- string(CONCAT GHS_INT_DIRECTORY ${GHS_EXPECTED_ROOT} "/"
- ${GHS_INT_DIRECTORY})
+set(GHS_OS_ROOT "C:/ghs" CACHE PATH "GHS platform OS search root directory")
+mark_as_advanced(GHS_OS_ROOT)
+
+set(GHS_OS_DIR "NOTFOUND" CACHE PATH "GHS platform OS directory")
+mark_as_advanced(GHS_OS_DIR)
+
+#set GHS_OS_DIR if not set by user
+if ( NOT GHS_OS_DIR )
+ if (EXISTS ${GHS_OS_ROOT})
+
+ #get all directories in root directory
+ FILE(GLOB GHS_CANDIDATE_OS_DIRS
+ LIST_DIRECTORIES true RELATIVE ${GHS_OS_ROOT} ${GHS_OS_ROOT}/*)
+ FILE(GLOB GHS_CANDIDATE_OS_FILES
+ LIST_DIRECTORIES false RELATIVE ${GHS_OS_ROOT} ${GHS_OS_ROOT}/*)
+ if ( GHS_CANDIDATE_OS_FILES )
+ list(REMOVE_ITEM GHS_CANDIDATE_OS_DIRS ${GHS_CANDIDATE_OS_FILES})
endif ()
- endif ()
- #Try to look for known registry values
- if (NOT GHS_INT_DIRECTORY)
- find_path(GHS_INT_DIRECTORY INTEGRITY.ld PATHS
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware6433c345;InstallLocation]" #int1122
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware289b6625;InstallLocation]" #int1104
- )
- endif ()
+ #filter based on platform name
+ if (GHS_TARGET_PLATFORM STREQUAL "integrity")
+ list(FILTER GHS_CANDIDATE_OS_DIRS INCLUDE REGEX "int[0-9][0-9][0-9][0-9a-z].*")
+ endif ()
+
+ if (GHS_CANDIDATE_OS_DIRS)
+ list(SORT GHS_CANDIDATE_OS_DIRS)
+ list(GET GHS_CANDIDATE_OS_DIRS -1 GHS_OS_DIR)
+ string(CONCAT GHS_OS_DIR ${GHS_OS_ROOT} "/" ${GHS_OS_DIR})
+ endif()
- set(GHS_INT_DIRECTORY ${GHS_INT_DIRECTORY} CACHE PATH
- "Path to integrity directory")
+ set(GHS_OS_DIR "${GHS_OS_DIR}" CACHE PATH "GHS platform OS directory" FORCE)
+ endif ()
endif ()
-set(GHS_OS_DIR ${GHS_INT_DIRECTORY} CACHE PATH "OS directory")
-set(GHS_PRIMARY_TARGET "arm_integrity.tgt" CACHE STRING "target for compilation")
-set(GHS_BSP_NAME "simarm" CACHE STRING "BSP name")
+set(GHS_BSP_NAME "IGNORE" CACHE STRING "BSP name")
+
set(GHS_CUSTOMIZATION "" CACHE FILEPATH "optional GHS customization")
mark_as_advanced(GHS_CUSTOMIZATION)
set(GHS_GPJ_MACROS "" CACHE STRING "optional GHS macros generated in the .gpjs for legacy reasons")
diff --git a/Modules/Platform/Generic-ADSP-C.cmake b/Modules/Platform/Generic-ADSP-C.cmake
index de1cee2..c8597cd 100644
--- a/Modules/Platform/Generic-ADSP-C.cmake
+++ b/Modules/Platform/Generic-ADSP-C.cmake
@@ -9,6 +9,9 @@ string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " ")
string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " ")
string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " ")
+set(CMAKE_C_LINKER_WRAPPER_FLAG "-flags-link" " ")
+set(CMAKE_C_LINKER_WRAPPER_FLAG_SEP ",")
+
set(CMAKE_C_CREATE_STATIC_LIBRARY
"<CMAKE_C_COMPILER> -build-lib -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o <TARGET> <CMAKE_C_LINK_FLAGS> <OBJECTS>")
@@ -17,4 +20,3 @@ set(CMAKE_C_LINK_EXECUTABLE
set(CMAKE_C_CREATE_SHARED_LIBRARY)
set(CMAKE_C_CREATE_MODULE_LIBRARY)
-
diff --git a/Modules/Platform/Generic-ADSP-CXX.cmake b/Modules/Platform/Generic-ADSP-CXX.cmake
index 0cde8f2..d76bb66 100644
--- a/Modules/Platform/Generic-ADSP-CXX.cmake
+++ b/Modules/Platform/Generic-ADSP-CXX.cmake
@@ -7,6 +7,9 @@ string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " ")
string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " ")
string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT " ")
+set(CMAKE_CXX_LINKER_WRAPPER_FLAG "-flags-link" " ")
+set(CMAKE_CXX_LINKER_WRAPPER_FLAG_SEP ",")
+
set(CMAKE_CXX_CREATE_STATIC_LIBRARY
"<CMAKE_CXX_COMPILER> -build-lib -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o <TARGET> <CMAKE_CXX_LINK_FLAGS> <OBJECTS>")
@@ -15,4 +18,3 @@ set(CMAKE_CXX_LINK_EXECUTABLE
set(CMAKE_CXX_CREATE_SHARED_LIBRARY)
set(CMAKE_CXX_CREATE_MODULE_LIBRARY)
-
diff --git a/Modules/Platform/Generic-SDCC-C.cmake b/Modules/Platform/Generic-SDCC-C.cmake
index 4b3912a..aef4abf 100644
--- a/Modules/Platform/Generic-SDCC-C.cmake
+++ b/Modules/Platform/Generic-SDCC-C.cmake
@@ -37,6 +37,8 @@ if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_INIT)
set (CMAKE_EXE_LINKER_FLAGS_INIT --model-small)
endif()
+set(CMAKE_C_LINKER_WRAPPER_FLAG "-Wl" ",")
+
# compile a C file into an object file
set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
@@ -51,4 +53,3 @@ set(CMAKE_C_CREATE_STATIC_LIBRARY
# not supported by sdcc
set(CMAKE_C_CREATE_SHARED_LIBRARY "")
set(CMAKE_C_CREATE_MODULE_LIBRARY "")
-
diff --git a/Modules/Platform/Linux-Intel.cmake b/Modules/Platform/Linux-Intel.cmake
index ee9aac2..f712e2b 100644
--- a/Modules/Platform/Linux-Intel.cmake
+++ b/Modules/Platform/Linux-Intel.cmake
@@ -30,6 +30,9 @@ macro(__linux_compiler_intel lang)
# executables that use dlopen but do not set ENABLE_EXPORTS.
set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-rdynamic")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
+
set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
if(XIAR)
diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake
index f8e1c9e..48b936e 100644
--- a/Modules/Platform/Windows-Embarcadero.cmake
+++ b/Modules/Platform/Windows-Embarcadero.cmake
@@ -76,6 +76,8 @@ macro(__embarcadero_language lang)
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "${_tD}") # ... while this is a space separated string.
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1)
+ set (CMAKE_${lang}_LINKER_WRAPPER_FLAG "-l")
+
# compile a source file into an object file
# place <DEFINES> outside the response file because Borland refuses
# to parse quotes from the response file.
diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake
index ba31001..96b1760 100644
--- a/Modules/Platform/Windows-Intel.cmake
+++ b/Modules/Platform/Windows-Intel.cmake
@@ -11,7 +11,7 @@ set(__WINDOWS_INTEL 1)
include(Platform/Windows-MSVC)
macro(__windows_compiler_intel lang)
__windows_compiler_msvc(${lang})
- string(REPLACE "<CMAKE_LINKER> /lib" "lib" CMAKE_${lang}_CREATE_STATIC_LIBRARY "${CMAKE_${lang}_CREATE_STATIC_LIBRARY}")
+ string(REPLACE "<CMAKE_LINKER> /lib" "xilib" CMAKE_${lang}_CREATE_STATIC_LIBRARY "${CMAKE_${lang}_CREATE_STATIC_LIBRARY}")
foreach(rule CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE)
string(REPLACE "<CMAKE_LINKER>" "xilink" CMAKE_${lang}_${rule} "${CMAKE_${lang}_${rule}}")
endforeach()
diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
index f1c1f2d..ba1638f 100644
--- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake
+++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
@@ -44,7 +44,7 @@ if(__IMPLICT_DLINK_DIRS)
endif()
set(__IMPLICT_DLINK_FLAGS )
foreach(dir ${__IMPLICT_DLINK_DIRS})
- if(EXISTS "${dir}/cublas_device.lib")
+ if(EXISTS "${dir}/curand_static.lib")
string(APPEND __IMPLICT_DLINK_FLAGS " -L\"${dir}\"")
endif()
endforeach()
diff --git a/Modules/Platform/WindowsPhone-Clang-C.cmake b/Modules/Platform/WindowsPhone-Clang-C.cmake
new file mode 100644
index 0000000..6e38572
--- /dev/null
+++ b/Modules/Platform/WindowsPhone-Clang-C.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-Clang-C)
diff --git a/Modules/Platform/WindowsPhone-Clang-CXX.cmake b/Modules/Platform/WindowsPhone-Clang-CXX.cmake
new file mode 100644
index 0000000..bf47978
--- /dev/null
+++ b/Modules/Platform/WindowsPhone-Clang-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-Clang-CXX)
diff --git a/Modules/Platform/WindowsPhone-GNU-C.cmake b/Modules/Platform/WindowsPhone-GNU-C.cmake
new file mode 100644
index 0000000..ff6acd5
--- /dev/null
+++ b/Modules/Platform/WindowsPhone-GNU-C.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-GNU-C)
diff --git a/Modules/Platform/WindowsPhone-GNU-CXX.cmake b/Modules/Platform/WindowsPhone-GNU-CXX.cmake
new file mode 100644
index 0000000..6adab6a
--- /dev/null
+++ b/Modules/Platform/WindowsPhone-GNU-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-GNU-CXX)
diff --git a/Modules/Platform/WindowsStore-Clang-C.cmake b/Modules/Platform/WindowsStore-Clang-C.cmake
new file mode 100644
index 0000000..6e38572
--- /dev/null
+++ b/Modules/Platform/WindowsStore-Clang-C.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-Clang-C)
diff --git a/Modules/Platform/WindowsStore-Clang-CXX.cmake b/Modules/Platform/WindowsStore-Clang-CXX.cmake
new file mode 100644
index 0000000..bf47978
--- /dev/null
+++ b/Modules/Platform/WindowsStore-Clang-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-Clang-CXX)
diff --git a/Modules/Platform/WindowsStore-GNU-C.cmake b/Modules/Platform/WindowsStore-GNU-C.cmake
new file mode 100644
index 0000000..ff6acd5
--- /dev/null
+++ b/Modules/Platform/WindowsStore-GNU-C.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-GNU-C)
diff --git a/Modules/Platform/WindowsStore-GNU-CXX.cmake b/Modules/Platform/WindowsStore-GNU-CXX.cmake
new file mode 100644
index 0000000..6adab6a
--- /dev/null
+++ b/Modules/Platform/WindowsStore-GNU-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-GNU-CXX)
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index b7b9fe1..dc4febc 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -30,9 +30,10 @@ Defines the following command for use with ``SWIG``:
.. note::
- The variable ``SWIG_MODULE_<name>_REAL_NAME`` will be set to the name
- of the swig module target library. This variable is useless if variable
- ``UseSWIG_TARGET_NAME_PREFERENCE`` is set to ``STANDARD``.
+ This command creates a target with the specified ``<name>`` when
+ policy :policy:`CMP0078` is set to ``NEW``. Otherwise, the legacy
+ behavior will choose a different target name and store it in the
+ ``SWIG_MODULE_<name>_REAL_NAME`` variable.
.. note::
@@ -117,6 +118,13 @@ ensure generated files will receive the required settings.
:prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and
:prop_sf:`COMPILE_OPTIONS`.
+``USE_TARGET_INCLUDE_DIRECTORIES``
+ If set to ``TRUE``, contents of target property
+ :prop_tgt:`INCLUDE_DIRECTORIES` will be forwarded to ``SWIG`` compiler.
+ If set to ``FALSE`` target property :prop_tgt:`INCLUDE_DIRECTORIES` will be
+ ignored. If not set, target property ``SWIG_USE_TARGT_INCLUDE_DIRECTORIES``
+ will be considered.
+
``GENERATED_INCLUDE_DIRECTORIES``, ``GENERATED_COMPILE_DEFINITIONS`` and ``GENERATED_COMPILE_OPTIONS``
Add custom flags to the C/C++ generated source. They will fill, respectively,
properties :prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and
@@ -149,6 +157,13 @@ input files.
set_property(TARGET mymod PROPERTY SWIG_COMPILE_DEFINITIONS MY_DEF1 MY_DEF2)
set_property(TARGET mymod PROPERTY SWIG_COMPILE_OPTIONS -bla -blb)
+``SWIG_USE_TARGET_INCLUDE_DIRECTORIES``
+ If set to ``TRUE``, contents of target property
+ :prop_tgt:`INCLUDE_DIRECTORIES` will be forwarded to ``SWIG`` compiler.
+ If set to ``FALSE`` or not defined, target property
+ :prop_tgt:`INCLUDE_DIRECTORIES` will be ignored. This behavior can be
+ overridden by specifying source property ``USE_TARGET_INCLUDE_DIRECTORIES``.
+
``SWIG_GENERATED_INCLUDE_DIRECTORIES``, ``SWIG_GENERATED_COMPILE_DEFINITIONS`` and ``SWIG_GENERATED_COMPILE_OPTIONS``
These properties will populate, respectively, properties
:prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and
@@ -183,13 +198,6 @@ information about support files generated by ``SWIG`` interface compilation.
Some variables can be set to customize the behavior of ``swig_add_library``
as well as ``SWIG``:
-``UseSWIG_TARGET_NAME_PREFERENCE``
- Specify target name strategy.
-
- * Set to ``LEGACY`` or undefined: legacy strategy is applied. Variable
- ``SWIG_MODULE_<name>_REAL_NAME`` must be used to get real target name.
- * Set to ``STANDARD``: target name matches specified name.
-
``UseSWIG_MODULE_VERSION``
Specify different behaviors for ``UseSWIG`` module.
@@ -211,8 +219,13 @@ as well as ``SWIG``:
Specify extra dependencies for the generated module for ``<name>``.
#]=======================================================================]
-
+cmake_policy(GET CMP0078 target_name_policy)
cmake_policy (VERSION 3.12)
+if (target_name_policy)
+ # respect user choice regarding CMP0078 policy
+ cmake_policy(SET CMP0078 ${target_name_policy})
+endif()
+unset(target_name_policy)
set(SWIG_CXX_EXTENSION "cxx")
set(SWIG_EXTRA_LIBRARIES "")
@@ -347,6 +360,14 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
endif()
set (property "$<TARGET_PROPERTY:${target_name},SWIG_INCLUDE_DIRECTORIES>")
list (APPEND swig_source_file_flags "$<$<BOOL:${property}>:-I$<JOIN:$<TARGET_GENEX_EVAL:${target_name},${property}>,$<SEMICOLON>-I>>")
+ set (property "$<TARGET_PROPERTY:${target_name},INCLUDE_DIRECTORIES>")
+ get_source_file_property(use_target_include_dirs "${infile}" USE_TARGET_INCLUDE_DIRECTORIES)
+ if (use_target_include_dirs)
+ list (APPEND swig_source_file_flags "$<$<BOOL:${property}>:-I$<JOIN:${property},$<SEMICOLON>-I>>")
+ elseif(use_target_include_dirs STREQUAL "NOTFOUND")
+ # not defined at source level, rely on target level
+ list (APPEND swig_source_file_flags "$<$<AND:$<BOOL:$<TARGET_PROPERTY:${target_name},SWIG_USE_TARGET_INCLUDE_DIRECTORIES>>,$<BOOL:${property}>>:-I$<JOIN:${property},$<SEMICOLON>-I>>")
+ endif()
set (property "$<TARGET_PROPERTY:${target_name},SWIG_COMPILE_DEFINITIONS>")
list (APPEND swig_source_file_flags "$<$<BOOL:${property}>:-D$<JOIN:$<TARGET_GENEX_EVAL:${target_name},${property}>,$<SEMICOLON>-D>>")
@@ -524,10 +545,22 @@ function(SWIG_ADD_LIBRARY name)
unset(_SAM_TYPE)
endif()
- if (NOT DEFINED UseSWIG_TARGET_NAME_PREFERENCE)
- set (UseSWIG_TARGET_NAME_PREFERENCE LEGACY)
- elseif (NOT UseSWIG_TARGET_NAME_PREFERENCE MATCHES "^(LEGACY|STANDARD)$")
- message (FATAL_ERROR "UseSWIG_TARGET_NAME_PREFERENCE: ${UseSWIG_TARGET_NAME_PREFERENCE}: invalid value. 'LEGACY' or 'STANDARD' is expected.")
+ cmake_policy(GET CMP0078 target_name_policy)
+ if (target_name_policy STREQUAL "NEW")
+ set (UseSWIG_TARGET_NAME_PREFERENCE STANDARD)
+ else()
+ if (NOT target_name_policy)
+ message(AUTHOR_WARNING
+ "Policy CMP0078 is not set. "
+ "Run \"cmake --help-policy CMP0078\" for policy details. "
+ "Use the cmake_policy command to set the policy and suppress this warning."
+ )
+ endif()
+ if (NOT DEFINED UseSWIG_TARGET_NAME_PREFERENCE)
+ set (UseSWIG_TARGET_NAME_PREFERENCE LEGACY)
+ elseif (NOT UseSWIG_TARGET_NAME_PREFERENCE MATCHES "^(LEGACY|STANDARD)$")
+ message (FATAL_ERROR "UseSWIG_TARGET_NAME_PREFERENCE: ${UseSWIG_TARGET_NAME_PREFERENCE}: invalid value. 'LEGACY' or 'STANDARD' is expected.")
+ endif()
endif()
if (NOT DEFINED UseSWIG_MODULE_VERSION)
diff --git a/README.rst b/README.rst
index 3cef06d..f1dbd9d 100644
--- a/README.rst
+++ b/README.rst
@@ -6,10 +6,12 @@ Introduction
CMake is a cross-platform, open-source build system generator.
For full documentation visit the `CMake Home Page`_ and the
-`CMake Documentation Page`_.
+`CMake Documentation Page`_. The `CMake Community Wiki`_ also
+references useful guides and recipes.
.. _`CMake Home Page`: https://cmake.org
.. _`CMake Documentation Page`: https://cmake.org/cmake/help/documentation.html
+.. _`CMake Community Wiki`: https://gitlab.kitware.com/cmake/community/wikis/home
CMake is maintained and supported by `Kitware`_ and developed in
collaboration with a productive community of contributors.
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 30bef74..0457984 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -379,6 +379,8 @@ set(SRCS
cmAddCompileDefinitionsCommand.h
cmAddCompileOptionsCommand.cxx
cmAddCompileOptionsCommand.h
+ cmAddLinkOptionsCommand.cxx
+ cmAddLinkOptionsCommand.h
cmAddCustomCommandCommand.cxx
cmAddCustomCommandCommand.h
cmAddCustomTargetCommand.cxx
@@ -574,6 +576,8 @@ set(SRCS
cmTargetCompileOptionsCommand.h
cmTargetIncludeDirectoriesCommand.cxx
cmTargetIncludeDirectoriesCommand.h
+ cmTargetLinkOptionsCommand.cxx
+ cmTargetLinkOptionsCommand.h
cmTargetLinkLibrariesCommand.cxx
cmTargetLinkLibrariesCommand.h
cmTargetPropCommandBase.cxx
@@ -882,6 +886,8 @@ include_directories(
set(CPACK_SRCS
CPack/cmCPackArchiveGenerator.cxx
CPack/cmCPackComponentGroup.cxx
+ CPack/cmCPackDebGenerator.cxx
+ CPack/cmCPackExtGenerator.cxx
CPack/cmCPackGeneratorFactory.cxx
CPack/cmCPackGenerator.cxx
CPack/cmCPackLog.cxx
@@ -894,7 +900,6 @@ set(CPACK_SRCS
CPack/cmCPackTarCompressGenerator.cxx
CPack/cmCPackZIPGenerator.cxx
CPack/cmCPack7zGenerator.cxx
- CPack/cmCPackDebGenerator.cxx
)
# CPack IFW generator
set(CPACK_SRCS ${CPACK_SRCS}
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index a1343ae..6e18571 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 12)
-set(CMake_VERSION_PATCH 1)
-#set(CMake_VERSION_RC 0)
+set(CMake_VERSION_PATCH 20180905)
+#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index cf8334a..180c92e 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -90,7 +90,7 @@ int cmCPackIFWGenerator::PackageFiles()
ifwCmd.c_str(), &output, &output, &retVal, nullptr,
this->GeneratorVerbose, cmDuration::zero());
if (!res || retVal) {
- cmGeneratedFileStream ofs(ifwTmpFile.c_str());
+ cmGeneratedFileStream ofs(ifwTmpFile);
ofs << "# Run command: " << ifwCmd << std::endl
<< "# Output:" << std::endl
<< output << std::endl;
@@ -203,7 +203,7 @@ int cmCPackIFWGenerator::PackageFiles()
ifwCmd.c_str(), &output, &output, &retVal, nullptr,
this->GeneratorVerbose, cmDuration::zero());
if (!res || retVal) {
- cmGeneratedFileStream ofs(ifwTmpFile.c_str());
+ cmGeneratedFileStream ofs(ifwTmpFile);
ofs << "# Run command: " << ifwCmd << std::endl
<< "# Output:" << std::endl
<< output << std::endl;
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index 36cf08c..8f492af 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -306,7 +306,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
}
// Output stream
- cmGeneratedFileStream fout((this->Directory + "/config/config.xml").data());
+ cmGeneratedFileStream fout(this->Directory + "/config/config.xml");
cmXMLWriter xout(fout);
xout.StartDocument();
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
index f24ab69..67e279c 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.cxx
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -528,7 +528,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
}
// Output stream
- cmGeneratedFileStream fout((this->Directory + "/meta/package.xml").data());
+ cmGeneratedFileStream fout(this->Directory + "/meta/package.xml");
cmXMLWriter xout(fout);
xout.StartDocument();
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx
index a01fc4e..987cad8 100644
--- a/Source/CPack/IFW/cmCPackIFWRepository.cxx
+++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx
@@ -183,7 +183,7 @@ bool cmCPackIFWRepository::PatchUpdatesXml()
this->Directory + "/repository/UpdatesPatch.xml";
// Output stream
- cmGeneratedFileStream fout(updatesPatchXml.data());
+ cmGeneratedFileStream fout(updatesPatchXml);
cmXMLWriter xout(fout);
xout.StartDocument();
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index e06efda..398ebd3 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -100,6 +100,10 @@ bool cmCPackWIXGenerator::RunCandleCommand(std::string const& sourceFile,
command << " -ext " << QuotePath(ext);
}
+ if (sourceFile.rfind(this->CPackTopLevel, 0) != 0) {
+ command << " " << QuotePath("-I" + this->CPackTopLevel);
+ }
+
AddCustomFlags("CPACK_WIX_CANDLE_EXTRA_FLAGS", command);
command << " " << QuotePath(sourceFile);
@@ -148,7 +152,7 @@ int cmCPackWIXGenerator::PackageFiles()
bool cmCPackWIXGenerator::InitializeWiXConfiguration()
{
- if (!ReadListFile("CPackWIX.cmake")) {
+ if (!ReadListFile("Internal/CPack/CPackWIX.cmake")) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Error while executing CPackWIX.cmake" << std::endl);
return false;
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index b734bb4..ee1070f 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -103,18 +103,18 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(
*/
#define DECLARE_AND_OPEN_ARCHIVE(filename, archive) \
cmGeneratedFileStream gf; \
- gf.Open((filename).c_str(), false, true); \
+ gf.Open((filename), false, true); \
if (!GenerateHeader(&gf)) { \
cmCPackLogger(cmCPackLog::LOG_ERROR, \
- "Problem to generate Header for archive < " \
+ "Problem to generate Header for archive <" \
<< (filename) << ">." << std::endl); \
return 0; \
} \
cmArchiveWrite archive(gf, this->Compress, this->ArchiveFormat); \
if (!(archive)) { \
cmCPackLogger(cmCPackLog::LOG_ERROR, \
- "Problem to create archive < " \
- << (filename) << ">. ERROR =" << (archive).GetError() \
+ "Problem to create archive <" \
+ << (filename) << ">, ERROR = " << (archive).GetError() \
<< std::endl); \
return 0; \
}
@@ -262,9 +262,9 @@ int cmCPackArchiveGenerator::PackageFiles()
archive.Add(rp, 0, nullptr, false);
if (!archive) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Problem while adding file< "
+ "Problem while adding file <"
<< file << "> to archive <" << packageFileNames[0]
- << "> .ERROR =" << archive.GetError() << std::endl);
+ << ">, ERROR = " << archive.GetError() << std::endl);
return 0;
}
}
diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h
index f2907db..bb980d7 100644
--- a/Source/CPack/cmCPackComponentGroup.h
+++ b/Source/CPack/cmCPackComponentGroup.h
@@ -143,4 +143,29 @@ public:
std::vector<cmCPackComponentGroup*> Subgroups;
};
+/** \class cmCPackInstallCMakeProject
+ * \brief A single quadruplet from the CPACK_INSTALL_CMAKE_PROJECTS variable.
+ */
+class cmCPackInstallCMakeProject
+{
+public:
+ /// The directory of the CMake project.
+ std::string Directory;
+
+ /// The name of the CMake project.
+ std::string ProjectName;
+
+ /// The name of the component (or component set) to install.
+ std::string Component;
+
+ /// The subdirectory to install into.
+ std::string SubDirectory;
+
+ /// The list of installation types.
+ std::vector<cmCPackInstallationType*> InstallationTypes;
+
+ /// The list of components.
+ std::vector<cmCPackComponent*> Components;
+};
+
#endif
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 8a4c004..972fe6f 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -61,7 +61,7 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel,
component_path += packageName;
this->SetOption("CPACK_DEB_PACKAGE_COMPONENT_PART_PATH",
component_path.c_str());
- if (!this->ReadListFile("CPackDeb.cmake")) {
+ if (!this->ReadListFile("Internal/CPack/CPackDeb.cmake")) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Error while execution CPackDeb.cmake" << std::endl);
retval = 0;
@@ -179,7 +179,7 @@ int cmCPackDebGenerator::PackageComponentsAllInOne(
this->SetOption("CPACK_DEB_PACKAGE_COMPONENT_PART_PATH",
component_path.c_str());
}
- if (!this->ReadListFile("CPackDeb.cmake")) {
+ if (!this->ReadListFile("Internal/CPack/CPackDeb.cmake")) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Error while execution CPackDeb.cmake" << std::endl);
retval = 0;
@@ -238,7 +238,7 @@ int cmCPackDebGenerator::createDeb()
const std::string strGenWDIR(this->GetOption("GEN_WDIR"));
const std::string dbfilename = strGenWDIR + "/debian-binary";
{ // the scope is needed for cmGeneratedFileStream
- cmGeneratedFileStream out(dbfilename.c_str());
+ cmGeneratedFileStream out(dbfilename);
out << "2.0";
out << std::endl; // required for valid debian package
}
@@ -287,7 +287,7 @@ int cmCPackDebGenerator::createDeb()
this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_SOURCE");
{ // the scope is needed for cmGeneratedFileStream
- cmGeneratedFileStream out(ctlfilename.c_str());
+ cmGeneratedFileStream out(ctlfilename);
out << "Package: " << debian_pkg_name << "\n";
out << "Version: " << debian_pkg_version << "\n";
out << "Section: " << debian_pkg_section << "\n";
@@ -347,7 +347,7 @@ int cmCPackDebGenerator::createDeb()
const bool gen_shibs = this->IsOn("CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS") &&
debian_pkg_shlibs && *debian_pkg_shlibs;
if (gen_shibs) {
- cmGeneratedFileStream out(shlibsfilename.c_str());
+ cmGeneratedFileStream out(shlibsfilename);
out << debian_pkg_shlibs;
out << std::endl;
}
@@ -355,7 +355,7 @@ int cmCPackDebGenerator::createDeb()
const std::string postinst = strGenWDIR + "/postinst";
const std::string postrm = strGenWDIR + "/postrm";
if (this->IsOn("GEN_CPACK_DEBIAN_GENERATE_POSTINST")) {
- cmGeneratedFileStream out(postinst.c_str());
+ cmGeneratedFileStream out(postinst);
out << "#!/bin/sh\n\n"
"set -e\n\n"
"if [ \"$1\" = \"configure\" ]; then\n"
@@ -363,7 +363,7 @@ int cmCPackDebGenerator::createDeb()
"fi\n";
}
if (this->IsOn("GEN_CPACK_DEBIAN_GENERATE_POSTRM")) {
- cmGeneratedFileStream out(postrm.c_str());
+ cmGeneratedFileStream out(postrm);
out << "#!/bin/sh\n\n"
"set -e\n\n"
"if [ \"$1\" = \"remove\" ]; then\n"
@@ -412,7 +412,7 @@ int cmCPackDebGenerator::createDeb()
// atomic file generation for data.tar
{
cmGeneratedFileStream fileStream_data_tar;
- fileStream_data_tar.Open(filename_data_tar.c_str(), false, true);
+ fileStream_data_tar.Open(filename_data_tar, false, true);
if (!fileStream_data_tar) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Error opening the file \""
@@ -493,7 +493,7 @@ int cmCPackDebGenerator::createDeb()
std::string md5filename = strGenWDIR + "/md5sums";
{
// the scope is needed for cmGeneratedFileStream
- cmGeneratedFileStream out(md5filename.c_str());
+ cmGeneratedFileStream out(md5filename);
std::string topLevelWithTrailingSlash =
this->GetOption("CPACK_TEMPORARY_DIRECTORY");
@@ -528,7 +528,7 @@ int cmCPackDebGenerator::createDeb()
// atomic file generation for control.tar
{
cmGeneratedFileStream fileStream_control_tar;
- fileStream_control_tar.Open(filename_control_tar.c_str(), false, true);
+ fileStream_control_tar.Open(filename_control_tar, false, true);
if (!fileStream_control_tar) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Error opening the file \"" << filename_control_tar
@@ -662,7 +662,7 @@ int cmCPackDebGenerator::createDeb()
std::string const outputPath = outputDir + "/" + outputName;
std::string const tlDir = strGenWDIR + "/";
cmGeneratedFileStream debStream;
- debStream.Open(outputPath.c_str(), false, true);
+ debStream.Open(outputPath, false, true);
cmArchiveWrite deb(debStream, cmArchiveWrite::CompressNone, "arbsd");
// uid/gid should be the one of the root user, and this root user has
diff --git a/Source/CPack/cmCPackExtGenerator.cxx b/Source/CPack/cmCPackExtGenerator.cxx
new file mode 100644
index 0000000..4c560b9
--- /dev/null
+++ b/Source/CPack/cmCPackExtGenerator.cxx
@@ -0,0 +1,321 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cmCPackExtGenerator.h"
+
+#include "cmAlgorithms.h"
+#include "cmCPackComponentGroup.h"
+#include "cmCPackLog.h"
+#include "cmMakefile.h"
+#include "cmSystemTools.h"
+
+#include "cm_jsoncpp_value.h"
+#include "cm_jsoncpp_writer.h"
+
+#include "cmsys/FStream.hxx"
+
+#include <utility>
+#include <vector>
+
+int cmCPackExtGenerator::InitializeInternal()
+{
+ this->SetOption("CPACK_EXT_KNOWN_VERSIONS", "1.0");
+
+ if (!this->ReadListFile("Internal/CPack/CPackExt.cmake")) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Error while executing CPackExt.cmake" << std::endl);
+ return 0;
+ }
+
+ std::string major = this->GetOption("CPACK_EXT_SELECTED_MAJOR");
+ if (major == "1") {
+ this->Generator = cm::make_unique<cmCPackExtVersion1Generator>(this);
+ }
+
+ return this->Superclass::InitializeInternal();
+}
+
+int cmCPackExtGenerator::PackageFiles()
+{
+ Json::StreamWriterBuilder builder;
+ builder["indentation"] = " ";
+
+ std::string filename = "package.json";
+ if (!this->packageFileNames.empty()) {
+ filename = this->packageFileNames[0];
+ }
+
+ cmsys::ofstream fout(filename.c_str());
+ std::unique_ptr<Json::StreamWriter> jout(builder.newStreamWriter());
+
+ Json::Value root(Json::objectValue);
+
+ if (!this->Generator->WriteToJSON(root)) {
+ return 0;
+ }
+
+ if (jout->write(root, &fout)) {
+ return 0;
+ }
+
+ const char* packageScript = this->GetOption("CPACK_EXT_PACKAGE_SCRIPT");
+ if (packageScript && *packageScript) {
+ if (!cmSystemTools::FileIsFullPath(packageScript)) {
+ cmCPackLogger(
+ cmCPackLog::LOG_ERROR,
+ "CPACK_EXT_PACKAGE_SCRIPT does not contain a full file path"
+ << std::endl);
+ return 0;
+ }
+
+ int res = this->MakefileMap->ReadListFile(packageScript);
+
+ if (cmSystemTools::GetErrorOccuredFlag() || !res) {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+bool cmCPackExtGenerator::SupportsComponentInstallation() const
+{
+ return true;
+}
+
+int cmCPackExtGenerator::InstallProjectViaInstallCommands(
+ bool setDestDir, const std::string& tempInstallDirectory)
+{
+ if (this->StagingEnabled()) {
+ return cmCPackGenerator::InstallProjectViaInstallCommands(
+ setDestDir, tempInstallDirectory);
+ }
+
+ return 1;
+}
+
+int cmCPackExtGenerator::InstallProjectViaInstallScript(
+ bool setDestDir, const std::string& tempInstallDirectory)
+{
+ if (this->StagingEnabled()) {
+ return cmCPackGenerator::InstallProjectViaInstallScript(
+ setDestDir, tempInstallDirectory);
+ }
+
+ return 1;
+}
+
+int cmCPackExtGenerator::InstallProjectViaInstalledDirectories(
+ bool setDestDir, const std::string& tempInstallDirectory,
+ const mode_t* default_dir_mode)
+{
+ if (this->StagingEnabled()) {
+ return cmCPackGenerator::InstallProjectViaInstalledDirectories(
+ setDestDir, tempInstallDirectory, default_dir_mode);
+ }
+
+ return 1;
+}
+
+int cmCPackExtGenerator::RunPreinstallTarget(
+ const std::string& installProjectName, const std::string& installDirectory,
+ cmGlobalGenerator* globalGenerator, const std::string& buildConfig)
+{
+ if (this->StagingEnabled()) {
+ return cmCPackGenerator::RunPreinstallTarget(
+ installProjectName, installDirectory, globalGenerator, buildConfig);
+ }
+
+ return 1;
+}
+
+int cmCPackExtGenerator::InstallCMakeProject(
+ bool setDestDir, const std::string& installDirectory,
+ const std::string& baseTempInstallDirectory, const mode_t* default_dir_mode,
+ const std::string& component, bool componentInstall,
+ const std::string& installSubDirectory, const std::string& buildConfig,
+ std::string& absoluteDestFiles)
+{
+ if (this->StagingEnabled()) {
+ return cmCPackGenerator::InstallCMakeProject(
+ setDestDir, installDirectory, baseTempInstallDirectory, default_dir_mode,
+ component, componentInstall, installSubDirectory, buildConfig,
+ absoluteDestFiles);
+ }
+
+ return 1;
+}
+
+bool cmCPackExtGenerator::StagingEnabled() const
+{
+ return !cmSystemTools::IsOff(this->GetOption("CPACK_EXT_ENABLE_STAGING"));
+}
+
+cmCPackExtGenerator::cmCPackExtVersionGenerator::cmCPackExtVersionGenerator(
+ cmCPackExtGenerator* parent)
+ : Parent(parent)
+{
+}
+
+int cmCPackExtGenerator::cmCPackExtVersionGenerator::WriteVersion(
+ Json::Value& root)
+{
+ root["formatVersionMajor"] = this->GetVersionMajor();
+ root["formatVersionMinor"] = this->GetVersionMinor();
+
+ return 1;
+}
+
+int cmCPackExtGenerator::cmCPackExtVersionGenerator::WriteToJSON(
+ Json::Value& root)
+{
+ if (!this->WriteVersion(root)) {
+ return 0;
+ }
+
+ const char* packageName = this->Parent->GetOption("CPACK_PACKAGE_NAME");
+ if (packageName) {
+ root["packageName"] = packageName;
+ }
+
+ const char* packageVersion =
+ this->Parent->GetOption("CPACK_PACKAGE_VERSION");
+ if (packageVersion) {
+ root["packageVersion"] = packageVersion;
+ }
+
+ const char* packageDescriptionFile =
+ this->Parent->GetOption("CPACK_PACKAGE_DESCRIPTION_FILE");
+ if (packageDescriptionFile) {
+ root["packageDescriptionFile"] = packageDescriptionFile;
+ }
+
+ const char* packageDescriptionSummary =
+ this->Parent->GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY");
+ if (packageDescriptionSummary) {
+ root["packageDescriptionSummary"] = packageDescriptionSummary;
+ }
+
+ const char* buildConfigCstr = this->Parent->GetOption("CPACK_BUILD_CONFIG");
+ if (buildConfigCstr) {
+ root["buildConfig"] = buildConfigCstr;
+ }
+
+ const char* defaultDirectoryPermissions =
+ this->Parent->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS");
+ if (defaultDirectoryPermissions && *defaultDirectoryPermissions) {
+ root["defaultDirectoryPermissions"] = defaultDirectoryPermissions;
+ }
+ if (cmSystemTools::IsInternallyOn(
+ this->Parent->GetOption("CPACK_SET_DESTDIR"))) {
+ root["setDestdir"] = true;
+ root["packagingInstallPrefix"] =
+ this->Parent->GetOption("CPACK_PACKAGING_INSTALL_PREFIX");
+ } else {
+ root["setDestdir"] = false;
+ }
+
+ root["stripFiles"] =
+ !cmSystemTools::IsOff(this->Parent->GetOption("CPACK_STRIP_FILES"));
+ root["warnOnAbsoluteInstallDestination"] =
+ this->Parent->IsOn("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION");
+ root["errorOnAbsoluteInstallDestination"] =
+ this->Parent->IsOn("CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION");
+
+ Json::Value& projects = root["projects"] = Json::Value(Json::arrayValue);
+ for (auto& project : this->Parent->CMakeProjects) {
+ Json::Value jsonProject(Json::objectValue);
+
+ jsonProject["projectName"] = project.ProjectName;
+ jsonProject["component"] = project.Component;
+ jsonProject["directory"] = project.Directory;
+ jsonProject["subDirectory"] = project.SubDirectory;
+
+ Json::Value& installationTypes = jsonProject["installationTypes"] =
+ Json::Value(Json::arrayValue);
+ for (auto& installationType : project.InstallationTypes) {
+ installationTypes.append(installationType->Name);
+ }
+
+ Json::Value& components = jsonProject["components"] =
+ Json::Value(Json::arrayValue);
+ for (auto& component : project.Components) {
+ components.append(component->Name);
+ }
+
+ projects.append(jsonProject);
+ }
+
+ Json::Value& installationTypes = root["installationTypes"] =
+ Json::Value(Json::objectValue);
+ for (auto& installationType : this->Parent->InstallationTypes) {
+ Json::Value& jsonInstallationType =
+ installationTypes[installationType.first] =
+ Json::Value(Json::objectValue);
+
+ jsonInstallationType["name"] = installationType.second.Name;
+ jsonInstallationType["displayName"] = installationType.second.DisplayName;
+ jsonInstallationType["index"] = installationType.second.Index;
+ }
+
+ Json::Value& components = root["components"] =
+ Json::Value(Json::objectValue);
+ for (auto& component : this->Parent->Components) {
+ Json::Value& jsonComponent = components[component.first] =
+ Json::Value(Json::objectValue);
+
+ jsonComponent["name"] = component.second.Name;
+ jsonComponent["displayName"] = component.second.DisplayName;
+ if (component.second.Group) {
+ jsonComponent["group"] = component.second.Group->Name;
+ }
+ jsonComponent["isRequired"] = component.second.IsRequired;
+ jsonComponent["isHidden"] = component.second.IsHidden;
+ jsonComponent["isDisabledByDefault"] =
+ component.second.IsDisabledByDefault;
+ jsonComponent["isDownloaded"] = component.second.IsDownloaded;
+ jsonComponent["description"] = component.second.Description;
+ jsonComponent["archiveFile"] = component.second.ArchiveFile;
+
+ Json::Value& cmpInstallationTypes = jsonComponent["installationTypes"] =
+ Json::Value(Json::arrayValue);
+ for (auto& installationType : component.second.InstallationTypes) {
+ cmpInstallationTypes.append(installationType->Name);
+ }
+
+ Json::Value& dependencies = jsonComponent["dependencies"] =
+ Json::Value(Json::arrayValue);
+ for (auto& dep : component.second.Dependencies) {
+ dependencies.append(dep->Name);
+ }
+ }
+
+ Json::Value& groups = root["componentGroups"] =
+ Json::Value(Json::objectValue);
+ for (auto& group : this->Parent->ComponentGroups) {
+ Json::Value& jsonGroup = groups[group.first] =
+ Json::Value(Json::objectValue);
+
+ jsonGroup["name"] = group.second.Name;
+ jsonGroup["displayName"] = group.second.DisplayName;
+ jsonGroup["description"] = group.second.Description;
+ jsonGroup["isBold"] = group.second.IsBold;
+ jsonGroup["isExpandedByDefault"] = group.second.IsExpandedByDefault;
+ if (group.second.ParentGroup) {
+ jsonGroup["parentGroup"] = group.second.ParentGroup->Name;
+ }
+
+ Json::Value& subgroups = jsonGroup["subgroups"] =
+ Json::Value(Json::arrayValue);
+ for (auto& subgroup : group.second.Subgroups) {
+ subgroups.append(subgroup->Name);
+ }
+
+ Json::Value& groupComponents = jsonGroup["components"] =
+ Json::Value(Json::arrayValue);
+ for (auto& component : group.second.Components) {
+ groupComponents.append(component->Name);
+ }
+ }
+
+ return 1;
+}
diff --git a/Source/CPack/cmCPackExtGenerator.h b/Source/CPack/cmCPackExtGenerator.h
new file mode 100644
index 0000000..103e56d
--- /dev/null
+++ b/Source/CPack/cmCPackExtGenerator.h
@@ -0,0 +1,88 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#ifndef cmCPackExtGenerator_h
+#define cmCPackExtGenerator_h
+
+#include "cmCPackGenerator.h"
+#include "cm_sys_stat.h"
+
+#include <memory>
+#include <string>
+
+class cmGlobalGenerator;
+namespace Json {
+class Value;
+}
+
+/** \class cmCPackExtGenerator
+ * \brief A generator for CPack External packaging tools
+ */
+class cmCPackExtGenerator : public cmCPackGenerator
+{
+public:
+ cmCPackTypeMacro(cmCPackExtGenerator, cmCPackGenerator);
+
+ const char* GetOutputExtension() override { return ".json"; }
+
+protected:
+ int InitializeInternal() override;
+
+ int PackageFiles() override;
+
+ bool SupportsComponentInstallation() const override;
+
+ int InstallProjectViaInstallCommands(
+ bool setDestDir, const std::string& tempInstallDirectory) override;
+ int InstallProjectViaInstallScript(
+ bool setDestDir, const std::string& tempInstallDirectory) override;
+ int InstallProjectViaInstalledDirectories(
+ bool setDestDir, const std::string& tempInstallDirectory,
+ const mode_t* default_dir_mode) override;
+
+ int RunPreinstallTarget(const std::string& installProjectName,
+ const std::string& installDirectory,
+ cmGlobalGenerator* globalGenerator,
+ const std::string& buildConfig) override;
+ int InstallCMakeProject(bool setDestDir, const std::string& installDirectory,
+ const std::string& baseTempInstallDirectory,
+ const mode_t* default_dir_mode,
+ const std::string& component, bool componentInstall,
+ const std::string& installSubDirectory,
+ const std::string& buildConfig,
+ std::string& absoluteDestFiles) override;
+
+private:
+ bool StagingEnabled() const;
+
+ class cmCPackExtVersionGenerator
+ {
+ public:
+ cmCPackExtVersionGenerator(cmCPackExtGenerator* parent);
+
+ virtual ~cmCPackExtVersionGenerator() = default;
+
+ virtual int WriteToJSON(Json::Value& root);
+
+ protected:
+ virtual int GetVersionMajor() = 0;
+ virtual int GetVersionMinor() = 0;
+
+ int WriteVersion(Json::Value& root);
+
+ cmCPackExtGenerator* Parent;
+ };
+
+ class cmCPackExtVersion1Generator : public cmCPackExtVersionGenerator
+ {
+ public:
+ using cmCPackExtVersionGenerator::cmCPackExtVersionGenerator;
+
+ protected:
+ int GetVersionMajor() override { return 1; }
+ int GetVersionMinor() override { return 0; }
+ };
+
+ std::unique_ptr<cmCPackExtVersionGenerator> Generator;
+};
+
+#endif
diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx
index 91ae1a2..1433414 100644
--- a/Source/CPack/cmCPackFreeBSDGenerator.cxx
+++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx
@@ -298,7 +298,7 @@ static bool has_suffix(const std::string& str, const std::string& suffix)
int cmCPackFreeBSDGenerator::PackageFiles()
{
- if (!this->ReadListFile("CPackFreeBSD.cmake")) {
+ if (!this->ReadListFile("Internal/CPack/CPackFreeBSD.cmake")) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Error while execution CPackFreeBSD.cmake" << std::endl);
return 0;
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index f15445b..6347eed 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -288,7 +288,7 @@ int cmCPackGenerator::InstallProjectViaInstallCommands(
if (!resB || retVal) {
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
tmpFile += "/InstallOutput.log";
- cmGeneratedFileStream ofs(tmpFile.c_str());
+ cmGeneratedFileStream ofs(tmpFile);
ofs << "# Run command: " << ic << std::endl
<< "# Output:" << std::endl
<< output << std::endl;
@@ -369,7 +369,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
inFile += '/';
}
for (cmsys::RegularExpression& reg : ignoreFilesRegex) {
- if (reg.find(inFile.c_str())) {
+ if (reg.find(inFile)) {
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Ignore file: " << inFile << std::endl);
skip = true;
@@ -545,10 +545,13 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
++it;
std::string installProjectName = *it;
++it;
- std::string installComponent = *it;
+ cmCPackInstallCMakeProject project;
+
+ project.Directory = installDirectory;
+ project.ProjectName = installProjectName;
+ project.Component = *it;
++it;
- std::string installSubDirectory = *it;
- std::string installFile = installDirectory + "/cmake_install.cmake";
+ project.SubDirectory = *it;
std::vector<std::string> componentsVector;
@@ -559,34 +562,36 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
* - the user did not request Monolithic install
* (this works at CPack time too)
*/
- if (this->SupportsComponentInstallation() &
+ if (this->SupportsComponentInstallation() &&
!(this->IsOn("CPACK_MONOLITHIC_INSTALL"))) {
// Determine the installation types for this project (if provided).
std::string installTypesVar = "CPACK_" +
- cmSystemTools::UpperCase(installComponent) + "_INSTALL_TYPES";
+ cmSystemTools::UpperCase(project.Component) + "_INSTALL_TYPES";
const char* installTypes = this->GetOption(installTypesVar);
if (installTypes && *installTypes) {
std::vector<std::string> installTypesVector;
cmSystemTools::ExpandListArgument(installTypes, installTypesVector);
for (std::string const& installType : installTypesVector) {
- this->GetInstallationType(installProjectName, installType);
+ project.InstallationTypes.push_back(
+ this->GetInstallationType(project.ProjectName, installType));
}
}
// Determine the set of components that will be used in this project
std::string componentsVar =
- "CPACK_COMPONENTS_" + cmSystemTools::UpperCase(installComponent);
+ "CPACK_COMPONENTS_" + cmSystemTools::UpperCase(project.Component);
const char* components = this->GetOption(componentsVar);
if (components && *components) {
cmSystemTools::ExpandListArgument(components, componentsVector);
for (std::string const& comp : componentsVector) {
- GetComponent(installProjectName, comp);
+ project.Components.push_back(
+ this->GetComponent(project.ProjectName, comp));
}
componentInstall = true;
}
}
if (componentsVector.empty()) {
- componentsVector.push_back(installComponent);
+ componentsVector.push_back(project.Component);
}
const char* buildConfigCstr = this->GetOption("CPACK_BUILD_CONFIG");
@@ -606,297 +611,316 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
// on windows.
cmSystemTools::SetForceUnixPaths(globalGenerator->GetForceUnixPaths());
- // Does this generator require pre-install?
- if (const char* preinstall =
- globalGenerator->GetPreinstallTargetName()) {
- std::string buildCommand = globalGenerator->GenerateCMakeBuildCommand(
- preinstall, buildConfig, "", false);
- cmCPackLogger(cmCPackLog::LOG_DEBUG,
- "- Install command: " << buildCommand << std::endl);
- cmCPackLogger(cmCPackLog::LOG_OUTPUT,
- "- Run preinstall target for: " << installProjectName
- << std::endl);
- std::string output;
- int retVal = 1;
- bool resB = cmSystemTools::RunSingleCommand(
- buildCommand.c_str(), &output, &output, &retVal,
- installDirectory.c_str(), this->GeneratorVerbose,
- cmDuration::zero());
- if (!resB || retVal) {
- std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
- tmpFile += "/PreinstallOutput.log";
- cmGeneratedFileStream ofs(tmpFile.c_str());
- ofs << "# Run command: " << buildCommand << std::endl
- << "# Directory: " << installDirectory << std::endl
- << "# Output:" << std::endl
- << output << std::endl;
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Problem running install command: "
- << buildCommand << std::endl
- << "Please check " << tmpFile << " for errors"
- << std::endl);
- return 0;
- }
+ if (!this->RunPreinstallTarget(project.ProjectName, project.Directory,
+ globalGenerator, buildConfig)) {
+ return 0;
}
+
delete globalGenerator;
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
- "- Install project: " << installProjectName << std::endl);
+ "- Install project: " << project.ProjectName << std::endl);
// Run the installation for each component
for (std::string const& component : componentsVector) {
- std::string tempInstallDirectory = baseTempInstallDirectory;
- installComponent = component;
- if (componentInstall) {
- cmCPackLogger(cmCPackLog::LOG_OUTPUT,
- "- Install component: " << installComponent
- << std::endl);
+ if (!this->InstallCMakeProject(
+ setDestDir, project.Directory, baseTempInstallDirectory,
+ default_dir_mode, component, componentInstall,
+ project.SubDirectory, buildConfig, absoluteDestFiles)) {
+ return 0;
}
+ }
- cmake cm(cmake::RoleScript);
- cm.SetHomeDirectory("");
- cm.SetHomeOutputDirectory("");
- cm.GetCurrentSnapshot().SetDefaultDefinitions();
- cm.AddCMakePaths();
- cm.SetProgressCallback(cmCPackGeneratorProgress, this);
- cm.SetTrace(this->Trace);
- cm.SetTraceExpand(this->TraceExpand);
- cmGlobalGenerator gg(&cm);
- cmMakefile mf(&gg, cm.GetCurrentSnapshot());
- if (!installSubDirectory.empty() && installSubDirectory != "/" &&
- installSubDirectory != ".") {
- tempInstallDirectory += installSubDirectory;
- }
- if (componentInstall) {
- tempInstallDirectory += "/";
- // Some CPack generators would rather chose
- // the local installation directory suffix.
- // Some (e.g. RPM) use
- // one install directory for each component **GROUP**
- // instead of the default
- // one install directory for each component.
- tempInstallDirectory +=
- GetComponentInstallDirNameSuffix(installComponent);
- if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY")) {
- tempInstallDirectory += "/";
- tempInstallDirectory += this->GetOption("CPACK_PACKAGE_FILE_NAME");
- }
- }
+ this->CMakeProjects.push_back(project);
+ }
+ }
+ this->SetOption("CPACK_ABSOLUTE_DESTINATION_FILES",
+ absoluteDestFiles.c_str());
+ return 1;
+}
- const char* default_dir_inst_permissions =
- this->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS");
- if (default_dir_inst_permissions && *default_dir_inst_permissions) {
- mf.AddDefinition("CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS",
- default_dir_inst_permissions);
- }
+int cmCPackGenerator::RunPreinstallTarget(
+ const std::string& installProjectName, const std::string& installDirectory,
+ cmGlobalGenerator* globalGenerator, const std::string& buildConfig)
+{
+ // Does this generator require pre-install?
+ if (const char* preinstall = globalGenerator->GetPreinstallTargetName()) {
+ std::string buildCommand = globalGenerator->GenerateCMakeBuildCommand(
+ preinstall, buildConfig, "", false);
+ cmCPackLogger(cmCPackLog::LOG_DEBUG,
+ "- Install command: " << buildCommand << std::endl);
+ cmCPackLogger(cmCPackLog::LOG_OUTPUT,
+ "- Run preinstall target for: " << installProjectName
+ << std::endl);
+ std::string output;
+ int retVal = 1;
+ bool resB = cmSystemTools::RunSingleCommand(
+ buildCommand.c_str(), &output, &output, &retVal,
+ installDirectory.c_str(), this->GeneratorVerbose, cmDuration::zero());
+ if (!resB || retVal) {
+ std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
+ tmpFile += "/PreinstallOutput.log";
+ cmGeneratedFileStream ofs(tmpFile);
+ ofs << "# Run command: " << buildCommand << std::endl
+ << "# Directory: " << installDirectory << std::endl
+ << "# Output:" << std::endl
+ << output << std::endl;
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Problem running install command: "
+ << buildCommand << std::endl
+ << "Please check " << tmpFile << " for errors"
+ << std::endl);
+ return 0;
+ }
+ }
- if (!setDestDir) {
- tempInstallDirectory += this->GetPackagingInstallPrefix();
- }
+ return 1;
+}
- if (setDestDir) {
- // For DESTDIR based packaging, use the *project*
- // CMAKE_INSTALL_PREFIX underneath the tempInstallDirectory. The
- // value of the project's CMAKE_INSTALL_PREFIX is sent in here as
- // the value of the CPACK_INSTALL_PREFIX variable.
- //
- // If DESTDIR has been 'internally set ON' this means that
- // the underlying CPack specific generator did ask for that
- // In this case we may override CPACK_INSTALL_PREFIX with
- // CPACK_PACKAGING_INSTALL_PREFIX
- // I know this is tricky and awkward but it's the price for
- // CPACK_SET_DESTDIR backward compatibility.
- if (cmSystemTools::IsInternallyOn(
- this->GetOption("CPACK_SET_DESTDIR"))) {
- this->SetOption("CPACK_INSTALL_PREFIX",
- this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX"));
- }
- std::string dir;
- if (this->GetOption("CPACK_INSTALL_PREFIX")) {
- dir += this->GetOption("CPACK_INSTALL_PREFIX");
- }
- mf.AddDefinition("CMAKE_INSTALL_PREFIX", dir.c_str());
+int cmCPackGenerator::InstallCMakeProject(
+ bool setDestDir, const std::string& installDirectory,
+ const std::string& baseTempInstallDirectory, const mode_t* default_dir_mode,
+ const std::string& component, bool componentInstall,
+ const std::string& installSubDirectory, const std::string& buildConfig,
+ std::string& absoluteDestFiles)
+{
+ std::string tempInstallDirectory = baseTempInstallDirectory;
+ std::string installFile = installDirectory + "/cmake_install.cmake";
- cmCPackLogger(
- cmCPackLog::LOG_DEBUG,
- "- Using DESTDIR + CPACK_INSTALL_PREFIX... (mf.AddDefinition)"
- << std::endl);
- cmCPackLogger(cmCPackLog::LOG_DEBUG,
- "- Setting CMAKE_INSTALL_PREFIX to '" << dir << "'"
- << std::endl);
-
- // Make sure that DESTDIR + CPACK_INSTALL_PREFIX directory
- // exists:
- //
- if (cmSystemTools::StringStartsWith(dir.c_str(), "/")) {
- dir = tempInstallDirectory + dir;
- } else {
- dir = tempInstallDirectory + "/" + dir;
- }
- /*
- * We must re-set DESTDIR for each component
- * We must not add the CPACK_INSTALL_PREFIX part because
- * it will be added using the override of CMAKE_INSTALL_PREFIX
- * The main reason for this awkward trick is that
- * are using DESTDIR for 2 different reasons:
- * - Because it was asked by the CPack Generator or the user
- * using CPACK_SET_DESTDIR
- * - Because it was already used for component install
- * in order to put things in subdirs...
- */
- cmSystemTools::PutEnv(std::string("DESTDIR=") +
- tempInstallDirectory);
- cmCPackLogger(cmCPackLog::LOG_DEBUG,
- "- Creating directory: '" << dir << "'" << std::endl);
+ if (componentInstall) {
+ cmCPackLogger(cmCPackLog::LOG_OUTPUT,
+ "- Install component: " << component << std::endl);
+ }
- if (!cmsys::SystemTools::MakeDirectory(dir, default_dir_mode)) {
- cmCPackLogger(
- cmCPackLog::LOG_ERROR,
- "Problem creating temporary directory: " << dir << std::endl);
- return 0;
- }
- } else {
- mf.AddDefinition("CMAKE_INSTALL_PREFIX",
- tempInstallDirectory.c_str());
+ cmake cm(cmake::RoleScript);
+ cm.SetHomeDirectory("");
+ cm.SetHomeOutputDirectory("");
+ cm.GetCurrentSnapshot().SetDefaultDefinitions();
+ cm.AddCMakePaths();
+ cm.SetProgressCallback(cmCPackGeneratorProgress, this);
+ cm.SetTrace(this->Trace);
+ cm.SetTraceExpand(this->TraceExpand);
+ cmGlobalGenerator gg(&cm);
+ cmMakefile mf(&gg, cm.GetCurrentSnapshot());
+ if (!installSubDirectory.empty() && installSubDirectory != "/" &&
+ installSubDirectory != ".") {
+ tempInstallDirectory += installSubDirectory;
+ }
+ if (componentInstall) {
+ tempInstallDirectory += "/";
+ // Some CPack generators would rather chose
+ // the local installation directory suffix.
+ // Some (e.g. RPM) use
+ // one install directory for each component **GROUP**
+ // instead of the default
+ // one install directory for each component.
+ tempInstallDirectory += GetComponentInstallDirNameSuffix(component);
+ if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY")) {
+ tempInstallDirectory += "/";
+ tempInstallDirectory += this->GetOption("CPACK_PACKAGE_FILE_NAME");
+ }
+ }
- if (!cmsys::SystemTools::MakeDirectory(tempInstallDirectory,
- default_dir_mode)) {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Problem creating temporary directory: "
- << tempInstallDirectory << std::endl);
- return 0;
- }
+ const char* default_dir_inst_permissions =
+ this->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS");
+ if (default_dir_inst_permissions && *default_dir_inst_permissions) {
+ mf.AddDefinition("CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS",
+ default_dir_inst_permissions);
+ }
- cmCPackLogger(cmCPackLog::LOG_DEBUG,
- "- Using non-DESTDIR install... (mf.AddDefinition)"
- << std::endl);
- cmCPackLogger(cmCPackLog::LOG_DEBUG,
- "- Setting CMAKE_INSTALL_PREFIX to '"
- << tempInstallDirectory << "'" << std::endl);
- }
+ if (!setDestDir) {
+ tempInstallDirectory += this->GetPackagingInstallPrefix();
+ }
- if (!buildConfig.empty()) {
- mf.AddDefinition("BUILD_TYPE", buildConfig.c_str());
- }
- std::string installComponentLowerCase =
- cmSystemTools::LowerCase(installComponent);
- if (installComponentLowerCase != "all") {
- mf.AddDefinition("CMAKE_INSTALL_COMPONENT",
- installComponent.c_str());
- }
+ if (setDestDir) {
+ // For DESTDIR based packaging, use the *project*
+ // CMAKE_INSTALL_PREFIX underneath the tempInstallDirectory. The
+ // value of the project's CMAKE_INSTALL_PREFIX is sent in here as
+ // the value of the CPACK_INSTALL_PREFIX variable.
+ //
+ // If DESTDIR has been 'internally set ON' this means that
+ // the underlying CPack specific generator did ask for that
+ // In this case we may override CPACK_INSTALL_PREFIX with
+ // CPACK_PACKAGING_INSTALL_PREFIX
+ // I know this is tricky and awkward but it's the price for
+ // CPACK_SET_DESTDIR backward compatibility.
+ if (cmSystemTools::IsInternallyOn(this->GetOption("CPACK_SET_DESTDIR"))) {
+ this->SetOption("CPACK_INSTALL_PREFIX",
+ this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX"));
+ }
+ std::string dir;
+ if (this->GetOption("CPACK_INSTALL_PREFIX")) {
+ dir += this->GetOption("CPACK_INSTALL_PREFIX");
+ }
+ mf.AddDefinition("CMAKE_INSTALL_PREFIX", dir.c_str());
- // strip on TRUE, ON, 1, one or several file names, but not on
- // FALSE, OFF, 0 and an empty string
- if (!cmSystemTools::IsOff(this->GetOption("CPACK_STRIP_FILES"))) {
- mf.AddDefinition("CMAKE_INSTALL_DO_STRIP", "1");
- }
- // Remember the list of files before installation
- // of the current component (if we are in component install)
- std::string const& InstallPrefix = tempInstallDirectory;
- std::vector<std::string> filesBefore;
- std::string findExpr = tempInstallDirectory;
- if (componentInstall) {
- cmsys::Glob glB;
- findExpr += "/*";
- glB.RecurseOn();
- glB.SetRecurseListDirs(true);
- glB.FindFiles(findExpr);
- filesBefore = glB.GetFiles();
- std::sort(filesBefore.begin(), filesBefore.end());
- }
+ cmCPackLogger(
+ cmCPackLog::LOG_DEBUG,
+ "- Using DESTDIR + CPACK_INSTALL_PREFIX... (mf.AddDefinition)"
+ << std::endl);
+ cmCPackLogger(cmCPackLog::LOG_DEBUG,
+ "- Setting CMAKE_INSTALL_PREFIX to '" << dir << "'"
+ << std::endl);
+
+ // Make sure that DESTDIR + CPACK_INSTALL_PREFIX directory
+ // exists:
+ //
+ if (cmSystemTools::StringStartsWith(dir.c_str(), "/")) {
+ dir = tempInstallDirectory + dir;
+ } else {
+ dir = tempInstallDirectory + "/" + dir;
+ }
+ /*
+ * We must re-set DESTDIR for each component
+ * We must not add the CPACK_INSTALL_PREFIX part because
+ * it will be added using the override of CMAKE_INSTALL_PREFIX
+ * The main reason for this awkward trick is that
+ * are using DESTDIR for 2 different reasons:
+ * - Because it was asked by the CPack Generator or the user
+ * using CPACK_SET_DESTDIR
+ * - Because it was already used for component install
+ * in order to put things in subdirs...
+ */
+ cmSystemTools::PutEnv(std::string("DESTDIR=") + tempInstallDirectory);
+ cmCPackLogger(cmCPackLog::LOG_DEBUG,
+ "- Creating directory: '" << dir << "'" << std::endl);
- // If CPack was asked to warn on ABSOLUTE INSTALL DESTINATION
- // then forward request to cmake_install.cmake script
- if (this->IsOn("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION")) {
- mf.AddDefinition("CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION", "1");
- }
- // If current CPack generator does support
- // ABSOLUTE INSTALL DESTINATION or CPack has been asked for
- // then ask cmake_install.cmake script to error out
- // as soon as it occurs (before installing file)
- if (!SupportsAbsoluteDestination() ||
- this->IsOn("CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION")) {
- mf.AddDefinition("CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION", "1");
- }
- // do installation
- int res = mf.ReadListFile(installFile.c_str());
- // forward definition of CMAKE_ABSOLUTE_DESTINATION_FILES
- // to CPack (may be used by generators like CPack RPM or DEB)
- // in order to transparently handle ABSOLUTE PATH
- if (mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")) {
- mf.AddDefinition(
- "CPACK_ABSOLUTE_DESTINATION_FILES",
- mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES"));
- }
+ if (!cmsys::SystemTools::MakeDirectory(dir, default_dir_mode)) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Problem creating temporary directory: " << dir
+ << std::endl);
+ return 0;
+ }
+ } else {
+ mf.AddDefinition("CMAKE_INSTALL_PREFIX", tempInstallDirectory.c_str());
- // Now rebuild the list of files after installation
- // of the current component (if we are in component install)
- if (componentInstall) {
- cmsys::Glob glA;
- glA.RecurseOn();
- glA.SetRecurseListDirs(true);
- glA.SetRecurseThroughSymlinks(false);
- glA.FindFiles(findExpr);
- std::vector<std::string> filesAfter = glA.GetFiles();
- std::sort(filesAfter.begin(), filesAfter.end());
- std::vector<std::string>::iterator diff;
- std::vector<std::string> result(filesAfter.size());
- diff = std::set_difference(filesAfter.begin(), filesAfter.end(),
- filesBefore.begin(), filesBefore.end(),
- result.begin());
-
- std::vector<std::string>::iterator fit;
- std::string localFileName;
- // Populate the File field of each component
- for (fit = result.begin(); fit != diff; ++fit) {
- localFileName = cmSystemTools::RelativePath(InstallPrefix, *fit);
- localFileName =
- localFileName.substr(localFileName.find_first_not_of('/'));
- Components[installComponent].Files.push_back(localFileName);
- cmCPackLogger(cmCPackLog::LOG_DEBUG,
- "Adding file <"
- << localFileName << "> to component <"
- << installComponent << ">" << std::endl);
- }
- }
+ if (!cmsys::SystemTools::MakeDirectory(tempInstallDirectory,
+ default_dir_mode)) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Problem creating temporary directory: "
+ << tempInstallDirectory << std::endl);
+ return 0;
+ }
- if (nullptr != mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
- if (!absoluteDestFiles.empty()) {
- absoluteDestFiles += ";";
- }
- absoluteDestFiles +=
- mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES");
- cmCPackLogger(cmCPackLog::LOG_DEBUG,
- "Got some ABSOLUTE DESTINATION FILES: "
- << absoluteDestFiles << std::endl);
- // define component specific var
- if (componentInstall) {
- std::string absoluteDestFileComponent =
- std::string("CPACK_ABSOLUTE_DESTINATION_FILES") + "_" +
- GetComponentInstallDirNameSuffix(installComponent);
- if (nullptr != this->GetOption(absoluteDestFileComponent)) {
- std::string absoluteDestFilesListComponent =
- this->GetOption(absoluteDestFileComponent);
- absoluteDestFilesListComponent += ";";
- absoluteDestFilesListComponent +=
- mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES");
- this->SetOption(absoluteDestFileComponent,
- absoluteDestFilesListComponent.c_str());
- } else {
- this->SetOption(
- absoluteDestFileComponent,
- mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"));
- }
- }
- }
- if (cmSystemTools::GetErrorOccuredFlag() || !res) {
- return 0;
- }
+ cmCPackLogger(cmCPackLog::LOG_DEBUG,
+ "- Using non-DESTDIR install... (mf.AddDefinition)"
+ << std::endl);
+ cmCPackLogger(cmCPackLog::LOG_DEBUG,
+ "- Setting CMAKE_INSTALL_PREFIX to '" << tempInstallDirectory
+ << "'" << std::endl);
+ }
+
+ if (!buildConfig.empty()) {
+ mf.AddDefinition("BUILD_TYPE", buildConfig.c_str());
+ }
+ std::string installComponentLowerCase = cmSystemTools::LowerCase(component);
+ if (installComponentLowerCase != "all") {
+ mf.AddDefinition("CMAKE_INSTALL_COMPONENT", component.c_str());
+ }
+
+ // strip on TRUE, ON, 1, one or several file names, but not on
+ // FALSE, OFF, 0 and an empty string
+ if (!cmSystemTools::IsOff(this->GetOption("CPACK_STRIP_FILES"))) {
+ mf.AddDefinition("CMAKE_INSTALL_DO_STRIP", "1");
+ }
+ // Remember the list of files before installation
+ // of the current component (if we are in component install)
+ std::string const& InstallPrefix = tempInstallDirectory;
+ std::vector<std::string> filesBefore;
+ std::string findExpr = tempInstallDirectory;
+ if (componentInstall) {
+ cmsys::Glob glB;
+ findExpr += "/*";
+ glB.RecurseOn();
+ glB.SetRecurseListDirs(true);
+ glB.FindFiles(findExpr);
+ filesBefore = glB.GetFiles();
+ std::sort(filesBefore.begin(), filesBefore.end());
+ }
+
+ // If CPack was asked to warn on ABSOLUTE INSTALL DESTINATION
+ // then forward request to cmake_install.cmake script
+ if (this->IsOn("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION")) {
+ mf.AddDefinition("CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION", "1");
+ }
+ // If current CPack generator does support
+ // ABSOLUTE INSTALL DESTINATION or CPack has been asked for
+ // then ask cmake_install.cmake script to error out
+ // as soon as it occurs (before installing file)
+ if (!SupportsAbsoluteDestination() ||
+ this->IsOn("CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION")) {
+ mf.AddDefinition("CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION", "1");
+ }
+ // do installation
+ int res = mf.ReadListFile(installFile.c_str());
+ // forward definition of CMAKE_ABSOLUTE_DESTINATION_FILES
+ // to CPack (may be used by generators like CPack RPM or DEB)
+ // in order to transparently handle ABSOLUTE PATH
+ if (mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")) {
+ mf.AddDefinition("CPACK_ABSOLUTE_DESTINATION_FILES",
+ mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES"));
+ }
+
+ // Now rebuild the list of files after installation
+ // of the current component (if we are in component install)
+ if (componentInstall) {
+ cmsys::Glob glA;
+ glA.RecurseOn();
+ glA.SetRecurseListDirs(true);
+ glA.SetRecurseThroughSymlinks(false);
+ glA.FindFiles(findExpr);
+ std::vector<std::string> filesAfter = glA.GetFiles();
+ std::sort(filesAfter.begin(), filesAfter.end());
+ std::vector<std::string>::iterator diff;
+ std::vector<std::string> result(filesAfter.size());
+ diff = std::set_difference(filesAfter.begin(), filesAfter.end(),
+ filesBefore.begin(), filesBefore.end(),
+ result.begin());
+
+ std::vector<std::string>::iterator fit;
+ std::string localFileName;
+ // Populate the File field of each component
+ for (fit = result.begin(); fit != diff; ++fit) {
+ localFileName = cmSystemTools::RelativePath(InstallPrefix, *fit);
+ localFileName =
+ localFileName.substr(localFileName.find_first_not_of('/'));
+ Components[component].Files.push_back(localFileName);
+ cmCPackLogger(cmCPackLog::LOG_DEBUG,
+ "Adding file <" << localFileName << "> to component <"
+ << component << ">" << std::endl);
+ }
+ }
+
+ if (nullptr != mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
+ if (!absoluteDestFiles.empty()) {
+ absoluteDestFiles += ";";
+ }
+ absoluteDestFiles += mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES");
+ cmCPackLogger(cmCPackLog::LOG_DEBUG,
+ "Got some ABSOLUTE DESTINATION FILES: " << absoluteDestFiles
+ << std::endl);
+ // define component specific var
+ if (componentInstall) {
+ std::string absoluteDestFileComponent =
+ std::string("CPACK_ABSOLUTE_DESTINATION_FILES") + "_" +
+ GetComponentInstallDirNameSuffix(component);
+ if (nullptr != this->GetOption(absoluteDestFileComponent)) {
+ std::string absoluteDestFilesListComponent =
+ this->GetOption(absoluteDestFileComponent);
+ absoluteDestFilesListComponent += ";";
+ absoluteDestFilesListComponent +=
+ mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES");
+ this->SetOption(absoluteDestFileComponent,
+ absoluteDestFilesListComponent.c_str());
+ } else {
+ this->SetOption(absoluteDestFileComponent,
+ mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"));
}
}
}
- this->SetOption("CPACK_ABSOLUTE_DESTINATION_FILES",
- absoluteDestFiles.c_str());
+ if (cmSystemTools::GetErrorOccuredFlag() || !res) {
+ return 0;
+ }
return 1;
}
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index c22f36b..4755f94 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -15,6 +15,7 @@
#include "cm_sys_stat.h"
class cmCPackLog;
+class cmGlobalGenerator;
class cmInstalledFile;
class cmMakefile;
@@ -185,6 +186,17 @@ protected:
bool setDestDir, const std::string& tempInstallDirectory,
const mode_t* default_dir_mode);
+ virtual int RunPreinstallTarget(const std::string& installProjectName,
+ const std::string& installDirectory,
+ cmGlobalGenerator* globalGenerator,
+ const std::string& buildConfig);
+ virtual int InstallCMakeProject(
+ bool setDestDir, const std::string& installDirectory,
+ const std::string& baseTempInstallDirectory,
+ const mode_t* default_dir_mode, const std::string& component,
+ bool componentInstall, const std::string& installSubDirectory,
+ const std::string& buildConfig, std::string& absoluteDestFiles);
+
/**
* The various level of support of
* CPACK_SET_DESTDIR used by the generator.
@@ -271,6 +283,7 @@ protected:
*/
std::vector<std::string> files;
+ std::vector<cmCPackInstallCMakeProject> CMakeProjects;
std::map<std::string, cmCPackInstallationType> InstallationTypes;
/**
* The set of components.
@@ -308,7 +321,6 @@ protected:
bool Trace;
bool TraceExpand;
-private:
cmMakefile* MakefileMap;
};
diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx
index d47e5ed..8ef24f7 100644
--- a/Source/CPack/cmCPackGeneratorFactory.cxx
+++ b/Source/CPack/cmCPackGeneratorFactory.cxx
@@ -12,6 +12,7 @@
# include "cmCPackFreeBSDGenerator.h"
#endif
#include "cmCPackDebGenerator.h"
+#include "cmCPackExtGenerator.h"
#include "cmCPackGenerator.h"
#include "cmCPackLog.h"
#include "cmCPackNSISGenerator.h"
@@ -110,6 +111,10 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
this->RegisterGenerator("NuGet", "NuGet packages",
cmCPackNuGetGenerator::CreateGenerator);
}
+ if (cmCPackExtGenerator::CanGenerate()) {
+ this->RegisterGenerator("Ext", "CPack External packages",
+ cmCPackExtGenerator::CreateGenerator);
+ }
#ifdef __APPLE__
if (cmCPackDragNDropGenerator::CanGenerate()) {
this->RegisterGenerator("DragNDrop", "Mac OSX Drag And Drop",
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index a893a0f..f75a750 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -305,7 +305,7 @@ int cmCPackNSISGenerator::PackageFiles()
nsisCmd.c_str(), &output, &output, &retVal, nullptr,
this->GeneratorVerbose, cmDuration::zero());
if (!res || retVal) {
- cmGeneratedFileStream ofs(tmpFile.c_str());
+ cmGeneratedFileStream ofs(tmpFile);
ofs << "# Run command: " << nsisCmd << std::endl
<< "# Output:" << std::endl
<< output << std::endl;
@@ -416,7 +416,7 @@ int cmCPackNSISGenerator::InitializeInternal()
const char* topDir = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
std::string tmpFile = topDir ? topDir : ".";
tmpFile += "/NSISOutput.log";
- cmGeneratedFileStream ofs(tmpFile.c_str());
+ cmGeneratedFileStream ofs(tmpFile);
ofs << "# Run command: " << nsisCmd << std::endl
<< "# Output:" << std::endl
<< output << std::endl;
@@ -703,7 +703,7 @@ std::string cmCPackNSISGenerator::CreateComponentDescription(
// Find a ZIP program
if (!this->IsSet("ZIP_EXECUTABLE")) {
- this->ReadListFile("CPackZIP.cmake");
+ this->ReadListFile("Internal/CPack/CPackZIP.cmake");
if (!this->IsSet("ZIP_EXECUTABLE")) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -726,7 +726,7 @@ std::string cmCPackNSISGenerator::CreateComponentDescription(
cmSystemTools::IsOn(this->GetOption("CPACK_ZIP_NEED_QUOTES"));
unsigned long totalSize = 0;
{ // the scope is needed for cmGeneratedFileStream
- cmGeneratedFileStream out(zipListFileName.c_str());
+ cmGeneratedFileStream out(zipListFileName);
for (std::string const& file : component->Files) {
if (needQuotesInFile) {
out << "\"";
@@ -754,7 +754,7 @@ std::string cmCPackNSISGenerator::CreateComponentDescription(
if (!res || retVal) {
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
tmpFile += "/CompressZip.log";
- cmGeneratedFileStream ofs(tmpFile.c_str());
+ cmGeneratedFileStream ofs(tmpFile);
ofs << "# Run command: " << cmd << std::endl
<< "# Output:" << std::endl
<< output << std::endl;
diff --git a/Source/CPack/cmCPackNuGetGenerator.cxx b/Source/CPack/cmCPackNuGetGenerator.cxx
index 2ae8cba..76f0699 100644
--- a/Source/CPack/cmCPackNuGetGenerator.cxx
+++ b/Source/CPack/cmCPackNuGetGenerator.cxx
@@ -49,7 +49,7 @@ int cmCPackNuGetGenerator::PackageFiles()
this->SetOption("CPACK_NUGET_ORDINAL_MONOLITIC", "TRUE");
}
- auto retval = this->ReadListFile("CPackNuGet.cmake");
+ auto retval = this->ReadListFile("Internal/CPack/CPackNuGet.cmake");
if (retval) {
AddGeneratedPackageNames();
} else {
diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx
index 4ca0fa8..76b3275 100644
--- a/Source/CPack/cmCPackProductBuildGenerator.cxx
+++ b/Source/CPack/cmCPackProductBuildGenerator.cxx
@@ -144,10 +144,10 @@ bool cmCPackProductBuildGenerator::RunProductBuild(const std::string& command)
tmpFile += "/ProductBuildOutput.log";
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << command << std::endl);
- std::string output, error_output;
+ std::string output;
int retVal = 1;
bool res = cmSystemTools::RunSingleCommand(
- command.c_str(), &output, &error_output, &retVal, nullptr,
+ command.c_str(), &output, &output, &retVal, nullptr,
this->GeneratorVerbose, cmDuration::zero());
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Done running command" << std::endl);
if (!res || retVal) {
diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx
index c389884..5834829 100644
--- a/Source/CPack/cmCPackRPMGenerator.cxx
+++ b/Source/CPack/cmCPackRPMGenerator.cxx
@@ -89,7 +89,7 @@ int cmCPackRPMGenerator::PackageOnePack(std::string const& initialToplevel,
component_path += packageName;
this->SetOption("CPACK_RPM_PACKAGE_COMPONENT_PART_PATH",
component_path.c_str());
- if (!this->ReadListFile("CPackRPM.cmake")) {
+ if (!this->ReadListFile("Internal/CPack/CPackRPM.cmake")) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Error while execution CPackRPM.cmake" << std::endl);
retval = 0;
@@ -385,7 +385,7 @@ int cmCPackRPMGenerator::PackageComponentsAllInOne(
component_path.c_str());
}
- if (this->ReadListFile("CPackRPM.cmake")) {
+ if (this->ReadListFile("Internal/CPack/CPackRPM.cmake")) {
AddGeneratedPackageNames();
} else {
cmCPackLogger(cmCPackLog::LOG_ERROR,
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 8527d54..c5941ce 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -83,6 +83,7 @@ static const char* cmCTestErrorExceptions[] = {
"instantiated from ",
"candidates are:",
": warning",
+ ": WARNING",
": \\(Warning\\)",
": note",
"Note:",
@@ -589,7 +590,7 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(cmXMLWriter& xml)
for (cmCTestCompileErrorWarningRex& rit :
this->ErrorWarningFileLineRegex) {
cmsys::RegularExpression* re = &rit.RegularExpression;
- if (re->find(cm->Text.c_str())) {
+ if (re->find(cm->Text)) {
cm->SourceFile = re->match(rit.FileIndex);
// At this point we need to make this->SourceFile relative to
// the source root of the project, so cvs links will work
@@ -742,7 +743,7 @@ void cmCTestBuildHandler::LaunchHelper::WriteLauncherConfig()
// Give some testing configuration information to the launcher.
std::string fname = this->Handler->CTestLaunchDir;
fname += "/CTestLaunchConfig.cmake";
- cmGeneratedFileStream fout(fname.c_str());
+ cmGeneratedFileStream fout(fname);
std::string srcdir = this->CTest->GetCTestConfiguration("SourceDirectory");
fout << "set(CTEST_SOURCE_DIRECTORY \"" << srcdir << "\")\n";
}
@@ -757,7 +758,7 @@ void cmCTestBuildHandler::LaunchHelper::WriteScrapeMatchers(
fname += "/Custom";
fname += purpose;
fname += ".txt";
- cmGeneratedFileStream fout(fname.c_str());
+ cmGeneratedFileStream fout(fname);
for (std::string const& m : matchers) {
fout << m << "\n";
}
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 43a2bae..1d9a5f7 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -1075,7 +1075,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
if (line.empty()) {
// Ignore empty line; probably style 2
- } else if (st1re1.find(line.c_str())) {
+ } else if (st1re1.find(line)) {
if (gcovStyle == 0) {
gcovStyle = 1;
}
@@ -1088,7 +1088,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
actualSourceFile.clear();
sourceFile = st1re1.match(2);
- } else if (st1re2.find(line.c_str())) {
+ } else if (st1re2.find(line)) {
if (gcovStyle == 0) {
gcovStyle = 1;
}
@@ -1100,7 +1100,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
}
gcovFile = st1re2.match(1);
- } else if (st2re1.find(line.c_str())) {
+ } else if (st2re1.find(line)) {
if (gcovStyle == 0) {
gcovStyle = 2;
}
@@ -1113,7 +1113,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
actualSourceFile.clear();
sourceFile = st2re1.match(1);
- } else if (st2re2.find(line.c_str())) {
+ } else if (st2re2.find(line)) {
if (gcovStyle == 0) {
gcovStyle = 2;
}
@@ -1123,7 +1123,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
cont->Error++;
break;
}
- } else if (st2re3.find(line.c_str())) {
+ } else if (st2re3.find(line)) {
if (gcovStyle == 0) {
gcovStyle = 2;
}
@@ -1135,7 +1135,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
}
gcovFile = st2re3.match(2);
- } else if (st2re4.find(line.c_str())) {
+ } else if (st2re4.find(line)) {
if (gcovStyle == 0) {
gcovStyle = 2;
}
@@ -1150,7 +1150,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
"Warning: " << st2re4.match(1)
<< " had unexpected EOF" << std::endl,
this->Quiet);
- } else if (st2re5.find(line.c_str())) {
+ } else if (st2re5.find(line)) {
if (gcovStyle == 0) {
gcovStyle = 2;
}
@@ -1165,7 +1165,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
"Warning: Cannot open file: " << st2re5.match(1)
<< std::endl,
this->Quiet);
- } else if (st2re6.find(line.c_str())) {
+ } else if (st2re6.find(line)) {
if (gcovStyle == 0) {
gcovStyle = 2;
}
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index 0bffde3..6cd1c09 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -345,7 +345,7 @@ void cmCTestLaunch::WriteXML()
logXML += ".xml";
// Use cmGeneratedFileStream to atomically create the report file.
- cmGeneratedFileStream fxml(logXML.c_str());
+ cmGeneratedFileStream fxml(logXML);
cmXMLWriter xml(fxml, 2);
cmXMLElement e2(xml, "Failure");
e2.Attribute("type", this->IsError() ? "Error" : "Warning");
@@ -584,7 +584,7 @@ bool cmCTestLaunch::Match(std::string const& line,
std::vector<cmsys::RegularExpression>& regexps)
{
for (cmsys::RegularExpression& r : regexps) {
- if (r.find(line.c_str())) {
+ if (r.find(line)) {
return true;
}
}
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 04d1839..9c9532a 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -1087,7 +1087,7 @@ void cmCTestMemCheckHandler::TestOutputFileNames(
g.FindFiles(ofile);
if (g.GetFiles().empty()) {
std::string log = "Cannot find memory tester output file: " + ofile;
- cmCTestLog(this->CTest, ERROR_MESSAGE, log << std::endl);
+ cmCTestLog(this->CTest, WARNING, log << std::endl);
ofile.clear();
} else {
files = g.GetFiles();
@@ -1095,7 +1095,7 @@ void cmCTestMemCheckHandler::TestOutputFileNames(
}
} else if (!cmSystemTools::FileExists(ofile)) {
std::string log = "Cannot find memory tester output file: " + ofile;
- cmCTestLog(this->CTest, ERROR_MESSAGE, log << std::endl);
+ cmCTestLog(this->CTest, WARNING, log << std::endl);
ofile.clear();
}
files.push_back(std::move(ofile));
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index dcef8a0..52db9d4 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -15,7 +15,6 @@
#include "cmUVSignalHackRAII.h" // IWYU pragma: keep
#include "cmsys/FStream.hxx"
-#include "cmsys/String.hxx"
#include "cmsys/SystemInformation.hxx"
#include <algorithm>
@@ -458,7 +457,7 @@ void cmCTestMultiProcessHandler::UpdateCostData()
if (line == "---") {
break;
}
- std::vector<cmsys::String> parts = cmSystemTools::SplitString(line, ' ');
+ std::vector<std::string> parts = cmSystemTools::SplitString(line, ' ');
// Format: <name> <previous_runs> <avg_cost>
if (parts.size() < 3) {
break;
@@ -511,7 +510,7 @@ void cmCTestMultiProcessHandler::ReadCostData()
break;
}
- std::vector<cmsys::String> parts = cmSystemTools::SplitString(line, ' ');
+ std::vector<std::string> parts = cmSystemTools::SplitString(line, ' ');
// Probably an older version of the file, will be fixed next run
if (parts.size() < 3) {
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 927797a..ef0a49d 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -49,7 +49,7 @@ void cmCTestRunTest::CheckOutput(std::string const& line)
// Check for TIMEOUT_AFTER_MATCH property.
if (!this->TestProperties->TimeoutRegularExpressions.empty()) {
for (auto& reg : this->TestProperties->TimeoutRegularExpressions) {
- if (reg.first.find(this->ProcessOutput.c_str())) {
+ if (reg.first.find(this->ProcessOutput)) {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
this->GetIndex()
<< ": "
@@ -148,7 +148,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
this->FailedDependencies.empty()) {
bool found = false;
for (auto& pass : this->TestProperties->RequiredRegularExpressions) {
- if (pass.first.find(this->ProcessOutput.c_str())) {
+ if (pass.first.find(this->ProcessOutput)) {
found = true;
reason = "Required regular expression found.";
break;
@@ -168,7 +168,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
if (!this->TestProperties->ErrorRegularExpressions.empty() &&
this->FailedDependencies.empty()) {
for (auto& pass : this->TestProperties->ErrorRegularExpressions) {
- if (pass.first.find(this->ProcessOutput.c_str())) {
+ if (pass.first.find(this->ProcessOutput)) {
reason = "Error regular expression found in output.";
reason += " Regex=[";
reason += pass.second;
@@ -616,10 +616,10 @@ void cmCTestRunTest::DartProcessing()
{
if (!this->ProcessOutput.empty() &&
this->ProcessOutput.find("<DartMeasurement") != std::string::npos) {
- if (this->TestHandler->DartStuff.find(this->ProcessOutput.c_str())) {
+ if (this->TestHandler->DartStuff.find(this->ProcessOutput)) {
this->TestResult.DartString = this->TestHandler->DartStuff.match(1);
// keep searching and replacing until none are left
- while (this->TestHandler->DartStuff1.find(this->ProcessOutput.c_str())) {
+ while (this->TestHandler->DartStuff1.find(this->ProcessOutput)) {
// replace the exact match for the string
cmSystemTools::ReplaceString(
this->ProcessOutput, this->TestHandler->DartStuff1.match(1).c_str(),
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 333c899..6b62bb4 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -792,7 +792,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Write CMake output to file: " << cmakeOutputFile
<< std::endl);
- cmGeneratedFileStream fout(cmakeOutputFile.c_str());
+ cmGeneratedFileStream fout(cmakeOutputFile);
if (fout) {
fout << output.c_str();
} else {
@@ -856,7 +856,7 @@ bool cmCTestScriptHandler::WriteInitialCache(const char* directory,
{
std::string cacheFile = directory;
cacheFile += "/CMakeCache.txt";
- cmGeneratedFileStream fout(cacheFile.c_str());
+ cmGeneratedFileStream fout(cacheFile);
if (!fout) {
return false;
}
diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx
index 3911540..47006c1 100644
--- a/Source/CTest/cmCTestStartCommand.cxx
+++ b/Source/CTest/cmCTestStartCommand.cxx
@@ -121,7 +121,7 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args,
// Log startup actions.
std::string startLogFile = binaryDir + "/Testing/Temporary/LastStart.log";
- cmGeneratedFileStream ofs(startLogFile.c_str());
+ cmGeneratedFileStream ofs(startLogFile);
if (!ofs) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot create log file: LastStart.log" << std::endl);
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 4c2b75e..cbed40e 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -454,6 +454,10 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
// specify target
::curl_easy_setopt(curl, CURLOPT_URL, upload_as.c_str());
+ // CURLAUTH_BASIC is default, and here we allow additional methods,
+ // including more secure ones
+ ::curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
+
// now specify which file to upload
::curl_easy_setopt(curl, CURLOPT_INFILE, ftpfile);
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 91b92a3..d1d8d08 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -2310,7 +2310,7 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
this->Quiet);
if (this->UseExcludeRegExpFlag && this->UseExcludeRegExpFirst &&
- this->ExcludeTestsRegularExpression.find(testname.c_str())) {
+ this->ExcludeTestsRegularExpression.find(testname)) {
return true;
}
if (this->MemCheck) {
@@ -2365,10 +2365,10 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
test.SkipReturnCode = -1;
test.PreviousRuns = 0;
if (this->UseIncludeRegExpFlag &&
- !this->IncludeTestsRegularExpression.find(testname.c_str())) {
+ !this->IncludeTestsRegularExpression.find(testname)) {
test.IsInBasedOnREOptions = false;
} else if (this->UseExcludeRegExpFlag && !this->UseExcludeRegExpFirst &&
- this->ExcludeTestsRegularExpression.find(testname.c_str())) {
+ this->ExcludeTestsRegularExpression.find(testname)) {
test.IsInBasedOnREOptions = false;
}
this->TestList.push_back(test);
diff --git a/Source/Checks/cm_cxx14_check.cmake b/Source/Checks/cm_cxx14_check.cmake
index a78ba35..38606b9 100644
--- a/Source/Checks/cm_cxx14_check.cmake
+++ b/Source/Checks/cm_cxx14_check.cmake
@@ -1,5 +1,5 @@
set(CMake_CXX14_BROKEN 0)
-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|PGI")
if(NOT CMAKE_CXX14_STANDARD_COMPILE_OPTION)
set(CMake_CXX14_WORKS 0)
endif()
diff --git a/Source/Checks/cm_cxx14_check.cpp b/Source/Checks/cm_cxx14_check.cpp
index f5806a9..9369ba2 100644
--- a/Source/Checks/cm_cxx14_check.cpp
+++ b/Source/Checks/cm_cxx14_check.cpp
@@ -1,5 +1,8 @@
#include <cstdio>
+#include <memory>
+
int main()
{
- return 0;
+ std::unique_ptr<int> u(new int(0));
+ return *u;
}
diff --git a/Source/Checks/cm_cxx17_check.cmake b/Source/Checks/cm_cxx17_check.cmake
index 83d3971..4da2fd7 100644
--- a/Source/Checks/cm_cxx17_check.cmake
+++ b/Source/Checks/cm_cxx17_check.cmake
@@ -1,5 +1,5 @@
set(CMake_CXX17_BROKEN 0)
-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|PGI")
if(NOT CMAKE_CXX17_STANDARD_COMPILE_OPTION)
set(CMake_CXX17_WORKS 0)
endif()
diff --git a/Source/Checks/cm_cxx17_check.cpp b/Source/Checks/cm_cxx17_check.cpp
index 2cbf1d5..4e89184 100644
--- a/Source/Checks/cm_cxx17_check.cpp
+++ b/Source/Checks/cm_cxx17_check.cpp
@@ -1,7 +1,9 @@
#include <cstdio>
+#include <memory>
#include <unordered_map>
int main()
{
- return 0;
+ std::unique_ptr<int> u(new int(0));
+ return *u;
}
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx
index 9bd1c11..a41d051 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.cxx
+++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx
@@ -43,7 +43,7 @@ void cmCursesLongMessageForm::UpdateStatusBar()
getmaxyx(stdscr, y, x);
char bar[cmCursesMainForm::MAX_WIDTH];
- size_t size = strlen(this->Title.c_str());
+ size_t size = this->Title.size();
if (size >= cmCursesMainForm::MAX_WIDTH) {
size = cmCursesMainForm::MAX_WIDTH - 1;
}
diff --git a/Source/LexerParser/cmCommandArgumentParser.cxx b/Source/LexerParser/cmCommandArgumentParser.cxx
index aed0826..68b9e6c 100644
--- a/Source/LexerParser/cmCommandArgumentParser.cxx
+++ b/Source/LexerParser/cmCommandArgumentParser.cxx
@@ -126,8 +126,11 @@ static void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message);
# pragma warning (disable: 4244) /* loss of precision */
# pragma warning (disable: 4702) /* unreachable code */
#endif
+#if defined(__GNUC__) && __GNUC__ >= 8
+# pragma GCC diagnostic ignored "-Wconversion"
+#endif
-#line 131 "cmCommandArgumentParser.cxx" /* yacc.c:339 */
+#line 134 "cmCommandArgumentParser.cxx" /* yacc.c:339 */
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
@@ -200,7 +203,7 @@ int cmCommandArgument_yyparse (yyscan_t yyscanner);
/* Copy the second part of user declarations. */
-#line 204 "cmCommandArgumentParser.cxx" /* yacc.c:358 */
+#line 207 "cmCommandArgumentParser.cxx" /* yacc.c:358 */
#ifdef short
# undef short
@@ -498,9 +501,9 @@ static const yytype_uint8 yytranslate[] =
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 96, 96, 102, 105, 110, 113, 118, 121, 126,
- 129, 132, 135, 138, 141, 146, 149, 152, 155, 160,
- 163, 168, 171, 176, 179
+ 0, 99, 99, 105, 108, 113, 116, 121, 124, 129,
+ 132, 135, 138, 141, 144, 149, 152, 155, 158, 163,
+ 166, 171, 174, 179, 182
};
#endif
@@ -1297,192 +1300,192 @@ yyreduce:
switch (yyn)
{
case 2:
-#line 96 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 99 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = 0;
yyGetParser->SetResult((yyvsp[0].str));
}
-#line 1306 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1309 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 3:
-#line 102 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 105 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1314 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1317 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 4:
-#line 105 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 108 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str));
}
-#line 1322 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1325 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 5:
-#line 110 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 113 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = 0;
}
-#line 1330 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1333 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 6:
-#line 113 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 116 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str));
}
-#line 1338 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1341 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 7:
-#line 118 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 121 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1346 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1349 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 8:
-#line 121 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 124 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1354 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1357 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 9:
-#line 126 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 129 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1362 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1365 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 10:
-#line 129 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 132 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1370 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1373 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 11:
-#line 132 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 135 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1378 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1381 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 12:
-#line 135 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 138 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1386 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1389 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 13:
-#line 138 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 141 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1394 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1397 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 14:
-#line 141 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 144 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1402 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1405 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 15:
-#line 146 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 149 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[-2].str), (yyvsp[-1].str));
}
-#line 1410 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1413 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 16:
-#line 149 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 152 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[-2].str), (yyvsp[-1].str));
}
-#line 1418 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1421 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 17:
-#line 152 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 155 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = yyGetParser->ExpandVariable((yyvsp[-1].str));
}
-#line 1426 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1429 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 18:
-#line 155 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 158 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = yyGetParser->ExpandVariableForAt((yyvsp[0].str));
}
-#line 1434 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1437 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 19:
-#line 160 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 163 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1442 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1445 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 20:
-#line 163 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 166 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = (yyvsp[-1].str);
}
-#line 1450 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1453 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 21:
-#line 168 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 171 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = 0;
}
-#line 1458 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1461 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 22:
-#line 171 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 174 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str));
}
-#line 1466 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1469 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 23:
-#line 176 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 179 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1474 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1477 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
case 24:
-#line 179 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 182 "cmCommandArgumentParser.y" /* yacc.c:1646 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1482 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1485 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
break;
-#line 1486 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1489 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -1712,7 +1715,7 @@ yyreturn:
#endif
return yyresult;
}
-#line 184 "cmCommandArgumentParser.y" /* yacc.c:1906 */
+#line 187 "cmCommandArgumentParser.y" /* yacc.c:1906 */
/* End of grammar */
diff --git a/Source/LexerParser/cmCommandArgumentParser.y b/Source/LexerParser/cmCommandArgumentParser.y
index 55a88df..0c6aad5 100644
--- a/Source/LexerParser/cmCommandArgumentParser.y
+++ b/Source/LexerParser/cmCommandArgumentParser.y
@@ -55,6 +55,9 @@ static void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message);
# pragma warning (disable: 4244) /* loss of precision */
# pragma warning (disable: 4702) /* unreachable code */
#endif
+#if defined(__GNUC__) && __GNUC__ >= 8
+# pragma GCC diagnostic ignored "-Wconversion"
+#endif
%}
/* Generate a reentrant parser object. */
diff --git a/Source/LexerParser/cmDependsJavaParser.cxx b/Source/LexerParser/cmDependsJavaParser.cxx
index bc45d45..5400a10 100644
--- a/Source/LexerParser/cmDependsJavaParser.cxx
+++ b/Source/LexerParser/cmDependsJavaParser.cxx
@@ -115,8 +115,11 @@ static void cmDependsJava_yyerror(yyscan_t yyscanner, const char* message);
# pragma warning (disable: 4102) /* Unused goto label. */
# pragma warning (disable: 4065) /* Switch statement contains default but no case. */
#endif
+#if defined(__GNUC__) && __GNUC__ >= 8
+# pragma GCC diagnostic ignored "-Wconversion"
+#endif
-#line 120 "cmDependsJavaParser.cxx" /* yacc.c:339 */
+#line 123 "cmDependsJavaParser.cxx" /* yacc.c:339 */
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
@@ -371,7 +374,7 @@ int cmDependsJava_yyparse (yyscan_t yyscanner);
/* Copy the second part of user declarations. */
-#line 375 "cmDependsJavaParser.cxx" /* yacc.c:358 */
+#line 378 "cmDependsJavaParser.cxx" /* yacc.c:358 */
#ifdef short
# undef short
@@ -679,42 +682,42 @@ static const yytype_uint8 yytranslate[] =
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 179, 179, 188, 196, 204, 212, 220, 228, 237,
- 245, 254, 262, 271, 276, 281, 286, 291, 296, 301,
- 306, 312, 320, 329, 339, 348, 357, 365, 375, 381,
- 388, 395, 401, 408, 417, 427, 437, 446, 454, 463,
- 472, 478, 487, 493, 502, 508, 517, 529, 537, 546,
- 558, 571, 579, 587, 596, 604, 613, 613, 613, 614,
- 615, 615, 615, 615, 615, 615, 616, 619, 629, 638,
- 647, 656, 666, 672, 681, 690, 699, 707, 716, 725,
- 731, 740, 748, 756, 764, 773, 781, 790, 796, 804,
- 813, 821, 830, 839, 848, 856, 865, 873, 881, 890,
- 899, 909, 916, 926, 936, 943, 950, 953, 959, 969,
- 979, 989, 995, 1005, 1015, 1025, 1034, 1044, 1055, 1065,
- 1072, 1082, 1091, 1101, 1110, 1120, 1126, 1136, 1145, 1155,
- 1165, 1172, 1181, 1190, 1199, 1208, 1216, 1225, 1234, 1244,
- 1254, 1263, 1273, 1283, 1290, 1299, 1309, 1318, 1328, 1337,
- 1344, 1354, 1363, 1373, 1382, 1391, 1401, 1411, 1420, 1430,
- 1439, 1448, 1457, 1466, 1475, 1485, 1494, 1503, 1512, 1521,
- 1531, 1540, 1549, 1558, 1567, 1576, 1585, 1594, 1603, 1612,
- 1621, 1630, 1640, 1650, 1661, 1671, 1681, 1690, 1699, 1708,
- 1717, 1726, 1735, 1745, 1755, 1765, 1775, 1782, 1789, 1796,
- 1806, 1813, 1823, 1833, 1842, 1852, 1861, 1871, 1878, 1885,
- 1892, 1900, 1907, 1917, 1924, 1934, 1944, 1951, 1961, 1970,
- 1980, 1990, 1999, 2009, 2018, 2028, 2039, 2046, 2053, 2064,
- 2074, 2084, 2094, 2103, 2113, 2120, 2130, 2139, 2149, 2156,
- 2166, 2175, 2185, 2194, 2200, 2209, 2218, 2227, 2236, 2246,
- 2256, 2263, 2273, 2280, 2290, 2299, 2309, 2318, 2327, 2336,
- 2346, 2353, 2363, 2372, 2382, 2392, 2398, 2405, 2415, 2425,
- 2435, 2446, 2456, 2467, 2477, 2488, 2498, 2508, 2517, 2526,
- 2535, 2544, 2554, 2564, 2574, 2583, 2592, 2601, 2610, 2620,
- 2630, 2640, 2649, 2658, 2667, 2677, 2686, 2695, 2702, 2711,
- 2720, 2729, 2739, 2748, 2757, 2767, 2776, 2785, 2794, 2804,
- 2813, 2822, 2831, 2840, 2849, 2859, 2868, 2877, 2887, 2896,
- 2906, 2915, 2925, 2934, 2944, 2953, 2963, 2972, 2982, 2991,
- 3001, 3010, 3020, 3030, 3040, 3049, 3059, 3068, 3077, 3086,
- 3095, 3104, 3113, 3122, 3131, 3140, 3149, 3158, 3168, 3178,
- 3188, 3197
+ 0, 182, 182, 191, 199, 207, 215, 223, 231, 240,
+ 248, 257, 265, 274, 279, 284, 289, 294, 299, 304,
+ 309, 315, 323, 332, 342, 351, 360, 368, 378, 384,
+ 391, 398, 404, 411, 420, 430, 440, 449, 457, 466,
+ 475, 481, 490, 496, 505, 511, 520, 532, 540, 549,
+ 561, 574, 582, 590, 599, 607, 616, 616, 616, 617,
+ 618, 618, 618, 618, 618, 618, 619, 622, 632, 641,
+ 650, 659, 669, 675, 684, 693, 702, 710, 719, 728,
+ 734, 743, 751, 759, 767, 776, 784, 793, 799, 807,
+ 816, 824, 833, 842, 851, 859, 868, 876, 884, 893,
+ 902, 912, 919, 929, 939, 946, 953, 956, 962, 972,
+ 982, 992, 998, 1008, 1018, 1028, 1037, 1047, 1058, 1068,
+ 1075, 1085, 1094, 1104, 1113, 1123, 1129, 1139, 1148, 1158,
+ 1168, 1175, 1184, 1193, 1202, 1211, 1219, 1228, 1237, 1247,
+ 1257, 1266, 1276, 1286, 1293, 1302, 1312, 1321, 1331, 1340,
+ 1347, 1357, 1366, 1376, 1385, 1394, 1404, 1414, 1423, 1433,
+ 1442, 1451, 1460, 1469, 1478, 1488, 1497, 1506, 1515, 1524,
+ 1534, 1543, 1552, 1561, 1570, 1579, 1588, 1597, 1606, 1615,
+ 1624, 1633, 1643, 1653, 1664, 1674, 1684, 1693, 1702, 1711,
+ 1720, 1729, 1738, 1748, 1758, 1768, 1778, 1785, 1792, 1799,
+ 1809, 1816, 1826, 1836, 1845, 1855, 1864, 1874, 1881, 1888,
+ 1895, 1903, 1910, 1920, 1927, 1937, 1947, 1954, 1964, 1973,
+ 1983, 1993, 2002, 2012, 2021, 2031, 2042, 2049, 2056, 2067,
+ 2077, 2087, 2097, 2106, 2116, 2123, 2133, 2142, 2152, 2159,
+ 2169, 2178, 2188, 2197, 2203, 2212, 2221, 2230, 2239, 2249,
+ 2259, 2266, 2276, 2283, 2293, 2302, 2312, 2321, 2330, 2339,
+ 2349, 2356, 2366, 2375, 2385, 2395, 2401, 2408, 2418, 2428,
+ 2438, 2449, 2459, 2470, 2480, 2491, 2501, 2511, 2520, 2529,
+ 2538, 2547, 2557, 2567, 2577, 2586, 2595, 2604, 2613, 2623,
+ 2633, 2643, 2652, 2661, 2670, 2680, 2689, 2698, 2705, 2714,
+ 2723, 2732, 2742, 2751, 2760, 2770, 2779, 2788, 2797, 2807,
+ 2816, 2825, 2834, 2843, 2852, 2862, 2871, 2880, 2890, 2899,
+ 2909, 2918, 2928, 2937, 2947, 2956, 2966, 2975, 2985, 2994,
+ 3004, 3013, 3023, 3033, 3043, 3052, 3062, 3071, 3080, 3089,
+ 3098, 3107, 3116, 3125, 3134, 3143, 3152, 3161, 3171, 3181,
+ 3191, 3200
};
#endif
@@ -2282,214 +2285,214 @@ yyreduce:
switch (yyn)
{
case 2:
-#line 180 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 183 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2293 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2296 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 3:
-#line 189 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 192 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2304 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2307 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 4:
-#line 197 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 200 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2315 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2318 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 5:
-#line 205 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 208 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2326 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2329 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 6:
-#line 213 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 216 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2337 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2340 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 7:
-#line 221 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 224 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2348 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2351 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 8:
-#line 229 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 232 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2359 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2362 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 9:
-#line 238 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 241 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2370 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2373 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 10:
-#line 246 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 249 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2381 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2384 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 11:
-#line 255 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 258 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2392 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2395 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 12:
-#line 263 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 266 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2403 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2406 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 13:
-#line 272 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 275 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
}
-#line 2411 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2414 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 14:
-#line 277 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 280 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
}
-#line 2419 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2422 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 15:
-#line 282 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 285 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
}
-#line 2427 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2430 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 16:
-#line 287 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 290 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
}
-#line 2435 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2438 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 17:
-#line 292 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 295 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
}
-#line 2443 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2446 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 18:
-#line 297 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 300 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
}
-#line 2451 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2454 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 19:
-#line 302 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 305 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
}
-#line 2459 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2462 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 20:
-#line 307 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 310 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
}
-#line 2467 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2470 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 21:
-#line 313 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 316 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2478 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2481 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 22:
-#line 321 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 324 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2489 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2492 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 23:
-#line 330 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 333 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpStoreClass((yyvsp[0].str));
@@ -2497,44 +2500,44 @@ yyreduce:
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2501 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2504 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 24:
-#line 340 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 343 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2512 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2515 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 25:
-#line 349 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 352 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2523 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2526 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 26:
-#line 358 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 361 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2534 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2537 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 27:
-#line 366 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 369 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpStoreClass((yyvsp[-1].str));
@@ -2542,56 +2545,56 @@ yyreduce:
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2546 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2549 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 28:
-#line 376 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 379 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
(yyval.str) = (yyvsp[0].str);
}
-#line 2555 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2558 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 29:
-#line 382 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 385 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
(yyval.str) = (yyvsp[0].str);
}
-#line 2564 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2567 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 30:
-#line 389 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 392 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
(yyval.str) = (yyvsp[0].str);
}
-#line 2573 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2576 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 31:
-#line 396 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 399 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
(yyval.str) = (yyvsp[0].str);
}
-#line 2582 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2585 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 32:
-#line 402 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 405 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
(yyval.str) = (yyvsp[0].str);
}
-#line 2591 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2594 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 33:
-#line 409 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 412 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
yyGetParser->AddClassFound((yyvsp[-2].str));
@@ -2599,11 +2602,11 @@ yyreduce:
yyGetParser->DeallocateParserType(&((yyvsp[-2].str)));
(yyval.str) = const_cast<char*>(yyGetParser->GetCurrentCombine());
}
-#line 2603 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2606 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 34:
-#line 418 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 421 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpStoreClass((yyvsp[-2].str));
@@ -2612,11 +2615,11 @@ yyreduce:
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2616 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2619 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 35:
-#line 428 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 431 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpStoreClass((yyvsp[-2].str));
@@ -2625,118 +2628,118 @@ yyreduce:
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2629 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2632 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 36:
-#line 438 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 441 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2640 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2643 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 37:
-#line 447 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 450 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2651 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2654 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 38:
-#line 455 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 458 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2662 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2665 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 39:
-#line 464 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 467 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2673 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2676 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 40:
-#line 472 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 475 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2683 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2686 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 41:
-#line 479 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 482 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2694 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2697 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 42:
-#line 487 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 490 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2704 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2707 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 43:
-#line 494 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 497 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2715 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2718 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 44:
-#line 502 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 505 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2725 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2728 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 45:
-#line 509 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 512 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2736 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2739 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 46:
-#line 518 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 521 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
yyGetParser->SetCurrentPackage((yyvsp[-1].str));
@@ -2746,33 +2749,33 @@ yyreduce:
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2750 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2753 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 47:
-#line 530 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 533 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2761 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2764 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 48:
-#line 538 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 541 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2772 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2775 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 49:
-#line 547 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 550 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
yyGetParser->AddPackagesImport((yyvsp[-1].str));
@@ -2782,11 +2785,11 @@ yyreduce:
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2786 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2789 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 50:
-#line 559 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 562 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(5);
std::string str = (yyvsp[-3].str);
@@ -2797,77 +2800,77 @@ yyreduce:
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2801 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2804 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 51:
-#line 572 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 575 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2812 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2815 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 52:
-#line 580 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 583 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2823 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2826 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 53:
-#line 588 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 591 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2834 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2837 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 54:
-#line 597 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 600 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2845 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2848 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 55:
-#line 605 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 608 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2856 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2859 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 67:
-#line 620 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 623 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
yyGetParser->StartClass((yyvsp[0].str));
jpElementStart(3);
yyGetParser->DeallocateParserType(&((yyvsp[0].str)));
jpCheckEmpty(3);
}
-#line 2867 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2870 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 68:
-#line 630 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 633 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -2875,11 +2878,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
yyGetParser->EndClass();
}
-#line 2879 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2882 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 69:
-#line 639 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 642 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(2);
@@ -2887,11 +2890,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
yyGetParser->EndClass();
}
-#line 2891 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2894 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 70:
-#line 648 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 651 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -2899,11 +2902,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
yyGetParser->EndClass();
}
-#line 2903 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2906 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 71:
-#line 657 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 660 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -2911,226 +2914,226 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
yyGetParser->EndClass();
}
-#line 2915 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2918 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 72:
-#line 666 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 669 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2925 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2928 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 73:
-#line 673 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 676 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2936 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2939 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 74:
-#line 682 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 685 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2947 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2950 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 75:
-#line 691 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 694 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2958 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2961 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 76:
-#line 700 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 703 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2969 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2972 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 77:
-#line 708 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 711 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2980 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2983 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 78:
-#line 717 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 720 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2991 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2994 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 79:
-#line 725 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 728 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3001 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3004 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 80:
-#line 732 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 735 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3012 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3015 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 81:
-#line 741 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 744 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3023 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3026 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 82:
-#line 749 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 752 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3034 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3037 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 83:
-#line 757 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 760 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3045 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3048 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 84:
-#line 765 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 768 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3056 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3059 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 85:
-#line 774 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 777 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3067 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3070 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 86:
-#line 782 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 785 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3078 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3081 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 87:
-#line 791 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 794 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(4);
}
-#line 3086 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3089 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 88:
-#line 797 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 800 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3097 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3100 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 89:
-#line 805 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 808 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3108 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3111 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 90:
-#line 814 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 817 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3119 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3122 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 91:
-#line 822 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 825 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3130 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3133 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 92:
-#line 831 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 834 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
yyGetParser->DeallocateParserType(&((yyvsp[0].str)));
@@ -3138,77 +3141,77 @@ yyreduce:
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3142 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3145 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 93:
-#line 840 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 843 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3153 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3156 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 94:
-#line 849 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 852 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3164 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3167 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 95:
-#line 857 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 860 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3175 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3178 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 96:
-#line 866 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 869 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3186 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3189 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 97:
-#line 874 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 877 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3197 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3200 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 98:
-#line 882 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 885 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3208 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3211 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 99:
-#line 891 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 894 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -3216,11 +3219,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3220 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3223 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 100:
-#line 900 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 903 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -3228,22 +3231,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3232 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3235 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 101:
-#line 909 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 912 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3243 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3246 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 102:
-#line 917 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 920 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3251,11 +3254,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3255 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3258 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 103:
-#line 927 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 930 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(4);
yyGetParser->DeallocateParserType(&((yyvsp[-3].str)));
@@ -3264,40 +3267,40 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3268 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3271 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 104:
-#line 937 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 940 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
}
-#line 3277 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3280 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 105:
-#line 943 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 946 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3288 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3291 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 107:
-#line 954 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 957 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
}
-#line 3297 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3300 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 108:
-#line 960 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 963 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -3305,11 +3308,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3309 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3312 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 109:
-#line 970 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 973 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -3317,11 +3320,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3321 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3324 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 110:
-#line 980 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 983 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -3329,20 +3332,20 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3333 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3336 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 111:
-#line 990 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 993 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
}
-#line 3342 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3345 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 112:
-#line 996 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 999 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -3350,11 +3353,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3354 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3357 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 113:
-#line 1006 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1009 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3362,11 +3365,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3366 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3369 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 114:
-#line 1016 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1019 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -3374,11 +3377,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3378 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3381 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 115:
-#line 1026 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1029 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -3386,11 +3389,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3390 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3393 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 116:
-#line 1035 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1038 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(5);
jpCheckEmpty(5);
@@ -3398,11 +3401,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3402 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3405 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 117:
-#line 1045 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1048 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(4);
yyGetParser->DeallocateParserType(&((yyvsp[-3].str)));
@@ -3411,11 +3414,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3415 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3418 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 118:
-#line 1056 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1059 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -3423,22 +3426,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3427 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3430 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 119:
-#line 1065 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1068 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3438 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3441 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 120:
-#line 1073 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1076 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -3446,11 +3449,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3450 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3453 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 121:
-#line 1083 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1086 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(5);
jpCheckEmpty(5);
@@ -3458,11 +3461,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3462 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3465 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 122:
-#line 1092 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1095 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(5);
jpCheckEmpty(5);
@@ -3470,22 +3473,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3474 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3477 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 123:
-#line 1102 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1105 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
yyGetParser->StartClass((yyvsp[0].str));
jpElementStart(3);
yyGetParser->DeallocateParserType(&((yyvsp[0].str)));
jpCheckEmpty(3);
}
-#line 3485 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3488 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 124:
-#line 1111 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1114 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -3493,21 +3496,21 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
yyGetParser->EndClass();
}
-#line 3497 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3500 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 125:
-#line 1120 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1123 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3507 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3510 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 126:
-#line 1127 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1130 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3515,11 +3518,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3519 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3522 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 127:
-#line 1137 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1140 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -3527,11 +3530,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3531 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3534 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 128:
-#line 1146 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1149 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -3539,11 +3542,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3543 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3546 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 129:
-#line 1156 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1159 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -3551,33 +3554,33 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3555 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3558 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 130:
-#line 1165 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1168 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3566 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3569 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 131:
-#line 1173 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1176 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3577 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3580 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 132:
-#line 1182 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1185 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3585,11 +3588,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3589 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3592 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 133:
-#line 1191 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1194 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3597,11 +3600,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3601 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3604 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 134:
-#line 1200 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1203 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3609,22 +3612,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3613 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3616 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 135:
-#line 1209 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1212 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3624 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3627 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 136:
-#line 1217 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1220 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3632,22 +3635,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3636 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3639 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 137:
-#line 1226 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1229 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3647 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3650 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 138:
-#line 1235 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1238 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3655,11 +3658,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3659 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3662 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 139:
-#line 1245 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1248 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -3667,11 +3670,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3671 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3674 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 140:
-#line 1255 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1258 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3679,11 +3682,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3683 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3686 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 141:
-#line 1264 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1267 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -3691,11 +3694,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3695 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3698 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 142:
-#line 1274 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1277 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -3703,22 +3706,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3707 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3710 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 143:
-#line 1283 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1286 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3718 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3721 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 144:
-#line 1291 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1294 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3726,11 +3729,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3730 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3733 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 145:
-#line 1300 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1303 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -3738,11 +3741,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3742 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3745 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 146:
-#line 1310 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1313 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3750,11 +3753,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3754 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3757 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 147:
-#line 1319 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1322 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -3762,33 +3765,33 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3766 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3769 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 148:
-#line 1329 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1332 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(4);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3777 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3780 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 149:
-#line 1337 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1340 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3788 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3791 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 150:
-#line 1345 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1348 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3796,11 +3799,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3800 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3803 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 151:
-#line 1355 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1358 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3808,11 +3811,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3812 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3815 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 152:
-#line 1364 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1367 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(2);
@@ -3820,11 +3823,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3824 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3827 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 153:
-#line 1374 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1377 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3832,11 +3835,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3836 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3839 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 154:
-#line 1383 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1386 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3844,11 +3847,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3848 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3851 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 155:
-#line 1392 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1395 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3856,11 +3859,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3860 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3863 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 156:
-#line 1402 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1405 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(2);
@@ -3868,11 +3871,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3872 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3875 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 157:
-#line 1412 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1415 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(3);
@@ -3880,11 +3883,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3884 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3887 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 158:
-#line 1421 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1424 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(2);
@@ -3892,11 +3895,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3896 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3899 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 159:
-#line 1431 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1434 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3904,11 +3907,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3908 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3911 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 160:
-#line 1440 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1443 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3916,11 +3919,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3920 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3923 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 161:
-#line 1449 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1452 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3928,11 +3931,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3932 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3935 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 162:
-#line 1458 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1461 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3940,11 +3943,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3944 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3947 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 163:
-#line 1467 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1470 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3952,11 +3955,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3956 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3959 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 164:
-#line 1476 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1479 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3964,11 +3967,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3968 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3971 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 165:
-#line 1486 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1489 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3976,11 +3979,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3980 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3983 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 166:
-#line 1495 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1498 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3988,11 +3991,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3992 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3995 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 167:
-#line 1504 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1507 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4000,11 +4003,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4004 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4007 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 168:
-#line 1513 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1516 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4012,11 +4015,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4016 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4019 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 169:
-#line 1522 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1525 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4024,11 +4027,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4028 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4031 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 170:
-#line 1532 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1535 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4036,11 +4039,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4040 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4043 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 171:
-#line 1541 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1544 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4048,11 +4051,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4052 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4055 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 172:
-#line 1550 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1553 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4060,11 +4063,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4064 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4067 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 173:
-#line 1559 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1562 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4072,11 +4075,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4076 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4079 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 174:
-#line 1568 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1571 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4084,11 +4087,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4088 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4091 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 175:
-#line 1577 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1580 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4096,11 +4099,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4100 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4103 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 176:
-#line 1586 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1589 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4108,11 +4111,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4112 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4115 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 177:
-#line 1595 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1598 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4120,11 +4123,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4124 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4127 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 178:
-#line 1604 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1607 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4132,11 +4135,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4136 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4139 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 179:
-#line 1613 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1616 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4144,11 +4147,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4148 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4151 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 180:
-#line 1622 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1625 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4156,11 +4159,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4160 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4163 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 181:
-#line 1631 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1634 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4168,11 +4171,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4172 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4175 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 182:
-#line 1641 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1644 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4180,11 +4183,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4184 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4187 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 183:
-#line 1651 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1654 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
yyGetParser->DeallocateParserType(&((yyvsp[-2].str)));
@@ -4193,11 +4196,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4197 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4200 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 184:
-#line 1662 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1665 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -4205,11 +4208,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4209 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4212 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 185:
-#line 1672 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1675 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -4217,11 +4220,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4221 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4224 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 186:
-#line 1682 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1685 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4229,11 +4232,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4233 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4236 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 187:
-#line 1691 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1694 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4241,11 +4244,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4245 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4248 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 188:
-#line 1700 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1703 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4253,11 +4256,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4257 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4260 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 189:
-#line 1709 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1712 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4265,11 +4268,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4269 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4272 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 190:
-#line 1718 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1721 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4277,11 +4280,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4281 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4284 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 191:
-#line 1727 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1730 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4289,11 +4292,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4293 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4296 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 192:
-#line 1736 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1739 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4301,11 +4304,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4305 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4308 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 193:
-#line 1746 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1749 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(5);
jpCheckEmpty(5);
@@ -4313,11 +4316,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4317 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4320 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 194:
-#line 1756 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1759 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(7);
jpCheckEmpty(7);
@@ -4325,11 +4328,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4329 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4332 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 195:
-#line 1766 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1769 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(7);
jpCheckEmpty(7);
@@ -4337,40 +4340,40 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4341 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4344 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 196:
-#line 1776 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1779 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(5);
}
-#line 4350 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4353 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 197:
-#line 1783 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1786 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(4);
}
-#line 4359 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4362 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 198:
-#line 1789 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1792 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 4370 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4373 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 199:
-#line 1797 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1800 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4378,22 +4381,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4382 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4385 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 200:
-#line 1806 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1809 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 4393 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4396 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 201:
-#line 1814 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1817 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -4401,11 +4404,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4405 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4408 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 202:
-#line 1824 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1827 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -4413,11 +4416,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4417 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4420 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 203:
-#line 1834 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1837 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4425,11 +4428,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4429 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4432 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 204:
-#line 1843 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1846 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -4437,11 +4440,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4441 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4444 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 205:
-#line 1853 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1856 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -4449,11 +4452,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4453 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4456 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 206:
-#line 1862 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1865 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -4461,58 +4464,58 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4465 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4468 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 207:
-#line 1872 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1875 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(5);
}
-#line 4474 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4477 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 208:
-#line 1879 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1882 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(5);
}
-#line 4483 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4486 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 209:
-#line 1886 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1889 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(7);
}
-#line 4492 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4495 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 210:
-#line 1894 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1897 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(9);
}
-#line 4501 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4504 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 211:
-#line 1900 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1903 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 4512 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4515 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 212:
-#line 1908 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1911 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4520,22 +4523,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4524 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4527 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 213:
-#line 1917 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1920 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 4535 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4538 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 214:
-#line 1925 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1928 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4543,33 +4546,33 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4547 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4550 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 215:
-#line 1936 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1939 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(9);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 4558 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4561 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 216:
-#line 1944 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1947 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 4569 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4572 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 217:
-#line 1952 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1955 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4577,11 +4580,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4581 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4584 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 218:
-#line 1962 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1965 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4589,11 +4592,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4593 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4596 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 219:
-#line 1971 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1974 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4601,11 +4604,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4605 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4608 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 220:
-#line 1981 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1984 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4613,11 +4616,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4617 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4620 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 221:
-#line 1991 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1994 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4625,11 +4628,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4629 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4632 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 222:
-#line 2000 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2003 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -4637,11 +4640,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4641 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4644 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 223:
-#line 2010 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2013 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -4649,11 +4652,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4653 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4656 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 224:
-#line 2019 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2022 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(5);
jpCheckEmpty(5);
@@ -4661,11 +4664,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4665 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4668 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 225:
-#line 2029 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2032 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
yyGetParser->DeallocateParserType(&((yyvsp[-1].str)));
@@ -4674,31 +4677,31 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4678 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4681 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 226:
-#line 2039 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2042 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 4689 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4692 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 227:
-#line 2047 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2050 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
}
-#line 4698 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4701 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 228:
-#line 2054 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2057 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
yyGetParser->DeallocateParserType(&((yyvsp[-1].str)));
@@ -4707,11 +4710,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4711 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4714 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 229:
-#line 2065 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2068 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -4719,11 +4722,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4723 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4726 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 230:
-#line 2075 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2078 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -4731,11 +4734,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4735 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4738 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 231:
-#line 2085 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2088 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(5);
jpCheckEmpty(5);
@@ -4743,11 +4746,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4747 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4750 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 232:
-#line 2095 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2098 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -4755,11 +4758,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4759 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4762 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 233:
-#line 2104 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2107 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -4767,22 +4770,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4771 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4774 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 234:
-#line 2113 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2116 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 4782 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4785 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 235:
-#line 2121 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2124 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4790,11 +4793,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4794 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4797 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 236:
-#line 2131 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2134 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4802,11 +4805,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4806 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4809 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 237:
-#line 2140 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2143 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -4814,20 +4817,20 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4818 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4821 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 238:
-#line 2150 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2153 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(5);
}
-#line 4827 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4830 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 239:
-#line 2157 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2160 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -4835,11 +4838,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4839 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4842 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 240:
-#line 2167 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2170 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4847,11 +4850,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4851 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4854 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 241:
-#line 2176 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2179 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4859,11 +4862,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4863 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4866 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 242:
-#line 2186 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2189 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4871,20 +4874,20 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4875 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4878 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 243:
-#line 2195 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2198 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
}
-#line 4884 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4887 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 244:
-#line 2201 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2204 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -4892,11 +4895,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4896 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4899 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 245:
-#line 2210 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2213 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4904,11 +4907,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4908 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4911 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 246:
-#line 2219 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2222 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4916,11 +4919,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4920 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4923 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 247:
-#line 2228 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2231 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4928,11 +4931,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4932 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4935 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 248:
-#line 2237 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2240 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4940,11 +4943,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4944 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4947 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 249:
-#line 2247 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2250 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(6);
jpCheckEmpty(6);
@@ -4952,22 +4955,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4956 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4959 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 250:
-#line 2256 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2259 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 4967 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4970 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 251:
-#line 2264 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2267 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4975,22 +4978,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4979 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4982 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 252:
-#line 2273 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2276 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 4990 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4993 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 253:
-#line 2281 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2284 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4998,11 +5001,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5002 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5005 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 254:
-#line 2291 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2294 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5010,11 +5013,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5014 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5017 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 255:
-#line 2300 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2303 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5022,11 +5025,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5026 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5029 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 256:
-#line 2310 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2313 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -5034,11 +5037,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5038 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5041 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 257:
-#line 2319 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2322 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -5046,11 +5049,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5050 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5053 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 258:
-#line 2328 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2331 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -5058,11 +5061,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5062 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5065 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 259:
-#line 2337 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2340 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -5070,22 +5073,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5074 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5077 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 260:
-#line 2346 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2349 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 5085 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5088 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 261:
-#line 2354 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2357 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5093,11 +5096,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5097 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5100 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 262:
-#line 2364 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2367 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5105,11 +5108,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5109 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5112 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 263:
-#line 2373 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2376 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -5117,11 +5120,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5121 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5124 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 264:
-#line 2383 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2386 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5129,29 +5132,29 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5133 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5136 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 265:
-#line 2393 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2396 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
}
-#line 5142 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5145 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 266:
-#line 2399 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2402 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
}
-#line 5151 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5154 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 267:
-#line 2406 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2409 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
yyGetParser->DeallocateParserType(&((yyvsp[0].str)));
@@ -5160,11 +5163,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5164 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5167 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 268:
-#line 2416 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2419 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
yyGetParser->DeallocateParserType(&((yyvsp[0].str)));
@@ -5173,11 +5176,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5177 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5180 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 269:
-#line 2426 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2429 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
yyGetParser->DeallocateParserType(&((yyvsp[0].str)));
@@ -5186,11 +5189,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5190 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5193 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 270:
-#line 2436 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2439 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
yyGetParser->DeallocateParserType(&((yyvsp[0].str)));
@@ -5199,11 +5202,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5203 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5206 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 271:
-#line 2447 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2450 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(4);
yyGetParser->DeallocateParserType(&((yyvsp[-3].str)));
@@ -5212,11 +5215,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5216 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5219 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 272:
-#line 2457 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2460 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(6);
yyGetParser->DeallocateParserType(&((yyvsp[-5].str)));
@@ -5226,11 +5229,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5230 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5233 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 273:
-#line 2468 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2471 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(6);
yyGetParser->DeallocateParserType(&((yyvsp[-3].str)));
@@ -5239,11 +5242,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5243 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5246 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 274:
-#line 2478 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2481 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(6);
yyGetParser->DeallocateParserType(&((yyvsp[-3].str)));
@@ -5252,11 +5255,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5256 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5259 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 275:
-#line 2489 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2492 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(4);
yyGetParser->DeallocateParserType(&((yyvsp[-3].str)));
@@ -5265,11 +5268,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5269 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5272 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 276:
-#line 2499 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2502 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -5277,11 +5280,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5281 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5284 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 277:
-#line 2509 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2512 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5289,11 +5292,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5293 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5296 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 278:
-#line 2518 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2521 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
yyGetParser->DeallocateParserType(&((yyvsp[0].str)));
@@ -5301,11 +5304,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5305 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5308 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 279:
-#line 2527 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2530 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5313,11 +5316,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5317 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5320 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 280:
-#line 2536 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2539 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5325,11 +5328,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5329 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5332 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 281:
-#line 2545 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2548 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5337,11 +5340,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5341 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5344 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 282:
-#line 2555 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2558 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -5349,11 +5352,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5353 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5356 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 283:
-#line 2565 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2568 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -5361,11 +5364,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5365 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5368 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 284:
-#line 2575 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2578 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5373,11 +5376,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5377 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5380 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 285:
-#line 2584 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2587 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5385,11 +5388,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5389 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5392 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 286:
-#line 2593 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2596 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -5397,11 +5400,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5401 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5404 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 287:
-#line 2602 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2605 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -5409,11 +5412,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5413 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5416 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 288:
-#line 2611 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2614 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5421,11 +5424,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5425 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5428 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 289:
-#line 2621 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2624 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -5433,11 +5436,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5437 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5440 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 290:
-#line 2631 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2634 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -5445,11 +5448,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5449 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5452 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 291:
-#line 2641 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2644 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5457,11 +5460,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5461 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5464 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 292:
-#line 2650 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2653 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -5469,11 +5472,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5473 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5476 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 293:
-#line 2659 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2662 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -5481,11 +5484,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5485 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5488 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 294:
-#line 2668 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2671 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5493,11 +5496,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5497 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5500 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 295:
-#line 2678 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2681 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(5);
jpCheckEmpty(5);
@@ -5505,11 +5508,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5509 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5512 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 296:
-#line 2687 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2690 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -5517,20 +5520,20 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5521 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5524 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 297:
-#line 2696 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2699 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(5);
}
-#line 5530 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5533 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 298:
-#line 2703 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2706 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5538,11 +5541,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5542 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5545 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 299:
-#line 2712 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2715 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5550,11 +5553,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5554 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5557 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 300:
-#line 2721 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2724 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5562,11 +5565,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5566 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5569 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 301:
-#line 2730 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2733 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5574,11 +5577,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5578 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5581 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 302:
-#line 2740 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2743 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5586,11 +5589,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5590 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5593 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 303:
-#line 2749 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2752 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5598,11 +5601,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5602 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5605 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 304:
-#line 2758 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2761 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5610,11 +5613,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5614 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5617 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 305:
-#line 2768 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2771 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5622,11 +5625,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5626 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5629 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 306:
-#line 2777 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2780 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5634,11 +5637,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5638 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5641 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 307:
-#line 2786 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2789 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5646,11 +5649,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5650 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5653 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 308:
-#line 2795 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2798 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5658,11 +5661,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5662 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5665 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 309:
-#line 2805 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2808 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5670,11 +5673,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5674 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5677 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 310:
-#line 2814 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2817 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5682,11 +5685,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5686 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5689 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 311:
-#line 2823 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2826 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5694,11 +5697,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5698 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5701 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 312:
-#line 2832 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2835 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5706,11 +5709,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5710 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5713 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 313:
-#line 2841 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2844 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5718,11 +5721,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5722 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5725 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 314:
-#line 2850 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2853 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5730,11 +5733,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5734 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5737 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 315:
-#line 2860 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2863 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5742,11 +5745,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5746 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5749 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 316:
-#line 2869 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2872 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5754,11 +5757,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5758 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5761 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 317:
-#line 2878 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2881 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5766,11 +5769,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5770 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5773 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 318:
-#line 2888 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2891 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5778,11 +5781,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5782 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5785 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 319:
-#line 2897 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2900 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5790,11 +5793,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5794 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5797 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 320:
-#line 2907 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2910 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5802,11 +5805,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5806 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5809 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 321:
-#line 2916 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2919 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5814,11 +5817,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5818 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5821 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 322:
-#line 2926 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2929 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5826,11 +5829,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5830 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5833 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 323:
-#line 2935 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2938 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5838,11 +5841,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5842 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5845 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 324:
-#line 2945 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2948 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5850,11 +5853,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5854 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5857 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 325:
-#line 2954 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2957 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5862,11 +5865,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5866 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5869 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 326:
-#line 2964 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2967 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5874,11 +5877,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5878 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5881 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 327:
-#line 2973 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2976 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5886,11 +5889,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5890 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5893 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 328:
-#line 2983 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2986 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5898,11 +5901,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5902 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5905 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 329:
-#line 2992 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2995 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(5);
jpCheckEmpty(5);
@@ -5910,11 +5913,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5914 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5917 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 330:
-#line 3002 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3005 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5922,11 +5925,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5926 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5929 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 331:
-#line 3011 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3014 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5934,11 +5937,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5938 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5941 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 332:
-#line 3021 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3024 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5946,11 +5949,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5950 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5953 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 333:
-#line 3031 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3034 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
yyGetParser->DeallocateParserType(&((yyvsp[0].str)));
@@ -5959,11 +5962,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5963 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5966 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 334:
-#line 3041 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3044 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5971,11 +5974,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5975 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5978 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 335:
-#line 3050 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3053 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5983,11 +5986,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5987 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5990 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 336:
-#line 3060 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3063 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5995,11 +5998,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5999 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6002 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 337:
-#line 3069 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3072 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6007,11 +6010,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6011 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6014 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 338:
-#line 3078 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3081 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6019,11 +6022,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6023 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6026 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 339:
-#line 3087 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3090 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6031,11 +6034,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6035 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6038 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 340:
-#line 3096 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3099 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6043,11 +6046,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6047 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6050 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 341:
-#line 3105 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3108 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6055,11 +6058,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6059 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6062 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 342:
-#line 3114 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3117 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6067,11 +6070,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6071 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6074 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 343:
-#line 3123 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3126 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6079,11 +6082,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6083 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6086 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 344:
-#line 3132 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3135 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6091,11 +6094,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6095 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6098 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 345:
-#line 3141 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3144 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6103,11 +6106,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6107 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6110 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 346:
-#line 3150 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3153 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6115,11 +6118,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6119 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6122 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 347:
-#line 3159 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3162 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6127,11 +6130,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6131 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6134 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 348:
-#line 3169 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3172 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6139,11 +6142,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6143 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6146 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 349:
-#line 3179 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3182 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6151,11 +6154,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6155 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6158 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 350:
-#line 3189 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3192 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6163,11 +6166,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6167 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6170 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
case 351:
-#line 3198 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3201 "cmDependsJavaParser.y" /* yacc.c:1646 */
{
jpElementStart(3);
jpStoreClass((yyvsp[-2].str));
@@ -6176,11 +6179,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6180 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6183 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
break;
-#line 6184 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6187 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -6410,7 +6413,7 @@ yyreturn:
#endif
return yyresult;
}
-#line 3207 "cmDependsJavaParser.y" /* yacc.c:1906 */
+#line 3210 "cmDependsJavaParser.y" /* yacc.c:1906 */
/* End of grammar */
diff --git a/Source/LexerParser/cmDependsJavaParser.y b/Source/LexerParser/cmDependsJavaParser.y
index f7eb228..a4e9c5d 100644
--- a/Source/LexerParser/cmDependsJavaParser.y
+++ b/Source/LexerParser/cmDependsJavaParser.y
@@ -44,6 +44,9 @@ static void cmDependsJava_yyerror(yyscan_t yyscanner, const char* message);
# pragma warning (disable: 4102) /* Unused goto label. */
# pragma warning (disable: 4065) /* Switch statement contains default but no case. */
#endif
+#if defined(__GNUC__) && __GNUC__ >= 8
+# pragma GCC diagnostic ignored "-Wconversion"
+#endif
%}
/* Generate a reentrant parser object. */
diff --git a/Source/LexerParser/cmExprLexer.cxx b/Source/LexerParser/cmExprLexer.cxx
index 81a1ec5..cb24687 100644
--- a/Source/LexerParser/cmExprLexer.cxx
+++ b/Source/LexerParser/cmExprLexer.cxx
@@ -548,8 +548,8 @@ static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
yyg->yy_hold_char = *yy_cp; \
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
-#define YY_NUM_RULES 15
-#define YY_END_OF_BUFFER 16
+#define YY_NUM_RULES 18
+#define YY_END_OF_BUFFER 19
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -557,29 +557,29 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static const flex_int16_t yy_accept[23] =
+static const flex_int16_t yy_accept[29] =
{ 0,
- 0, 0, 16, 15, 6, 8, 13, 14, 4, 2,
- 3, 5, 1, 15, 15, 9, 7, 10, 1, 11,
- 12, 0
+ 0, 0, 19, 17, 1, 18, 8, 10, 15, 16,
+ 6, 4, 5, 7, 2, 2, 17, 17, 11, 9,
+ 12, 2, 0, 13, 14, 3, 3, 0
} ;
static const YY_CHAR yy_ec[256] =
{ 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 1, 1, 1, 1, 4, 5, 1, 6,
+ 7, 8, 9, 1, 10, 1, 11, 12, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 1, 1, 14,
+ 1, 15, 1, 1, 16, 16, 16, 16, 16, 16,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 2, 3, 1, 4,
- 5, 6, 7, 1, 8, 1, 9, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 1, 1, 11,
- 1, 12, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 13, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 17, 1, 1,
+ 1, 1, 1, 18, 1, 1, 16, 16, 16, 16,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 14, 1, 15, 1, 1, 1, 1,
+ 16, 16, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 17,
+ 1, 1, 1, 19, 1, 20, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -596,40 +596,46 @@ static const YY_CHAR yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static const YY_CHAR yy_meta[16] =
+static const YY_CHAR yy_meta[21] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1
+ 1, 2, 2, 1, 1, 3, 4, 1, 1, 1
} ;
-static const flex_int16_t yy_base[23] =
+static const flex_int16_t yy_base[32] =
{ 0,
- 0, 0, 20, 21, 21, 21, 21, 21, 21, 21,
- 21, 21, 9, 7, 5, 21, 21, 21, 6, 21,
- 21, 21
+ 0, 0, 34, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 16, 9, 18, 11, 35, 35,
+ 35, 11, 0, 35, 35, 0, 0, 35, 23, 26,
+ 28
} ;
-static const flex_int16_t yy_def[23] =
+static const flex_int16_t yy_def[32] =
{ 0,
- 22, 1, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 0
+ 28, 1, 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 29, 28, 28, 28, 28, 28,
+ 28, 28, 30, 28, 28, 31, 31, 0, 28, 28,
+ 28
} ;
-static const flex_int16_t yy_nxt[37] =
+static const flex_int16_t yy_nxt[56] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 21, 20, 19, 22,
- 3, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22
+ 14, 15, 16, 17, 18, 4, 4, 19, 20, 21,
+ 22, 22, 22, 22, 22, 25, 22, 26, 26, 27,
+ 27, 24, 23, 28, 3, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28
} ;
-static const flex_int16_t yy_chk[37] =
+static const flex_int16_t yy_chk[56] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 19, 15, 14, 13, 3,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 16, 16, 22, 22, 29, 18, 29, 30, 30, 31,
+ 31, 17, 15, 3, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28
} ;
/* The intent behind this definition is that it'll catch
@@ -668,6 +674,8 @@ Modify cmExprLexer.cxx:
/* Include the set of tokens from the parser. */
#include "cmExprParserTokens.h"
+#include <string>
+
/*--------------------------------------------------------------------------*/
#define INITIAL 0
@@ -946,13 +954,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 23 )
+ if ( yy_current_state >= 29 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
++yy_cp;
}
- while ( yy_base[yy_current_state] != 21 );
+ while ( yy_base[yy_current_state] != 35 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -978,62 +986,74 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
-{ yylvalp->Number = atoi(yytext); return exp_NUMBER; }
+{}
YY_BREAK
case 2:
YY_RULE_SETUP
-{ return exp_PLUS; }
+{ yylvalp->Number = std::stoll(yytext, nullptr, 10); return exp_NUMBER; }
YY_BREAK
case 3:
YY_RULE_SETUP
-{ return exp_MINUS; }
+{ yylvalp->Number = std::stoll(yytext, nullptr, 16); return exp_NUMBER; }
YY_BREAK
case 4:
YY_RULE_SETUP
-{ return exp_TIMES; }
+{ return exp_PLUS; }
YY_BREAK
case 5:
YY_RULE_SETUP
-{ return exp_DIVIDE; }
+{ return exp_MINUS; }
YY_BREAK
case 6:
YY_RULE_SETUP
-{ return exp_MOD; }
+{ return exp_TIMES; }
YY_BREAK
case 7:
YY_RULE_SETUP
-{ return exp_OR; }
+{ return exp_DIVIDE; }
YY_BREAK
case 8:
YY_RULE_SETUP
-{ return exp_AND; }
+{ return exp_MOD; }
YY_BREAK
case 9:
YY_RULE_SETUP
-{ return exp_XOR; }
+{ return exp_OR; }
YY_BREAK
case 10:
YY_RULE_SETUP
-{ return exp_NOT; }
+{ return exp_AND; }
YY_BREAK
case 11:
YY_RULE_SETUP
-{ return exp_SHIFTLEFT; }
+{ return exp_XOR; }
YY_BREAK
case 12:
YY_RULE_SETUP
-{ return exp_SHIFTRIGHT; }
+{ return exp_NOT; }
YY_BREAK
case 13:
YY_RULE_SETUP
-{ return exp_OPENPARENT; }
+{ return exp_SHIFTLEFT; }
YY_BREAK
case 14:
YY_RULE_SETUP
-{ return exp_CLOSEPARENT; }
+{ return exp_SHIFTRIGHT; }
YY_BREAK
case 15:
YY_RULE_SETUP
+{ return exp_OPENPARENT; }
+ YY_BREAK
+case 16:
+YY_RULE_SETUP
+{ return exp_CLOSEPARENT; }
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+{ yyextra->UnexpectedChar(yytext[0]); }
+ YY_BREAK
+case 18:
+YY_RULE_SETUP
ECHO;
YY_BREAK
case YY_STATE_EOF(INITIAL):
@@ -1334,7 +1354,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 23 )
+ if ( yy_current_state >= 29 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
@@ -1363,11 +1383,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 23 )
+ if ( yy_current_state >= 29 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- yy_is_jam = (yy_current_state == 22);
+ yy_is_jam = (yy_current_state == 28);
(void)yyg;
return yy_is_jam ? 0 : yy_current_state;
diff --git a/Source/LexerParser/cmExprLexer.in.l b/Source/LexerParser/cmExprLexer.in.l
index e5f177a..2197c2a 100644
--- a/Source/LexerParser/cmExprLexer.in.l
+++ b/Source/LexerParser/cmExprLexer.in.l
@@ -28,6 +28,8 @@ Modify cmExprLexer.cxx:
/* Include the set of tokens from the parser. */
#include "cmExprParserTokens.h"
+#include <string>
+
/*--------------------------------------------------------------------------*/
%}
@@ -38,8 +40,10 @@ Modify cmExprLexer.cxx:
%pointer
%%
+[ \t] {}
-[0-9][0-9]* { yylvalp->Number = atoi(yytext); return exp_NUMBER; }
+[0-9][0-9]* { yylvalp->Number = std::stoll(yytext, nullptr, 10); return exp_NUMBER; }
+0[xX][0-9a-fA-F][0-9a-fA-F]* { yylvalp->Number = std::stoll(yytext, nullptr, 16); return exp_NUMBER; }
"+" { return exp_PLUS; }
"-" { return exp_MINUS; }
@@ -54,5 +58,6 @@ Modify cmExprLexer.cxx:
">>" { return exp_SHIFTRIGHT; }
"(" { return exp_OPENPARENT; }
")" { return exp_CLOSEPARENT; }
+. { yyextra->UnexpectedChar(yytext[0]); }
%%
diff --git a/Source/LexerParser/cmExprParser.cxx b/Source/LexerParser/cmExprParser.cxx
index 67664a5..73ece2b 100644
--- a/Source/LexerParser/cmExprParser.cxx
+++ b/Source/LexerParser/cmExprParser.cxx
@@ -89,6 +89,7 @@ Modify cmExprParser.cxx:
#include <stdlib.h>
#include <string.h>
+#include <stdexcept>
/*-------------------------------------------------------------------------*/
#define YYDEBUG 1
@@ -107,8 +108,11 @@ static void cmExpr_yyerror(yyscan_t yyscanner, const char* message);
# pragma warning (disable: 4102) /* Unused goto label. */
# pragma warning (disable: 4065) /* Switch statement contains default but no case. */
#endif
+#if defined(__GNUC__) && __GNUC__ >= 8
+# pragma GCC diagnostic ignored "-Wconversion"
+#endif
-#line 112 "cmExprParser.cxx" /* yacc.c:339 */
+#line 116 "cmExprParser.cxx" /* yacc.c:339 */
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
@@ -185,7 +189,7 @@ int cmExpr_yyparse (yyscan_t yyscanner);
/* Copy the second part of user declarations. */
-#line 189 "cmExprParser.cxx" /* yacc.c:358 */
+#line 193 "cmExprParser.cxx" /* yacc.c:358 */
#ifdef short
# undef short
@@ -484,9 +488,9 @@ static const yytype_uint8 yytranslate[] =
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 73, 73, 78, 81, 86, 89, 94, 97, 102,
- 105, 108, 113, 116, 119, 124, 127, 130, 133, 138,
- 141, 144, 149, 152
+ 0, 77, 77, 82, 85, 90, 93, 98, 101, 106,
+ 109, 112, 117, 120, 123, 128, 131, 134, 140, 145,
+ 148, 151, 156, 159
};
#endif
@@ -1281,183 +1285,186 @@ yyreduce:
switch (yyn)
{
case 2:
-#line 73 "cmExprParser.y" /* yacc.c:1646 */
+#line 77 "cmExprParser.y" /* yacc.c:1646 */
{
cmExpr_yyget_extra(yyscanner)->SetResult((yyvsp[0].Number));
}
-#line 1289 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1293 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 3:
-#line 78 "cmExprParser.y" /* yacc.c:1646 */
+#line 82 "cmExprParser.y" /* yacc.c:1646 */
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1297 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1301 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 4:
-#line 81 "cmExprParser.y" /* yacc.c:1646 */
+#line 85 "cmExprParser.y" /* yacc.c:1646 */
{
(yyval.Number) = (yyvsp[-2].Number) | (yyvsp[0].Number);
}
-#line 1305 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1309 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 5:
-#line 86 "cmExprParser.y" /* yacc.c:1646 */
+#line 90 "cmExprParser.y" /* yacc.c:1646 */
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1313 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1317 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 6:
-#line 89 "cmExprParser.y" /* yacc.c:1646 */
+#line 93 "cmExprParser.y" /* yacc.c:1646 */
{
(yyval.Number) = (yyvsp[-2].Number) ^ (yyvsp[0].Number);
}
-#line 1321 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1325 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 7:
-#line 94 "cmExprParser.y" /* yacc.c:1646 */
+#line 98 "cmExprParser.y" /* yacc.c:1646 */
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1329 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1333 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 8:
-#line 97 "cmExprParser.y" /* yacc.c:1646 */
+#line 101 "cmExprParser.y" /* yacc.c:1646 */
{
(yyval.Number) = (yyvsp[-2].Number) & (yyvsp[0].Number);
}
-#line 1337 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1341 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 9:
-#line 102 "cmExprParser.y" /* yacc.c:1646 */
+#line 106 "cmExprParser.y" /* yacc.c:1646 */
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1345 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1349 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 10:
-#line 105 "cmExprParser.y" /* yacc.c:1646 */
+#line 109 "cmExprParser.y" /* yacc.c:1646 */
{
(yyval.Number) = (yyvsp[-2].Number) << (yyvsp[0].Number);
}
-#line 1353 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1357 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 11:
-#line 108 "cmExprParser.y" /* yacc.c:1646 */
+#line 112 "cmExprParser.y" /* yacc.c:1646 */
{
(yyval.Number) = (yyvsp[-2].Number) >> (yyvsp[0].Number);
}
-#line 1361 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1365 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 12:
-#line 113 "cmExprParser.y" /* yacc.c:1646 */
+#line 117 "cmExprParser.y" /* yacc.c:1646 */
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1369 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1373 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 13:
-#line 116 "cmExprParser.y" /* yacc.c:1646 */
+#line 120 "cmExprParser.y" /* yacc.c:1646 */
{
(yyval.Number) = (yyvsp[-2].Number) + (yyvsp[0].Number);
}
-#line 1377 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1381 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 14:
-#line 119 "cmExprParser.y" /* yacc.c:1646 */
+#line 123 "cmExprParser.y" /* yacc.c:1646 */
{
(yyval.Number) = (yyvsp[-2].Number) - (yyvsp[0].Number);
}
-#line 1385 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1389 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 15:
-#line 124 "cmExprParser.y" /* yacc.c:1646 */
+#line 128 "cmExprParser.y" /* yacc.c:1646 */
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1393 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1397 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 16:
-#line 127 "cmExprParser.y" /* yacc.c:1646 */
+#line 131 "cmExprParser.y" /* yacc.c:1646 */
{
(yyval.Number) = (yyvsp[-2].Number) * (yyvsp[0].Number);
}
-#line 1401 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1405 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 17:
-#line 130 "cmExprParser.y" /* yacc.c:1646 */
+#line 134 "cmExprParser.y" /* yacc.c:1646 */
{
+ if (yyvsp[0].Number == 0) {
+ throw std::overflow_error("divide by zero");
+ }
(yyval.Number) = (yyvsp[-2].Number) / (yyvsp[0].Number);
}
-#line 1409 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1416 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 18:
-#line 133 "cmExprParser.y" /* yacc.c:1646 */
+#line 140 "cmExprParser.y" /* yacc.c:1646 */
{
(yyval.Number) = (yyvsp[-2].Number) % (yyvsp[0].Number);
}
-#line 1417 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1424 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 19:
-#line 138 "cmExprParser.y" /* yacc.c:1646 */
+#line 145 "cmExprParser.y" /* yacc.c:1646 */
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1425 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1432 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 20:
-#line 141 "cmExprParser.y" /* yacc.c:1646 */
+#line 148 "cmExprParser.y" /* yacc.c:1646 */
{
(yyval.Number) = + (yyvsp[0].Number);
}
-#line 1433 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1440 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 21:
-#line 144 "cmExprParser.y" /* yacc.c:1646 */
+#line 151 "cmExprParser.y" /* yacc.c:1646 */
{
(yyval.Number) = - (yyvsp[0].Number);
}
-#line 1441 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1448 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 22:
-#line 149 "cmExprParser.y" /* yacc.c:1646 */
+#line 156 "cmExprParser.y" /* yacc.c:1646 */
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1449 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1456 "cmExprParser.cxx" /* yacc.c:1646 */
break;
case 23:
-#line 152 "cmExprParser.y" /* yacc.c:1646 */
+#line 159 "cmExprParser.y" /* yacc.c:1646 */
{
(yyval.Number) = (yyvsp[-1].Number);
}
-#line 1457 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1464 "cmExprParser.cxx" /* yacc.c:1646 */
break;
-#line 1461 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1468 "cmExprParser.cxx" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -1687,7 +1694,7 @@ yyreturn:
#endif
return yyresult;
}
-#line 157 "cmExprParser.y" /* yacc.c:1906 */
+#line 164 "cmExprParser.y" /* yacc.c:1906 */
/* End of grammar */
diff --git a/Source/LexerParser/cmExprParser.y b/Source/LexerParser/cmExprParser.y
index d1c3a97..2137473 100644
--- a/Source/LexerParser/cmExprParser.y
+++ b/Source/LexerParser/cmExprParser.y
@@ -18,6 +18,7 @@ Modify cmExprParser.cxx:
#include <stdlib.h>
#include <string.h>
+#include <stdexcept>
/*-------------------------------------------------------------------------*/
#define YYDEBUG 1
@@ -36,6 +37,9 @@ static void cmExpr_yyerror(yyscan_t yyscanner, const char* message);
# pragma warning (disable: 4102) /* Unused goto label. */
# pragma warning (disable: 4065) /* Switch statement contains default but no case. */
#endif
+#if defined(__GNUC__) && __GNUC__ >= 8
+# pragma GCC diagnostic ignored "-Wconversion"
+#endif
%}
/* Generate a reentrant parser object. */
@@ -128,6 +132,9 @@ term:
$<Number>$ = $<Number>1 * $<Number>3;
}
| term exp_DIVIDE unary {
+ if (yyvsp[0].Number == 0) {
+ throw std::overflow_error("divide by zero");
+ }
$<Number>$ = $<Number>1 / $<Number>3;
}
| term exp_MOD unary {
diff --git a/Source/LexerParser/cmFortranParser.cxx b/Source/LexerParser/cmFortranParser.cxx
index 00c8a8a..015cab9 100644
--- a/Source/LexerParser/cmFortranParser.cxx
+++ b/Source/LexerParser/cmFortranParser.cxx
@@ -127,8 +127,11 @@ static void cmFortran_yyerror(yyscan_t yyscanner, const char* message)
# pragma warning (disable: 4127) /* Conditional expression is constant. */
# pragma warning (disable: 4244) /* Conversion to smaller type, data loss. */
#endif
+#if defined(__GNUC__) && __GNUC__ >= 8
+# pragma GCC diagnostic ignored "-Wconversion"
+#endif
-#line 132 "cmFortranParser.cxx" /* yacc.c:339 */
+#line 135 "cmFortranParser.cxx" /* yacc.c:339 */
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
@@ -248,11 +251,11 @@ extern int cmFortran_yydebug;
union YYSTYPE
{
-#line 70 "cmFortranParser.y" /* yacc.c:355 */
+#line 73 "cmFortranParser.y" /* yacc.c:355 */
char* string;
-#line 256 "cmFortranParser.cxx" /* yacc.c:355 */
+#line 259 "cmFortranParser.cxx" /* yacc.c:355 */
};
typedef union YYSTYPE YYSTYPE;
@@ -268,7 +271,7 @@ int cmFortran_yyparse (yyscan_t yyscanner);
/* Copy the second part of user declarations. */
-#line 272 "cmFortranParser.cxx" /* yacc.c:358 */
+#line 275 "cmFortranParser.cxx" /* yacc.c:358 */
#ifdef short
# undef short
@@ -569,13 +572,13 @@ static const yytype_uint8 yytranslate[] =
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 98, 98, 98, 101, 105, 110, 119, 125, 132,
- 137, 141, 146, 154, 159, 164, 169, 174, 179, 184,
- 189, 194, 198, 202, 206, 210, 211, 216, 216, 216,
- 217, 217, 218, 218, 219, 219, 220, 220, 221, 221,
- 222, 222, 223, 223, 224, 224, 225, 225, 228, 229,
- 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
- 240, 241, 242, 243
+ 0, 101, 101, 101, 104, 108, 113, 122, 128, 135,
+ 140, 144, 149, 157, 162, 167, 172, 177, 182, 187,
+ 192, 197, 201, 205, 209, 213, 214, 219, 219, 219,
+ 220, 220, 221, 221, 222, 222, 223, 223, 224, 224,
+ 225, 225, 226, 226, 227, 227, 228, 228, 231, 232,
+ 233, 234, 235, 236, 237, 238, 239, 240, 241, 242,
+ 243, 244, 245, 246
};
#endif
@@ -1527,26 +1530,26 @@ yyreduce:
switch (yyn)
{
case 4:
-#line 101 "cmFortranParser.y" /* yacc.c:1646 */
+#line 104 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_SetInInterface(parser, true);
}
-#line 1536 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1539 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 5:
-#line 105 "cmFortranParser.y" /* yacc.c:1646 */
+#line 108 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleUse(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
-#line 1546 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1549 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 6:
-#line 110 "cmFortranParser.y" /* yacc.c:1646 */
+#line 113 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
if (cmsysString_strcasecmp((yyvsp[-2].string), "function") != 0 &&
@@ -1556,22 +1559,22 @@ yyreduce:
}
free((yyvsp[-2].string));
}
-#line 1560 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1563 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 7:
-#line 119 "cmFortranParser.y" /* yacc.c:1646 */
+#line 122 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleSubmodule(parser, (yyvsp[-4].string), (yyvsp[-2].string));
free((yyvsp[-4].string));
free((yyvsp[-2].string));
}
-#line 1571 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1574 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 8:
-#line 125 "cmFortranParser.y" /* yacc.c:1646 */
+#line 128 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleSubmoduleNested(parser, (yyvsp[-6].string), (yyvsp[-4].string), (yyvsp[-2].string));
@@ -1579,40 +1582,40 @@ yyreduce:
free((yyvsp[-4].string));
free((yyvsp[-2].string));
}
-#line 1583 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1586 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 9:
-#line 132 "cmFortranParser.y" /* yacc.c:1646 */
+#line 135 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_SetInInterface(parser, true);
free((yyvsp[-2].string));
}
-#line 1593 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1596 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 10:
-#line 137 "cmFortranParser.y" /* yacc.c:1646 */
+#line 140 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_SetInInterface(parser, false);
}
-#line 1602 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1605 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 11:
-#line 141 "cmFortranParser.y" /* yacc.c:1646 */
+#line 144 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleUse(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
-#line 1612 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1615 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 12:
-#line 146 "cmFortranParser.y" /* yacc.c:1646 */
+#line 149 "cmFortranParser.y" /* yacc.c:1646 */
{
if (cmsysString_strcasecmp((yyvsp[-4].string), "non_intrinsic") == 0) {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
@@ -1621,139 +1624,139 @@ yyreduce:
free((yyvsp[-4].string));
free((yyvsp[-2].string));
}
-#line 1625 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1628 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 13:
-#line 154 "cmFortranParser.y" /* yacc.c:1646 */
+#line 157 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleInclude(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
-#line 1635 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1638 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 14:
-#line 159 "cmFortranParser.y" /* yacc.c:1646 */
+#line 162 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleLineDirective(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
-#line 1645 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1648 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 15:
-#line 164 "cmFortranParser.y" /* yacc.c:1646 */
+#line 167 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleInclude(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
-#line 1655 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1658 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 16:
-#line 169 "cmFortranParser.y" /* yacc.c:1646 */
+#line 172 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleInclude(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
-#line 1665 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1668 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 17:
-#line 174 "cmFortranParser.y" /* yacc.c:1646 */
+#line 177 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleDefine(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
-#line 1675 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1678 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 18:
-#line 179 "cmFortranParser.y" /* yacc.c:1646 */
+#line 182 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleUndef(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
-#line 1685 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1688 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 19:
-#line 184 "cmFortranParser.y" /* yacc.c:1646 */
+#line 187 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleIfdef(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
-#line 1695 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1698 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 20:
-#line 189 "cmFortranParser.y" /* yacc.c:1646 */
+#line 192 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleIfndef(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
-#line 1705 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1708 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 21:
-#line 194 "cmFortranParser.y" /* yacc.c:1646 */
+#line 197 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleIf(parser);
}
-#line 1714 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1717 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 22:
-#line 198 "cmFortranParser.y" /* yacc.c:1646 */
+#line 201 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleElif(parser);
}
-#line 1723 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1726 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 23:
-#line 202 "cmFortranParser.y" /* yacc.c:1646 */
+#line 205 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleElse(parser);
}
-#line 1732 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1735 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 24:
-#line 206 "cmFortranParser.y" /* yacc.c:1646 */
+#line 209 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleEndif(parser);
}
-#line 1741 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1744 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 48:
-#line 228 "cmFortranParser.y" /* yacc.c:1646 */
+#line 231 "cmFortranParser.y" /* yacc.c:1646 */
{ free ((yyvsp[0].string)); }
-#line 1747 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1750 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 55:
-#line 235 "cmFortranParser.y" /* yacc.c:1646 */
+#line 238 "cmFortranParser.y" /* yacc.c:1646 */
{ free ((yyvsp[0].string)); }
-#line 1753 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1756 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
-#line 1757 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1760 "cmFortranParser.cxx" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -1983,6 +1986,6 @@ yyreturn:
#endif
return yyresult;
}
-#line 246 "cmFortranParser.y" /* yacc.c:1906 */
+#line 249 "cmFortranParser.y" /* yacc.c:1906 */
/* End of grammar */
diff --git a/Source/LexerParser/cmFortranParser.y b/Source/LexerParser/cmFortranParser.y
index 5e09248..87f3e0a 100644
--- a/Source/LexerParser/cmFortranParser.y
+++ b/Source/LexerParser/cmFortranParser.y
@@ -56,6 +56,9 @@ static void cmFortran_yyerror(yyscan_t yyscanner, const char* message)
# pragma warning (disable: 4127) /* Conditional expression is constant. */
# pragma warning (disable: 4244) /* Conversion to smaller type, data loss. */
#endif
+#if defined(__GNUC__) && __GNUC__ >= 8
+# pragma GCC diagnostic ignored "-Wconversion"
+#endif
%}
/* Generate a reentrant parser object. */
diff --git a/Source/LexerParser/cmFortranParserTokens.h b/Source/LexerParser/cmFortranParserTokens.h
index 8d6a5fe..29c6d60 100644
--- a/Source/LexerParser/cmFortranParserTokens.h
+++ b/Source/LexerParser/cmFortranParserTokens.h
@@ -130,7 +130,7 @@ extern int cmFortran_yydebug;
union YYSTYPE
{
-#line 70 "cmFortranParser.y" /* yacc.c:1909 */
+#line 73 "cmFortranParser.y" /* yacc.c:1909 */
char* string;
diff --git a/Source/QtDialog/CMakeSetup.icns b/Source/QtDialog/CMakeSetup.icns
index 4a50c04..e0bf8fd 100644
--- a/Source/QtDialog/CMakeSetup.icns
+++ b/Source/QtDialog/CMakeSetup.icns
Binary files differ
diff --git a/Source/QtDialog/CMakeSetup.ico b/Source/QtDialog/CMakeSetup.ico
index e13bb15..1ac13c8 100644
--- a/Source/QtDialog/CMakeSetup.ico
+++ b/Source/QtDialog/CMakeSetup.ico
Binary files differ
diff --git a/Source/QtDialog/CMakeSetup128.png b/Source/QtDialog/CMakeSetup128.png
index 12f1d9a..728ef02 100644
--- a/Source/QtDialog/CMakeSetup128.png
+++ b/Source/QtDialog/CMakeSetup128.png
Binary files differ
diff --git a/Source/QtDialog/CMakeSetup32.png b/Source/QtDialog/CMakeSetup32.png
index 7bbcee4..1c36b31 100644
--- a/Source/QtDialog/CMakeSetup32.png
+++ b/Source/QtDialog/CMakeSetup32.png
Binary files differ
diff --git a/Source/QtDialog/CMakeSetup64.png b/Source/QtDialog/CMakeSetup64.png
index 43a8cc6..44eb171 100644
--- a/Source/QtDialog/CMakeSetup64.png
+++ b/Source/QtDialog/CMakeSetup64.png
Binary files differ
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index 1e3faef..91ccdf7 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -320,7 +320,7 @@ bool cmAddCustomCommandCommand::InitialPass(
// Convert working directory to a full path.
if (!working.empty()) {
- const char* build_dir = this->Makefile->GetCurrentBinaryDirectory();
+ const std::string& build_dir = this->Makefile->GetCurrentBinaryDirectory();
working = cmSystemTools::CollapseFullPath(working, build_dir);
}
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index 4655f58..82ee6b4 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -183,7 +183,7 @@ bool cmAddCustomTargetCommand::InitialPass(
// Convert working directory to a full path.
if (!working_directory.empty()) {
- const char* build_dir = this->Makefile->GetCurrentBinaryDirectory();
+ const std::string& build_dir = this->Makefile->GetCurrentBinaryDirectory();
working_directory =
cmSystemTools::CollapseFullPath(working_directory, build_dir);
}
diff --git a/Source/cmAddLinkOptionsCommand.cxx b/Source/cmAddLinkOptionsCommand.cxx
new file mode 100644
index 0000000..10ebd12
--- /dev/null
+++ b/Source/cmAddLinkOptionsCommand.cxx
@@ -0,0 +1,20 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cmAddLinkOptionsCommand.h"
+
+#include "cmMakefile.h"
+
+class cmExecutionStatus;
+
+bool cmAddLinkOptionsCommand::InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus&)
+{
+ if (args.empty()) {
+ return true;
+ }
+
+ for (std::string const& i : args) {
+ this->Makefile->AddLinkOption(i);
+ }
+ return true;
+}
diff --git a/Source/cmAddLinkOptionsCommand.h b/Source/cmAddLinkOptionsCommand.h
new file mode 100644
index 0000000..30fff00
--- /dev/null
+++ b/Source/cmAddLinkOptionsCommand.h
@@ -0,0 +1,31 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#ifndef cmAddLinkOptionsCommand_h
+#define cmAddLinkOptionsCommand_h
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include <string>
+#include <vector>
+
+#include "cmCommand.h"
+
+class cmExecutionStatus;
+
+class cmAddLinkOptionsCommand : public cmCommand
+{
+public:
+ /**
+ * This is a virtual constructor for the command.
+ */
+ cmCommand* Clone() override { return new cmAddLinkOptionsCommand; }
+
+ /**
+ * This is called when the command is first encountered in
+ * the CMakeLists.txt file.
+ */
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) override;
+};
+
+#endif
diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx
index f673c72..75bd6fb 100644
--- a/Source/cmAddSubDirectoryCommand.cxx
+++ b/Source/cmAddSubDirectoryCommand.cxx
@@ -80,17 +80,17 @@ bool cmAddSubDirectoryCommand::InitialPass(
// Remove the CurrentDirectory from the srcPath and replace it
// with the CurrentOutputDirectory.
- const char* src = this->Makefile->GetCurrentSourceDirectory();
- const char* bin = this->Makefile->GetCurrentBinaryDirectory();
- size_t srcLen = strlen(src);
- size_t binLen = strlen(bin);
+ const std::string& src = this->Makefile->GetCurrentSourceDirectory();
+ const std::string& bin = this->Makefile->GetCurrentBinaryDirectory();
+ size_t srcLen = src.length();
+ size_t binLen = bin.length();
if (srcLen > 0 && src[srcLen - 1] == '/') {
--srcLen;
}
if (binLen > 0 && bin[binLen - 1] == '/') {
--binLen;
}
- binPath = std::string(bin, binLen) + srcPath.substr(srcLen);
+ binPath = bin.substr(0, binLen) + srcPath.substr(srcLen);
} else {
// Use the binary directory specified.
// Interpret a relative path with respect to the current binary directory.
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index 1dd7734..6031781 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -10,6 +10,7 @@
#include "cmsys/Encoding.hxx"
#include "cmsys/FStream.hxx"
#include <iostream>
+#include <sstream>
#include <string.h>
#include <time.h>
@@ -94,13 +95,25 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c,
return;
}
break;
- case CompressGZip:
+ case CompressGZip: {
if (archive_write_add_filter_gzip(this->Archive) != ARCHIVE_OK) {
this->Error = "archive_write_add_filter_gzip: ";
this->Error += cm_archive_error_string(this->Archive);
return;
}
- break;
+ std::string source_date_epoch;
+ cmSystemTools::GetEnv("SOURCE_DATE_EPOCH", source_date_epoch);
+ if (!source_date_epoch.empty()) {
+ // We're not able to specify an arbitrary timestamp for gzip.
+ // The next best thing is to omit the timestamp entirely.
+ if (archive_write_set_filter_option(this->Archive, "gzip", "timestamp",
+ nullptr) != ARCHIVE_OK) {
+ this->Error = "archive_write_set_filter_option: ";
+ this->Error += cm_archive_error_string(this->Archive);
+ return;
+ }
+ }
+ } break;
case CompressBZip2:
if (archive_write_add_filter_bzip2(this->Archive) != ARCHIVE_OK) {
this->Error = "archive_write_add_filter_bzip2: ";
@@ -243,6 +256,17 @@ bool cmArchiveWrite::AddFile(const char* file, size_t skip, const char* prefix)
return false;
}
archive_entry_set_mtime(e, t, 0);
+ } else {
+ std::string source_date_epoch;
+ cmSystemTools::GetEnv("SOURCE_DATE_EPOCH", source_date_epoch);
+ if (!source_date_epoch.empty()) {
+ std::istringstream iss(source_date_epoch);
+ time_t epochTime;
+ iss >> epochTime;
+ if (iss.eof() && !iss.fail()) {
+ archive_entry_set_mtime(e, epochTime, 0);
+ }
+ }
}
// manages the uid/guid of the entry (if any)
diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx
index 5f54338..ddff686 100644
--- a/Source/cmBuildNameCommand.cxx
+++ b/Source/cmBuildNameCommand.cxx
@@ -40,8 +40,8 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args,
cmSystemTools::RunSingleCommand("uname -a", &buildname, &buildname);
if (!buildname.empty()) {
std::string RegExp = "([^ ]*) [^ ]* ([^ ]*) ";
- cmsys::RegularExpression reg(RegExp.c_str());
- if (reg.find(buildname.c_str())) {
+ cmsys::RegularExpression reg(RegExp);
+ if (reg.find(buildname)) {
buildname = reg.match(1) + "-" + reg.match(2);
}
}
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index be3d2f4..3aa59d6 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -118,22 +118,22 @@ const char* CCONV cmGetHomeOutputDirectory(void* arg)
const char* CCONV cmGetStartDirectory(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
- return mf->GetCurrentSourceDirectory();
+ return mf->GetCurrentSourceDirectory().c_str();
}
const char* CCONV cmGetStartOutputDirectory(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
- return mf->GetCurrentBinaryDirectory();
+ return mf->GetCurrentBinaryDirectory().c_str();
}
const char* CCONV cmGetCurrentDirectory(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
- return mf->GetCurrentSourceDirectory();
+ return mf->GetCurrentSourceDirectory().c_str();
}
const char* CCONV cmGetCurrentOutputDirectory(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
- return mf->GetCurrentBinaryDirectory();
+ return mf->GetCurrentBinaryDirectory().c_str();
}
const char* CCONV cmGetDefinition(void* arg, const char* def)
{
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index d0e668d..3d3d526 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -9,7 +9,6 @@
#include "cmsys/FStream.hxx"
#include "cmsys/Glob.hxx"
#include "cmsys/Process.h"
-#include "cmsys/String.hxx"
#include "cmsys/SystemInformation.hxx"
#include <algorithm>
#include <chrono>
@@ -819,7 +818,7 @@ bool cmCTest::OpenOutputFile(const std::string& path, const std::string& name,
}
}
std::string filename = testingDir + "/" + name;
- stream.Open(filename.c_str());
+ stream.Open(filename);
if (!stream) {
cmCTestLog(this, ERROR_MESSAGE,
"Problem opening file: " << filename << std::endl);
@@ -1491,7 +1490,7 @@ int cmCTest::GenerateCTestNotesOutput(cmXMLWriter& xml,
this->AddSiteProperties(xml);
xml.StartElement("Notes");
- for (cmsys::String const& file : files) {
+ for (std::string const& file : files) {
cmCTestLog(this, OUTPUT, "\tAdd file: " << file << std::endl);
std::string note_time = this->CurrentTime();
xml.StartElement("Note");
@@ -1595,7 +1594,7 @@ std::string cmCTest::Base64EncodeFile(std::string const& file)
bool cmCTest::SubmitExtraFiles(const VectorOfStrings& files)
{
- for (cmsys::String const& file : files) {
+ for (std::string const& file : files) {
if (!cmSystemTools::FileExists(file)) {
cmCTestLog(this, ERROR_MESSAGE,
"Cannot find extra file: " << file << " to submit."
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index ddeab1a..c6ece98 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -7,7 +7,7 @@
#include "cmDuration.h"
#include "cmProcessOutput.h"
-#include "cmsys/String.hxx"
+
#include <chrono>
#include <map>
#include <set>
@@ -93,7 +93,7 @@ public:
if the string does not name a valid part. */
Part GetPartFromName(const char* name);
- typedef std::vector<cmsys::String> VectorOfStrings;
+ typedef std::vector<std::string> VectorOfStrings;
typedef std::set<std::string> SetOfStrings;
/** Process Command line arguments */
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index c6a1cff..5091c97 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -234,7 +234,7 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger)
{
std::string cacheFile = path;
cacheFile += "/CMakeCache.txt";
- cmGeneratedFileStream fout(cacheFile.c_str());
+ cmGeneratedFileStream fout(cacheFile);
fout.SetCopyIfDifferent(true);
if (!fout) {
cmSystemTools::Error("Unable to open cache file for save. ",
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index ccb4f88..c7210b4 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -172,7 +172,7 @@ void cmCommandArgumentParserHelper::AllocateParserType(
return;
}
char* out = new char[len + 1];
- strncpy(out, str, len);
+ memcpy(out, str, len);
out[len] = 0;
pt->str = out;
this->Variables.push_back(out);
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index dc9318e..15fbd40 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -82,6 +82,7 @@
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmAddCompileOptionsCommand.h"
+# include "cmAddLinkOptionsCommand.h"
# include "cmAuxSourceDirectoryCommand.h"
# include "cmBuildNameCommand.h"
# include "cmCMakeHostSystemInformationCommand.h"
@@ -100,6 +101,7 @@
# include "cmRemoveDefinitionsCommand.h"
# include "cmSourceGroupCommand.h"
# include "cmSubdirDependsCommand.h"
+# include "cmTargetLinkOptionsCommand.h"
# include "cmUseMangledMesaCommand.h"
# include "cmUtilitySourceCommand.h"
# include "cmVariableRequiresCommand.h"
@@ -272,7 +274,10 @@ void GetProjectCommands(cmState* state)
state->AddBuiltinCommand("include_external_msproject",
new cmIncludeExternalMSProjectCommand);
state->AddBuiltinCommand("install_programs", new cmInstallProgramsCommand);
+ state->AddBuiltinCommand("add_link_options", new cmAddLinkOptionsCommand);
state->AddBuiltinCommand("link_libraries", new cmLinkLibrariesCommand);
+ state->AddBuiltinCommand("target_link_options",
+ new cmTargetLinkOptionsCommand);
state->AddBuiltinCommand("load_cache", new cmLoadCacheCommand);
state->AddBuiltinCommand("qt_wrap_cpp", new cmQTWrapCPPCommand);
state->AddBuiltinCommand("qt_wrap_ui", new cmQTWrapUICommand);
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 34c0e94..f7dd33b 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -174,7 +174,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
// Complain if the file cannot be found and matches the complain
// regex.
if (fullName.empty() &&
- this->IncludeRegexComplain.find(current.FileName.c_str())) {
+ this->IncludeRegexComplain.find(current.FileName)) {
cmSystemTools::Error("Cannot find file \"", current.FileName.c_str(),
"\".");
return false;
@@ -359,7 +359,7 @@ void cmDependsC::Scan(std::istream& is, const char* directory,
}
// Match include directives.
- if (this->IncludeRegexLine.find(line.c_str())) {
+ if (this->IncludeRegexLine.find(line)) {
// Get the file being included.
UnscannedEntry entry;
entry.FileName = this->IncludeRegexLine.match(2);
@@ -383,7 +383,7 @@ void cmDependsC::Scan(std::istream& is, const char* directory,
// file their own directory by simply using "filename.h" (#12619)
// This kind of problem will be fixed when a more
// preprocessor-like implementation of this scanner is created.
- if (this->IncludeRegexScan.find(entry.FileName.c_str())) {
+ if (this->IncludeRegexScan.find(entry.FileName)) {
newCacheEntry->UnscannedEntries.push_back(entry);
if (this->Encountered.find(entry.FileName) ==
this->Encountered.end()) {
@@ -449,7 +449,7 @@ void cmDependsC::ParseTransform(std::string const& xform)
void cmDependsC::TransformLine(std::string& line)
{
// Check for a transform rule match. Return if none.
- if (!this->IncludeRegexTransform.find(line.c_str())) {
+ if (!this->IncludeRegexTransform.find(line)) {
return;
}
TransformRulesType::const_iterator tri =
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index dbea15a..a04cee7 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -178,7 +178,7 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends,
// Store the list of modules provided by this target.
std::string fiName = this->TargetDirectory;
fiName += "/fortran.internal";
- cmGeneratedFileStream fiStream(fiName.c_str());
+ cmGeneratedFileStream fiStream(fiName);
fiStream << "# The fortran modules provided by this target.\n";
fiStream << "provides\n";
std::set<std::string> const& provides = this->Internal->TargetProvides;
@@ -190,7 +190,7 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends,
if (!provides.empty()) {
std::string fcName = this->TargetDirectory;
fcName += "/cmake_clean_Fortran.cmake";
- cmGeneratedFileStream fcStream(fcName.c_str());
+ cmGeneratedFileStream fcStream(fcName);
fcStream << "# Remove fortran modules provided by this target.\n";
fcStream << "FILE(REMOVE";
std::string currentBinDir =
diff --git a/Source/cmDocumentationFormatter.cxx b/Source/cmDocumentationFormatter.cxx
index 6b996e4..2267ef9 100644
--- a/Source/cmDocumentationFormatter.cxx
+++ b/Source/cmDocumentationFormatter.cxx
@@ -90,7 +90,7 @@ void cmDocumentationFormatter::SetIndent(const char* indent)
void cmDocumentationFormatter::PrintColumn(std::ostream& os, const char* text)
{
- // Print text arranged in an indented column of fixed witdh.
+ // Print text arranged in an indented column of fixed width.
const char* l = text;
long column = 0;
bool newSentence = false;
diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx
index 0ceac85..bb370c4 100644
--- a/Source/cmExportBuildAndroidMKGenerator.cxx
+++ b/Source/cmExportBuildAndroidMKGenerator.cxx
@@ -7,6 +7,7 @@
#include <sstream>
#include <utility>
+#include "cmAlgorithms.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorExpressionDAGChecker.h"
#include "cmGeneratorTarget.h"
@@ -169,6 +170,11 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
end = "\\\n";
}
os << "\n";
+ } else if (property.first == "INTERFACE_LINK_OPTIONS") {
+ os << "LOCAL_EXPORT_LDFLAGS := ";
+ std::vector<std::string> linkFlagsList;
+ cmSystemTools::ExpandListArgument(property.second, linkFlagsList);
+ os << cmJoin(linkFlagsList, " ") << "\n";
} else {
os << "# " << property.first << " " << (property.second) << "\n";
}
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 47636cd..7f42035 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -95,6 +95,12 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
this->PopulateInterfaceProperty("INTERFACE_COMPILE_FEATURES", gte,
cmGeneratorExpression::BuildInterface,
properties, missingTargets);
+ this->PopulateInterfaceProperty("INTERFACE_LINK_OPTIONS", gte,
+ cmGeneratorExpression::BuildInterface,
+ properties, missingTargets);
+ this->PopulateInterfaceProperty("INTERFACE_LINK_DEPENDS", gte,
+ cmGeneratorExpression::BuildInterface,
+ properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", gte,
properties);
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index 4e1d771..f965a29 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -237,7 +237,7 @@ bool cmExportCommand::HandlePackage(std::vector<std::string> const& args)
}
const char* packageExpr = "^[A-Za-z0-9_.-]+$";
cmsys::RegularExpression packageRegex(packageExpr);
- if (!packageRegex.find(package.c_str())) {
+ if (!packageRegex.find(package)) {
std::ostringstream e;
e << "PACKAGE given invalid package name \"" << package << "\". "
<< "Package names must match \"" << packageExpr << "\".";
@@ -254,12 +254,12 @@ bool cmExportCommand::HandlePackage(std::vector<std::string> const& args)
// We store the current build directory in the registry as a value
// named by a hash of its own content. This is deterministic and is
// unique with high probability.
- const char* outDir = this->Makefile->GetCurrentBinaryDirectory();
+ const std::string& outDir = this->Makefile->GetCurrentBinaryDirectory();
std::string hash = cmSystemTools::ComputeStringMD5(outDir);
#if defined(_WIN32) && !defined(__CYGWIN__)
- this->StorePackageRegistryWin(package, outDir, hash.c_str());
+ this->StorePackageRegistryWin(package, outDir.c_str(), hash.c_str());
#else
- this->StorePackageRegistryDir(package, outDir, hash.c_str());
+ this->StorePackageRegistryDir(package, outDir.c_str(), hash.c_str());
#endif
return true;
@@ -339,7 +339,7 @@ void cmExportCommand::StorePackageRegistryDir(std::string const& package,
fname += "/";
fname += hash;
if (!cmSystemTools::FileExists(fname)) {
- cmGeneratedFileStream entry(fname.c_str(), true);
+ cmGeneratedFileStream entry(fname, true);
if (entry) {
entry << content << "\n";
} else {
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 5f61571..75d3374 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -75,7 +75,7 @@ bool cmExportFileGenerator::GenerateImportFile()
} else {
// Generate atomically and with copy-if-different.
std::unique_ptr<cmGeneratedFileStream> ap(
- new cmGeneratedFileStream(this->MainImportFile.c_str(), true));
+ new cmGeneratedFileStream(this->MainImportFile, true));
ap->SetCopyIfDifferent(true);
foutPtr = std::move(ap);
}
@@ -420,6 +420,37 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
}
}
+void cmExportFileGenerator::PopulateLinkDependsInterface(
+ cmTargetExport* tei, cmGeneratorExpression::PreprocessContext preprocessRule,
+ ImportPropertyMap& properties, std::vector<std::string>& missingTargets)
+{
+ cmGeneratorTarget* gt = tei->Target;
+ assert(preprocessRule == cmGeneratorExpression::InstallInterface);
+
+ const char* propName = "INTERFACE_LINK_DEPENDS";
+ const char* input = gt->GetProperty(propName);
+
+ if (!input) {
+ return;
+ }
+
+ if (!*input) {
+ properties[propName].clear();
+ return;
+ }
+
+ std::string prepro =
+ cmGeneratorExpression::Preprocess(input, preprocessRule, true);
+ if (!prepro.empty()) {
+ this->ResolveTargetsInGeneratorExpressions(prepro, gt, missingTargets);
+
+ if (!checkInterfaceDirs(prepro, gt, propName)) {
+ return;
+ }
+ properties[propName] = prepro;
+ }
+}
+
void cmExportFileGenerator::PopulateInterfaceProperty(
const std::string& propName, cmGeneratorTarget* target,
cmGeneratorExpression::PreprocessContext preprocessRule,
@@ -1143,6 +1174,11 @@ bool cmExportFileGenerator::PopulateExportProperties(
return false;
}
auto propertyValue = targetProperties.GetPropertyValue(prop);
+ if (propertyValue == nullptr) {
+ // Asked to export a property that isn't defined on the target. Do not
+ // consider this an error, there's just nothing to export.
+ continue;
+ }
std::string evaluatedValue = cmGeneratorExpression::Preprocess(
propertyValue, cmGeneratorExpression::StripAllGeneratorExpressions);
if (evaluatedValue != propertyValue) {
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index 954e6c5..6ca2e07 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -147,6 +147,10 @@ protected:
cmTargetExport* target,
cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap& properties, std::vector<std::string>& missingTargets);
+ void PopulateLinkDependsInterface(
+ cmTargetExport* target,
+ cmGeneratorExpression::PreprocessContext preprocessRule,
+ ImportPropertyMap& properties, std::vector<std::string>& missingTargets);
void SetImportLinkInterface(
const std::string& config, std::string const& suffix,
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 02686f3..bfb7a05 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -103,6 +103,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
this->PopulateInterfaceProperty("INTERFACE_COMPILE_FEATURES", gt,
cmGeneratorExpression::InstallInterface,
properties, missingTargets);
+ this->PopulateInterfaceProperty("INTERFACE_LINK_OPTIONS", gt,
+ cmGeneratorExpression::InstallInterface,
+ properties, missingTargets);
+ this->PopulateLinkDependsInterface(
+ te, cmGeneratorExpression::InstallInterface, properties, missingTargets);
std::string errorMessage;
if (!this->PopulateExportProperties(gt, properties, errorMessage)) {
@@ -283,7 +288,7 @@ bool cmExportInstallFileGenerator::GenerateImportFileConfig(
fileName += this->FileExt;
// Open the output file to generate it.
- cmGeneratedFileStream exportFileStream(fileName.c_str(), true);
+ cmGeneratedFileStream exportFileStream(fileName, true);
if (!exportFileStream) {
std::string se = cmSystemTools::GetLastSystemError();
std::ostringstream e;
diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx
index 50f8cb0..b4b2962 100644
--- a/Source/cmExportLibraryDependenciesCommand.cxx
+++ b/Source/cmExportLibraryDependenciesCommand.cxx
@@ -54,7 +54,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
cm::make_unique<cmsys::ofstream>(this->Filename.c_str(), std::ios::app);
} else {
std::unique_ptr<cmGeneratedFileStream> ap(
- new cmGeneratedFileStream(this->Filename.c_str(), true));
+ new cmGeneratedFileStream(this->Filename, true));
ap->SetCopyIfDifferent(true);
foutPtr = std::move(ap);
}
diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx
index fe7159a..8d3dad7 100644
--- a/Source/cmExprParserHelper.cxx
+++ b/Source/cmExprParserHelper.cxx
@@ -6,6 +6,8 @@
#include <iostream>
#include <sstream>
+#include <stdexcept>
+#include <utility>
int cmExpr_yyparse(yyscan_t yyscanner);
//
@@ -13,11 +15,11 @@ cmExprParserHelper::cmExprParserHelper()
{
this->FileLine = -1;
this->FileName = nullptr;
+ this->Result = 0;
}
cmExprParserHelper::~cmExprParserHelper()
{
- this->CleanupParser();
}
int cmExprParserHelper::ParseString(const char* str, int verb)
@@ -37,16 +39,34 @@ int cmExprParserHelper::ParseString(const char* str, int verb)
yyscan_t yyscanner;
cmExpr_yylex_init(&yyscanner);
cmExpr_yyset_extra(this, yyscanner);
- int res = cmExpr_yyparse(yyscanner);
+
+ try {
+ int res = cmExpr_yyparse(yyscanner);
+ if (res != 0) {
+ std::string e = "cannot parse the expression: \"" + InputBuffer + "\": ";
+ e += ErrorString;
+ e += ".";
+ this->SetError(std::move(e));
+ }
+ } catch (std::runtime_error const& fail) {
+ std::string e =
+ "cannot evaluate the expression: \"" + InputBuffer + "\": ";
+ e += fail.what();
+ e += ".";
+ this->SetError(std::move(e));
+ } catch (std::out_of_range const&) {
+ std::string e = "cannot evaluate the expression: \"" + InputBuffer +
+ "\": a numeric value is out of range.";
+ this->SetError(std::move(e));
+ } catch (...) {
+ std::string e = "cannot parse the expression: \"" + InputBuffer + "\".";
+ this->SetError(std::move(e));
+ }
cmExpr_yylex_destroy(yyscanner);
- if (res != 0) {
- // str << "CAL_Parser returned: " << res << std::endl;
- // std::cerr << "When parsing: [" << str << "]" << std::endl;
+ if (!this->ErrorString.empty()) {
return 0;
}
- this->CleanupParser();
-
if (Verbose) {
std::cerr << "Expanding [" << str << "] produced: [" << this->Result << "]"
<< std::endl;
@@ -54,10 +74,6 @@ int cmExprParserHelper::ParseString(const char* str, int verb)
return 1;
}
-void cmExprParserHelper::CleanupParser()
-{
-}
-
int cmExprParserHelper::LexInput(char* buf, int maxlen)
{
// std::cout << "JPLexInput ";
@@ -85,7 +101,21 @@ void cmExprParserHelper::Error(const char* str)
this->ErrorString = ostr.str();
}
-void cmExprParserHelper::SetResult(int value)
+void cmExprParserHelper::UnexpectedChar(char c)
+{
+ unsigned long pos = static_cast<unsigned long>(this->InputBufferPos);
+ std::ostringstream ostr;
+ ostr << "Unexpected character in expression at position " << pos << ": " << c
+ << "\n";
+ this->WarningString += ostr.str();
+}
+
+void cmExprParserHelper::SetResult(KWIML_INT_int64_t value)
{
this->Result = value;
}
+
+void cmExprParserHelper::SetError(std::string errorString)
+{
+ this->ErrorString = std::move(errorString);
+}
diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h
index dcdaca9..42c460a 100644
--- a/Source/cmExprParserHelper.h
+++ b/Source/cmExprParserHelper.h
@@ -5,6 +5,8 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include "cm_kwiml.h"
+
#include <string>
#include <vector>
@@ -13,7 +15,7 @@ class cmExprParserHelper
public:
struct ParserType
{
- int Number;
+ KWIML_INT_int64_t Number;
};
cmExprParserHelper();
@@ -24,12 +26,16 @@ public:
int LexInput(char* buf, int maxlen);
void Error(const char* str);
- void SetResult(int value);
+ void SetResult(KWIML_INT_int64_t value);
- int GetResult() { return this->Result; }
+ KWIML_INT_int64_t GetResult() { return this->Result; }
const char* GetError() { return this->ErrorString.c_str(); }
+ void UnexpectedChar(char c);
+
+ std::string const& GetWarning() const { return this->WarningString; }
+
private:
std::string::size_type InputBufferPos;
std::string InputBuffer;
@@ -39,12 +45,13 @@ private:
void Print(const char* place, const char* str);
- void CleanupParser();
+ void SetError(std::string errorString);
- int Result;
+ KWIML_INT_int64_t Result;
const char* FileName;
long FileLine;
std::string ErrorString;
+ std::string WarningString;
};
#define YYSTYPE cmExprParserHelper::ParserType
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index b636c73..fbf6560 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -199,7 +199,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
const std::vector<cmLocalGenerator*>& lgs, const std::string& filename)
{
const cmMakefile* mf = lgs[0]->GetMakefile();
- cmGeneratedFileStream fout(filename.c_str());
+ cmGeneratedFileStream fout(filename);
if (!fout) {
return;
}
@@ -476,7 +476,7 @@ std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile(
filename += "/";
filename += target->GetName();
filename += ".objlib";
- cmGeneratedFileStream fout(filename.c_str());
+ cmGeneratedFileStream fout(filename);
if (fout) {
/* clang-format off */
fout << "# This is a dummy file for the OBJECT library "
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index b76efb2..fe5c7bb 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -77,7 +77,7 @@ void cmExtraCodeLiteGenerator::Generate()
}
}
- cmGeneratedFileStream fout(workspaceFileName.c_str());
+ cmGeneratedFileStream fout(workspaceFileName);
cmXMLWriter xml(fout);
xml.StartDocument("utf-8");
@@ -122,7 +122,7 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByTarget(
for (cmLocalGenerator* lg : lgs) {
for (cmGeneratorTarget* lt : lg->GetGeneratorTargets()) {
cmStateEnums::TargetType type = lt->GetType();
- std::string outputDir = lg->GetCurrentBinaryDirectory();
+ std::string const& outputDir = lg->GetCurrentBinaryDirectory();
std::string targetName = lt->GetName();
std::string filename = outputDir + "/" + targetName + ".project";
retval.push_back(targetName);
@@ -161,7 +161,7 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByProjectMaps(
// for each sub project in the workspace create a codelite project
for (auto const& it : this->GlobalGenerator->GetProjectMap()) {
- std::string outputDir = it.second[0]->GetCurrentBinaryDirectory();
+ std::string const& outputDir = it.second[0]->GetCurrentBinaryDirectory();
std::string projectName = it.second[0]->GetProjectName();
retval.push_back(projectName);
std::string filename = outputDir + "/" + projectName + ".project";
@@ -184,7 +184,7 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByProjectMaps(
void cmExtraCodeLiteGenerator::CreateProjectFile(
const std::vector<cmLocalGenerator*>& lgs)
{
- std::string outputDir = lgs[0]->GetCurrentBinaryDirectory();
+ std::string const& outputDir = lgs[0]->GetCurrentBinaryDirectory();
std::string projectName = lgs[0]->GetProjectName();
std::string filename = outputDir + "/";
@@ -249,7 +249,7 @@ void cmExtraCodeLiteGenerator::CreateNewProjectFile(
const std::vector<cmLocalGenerator*>& lgs, const std::string& filename)
{
const cmMakefile* mf = lgs[0]->GetMakefile();
- cmGeneratedFileStream fout(filename.c_str());
+ cmGeneratedFileStream fout(filename);
if (!fout) {
return;
}
@@ -547,7 +547,7 @@ void cmExtraCodeLiteGenerator::CreateNewProjectFile(
const cmGeneratorTarget* gt, const std::string& filename)
{
const cmMakefile* mf = gt->Makefile;
- cmGeneratedFileStream fout(filename.c_str());
+ cmGeneratedFileStream fout(filename);
if (!fout) {
return;
}
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 14448f5..313d46b 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -98,7 +98,7 @@ void cmExtraEclipseCDT4Generator::Generate()
std::string eclipseVersion = mf->GetSafeDefinition("CMAKE_ECLIPSE_VERSION");
cmsys::RegularExpression regex(".*([0-9]+\\.[0-9]+).*");
- if (regex.find(eclipseVersion.c_str())) {
+ if (regex.find(eclipseVersion)) {
unsigned int majorVersion = 0;
unsigned int minorVersion = 0;
int res =
@@ -176,7 +176,7 @@ void cmExtraEclipseCDT4Generator::CreateSourceProjectFile()
this->GetPathBasename(this->HomeDirectory));
const std::string filename = this->HomeDirectory + "/.project";
- cmGeneratedFileStream fout(filename.c_str());
+ cmGeneratedFileStream fout(filename);
if (!fout) {
return;
}
@@ -261,7 +261,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
const std::string filename = this->HomeOutputDirectory + "/.project";
- cmGeneratedFileStream fout(filename.c_str());
+ cmGeneratedFileStream fout(filename);
if (!fout) {
return;
}
@@ -555,7 +555,7 @@ void cmExtraEclipseCDT4Generator::AppendIncludeDirectories(
// Frameworks/ part has to be stripped
// /System/Library/Frameworks/GLUT.framework/Headers
cmsys::RegularExpression frameworkRx("(.+/Frameworks)/.+\\.framework/");
- if (frameworkRx.find(dir.c_str())) {
+ if (frameworkRx.find(dir)) {
dir = frameworkRx.match(1);
}
@@ -582,7 +582,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
const std::string filename = this->HomeOutputDirectory + "/.cproject";
- cmGeneratedFileStream fout(filename.c_str());
+ cmGeneratedFileStream fout(filename);
if (!fout) {
return;
}
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index df18715..f5c4c93 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -58,7 +58,7 @@ void cmExtraKateGenerator::CreateKateProjectFile(
{
std::string filename = lg->GetBinaryDirectory();
filename += "/.kateproject";
- cmGeneratedFileStream fout(filename.c_str());
+ cmGeneratedFileStream fout(filename);
if (!fout) {
return;
}
@@ -215,7 +215,7 @@ void cmExtraKateGenerator::CreateDummyKateProjectFile(
filename += "/";
filename += this->ProjectName;
filename += ".kateproject";
- cmGeneratedFileStream fout(filename.c_str());
+ cmGeneratedFileStream fout(filename);
if (!fout) {
return;
}
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index fb85a68..14e7927 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -91,7 +91,7 @@ void cmExtraSublimeTextGenerator::CreateNewProjectFile(
{
const cmMakefile* mf = lgs[0]->GetMakefile();
- cmGeneratedFileStream fout(filename.c_str());
+ cmGeneratedFileStream fout(filename);
if (!fout) {
return;
}
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index dcb79f7..1c29017 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -7,9 +7,10 @@
#include "cmsys/FStream.hxx"
#include "cmsys/Glob.hxx"
#include "cmsys/RegularExpression.hxx"
-#include "cmsys/String.hxx"
+
#include <algorithm>
#include <assert.h>
+#include <ctype.h>
#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
@@ -207,16 +208,20 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args,
cmSystemTools::MakeDirectory(dir);
mode_t mode = 0;
+ bool writable = false;
// Set permissions to writable
if (cmSystemTools::GetPermissions(fileName.c_str(), mode)) {
- cmSystemTools::SetPermissions(fileName.c_str(),
#if defined(_MSC_VER) || defined(__MINGW32__)
- mode | S_IWRITE
+ writable = mode & S_IWRITE;
+ mode_t newMode = mode | S_IWRITE;
#else
- mode | S_IWUSR | S_IWGRP
+ writable = mode & S_IWUSR;
+ mode_t newMode = mode | S_IWUSR | S_IWGRP;
#endif
- );
+ if (!writable) {
+ cmSystemTools::SetPermissions(fileName.c_str(), newMode);
+ }
}
// If GetPermissions fails, pretend like it is ok. File open will fail if
// the file is not writable
@@ -241,7 +246,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args,
return false;
}
file.close();
- if (mode) {
+ if (mode && !writable) {
cmSystemTools::SetPermissions(fileName.c_str(), mode);
}
return true;
@@ -609,8 +614,8 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
continue;
}
- if ((c >= 0x20 && c < 0x7F) || c == '\t' ||
- (c == '\n' && newline_consume)) {
+ if (c >= 0 && c <= 0xFF &&
+ (isprint(c) || c == '\t' || (c == '\n' && newline_consume))) {
// This is an ASCII character that may be part of a string.
// Cast added to avoid compiler warning. Cast is ok because
// c is guaranteed to fit in char by the above if...
@@ -658,7 +663,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
// The current line has been terminated. Check if the current
// string matches the requirements. The length may now be as
// low as zero since blank lines are allowed.
- if (s.length() >= minlen && (!have_regex || regex.find(s.c_str()))) {
+ if (s.length() >= minlen && (!have_regex || regex.find(s))) {
output_size += static_cast<int>(s.size()) + 1;
if (limit_output >= 0 && output_size >= limit_output) {
s.clear();
@@ -674,7 +679,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
// string matches the requirements. We require that the length
// be at least one no matter what the user specified.
if (s.length() >= minlen && !s.empty() &&
- (!have_regex || regex.find(s.c_str()))) {
+ (!have_regex || regex.find(s))) {
output_size += static_cast<int>(s.size()) + 1;
if (limit_output >= 0 && output_size >= limit_output) {
s.clear();
@@ -691,7 +696,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
if (maxlen > 0 && s.size() == maxlen) {
// Terminate a string if the maximum length is reached.
- if (s.length() >= minlen && (!have_regex || regex.find(s.c_str()))) {
+ if (s.length() >= minlen && (!have_regex || regex.find(s))) {
output_size += static_cast<int>(s.size()) + 1;
if (limit_output >= 0 && output_size >= limit_output) {
s.clear();
@@ -707,7 +712,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
// input file or the input size limit. Check if the current string
// matches the requirements.
if ((!limit_count || strings.size() < limit_count) && !s.empty() &&
- s.length() >= minlen && (!have_regex || regex.find(s.c_str()))) {
+ s.length() >= minlen && (!have_regex || regex.find(s))) {
output_size += static_cast<int>(s.size()) + 1;
if (limit_output < 0 || output_size < limit_output) {
strings.push_back(s);
@@ -2484,11 +2489,11 @@ bool cmFileCommand::HandleCMakePathCommand(
#else
char pathSep = ':';
#endif
- std::vector<cmsys::String> path = cmSystemTools::SplitString(*i, pathSep);
+ std::vector<std::string> path = cmSystemTools::SplitString(*i, pathSep);
i++;
const char* var = i->c_str();
std::string value;
- for (std::vector<cmsys::String>::iterator j = path.begin(); j != path.end();
+ for (std::vector<std::string>::iterator j = path.begin(); j != path.end();
++j) {
if (j != path.begin()) {
value += ";";
@@ -2498,7 +2503,7 @@ bool cmFileCommand::HandleCMakePathCommand(
} else {
*j = cmSystemTools::ConvertToOutputPath(*j);
// remove double quotes in the path
- cmsys::String& s = *j;
+ std::string& s = *j;
if (s.size() > 1 && s[0] == '\"' && s[s.size() - 1] == '\"') {
s = s.substr(1, s.size() - 2);
@@ -2881,6 +2886,10 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
check_curl_result(res, "DOWNLOAD cannot set url: ");
+ // enable auth
+ res = ::curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
+ check_curl_result(res, "DOWNLOAD cannot set httpauth: ");
+
// enable HTTP ERROR parsing
res = ::curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
check_curl_result(res, "DOWNLOAD cannot set http failure option: ");
@@ -3180,6 +3189,10 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
res = ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
check_curl_result(res, "UPLOAD cannot set url: ");
+ // enable auth
+ res = ::curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
+ check_curl_result(res, "UPLOAD cannot set httpauth: ");
+
res =
::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, cmWriteToMemoryCallback);
check_curl_result(res, "UPLOAD cannot set write function: ");
@@ -3458,7 +3471,7 @@ bool cmFileCommand::HandleLockCommand(std::vector<std::string> const& args)
}
if (!cmsys::SystemTools::FileIsFullPath(path)) {
- path = this->Makefile->GetCurrentSourceDirectory() + ("/" + path);
+ path = this->Makefile->GetCurrentSourceDirectory() + "/" + path;
}
// Unify path (remove '//', '/../', ...)
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 7ac0cdf..96de6ad 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -337,7 +337,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
return false;
}
this->Configs.push_back(args[i]);
- } else if (!haveVersion && version.find(args[i].c_str())) {
+ } else if (!haveVersion && version.find(args[i])) {
haveVersion = true;
this->Version = args[i];
} else {
@@ -487,7 +487,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
this->SetModuleVariables(components);
- // See if there is a Find<package>.cmake module.
+ // See if there is a Find<PackageName>.cmake module.
if (this->UseFindModules) {
bool foundModule = false;
if (!this->FindModule(foundModule)) {
@@ -538,7 +538,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
}
// No find module. Assume the project has a CMake config file. Use
- // a <package>_DIR cache variable to locate it.
+ // a <PackageName>_DIR cache variable to locate it.
this->Variable = this->Name;
this->Variable += "_DIR";
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index d8c7ab3..48f17ef 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -7,6 +7,7 @@
#include "cm_kwiml.h"
#include <cstddef>
+#include <functional>
#include <map>
#include <set>
#include <string>
@@ -15,14 +16,12 @@
// IWYU insists we should forward-declare instead of including <functional>,
// but we cannot forward-declare reliably because some C++ standard libraries
// put the template in an inline namespace.
-#ifdef CMAKE_IWYU
+#ifdef CMAKE_IWYU_FORWARD_STD_HASH
/* clang-format off */
namespace std {
template <class T> struct hash;
}
/* clang-format on */
-#else
-# include <functional>
#endif
#include "cmFindCommon.h"
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx
index 13a18e2..db34077 100644
--- a/Source/cmFindProgramCommand.cxx
+++ b/Source/cmFindProgramCommand.cxx
@@ -34,6 +34,9 @@ struct cmFindProgramHelper
// Current names under consideration.
std::vector<std::string> Names;
+ // Current name with extension under consideration.
+ std::string TestNameExt;
+
// Current full path under consideration.
std::string TestPath;
@@ -43,6 +46,19 @@ struct cmFindProgramHelper
this->Names.clear();
this->AddName(name);
}
+ bool CheckCompoundNames()
+ {
+ for (std::string const& n : this->Names) {
+ // Only perform search relative to current directory if the file name
+ // contains a directory separator.
+ if (n.find('/') != std::string::npos) {
+ if (this->CheckDirectoryForName("", n)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
bool CheckDirectory(std::string const& path)
{
for (std::string const& n : this->Names) {
@@ -55,14 +71,16 @@ struct cmFindProgramHelper
bool CheckDirectoryForName(std::string const& path, std::string const& name)
{
for (std::string const& ext : this->Extensions) {
- this->TestPath = path;
- this->TestPath += name;
if (!ext.empty() && cmSystemTools::StringEndsWith(name, ext.c_str())) {
continue;
}
- this->TestPath += ext;
+ this->TestNameExt = name;
+ this->TestNameExt += ext;
+ this->TestPath =
+ cmSystemTools::CollapseCombinedPath(path, this->TestNameExt);
+
if (cmSystemTools::FileExists(this->TestPath, true)) {
- this->BestPath = cmSystemTools::CollapseFullPath(this->TestPath);
+ this->BestPath = this->TestPath;
return true;
}
}
@@ -145,8 +163,8 @@ std::string cmFindProgramCommand::FindNormalProgramNamesPerDir()
helper.AddName(n);
}
- // Check for the names themselves (e.g. absolute paths).
- if (helper.CheckDirectory(std::string())) {
+ // Check for the names themselves if they contain a directory separator.
+ if (helper.CheckCompoundNames()) {
return helper.BestPath;
}
@@ -168,8 +186,8 @@ std::string cmFindProgramCommand::FindNormalProgramDirsPerName()
// Switch to searching for this name.
helper.SetName(n);
- // Check for the name by itself (e.g. an absolute path).
- if (helper.CheckDirectory(std::string())) {
+ // Check for the names themselves if they contain a directory separator.
+ if (helper.CheckCompoundNames()) {
return helper.BestPath;
}
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx
index 6bdf3a4..186ec8c 100644
--- a/Source/cmGeneratedFileStream.cxx
+++ b/Source/cmGeneratedFileStream.cxx
@@ -24,8 +24,8 @@ cmGeneratedFileStream::cmGeneratedFileStream(Encoding encoding)
#endif
}
-cmGeneratedFileStream::cmGeneratedFileStream(const char* name, bool quiet,
- Encoding encoding)
+cmGeneratedFileStream::cmGeneratedFileStream(std::string const& name,
+ bool quiet, Encoding encoding)
: cmGeneratedFileStreamBase(name)
, Stream(TempName.c_str())
{
@@ -54,7 +54,7 @@ cmGeneratedFileStream::~cmGeneratedFileStream()
this->Okay = !this->fail();
}
-cmGeneratedFileStream& cmGeneratedFileStream::Open(const char* name,
+cmGeneratedFileStream& cmGeneratedFileStream::Open(std::string const& name,
bool quiet, bool binaryFlag)
{
// Store the file name and construct the temporary file name.
@@ -114,7 +114,7 @@ cmGeneratedFileStreamBase::cmGeneratedFileStreamBase()
{
}
-cmGeneratedFileStreamBase::cmGeneratedFileStreamBase(const char* name)
+cmGeneratedFileStreamBase::cmGeneratedFileStreamBase(std::string const& name)
: Name()
, TempName()
, CopyIfDifferent(false)
@@ -130,7 +130,7 @@ cmGeneratedFileStreamBase::~cmGeneratedFileStreamBase()
this->Close();
}
-void cmGeneratedFileStreamBase::Open(const char* name)
+void cmGeneratedFileStreamBase::Open(std::string const& name)
{
// Save the original name of the file.
this->Name = name;
@@ -168,12 +168,12 @@ bool cmGeneratedFileStreamBase::Close()
// destination atomically.
if (this->Compress) {
std::string gzname = this->TempName + ".temp.gz";
- if (this->CompressFile(this->TempName.c_str(), gzname.c_str())) {
- this->RenameFile(gzname.c_str(), resname.c_str());
+ if (this->CompressFile(this->TempName, gzname)) {
+ this->RenameFile(gzname, resname);
}
cmSystemTools::RemoveFile(gzname);
} else {
- this->RenameFile(this->TempName.c_str(), resname.c_str());
+ this->RenameFile(this->TempName, resname);
}
replaced = true;
@@ -188,10 +188,10 @@ bool cmGeneratedFileStreamBase::Close()
}
#ifdef CMAKE_BUILD_WITH_CMAKE
-int cmGeneratedFileStreamBase::CompressFile(const char* oldname,
- const char* newname)
+int cmGeneratedFileStreamBase::CompressFile(std::string const& oldname,
+ std::string const& newname)
{
- gzFile gf = gzopen(newname, "w");
+ gzFile gf = gzopen(newname.c_str(), "w");
if (!gf) {
return 0;
}
@@ -214,16 +214,17 @@ int cmGeneratedFileStreamBase::CompressFile(const char* oldname,
return 1;
}
#else
-int cmGeneratedFileStreamBase::CompressFile(const char*, const char*)
+int cmGeneratedFileStreamBase::CompressFile(std::string const&,
+ std::string const&)
{
return 0;
}
#endif
-int cmGeneratedFileStreamBase::RenameFile(const char* oldname,
- const char* newname)
+int cmGeneratedFileStreamBase::RenameFile(std::string const& oldname,
+ std::string const& newname)
{
- return cmSystemTools::RenameFile(oldname, newname);
+ return cmSystemTools::RenameFile(oldname.c_str(), newname.c_str());
}
void cmGeneratedFileStream::SetName(const std::string& fname)
diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h
index 48f93c5..dacd166 100644
--- a/Source/cmGeneratedFileStream.h
+++ b/Source/cmGeneratedFileStream.h
@@ -20,7 +20,7 @@ protected:
cmGeneratedFileStreamBase();
// This constructor prepares the temporary output file.
- cmGeneratedFileStreamBase(const char* name);
+ cmGeneratedFileStreamBase(std::string const& name);
// The destructor renames the temporary output file to the real name.
~cmGeneratedFileStreamBase();
@@ -29,14 +29,14 @@ protected:
// called before the real stream is opened. Close is always called
// after the real stream is closed and Okay is set to whether the
// real stream was still valid for writing when it was closed.
- void Open(const char* name);
+ void Open(std::string const& name);
bool Close();
// Internal file replacement implementation.
- int RenameFile(const char* oldname, const char* newname);
+ int RenameFile(std::string const& oldname, std::string const& newname);
// Internal file compression implementation.
- int CompressFile(const char* oldname, const char* newname);
+ int CompressFile(std::string const& oldname, std::string const& newname);
// The name of the final destination file for the output.
std::string Name;
@@ -87,7 +87,7 @@ public:
* file cannot be opened an error message is produced unless the
* second argument is set to true.
*/
- cmGeneratedFileStream(const char* name, bool quiet = false,
+ cmGeneratedFileStream(std::string const& name, bool quiet = false,
Encoding encoding = codecvt::None);
/**
@@ -103,7 +103,7 @@ public:
* temporary file. If the file cannot be opened an error message is
* produced unless the second argument is set to true.
*/
- cmGeneratedFileStream& Open(const char* name, bool quiet = false,
+ cmGeneratedFileStream& Open(std::string const& name, bool quiet = false,
bool binaryFlag = false);
/**
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 64ec30d..6823cd5 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -38,7 +38,7 @@ cmGeneratorExpression::~cmGeneratorExpression()
{
}
-const char* cmCompiledGeneratorExpression::Evaluate(
+const std::string& cmCompiledGeneratorExpression::Evaluate(
cmLocalGenerator* lg, const std::string& config, bool quiet,
const cmGeneratorTarget* headTarget,
cmGeneratorExpressionDAGChecker* dagChecker,
@@ -48,7 +48,7 @@ const char* cmCompiledGeneratorExpression::Evaluate(
language);
}
-const char* cmCompiledGeneratorExpression::Evaluate(
+const std::string& cmCompiledGeneratorExpression::Evaluate(
cmLocalGenerator* lg, const std::string& config, bool quiet,
const cmGeneratorTarget* headTarget, const cmGeneratorTarget* currentTarget,
cmGeneratorExpressionDAGChecker* dagChecker,
@@ -61,12 +61,12 @@ const char* cmCompiledGeneratorExpression::Evaluate(
return this->EvaluateWithContext(context, dagChecker);
}
-const char* cmCompiledGeneratorExpression::EvaluateWithContext(
+const std::string& cmCompiledGeneratorExpression::EvaluateWithContext(
cmGeneratorExpressionContext& context,
cmGeneratorExpressionDAGChecker* dagChecker) const
{
if (!this->NeedsEvaluation) {
- return this->Input.c_str();
+ return this->Input;
}
this->Output.clear();
@@ -97,8 +97,7 @@ const char* cmCompiledGeneratorExpression::EvaluateWithContext(
this->DependTargets = context.DependTargets;
this->AllTargetsSeen = context.AllTargets;
- // TODO: Return a std::string from here instead?
- return this->Output.c_str();
+ return this->Output;
}
cmCompiledGeneratorExpression::cmCompiledGeneratorExpression(
@@ -387,7 +386,7 @@ void cmCompiledGeneratorExpression::GetMaxLanguageStandard(
}
}
-const char* cmGeneratorExpressionInterpreter::Evaluate(
+const std::string& cmGeneratorExpressionInterpreter::Evaluate(
const char* expression, const std::string& property)
{
if (this->Target.empty()) {
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 9fd53c6..2b7df91 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -72,16 +72,17 @@ class cmCompiledGeneratorExpression
CM_DISABLE_COPY(cmCompiledGeneratorExpression)
public:
- const char* Evaluate(cmLocalGenerator* lg, const std::string& config,
- bool quiet = false,
- cmGeneratorTarget const* headTarget = nullptr,
- cmGeneratorTarget const* currentTarget = nullptr,
- cmGeneratorExpressionDAGChecker* dagChecker = nullptr,
- std::string const& language = std::string()) const;
- const char* Evaluate(cmLocalGenerator* lg, const std::string& config,
- bool quiet, cmGeneratorTarget const* headTarget,
- cmGeneratorExpressionDAGChecker* dagChecker,
- std::string const& language = std::string()) const;
+ const std::string& Evaluate(
+ cmLocalGenerator* lg, const std::string& config, bool quiet = false,
+ cmGeneratorTarget const* headTarget = nullptr,
+ cmGeneratorTarget const* currentTarget = nullptr,
+ cmGeneratorExpressionDAGChecker* dagChecker = nullptr,
+ std::string const& language = std::string()) const;
+ const std::string& Evaluate(
+ cmLocalGenerator* lg, const std::string& config, bool quiet,
+ cmGeneratorTarget const* headTarget,
+ cmGeneratorExpressionDAGChecker* dagChecker,
+ std::string const& language = std::string()) const;
/** Get set of targets found during evaluations. */
std::set<cmGeneratorTarget*> const& GetTargets() const
@@ -126,7 +127,7 @@ public:
std::map<std::string, std::string>& mapping);
private:
- const char* EvaluateWithContext(
+ const std::string& EvaluateWithContext(
cmGeneratorExpressionContext& context,
cmGeneratorExpressionDAGChecker* dagChecker) const;
@@ -178,17 +179,10 @@ public:
{
}
- const char* Evaluate(const char* expression)
- {
- return this->EvaluateExpression(expression);
- }
- const char* Evaluate(const std::string& expression)
- {
- return this->Evaluate(expression.c_str());
- }
- const char* Evaluate(const char* expression, const std::string& property);
- const char* Evaluate(const std::string& expression,
- const std::string& property)
+ const std::string& Evaluate(const char* expression,
+ const std::string& property);
+ const std::string& Evaluate(const std::string& expression,
+ const std::string& property)
{
return this->Evaluate(expression.c_str(), property);
}
@@ -211,7 +205,7 @@ protected:
const std::string& GetTargetName() const { return this->Target; }
const std::string& GetLanguage() const { return this->Language; }
- const char* EvaluateExpression(
+ const std::string& EvaluateExpression(
const char* expression,
cmGeneratorExpressionDAGChecker* dagChecker = nullptr)
{
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index a3a8f69..cd23904 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -25,7 +25,9 @@ struct cmGeneratorExpressionContext;
SELECT(F, EvaluatingCompileOptions, COMPILE_OPTIONS) \
SELECT(F, EvaluatingAutoUicOptions, AUTOUIC_OPTIONS) \
SELECT(F, EvaluatingSources, SOURCES) \
- SELECT(F, EvaluatingCompileFeatures, COMPILE_FEATURES)
+ SELECT(F, EvaluatingCompileFeatures, COMPILE_FEATURES) \
+ SELECT(F, EvaluatingLinkOptions, LINK_OPTIONS) \
+ SELECT(F, EvaluatingLinkDepends, LINK_DEPENDS)
#define CM_FOR_EACH_TRANSITIVE_PROPERTY(F) \
CM_FOR_EACH_TRANSITIVE_PROPERTY_IMPL(F, CM_SELECT_BOTH)
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index 99b9261..e7a55e0 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -55,7 +55,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(
std::string outputFileName = this->OutputFileExpr->Evaluate(
lg, config, false, nullptr, nullptr, nullptr, lang);
- const std::string outputContent = inputExpression->Evaluate(
+ const std::string& outputContent = inputExpression->Evaluate(
lg, config, false, nullptr, nullptr, nullptr, lang);
if (cmSystemTools::FileIsFullPath(outputFileName)) {
@@ -85,7 +85,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(
this->Files.push_back(outputFileName);
outputFiles[outputFileName] = outputContent;
- cmGeneratedFileStream fout(outputFileName.c_str());
+ cmGeneratedFileStream fout(outputFileName);
fout.SetCopyIfDifferent(true);
fout << outputContent;
if (fout.Close() && perm) {
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 1594904..3381e6d 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -1126,7 +1126,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
std::string targetName = parameters.front();
propertyName = parameters[1];
if (!cmGeneratorExpression::IsValidTargetName(targetName)) {
- if (!propertyNameValidator.find(propertyName.c_str())) {
+ if (!propertyNameValidator.find(propertyName)) {
::reportError(context, content->GetOriginalExpression(),
"Target name and property name not supported.");
return std::string();
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index b223c5e..eb1852d 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -102,6 +102,7 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
, DebugCompileOptionsDone(false)
, DebugCompileFeaturesDone(false)
, DebugCompileDefinitionsDone(false)
+ , DebugLinkOptionsDone(false)
, DebugSourcesDone(false)
, LinkImplementationLanguageIsContextDependent(true)
, UtilityItemsDone(false)
@@ -128,6 +129,10 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
t->GetCompileDefinitionsBacktraces(),
this->CompileDefinitionsEntries);
+ CreatePropertyGeneratorExpressions(t->GetLinkOptionsEntries(),
+ t->GetLinkOptionsBacktraces(),
+ this->LinkOptionsEntries);
+
CreatePropertyGeneratorExpressions(t->GetSourceEntries(),
t->GetSourceBacktraces(),
this->SourceEntries, true);
@@ -145,6 +150,7 @@ cmGeneratorTarget::~cmGeneratorTarget()
cmDeleteAll(this->CompileOptionsEntries);
cmDeleteAll(this->CompileFeaturesEntries);
cmDeleteAll(this->CompileDefinitionsEntries);
+ cmDeleteAll(this->LinkOptionsEntries);
cmDeleteAll(this->SourceEntries);
cmDeleteAll(this->LinkInformation);
}
@@ -215,6 +221,15 @@ const char* cmGeneratorTarget::GetProperty(const std::string& prop) const
return this->Target->GetProperty(prop);
}
+const char* cmGeneratorTarget::GetSafeProperty(const std::string& prop) const
+{
+ const char* ret = this->GetProperty(prop);
+ if (!ret) {
+ return "";
+ }
+ return ret;
+}
+
const char* cmGeneratorTarget::GetOutputTargetType(
cmStateEnums::ArtifactType artifact) const
{
@@ -1124,7 +1139,7 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files,
std::string cppFileName = xaml + ".cpp";
files.ExpectedXamlHeaders.insert(hFileName);
files.ExpectedXamlSources.insert(cppFileName);
- } else if (header_regex.find(sf->GetFullPath().c_str())) {
+ } else if (header_regex.find(sf->GetFullPath())) {
kind = SourceKindHeader;
} else {
kind = SourceKindExtra;
@@ -2633,7 +2648,7 @@ enum class OptionsParse
Shell
};
-static void processCompileOptionsInternal(
+static void processOptionsInternal(
cmGeneratorTarget const* tgt,
const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
std::vector<std::string>& options,
@@ -2665,7 +2680,7 @@ static void processCompileOptionsInternal(
if (!usedOptions.empty()) {
tgt->GetLocalGenerator()->GetCMakeInstance()->IssueMessage(
cmake::LOG,
- std::string("Used compile ") + logName + std::string(" for target ") +
+ std::string("Used ") + logName + std::string(" for target ") +
tgt->GetName() + ":\n" + usedOptions,
entry->ge->GetBacktrace());
}
@@ -2680,9 +2695,9 @@ static void processCompileOptions(
cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
bool debugOptions, std::string const& language)
{
- processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
- dagChecker, config, debugOptions, "options",
- language, OptionsParse::Shell);
+ processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker,
+ config, debugOptions, "compile options", language,
+ OptionsParse::Shell);
}
void cmGeneratorTarget::GetCompileOptions(std::vector<std::string>& result,
@@ -2734,9 +2749,9 @@ static void processCompileFeatures(
cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
bool debugOptions)
{
- processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
- dagChecker, config, debugOptions, "features",
- std::string(), OptionsParse::None);
+ processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker,
+ config, debugOptions, "compile features",
+ std::string(), OptionsParse::None);
}
void cmGeneratorTarget::GetCompileFeatures(std::vector<std::string>& result,
@@ -2784,9 +2799,9 @@ static void processCompileDefinitions(
cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
bool debugOptions, std::string const& language)
{
- processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
- dagChecker, config, debugOptions,
- "definitions", language, OptionsParse::None);
+ processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker,
+ config, debugOptions, "compile definitions", language,
+ OptionsParse::None);
}
void cmGeneratorTarget::GetCompileDefinitions(
@@ -2855,6 +2870,236 @@ void cmGeneratorTarget::GetCompileDefinitions(
cmDeleteAll(linkInterfaceCompileDefinitionsEntries);
}
+namespace {
+void processLinkOptions(
+ cmGeneratorTarget const* tgt,
+ const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
+ std::vector<std::string>& options,
+ std::unordered_set<std::string>& uniqueOptions,
+ cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
+ bool debugOptions, std::string const& language)
+{
+ processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker,
+ config, debugOptions, "link options", language,
+ OptionsParse::Shell);
+}
+}
+
+void cmGeneratorTarget::GetLinkOptions(std::vector<std::string>& result,
+ const std::string& config,
+ const std::string& language) const
+{
+ std::unordered_set<std::string> uniqueOptions;
+
+ cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "LINK_OPTIONS",
+ nullptr, nullptr);
+
+ std::vector<std::string> debugProperties;
+ const char* debugProp =
+ this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
+ if (debugProp) {
+ cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+ }
+
+ bool debugOptions = !this->DebugLinkOptionsDone &&
+ std::find(debugProperties.begin(), debugProperties.end(),
+ "LINK_OPTIONS") != debugProperties.end();
+
+ if (this->GlobalGenerator->GetConfigureDoneCMP0026()) {
+ this->DebugLinkOptionsDone = true;
+ }
+
+ processLinkOptions(this, this->LinkOptionsEntries, result, uniqueOptions,
+ &dagChecker, config, debugOptions, language);
+
+ std::vector<cmGeneratorTarget::TargetPropertyEntry*>
+ linkInterfaceLinkOptionsEntries;
+
+ AddInterfaceEntries(this, config, "INTERFACE_LINK_OPTIONS",
+ linkInterfaceLinkOptionsEntries);
+
+ processLinkOptions(this, linkInterfaceLinkOptionsEntries, result,
+ uniqueOptions, &dagChecker, config, debugOptions,
+ language);
+
+ cmDeleteAll(linkInterfaceLinkOptionsEntries);
+
+ // Last step: replace "LINKER:" prefixed elements by
+ // actual linker wrapper
+ const std::string wrapper(this->Makefile->GetSafeDefinition(
+ "CMAKE_" + language + "_LINKER_WRAPPER_FLAG"));
+ std::vector<std::string> wrapperFlag;
+ cmSystemTools::ExpandListArgument(wrapper, wrapperFlag);
+ const std::string wrapperSep(this->Makefile->GetSafeDefinition(
+ "CMAKE_" + language + "_LINKER_WRAPPER_FLAG_SEP"));
+ bool concatFlagAndArgs = true;
+ if (!wrapperFlag.empty() && wrapperFlag.back() == " ") {
+ concatFlagAndArgs = false;
+ wrapperFlag.pop_back();
+ }
+
+ const std::string LINKER{ "LINKER:" };
+ const std::string SHELL{ "SHELL:" };
+ const std::string LINKER_SHELL = LINKER + SHELL;
+
+ std::vector<std::string>::iterator entry;
+ while ((entry = std::find_if(result.begin(), result.end(),
+ [&LINKER](const std::string& item) -> bool {
+ return item.compare(0, LINKER.length(),
+ LINKER) == 0;
+ })) != result.end()) {
+ std::vector<std::string> linkerOptions;
+ if (entry->compare(0, LINKER_SHELL.length(), LINKER_SHELL) == 0) {
+ cmSystemTools::ParseUnixCommandLine(
+ entry->c_str() + LINKER_SHELL.length(), linkerOptions);
+ } else {
+ linkerOptions =
+ cmSystemTools::tokenize(entry->substr(LINKER.length()), ",");
+ }
+ entry = result.erase(entry);
+
+ if (linkerOptions.empty() ||
+ (linkerOptions.size() == 1 && linkerOptions.front().empty())) {
+ continue;
+ }
+
+ // for now, raise an error if prefix SHELL: is part of arguments
+ if (std::find_if(linkerOptions.begin(), linkerOptions.end(),
+ [&SHELL](const std::string& item) -> bool {
+ return item.find(SHELL) != std::string::npos;
+ }) != linkerOptions.end()) {
+ this->LocalGenerator->GetCMakeInstance()->IssueMessage(
+ cmake::FATAL_ERROR,
+ "'SHELL:' prefix is not supported as part of 'LINKER:' arguments.",
+ this->GetBacktrace());
+ return;
+ }
+
+ if (wrapperFlag.empty()) {
+ // nothing specified, insert elements as is
+ result.insert(entry, linkerOptions.begin(), linkerOptions.end());
+ } else {
+ std::vector<std::string> options;
+
+ if (!wrapperSep.empty()) {
+ if (concatFlagAndArgs) {
+ // insert flag elements except last one
+ options.insert(options.end(), wrapperFlag.begin(),
+ wrapperFlag.end() - 1);
+ // concatenate last flag element and all LINKER list values
+ // in one option
+ options.push_back(wrapperFlag.back() +
+ cmJoin(linkerOptions, wrapperSep));
+ } else {
+ options.insert(options.end(), wrapperFlag.begin(),
+ wrapperFlag.end());
+ // concatenate all LINKER list values in one option
+ options.push_back(cmJoin(linkerOptions, wrapperSep));
+ }
+ } else {
+ // prefix each element of LINKER list with wrapper
+ if (concatFlagAndArgs) {
+ std::transform(
+ linkerOptions.begin(), linkerOptions.end(), linkerOptions.begin(),
+ [&wrapperFlag](const std::string& value) -> std::string {
+ return wrapperFlag.back() + value;
+ });
+ }
+ for (const auto& value : linkerOptions) {
+ options.insert(options.end(), wrapperFlag.begin(),
+ concatFlagAndArgs ? wrapperFlag.end() - 1
+ : wrapperFlag.end());
+ options.push_back(value);
+ }
+ }
+ result.insert(entry, options.begin(), options.end());
+ }
+ }
+}
+
+namespace {
+void processStaticLibraryLinkOptions(
+ cmGeneratorTarget const* tgt,
+ const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
+ std::vector<std::string>& options,
+ std::unordered_set<std::string>& uniqueOptions,
+ cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
+ std::string const& language)
+{
+ processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker,
+ config, false, "static library link options",
+ language, OptionsParse::Shell);
+}
+}
+
+void cmGeneratorTarget::GetStaticLibraryLinkOptions(
+ std::vector<std::string>& result, const std::string& config,
+ const std::string& language) const
+{
+ std::vector<cmGeneratorTarget::TargetPropertyEntry*> entries;
+ std::unordered_set<std::string> uniqueOptions;
+
+ cmGeneratorExpressionDAGChecker dagChecker(
+ this->GetName(), "STATIC_LIBRARY_OPTIONS", nullptr, nullptr);
+
+ if (const char* linkOptions = this->GetProperty("STATIC_LIBRARY_OPTIONS")) {
+ std::vector<std::string> options;
+ cmGeneratorExpression ge;
+ cmSystemTools::ExpandListArgument(linkOptions, options);
+ for (const auto& option : options) {
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(option);
+ entries.push_back(
+ new cmGeneratorTarget::TargetPropertyEntry(std::move(cge)));
+ }
+ }
+ processStaticLibraryLinkOptions(this, entries, result, uniqueOptions,
+ &dagChecker, config, language);
+
+ cmDeleteAll(entries);
+}
+
+namespace {
+void processLinkDepends(
+ cmGeneratorTarget const* tgt,
+ const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
+ std::vector<std::string>& options,
+ std::unordered_set<std::string>& uniqueOptions,
+ cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
+ std::string const& language)
+{
+ processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker,
+ config, false, "link depends", language,
+ OptionsParse::None);
+}
+}
+
+void cmGeneratorTarget::GetLinkDepends(std::vector<std::string>& result,
+ const std::string& config,
+ const std::string& language) const
+{
+ std::vector<cmGeneratorTarget::TargetPropertyEntry*> linkDependsEntries;
+ std::unordered_set<std::string> uniqueOptions;
+ cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "LINK_DEPENDS",
+ nullptr, nullptr);
+
+ if (const char* linkDepends = this->GetProperty("LINK_DEPENDS")) {
+ std::vector<std::string> depends;
+ cmGeneratorExpression ge;
+ cmSystemTools::ExpandListArgument(linkDepends, depends);
+ for (const auto& depend : depends) {
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(depend);
+ linkDependsEntries.push_back(
+ new cmGeneratorTarget::TargetPropertyEntry(std::move(cge)));
+ }
+ }
+ AddInterfaceEntries(this, config, "INTERFACE_LINK_DEPENDS",
+ linkDependsEntries);
+ processLinkDepends(this, linkDependsEntries, result, uniqueOptions,
+ &dagChecker, config, language);
+
+ cmDeleteAll(linkDependsEntries);
+}
+
void cmGeneratorTarget::ComputeTargetManifest(const std::string& config) const
{
if (this->IsImported()) {
@@ -3154,14 +3399,12 @@ std::string cmGeneratorTarget::GetFullNameInternal(
return prefix + base + suffix;
}
-const char* cmGeneratorTarget::ImportedGetLocation(
+std::string cmGeneratorTarget::ImportedGetLocation(
const std::string& config) const
{
- static std::string location;
assert(this->IsImported());
- location = this->Target->ImportedGetFullPath(
+ return this->Target->ImportedGetFullPath(
config, cmStateEnums::RuntimeBinaryArtifact);
- return location.c_str();
}
std::string cmGeneratorTarget::GetFullNameImported(
@@ -3363,8 +3606,9 @@ bool cmGeneratorTarget::StrictTargetComparison::operator()(
{
int nameResult = strcmp(t1->GetName().c_str(), t2->GetName().c_str());
if (nameResult == 0) {
- return strcmp(t1->GetLocalGenerator()->GetCurrentBinaryDirectory(),
- t2->GetLocalGenerator()->GetCurrentBinaryDirectory()) < 0;
+ return strcmp(
+ t1->GetLocalGenerator()->GetCurrentBinaryDirectory().c_str(),
+ t2->GetLocalGenerator()->GetCurrentBinaryDirectory().c_str()) < 0;
}
return nameResult < 0;
}
@@ -5317,7 +5561,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
this->GetName(), "LINK_LIBRARIES", nullptr, nullptr);
cmGeneratorExpression ge(*btIt);
std::unique_ptr<cmCompiledGeneratorExpression> const cge = ge.Parse(*le);
- std::string const evaluated =
+ std::string const& evaluated =
cge->Evaluate(this->LocalGenerator, config, false, head, &dagChecker);
cmSystemTools::ExpandListArgument(evaluated, llibs);
if (cge->GetHadHeadSensitiveCondition()) {
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 2132b15..1030d91 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -68,7 +68,10 @@ public:
std::string GetExportName() const;
std::vector<std::string> GetPropertyKeys() const;
+ ///! Might return a nullptr if the property is not set or invalid
const char* GetProperty(const std::string& prop) const;
+ ///! Always returns a valid pointer
+ const char* GetSafeProperty(const std::string& prop) const;
bool GetPropertyAsBool(const std::string& prop) const;
void GetSourceFiles(std::vector<cmSourceFile*>& files,
const std::string& config) const;
@@ -418,6 +421,17 @@ public:
const std::string& config,
const std::string& language) const;
+ void GetLinkOptions(std::vector<std::string>& result,
+ const std::string& config,
+ const std::string& language) const;
+ void GetStaticLibraryLinkOptions(std::vector<std::string>& result,
+ const std::string& config,
+ const std::string& language) const;
+
+ void GetLinkDepends(std::vector<std::string>& result,
+ const std::string& config,
+ const std::string& language) const;
+
bool IsSystemIncludeDirectory(const std::string& dir,
const std::string& config,
const std::string& language) const;
@@ -647,7 +661,7 @@ public:
no soname at all. */
bool IsImportedSharedLibWithoutSOName(const std::string& config) const;
- const char* ImportedGetLocation(const std::string& config) const;
+ std::string ImportedGetLocation(const std::string& config) const;
/** Get the target major and minor version numbers interpreted from
the VERSION property. Version 0 is returned if the property is
@@ -803,6 +817,7 @@ private:
std::vector<TargetPropertyEntry*> CompileOptionsEntries;
std::vector<TargetPropertyEntry*> CompileFeaturesEntries;
std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
+ std::vector<TargetPropertyEntry*> LinkOptionsEntries;
std::vector<TargetPropertyEntry*> SourceEntries;
mutable std::set<std::string> LinkImplicitNullProperties;
@@ -851,6 +866,7 @@ private:
mutable bool DebugCompileOptionsDone;
mutable bool DebugCompileFeaturesDone;
mutable bool DebugCompileDefinitionsDone;
+ mutable bool DebugLinkOptionsDone;
mutable bool DebugSourcesDone;
mutable bool LinkImplementationLanguageIsContextDependent;
mutable bool UtilityItemsDone;
diff --git a/Source/cmGlobVerificationManager.cxx b/Source/cmGlobVerificationManager.cxx
index e23b6ea..e8959f2 100644
--- a/Source/cmGlobVerificationManager.cxx
+++ b/Source/cmGlobVerificationManager.cxx
@@ -23,7 +23,7 @@ bool cmGlobVerificationManager::SaveVerificationScript(const std::string& path)
cmSystemTools::MakeDirectory(scriptFile);
scriptFile += "/VerifyGlobs.cmake";
stampFile += "/cmake.verify_globs";
- cmGeneratedFileStream verifyScriptFile(scriptFile.c_str());
+ cmGeneratedFileStream verifyScriptFile(scriptFile);
verifyScriptFile.SetCopyIfDifferent(true);
if (!verifyScriptFile) {
cmSystemTools::Error("Unable to open verification script file for save. ",
@@ -170,3 +170,10 @@ void cmGlobVerificationManager::AddCacheEntry(
value.Backtraces.emplace_back(variable, backtrace);
}
}
+
+void cmGlobVerificationManager::Reset()
+{
+ this->Cache.clear();
+ this->VerifyScript.clear();
+ this->VerifyStamp.clear();
+}
diff --git a/Source/cmGlobVerificationManager.h b/Source/cmGlobVerificationManager.h
index 4508602..cf04c97 100644
--- a/Source/cmGlobVerificationManager.h
+++ b/Source/cmGlobVerificationManager.h
@@ -37,6 +37,9 @@ protected:
const std::string& variable,
const cmListFileBacktrace& bt);
+ ///! Clear the glob cache for state reset.
+ void Reset();
+
///! Check targets should be written in generated build system.
bool DoWriteVerifyTarget() const;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 2872831..92ede7f 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -34,6 +34,7 @@
#include "cmMakefile.h"
#include "cmOutputConverter.h"
#include "cmPolicies.h"
+#include "cmQtAutoGen.h"
#include "cmQtAutoGenInitializer.h"
#include "cmSourceFile.h"
#include "cmState.h"
@@ -63,8 +64,8 @@ bool cmTarget::StrictTargetComparison::operator()(cmTarget const* t1,
{
int nameResult = strcmp(t1->GetName().c_str(), t2->GetName().c_str());
if (nameResult == 0) {
- return strcmp(t1->GetMakefile()->GetCurrentBinaryDirectory(),
- t2->GetMakefile()->GetCurrentBinaryDirectory()) < 0;
+ return strcmp(t1->GetMakefile()->GetCurrentBinaryDirectory().c_str(),
+ t2->GetMakefile()->GetCurrentBinaryDirectory().c_str()) < 0;
}
return nameResult < 0;
}
@@ -1313,14 +1314,10 @@ bool cmGlobalGenerator::Compute()
// so create the map from project name to vector of local generators
this->FillProjectMap();
-#ifdef CMAKE_BUILD_WITH_CMAKE
- // Iterate through all targets and set up automoc for those which have
- // the AUTOMOC, AUTOUIC or AUTORCC property set
- auto autogenInits = this->CreateQtAutoGenInitializers();
- for (auto& autoGen : autogenInits) {
- autoGen->InitCustomTargets();
+ // Iterate through all targets and set up AUTOMOC, AUTOUIC and AUTORCC
+ if (!this->QtAutoGen()) {
+ return false;
}
-#endif
// Add generator specific helper commands
for (cmLocalGenerator* localGen : this->LocalGenerators) {
@@ -1339,14 +1336,6 @@ bool cmGlobalGenerator::Compute()
}
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
- for (auto& autoGen : autogenInits) {
- autoGen->SetupCustomTargets();
- autoGen.reset(nullptr);
- }
- autogenInits.clear();
-#endif
-
for (cmLocalGenerator* localGen : this->LocalGenerators) {
cmMakefile* mf = localGen->GetMakefile();
for (cmInstallGenerator* g : mf->GetInstallGenerators()) {
@@ -1476,12 +1465,11 @@ bool cmGlobalGenerator::ComputeTargetDepends()
return true;
}
-std::vector<std::unique_ptr<cmQtAutoGenInitializer>>
-cmGlobalGenerator::CreateQtAutoGenInitializers()
+bool cmGlobalGenerator::QtAutoGen()
{
+#ifdef CMAKE_BUILD_WITH_CMAKE
std::vector<std::unique_ptr<cmQtAutoGenInitializer>> autogenInits;
-#ifdef CMAKE_BUILD_WITH_CMAKE
for (cmLocalGenerator* localGen : this->LocalGenerators) {
const std::vector<cmGeneratorTarget*>& targets =
localGen->GetGeneratorTargets();
@@ -1508,19 +1496,36 @@ cmGlobalGenerator::CreateQtAutoGenInitializers()
continue;
}
- std::string qtVersionMajor =
- cmQtAutoGenInitializer::GetQtMajorVersion(target);
+ auto qtVersion = cmQtAutoGenInitializer::GetQtVersion(target);
// don't do anything if there is no Qt4 or Qt5Core (which contains moc)
- if (qtVersionMajor != "4" && qtVersionMajor != "5") {
+ if (qtVersion.Major != 4 && qtVersion.Major != 5) {
continue;
}
- autogenInits.emplace_back(new cmQtAutoGenInitializer(
- target, mocEnabled, uicEnabled, rccEnabled, qtVersionMajor));
+ autogenInits.emplace_back(cm::make_unique<cmQtAutoGenInitializer>(
+ target, mocEnabled, uicEnabled, rccEnabled, qtVersion));
+ }
+ }
+
+ if (!autogenInits.empty()) {
+ // Initialize custom targets
+ for (auto& autoGen : autogenInits) {
+ if (!autoGen->InitCustomTargets()) {
+ return false;
+ }
+ }
+
+ // Setup custom targets
+ for (auto& autoGen : autogenInits) {
+ if (!autoGen->SetupCustomTargets()) {
+ return false;
+ }
+ autoGen.reset(nullptr);
}
}
#endif
- return autogenInits;
+
+ return true;
}
cmLinkLineComputer* cmGlobalGenerator::CreateLinkLineComputer(
@@ -1992,9 +1997,9 @@ void cmGlobalGenerator::AddMakefile(cmMakefile* mf)
this->CMakeInstance->UpdateProgress("Configuring", prog);
}
-void cmGlobalGenerator::AddInstallComponent(const char* component)
+void cmGlobalGenerator::AddInstallComponent(const std::string& component)
{
- if (component && *component) {
+ if (!component.empty()) {
this->InstallComponents.insert(component);
}
}
@@ -2886,7 +2891,7 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile,
std::string fpath = cmSystemTools::CollapseFullPath(fname, home.c_str());
if (cmSystemTools::FileExists(fpath)) {
RuleHash hash;
- strncpy(hash.Data, line.c_str(), 32);
+ memcpy(hash.Data, line.c_str(), 32);
this->RuleHashes[fname] = hash;
}
}
@@ -2899,7 +2904,7 @@ void cmGlobalGenerator::WriteRuleHashes(std::string const& pfile)
if (this->RuleHashes.empty()) {
cmSystemTools::RemoveFile(pfile);
} else {
- cmGeneratedFileStream fout(pfile.c_str());
+ cmGeneratedFileStream fout(pfile);
fout << "# Hashes of file build rules.\n";
for (auto const& rh : this->RuleHashes) {
fout.write(rh.second.Data, 32);
@@ -2914,7 +2919,7 @@ void cmGlobalGenerator::WriteSummary()
std::string fname = this->CMakeInstance->GetHomeOutputDirectory();
fname += cmake::GetCMakeFilesDirectory();
fname += "/TargetDirectories.txt";
- cmGeneratedFileStream fout(fname.c_str());
+ cmGeneratedFileStream fout(fname);
for (cmLocalGenerator* lg : this->LocalGenerators) {
const std::vector<cmGeneratorTarget*>& tgts = lg->GetGeneratorTargets();
@@ -2951,7 +2956,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
Json::Value& lj_sources = lj_root["sources"] = Json::arrayValue;
cmSystemTools::MakeDirectory(dir);
- cmGeneratedFileStream fout(file.c_str());
+ cmGeneratedFileStream fout(file);
std::vector<std::string> labels;
@@ -3025,7 +3030,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
}
}
}
- cmGeneratedFileStream json_fout(json_file.c_str());
+ cmGeneratedFileStream json_fout(json_file);
json_fout << lj_root;
} else
#endif
@@ -3100,7 +3105,7 @@ bool cmGlobalGenerator::GenerateCPackPropertiesFile()
return true;
}
- cmGeneratedFileStream file(path.c_str());
+ cmGeneratedFileStream file(path);
file << "# CPack properties\n";
for (auto const& i : installedFiles) {
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index a50cc3b..c06ac52 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -33,7 +33,6 @@ class cmLinkLineComputer;
class cmLocalGenerator;
class cmMakefile;
class cmOutputConverter;
-class cmQtAutoGenInitializer;
class cmSourceFile;
class cmStateDirectory;
class cmake;
@@ -220,7 +219,7 @@ public:
std::string GetExtraGeneratorName() const;
- void AddInstallComponent(const char* component);
+ void AddInstallComponent(const std::string& component);
const std::set<std::string>* GetInstallComponents() const
{
@@ -354,6 +353,8 @@ public:
i.e. "Can I build Debug and Release in the same tree?" */
virtual bool IsMultiConfig() const { return false; }
+ virtual bool IsXcode() const { return false; }
+
/** Return true if we know the exact location of object files.
If false, store the reason in the given string.
This is meaningful only after EnableLanguage has been called. */
@@ -441,9 +442,9 @@ protected:
virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const;
- // Qt auto generators
- std::vector<std::unique_ptr<cmQtAutoGenInitializer>>
- CreateQtAutoGenInitializers();
+ /// @brief Qt AUTOMOC/UIC/RCC target generation
+ /// @return true on success
+ bool QtAutoGen();
std::string SelectMakeProgram(const std::string& makeProgram,
const std::string& makeDefault = "") const;
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 0328991..a9742c5 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -14,13 +14,13 @@
#include "cmVersion.h"
const char* cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj";
-const char* cmGlobalGhsMultiGenerator::DEFAULT_MAKE_PROGRAM = "gbuild";
+const char* cmGlobalGhsMultiGenerator::DEFAULT_BUILD_PROGRAM = "gbuild.exe";
+const char* cmGlobalGhsMultiGenerator::DEFAULT_TOOLSET_ROOT = "C:/ghs";
cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator(cmake* cm)
: cmGlobalGenerator(cm)
, OSDirRelative(false)
{
- this->GhsBuildCommandInitialized = false;
}
cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator()
@@ -41,133 +41,153 @@ void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry& entry)
"Generates Green Hills MULTI files (experimental, work-in-progress).";
}
-void cmGlobalGhsMultiGenerator::EnableLanguage(
- std::vector<std::string> const& l, cmMakefile* mf, bool optional)
+bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
+ cmMakefile* mf)
{
- mf->AddDefinition("CMAKE_SYSTEM_NAME", "GHS-MULTI");
- mf->AddDefinition("CMAKE_SYSTEM_PROCESSOR", "ARM");
-
- const std::string ghsCompRoot(GetCompRoot());
- mf->AddDefinition("GHS_COMP_ROOT", ghsCompRoot.c_str());
- std::string ghsCompRootStart =
- 0 == ghsCompRootStart.size() ? "" : ghsCompRoot + "/";
- mf->AddDefinition("CMAKE_C_COMPILER",
- std::string(ghsCompRootStart + "ccarm.exe").c_str());
+ std::string tsp; /* toolset path */
+ std::string tsn = ts; /* toolset name */
+
+ GetToolset(mf, tsp, tsn);
+
+ /* no toolset was found */
+ if (tsn.empty()) {
+ return false;
+ } else if (ts.empty()) {
+ std::string message;
+ message =
+ "Green Hills MULTI: -T <toolset> not specified; defaulting to \"";
+ message += tsn;
+ message += "\"";
+ cmSystemTools::Message(message.c_str());
+
+ /* store the toolset for later use
+ * -- already done if -T<toolset> was specified
+ */
+ mf->AddCacheDefinition("CMAKE_GENERATOR_TOOLSET", tsn.c_str(),
+ "Name of generator toolset.",
+ cmStateEnums::INTERNAL);
+ }
+
+ /* set the build tool to use */
+ const char* prevTool = mf->GetDefinition("CMAKE_MAKE_PROGRAM");
+ std::string gbuild(tsp + "/" + tsn + "/" + DEFAULT_BUILD_PROGRAM);
+
+ /* check if the toolset changed from last generate */
+ if (prevTool != NULL && (gbuild != prevTool)) {
+ std::string message = "generator toolset: ";
+ message += gbuild;
+ message += "\nDoes not match the toolset used previously: ";
+ message += prevTool;
+ message += "\nEither remove the CMakeCache.txt file and CMakeFiles "
+ "directory or choose a different binary directory.";
+ cmSystemTools::Error(message.c_str());
+ } else {
+ /* store the toolset that is being used for this build */
+ mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", gbuild.c_str(),
+ "build program to use", cmStateEnums::INTERNAL,
+ true);
+ }
+
+ mf->AddDefinition("CMAKE_SYSTEM_VERSION", tsn.c_str());
+
+ // FIXME: compiler detection not implemented
+ // gbuild uses the primaryTarget setting in the top-level project
+ // file to determine which compiler to use. Because compiler
+ // detection is not implemented these variables must be
+ // set to skip past these tests. However cmake will verify that
+ // the executable pointed to by CMAKE_<LANG>_COMPILER exists.
+ // To pass this additional check gbuild is used as a place holder for the
+ // actual compiler.
+ mf->AddDefinition("CMAKE_C_COMPILER", gbuild.c_str());
mf->AddDefinition("CMAKE_C_COMPILER_ID_RUN", "TRUE");
mf->AddDefinition("CMAKE_C_COMPILER_ID", "GHS");
mf->AddDefinition("CMAKE_C_COMPILER_FORCED", "TRUE");
- mf->AddDefinition("CMAKE_CXX_COMPILER",
- std::string(ghsCompRootStart + "cxarm.exe").c_str());
+ mf->AddDefinition("CMAKE_CXX_COMPILER", gbuild.c_str());
mf->AddDefinition("CMAKE_CXX_COMPILER_ID_RUN", "TRUE");
mf->AddDefinition("CMAKE_CXX_COMPILER_ID", "GHS");
mf->AddDefinition("CMAKE_CXX_COMPILER_FORCED", "TRUE");
- if (!ghsCompRoot.empty()) {
- static const char* compPreFix = "comp_";
- std::string compFilename =
- cmsys::SystemTools::FindLastString(ghsCompRoot.c_str(), compPreFix);
- cmsys::SystemTools::ReplaceString(compFilename, compPreFix, "");
- mf->AddDefinition("CMAKE_SYSTEM_VERSION", compFilename.c_str());
- }
-
- mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files
- this->cmGlobalGenerator::EnableLanguage(l, mf, optional);
+ return true;
}
-bool cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile* mf)
+bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p,
+ cmMakefile* mf)
{
- // The GHS generator knows how to lookup its build tool
- // directly instead of needing a helper module to do it, so we
- // do not actually need to put CMAKE_MAKE_PROGRAM into the cache.
- if (cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) {
- mf->AddDefinition("CMAKE_MAKE_PROGRAM",
- this->GetGhsBuildCommand().c_str());
+ if (p == "") {
+ cmSystemTools::Message(
+ "Green Hills MULTI: -A <arch> not specified; defaulting to \"arm\"");
+ std::string arch = "arm";
+
+ /* store the platform name for later use
+ * -- already done if -A<arch> was specified
+ */
+ mf->AddCacheDefinition("CMAKE_GENERATOR_PLATFORM", arch.c_str(),
+ "Name of generator platform.",
+ cmStateEnums::INTERNAL);
}
- return true;
-}
-std::string const& cmGlobalGhsMultiGenerator::GetGhsBuildCommand()
-{
- if (!this->GhsBuildCommandInitialized) {
- this->GhsBuildCommandInitialized = true;
- this->GhsBuildCommand = this->FindGhsBuildCommand();
+ const char* tgtPlatform = mf->GetDefinition("GHS_TARGET_PLATFORM");
+ if (tgtPlatform == nullptr) {
+ tgtPlatform = "integrity";
}
- return this->GhsBuildCommand;
+
+ /* store the platform name for later use */
+ mf->AddCacheDefinition("GHS_TARGET_PLATFORM", tgtPlatform,
+ "Name of GHS target platform.",
+ cmStateEnums::INTERNAL);
+
+ return true;
}
-std::string cmGlobalGhsMultiGenerator::FindGhsBuildCommand()
+void cmGlobalGhsMultiGenerator::EnableLanguage(
+ std::vector<std::string> const& l, cmMakefile* mf, bool optional)
{
- std::vector<std::string> userPaths;
- userPaths.push_back(this->GetCompRoot());
- std::string makeProgram =
- cmSystemTools::FindProgram(DEFAULT_MAKE_PROGRAM, userPaths);
- if (makeProgram.empty()) {
- makeProgram = DEFAULT_MAKE_PROGRAM;
- }
- return makeProgram;
+ mf->AddDefinition("CMAKE_SYSTEM_NAME", "GHS-MULTI");
+
+ mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files
+ this->cmGlobalGenerator::EnableLanguage(l, mf, optional);
}
-std::string cmGlobalGhsMultiGenerator::GetCompRoot()
+bool cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile* /*mf*/)
{
- std::string output;
-
- const std::vector<std::string> potentialDirsHardPaths(
- GetCompRootHardPaths());
- const std::vector<std::string> potentialDirsRegistry(GetCompRootRegistry());
-
- std::vector<std::string> potentialDirsComplete;
- potentialDirsComplete.insert(potentialDirsComplete.end(),
- potentialDirsHardPaths.begin(),
- potentialDirsHardPaths.end());
- potentialDirsComplete.insert(potentialDirsComplete.end(),
- potentialDirsRegistry.begin(),
- potentialDirsRegistry.end());
-
- // Use latest version
- std::string outputDirName;
- for (std::vector<std::string>::const_iterator potentialDirsCompleteIt =
- potentialDirsComplete.begin();
- potentialDirsCompleteIt != potentialDirsComplete.end();
- ++potentialDirsCompleteIt) {
- const std::string dirName(
- cmsys::SystemTools::GetFilenameName(*potentialDirsCompleteIt));
- if (dirName.compare(outputDirName) > 0) {
- output = *potentialDirsCompleteIt;
- outputDirName = dirName;
- }
- }
+ // The GHS generator only knows how to lookup its build tool
+ // during generation of the project files, but this
+ // can only be done after the toolset is specified.
- return output;
+ return true;
}
-std::vector<std::string> cmGlobalGhsMultiGenerator::GetCompRootHardPaths()
+void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsd,
+ std::string& ts)
{
- std::vector<std::string> output;
- cmSystemTools::Glob("C:/ghs", "comp_[^;]+", output);
- for (std::vector<std::string>::iterator outputIt = output.begin();
- outputIt != output.end(); ++outputIt) {
- *outputIt = "C:/ghs/" + *outputIt;
+ const char* ghsRoot = mf->GetDefinition("GHS_TOOLSET_ROOT");
+
+ if (!ghsRoot) {
+ ghsRoot = DEFAULT_TOOLSET_ROOT;
}
- return output;
-}
+ tsd = ghsRoot;
-std::vector<std::string> cmGlobalGhsMultiGenerator::GetCompRootRegistry()
-{
- std::vector<std::string> output(2);
- cmsys::SystemTools::ReadRegistryValue(
- "HKEY_LOCAL_"
- "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\"
- "Windows\\CurrentVersion\\Uninstall\\"
- "GreenHillsSoftwared771f1b4;InstallLocation",
- output[0]);
- cmsys::SystemTools::ReadRegistryValue(
- "HKEY_LOCAL_"
- "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\"
- "Windows\\CurrentVersion\\Uninstall\\"
- "GreenHillsSoftware9881cef6;InstallLocation",
- output[1]);
- return output;
+ if (ts.empty()) {
+ std::vector<std::string> output;
+
+ // Use latest? version
+ cmSystemTools::Glob(tsd, "comp_[^;]+", output);
+
+ if (output.empty()) {
+ cmSystemTools::Error("GHS toolset not found in ", tsd.c_str());
+ ts = "";
+ } else {
+ ts = output.back();
+ }
+ } else {
+ std::string tryPath = tsd + std::string("/") + ts;
+ if (!cmSystemTools::FileExists(tryPath)) {
+ cmSystemTools::Error("GHS toolset \"", ts.c_str(), "\" not found in ",
+ tsd.c_str());
+ ts = "";
+ }
+ }
}
void cmGlobalGhsMultiGenerator::OpenBuildFileStream(
@@ -216,25 +236,28 @@ void cmGlobalGhsMultiGenerator::OpenBuildFileStream()
this->OSDirRelative = true;
}
- char const* bspName =
+ std::string bspName;
+ char const* bspCache =
this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME");
- if (NULL == bspName) {
- bspName = "";
- cmSystemTools::Error("GHS_BSP_NAME cache variable must be set");
- } else {
+ if (bspCache) {
+ bspName = bspCache;
this->GetCMakeInstance()->MarkCliAsUsed("GHS_BSP_NAME");
}
- std::string fBspName(this->trimQuotes(bspName));
- std::replace(fBspName.begin(), fBspName.end(), '\\', '/');
+ if (bspName.empty() || bspName.compare("IGNORE") == 0) {
+ const char* a =
+ this->GetCMakeInstance()->GetCacheDefinition("CMAKE_GENERATOR_PLATFORM");
+ bspName = "sim";
+ bspName += (a ? a : "");
+ }
+
this->WriteMacros();
this->WriteHighLevelDirectives();
GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, this->GetBuildFileStream());
this->WriteDisclaimer(this->GetBuildFileStream());
*this->GetBuildFileStream() << "# Top Level Project File" << std::endl;
- if (!fBspName.empty()) {
- *this->GetBuildFileStream() << " -bsp " << fBspName << std::endl;
- }
+ *this->GetBuildFileStream() << " -bsp " << bspName << std::endl;
+
this->WriteCompilerOptions(fOSDir);
}
@@ -275,8 +298,10 @@ void cmGlobalGhsMultiGenerator::GenerateBuildCommand(
const std::string& targetName, const std::string& /*config*/, bool /*fast*/,
int jobs, bool /*verbose*/, std::vector<std::string> const& makeOptions)
{
+ const char* gbuild =
+ this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
makeCommand.push_back(
- this->SelectMakeProgram(makeProgram, this->GetGhsBuildCommand()));
+ this->SelectMakeProgram(makeProgram, (std::string)gbuild));
if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) {
makeCommand.push_back("-parallel");
@@ -313,8 +338,26 @@ void cmGlobalGhsMultiGenerator::WriteMacros()
void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives()
{
- *this->GetBuildFileStream()
- << "primaryTarget=arm_integrity.tgt" << std::endl;
+ /* set primary target */
+ std::string tgt;
+ const char* t =
+ this->GetCMakeInstance()->GetCacheDefinition("GHS_PRIMARY_TARGET");
+ if (t) {
+ tgt = t;
+ this->GetCMakeInstance()->MarkCliAsUsed("GHS_PRIMARY_TARGET");
+ } else {
+ const char* a =
+ this->GetCMakeInstance()->GetCacheDefinition("CMAKE_GENERATOR_PLATFORM");
+ const char* p =
+ this->GetCMakeInstance()->GetCacheDefinition("GHS_TARGET_PLATFORM");
+ tgt = (a ? a : "");
+ tgt += "_";
+ tgt += (p ? p : "");
+ tgt += ".tgt";
+ }
+
+ *this->GetBuildFileStream() << "primaryTarget=" << tgt << std::endl;
+
char const* const customization =
this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION");
if (NULL != customization && strlen(customization) > 0) {
@@ -348,16 +391,14 @@ void cmGlobalGhsMultiGenerator::AddFilesUpToPath(
{
std::string workingPath(path);
cmSystemTools::ConvertToUnixSlashes(workingPath);
- std::vector<cmsys::String> splitPath =
- cmSystemTools::SplitString(workingPath);
+ std::vector<std::string> splitPath = cmSystemTools::SplitString(workingPath);
std::string workingRelPath(relPath);
cmSystemTools::ConvertToUnixSlashes(workingRelPath);
if (!workingRelPath.empty()) {
workingRelPath += "/";
}
std::string pathUpTo;
- for (std::vector<cmsys::String>::const_iterator splitPathI =
- splitPath.begin();
+ for (std::vector<std::string>::const_iterator splitPathI = splitPath.begin();
splitPath.end() != splitPathI; ++splitPathI) {
pathUpTo += *splitPathI;
if (targetFolderBuildStreams->end() ==
@@ -415,11 +456,11 @@ void cmGlobalGhsMultiGenerator::AddFilesUpToPathNewBuildFile(
void cmGlobalGhsMultiGenerator::AddFilesUpToPathAppendNextFile(
std::map<std::string, cmGeneratedFileStream*>* targetFolderBuildStreams,
std::string const& pathUpTo,
- std::vector<cmsys::String>::const_iterator splitPathI,
- std::vector<cmsys::String>::const_iterator end,
+ std::vector<std::string>::const_iterator splitPathI,
+ std::vector<std::string>::const_iterator end,
GhsMultiGpj::Types const projType)
{
- std::vector<cmsys::String>::const_iterator splitPathNextI = splitPathI + 1;
+ std::vector<std::string>::const_iterator splitPathNextI = splitPathI + 1;
if (end != splitPathNextI &&
targetFolderBuildStreams->end() ==
targetFolderBuildStreams->find(pathUpTo + "/" + *splitPathNextI)) {
@@ -436,7 +477,7 @@ std::string cmGlobalGhsMultiGenerator::GetFileNameFromPath(
std::string output(path);
if (!path.empty()) {
cmSystemTools::ConvertToUnixSlashes(output);
- std::vector<cmsys::String> splitPath = cmSystemTools::SplitString(output);
+ std::vector<std::string> splitPath = cmSystemTools::SplitString(output);
output += "/" + splitPath.back() + FILE_EXTENSION;
}
return output;
@@ -457,7 +498,7 @@ void cmGlobalGhsMultiGenerator::UpdateBuildFiles(
this->GetCMakeInstance()->GetHomeOutputDirectory().c_str(),
folderName, GhsMultiGpj::PROJECT);
}
- std::vector<cmsys::String> splitPath = cmSystemTools::SplitString(
+ std::vector<std::string> splitPath = cmSystemTools::SplitString(
cmGhsMultiTargetGenerator::GetRelBuildFileName(tgt));
std::string foldNameRelBuildFile(*(splitPath.end() - 2) + "/" +
splitPath.back());
diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h
index 30d4d3b..13c5113 100644
--- a/Source/cmGlobalGhsMultiGenerator.h
+++ b/Source/cmGlobalGhsMultiGenerator.h
@@ -40,13 +40,17 @@ public:
* Utilized by the generator factory to determine if this generator
* supports toolsets.
*/
- static bool SupportsToolset() { return false; }
+ static bool SupportsToolset() { return true; }
/**
* Utilized by the generator factory to determine if this generator
* supports platforms.
*/
- static bool SupportsPlatform() { return false; }
+ static bool SupportsPlatform() { return true; }
+
+ // Toolset / Platform Support
+ virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf);
+ virtual bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf);
/**
* Try to determine system information such as shared library
@@ -93,11 +97,7 @@ protected:
std::vector<std::string> const& makeOptions = std::vector<std::string>());
private:
- std::string const& GetGhsBuildCommand();
- std::string FindGhsBuildCommand();
- std::string GetCompRoot();
- std::vector<std::string> GetCompRootHardPaths();
- std::vector<std::string> GetCompRootRegistry();
+ void GetToolset(cmMakefile* mf, std::string& tsd, std::string& ts);
void OpenBuildFileStream();
void WriteMacros();
@@ -112,9 +112,8 @@ private:
static void AddFilesUpToPathAppendNextFile(
std::map<std::string, cmGeneratedFileStream*>* targetFolderBuildStreams,
std::string const& pathUpTo,
- std::vector<cmsys::String>::const_iterator splitPathI,
- std::vector<cmsys::String>::const_iterator end,
- GhsMultiGpj::Types projType);
+ std::vector<std::string>::const_iterator splitPathI,
+ std::vector<std::string>::const_iterator end, GhsMultiGpj::Types projType);
static std::string GetFileNameFromPath(std::string const& path);
void UpdateBuildFiles(const std::vector<cmGeneratorTarget*>& tgts);
bool IsTgtForBuild(const cmGeneratorTarget* tgt);
@@ -125,9 +124,8 @@ private:
std::vector<std::string> LibDirs;
bool OSDirRelative;
- bool GhsBuildCommandInitialized;
- std::string GhsBuildCommand;
- static const char* DEFAULT_MAKE_PROGRAM;
+ static const char* DEFAULT_BUILD_PROGRAM;
+ static const char* DEFAULT_TOOLSET_ROOT;
};
#endif
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 6f7e82a..0c80910 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -763,7 +763,7 @@ void cmGlobalNinjaGenerator::OpenBuildFileStream()
// Get a stream where to generate things.
if (!this->BuildFileStream) {
this->BuildFileStream = new cmGeneratedFileStream(
- buildFilePath.c_str(), false, this->GetMakefileEncoding());
+ buildFilePath, false, this->GetMakefileEncoding());
if (!this->BuildFileStream) {
// An error message is generated by the constructor if it cannot
// open the file.
@@ -801,7 +801,7 @@ void cmGlobalNinjaGenerator::OpenRulesFileStream()
// Get a stream where to generate things.
if (!this->RulesFileStream) {
this->RulesFileStream = new cmGeneratedFileStream(
- rulesFilePath.c_str(), false, this->GetMakefileEncoding());
+ rulesFilePath, false, this->GetMakefileEncoding());
if (!this->RulesFileStream) {
// An error message is generated by the constructor if it cannot
// open the file.
@@ -883,8 +883,7 @@ void cmGlobalNinjaGenerator::AddCXXCompileCommand(
}
// Get a stream where to generate things.
- this->CompileCommandsStream =
- new cmGeneratedFileStream(buildFilePath.c_str());
+ this->CompileCommandsStream = new cmGeneratedFileStream(buildFilePath);
*this->CompileCommandsStream << "[";
} else {
*this->CompileCommandsStream << "," << std::endl;
@@ -1012,8 +1011,7 @@ void cmGlobalNinjaGenerator::AppendTargetDepends(
std::set<std::string> const& utils = target->GetUtilities();
for (std::string const& util : utils) {
std::string d =
- target->GetLocalGenerator()->GetCurrentBinaryDirectory() +
- std::string("/") + util;
+ target->GetLocalGenerator()->GetCurrentBinaryDirectory() + "/" + util;
outputs.push_back(this->ConvertToNinjaPath(d));
}
} else {
@@ -1112,6 +1110,12 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os)
continue;
}
+ // Don't write alias if there is a already a custom command with
+ // matching output
+ if (this->HasCustomCommandOutput(ta.first)) {
+ continue;
+ }
+
cmNinjaDeps deps;
this->AppendTargetOutputs(ta.second, deps);
@@ -1700,7 +1704,7 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg,
}
{
- cmGeneratedFileStream depfile(arg_dep.c_str());
+ cmGeneratedFileStream depfile(arg_dep);
depfile << cmSystemTools::ConvertToUnixOutputPath(arg_pp) << ":";
for (std::string const& include : info.Includes) {
depfile << " \\\n " << cmSystemTools::ConvertToUnixOutputPath(include);
@@ -1723,7 +1727,7 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg,
}
}
- cmGeneratedFileStream ddif(arg_ddi.c_str());
+ cmGeneratedFileStream ddif(arg_ddi);
ddif << ddi;
if (!ddif) {
cmSystemTools::Error("-E cmake_ninja_depends failed to write ",
@@ -1827,7 +1831,7 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
}
}
- cmGeneratedFileStream ddf(arg_dd.c_str());
+ cmGeneratedFileStream ddf(arg_dd);
ddf << "ninja_dyndep_version = 1.0\n";
for (cmFortranObjectInfo const& object : objects) {
@@ -1862,7 +1866,7 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
// use by dependents that reference this target in linked-target-dirs.
std::string const target_mods_file =
cmSystemTools::GetFilenamePath(arg_dd) + "/FortranModules.json";
- cmGeneratedFileStream tmf(target_mods_file.c_str());
+ cmGeneratedFileStream tmf(target_mods_file);
tmf << tm;
return true;
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 61c42be..db72353 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -147,7 +147,7 @@ void cmGlobalUnixMakefileGenerator3::Generate()
markFileName += "/";
markFileName += cmake::GetCMakeFilesDirectory();
markFileName += "/progress.marks";
- cmGeneratedFileStream markFile(markFileName.c_str());
+ cmGeneratedFileStream markFile(markFileName);
markFile << this->CountProgressMarksInAll(lg) << "\n";
}
@@ -170,8 +170,7 @@ void cmGlobalUnixMakefileGenerator3::AddCXXCompileCommand(
std::string commandDatabaseName =
std::string(this->GetCMakeInstance()->GetHomeOutputDirectory()) +
"/compile_commands.json";
- this->CommandDatabase =
- new cmGeneratedFileStream(commandDatabaseName.c_str());
+ this->CommandDatabase = new cmGeneratedFileStream(commandDatabaseName);
*this->CommandDatabase << "[" << std::endl;
} else {
*this->CommandDatabase << "," << std::endl;
@@ -198,7 +197,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2()
this->GetCMakeInstance()->GetHomeOutputDirectory();
makefileName += cmake::GetCMakeFilesDirectory();
makefileName += "/Makefile2";
- cmGeneratedFileStream makefileStream(makefileName.c_str(), false,
+ cmGeneratedFileStream makefileStream(makefileName, false,
this->GetMakefileEncoding());
if (!makefileStream) {
return;
@@ -270,7 +269,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
this->GetCMakeInstance()->GetHomeOutputDirectory();
cmakefileName += cmake::GetCMakeFilesDirectory();
cmakefileName += "/Makefile.cmake";
- cmGeneratedFileStream cmakefileStream(cmakefileName.c_str());
+ cmGeneratedFileStream cmakefileStream(cmakefileName);
if (!cmakefileStream) {
return;
}
@@ -876,7 +875,7 @@ void cmGlobalUnixMakefileGenerator3::RecordTargetProgress(
void cmGlobalUnixMakefileGenerator3::TargetProgress::WriteProgressVariables(
unsigned long total, unsigned long& current)
{
- cmGeneratedFileStream fout(this->VariableFile.c_str());
+ cmGeneratedFileStream fout(this->VariableFile);
for (unsigned long i = 1; i <= this->NumberOfActions; ++i) {
fout << "CMAKE_PROGRESS_" << i << " = ";
if (total <= 100) {
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index a5709d5..5ea323a 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -1014,7 +1014,7 @@ void cmGlobalVisualStudio10Generator::PathTooLong(cmGeneratorTarget* target,
std::string const& sfRel)
{
size_t len =
- (strlen(target->GetLocalGenerator()->GetCurrentBinaryDirectory()) + 1 +
+ (target->GetLocalGenerator()->GetCurrentBinaryDirectory().length() + 1 +
sfRel.length());
if (len > this->LongestSource.Length) {
this->LongestSource.Length = len;
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 158f484..28cbdc7 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -397,12 +397,12 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
if (written && this->UseFolderProperty()) {
const std::string targetFolder = target->GetEffectiveFolderName();
if (!targetFolder.empty()) {
- std::vector<cmsys::String> tokens =
+ std::vector<std::string> tokens =
cmSystemTools::SplitString(targetFolder, '/', false);
std::string cumulativePath;
- for (cmsys::String const& iter : tokens) {
+ for (std::string const& iter : tokens) {
if (!iter.size()) {
continue;
}
@@ -679,7 +679,7 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
std::unique_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(propertyValue);
if (cmSystemTools::IsOn(
- cge->Evaluate(target->GetLocalGenerator(), i))) {
+ cge->Evaluate(target->GetLocalGenerator(), i).c_str())) {
activeConfigs.insert(i);
}
}
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index e9a08bf..7456d3c 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -386,12 +386,46 @@ void cmGlobalXCodeGenerator::AddExtraIDETargets()
}
}
+void cmGlobalXCodeGenerator::ComputeTargetOrder()
+{
+ size_t index = 0;
+ auto const& lgens = this->GetLocalGenerators();
+ for (cmLocalGenerator* lgen : lgens) {
+ auto const& targets = lgen->GetGeneratorTargets();
+ for (cmGeneratorTarget const* gt : targets) {
+ this->ComputeTargetOrder(gt, index);
+ }
+ }
+ assert(index == this->TargetOrderIndex.size());
+}
+
+void cmGlobalXCodeGenerator::ComputeTargetOrder(cmGeneratorTarget const* gt,
+ size_t& index)
+{
+ std::map<cmGeneratorTarget const*, size_t>::value_type value(gt, 0);
+ auto insertion = this->TargetOrderIndex.insert(value);
+ if (!insertion.second) {
+ return;
+ }
+ auto entry = insertion.first;
+
+ auto& deps = this->GetTargetDirectDepends(gt);
+ for (auto& d : deps) {
+ this->ComputeTargetOrder(d, index);
+ }
+
+ entry->second = index++;
+}
+
void cmGlobalXCodeGenerator::Generate()
{
this->cmGlobalGenerator::Generate();
if (cmSystemTools::GetErrorOccuredFlag()) {
return;
}
+
+ this->ComputeTargetOrder();
+
for (auto keyVal : this->ProjectMap) {
cmLocalGenerator* root = keyVal.second[0];
@@ -728,9 +762,10 @@ public:
using cmGeneratorExpressionInterpreter::Evaluate;
- const char* Evaluate(const char* expression, const std::string& property)
+ const std::string& Evaluate(const char* expression,
+ const std::string& property)
{
- const char* processed =
+ const std::string& processed =
this->cmGeneratorExpressionInterpreter::Evaluate(expression, property);
if (this->GetCompiledGeneratorExpression()
.GetHadContextSensitiveCondition()) {
@@ -787,7 +822,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
const std::string COMPILE_DEFINITIONS("COMPILE_DEFINITIONS");
if (const char* compile_defs = sf->GetProperty(COMPILE_DEFINITIONS)) {
this->AppendDefines(
- flagsBuild, genexInterpreter.Evaluate(compile_defs, COMPILE_DEFINITIONS),
+ flagsBuild,
+ genexInterpreter.Evaluate(compile_defs, COMPILE_DEFINITIONS).c_str(),
true);
}
if (!flagsBuild.IsEmpty()) {
@@ -1031,15 +1067,17 @@ struct cmSourceFilePathCompare
struct cmCompareTargets
{
- bool operator()(std::string const& a, std::string const& b) const
+ bool operator()(cmXCodeObject* l, cmXCodeObject* r) const
{
+ std::string const& a = l->GetTarget()->GetName();
+ std::string const& b = r->GetTarget()->GetName();
if (a == "ALL_BUILD") {
return true;
}
if (b == "ALL_BUILD") {
return false;
}
- return strcmp(a.c_str(), b.c_str()) < 0;
+ return a < b;
}
};
@@ -1047,274 +1085,279 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
cmLocalGenerator* gen, std::vector<cmXCodeObject*>& targets)
{
this->SetCurrentLocalGenerator(gen);
- typedef std::map<std::string, cmGeneratorTarget*, cmCompareTargets>
- cmSortedTargets;
- cmSortedTargets sortedTargets;
- for (auto tgt : this->CurrentLocalGenerator->GetGeneratorTargets()) {
- sortedTargets[tgt->GetName()] = tgt;
+ std::vector<cmGeneratorTarget*> gts =
+ this->CurrentLocalGenerator->GetGeneratorTargets();
+ std::sort(gts.begin(), gts.end(),
+ [this](cmGeneratorTarget const* l, cmGeneratorTarget const* r) {
+ return this->TargetOrderIndex[l] < this->TargetOrderIndex[r];
+ });
+ for (auto gtgt : gts) {
+ if (!this->CreateXCodeTarget(gtgt, targets)) {
+ return false;
+ }
}
- for (auto& sortedTarget : sortedTargets) {
- cmGeneratorTarget* gtgt = sortedTarget.second;
-
- std::string targetName = gtgt->GetName();
+ std::sort(targets.begin(), targets.end(), cmCompareTargets());
+ return true;
+}
- // make sure ALL_BUILD, INSTALL, etc are only done once
- if (this->SpecialTargetEmitted(targetName)) {
- continue;
- }
+bool cmGlobalXCodeGenerator::CreateXCodeTarget(
+ cmGeneratorTarget* gtgt, std::vector<cmXCodeObject*>& targets)
+{
+ std::string targetName = gtgt->GetName();
- if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
- continue;
- }
+ // make sure ALL_BUILD, INSTALL, etc are only done once
+ if (this->SpecialTargetEmitted(targetName)) {
+ return true;
+ }
- if (gtgt->GetType() == cmStateEnums::UTILITY ||
- gtgt->GetType() == cmStateEnums::GLOBAL_TARGET) {
- cmXCodeObject* t = this->CreateUtilityTarget(gtgt);
- if (!t) {
- return false;
- }
- targets.push_back(t);
- continue;
- }
+ if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
+ return true;
+ }
- // organize the sources
- std::vector<cmSourceFile*> classes;
- if (!gtgt->GetConfigCommonSourceFiles(classes)) {
+ if (gtgt->GetType() == cmStateEnums::UTILITY ||
+ gtgt->GetType() == cmStateEnums::GLOBAL_TARGET) {
+ cmXCodeObject* t = this->CreateUtilityTarget(gtgt);
+ if (!t) {
return false;
}
+ targets.push_back(t);
+ return true;
+ }
- // Add CMakeLists.txt file for user convenience.
- this->AddXCodeProjBuildRule(gtgt, classes);
+ // organize the sources
+ std::vector<cmSourceFile*> classes;
+ if (!gtgt->GetConfigCommonSourceFiles(classes)) {
+ return false;
+ }
- std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare());
+ // Add CMakeLists.txt file for user convenience.
+ this->AddXCodeProjBuildRule(gtgt, classes);
- gtgt->ComputeObjectMapping();
+ std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare());
- std::vector<cmXCodeObject*> externalObjFiles;
- std::vector<cmXCodeObject*> headerFiles;
- std::vector<cmXCodeObject*> resourceFiles;
- std::vector<cmXCodeObject*> sourceFiles;
- for (auto sourceFile : classes) {
- cmXCodeObject* xsf = this->CreateXCodeSourceFile(
- this->CurrentLocalGenerator, sourceFile, gtgt);
- cmXCodeObject* fr = xsf->GetObject("fileRef");
- cmXCodeObject* filetype = fr->GetObject()->GetObject("explicitFileType");
+ gtgt->ComputeObjectMapping();
- cmGeneratorTarget::SourceFileFlags tsFlags =
- gtgt->GetTargetSourceFileFlags(sourceFile);
+ std::vector<cmXCodeObject*> externalObjFiles;
+ std::vector<cmXCodeObject*> headerFiles;
+ std::vector<cmXCodeObject*> resourceFiles;
+ std::vector<cmXCodeObject*> sourceFiles;
+ for (auto sourceFile : classes) {
+ cmXCodeObject* xsf = this->CreateXCodeSourceFile(
+ this->CurrentLocalGenerator, sourceFile, gtgt);
+ cmXCodeObject* fr = xsf->GetObject("fileRef");
+ cmXCodeObject* filetype = fr->GetObject()->GetObject("explicitFileType");
- if (filetype && filetype->GetString() == "compiled.mach-o.objfile") {
- if (sourceFile->GetObjectLibrary().empty()) {
- externalObjFiles.push_back(xsf);
- }
- } else if (this->IsHeaderFile(sourceFile) ||
- (tsFlags.Type ==
- cmGeneratorTarget::SourceFileTypePrivateHeader) ||
- (tsFlags.Type ==
- cmGeneratorTarget::SourceFileTypePublicHeader)) {
- headerFiles.push_back(xsf);
- } else if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource) {
- resourceFiles.push_back(xsf);
- } else if (!sourceFile->GetPropertyAsBool("HEADER_FILE_ONLY")) {
- // Include this file in the build if it has a known language
- // and has not been listed as an ignored extension for this
- // generator.
- if (!this->CurrentLocalGenerator->GetSourceFileLanguage(*sourceFile)
- .empty() &&
- !this->IgnoreFile(sourceFile->GetExtension().c_str())) {
- sourceFiles.push_back(xsf);
- }
- }
- }
+ cmGeneratorTarget::SourceFileFlags tsFlags =
+ gtgt->GetTargetSourceFileFlags(sourceFile);
- if (this->XcodeVersion < 50) {
- // Add object library contents as external objects. (Equivalent to
- // the externalObjFiles above, except each one is not a cmSourceFile
- // within the target.)
- std::vector<cmSourceFile const*> objs;
- gtgt->GetExternalObjects(objs, "");
- for (auto sourceFile : objs) {
- if (sourceFile->GetObjectLibrary().empty()) {
- continue;
- }
- std::string const& obj = sourceFile->GetFullPath();
- cmXCodeObject* xsf =
- this->CreateXCodeSourceFileFromPath(obj, gtgt, "", nullptr);
+ if (filetype && filetype->GetString() == "compiled.mach-o.objfile") {
+ if (sourceFile->GetObjectLibrary().empty()) {
externalObjFiles.push_back(xsf);
}
- }
-
- // some build phases only apply to bundles and/or frameworks
- bool isFrameworkTarget = gtgt->IsFrameworkOnApple();
- bool isBundleTarget = gtgt->GetPropertyAsBool("MACOSX_BUNDLE");
- bool isCFBundleTarget = gtgt->IsCFBundleOnApple();
-
- cmXCodeObject* buildFiles = nullptr;
-
- // create source build phase
- cmXCodeObject* sourceBuildPhase = nullptr;
- if (!sourceFiles.empty()) {
- sourceBuildPhase =
- this->CreateObject(cmXCodeObject::PBXSourcesBuildPhase);
- sourceBuildPhase->SetComment("Sources");
- sourceBuildPhase->AddAttribute("buildActionMask",
- this->CreateString("2147483647"));
- buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
- for (auto& sourceFile : sourceFiles) {
- buildFiles->AddObject(sourceFile);
+ } else if (this->IsHeaderFile(sourceFile) ||
+ (tsFlags.Type ==
+ cmGeneratorTarget::SourceFileTypePrivateHeader) ||
+ (tsFlags.Type ==
+ cmGeneratorTarget::SourceFileTypePublicHeader)) {
+ headerFiles.push_back(xsf);
+ } else if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource) {
+ resourceFiles.push_back(xsf);
+ } else if (!sourceFile->GetPropertyAsBool("HEADER_FILE_ONLY")) {
+ // Include this file in the build if it has a known language
+ // and has not been listed as an ignored extension for this
+ // generator.
+ if (!this->CurrentLocalGenerator->GetSourceFileLanguage(*sourceFile)
+ .empty() &&
+ !this->IgnoreFile(sourceFile->GetExtension().c_str())) {
+ sourceFiles.push_back(xsf);
}
- sourceBuildPhase->AddAttribute("files", buildFiles);
- sourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
- this->CreateString("0"));
}
+ }
- // create header build phase - only for framework targets
- cmXCodeObject* headerBuildPhase = nullptr;
- if (!headerFiles.empty() && isFrameworkTarget) {
- headerBuildPhase =
- this->CreateObject(cmXCodeObject::PBXHeadersBuildPhase);
- headerBuildPhase->SetComment("Headers");
- headerBuildPhase->AddAttribute("buildActionMask",
- this->CreateString("2147483647"));
- buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
- for (auto& headerFile : headerFiles) {
- buildFiles->AddObject(headerFile);
+ if (this->XcodeVersion < 50) {
+ // Add object library contents as external objects. (Equivalent to
+ // the externalObjFiles above, except each one is not a cmSourceFile
+ // within the target.)
+ std::vector<cmSourceFile const*> objs;
+ gtgt->GetExternalObjects(objs, "");
+ for (auto sourceFile : objs) {
+ if (sourceFile->GetObjectLibrary().empty()) {
+ continue;
}
- headerBuildPhase->AddAttribute("files", buildFiles);
- headerBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
- this->CreateString("0"));
+ std::string const& obj = sourceFile->GetFullPath();
+ cmXCodeObject* xsf =
+ this->CreateXCodeSourceFileFromPath(obj, gtgt, "", nullptr);
+ externalObjFiles.push_back(xsf);
+ }
+ }
+
+ // some build phases only apply to bundles and/or frameworks
+ bool isFrameworkTarget = gtgt->IsFrameworkOnApple();
+ bool isBundleTarget = gtgt->GetPropertyAsBool("MACOSX_BUNDLE");
+ bool isCFBundleTarget = gtgt->IsCFBundleOnApple();
+
+ cmXCodeObject* buildFiles = nullptr;
+
+ // create source build phase
+ cmXCodeObject* sourceBuildPhase = nullptr;
+ if (!sourceFiles.empty()) {
+ sourceBuildPhase = this->CreateObject(cmXCodeObject::PBXSourcesBuildPhase);
+ sourceBuildPhase->SetComment("Sources");
+ sourceBuildPhase->AddAttribute("buildActionMask",
+ this->CreateString("2147483647"));
+ buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
+ for (auto& sourceFile : sourceFiles) {
+ buildFiles->AddObject(sourceFile);
+ }
+ sourceBuildPhase->AddAttribute("files", buildFiles);
+ sourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
+ this->CreateString("0"));
+ }
+
+ // create header build phase - only for framework targets
+ cmXCodeObject* headerBuildPhase = nullptr;
+ if (!headerFiles.empty() && isFrameworkTarget) {
+ headerBuildPhase = this->CreateObject(cmXCodeObject::PBXHeadersBuildPhase);
+ headerBuildPhase->SetComment("Headers");
+ headerBuildPhase->AddAttribute("buildActionMask",
+ this->CreateString("2147483647"));
+ buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
+ for (auto& headerFile : headerFiles) {
+ buildFiles->AddObject(headerFile);
+ }
+ headerBuildPhase->AddAttribute("files", buildFiles);
+ headerBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
+ this->CreateString("0"));
+ }
+
+ // create resource build phase - only for framework or bundle targets
+ cmXCodeObject* resourceBuildPhase = nullptr;
+ if (!resourceFiles.empty() &&
+ (isFrameworkTarget || isBundleTarget || isCFBundleTarget)) {
+ resourceBuildPhase =
+ this->CreateObject(cmXCodeObject::PBXResourcesBuildPhase);
+ resourceBuildPhase->SetComment("Resources");
+ resourceBuildPhase->AddAttribute("buildActionMask",
+ this->CreateString("2147483647"));
+ buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
+ for (auto& resourceFile : resourceFiles) {
+ buildFiles->AddObject(resourceFile);
}
+ resourceBuildPhase->AddAttribute("files", buildFiles);
+ resourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
+ this->CreateString("0"));
+ }
- // create resource build phase - only for framework or bundle targets
- cmXCodeObject* resourceBuildPhase = nullptr;
- if (!resourceFiles.empty() &&
- (isFrameworkTarget || isBundleTarget || isCFBundleTarget)) {
- resourceBuildPhase =
- this->CreateObject(cmXCodeObject::PBXResourcesBuildPhase);
- resourceBuildPhase->SetComment("Resources");
- resourceBuildPhase->AddAttribute("buildActionMask",
- this->CreateString("2147483647"));
- buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
- for (auto& resourceFile : resourceFiles) {
- buildFiles->AddObject(resourceFile);
- }
- resourceBuildPhase->AddAttribute("files", buildFiles);
- resourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
- this->CreateString("0"));
- }
-
- // create vector of "non-resource content file" build phases - only for
- // framework or bundle targets
- std::vector<cmXCodeObject*> contentBuildPhases;
- if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) {
- typedef std::map<std::string, std::vector<cmSourceFile*>>
- mapOfVectorOfSourceFiles;
- mapOfVectorOfSourceFiles bundleFiles;
- for (auto sourceFile : classes) {
- cmGeneratorTarget::SourceFileFlags tsFlags =
- gtgt->GetTargetSourceFileFlags(sourceFile);
- if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeMacContent) {
- bundleFiles[tsFlags.MacFolder].push_back(sourceFile);
- }
+ // create vector of "non-resource content file" build phases - only for
+ // framework or bundle targets
+ std::vector<cmXCodeObject*> contentBuildPhases;
+ if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) {
+ typedef std::map<std::string, std::vector<cmSourceFile*>>
+ mapOfVectorOfSourceFiles;
+ mapOfVectorOfSourceFiles bundleFiles;
+ for (auto sourceFile : classes) {
+ cmGeneratorTarget::SourceFileFlags tsFlags =
+ gtgt->GetTargetSourceFileFlags(sourceFile);
+ if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeMacContent) {
+ bundleFiles[tsFlags.MacFolder].push_back(sourceFile);
}
- for (auto keySources : bundleFiles) {
- cmXCodeObject* copyFilesBuildPhase =
- this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase);
- copyFilesBuildPhase->SetComment("Copy files");
- copyFilesBuildPhase->AddAttribute("buildActionMask",
- this->CreateString("2147483647"));
- copyFilesBuildPhase->AddAttribute("dstSubfolderSpec",
- this->CreateString("6"));
- std::ostringstream ostr;
- if (gtgt->IsFrameworkOnApple()) {
- // dstPath in frameworks is relative to Versions/<version>
+ }
+ for (auto keySources : bundleFiles) {
+ cmXCodeObject* copyFilesBuildPhase =
+ this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase);
+ copyFilesBuildPhase->SetComment("Copy files");
+ copyFilesBuildPhase->AddAttribute("buildActionMask",
+ this->CreateString("2147483647"));
+ copyFilesBuildPhase->AddAttribute("dstSubfolderSpec",
+ this->CreateString("6"));
+ std::ostringstream ostr;
+ if (gtgt->IsFrameworkOnApple()) {
+ // dstPath in frameworks is relative to Versions/<version>
+ ostr << keySources.first;
+ } else if (keySources.first != "MacOS") {
+ if (gtgt->Target->GetMakefile()->PlatformIsAppleEmbedded()) {
ostr << keySources.first;
- } else if (keySources.first != "MacOS") {
- if (gtgt->Target->GetMakefile()->PlatformIsAppleEmbedded()) {
- ostr << keySources.first;
- } else {
- // dstPath in bundles is relative to Contents/MacOS
- ostr << "../" << keySources.first;
- }
- }
- copyFilesBuildPhase->AddAttribute("dstPath",
- this->CreateString(ostr.str()));
- copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
- this->CreateString("0"));
- buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
- copyFilesBuildPhase->AddAttribute("files", buildFiles);
- for (auto sourceFile : keySources.second) {
- cmXCodeObject* xsf = this->CreateXCodeSourceFile(
- this->CurrentLocalGenerator, sourceFile, gtgt);
- buildFiles->AddObject(xsf);
+ } else {
+ // dstPath in bundles is relative to Contents/MacOS
+ ostr << "../" << keySources.first;
}
- contentBuildPhases.push_back(copyFilesBuildPhase);
}
+ copyFilesBuildPhase->AddAttribute("dstPath",
+ this->CreateString(ostr.str()));
+ copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
+ this->CreateString("0"));
+ buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
+ copyFilesBuildPhase->AddAttribute("files", buildFiles);
+ for (auto sourceFile : keySources.second) {
+ cmXCodeObject* xsf = this->CreateXCodeSourceFile(
+ this->CurrentLocalGenerator, sourceFile, gtgt);
+ buildFiles->AddObject(xsf);
+ }
+ contentBuildPhases.push_back(copyFilesBuildPhase);
}
+ }
- // create vector of "resource content file" build phases - only for
- // framework or bundle targets
- if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) {
- typedef std::map<std::string, std::vector<cmSourceFile*>>
- mapOfVectorOfSourceFiles;
- mapOfVectorOfSourceFiles bundleFiles;
- for (auto sourceFile : classes) {
- cmGeneratorTarget::SourceFileFlags tsFlags =
- gtgt->GetTargetSourceFileFlags(sourceFile);
- if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeDeepResource) {
- bundleFiles[tsFlags.MacFolder].push_back(sourceFile);
- }
- }
- for (auto keySources : bundleFiles) {
- cmXCodeObject* copyFilesBuildPhase =
- this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase);
- copyFilesBuildPhase->SetComment("Copy files");
- copyFilesBuildPhase->AddAttribute("buildActionMask",
- this->CreateString("2147483647"));
- copyFilesBuildPhase->AddAttribute("dstSubfolderSpec",
- this->CreateString("7"));
- copyFilesBuildPhase->AddAttribute(
- "dstPath", this->CreateString(keySources.first));
- copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
- this->CreateString("0"));
- buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
- copyFilesBuildPhase->AddAttribute("files", buildFiles);
- for (auto sourceFile : keySources.second) {
- cmXCodeObject* xsf = this->CreateXCodeSourceFile(
- this->CurrentLocalGenerator, sourceFile, gtgt);
- buildFiles->AddObject(xsf);
- }
- contentBuildPhases.push_back(copyFilesBuildPhase);
+ // create vector of "resource content file" build phases - only for
+ // framework or bundle targets
+ if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) {
+ typedef std::map<std::string, std::vector<cmSourceFile*>>
+ mapOfVectorOfSourceFiles;
+ mapOfVectorOfSourceFiles bundleFiles;
+ for (auto sourceFile : classes) {
+ cmGeneratorTarget::SourceFileFlags tsFlags =
+ gtgt->GetTargetSourceFileFlags(sourceFile);
+ if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeDeepResource) {
+ bundleFiles[tsFlags.MacFolder].push_back(sourceFile);
}
}
-
- // create framework build phase
- cmXCodeObject* frameworkBuildPhase = nullptr;
- if (!externalObjFiles.empty()) {
- frameworkBuildPhase =
- this->CreateObject(cmXCodeObject::PBXFrameworksBuildPhase);
- frameworkBuildPhase->SetComment("Frameworks");
- frameworkBuildPhase->AddAttribute("buildActionMask",
+ for (auto keySources : bundleFiles) {
+ cmXCodeObject* copyFilesBuildPhase =
+ this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase);
+ copyFilesBuildPhase->SetComment("Copy files");
+ copyFilesBuildPhase->AddAttribute("buildActionMask",
this->CreateString("2147483647"));
+ copyFilesBuildPhase->AddAttribute("dstSubfolderSpec",
+ this->CreateString("7"));
+ copyFilesBuildPhase->AddAttribute("dstPath",
+ this->CreateString(keySources.first));
+ copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
+ this->CreateString("0"));
buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
- frameworkBuildPhase->AddAttribute("files", buildFiles);
- for (auto& externalObjFile : externalObjFiles) {
- buildFiles->AddObject(externalObjFile);
+ copyFilesBuildPhase->AddAttribute("files", buildFiles);
+ for (auto sourceFile : keySources.second) {
+ cmXCodeObject* xsf = this->CreateXCodeSourceFile(
+ this->CurrentLocalGenerator, sourceFile, gtgt);
+ buildFiles->AddObject(xsf);
}
- frameworkBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
- this->CreateString("0"));
+ contentBuildPhases.push_back(copyFilesBuildPhase);
+ }
+ }
+
+ // create framework build phase
+ cmXCodeObject* frameworkBuildPhase = nullptr;
+ if (!externalObjFiles.empty()) {
+ frameworkBuildPhase =
+ this->CreateObject(cmXCodeObject::PBXFrameworksBuildPhase);
+ frameworkBuildPhase->SetComment("Frameworks");
+ frameworkBuildPhase->AddAttribute("buildActionMask",
+ this->CreateString("2147483647"));
+ buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
+ frameworkBuildPhase->AddAttribute("files", buildFiles);
+ for (auto& externalObjFile : externalObjFiles) {
+ buildFiles->AddObject(externalObjFile);
}
+ frameworkBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
+ this->CreateString("0"));
+ }
- // create list of build phases and create the Xcode target
- cmXCodeObject* buildPhases =
- this->CreateObject(cmXCodeObject::OBJECT_LIST);
+ // create list of build phases and create the Xcode target
+ cmXCodeObject* buildPhases = this->CreateObject(cmXCodeObject::OBJECT_LIST);
- this->CreateCustomCommands(buildPhases, sourceBuildPhase, headerBuildPhase,
- resourceBuildPhase, contentBuildPhases,
- frameworkBuildPhase, gtgt);
+ this->CreateCustomCommands(buildPhases, sourceBuildPhase, headerBuildPhase,
+ resourceBuildPhase, contentBuildPhases,
+ frameworkBuildPhase, gtgt);
- targets.push_back(this->CreateXCodeTarget(gtgt, buildPhases));
- }
+ targets.push_back(this->CreateXCodeTarget(gtgt, buildPhases));
return true;
}
@@ -1803,7 +1846,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY ||
gtgt->GetType() == cmStateEnums::STATIC_LIBRARY) {
this->CurrentLocalGenerator->GetStaticLibraryFlags(
- extraLinkOptions, cmSystemTools::UpperCase(configName), gtgt);
+ extraLinkOptions, cmSystemTools::UpperCase(configName), llang, gtgt);
} else {
const char* targetLinkFlags = gtgt->GetProperty("LINK_FLAGS");
if (targetLinkFlags) {
@@ -1817,6 +1860,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
this->CurrentLocalGenerator->AppendFlags(extraLinkOptions, linkFlags);
}
}
+ std::vector<std::string> opts;
+ gtgt->GetLinkOptions(opts, configName, llang);
+ // LINK_OPTIONS are escaped.
+ this->CurrentLocalGenerator->AppendCompileOptions(extraLinkOptions, opts);
}
// Set target-specific architectures.
@@ -2995,7 +3042,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
// Point Xcode at the top of the source tree.
{
std::string pdir =
- this->RelativeToBinary(root->GetCurrentSourceDirectory());
+ this->RelativeToBinary(root->GetCurrentSourceDirectory().c_str());
this->RootObject->AddAttribute("projectDirPath", this->CreateString(pdir));
this->RootObject->AddAttribute("projectRoot", this->CreateString(""));
}
@@ -3315,13 +3362,6 @@ void cmGlobalXCodeGenerator::OutputXCodeProject(
if (generators.empty()) {
return;
}
- // Skip local generators that are excluded from this project.
- for (auto generator : generators) {
- if (this->IsExcluded(root, generator)) {
- continue;
- }
- }
-
if (!this->CreateXCodeObjects(root, generators)) {
return;
}
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index ccef6e2..62f7030 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -96,6 +96,8 @@ public:
i.e. "Can I build Debug and Release in the same tree?" */
bool IsMultiConfig() const override;
+ bool IsXcode() const override { return true; }
+
bool HasKnownObjectFileLocation(std::string* reason) const override;
bool IsIPOSupported() const override { return true; }
@@ -109,6 +111,8 @@ public:
protected:
void AddExtraIDETargets() override;
+ void ComputeTargetOrder();
+ void ComputeTargetOrder(cmGeneratorTarget const* gt, size_t& index);
void Generate() override;
private:
@@ -204,6 +208,8 @@ private:
void AddXCodeProjBuildRule(cmGeneratorTarget* target,
std::vector<cmSourceFile*>& sources) const;
bool CreateXCodeTargets(cmLocalGenerator* gen, std::vector<cmXCodeObject*>&);
+ bool CreateXCodeTarget(cmGeneratorTarget* gtgt,
+ std::vector<cmXCodeObject*>&);
bool IsHeaderFile(cmSourceFile*);
void AddDependTarget(cmXCodeObject* target, cmXCodeObject* dependTarget);
void CreateXCodeDependHackTarget(std::vector<cmXCodeObject*>& targets);
@@ -286,6 +292,7 @@ private:
std::string ObjectDirArchDefault;
std::string ObjectDirArch;
std::string GeneratorToolset;
+ std::map<cmGeneratorTarget const*, size_t> TargetOrderIndex;
};
#endif
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 1bbfbe0..fcdf03f 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -257,7 +257,7 @@ void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName)
currentFilename += ptr.first;
currentFilename += ".dependers";
- cmGeneratedFileStream str(currentFilename.c_str());
+ cmGeneratedFileStream str(currentFilename);
if (!str) {
return;
}
@@ -300,7 +300,7 @@ void cmGraphVizWriter::WritePerTargetFiles(const char* fileName)
std::string currentFilename = fileName;
currentFilename += ".";
currentFilename += ptr.first;
- cmGeneratedFileStream str(currentFilename.c_str());
+ cmGeneratedFileStream str(currentFilename);
if (!str) {
return;
}
diff --git a/Source/cmHexFileConverter.cxx b/Source/cmHexFileConverter.cxx
index 8deb8c1..4e29f39 100644
--- a/Source/cmHexFileConverter.cxx
+++ b/Source/cmHexFileConverter.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmHexFileConverter.h"
+#include <ctype.h>
#include <stdio.h>
#include <string.h>
@@ -12,13 +13,6 @@
#define MOTOROLA_SREC_MIN_LINE_LENGTH (2 + 2 + 4 + 2)
#define MOTOROLA_SREC_MAX_LINE_LENGTH (2 + 2 + 8 + (256 * 2) + 2)
-// might go to SystemTools ?
-static bool cm_IsHexChar(char c)
-{
- return (((c >= '0') && (c <= '9')) || ((c >= 'a') && (c <= 'f')) ||
- ((c >= 'A') && (c <= 'F')));
-}
-
static unsigned int ChompStrlen(const char* line)
{
if (line == nullptr) {
@@ -169,7 +163,7 @@ cmHexFileConverter::FileType cmHexFileConverter::DetermineFileType(
}
for (unsigned int i = 1; i < slen; i++) {
- if (!cm_IsHexChar(buf[i])) {
+ if (!isxdigit(buf[i])) {
return Binary;
}
}
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 87dcb18..d7fe777 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -187,7 +187,7 @@ bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args)
// Tell the global generator about any installation component names
// specified.
- this->Makefile->GetGlobalGenerator()->AddInstallComponent(component.c_str());
+ this->Makefile->GetGlobalGenerator()->AddInstallComponent(component);
return true;
}
@@ -362,7 +362,12 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
return false;
}
// Lookup this target in the current directory.
- if (cmTarget* target = this->Makefile->FindLocalNonAliasTarget(tgt)) {
+ cmTarget* target = this->Makefile->FindLocalNonAliasTarget(tgt);
+ if (!target) {
+ // If no local target has been found, find it in the global scope.
+ target = this->Makefile->GetGlobalGenerator()->FindTarget(tgt, true);
+ }
+ if (target) {
// Found the target. Check its type.
if (target->GetType() != cmStateEnums::EXECUTABLE &&
target->GetType() != cmStateEnums::STATIC_LIBRARY &&
@@ -381,8 +386,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
} else {
// Did not find the target.
std::ostringstream e;
- e << "TARGETS given target \"" << tgt
- << "\" which does not exist in this directory.";
+ e << "TARGETS given target \"" << tgt << "\" which does not exist.";
this->SetError(e.str());
return false;
}
@@ -757,43 +761,43 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
// specified
if (installsArchive) {
this->Makefile->GetGlobalGenerator()->AddInstallComponent(
- archiveArgs.GetComponent().c_str());
+ archiveArgs.GetComponent());
}
if (installsLibrary) {
this->Makefile->GetGlobalGenerator()->AddInstallComponent(
- libraryArgs.GetComponent().c_str());
+ libraryArgs.GetComponent());
}
if (installsNamelink) {
this->Makefile->GetGlobalGenerator()->AddInstallComponent(
- libraryArgs.GetNamelinkComponent().c_str());
+ libraryArgs.GetNamelinkComponent());
}
if (installsRuntime) {
this->Makefile->GetGlobalGenerator()->AddInstallComponent(
- runtimeArgs.GetComponent().c_str());
+ runtimeArgs.GetComponent());
}
if (installsObject) {
this->Makefile->GetGlobalGenerator()->AddInstallComponent(
- objectArgs.GetComponent().c_str());
+ objectArgs.GetComponent());
}
if (installsFramework) {
this->Makefile->GetGlobalGenerator()->AddInstallComponent(
- frameworkArgs.GetComponent().c_str());
+ frameworkArgs.GetComponent());
}
if (installsBundle) {
this->Makefile->GetGlobalGenerator()->AddInstallComponent(
- bundleArgs.GetComponent().c_str());
+ bundleArgs.GetComponent());
}
if (installsPrivateHeader) {
this->Makefile->GetGlobalGenerator()->AddInstallComponent(
- privateHeaderArgs.GetComponent().c_str());
+ privateHeaderArgs.GetComponent());
}
if (installsPublicHeader) {
this->Makefile->GetGlobalGenerator()->AddInstallComponent(
- publicHeaderArgs.GetComponent().c_str());
+ publicHeaderArgs.GetComponent());
}
if (installsResource) {
this->Makefile->GetGlobalGenerator()->AddInstallComponent(
- resourceArgs.GetComponent().c_str());
+ resourceArgs.GetComponent());
}
return true;
@@ -895,7 +899,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
// Tell the global generator about any installation component names
// specified.
this->Makefile->GetGlobalGenerator()->AddInstallComponent(
- ica.GetComponent().c_str());
+ ica.GetComponent());
return true;
}
@@ -1192,7 +1196,7 @@ bool cmInstallCommand::HandleDirectoryMode(
// Tell the global generator about any installation component names
// specified.
- this->Makefile->GetGlobalGenerator()->AddInstallComponent(component.c_str());
+ this->Makefile->GetGlobalGenerator()->AddInstallComponent(component);
return true;
}
diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx
index b569b73..c9b50a3 100644
--- a/Source/cmInstallDirectoryGenerator.cxx
+++ b/Source/cmInstallDirectoryGenerator.cxx
@@ -73,7 +73,7 @@ void cmInstallDirectoryGenerator::GenerateScriptForConfig(
cmMakefile const& mf = *this->LocalGenerator->GetMakefile();
for (std::string& d : dirs) {
if (!cmSystemTools::FileIsFullPath(d)) {
- d = std::string(mf.GetCurrentSourceDirectory()) + "/" + d;
+ d = mf.GetCurrentSourceDirectory() + "/" + d;
}
}
diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx
index f7e6e44..3a90f4c 100644
--- a/Source/cmInstallScriptGenerator.cxx
+++ b/Source/cmInstallScriptGenerator.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallScriptGenerator.h"
+#include "cmGeneratorExpression.h"
#include "cmScriptGenerator.h"
#include <ostream>
@@ -16,24 +17,47 @@ cmInstallScriptGenerator::cmInstallScriptGenerator(const char* script,
, Script(script)
, Code(code)
{
+ // We need per-config actions if the script has generator expressions.
+ if (cmGeneratorExpression::Find(Script) != std::string::npos) {
+ this->ActionsPerConfig = true;
+ }
}
cmInstallScriptGenerator::~cmInstallScriptGenerator()
{
}
-void cmInstallScriptGenerator::GenerateScript(std::ostream& os)
+void cmInstallScriptGenerator::Compute(cmLocalGenerator* lg)
{
- Indent indent;
- std::string component_test =
- this->CreateComponentTest(this->Component.c_str(), this->ExcludeFromAll);
- os << indent << "if(" << component_test << ")\n";
+ this->LocalGenerator = lg;
+}
+void cmInstallScriptGenerator::AddScriptInstallRule(std::ostream& os,
+ Indent indent,
+ std::string const& script)
+{
if (this->Code) {
- os << indent.Next() << this->Script << "\n";
+ os << indent.Next() << script << "\n";
+ } else {
+ os << indent.Next() << "include(\"" << script << "\")\n";
+ }
+}
+
+void cmInstallScriptGenerator::GenerateScriptActions(std::ostream& os,
+ Indent indent)
+{
+ if (this->ActionsPerConfig) {
+ this->cmInstallGenerator::GenerateScriptActions(os, indent);
} else {
- os << indent.Next() << "include(\"" << this->Script << "\")\n";
+ this->AddScriptInstallRule(os, indent, this->Script);
}
+}
- os << indent << "endif()\n\n";
+void cmInstallScriptGenerator::GenerateScriptForConfig(
+ std::ostream& os, const std::string& config, Indent indent)
+{
+ cmGeneratorExpression ge;
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(this->Script);
+ this->AddScriptInstallRule(os, indent,
+ cge->Evaluate(this->LocalGenerator, config));
}
diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h
index fe0f7c6..534bc1d 100644
--- a/Source/cmInstallScriptGenerator.h
+++ b/Source/cmInstallScriptGenerator.h
@@ -6,10 +6,13 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmInstallGenerator.h"
+#include "cmScriptGenerator.h"
#include <iosfwd>
#include <string>
+class cmLocalGenerator;
+
/** \class cmInstallScriptGenerator
* \brief Generate target installation rules.
*/
@@ -20,10 +23,18 @@ public:
const char* component, bool exclude_from_all);
~cmInstallScriptGenerator() override;
+ void Compute(cmLocalGenerator* lg) override;
+
protected:
- void GenerateScript(std::ostream& os) override;
+ void GenerateScriptActions(std::ostream& os, Indent indent) override;
+ void GenerateScriptForConfig(std::ostream& os, const std::string& config,
+ Indent indent) override;
+ void AddScriptInstallRule(std::ostream& os, Indent indent,
+ std::string const& script);
+
std::string Script;
bool Code;
+ cmLocalGenerator* LocalGenerator;
};
#endif
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index e0afa2d..8b8f79b 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -440,7 +440,13 @@ std::string cmInstallTargetGenerator::GetInstallFilename(
void cmInstallTargetGenerator::Compute(cmLocalGenerator* lg)
{
+ // Lookup this target in the current directory.
this->Target = lg->FindLocalNonAliasGeneratorTarget(this->TargetName);
+ if (!this->Target) {
+ // If no local target has been found, find it in the global scope.
+ this->Target =
+ lg->GetGlobalGenerator()->FindGeneratorTarget(this->TargetName);
+ }
}
void cmInstallTargetGenerator::AddTweak(std::ostream& os, Indent indent,
diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx
index 557fa41..c9bbde1 100644
--- a/Source/cmLinkLineDeviceComputer.cxx
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -3,7 +3,9 @@
#include "cmLinkLineDeviceComputer.h"
+#include <set>
#include <sstream>
+#include <utility>
#include "cmAlgorithms.h"
#include "cmComputeLinkInformation.h"
@@ -28,6 +30,12 @@ std::string cmLinkLineDeviceComputer::ComputeLinkLibraries(
{
// Write the library flags to the build rule.
std::ostringstream fout;
+
+ // Generate the unique set of link items when device linking.
+ // The nvcc device linker is designed so that each static library
+ // with device symbols only needs to be listed once as it doesn't
+ // care about link order.
+ std::set<std::string> emitted;
typedef cmComputeLinkInformation::ItemVector ItemVector;
ItemVector const& items = cli.GetItems();
std::string config = cli.GetConfig();
@@ -50,20 +58,24 @@ std::string cmLinkLineDeviceComputer::ComputeLinkLibraries(
}
}
+ std::string out;
if (item.IsPath) {
// nvcc understands absolute paths to libraries ending in '.a' should
// be passed to nvlink. Other extensions like '.so' or '.dylib' are
// rejected by the nvcc front-end even though nvlink knows to ignore
// them. Bypass the front-end via '-Xnvlink'.
if (!cmHasLiteralSuffix(item.Value, ".a")) {
- fout << "-Xnvlink ";
+ out += "-Xnvlink ";
}
- fout << this->ConvertToOutputFormat(
- this->ConvertToLinkReference(item.Value));
+ out +=
+ this->ConvertToOutputFormat(this->ConvertToLinkReference(item.Value));
} else {
- fout << item.Value;
+ out += item.Value;
+ }
+
+ if (emitted.insert(out).second) {
+ fout << out << " ";
}
- fout << " ";
}
if (!stdLibString.empty()) {
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 1ac2cc2..d7de2fa 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -289,12 +289,10 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args)
if (item < 0) {
item = static_cast<int>(nitem) + item;
}
- if (item < 0 || nitem <= static_cast<size_t>(item)) {
+ if (item < 0 || nitem < static_cast<size_t>(item)) {
std::ostringstream str;
str << "index: " << item << " out of range (-" << varArgsExpanded.size()
- << ", "
- << (varArgsExpanded.empty() ? 0 : (varArgsExpanded.size() - 1))
- << ")";
+ << ", " << varArgsExpanded.size() << ")";
this->SetError(str.str());
return false;
}
@@ -963,14 +961,193 @@ bool cmListCommand::HandleTransformCommand(
return true;
}
+class cmStringSorter
+{
+public:
+ enum class Order
+ {
+ UNINITIALIZED,
+ ASCENDING,
+ DESCENDING,
+ };
+
+ enum class Compare
+ {
+ UNINITIALIZED,
+ STRING,
+ FILE_BASENAME,
+ };
+ enum class CaseSensitivity
+ {
+ UNINITIALIZED,
+ SENSITIVE,
+ INSENSITIVE,
+ };
+
+protected:
+ typedef std::string (*StringFilter)(const std::string& in);
+ StringFilter GetCompareFilter(Compare compare)
+ {
+ return (compare == Compare::FILE_BASENAME) ? cmSystemTools::GetFilenameName
+ : nullptr;
+ }
+
+ StringFilter GetCaseFilter(CaseSensitivity sensitivity)
+ {
+ return (sensitivity == CaseSensitivity::INSENSITIVE)
+ ? cmSystemTools::LowerCase
+ : nullptr;
+ }
+
+public:
+ cmStringSorter(Compare compare, CaseSensitivity caseSensitivity,
+ Order desc = Order::ASCENDING)
+ : filters{ GetCompareFilter(compare), GetCaseFilter(caseSensitivity) }
+ , descending(desc == Order::DESCENDING)
+ {
+ }
+
+ std::string ApplyFilter(const std::string& argument)
+ {
+ std::string result = argument;
+ for (auto filter : filters) {
+ if (filter != nullptr) {
+ result = filter(result);
+ }
+ }
+ return result;
+ }
+
+ bool operator()(const std::string& a, const std::string& b)
+ {
+ std::string af = ApplyFilter(a);
+ std::string bf = ApplyFilter(b);
+ bool result;
+ if (descending) {
+ result = bf < af;
+ } else {
+ result = af < bf;
+ }
+ return result;
+ }
+
+protected:
+ StringFilter filters[2] = { nullptr, nullptr };
+ bool descending;
+};
+
bool cmListCommand::HandleSortCommand(std::vector<std::string> const& args)
{
assert(args.size() >= 2);
- if (args.size() > 2) {
- this->SetError("sub-command SORT only takes one argument.");
+ if (args.size() > 8) {
+ this->SetError("sub-command SORT only takes up to six arguments.");
return false;
}
+ auto sortCompare = cmStringSorter::Compare::UNINITIALIZED;
+ auto sortCaseSensitivity = cmStringSorter::CaseSensitivity::UNINITIALIZED;
+ auto sortOrder = cmStringSorter::Order::UNINITIALIZED;
+
+ size_t argumentIndex = 2;
+ const std::string messageHint = "sub-command SORT ";
+
+ while (argumentIndex < args.size()) {
+ const std::string option = args[argumentIndex++];
+ if (option == "COMPARE") {
+ if (sortCompare != cmStringSorter::Compare::UNINITIALIZED) {
+ std::string error = messageHint + "option \"" + option +
+ "\" has been specified multiple times.";
+ this->SetError(error);
+ return false;
+ }
+ if (argumentIndex < args.size()) {
+ const std::string argument = args[argumentIndex++];
+ if (argument == "STRING") {
+ sortCompare = cmStringSorter::Compare::STRING;
+ } else if (argument == "FILE_BASENAME") {
+ sortCompare = cmStringSorter::Compare::FILE_BASENAME;
+ } else {
+ std::string error = messageHint + "value \"" + argument +
+ "\" for option \"" + option + "\" is invalid.";
+ this->SetError(error);
+ return false;
+ }
+ } else {
+ std::string error =
+ messageHint + "missing argument for option \"" + option + "\".";
+ this->SetError(error);
+ return false;
+ }
+ } else if (option == "CASE") {
+ if (sortCaseSensitivity !=
+ cmStringSorter::CaseSensitivity::UNINITIALIZED) {
+ std::string error = messageHint + "option \"" + option +
+ "\" has been specified multiple times.";
+ this->SetError(error);
+ return false;
+ }
+ if (argumentIndex < args.size()) {
+ const std::string argument = args[argumentIndex++];
+ if (argument == "SENSITIVE") {
+ sortCaseSensitivity = cmStringSorter::CaseSensitivity::SENSITIVE;
+ } else if (argument == "INSENSITIVE") {
+ sortCaseSensitivity = cmStringSorter::CaseSensitivity::INSENSITIVE;
+ } else {
+ std::string error = messageHint + "value \"" + argument +
+ "\" for option \"" + option + "\" is invalid.";
+ this->SetError(error);
+ return false;
+ }
+ } else {
+ std::string error =
+ messageHint + "missing argument for option \"" + option + "\".";
+ this->SetError(error);
+ return false;
+ }
+ } else if (option == "ORDER") {
+
+ if (sortOrder != cmStringSorter::Order::UNINITIALIZED) {
+ std::string error = messageHint + "option \"" + option +
+ "\" has been specified multiple times.";
+ this->SetError(error);
+ return false;
+ }
+ if (argumentIndex < args.size()) {
+ const std::string argument = args[argumentIndex++];
+ if (argument == "ASCENDING") {
+ sortOrder = cmStringSorter::Order::ASCENDING;
+ } else if (argument == "DESCENDING") {
+ sortOrder = cmStringSorter::Order::DESCENDING;
+ } else {
+ std::string error = messageHint + "value \"" + argument +
+ "\" for option \"" + option + "\" is invalid.";
+ this->SetError(error);
+ return false;
+ }
+ } else {
+ std::string error =
+ messageHint + "missing argument for option \"" + option + "\".";
+ this->SetError(error);
+ return false;
+ }
+ } else {
+ std::string error =
+ messageHint + "option \"" + option + "\" is unknown.";
+ this->SetError(error);
+ return false;
+ }
+ }
+ // set Default Values if Option is not given
+ if (sortCompare == cmStringSorter::Compare::UNINITIALIZED) {
+ sortCompare = cmStringSorter::Compare::STRING;
+ }
+ if (sortCaseSensitivity == cmStringSorter::CaseSensitivity::UNINITIALIZED) {
+ sortCaseSensitivity = cmStringSorter::CaseSensitivity::SENSITIVE;
+ }
+ if (sortOrder == cmStringSorter::Order::UNINITIALIZED) {
+ sortOrder = cmStringSorter::Order::ASCENDING;
+ }
+
const std::string& listName = args[1];
// expand the variable
std::vector<std::string> varArgsExpanded;
@@ -979,7 +1156,14 @@ bool cmListCommand::HandleSortCommand(std::vector<std::string> const& args)
return false;
}
- std::sort(varArgsExpanded.begin(), varArgsExpanded.end());
+ if ((sortCompare == cmStringSorter::Compare::STRING) &&
+ (sortCaseSensitivity == cmStringSorter::CaseSensitivity::SENSITIVE) &&
+ (sortOrder == cmStringSorter::Order::ASCENDING)) {
+ std::sort(varArgsExpanded.begin(), varArgsExpanded.end());
+ } else {
+ cmStringSorter sorter(sortCompare, sortCaseSensitivity, sortOrder);
+ std::sort(varArgsExpanded.begin(), varArgsExpanded.end(), sorter);
+ }
std::string value = cmJoin(varArgsExpanded, ";");
this->Makefile->AddDefinition(listName, value.c_str());
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index a3f4a8f..532f9a9 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -253,7 +253,7 @@ void cmLocalGenerator::GenerateTestFiles()
file += "/";
file += "CTestTestfile.cmake";
- cmGeneratedFileStream fout(file.c_str());
+ cmGeneratedFileStream fout(file);
fout.SetCopyIfDifferent(true);
fout << "# CMake generated Testfile for " << std::endl
@@ -429,7 +429,7 @@ void cmLocalGenerator::GenerateInstallRules()
toplevel_install = 1;
}
file += "/cmake_install.cmake";
- cmGeneratedFileStream fout(file.c_str());
+ cmGeneratedFileStream fout(file);
fout.SetCopyIfDifferent(true);
// Write the header.
@@ -844,12 +844,11 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
cmGeneratorTarget const* target,
const std::string& lang,
const std::string& config,
- bool stripImplicitInclDirs) const
+ bool stripImplicitDirs,
+ bool appendAllImplicitDirs) const
{
- // Need to decide whether to automatically include the source and
- // binary directories at the beginning of the include path.
- bool includeSourceDir = false;
- bool includeBinaryDir = false;
+ // Do not repeat an include path.
+ std::set<std::string> emitted;
// When automatic include directories are requested for a build then
// include the source and binary directories at the beginning of the
@@ -859,26 +858,21 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
// cannot fix this because not all native build tools support
// per-source-file include paths.
if (this->Makefile->IsOn("CMAKE_INCLUDE_CURRENT_DIR")) {
- includeSourceDir = true;
- includeBinaryDir = true;
- }
-
- // Do not repeat an include path.
- std::set<std::string> emitted;
-
- // Store the automatic include paths.
- if (includeBinaryDir) {
- std::string binDir = this->StateSnapshot.GetDirectory().GetCurrentBinary();
- if (emitted.find(binDir) == emitted.end()) {
- dirs.push_back(binDir);
- emitted.insert(binDir);
+ // Current binary directory
+ {
+ std::string binDir =
+ this->StateSnapshot.GetDirectory().GetCurrentBinary();
+ if (emitted.insert(binDir).second) {
+ dirs.push_back(std::move(binDir));
+ }
}
- }
- if (includeSourceDir) {
- std::string srcDir = this->StateSnapshot.GetDirectory().GetCurrentSource();
- if (emitted.find(srcDir) == emitted.end()) {
- dirs.push_back(srcDir);
- emitted.insert(srcDir);
+ // Current source directory
+ {
+ std::string srcDir =
+ this->StateSnapshot.GetDirectory().GetCurrentSource();
+ if (emitted.insert(srcDir).second) {
+ dirs.push_back(std::move(srcDir));
+ }
}
}
@@ -886,43 +880,45 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
return;
}
- std::string rootPath;
- if (const char* sysrootCompile =
- this->Makefile->GetDefinition("CMAKE_SYSROOT_COMPILE")) {
- rootPath = sysrootCompile;
- } else {
- rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
- }
-
+ // Implicit include directories
std::vector<std::string> implicitDirs;
- // Load implicit include directories for this language.
- std::string impDirVar = "CMAKE_";
- impDirVar += lang;
- impDirVar += "_IMPLICIT_INCLUDE_DIRECTORIES";
- if (const char* value = this->Makefile->GetDefinition(impDirVar)) {
- std::vector<std::string> impDirVec;
- cmSystemTools::ExpandListArgument(value, impDirVec);
- for (std::string const& i : impDirVec) {
- std::string d = rootPath + i;
- cmSystemTools::ConvertToUnixSlashes(d);
- emitted.insert(std::move(d));
- if (!stripImplicitInclDirs) {
+ {
+ std::string rootPath;
+ if (const char* sysrootCompile =
+ this->Makefile->GetDefinition("CMAKE_SYSROOT_COMPILE")) {
+ rootPath = sysrootCompile;
+ } else {
+ rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
+ }
+
+ // Load implicit include directories for this language.
+ std::string key = "CMAKE_";
+ key += lang;
+ key += "_IMPLICIT_INCLUDE_DIRECTORIES";
+ if (const char* value = this->Makefile->GetDefinition(key)) {
+ std::vector<std::string> impDirVec;
+ cmSystemTools::ExpandListArgument(value, impDirVec);
+ for (std::string const& i : impDirVec) {
+ {
+ std::string d = rootPath + i;
+ cmSystemTools::ConvertToUnixSlashes(d);
+ emitted.insert(std::move(d));
+ }
implicitDirs.push_back(i);
}
}
}
// Get the target-specific include directories.
- std::vector<std::string> includes;
-
- includes = target->GetIncludeDirectories(config, lang);
+ std::vector<std::string> userDirs =
+ target->GetIncludeDirectories(config, lang);
// Support putting all the in-project include directories first if
// it is requested by the project.
if (this->Makefile->IsOn("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE")) {
std::string const &topSourceDir = this->GetState()->GetSourceDirectory(),
&topBinaryDir = this->GetState()->GetBinaryDirectory();
- for (std::string const& i : includes) {
+ for (std::string const& i : userDirs) {
// Emit this directory only if it is a subdirectory of the
// top-level source or binary tree.
if (cmSystemTools::ComparePath(i, topSourceDir) ||
@@ -937,7 +933,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
}
// Construct the final ordered include directory list.
- for (std::string const& i : includes) {
+ for (std::string const& i : userDirs) {
if (emitted.insert(i).second) {
dirs.push_back(i);
}
@@ -946,28 +942,44 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
this->MoveSystemIncludesToEnd(dirs, config, lang, target);
// Add standard include directories for this language.
- // We do not filter out implicit directories here.
- 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);
- dirs.push_back(*i);
- }
-
- for (std::string const& i : implicitDirs) {
- if (std::find(includes.begin(), includes.end(), i) != includes.end()) {
- dirs.push_back(i);
+ {
+ std::vector<std::string>::size_type const before = userDirs.size();
+ {
+ std::string key = "CMAKE_";
+ key += lang;
+ key += "_STANDARD_INCLUDE_DIRECTORIES";
+ std::string const value = this->Makefile->GetSafeDefinition(key);
+ cmSystemTools::ExpandListArgument(value, userDirs);
+ }
+ for (std::vector<std::string>::iterator i = userDirs.begin() + before,
+ ie = userDirs.end();
+ i != ie; ++i) {
+ cmSystemTools::ConvertToUnixSlashes(*i);
+ dirs.push_back(*i);
+ }
+ }
+
+ if (!stripImplicitDirs) {
+ // Append only implicit directories that were requested by the user
+ for (std::string const& i : implicitDirs) {
+ if (std::find(userDirs.begin(), userDirs.end(), i) != userDirs.end()) {
+ dirs.push_back(i);
+ }
+ }
+ // Append remaining implicit directories on demand
+ if (appendAllImplicitDirs) {
+ for (std::string const& i : implicitDirs) {
+ if (std::find(dirs.begin(), dirs.end(), i) == dirs.end()) {
+ dirs.push_back(i);
+ }
+ }
}
}
}
void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags,
std::string const& config,
+ std::string const& linkLanguage,
cmGeneratorTarget* target)
{
this->AppendFlags(
@@ -981,6 +993,11 @@ void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags,
std::string name = "STATIC_LIBRARY_FLAGS_" + config;
this->AppendFlags(flags, target->GetProperty(name));
}
+
+ std::vector<std::string> options;
+ target->GetStaticLibraryLinkOptions(options, config, linkLanguage);
+ // STATIC_LIBRARY_OPTIONS are escaped.
+ this->AppendCompileOptions(flags, options);
}
void cmLocalGenerator::GetTargetFlags(
@@ -998,7 +1015,7 @@ void cmLocalGenerator::GetTargetFlags(
switch (target->GetType()) {
case cmStateEnums::STATIC_LIBRARY:
- this->GetStaticLibraryFlags(linkFlags, buildType, target);
+ this->GetStaticLibraryFlags(linkFlags, buildType, linkLanguage, target);
break;
case cmStateEnums::MODULE_LIBRARY:
libraryLinkVariable = "CMAKE_MODULE_LINKER_FLAGS";
@@ -1042,6 +1059,10 @@ void cmLocalGenerator::GetTargetFlags(
linkFlags += " ";
}
}
+ std::vector<std::string> opts;
+ target->GetLinkOptions(opts, config, linkLanguage);
+ // LINK_OPTIONS are escaped.
+ this->AppendCompileOptions(linkFlags, opts);
if (pcli) {
this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
frameworkPath, linkPath);
@@ -1113,6 +1134,10 @@ void cmLocalGenerator::GetTargetFlags(
linkFlags += " ";
}
}
+ std::vector<std::string> opts;
+ target->GetLinkOptions(opts, config, linkLanguage);
+ // LINK_OPTIONS are escaped.
+ this->AppendCompileOptions(linkFlags, opts);
} break;
default:
break;
@@ -1952,7 +1977,7 @@ void cmLocalGenerator::AppendCompileOptions(
cmsys::RegularExpression r(regex);
for (std::string const& opt : options_vec) {
- if (r.find(opt.c_str())) {
+ if (r.find(opt)) {
this->AppendFlagEscape(options, opt);
}
}
@@ -2503,12 +2528,12 @@ std::string const& cmLocalGenerator::GetBinaryDirectory() const
return this->GetCMakeInstance()->GetHomeOutputDirectory();
}
-const char* cmLocalGenerator::GetCurrentBinaryDirectory() const
+std::string const& cmLocalGenerator::GetCurrentBinaryDirectory() const
{
return this->StateSnapshot.GetDirectory().GetCurrentBinary();
}
-const char* cmLocalGenerator::GetCurrentSourceDirectory() const
+std::string const& cmLocalGenerator::GetCurrentSourceDirectory() const
{
return this->StateSnapshot.GetDirectory().GetCurrentSource();
}
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 9ba62cc..27a42b3 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -237,12 +237,18 @@ public:
return true;
}
- /** Get the include flags for the current makefile and language. */
+ /** @brief Get the include directories for the current makefile and language.
+ * @arg stripImplicitDirs Strip all directories found in
+ * CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES from the result.
+ * @arg appendAllImplicitDirs Append all directories found in
+ * CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES to the result.
+ */
void GetIncludeDirectories(std::vector<std::string>& dirs,
cmGeneratorTarget const* target,
const std::string& lang = "C",
const std::string& config = "",
- bool stripImplicitInclDirs = true) const;
+ bool stripImplicitDirs = true,
+ bool appendAllImplicitDirs = false) const;
void AddCompileOptions(std::string& flags, cmGeneratorTarget* target,
const std::string& lang, const std::string& config);
void AddCompileDefinitions(std::set<std::string>& defines,
@@ -290,8 +296,8 @@ public:
std::string const& GetSourceDirectory() const;
std::string const& GetBinaryDirectory() const;
- const char* GetCurrentBinaryDirectory() const;
- const char* GetCurrentSourceDirectory() const;
+ std::string const& GetCurrentBinaryDirectory() const;
+ std::string const& GetCurrentSourceDirectory() const;
/**
* Generate a Mac OS X application bundle Info.plist file.
@@ -317,6 +323,7 @@ public:
/** Fill out the static linker flags for the given target. */
void GetStaticLibraryFlags(std::string& flags, std::string const& config,
+ std::string const& linkLanguage,
cmGeneratorTarget* target);
/** Fill out these strings for the given target. Libraries to link,
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 9fd2ddb..bc83ce2 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -211,8 +211,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
// rules may depend on this file itself.
std::string ruleFileNameFull = this->ConvertToFullPath(ruleFileName);
cmGeneratedFileStream ruleFileStream(
- ruleFileNameFull.c_str(), false,
- this->GlobalGenerator->GetMakefileEncoding());
+ ruleFileNameFull, false, this->GlobalGenerator->GetMakefileEncoding());
if (!ruleFileStream) {
return;
}
@@ -433,7 +432,7 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
infoFileName += "/CMakeDirectoryInformation.cmake";
// Open the output file.
- cmGeneratedFileStream infoFileStream(infoFileName.c_str());
+ cmGeneratedFileStream infoFileStream(infoFileName);
if (!infoFileStream) {
return;
}
@@ -1403,8 +1402,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
std::string ruleFileNameFull = dir;
ruleFileNameFull += "/depend.make";
cmGeneratedFileStream ruleFileStream(
- ruleFileNameFull.c_str(), false,
- this->GlobalGenerator->GetMakefileEncoding());
+ ruleFileNameFull, false, this->GlobalGenerator->GetMakefileEncoding());
ruleFileStream.SetCopyIfDifferent(true);
if (!ruleFileStream) {
return false;
@@ -1416,7 +1414,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
std::string internalRuleFileNameFull = dir;
internalRuleFileNameFull += "/depend.internal";
cmGeneratedFileStream internalRuleFileStream(
- internalRuleFileNameFull.c_str(), false,
+ internalRuleFileNameFull, false,
this->GlobalGenerator->GetMakefileEncoding());
if (!internalRuleFileStream) {
return false;
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 3460289..80f2803 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -118,7 +118,7 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles()
if (this->GetCurrentBinaryDirectory() != this->GetSourceDirectory()) {
if (!cmSystemTools::MakeDirectory(this->GetCurrentBinaryDirectory())) {
cmSystemTools::Error("Error creating directory ",
- this->GetCurrentBinaryDirectory());
+ this->GetCurrentBinaryDirectory().c_str());
}
}
@@ -712,8 +712,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
targetOptions.FixExceptionHandlingDefault();
std::string asmLocation = configName + "/";
targetOptions.AddFlag("AssemblerListingLocation", asmLocation);
- targetOptions.Parse(flags.c_str());
- targetOptions.Parse(defineFlags.c_str());
+ targetOptions.Parse(flags);
+ targetOptions.Parse(defineFlags);
targetOptions.ParseFinish();
if (!langForClCompile.empty()) {
std::vector<std::string> targetDefines;
@@ -977,13 +977,20 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
extraLinkOptions += " ";
extraLinkOptions += targetLinkFlags;
}
+
+ std::vector<std::string> opts;
+ target->GetLinkOptions(opts, configName,
+ target->GetLinkerLanguage(configName));
+ // LINK_OPTIONS are escaped.
+ this->AppendCompileOptions(extraLinkOptions, opts);
+
Options linkOptions(this, Options::Linker);
if (this->FortranProject) {
linkOptions.AddTable(cmLocalVisualStudio7GeneratorFortranLinkFlagTable);
}
linkOptions.AddTable(cmLocalVisualStudio7GeneratorLinkFlagTable);
- linkOptions.Parse(extraLinkOptions.c_str());
+ linkOptions.Parse(extraLinkOptions);
cmGeneratorTarget::ModuleDefinitionInfo const* mdi =
target->GetModuleDefinitionInfo(configName);
if (mdi && !mdi->DefFile.empty()) {
@@ -1031,7 +1038,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
}
}
std::string libflags;
- this->GetStaticLibraryFlags(libflags, configTypeUpper, target);
+ this->GetStaticLibraryFlags(libflags, configTypeUpper,
+ target->GetLinkerLanguage(configName),
+ target);
if (!libflags.empty()) {
fout << "\t\t\t\tAdditionalOptions=\"" << libflags << "\"\n";
}
@@ -1226,30 +1235,56 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
}
}
+static std::string cmLocalVisualStudio7GeneratorEscapeForXML(
+ const std::string& s)
+{
+ std::string ret = s;
+ cmSystemTools::ReplaceString(ret, "&", "&amp;");
+ cmSystemTools::ReplaceString(ret, "\"", "&quot;");
+ cmSystemTools::ReplaceString(ret, "<", "&lt;");
+ cmSystemTools::ReplaceString(ret, ">", "&gt;");
+ cmSystemTools::ReplaceString(ret, "\n", "&#x0D;&#x0A;");
+ return ret;
+}
+
+static std::string GetEscapedPropertyIfValueNotNULL(const char* propertyValue)
+{
+ return propertyValue == nullptr
+ ? std::string()
+ : cmLocalVisualStudio7GeneratorEscapeForXML(propertyValue);
+}
+
void cmLocalVisualStudio7Generator::OutputDeploymentDebuggerTool(
std::ostream& fout, std::string const& config, cmGeneratorTarget* target)
{
if (this->WindowsCEProject) {
- if (const char* dir = target->GetProperty("DEPLOYMENT_REMOTE_DIRECTORY")) {
- /* clang-format off */
- fout <<
- "\t\t\t<DeploymentTool\n"
- "\t\t\t\tForceDirty=\"-1\"\n"
- "\t\t\t\tRemoteDirectory=\"" << this->EscapeForXML(dir) << "\"\n"
- "\t\t\t\tRegisterOutput=\"0\"\n"
- "\t\t\t\tAdditionalFiles=\"\"/>\n"
- ;
- /* clang-format on */
+ const char* dir = target->GetProperty("DEPLOYMENT_REMOTE_DIRECTORY");
+ const char* additionalFiles =
+ target->GetProperty("DEPLOYMENT_ADDITIONAL_FILES");
+
+ if (dir == nullptr && additionalFiles == nullptr) {
+ return;
+ }
+
+ fout << "\t\t\t<DeploymentTool\n"
+ "\t\t\t\tForceDirty=\"-1\"\n"
+ "\t\t\t\tRemoteDirectory=\""
+ << GetEscapedPropertyIfValueNotNULL(dir)
+ << "\"\n"
+ "\t\t\t\tRegisterOutput=\"0\"\n"
+ "\t\t\t\tAdditionalFiles=\""
+ << GetEscapedPropertyIfValueNotNULL(additionalFiles) << "\"/>\n";
+
+ if (dir != nullptr) {
std::string const exe =
dir + std::string("\\") + target->GetFullName(config);
- /* clang-format off */
- fout <<
- "\t\t\t<DebuggerTool\n"
- "\t\t\t\tRemoteExecutable=\"" << this->EscapeForXML(exe) << "\"\n"
- "\t\t\t\tArguments=\"\"\n"
- "\t\t\t/>\n"
- ;
- /* clang-format on */
+
+ fout << "\t\t\t<DebuggerTool\n"
+ "\t\t\t\tRemoteExecutable=\""
+ << this->EscapeForXML(exe)
+ << "\"\n"
+ "\t\t\t\tArguments=\"\"\n"
+ "\t\t\t/>\n";
}
}
}
@@ -1702,7 +1737,7 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
table = cmLocalVisualStudio7GeneratorFortranFlagTable;
}
Options fileOptions(this, tool, table, gg->ExtraFlagTable);
- fileOptions.Parse(fc.CompileFlags.c_str());
+ fileOptions.Parse(fc.CompileFlags);
fileOptions.AddDefines(fc.CompileDefs);
fileOptions.AddDefines(fc.CompileDefsConfig);
// validate source level include directories
@@ -2049,17 +2084,6 @@ void cmLocalVisualStudio7Generator::WriteVCProjFooter(
<< "</VisualStudioProject>\n";
}
-std::string cmLocalVisualStudio7GeneratorEscapeForXML(const std::string& s)
-{
- std::string ret = s;
- cmSystemTools::ReplaceString(ret, "&", "&amp;");
- cmSystemTools::ReplaceString(ret, "\"", "&quot;");
- cmSystemTools::ReplaceString(ret, "<", "&lt;");
- cmSystemTools::ReplaceString(ret, ">", "&gt;");
- cmSystemTools::ReplaceString(ret, "\n", "&#x0D;&#x0A;");
- return ret;
-}
-
std::string cmLocalVisualStudio7Generator::EscapeForXML(const std::string& s)
{
return cmLocalVisualStudio7GeneratorEscapeForXML(s);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index af97f80..6127b57 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -216,6 +216,16 @@ cmBacktraceRange cmMakefile::GetCompileDefinitionsBacktraces() const
.GetCompileDefinitionsEntryBacktraces();
}
+cmStringRange cmMakefile::GetLinkOptionsEntries() const
+{
+ return this->StateSnapshot.GetDirectory().GetLinkOptionsEntries();
+}
+
+cmBacktraceRange cmMakefile::GetLinkOptionsBacktraces() const
+{
+ return this->StateSnapshot.GetDirectory().GetLinkOptionsEntryBacktraces();
+}
+
cmListFileBacktrace cmMakefile::GetBacktrace() const
{
return this->Backtrace;
@@ -1205,6 +1215,11 @@ void cmMakefile::AddCompileOption(std::string const& option)
this->AppendProperty("COMPILE_OPTIONS", option.c_str());
}
+void cmMakefile::AddLinkOption(std::string const& option)
+{
+ this->AppendProperty("LINK_OPTIONS", option.c_str());
+}
+
bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
{
// Create a regular expression to match valid definitions.
@@ -1620,12 +1635,12 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
}
}
-const char* cmMakefile::GetCurrentSourceDirectory() const
+const std::string& cmMakefile::GetCurrentSourceDirectory() const
{
return this->StateSnapshot.GetDirectory().GetCurrentSource();
}
-const char* cmMakefile::GetCurrentBinaryDirectory() const
+const std::string& cmMakefile::GetCurrentBinaryDirectory() const
{
return this->StateSnapshot.GetDirectory().GetCurrentBinary();
}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index a7c8df5..4085e99 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -171,6 +171,7 @@ public:
void RemoveDefineFlag(std::string const& definition);
void AddCompileDefinition(std::string const& definition);
void AddCompileOption(std::string const& option);
+ void AddLinkOption(std::string const& option);
/** Create a new imported target with the name and type given. */
cmTarget* AddImportedTarget(const std::string& name,
@@ -326,8 +327,8 @@ public:
*/
void SetArgcArgv(const std::vector<std::string>& args);
- const char* GetCurrentSourceDirectory() const;
- const char* GetCurrentBinaryDirectory() const;
+ std::string const& GetCurrentSourceDirectory() const;
+ std::string const& GetCurrentBinaryDirectory() const;
//@}
@@ -788,6 +789,8 @@ public:
cmBacktraceRange GetCompileOptionsBacktraces() const;
cmStringRange GetCompileDefinitionsEntries() const;
cmBacktraceRange GetCompileDefinitionsBacktraces() const;
+ cmStringRange GetLinkOptionsEntries() const;
+ cmBacktraceRange GetLinkOptionsBacktraces() const;
std::set<std::string> const& GetSystemIncludeDirectories() const
{
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 1e59f44..08bb2ce 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -97,15 +97,15 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
std::vector<std::string> commands;
- // Build list of dependencies.
- std::vector<std::string> depends;
- this->AppendLinkDepends(depends);
-
// Get the language to use for linking this library.
std::string linkLanguage = "CUDA";
std::string const objExt =
this->Makefile->GetSafeDefinition("CMAKE_CUDA_OUTPUT_EXTENSION");
+ // Build list of dependencies.
+ std::vector<std::string> depends;
+ this->AppendLinkDepends(depends, linkLanguage);
+
// Get the name of the device object to generate.
std::string const targetOutputReal =
this->GeneratorTarget->ObjectDirectory + "cmake_device_link" + objExt;
@@ -154,12 +154,7 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
linkLanguage, this->ConfigName);
// Add target-specific linker flags.
- this->LocalGenerator->AppendFlags(
- linkFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS"));
- std::string linkFlagsConfig = "LINK_FLAGS_";
- linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
- this->LocalGenerator->AppendFlags(
- linkFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
+ this->GetTargetLinkFlags(linkFlags, linkLanguage);
// Construct a list of files associated with this executable that
// may need to be cleaned.
@@ -299,13 +294,6 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
{
std::vector<std::string> commands;
- // Build list of dependencies.
- std::vector<std::string> depends;
- this->AppendLinkDepends(depends);
- if (!this->DeviceLinkObject.empty()) {
- depends.push_back(this->DeviceLinkObject);
- }
-
// Get the name of the executable to generate.
std::string targetName;
std::string targetNameReal;
@@ -383,6 +371,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
return;
}
+ // Build list of dependencies.
+ std::vector<std::string> depends;
+ this->AppendLinkDepends(depends, linkLanguage);
+ if (!this->DeviceLinkObject.empty()) {
+ depends.push_back(this->DeviceLinkObject);
+ }
+
this->NumberOfProgressActions++;
if (!this->NoRuleMessages) {
cmLocalUnixMakefileGenerator3::EchoProgress progress;
@@ -437,12 +432,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
linkLanguage, this->ConfigName);
// Add target-specific linker flags.
- this->LocalGenerator->AppendFlags(
- linkFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS"));
- std::string linkFlagsConfig = "LINK_FLAGS_";
- linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
- this->LocalGenerator->AppendFlags(
- linkFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
+ this->GetTargetLinkFlags(linkFlags, linkLanguage);
{
std::unique_ptr<cmLinkLineComputer> linkLineComputer(
@@ -466,7 +456,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// clean set just in case.
exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(),
- (targetFullPath + ".manifest").c_str()));
+ targetFullPath + ".manifest"));
#endif
if (targetNameReal != targetName) {
exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index c538992..2d2915c 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -137,10 +137,7 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
this->GeneratorTarget->GetPropertyAsBool("CUDA_RESOLVE_DEVICE_SYMBOLS");
if (hasCUDA && resolveDeviceSymbols) {
std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY";
- std::string extraFlags;
- this->LocalGenerator->AppendFlags(
- extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS"));
- this->WriteDeviceLibraryRules(linkRuleVar, extraFlags, false);
+ this->WriteDeviceLibraryRules(linkRuleVar, false);
}
std::string linkLanguage =
@@ -151,7 +148,7 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
std::string extraFlags;
this->LocalGenerator->GetStaticLibraryFlags(
- extraFlags, cmSystemTools::UpperCase(this->ConfigName),
+ extraFlags, cmSystemTools::UpperCase(this->ConfigName), linkLanguage,
this->GeneratorTarget);
this->WriteLibraryRules(linkRuleVar, extraFlags, false);
}
@@ -173,10 +170,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
cuda_lang) != closure->Languages.end());
if (hasCUDA) {
std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY";
- std::string extraFlags;
- this->LocalGenerator->AppendFlags(
- extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS"));
- this->WriteDeviceLibraryRules(linkRuleVar, extraFlags, relink);
+ this->WriteDeviceLibraryRules(linkRuleVar, relink);
}
}
@@ -187,13 +181,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
linkRuleVar += "_CREATE_SHARED_LIBRARY";
std::string extraFlags;
- this->LocalGenerator->AppendFlags(
- extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS"));
- std::string linkFlagsConfig = "LINK_FLAGS_";
- linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
- this->LocalGenerator->AppendFlags(
- extraFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
-
+ this->GetTargetLinkFlags(extraFlags, linkLanguage);
this->LocalGenerator->AddConfigVariableFlags(
extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->ConfigName);
@@ -223,10 +211,7 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
cuda_lang) != closure->Languages.end());
if (hasCUDA) {
std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY";
- std::string extraFlags;
- this->LocalGenerator->AppendFlags(
- extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS"));
- this->WriteDeviceLibraryRules(linkRuleVar, extraFlags, relink);
+ this->WriteDeviceLibraryRules(linkRuleVar, relink);
}
}
@@ -237,12 +222,7 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
linkRuleVar += "_CREATE_SHARED_MODULE";
std::string extraFlags;
- this->LocalGenerator->AppendFlags(
- extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS"));
- std::string linkFlagsConfig = "LINK_FLAGS_";
- linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
- this->LocalGenerator->AppendFlags(
- extraFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
+ this->GetTargetLinkFlags(extraFlags, linkLanguage);
this->LocalGenerator->AddConfigVariableFlags(
extraFlags, "CMAKE_MODULE_LINKER_FLAGS", this->ConfigName);
@@ -265,12 +245,7 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink)
linkRuleVar += "_CREATE_MACOSX_FRAMEWORK";
std::string extraFlags;
- this->LocalGenerator->AppendFlags(
- extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS"));
- std::string linkFlagsConfig = "LINK_FLAGS_";
- linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
- this->LocalGenerator->AppendFlags(
- extraFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
+ this->GetTargetLinkFlags(extraFlags, linkLanguage);
this->LocalGenerator->AddConfigVariableFlags(
extraFlags, "CMAKE_MACOSX_FRAMEWORK_LINKER_FLAGS", this->ConfigName);
@@ -278,25 +253,25 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink)
}
void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
- const std::string& linkRuleVar, const std::string& extraFlags, bool relink)
+ const std::string& linkRuleVar, bool relink)
{
#ifdef CMAKE_BUILD_WITH_CMAKE
// TODO: Merge the methods that call this method to avoid
// code duplication.
std::vector<std::string> commands;
- // Build list of dependencies.
- std::vector<std::string> depends;
- this->AppendLinkDepends(depends);
-
// Get the language to use for linking this library.
std::string linkLanguage = "CUDA";
std::string const objExt =
this->Makefile->GetSafeDefinition("CMAKE_CUDA_OUTPUT_EXTENSION");
+ // Build list of dependencies.
+ std::vector<std::string> depends;
+ this->AppendLinkDepends(depends, linkLanguage);
+
// Create set of linking flags.
std::string linkFlags;
- this->LocalGenerator->AppendFlags(linkFlags, extraFlags);
+ this->GetTargetLinkFlags(linkFlags, linkLanguage);
// Get the name of the device object to generate.
std::string const targetOutputReal =
@@ -458,7 +433,6 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
this->WriteTargetDriverRule(targetOutputReal, relink);
#else
static_cast<void>(linkRuleVar);
- static_cast<void>(extraFlags);
static_cast<void>(relink);
#endif
}
@@ -470,13 +444,6 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// code duplication.
std::vector<std::string> commands;
- // Build list of dependencies.
- std::vector<std::string> depends;
- this->AppendLinkDepends(depends);
- if (!this->DeviceLinkObject.empty()) {
- depends.push_back(this->DeviceLinkObject);
- }
-
// Get the language to use for linking this library.
std::string linkLanguage =
this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
@@ -488,6 +455,13 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
return;
}
+ // Build list of dependencies.
+ std::vector<std::string> depends;
+ this->AppendLinkDepends(depends, linkLanguage);
+ if (!this->DeviceLinkObject.empty()) {
+ depends.push_back(this->DeviceLinkObject);
+ }
+
// Create set of linking flags.
std::string linkFlags;
this->LocalGenerator->AppendFlags(linkFlags, extraFlags);
@@ -661,7 +635,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
if (this->GeneratorTarget->GetType() != cmStateEnums::STATIC_LIBRARY) {
libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(),
- (targetFullPath + ".manifest").c_str()));
+ targetFullPath + ".manifest"));
}
#endif
diff --git a/Source/cmMakefileLibraryTargetGenerator.h b/Source/cmMakefileLibraryTargetGenerator.h
index 02fa029..35e4327 100644
--- a/Source/cmMakefileLibraryTargetGenerator.h
+++ b/Source/cmMakefileLibraryTargetGenerator.h
@@ -27,8 +27,7 @@ protected:
void WriteSharedLibraryRules(bool relink);
void WriteModuleLibraryRules(bool relink);
- void WriteDeviceLibraryRules(const std::string& linkRule,
- const std::string& extraFlags, bool relink);
+ void WriteDeviceLibraryRules(const std::string& linkRule, bool relink);
void WriteLibraryRules(const std::string& linkRule,
const std::string& extraFlags, bool relink);
// MacOSX Framework support methods
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 1f65f08..e8cf255 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -82,6 +82,23 @@ cmMakefileTargetGenerator* cmMakefileTargetGenerator::New(
return result;
}
+void cmMakefileTargetGenerator::GetTargetLinkFlags(
+ std::string& flags, const std::string& linkLanguage)
+{
+ this->LocalGenerator->AppendFlags(
+ flags, this->GeneratorTarget->GetProperty("LINK_FLAGS"));
+
+ std::string linkFlagsConfig = "LINK_FLAGS_";
+ linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
+ this->LocalGenerator->AppendFlags(
+ flags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
+
+ std::vector<std::string> opts;
+ this->GeneratorTarget->GetLinkOptions(opts, this->ConfigName, linkLanguage);
+ // LINK_OPTIONS are escaped.
+ this->LocalGenerator->AppendCompileOptions(flags, opts);
+}
+
void cmMakefileTargetGenerator::CreateRuleFile()
{
// Create a directory for this target.
@@ -107,7 +124,7 @@ void cmMakefileTargetGenerator::CreateRuleFile()
// Open the rule file. This should be copy-if-different because the
// rules may depend on this file itself.
this->BuildFileStream =
- new cmGeneratedFileStream(this->BuildFileNameFull.c_str(), false,
+ new cmGeneratedFileStream(this->BuildFileNameFull, false,
this->GlobalGenerator->GetMakefileEncoding());
this->BuildFileStream->SetCopyIfDifferent(true);
if (!this->BuildFileStream) {
@@ -220,8 +237,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
if (!cmSystemTools::FileExists(dependFileNameFull)) {
// Write an empty dependency file.
cmGeneratedFileStream depFileStream(
- dependFileNameFull.c_str(), false,
- this->GlobalGenerator->GetMakefileEncoding());
+ dependFileNameFull, false, this->GlobalGenerator->GetMakefileEncoding());
depFileStream << "# Empty dependencies file for "
<< this->GeneratorTarget->GetName() << ".\n"
<< "# This may be replaced when dependencies are built."
@@ -233,7 +249,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
this->FlagFileNameFull = this->TargetBuildDirectoryFull;
this->FlagFileNameFull += "/flags.make";
this->FlagFileStream =
- new cmGeneratedFileStream(this->FlagFileNameFull.c_str(), false,
+ new cmGeneratedFileStream(this->FlagFileNameFull, false,
this->GlobalGenerator->GetMakefileEncoding());
this->FlagFileStream->SetCopyIfDifferent(true);
if (!this->FlagFileStream) {
@@ -429,7 +445,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
// Add flags from source file properties.
const std::string COMPILE_FLAGS("COMPILE_FLAGS");
if (const char* cflags = source.GetProperty(COMPILE_FLAGS)) {
- const char* evaluatedFlags =
+ const std::string& evaluatedFlags =
genexInterpreter.Evaluate(cflags, COMPILE_FLAGS);
this->LocalGenerator->AppendFlags(flags, evaluatedFlags);
*this->FlagFileStream << "# Custom flags: " << relativeObj
@@ -439,7 +455,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
const std::string COMPILE_OPTIONS("COMPILE_OPTIONS");
if (const char* coptions = source.GetProperty(COMPILE_OPTIONS)) {
- const char* evaluatedOptions =
+ const std::string& evaluatedOptions =
genexInterpreter.Evaluate(coptions, COMPILE_OPTIONS);
this->LocalGenerator->AppendCompileOptions(flags, evaluatedOptions);
*this->FlagFileStream << "# Custom options: " << relativeObj
@@ -452,7 +468,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
if (const char* cincludes = source.GetProperty(INCLUDE_DIRECTORIES)) {
- const char* evaluatedIncludes =
+ const std::string& evaluatedIncludes =
genexInterpreter.Evaluate(cincludes, INCLUDE_DIRECTORIES);
this->LocalGenerator->AppendIncludeDirectories(includes, evaluatedIncludes,
source);
@@ -468,7 +484,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
// Add source-specific preprocessor definitions.
const std::string COMPILE_DEFINITIONS("COMPILE_DEFINITIONS");
if (const char* compile_defs = source.GetProperty(COMPILE_DEFINITIONS)) {
- const char* evaluatedDefs =
+ const std::string& evaluatedDefs =
genexInterpreter.Evaluate(compile_defs, COMPILE_DEFINITIONS);
this->LocalGenerator->AppendDefines(defines, evaluatedDefs);
*this->FlagFileStream << "# Custom defines: " << relativeObj
@@ -478,7 +494,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
std::string defPropName = "COMPILE_DEFINITIONS_";
defPropName += configUpper;
if (const char* config_compile_defs = source.GetProperty(defPropName)) {
- const char* evaluatedDefs =
+ const std::string& evaluatedDefs =
genexInterpreter.Evaluate(config_compile_defs, COMPILE_DEFINITIONS);
this->LocalGenerator->AppendDefines(defines, evaluatedDefs);
*this->FlagFileStream << "# Custom defines: " << relativeObj << "_DEFINES_"
@@ -957,8 +973,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
this->InfoFileNameFull += "/DependInfo.cmake";
this->InfoFileNameFull =
this->LocalGenerator->ConvertToFullPath(this->InfoFileNameFull);
- this->InfoFileStream =
- new cmGeneratedFileStream(this->InfoFileNameFull.c_str());
+ this->InfoFileStream = new cmGeneratedFileStream(this->InfoFileNameFull);
this->InfoFileStream->SetCopyIfDifferent(true);
if (!*this->InfoFileStream) {
return;
@@ -1370,7 +1385,7 @@ void cmMakefileTargetGenerator::AppendObjectDepends(
}
void cmMakefileTargetGenerator::AppendLinkDepends(
- std::vector<std::string>& depends)
+ std::vector<std::string>& depends, const std::string& linkLanguage)
{
this->AppendObjectDepends(depends);
@@ -1394,10 +1409,8 @@ void cmMakefileTargetGenerator::AppendLinkDepends(
}
// Add user-specified dependencies.
- if (const char* linkDepends =
- this->GeneratorTarget->GetProperty("LINK_DEPENDS")) {
- cmSystemTools::ExpandListArgument(linkDepends, depends);
- }
+ this->GeneratorTarget->GetLinkDepends(depends, this->ConfigName,
+ linkLanguage);
}
std::string cmMakefileTargetGenerator::GetLinkRule(
@@ -1431,7 +1444,7 @@ void cmMakefileTargetGenerator::CreateLinkScript(
std::string linkScriptName = this->TargetBuildDirectoryFull;
linkScriptName += "/";
linkScriptName += name;
- cmGeneratedFileStream linkScriptStream(linkScriptName.c_str());
+ cmGeneratedFileStream linkScriptStream(linkScriptName);
linkScriptStream.SetCopyIfDifferent(true);
for (std::string const& link_command : link_commands) {
// Do not write out empty commands or commands beginning in the
@@ -1515,7 +1528,7 @@ std::string cmMakefileTargetGenerator::CreateResponseFile(
std::string responseFileNameFull = this->TargetBuildDirectoryFull;
responseFileNameFull += "/";
responseFileNameFull += name;
- cmGeneratedFileStream responseStream(responseFileNameFull.c_str());
+ cmGeneratedFileStream responseStream(responseFileNameFull);
responseStream.SetCopyIfDifferent(true);
responseStream << options << "\n";
@@ -1703,7 +1716,7 @@ void cmMakefileTargetGenerator::GenDefFile(
cmOutputConverter::SHELL);
real_link_commands.insert(real_link_commands.begin(), cmd);
// create a list of obj files for the -E __create_def to read
- cmGeneratedFileStream fout(objlist_file.c_str());
+ cmGeneratedFileStream fout(objlist_file);
if (mdi->WindowsExportAllSymbols) {
for (std::string const& obj : this->Objects) {
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index 7af3cf3..f21362a 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -52,6 +52,8 @@ public:
cmGeneratorTarget* GetGeneratorTarget() { return this->GeneratorTarget; }
protected:
+ void GetTargetLinkFlags(std::string& flags, const std::string& linkLanguage);
+
// create the file and directory etc
void CreateRuleFile();
@@ -126,7 +128,8 @@ protected:
void AppendObjectDepends(std::vector<std::string>& depends);
// Append link rule dependencies (objects, etc.).
- void AppendLinkDepends(std::vector<std::string>& depends);
+ void AppendLinkDepends(std::vector<std::string>& depends,
+ const std::string& linkLanguage);
// Lookup the link rule for this target.
std::string GetLinkRule(const std::string& linkRuleVar);
diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx
index c1cd1b6..a50e5fc 100644
--- a/Source/cmMathCommand.cxx
+++ b/Source/cmMathCommand.cxx
@@ -2,10 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMathCommand.h"
-#include <stdio.h>
-
#include "cmExprParserHelper.h"
#include "cmMakefile.h"
+#include "cm_kwiml.h"
+#include "cmake.h"
+
+#include <stdio.h>
class cmExecutionStatus;
@@ -27,24 +29,83 @@ bool cmMathCommand::InitialPass(std::vector<std::string> const& args,
bool cmMathCommand::HandleExprCommand(std::vector<std::string> const& args)
{
- if (args.size() != 3) {
+ if ((args.size() != 3) && (args.size() != 5)) {
this->SetError("EXPR called with incorrect arguments.");
return false;
}
+ enum class NumericFormat
+ {
+ UNINITIALIZED,
+ DECIMAL,
+ HEXADECIMAL,
+ };
+
const std::string& outputVariable = args[1];
const std::string& expression = args[2];
+ size_t argumentIndex = 3;
+ NumericFormat outputFormat = NumericFormat::UNINITIALIZED;
+
+ this->Makefile->AddDefinition(outputVariable, "ERROR");
+
+ if (argumentIndex < args.size()) {
+ const std::string messageHint = "sub-command EXPR ";
+ const std::string option = args[argumentIndex++];
+ if (option == "OUTPUT_FORMAT") {
+ if (argumentIndex < args.size()) {
+ const std::string argument = args[argumentIndex++];
+ if (argument == "DECIMAL") {
+ outputFormat = NumericFormat::DECIMAL;
+ } else if (argument == "HEXADECIMAL") {
+ outputFormat = NumericFormat::HEXADECIMAL;
+ } else {
+ std::string error = messageHint + "value \"" + argument +
+ "\" for option \"" + option + "\" is invalid.";
+ this->SetError(error);
+ return false;
+ }
+ } else {
+ std::string error =
+ messageHint + "missing argument for option \"" + option + "\".";
+ this->SetError(error);
+ return false;
+ }
+ } else {
+ std::string error =
+ messageHint + "option \"" + option + "\" is unknown.";
+ this->SetError(error);
+ return false;
+ }
+ }
+
+ if (outputFormat == NumericFormat::UNINITIALIZED) {
+ outputFormat = NumericFormat::DECIMAL;
+ }
cmExprParserHelper helper;
if (!helper.ParseString(expression.c_str(), 0)) {
- std::string e = "cannot parse the expression: \"" + expression + "\": ";
- e += helper.GetError();
- this->SetError(e);
+ this->SetError(helper.GetError());
return false;
}
char buffer[1024];
- sprintf(buffer, "%d", helper.GetResult());
+ const char* fmt;
+ switch (outputFormat) {
+ case NumericFormat::HEXADECIMAL:
+ fmt = "0x%" KWIML_INT_PRIx64;
+ break;
+ case NumericFormat::DECIMAL:
+ CM_FALLTHROUGH;
+ default:
+ fmt = "%" KWIML_INT_PRId64;
+ break;
+ }
+ sprintf(buffer, fmt, helper.GetResult());
+
+ std::string const& w = helper.GetWarning();
+ if (!w.empty()) {
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w);
+ }
this->Makefile->AddDefinition(outputVariable, buffer);
return true;
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 7394188..b634b0a 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -625,7 +625,7 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement()
outputs.push_back(targetOutputReal);
// Compute specific libraries to link with.
cmNinjaDeps explicitDeps = this->GetObjects();
- cmNinjaDeps implicitDeps = this->ComputeLinkDeps();
+ cmNinjaDeps implicitDeps = this->ComputeLinkDeps(this->TargetLinkLanguage);
std::string frameworkPath;
std::string linkPath;
@@ -794,7 +794,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
// Compute specific libraries to link with.
cmNinjaDeps explicitDeps = this->GetObjects();
- cmNinjaDeps implicitDeps = this->ComputeLinkDeps();
+ cmNinjaDeps implicitDeps = this->ComputeLinkDeps(this->TargetLinkLanguage);
if (!this->DeviceLinkObject.empty()) {
explicitDeps.push_back(this->DeviceLinkObject);
@@ -956,7 +956,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
preLinkCmdLines.push_back(std::move(cmd));
// create a list of obj files for the -E __create_def to read
- cmGeneratedFileStream fout(obj_list_file.c_str());
+ cmGeneratedFileStream fout(obj_list_file);
if (mdi->WindowsExportAllSymbols) {
cmNinjaDeps objs = this->GetObjects();
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 9d41948..1cfaac5 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -235,7 +235,8 @@ std::string cmNinjaTargetGenerator::ComputeIncludes(
return includesString;
}
-cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
+cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps(
+ const std::string& linkLanguage) const
{
// Static libraries never depend on other targets for linking.
if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY ||
@@ -270,13 +271,11 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
}
// Add user-specified dependencies.
- if (const char* linkDepends =
- this->GeneratorTarget->GetProperty("LINK_DEPENDS")) {
- std::vector<std::string> linkDeps;
- cmSystemTools::ExpandListArgument(linkDepends, linkDeps);
- std::transform(linkDeps.begin(), linkDeps.end(),
- std::back_inserter(result), MapToNinjaPath());
- }
+ std::vector<std::string> linkDeps;
+ this->GeneratorTarget->GetLinkDepends(linkDeps, this->ConfigName,
+ linkLanguage);
+ std::transform(linkDeps.begin(), linkDeps.end(), std::back_inserter(result),
+ MapToNinjaPath());
return result;
}
@@ -1134,7 +1133,7 @@ void cmNinjaTargetGenerator::WriteTargetDependInfo(std::string const& lang)
}
std::string const tdin = this->GetTargetDependInfoPath(lang);
- cmGeneratedFileStream tdif(tdin.c_str());
+ cmGeneratedFileStream tdif(tdin);
tdif << tdi;
}
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 4660a3a..e58a8a0 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -95,7 +95,7 @@ protected:
}
/// @return the list of link dependency for the given target @a target.
- cmNinjaDeps ComputeLinkDeps() const;
+ cmNinjaDeps ComputeLinkDeps(const std::string& linkLanguage) const;
/// @return the source file path for the given @a source.
std::string GetSourceFilePath(cmSourceFile const* source) const;
diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx
index 00a2d2b..239cd00 100644
--- a/Source/cmOptionCommand.cxx
+++ b/Source/cmOptionCommand.cxx
@@ -2,11 +2,16 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmOptionCommand.h"
+#include <sstream>
+
#include "cmAlgorithms.h"
#include "cmMakefile.h"
+#include "cmPolicies.h"
#include "cmState.h"
+#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
+#include "cmake.h"
class cmExecutionStatus;
@@ -14,19 +19,7 @@ class cmExecutionStatus;
bool cmOptionCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- bool argError = false;
- if (args.size() < 2) {
- argError = true;
- }
- // for VTK 4.0 we have to support the option command with more than 3
- // arguments if CMAKE_MINIMUM_REQUIRED_VERSION is not defined, if
- // CMAKE_MINIMUM_REQUIRED_VERSION is defined, then we can have stricter
- // checking.
- if (this->Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION")) {
- if (args.size() > 3) {
- argError = true;
- }
- }
+ const bool argError = (args.size() < 2) || (args.size() > 3);
if (argError) {
std::string m = "called with incorrect number of arguments: ";
m += cmJoin(args, " ");
@@ -34,23 +27,62 @@ bool cmOptionCommand::InitialPass(std::vector<std::string> const& args,
return false;
}
- std::string initialValue = "Off";
- // Now check and see if the value has been stored in the cache
- // already, if so use that value and don't look for the program
+ // Determine the state of the option policy
+ bool checkAndWarn = false;
+ {
+ auto status = this->Makefile->GetPolicyStatus(cmPolicies::CMP0077);
+ const char* existsBeforeSet =
+ this->Makefile->GetStateSnapshot().GetDefinition(args[0]);
+ switch (status) {
+ case cmPolicies::WARN:
+ checkAndWarn = (existsBeforeSet != nullptr);
+ break;
+ case cmPolicies::OLD:
+ // OLD behavior does not warn.
+ break;
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::NEW: {
+ // See if a local variable with this name already exists.
+ // If so we ignore the option command.
+ if (existsBeforeSet) {
+ return true;
+ }
+ } break;
+ }
+ }
+
+ // See if a cache variable with this name already exists
+ // If so just make sure the doc state is correct
cmState* state = this->Makefile->GetState();
const char* existingValue = state->GetCacheEntryValue(args[0]);
- if (existingValue) {
- if (state->GetCacheEntryType(args[0]) != cmStateEnums::UNINITIALIZED) {
- state->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]);
- return true;
- }
- initialValue = existingValue;
+ if (existingValue &&
+ (state->GetCacheEntryType(args[0]) != cmStateEnums::UNINITIALIZED)) {
+ state->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]);
+ return true;
}
+
+ // Nothing in the cache so add it
+ std::string initialValue = existingValue ? existingValue : "Off";
if (args.size() == 3) {
initialValue = args[2];
}
bool init = cmSystemTools::IsOn(initialValue.c_str());
this->Makefile->AddCacheDefinition(args[0], init ? "ON" : "OFF",
args[1].c_str(), cmStateEnums::BOOL);
+
+ if (checkAndWarn) {
+ const char* existsAfterSet =
+ this->Makefile->GetStateSnapshot().GetDefinition(args[0]);
+ if (!existsAfterSet) {
+ std::ostringstream w;
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0077)
+ << "\n"
+ "For compatibility with older versions of CMake, option "
+ "is clearing the normal variable '"
+ << args[0] << "'.";
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ }
+ }
return true;
}
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index fd42c53..dbe6fa1 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -83,9 +83,9 @@ bool cmOutputConverter::ContainedInDirectory(std::string const& local_path,
std::string const& remote_path,
cmStateDirectory const& directory)
{
- const std::string relativePathTopBinary =
+ const std::string& relativePathTopBinary =
directory.GetRelativePathTopBinary();
- const std::string relativePathTopSource =
+ const std::string& relativePathTopSource =
directory.GetRelativePathTopSource();
const bool bothInBinary =
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index bdb98ca..e2de3f9 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -356,8 +356,7 @@ protected:
if (!found) {
// Couldn't find any dependency information.
- if (this->ComplainFileRegularExpression.find(
- info->IncludeName.c_str())) {
+ if (this->ComplainFileRegularExpression.find(info->IncludeName)) {
cmSystemTools::Error("error cannot find dependencies for ", path);
} else {
// Destroy the name of the file so that it won't be output as a
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 1ef1813..91ed924 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -223,6 +223,13 @@ class cmMakefile;
3, 12, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0075, \
"Include file check macros honor CMAKE_REQUIRED_LIBRARIES.", 3, 12, \
+ 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0076, \
+ "target_sources() command converts relative paths to absolute.", 3, \
+ 13, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0077, "option() honors normal variables.", 3, 13, 0, \
+ cmPolicies::WARN) \
+ SELECT(POLICY, CMP0078, "UseSWIG generates standard target names.", 3, 13, \
0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
@@ -248,7 +255,8 @@ class cmMakefile;
F(CMP0065) \
F(CMP0068) \
F(CMP0069) \
- F(CMP0073)
+ F(CMP0073) \
+ F(CMP0076)
/** \class cmPolicies
* \brief Handles changes in CMake behavior and policies
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index ee44007..305c7a6 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -35,19 +35,19 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
srcdir += "_SOURCE_DIR";
this->Makefile->AddCacheDefinition(
- bindir, this->Makefile->GetCurrentBinaryDirectory(),
+ bindir, this->Makefile->GetCurrentBinaryDirectory().c_str(),
"Value Computed by CMake", cmStateEnums::STATIC);
this->Makefile->AddCacheDefinition(
- srcdir, this->Makefile->GetCurrentSourceDirectory(),
+ srcdir, this->Makefile->GetCurrentSourceDirectory().c_str(),
"Value Computed by CMake", cmStateEnums::STATIC);
bindir = "PROJECT_BINARY_DIR";
srcdir = "PROJECT_SOURCE_DIR";
- this->Makefile->AddDefinition(bindir,
- this->Makefile->GetCurrentBinaryDirectory());
- this->Makefile->AddDefinition(srcdir,
- this->Makefile->GetCurrentSourceDirectory());
+ this->Makefile->AddDefinition(
+ bindir, this->Makefile->GetCurrentBinaryDirectory().c_str());
+ this->Makefile->AddDefinition(
+ srcdir, this->Makefile->GetCurrentSourceDirectory().c_str());
this->Makefile->AddDefinition("PROJECT_NAME", projectName.c_str());
diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h
index a3e16ac..4118dc7 100644
--- a/Source/cmQtAutoGen.h
+++ b/Source/cmQtAutoGen.h
@@ -28,6 +28,32 @@ public:
RCC
};
+ /// @brief Integer version
+ struct IntegerVersion
+ {
+ unsigned int Major = 0;
+ unsigned int Minor = 0;
+
+ IntegerVersion() = default;
+ IntegerVersion(unsigned int major, unsigned int minor)
+ : Major(major)
+ , Minor(minor)
+ {
+ }
+
+ bool operator>(IntegerVersion const version)
+ {
+ return (this->Major > version.Major) ||
+ ((this->Major == version.Major) && (this->Minor > version.Minor));
+ }
+
+ bool operator>=(IntegerVersion const version)
+ {
+ return (this->Major > version.Major) ||
+ ((this->Major == version.Major) && (this->Minor >= version.Minor));
+ }
+ };
+
public:
/// @brief Returns the generator name
static std::string const& GeneratorName(GeneratorT genType);
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 34196d9..5dd3c8b 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -37,23 +37,6 @@
#include <utility>
#include <vector>
-inline static const char* SafeString(const char* value)
-{
- return (value != nullptr) ? value : "";
-}
-
-inline static std::string GetSafeProperty(cmGeneratorTarget const* target,
- const char* key)
-{
- return std::string(SafeString(target->GetProperty(key)));
-}
-
-inline static std::string GetSafeProperty(cmSourceFile const* sf,
- const char* key)
-{
- return std::string(SafeString(sf->GetProperty(key)));
-}
-
static std::size_t GetParallelCPUCount()
{
static std::size_t count = 0;
@@ -190,21 +173,20 @@ static bool StaticLibraryCycle(cmGeneratorTarget const* targetOrigin,
return cycle;
}
-cmQtAutoGenInitializer::cmQtAutoGenInitializer(
- cmGeneratorTarget* target, bool mocEnabled, bool uicEnabled, bool rccEnabled,
- std::string const& qtVersionMajor)
+cmQtAutoGenInitializer::cmQtAutoGenInitializer(cmGeneratorTarget* target,
+ bool mocEnabled,
+ bool uicEnabled,
+ bool rccEnabled,
+ IntegerVersion const& qtVersion)
: Target(target)
- , MocEnabled(mocEnabled)
- , UicEnabled(uicEnabled)
- , RccEnabled(rccEnabled)
- , MultiConfig(false)
- , QtVersionMajor(qtVersionMajor)
+ , QtVersion(qtVersion)
{
- this->QtVersionMinor =
- cmQtAutoGenInitializer::GetQtMinorVersion(target, this->QtVersionMajor);
+ Moc.Enabled = mocEnabled;
+ Uic.Enabled = uicEnabled;
+ Rcc.Enabled = rccEnabled;
}
-void cmQtAutoGenInitializer::InitCustomTargets()
+bool cmQtAutoGenInitializer::InitCustomTargets()
{
cmMakefile* makefile = this->Target->Target->GetMakefile();
cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
@@ -217,48 +199,18 @@ void cmQtAutoGenInitializer::InitCustomTargets()
this->ConfigsList.push_back(this->ConfigDefault);
}
- // Autogen target name
- this->AutogenTargetName = this->Target->GetName();
- this->AutogenTargetName += "_autogen";
-
- // Autogen directories
- {
- // Collapsed current binary directory
- std::string const cbd = cmSystemTools::CollapseFullPath(
- "", makefile->GetCurrentBinaryDirectory());
-
- // Autogen info dir
- this->DirInfo = cbd;
- this->DirInfo += makefile->GetCMakeInstance()->GetCMakeFilesDirectory();
- this->DirInfo += '/';
- this->DirInfo += this->AutogenTargetName;
- this->DirInfo += ".dir";
- cmSystemTools::ConvertToUnixSlashes(this->DirInfo);
-
- // Autogen build dir
- this->DirBuild = GetSafeProperty(this->Target, "AUTOGEN_BUILD_DIR");
- if (this->DirBuild.empty()) {
- this->DirBuild = cbd;
- this->DirBuild += '/';
- this->DirBuild += this->AutogenTargetName;
+ // Verbosity
+ this->Verbosity = makefile->GetSafeDefinition("CMAKE_AUTOGEN_VERBOSE");
+ if (!this->Verbosity.empty()) {
+ unsigned long iVerb = 0;
+ if (!cmSystemTools::StringToULong(this->Verbosity.c_str(), &iVerb)) {
+ // Non numeric verbosity
+ this->Verbosity =
+ cmSystemTools::IsOn(this->Verbosity.c_str()) ? "1" : "0";
}
- cmSystemTools::ConvertToUnixSlashes(this->DirBuild);
-
- // Working directory
- this->DirWork = cbd;
- cmSystemTools::ConvertToUnixSlashes(this->DirWork);
}
- // Autogen files
- {
- this->AutogenInfoFile = this->DirInfo;
- this->AutogenInfoFile += "/AutogenInfo.cmake";
-
- this->AutogenSettingsFile = this->DirInfo;
- this->AutogenSettingsFile += "/AutogenOldSettings.txt";
- }
-
- // Autogen target FOLDER property
+ // Targets FOLDER
{
const char* folder =
makefile->GetState()->GetGlobalProperty("AUTOMOC_TARGETS_FOLDER");
@@ -268,107 +220,321 @@ void cmQtAutoGenInitializer::InitCustomTargets()
}
// Inherit FOLDER property from target (#13688)
if (folder == nullptr) {
- folder = SafeString(this->Target->Target->GetProperty("FOLDER"));
+ folder = this->Target->GetProperty("FOLDER");
}
if (folder != nullptr) {
- this->AutogenFolder = folder;
+ this->TargetsFolder = folder;
}
}
- std::set<std::string> autogenDependFiles;
- std::set<cmTarget*> autogenDependTargets;
- std::vector<std::string> autogenProvides;
-
- // Remove build directories on cleanup
- AddCleanFile(makefile, this->DirBuild);
- // Remove old settings on cleanup
+ // Common directories
{
- std::string base = this->DirInfo;
- base += "/AutogenOldSettings";
+ // Collapsed current binary directory
+ std::string const cbd = cmSystemTools::CollapseFullPath(
+ std::string(), makefile->GetCurrentBinaryDirectory());
+
+ // Info directory
+ this->Dir.Info = cbd;
+ this->Dir.Info += makefile->GetCMakeInstance()->GetCMakeFilesDirectory();
+ this->Dir.Info += '/';
+ this->Dir.Info += this->Target->GetName();
+ this->Dir.Info += "_autogen";
+ this->Dir.Info += ".dir";
+ cmSystemTools::ConvertToUnixSlashes(this->Dir.Info);
+
+ // Build directory
+ this->Dir.Build = this->Target->GetSafeProperty("AUTOGEN_BUILD_DIR");
+ if (this->Dir.Build.empty()) {
+ this->Dir.Build = cbd;
+ this->Dir.Build += '/';
+ this->Dir.Build += this->Target->GetName();
+ this->Dir.Build += "_autogen";
+ }
+ cmSystemTools::ConvertToUnixSlashes(this->Dir.Build);
+ // Cleanup build directory
+ AddCleanFile(makefile, this->Dir.Build);
+
+ // Working directory
+ this->Dir.Work = cbd;
+ cmSystemTools::ConvertToUnixSlashes(this->Dir.Work);
+
+ // Include directory
+ this->Dir.Include = this->Dir.Build;
+ this->Dir.Include += "/include";
+ if (this->MultiConfig) {
+ this->Dir.Include += "_$<CONFIG>";
+ }
+ // Per config include directories
if (this->MultiConfig) {
for (std::string const& cfg : this->ConfigsList) {
- std::string filename = base;
- filename += '_';
- filename += cfg;
- filename += ".cmake";
- AddCleanFile(makefile, filename);
+ std::string& dir = this->Dir.ConfigInclude[cfg];
+ dir = this->Dir.Build;
+ dir += "/include_";
+ dir += cfg;
}
- } else {
- AddCleanFile(makefile, base.append(".cmake"));
}
}
- // Add moc compilation to generated files list
- if (this->MocEnabled) {
- std::string mocsComp = this->DirBuild + "/mocs_compilation.cpp";
- this->AddGeneratedSource(mocsComp, GeneratorT::MOC);
- autogenProvides.push_back(std::move(mocsComp));
+ // Moc, Uic and _autogen target settings
+ if (this->Moc.Enabled || this->Uic.Enabled) {
+ // Init moc specific settings
+ if (this->Moc.Enabled && !InitMoc()) {
+ return false;
+ }
+
+ // Init uic specific settings
+ if (this->Uic.Enabled && !InitUic()) {
+ return false;
+ }
+
+ // Autogen target name
+ this->AutogenTarget.Name = this->Target->GetName();
+ this->AutogenTarget.Name += "_autogen";
+
+ // Autogen target parallel processing
+ this->AutogenTarget.Parallel =
+ this->Target->GetSafeProperty("AUTOGEN_PARALLEL");
+ if (this->AutogenTarget.Parallel.empty() ||
+ (this->AutogenTarget.Parallel == "AUTO")) {
+ // Autodetect number of CPUs
+ this->AutogenTarget.Parallel = std::to_string(GetParallelCPUCount());
+ }
+
+ // Autogen target info and settings files
+ {
+ this->AutogenTarget.InfoFile = this->Dir.Info;
+ this->AutogenTarget.InfoFile += "/AutogenInfo.cmake";
+
+ this->AutogenTarget.SettingsFile = this->Dir.Info;
+ this->AutogenTarget.SettingsFile += "/AutogenOldSettings.txt";
+
+ if (this->MultiConfig) {
+ for (std::string const& cfg : this->ConfigsList) {
+ std::string& filename = this->AutogenTarget.ConfigSettingsFile[cfg];
+ filename =
+ AppendFilenameSuffix(this->AutogenTarget.SettingsFile, "_" + cfg);
+ AddCleanFile(makefile, filename);
+ }
+ } else {
+ AddCleanFile(makefile, this->AutogenTarget.SettingsFile);
+ }
+ }
+
+ // Autogen target: Compute user defined dependencies
+ {
+ std::string const deps =
+ this->Target->GetSafeProperty("AUTOGEN_TARGET_DEPENDS");
+ if (!deps.empty()) {
+ std::vector<std::string> extraDeps;
+ cmSystemTools::ExpandListArgument(deps, extraDeps);
+ for (std::string const& depName : extraDeps) {
+ // Allow target and file dependencies
+ auto* depTarget = makefile->FindTargetToUse(depName);
+ if (depTarget != nullptr) {
+ this->AutogenTarget.DependTargets.insert(depTarget);
+ } else {
+ this->AutogenTarget.DependFiles.insert(depName);
+ }
+ }
+ }
+ }
}
- // Add autogen includes directory to the origin target INCLUDE_DIRECTORIES
- if (this->MocEnabled || this->UicEnabled ||
- (this->RccEnabled && this->MultiConfig)) {
- std::string includeDir = this->DirBuild;
- includeDir += "/include";
+ // Init rcc specific settings
+ if (this->Rcc.Enabled && !InitRcc()) {
+ return false;
+ }
+
+ // Add autogen include directory to the origin target INCLUDE_DIRECTORIES
+ if (this->Moc.Enabled || this->Uic.Enabled ||
+ (this->Rcc.Enabled && this->MultiConfig)) {
+ this->Target->AddIncludeDirectory(this->Dir.Include, true);
+ }
+
+ // Scan files
+ if (!this->InitScanFiles()) {
+ return false;
+ }
+
+ // Create autogen target
+ if ((this->Moc.Enabled || this->Uic.Enabled) && !this->InitAutogenTarget()) {
+ return false;
+ }
+
+ // Create rcc targets
+ if (this->Rcc.Enabled && !this->InitRccTargets()) {
+ return false;
+ }
+
+ return true;
+}
+
+bool cmQtAutoGenInitializer::InitMoc()
+{
+ cmMakefile* makefile = this->Target->Target->GetMakefile();
+ cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
+
+ // Mocs compilation file
+ this->Moc.MocsCompilation = this->Dir.Build;
+ this->Moc.MocsCompilation += "/mocs_compilation.cpp";
+
+ // Moc predefs command
+ if (this->Target->GetPropertyAsBool("AUTOMOC_COMPILER_PREDEFINES") &&
+ (this->QtVersion >= IntegerVersion(5, 8))) {
+ this->Moc.PredefsCmd =
+ makefile->GetSafeDefinition("CMAKE_CXX_COMPILER_PREDEFINES_COMMAND");
+ }
+
+ // Moc includes
+ {
+ bool const appendImplicit = (this->QtVersion.Major == 5);
+ auto GetIncludeDirs =
+ [this, localGen, appendImplicit](std::string const& cfg) -> std::string {
+ // Get the include dirs for this target, without stripping the implicit
+ // include dirs off, see
+ // https://gitlab.kitware.com/cmake/cmake/issues/13667
+ std::vector<std::string> dirs;
+ localGen->GetIncludeDirectories(dirs, this->Target, "CXX", cfg, false,
+ appendImplicit);
+ return cmJoin(dirs, ";");
+ };
+
+ // Default configuration include directories
+ this->Moc.Includes = GetIncludeDirs(this->ConfigDefault);
+ // Other configuration settings
if (this->MultiConfig) {
- includeDir += "_$<CONFIG>";
+ for (std::string const& cfg : this->ConfigsList) {
+ std::string dirs = GetIncludeDirs(cfg);
+ if (dirs != this->Moc.Includes) {
+ this->Moc.ConfigIncludes[cfg] = std::move(dirs);
+ }
+ }
}
- this->Target->AddIncludeDirectory(includeDir, true);
}
- // Acquire rcc executable and features
- if (this->RccEnabled) {
- {
- std::string err;
- if (this->QtVersionMajor == "5") {
- cmGeneratorTarget* tgt =
- localGen->FindGeneratorTargetToUse("Qt5::rcc");
- if (tgt != nullptr) {
- this->RccExecutable = SafeString(tgt->ImportedGetLocation(""));
- } else {
- err = "AUTORCC: Qt5::rcc target not found";
- }
- } else if (QtVersionMajor == "4") {
- cmGeneratorTarget* tgt =
- localGen->FindGeneratorTargetToUse("Qt4::rcc");
- if (tgt != nullptr) {
- this->RccExecutable = SafeString(tgt->ImportedGetLocation(""));
- } else {
- err = "AUTORCC: Qt4::rcc target not found";
+ // Moc compile definitions
+ {
+ auto GetCompileDefinitions =
+ [this, localGen](std::string const& cfg) -> std::string {
+ std::set<std::string> defines;
+ localGen->AddCompileDefinitions(defines, this->Target, cfg, "CXX");
+ return cmJoin(defines, ";");
+ };
+
+ // Default configuration defines
+ this->Moc.Defines = GetCompileDefinitions(this->ConfigDefault);
+ // Other configuration defines
+ if (this->MultiConfig) {
+ for (std::string const& cfg : this->ConfigsList) {
+ std::string defines = GetCompileDefinitions(cfg);
+ if (defines != this->Moc.Defines) {
+ this->Moc.ConfigDefines[cfg] = std::move(defines);
}
- } else {
- err = "The AUTORCC feature supports only Qt 4 and Qt 5";
}
- if (!err.empty()) {
- err += " (";
- err += this->Target->GetName();
- err += ")";
- cmSystemTools::Error(err.c_str());
+ }
+ }
+
+ // Moc executable
+ if (!GetMocExecutable()) {
+ return false;
+ }
+
+ return true;
+}
+
+bool cmQtAutoGenInitializer::InitUic()
+{
+ cmMakefile* makefile = this->Target->Target->GetMakefile();
+
+ // Uic search paths
+ {
+ std::string const usp =
+ this->Target->GetSafeProperty("AUTOUIC_SEARCH_PATHS");
+ if (!usp.empty()) {
+ cmSystemTools::ExpandListArgument(usp, this->Uic.SearchPaths);
+ std::string const& srcDir = makefile->GetCurrentSourceDirectory();
+ for (std::string& path : this->Uic.SearchPaths) {
+ path = cmSystemTools::CollapseFullPath(path, srcDir);
}
}
- // Detect if rcc supports (-)-list
- if (!this->RccExecutable.empty() && (this->QtVersionMajor == "5")) {
- std::vector<std::string> command;
- command.push_back(this->RccExecutable);
- command.push_back("--help");
- std::string rccStdOut;
- std::string rccStdErr;
- int retVal = 0;
- bool result = cmSystemTools::RunSingleCommand(
- command, &rccStdOut, &rccStdErr, &retVal, nullptr,
- cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto);
- if (result && retVal == 0 &&
- rccStdOut.find("--list") != std::string::npos) {
- this->RccListOptions.push_back("--list");
- } else {
- this->RccListOptions.push_back("-list");
+ }
+ // Uic target options
+ {
+ auto UicGetOpts = [this](std::string const& cfg) -> std::string {
+ std::vector<std::string> opts;
+ this->Target->GetAutoUicOptions(opts, cfg);
+ return cmJoin(opts, ";");
+ };
+
+ // Default settings
+ this->Uic.Options = UicGetOpts(this->ConfigDefault);
+
+ // Configuration specific settings
+ if (this->MultiConfig) {
+ for (std::string const& cfg : this->ConfigsList) {
+ std::string options = UicGetOpts(cfg);
+ if (options != this->Uic.Options) {
+ this->Uic.ConfigOptions[cfg] = std::move(options);
+ }
+ }
+ }
+ }
+ // .ui files skip and options
+ {
+ std::string const uiExt = "ui";
+ std::string pathError;
+ for (cmSourceFile* sf : makefile->GetSourceFiles()) {
+ // sf->GetExtension() is only valid after sf->GetFullPath() ...
+ // Since we're iterating over source files that might be not in the
+ // target we need to check for path errors (not existing files).
+ std::string const& fPath = sf->GetFullPath(&pathError);
+ if (!pathError.empty()) {
+ pathError.clear();
+ continue;
+ }
+ if (sf->GetExtension() == uiExt) {
+ std::string const absFile = cmSystemTools::GetRealPath(fPath);
+ // Check if the .ui file should be skipped
+ if (sf->GetPropertyAsBool("SKIP_AUTOUIC") ||
+ sf->GetPropertyAsBool("SKIP_AUTOGEN")) {
+ this->Uic.Skip.insert(absFile);
+ }
+ // Check if the .ui file has uic options
+ std::string const uicOpts = sf->GetSafeProperty("AUTOUIC_OPTIONS");
+ if (!uicOpts.empty()) {
+ // Check if file isn't skipped
+ if (this->Uic.Skip.count(absFile) == 0) {
+ this->Uic.FileFiles.push_back(absFile);
+ std::vector<std::string> optsVec;
+ cmSystemTools::ExpandListArgument(uicOpts, optsVec);
+ this->Uic.FileOptions.push_back(std::move(optsVec));
+ }
+ }
}
}
}
- // Extract relevant source files
- std::vector<std::string> generatedSources;
- std::vector<std::string> generatedHeaders;
+ // Uic executable
+ if (!GetUicExecutable()) {
+ return false;
+ }
+
+ return true;
+}
+
+bool cmQtAutoGenInitializer::InitRcc()
+{
+ if (!GetRccExecutable()) {
+ return false;
+ }
+ return true;
+}
+
+bool cmQtAutoGenInitializer::InitScanFiles()
+{
+ cmMakefile* makefile = this->Target->Target->GetMakefile();
+
+ // Scan through target files
{
std::string const qrcExt = "qrc";
std::vector<cmSourceFile*> srcFiles;
@@ -381,34 +547,34 @@ void cmQtAutoGenInitializer::InitCustomTargets()
std::string const& fPath = sf->GetFullPath();
std::string const& ext = sf->GetExtension();
// Register generated files that will be scanned by moc or uic
- if (this->MocEnabled || this->UicEnabled) {
+ if (this->Moc.Enabled || this->Uic.Enabled) {
cmSystemTools::FileFormat const fileType =
cmSystemTools::GetFileFormat(ext.c_str());
if ((fileType == cmSystemTools::CXX_FILE_FORMAT) ||
(fileType == cmSystemTools::HEADER_FILE_FORMAT)) {
std::string const absPath = cmSystemTools::GetRealPath(fPath);
- if ((this->MocEnabled && !sf->GetPropertyAsBool("SKIP_AUTOMOC")) ||
- (this->UicEnabled && !sf->GetPropertyAsBool("SKIP_AUTOUIC"))) {
+ if ((this->Moc.Enabled && !sf->GetPropertyAsBool("SKIP_AUTOMOC")) ||
+ (this->Uic.Enabled && !sf->GetPropertyAsBool("SKIP_AUTOUIC"))) {
// Register source
const bool generated = sf->GetPropertyAsBool("GENERATED");
if (fileType == cmSystemTools::HEADER_FILE_FORMAT) {
if (generated) {
- generatedHeaders.push_back(absPath);
+ this->AutogenTarget.HeadersGenerated.push_back(absPath);
} else {
- this->Headers.push_back(absPath);
+ this->AutogenTarget.Headers.push_back(absPath);
}
} else {
if (generated) {
- generatedSources.push_back(absPath);
+ this->AutogenTarget.SourcesGenerated.push_back(absPath);
} else {
- this->Sources.push_back(absPath);
+ this->AutogenTarget.Sources.push_back(absPath);
}
}
}
}
}
// Register rcc enabled files
- if (this->RccEnabled && (ext == qrcExt) &&
+ if (this->Rcc.Enabled && (ext == qrcExt) &&
!sf->GetPropertyAsBool("SKIP_AUTORCC")) {
// Register qrc file
{
@@ -419,148 +585,155 @@ void cmQtAutoGenInitializer::InitCustomTargets()
qrc.Generated = sf->GetPropertyAsBool("GENERATED");
// RCC options
{
- std::string const opts = GetSafeProperty(sf, "AUTORCC_OPTIONS");
+ std::string const opts = sf->GetSafeProperty("AUTORCC_OPTIONS");
if (!opts.empty()) {
cmSystemTools::ExpandListArgument(opts, qrc.Options);
}
}
- this->Qrcs.push_back(std::move(qrc));
+ this->Rcc.Qrcs.push_back(std::move(qrc));
}
}
}
- // cmGeneratorTarget::GetConfigCommonSourceFiles computes the target's
- // sources meta data cache. Clear it so that OBJECT library targets that
- // are AUTOGEN initialized after this target get their added
- // mocs_compilation.cpp source acknowledged by this target.
- this->Target->ClearSourcesCache();
}
- // Read skip files from makefile sources
- if (this->MocEnabled || this->UicEnabled) {
- std::string pathError;
- for (cmSourceFile* sf : makefile->GetSourceFiles()) {
- // sf->GetExtension() is only valid after sf->GetFullPath() ...
- // Since we're iterating over source files that might be not in the
- // target we need to check for path errors (not existing files).
- std::string const& fPath = sf->GetFullPath(&pathError);
- if (!pathError.empty()) {
- pathError.clear();
- continue;
- }
- cmSystemTools::FileFormat const fileType =
- cmSystemTools::GetFileFormat(sf->GetExtension().c_str());
- if (!(fileType == cmSystemTools::CXX_FILE_FORMAT) &&
- !(fileType == cmSystemTools::HEADER_FILE_FORMAT)) {
- continue;
- }
- const bool skipAll = sf->GetPropertyAsBool("SKIP_AUTOGEN");
- const bool mocSkip =
- this->MocEnabled && (skipAll || sf->GetPropertyAsBool("SKIP_AUTOMOC"));
- const bool uicSkip =
- this->UicEnabled && (skipAll || sf->GetPropertyAsBool("SKIP_AUTOUIC"));
- if (mocSkip || uicSkip) {
- std::string const absFile = cmSystemTools::GetRealPath(fPath);
- if (mocSkip) {
- this->MocSkip.insert(absFile);
+ // cmGeneratorTarget::GetConfigCommonSourceFiles computes the target's
+ // sources meta data cache. Clear it so that OBJECT library targets that
+ // are AUTOGEN initialized after this target get their added
+ // mocs_compilation.cpp source acknowledged by this target.
+ this->Target->ClearSourcesCache();
+
+ if (this->Moc.Enabled || this->Uic.Enabled) {
+ // Read skip files from makefile sources
+ {
+ std::string pathError;
+ for (cmSourceFile* sf : makefile->GetSourceFiles()) {
+ // sf->GetExtension() is only valid after sf->GetFullPath() ...
+ // Since we're iterating over source files that might be not in the
+ // target we need to check for path errors (not existing files).
+ std::string const& fPath = sf->GetFullPath(&pathError);
+ if (!pathError.empty()) {
+ pathError.clear();
+ continue;
+ }
+ cmSystemTools::FileFormat const fileType =
+ cmSystemTools::GetFileFormat(sf->GetExtension().c_str());
+ if (!(fileType == cmSystemTools::CXX_FILE_FORMAT) &&
+ !(fileType == cmSystemTools::HEADER_FILE_FORMAT)) {
+ continue;
}
- if (uicSkip) {
- this->UicSkip.insert(absFile);
+ const bool skipAll = sf->GetPropertyAsBool("SKIP_AUTOGEN");
+ const bool mocSkip = this->Moc.Enabled &&
+ (skipAll || sf->GetPropertyAsBool("SKIP_AUTOMOC"));
+ const bool uicSkip = this->Uic.Enabled &&
+ (skipAll || sf->GetPropertyAsBool("SKIP_AUTOUIC"));
+ if (mocSkip || uicSkip) {
+ std::string const absFile = cmSystemTools::GetRealPath(fPath);
+ if (mocSkip) {
+ this->Moc.Skip.insert(absFile);
+ }
+ if (uicSkip) {
+ this->Uic.Skip.insert(absFile);
+ }
}
}
}
- }
- // Process GENERATED sources and headers
- if (!generatedSources.empty() || !generatedHeaders.empty()) {
- // Check status of policy CMP0071
- bool policyAccept = false;
- bool policyWarn = false;
- cmPolicies::PolicyStatus const CMP0071_status =
- makefile->GetPolicyStatus(cmPolicies::CMP0071);
- switch (CMP0071_status) {
- case cmPolicies::WARN:
- policyWarn = true;
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- // Ignore GENERATED file
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- // Process GENERATED file
- policyAccept = true;
- break;
- }
-
- if (policyAccept) {
- // Accept GENERATED sources
- for (std::string const& absFile : generatedHeaders) {
- this->Headers.push_back(absFile);
- autogenDependFiles.insert(absFile);
- }
- for (std::string const& absFile : generatedSources) {
- this->Sources.push_back(absFile);
- autogenDependFiles.insert(absFile);
+ // Process GENERATED sources and headers
+ if (!this->AutogenTarget.SourcesGenerated.empty() ||
+ !this->AutogenTarget.HeadersGenerated.empty()) {
+ // Check status of policy CMP0071
+ bool policyAccept = false;
+ bool policyWarn = false;
+ cmPolicies::PolicyStatus const CMP0071_status =
+ makefile->GetPolicyStatus(cmPolicies::CMP0071);
+ switch (CMP0071_status) {
+ case cmPolicies::WARN:
+ policyWarn = true;
+ CM_FALLTHROUGH;
+ case cmPolicies::OLD:
+ // Ignore GENERATED file
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ // Process GENERATED file
+ policyAccept = true;
+ break;
}
- } else {
- if (policyWarn) {
- std::string msg;
- msg += cmPolicies::GetPolicyWarning(cmPolicies::CMP0071);
- msg += "\n";
- std::string tools;
- std::string property;
- if (this->MocEnabled && this->UicEnabled) {
- tools = "AUTOMOC and AUTOUIC";
- property = "SKIP_AUTOGEN";
- } else if (this->MocEnabled) {
- tools = "AUTOMOC";
- property = "SKIP_AUTOMOC";
- } else if (this->UicEnabled) {
- tools = "AUTOUIC";
- property = "SKIP_AUTOUIC";
+
+ if (policyAccept) {
+ // Accept GENERATED sources
+ for (std::string const& absFile :
+ this->AutogenTarget.HeadersGenerated) {
+ this->AutogenTarget.Headers.push_back(absFile);
+ this->AutogenTarget.DependFiles.insert(absFile);
}
- msg += "For compatibility, CMake is excluding the GENERATED source "
- "file(s):\n";
- for (const std::string& absFile : generatedHeaders) {
- msg.append(" ").append(Quoted(absFile)).append("\n");
+ for (std::string const& absFile :
+ this->AutogenTarget.SourcesGenerated) {
+ this->AutogenTarget.Sources.push_back(absFile);
+ this->AutogenTarget.DependFiles.insert(absFile);
}
- for (const std::string& absFile : generatedSources) {
- msg.append(" ").append(Quoted(absFile)).append("\n");
+ } else {
+ if (policyWarn) {
+ std::string msg;
+ msg += cmPolicies::GetPolicyWarning(cmPolicies::CMP0071);
+ msg += "\n";
+ std::string tools;
+ std::string property;
+ if (this->Moc.Enabled && this->Uic.Enabled) {
+ tools = "AUTOMOC and AUTOUIC";
+ property = "SKIP_AUTOGEN";
+ } else if (this->Moc.Enabled) {
+ tools = "AUTOMOC";
+ property = "SKIP_AUTOMOC";
+ } else if (this->Uic.Enabled) {
+ tools = "AUTOUIC";
+ property = "SKIP_AUTOUIC";
+ }
+ msg += "For compatibility, CMake is excluding the GENERATED source "
+ "file(s):\n";
+ for (const std::string& absFile :
+ this->AutogenTarget.HeadersGenerated) {
+ msg.append(" ").append(Quoted(absFile)).append("\n");
+ }
+ for (const std::string& absFile :
+ this->AutogenTarget.SourcesGenerated) {
+ msg.append(" ").append(Quoted(absFile)).append("\n");
+ }
+ msg += "from processing by ";
+ msg += tools;
+ msg +=
+ ". If any of the files should be processed, set CMP0071 to NEW. "
+ "If any of the files should not be processed, "
+ "explicitly exclude them by setting the source file property ";
+ msg += property;
+ msg += ":\n set_property(SOURCE file.h PROPERTY ";
+ msg += property;
+ msg += " ON)\n";
+ makefile->IssueMessage(cmake::AUTHOR_WARNING, msg);
}
- msg += "from processing by ";
- msg += tools;
- msg +=
- ". If any of the files should be processed, set CMP0071 to NEW. "
- "If any of the files should not be processed, "
- "explicitly exclude them by setting the source file property ";
- msg += property;
- msg += ":\n set_property(SOURCE file.h PROPERTY ";
- msg += property;
- msg += " ON)\n";
- makefile->IssueMessage(cmake::AUTHOR_WARNING, msg);
}
}
- // Clear lists
- generatedSources.clear();
- generatedHeaders.clear();
- }
- // Sort headers and sources
- if (this->MocEnabled || this->UicEnabled) {
- std::sort(this->Headers.begin(), this->Headers.end());
- std::sort(this->Sources.begin(), this->Sources.end());
+ // Sort headers and sources
+ if (this->Moc.Enabled || this->Uic.Enabled) {
+ std::sort(this->AutogenTarget.Headers.begin(),
+ this->AutogenTarget.Headers.end());
+ std::sort(this->AutogenTarget.Sources.begin(),
+ this->AutogenTarget.Sources.end());
+ }
}
// Process qrc files
- if (!this->Qrcs.empty()) {
- const bool QtV5 = (this->QtVersionMajor == "5");
+ if (!this->Rcc.Qrcs.empty()) {
+ const bool QtV5 = (this->QtVersion.Major == 5);
// Target rcc options
std::vector<std::string> optionsTarget;
cmSystemTools::ExpandListArgument(
- GetSafeProperty(this->Target, "AUTORCC_OPTIONS"), optionsTarget);
+ this->Target->GetSafeProperty("AUTORCC_OPTIONS"), optionsTarget);
// Check if file name is unique
- for (Qrc& qrc : this->Qrcs) {
+ for (Qrc& qrc : this->Rcc.Qrcs) {
qrc.Unique = true;
- for (Qrc const& qrc2 : this->Qrcs) {
+ for (Qrc const& qrc2 : this->Rcc.Qrcs) {
if ((&qrc != &qrc2) && (qrc.QrcName == qrc2.QrcName)) {
qrc.Unique = false;
break;
@@ -570,11 +743,11 @@ void cmQtAutoGenInitializer::InitCustomTargets()
// Path checksum and file names
{
cmFilePathChecksum const fpathCheckSum(makefile);
- for (Qrc& qrc : this->Qrcs) {
+ for (Qrc& qrc : this->Rcc.Qrcs) {
qrc.PathChecksum = fpathCheckSum.getPart(qrc.QrcFile);
// RCC output file name
{
- std::string rccFile = this->DirBuild + "/";
+ std::string rccFile = this->Dir.Build + "/";
rccFile += qrc.PathChecksum;
rccFile += "/qrc_";
rccFile += qrc.QrcName;
@@ -582,7 +755,7 @@ void cmQtAutoGenInitializer::InitCustomTargets()
qrc.RccFile = std::move(rccFile);
}
{
- std::string base = this->DirInfo;
+ std::string base = this->Dir.Info;
base += "/RCC";
base += qrc.QrcName;
if (!qrc.Unique) {
@@ -597,11 +770,18 @@ void cmQtAutoGenInitializer::InitCustomTargets()
qrc.SettingsFile = base;
qrc.SettingsFile += "Settings.txt";
+
+ if (this->MultiConfig) {
+ for (std::string const& cfg : this->ConfigsList) {
+ qrc.ConfigSettingsFile[cfg] =
+ AppendFilenameSuffix(qrc.SettingsFile, "_" + cfg);
+ }
+ }
}
}
}
// RCC options
- for (Qrc& qrc : this->Qrcs) {
+ for (Qrc& qrc : this->Rcc.Qrcs) {
// Target options
std::vector<std::string> opts = optionsTarget;
// Merge computed "-name XYZ" option
@@ -622,313 +802,410 @@ void cmQtAutoGenInitializer::InitCustomTargets()
RccMergeOptions(opts, qrc.Options, QtV5);
qrc.Options = std::move(opts);
}
- for (Qrc& qrc : this->Qrcs) {
- // Register file at target
- this->AddGeneratedSource(qrc.RccFile, GeneratorT::RCC);
-
- std::vector<std::string> ccOutput;
- ccOutput.push_back(qrc.RccFile);
-
- cmCustomCommandLines commandLines;
- if (this->MultiConfig) {
- // Build for all configurations
- for (std::string const& config : this->ConfigsList) {
- cmCustomCommandLine currentLine;
- currentLine.push_back(cmSystemTools::GetCMakeCommand());
- currentLine.push_back("-E");
- currentLine.push_back("cmake_autorcc");
- currentLine.push_back(qrc.InfoFile);
- currentLine.push_back(config);
- commandLines.push_back(std::move(currentLine));
+ // RCC resources
+ for (Qrc& qrc : this->Rcc.Qrcs) {
+ if (!qrc.Generated) {
+ std::string error;
+ if (!RccListInputs(qrc.QrcFile, qrc.Resources, error)) {
+ cmSystemTools::Error(error.c_str());
+ return false;
}
- } else {
- cmCustomCommandLine currentLine;
- currentLine.push_back(cmSystemTools::GetCMakeCommand());
- currentLine.push_back("-E");
- currentLine.push_back("cmake_autorcc");
- currentLine.push_back(qrc.InfoFile);
- currentLine.push_back("$<CONFIG>");
- commandLines.push_back(std::move(currentLine));
}
- std::string ccComment = "Automatic RCC for ";
- ccComment += FileProjectRelativePath(makefile, qrc.QrcFile);
+ }
+ }
- if (qrc.Generated) {
- // Create custom rcc target
- std::string ccName;
- {
- ccName = this->Target->GetName();
- ccName += "_arcc_";
- ccName += qrc.QrcName;
- if (!qrc.Unique) {
- ccName += "_";
- ccName += qrc.PathChecksum;
- }
- std::vector<std::string> ccDepends;
- // Add the .qrc and info file to the custom target dependencies
- ccDepends.push_back(qrc.QrcFile);
- ccDepends.push_back(qrc.InfoFile);
-
- cmTarget* autoRccTarget = makefile->AddUtilityCommand(
- ccName, cmMakefile::TargetOrigin::Generator, true,
- this->DirWork.c_str(), ccOutput, ccDepends, commandLines, false,
- ccComment.c_str());
- // Create autogen generator target
- localGen->AddGeneratorTarget(
- new cmGeneratorTarget(autoRccTarget, localGen));
-
- // Set FOLDER property in autogen target
- if (!this->AutogenFolder.empty()) {
- autoRccTarget->SetProperty("FOLDER", this->AutogenFolder.c_str());
- }
- }
- // Add autogen target to the origin target dependencies
- this->Target->Target->AddUtility(ccName, makefile);
- } else {
- // Create custom rcc command
- {
- std::vector<std::string> ccByproducts;
- std::vector<std::string> ccDepends;
- // Add the .qrc and info file to the custom command dependencies
- ccDepends.push_back(qrc.QrcFile);
- ccDepends.push_back(qrc.InfoFile);
+ return true;
+}
- // Add the resource files to the dependencies
- {
- std::string error;
- if (RccListInputs(qrc.QrcFile, qrc.Resources, error)) {
- for (std::string const& fileName : qrc.Resources) {
- // Add resource file to the custom command dependencies
- ccDepends.push_back(fileName);
- }
- } else {
- cmSystemTools::Error(error.c_str());
- }
- }
- makefile->AddCustomCommandToOutput(ccOutput, ccByproducts, ccDepends,
- /*main_dependency*/ std::string(),
- commandLines, ccComment.c_str(),
- this->DirWork.c_str());
- }
- // Reconfigure when .qrc file changes
- makefile->AddCMakeDependFile(qrc.QrcFile);
+bool cmQtAutoGenInitializer::InitAutogenTarget()
+{
+ cmMakefile* makefile = this->Target->Target->GetMakefile();
+ cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
+ cmGlobalGenerator* globalGen = localGen->GetGlobalGenerator();
+
+ // Register info file as generated by CMake
+ makefile->AddCMakeOutputFile(this->AutogenTarget.InfoFile);
+
+ // Files provided by the autogen target
+ std::vector<std::string> autogenProvides;
+ if (this->Moc.Enabled) {
+ this->AddGeneratedSource(this->Moc.MocsCompilation, GeneratorT::MOC);
+ autogenProvides.push_back(this->Moc.MocsCompilation);
+ }
+
+ // Compose target comment
+ std::string autogenComment;
+ {
+ std::string tools;
+ if (this->Moc.Enabled) {
+ tools += "MOC";
+ }
+ if (this->Uic.Enabled) {
+ if (!tools.empty()) {
+ tools += " and ";
}
+ tools += "UIC";
}
+ autogenComment = "Automatic ";
+ autogenComment += tools;
+ autogenComment += " for target ";
+ autogenComment += this->Target->GetName();
}
- // Create _autogen target
- if (this->MocEnabled || this->UicEnabled) {
- // Add user defined autogen target dependencies
- {
- std::string const deps =
- GetSafeProperty(this->Target, "AUTOGEN_TARGET_DEPENDS");
- if (!deps.empty()) {
- std::vector<std::string> extraDeps;
- cmSystemTools::ExpandListArgument(deps, extraDeps);
- for (std::string const& depName : extraDeps) {
- // Allow target and file dependencies
- auto* depTarget = makefile->FindTargetToUse(depName);
- if (depTarget != nullptr) {
- autogenDependTargets.insert(depTarget);
- } else {
- autogenDependFiles.insert(depName);
- }
- }
- }
+ // Compose command lines
+ cmCustomCommandLines commandLines;
+ {
+ cmCustomCommandLine currentLine;
+ currentLine.push_back(cmSystemTools::GetCMakeCommand());
+ currentLine.push_back("-E");
+ currentLine.push_back("cmake_autogen");
+ currentLine.push_back(this->AutogenTarget.InfoFile);
+ currentLine.push_back("$<CONFIGURATION>");
+ commandLines.push_back(std::move(currentLine));
+ }
+
+ // Use PRE_BUILD on demand
+ bool usePRE_BUILD = false;
+ if (globalGen->GetName().find("Visual Studio") != std::string::npos) {
+ // Under VS use a PRE_BUILD event instead of a separate target to
+ // reduce the number of targets loaded into the IDE.
+ // This also works around a VS 11 bug that may skip updating the target:
+ // https://connect.microsoft.com/VisualStudio/feedback/details/769495
+ usePRE_BUILD = true;
+ }
+ // Disable PRE_BUILD in some cases
+ if (usePRE_BUILD) {
+ // Cannot use PRE_BUILD with file depends
+ if (!this->AutogenTarget.DependFiles.empty()) {
+ usePRE_BUILD = false;
+ }
+ }
+ // Create the autogen target/command
+ if (usePRE_BUILD) {
+ // Add additional autogen target dependencies to origin target
+ for (cmTarget* depTarget : this->AutogenTarget.DependTargets) {
+ this->Target->Target->AddUtility(depTarget->GetName(), makefile);
}
- // Compose target comment
- std::string autogenComment;
+ // Add the pre-build command directly to bypass the OBJECT_LIBRARY
+ // rejection in cmMakefile::AddCustomCommandToTarget because we know
+ // PRE_BUILD will work for an OBJECT_LIBRARY in this specific case.
+ //
+ // PRE_BUILD does not support file dependencies!
+ const std::vector<std::string> no_output;
+ const std::vector<std::string> no_deps;
+ cmCustomCommand cc(makefile, no_output, autogenProvides, no_deps,
+ commandLines, autogenComment.c_str(),
+ this->Dir.Work.c_str());
+ cc.SetEscapeOldStyle(false);
+ cc.SetEscapeAllowMakeVars(true);
+ this->Target->Target->AddPreBuildCommand(cc);
+ } else {
+
+ // Add link library target dependencies to the autogen target
+ // dependencies
{
- std::string tools;
- if (this->MocEnabled) {
- tools += "MOC";
+ // add_dependencies/addUtility do not support generator expressions.
+ // We depend only on the libraries found in all configs therefore.
+ std::map<cmGeneratorTarget const*, std::size_t> commonTargets;
+ for (std::string const& config : this->ConfigsList) {
+ cmLinkImplementationLibraries const* libs =
+ this->Target->GetLinkImplementationLibraries(config);
+ if (libs != nullptr) {
+ for (cmLinkItem const& item : libs->Libraries) {
+ cmGeneratorTarget const* libTarget = item.Target;
+ if ((libTarget != nullptr) &&
+ !StaticLibraryCycle(this->Target, libTarget, config)) {
+ // Increment target config count
+ commonTargets[libTarget]++;
+ }
+ }
+ }
}
- if (this->UicEnabled) {
- if (!tools.empty()) {
- tools += " and ";
+ for (auto const& item : commonTargets) {
+ if (item.second == this->ConfigsList.size()) {
+ this->AutogenTarget.DependTargets.insert(item.first->Target);
}
- tools += "UIC";
}
- autogenComment = "Automatic ";
- autogenComment += tools;
- autogenComment += " for target ";
- autogenComment += this->Target->GetName();
}
- // Compose command lines
+ // Create autogen target
+ cmTarget* autogenTarget = makefile->AddUtilityCommand(
+ this->AutogenTarget.Name, cmMakefile::TargetOrigin::Generator, true,
+ this->Dir.Work.c_str(), /*byproducts=*/autogenProvides,
+ std::vector<std::string>(this->AutogenTarget.DependFiles.begin(),
+ this->AutogenTarget.DependFiles.end()),
+ commandLines, false, autogenComment.c_str());
+ // Create autogen generator target
+ localGen->AddGeneratorTarget(
+ new cmGeneratorTarget(autogenTarget, localGen));
+
+ // Forward origin utilities to autogen target
+ for (std::string const& depName : this->Target->Target->GetUtilities()) {
+ autogenTarget->AddUtility(depName, makefile);
+ }
+ // Add additional autogen target dependencies to autogen target
+ for (cmTarget* depTarget : this->AutogenTarget.DependTargets) {
+ autogenTarget->AddUtility(depTarget->GetName(), makefile);
+ }
+
+ // Set FOLDER property in autogen target
+ if (!this->TargetsFolder.empty()) {
+ autogenTarget->SetProperty("FOLDER", this->TargetsFolder.c_str());
+ }
+
+ // Add autogen target to the origin target dependencies
+ this->Target->Target->AddUtility(this->AutogenTarget.Name, makefile);
+ }
+
+ return true;
+}
+
+bool cmQtAutoGenInitializer::InitRccTargets()
+{
+ cmMakefile* makefile = this->Target->Target->GetMakefile();
+ cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
+
+ for (Qrc const& qrc : this->Rcc.Qrcs) {
+ // Register info file as generated by CMake
+ makefile->AddCMakeOutputFile(qrc.InfoFile);
+ // Register file at target
+ this->AddGeneratedSource(qrc.RccFile, GeneratorT::RCC);
+
+ std::vector<std::string> ccOutput;
+ ccOutput.push_back(qrc.RccFile);
+
cmCustomCommandLines commandLines;
- {
+ if (this->MultiConfig) {
+ // Build for all configurations
+ for (std::string const& config : this->ConfigsList) {
+ cmCustomCommandLine currentLine;
+ currentLine.push_back(cmSystemTools::GetCMakeCommand());
+ currentLine.push_back("-E");
+ currentLine.push_back("cmake_autorcc");
+ currentLine.push_back(qrc.InfoFile);
+ currentLine.push_back(config);
+ commandLines.push_back(std::move(currentLine));
+ }
+ } else {
cmCustomCommandLine currentLine;
currentLine.push_back(cmSystemTools::GetCMakeCommand());
currentLine.push_back("-E");
- currentLine.push_back("cmake_autogen");
- currentLine.push_back(this->AutogenInfoFile);
- currentLine.push_back("$<CONFIGURATION>");
+ currentLine.push_back("cmake_autorcc");
+ currentLine.push_back(qrc.InfoFile);
+ currentLine.push_back("$<CONFIG>");
commandLines.push_back(std::move(currentLine));
}
+ std::string ccComment = "Automatic RCC for ";
+ ccComment += FileProjectRelativePath(makefile, qrc.QrcFile);
- // Use PRE_BUILD on demand
- bool usePRE_BUILD = false;
- if (globalGen->GetName().find("Visual Studio") != std::string::npos) {
- // Under VS use a PRE_BUILD event instead of a separate target to
- // reduce the number of targets loaded into the IDE.
- // This also works around a VS 11 bug that may skip updating the target:
- // https://connect.microsoft.com/VisualStudio/feedback/details/769495
- usePRE_BUILD = true;
- }
- // Disable PRE_BUILD in some cases
- if (usePRE_BUILD) {
- // Cannot use PRE_BUILD with file depends
- if (!autogenDependFiles.empty()) {
- usePRE_BUILD = false;
- }
- }
- // Create the autogen target/command
- if (usePRE_BUILD) {
- // Add additional autogen target dependencies to origin target
- for (cmTarget* depTarget : autogenDependTargets) {
- this->Target->Target->AddUtility(depTarget->GetName(), makefile);
- }
-
- // Add the pre-build command directly to bypass the OBJECT_LIBRARY
- // rejection in cmMakefile::AddCustomCommandToTarget because we know
- // PRE_BUILD will work for an OBJECT_LIBRARY in this specific case.
- //
- // PRE_BUILD does not support file dependencies!
- const std::vector<std::string> no_output;
- const std::vector<std::string> no_deps;
- cmCustomCommand cc(makefile, no_output, autogenProvides, no_deps,
- commandLines, autogenComment.c_str(),
- this->DirWork.c_str());
- cc.SetEscapeOldStyle(false);
- cc.SetEscapeAllowMakeVars(true);
- this->Target->Target->AddPreBuildCommand(cc);
- } else {
-
- // Add link library target dependencies to the autogen target
- // dependencies
+ if (qrc.Generated) {
+ // Create custom rcc target
+ std::string ccName;
{
- // add_dependencies/addUtility do not support generator expressions.
- // We depend only on the libraries found in all configs therefore.
- std::map<cmGeneratorTarget const*, std::size_t> commonTargets;
- for (std::string const& config : this->ConfigsList) {
- cmLinkImplementationLibraries const* libs =
- this->Target->GetLinkImplementationLibraries(config);
- if (libs != nullptr) {
- for (cmLinkItem const& item : libs->Libraries) {
- cmGeneratorTarget const* libTarget = item.Target;
- if ((libTarget != nullptr) &&
- !StaticLibraryCycle(this->Target, libTarget, config)) {
- // Increment target config count
- commonTargets[libTarget]++;
- }
- }
- }
+ ccName = this->Target->GetName();
+ ccName += "_arcc_";
+ ccName += qrc.QrcName;
+ if (!qrc.Unique) {
+ ccName += "_";
+ ccName += qrc.PathChecksum;
}
- for (auto const& item : commonTargets) {
- if (item.second == this->ConfigsList.size()) {
- autogenDependTargets.insert(item.first->Target);
- }
+ std::vector<std::string> ccDepends;
+ // Add the .qrc and info file to the custom target dependencies
+ ccDepends.push_back(qrc.QrcFile);
+ ccDepends.push_back(qrc.InfoFile);
+
+ cmTarget* autoRccTarget = makefile->AddUtilityCommand(
+ ccName, cmMakefile::TargetOrigin::Generator, true,
+ this->Dir.Work.c_str(), ccOutput, ccDepends, commandLines, false,
+ ccComment.c_str());
+ // Create autogen generator target
+ localGen->AddGeneratorTarget(
+ new cmGeneratorTarget(autoRccTarget, localGen));
+
+ // Set FOLDER property in autogen target
+ if (!this->TargetsFolder.empty()) {
+ autoRccTarget->SetProperty("FOLDER", this->TargetsFolder.c_str());
}
}
-
- // Create autogen target
- cmTarget* autogenTarget = makefile->AddUtilityCommand(
- this->AutogenTargetName, cmMakefile::TargetOrigin::Generator, true,
- this->DirWork.c_str(), /*byproducts=*/autogenProvides,
- std::vector<std::string>(autogenDependFiles.begin(),
- autogenDependFiles.end()),
- commandLines, false, autogenComment.c_str());
- // Create autogen generator target
- localGen->AddGeneratorTarget(
- new cmGeneratorTarget(autogenTarget, localGen));
-
- // Forward origin utilities to autogen target
- for (std::string const& depName : this->Target->Target->GetUtilities()) {
- autogenTarget->AddUtility(depName, makefile);
- }
- // Add additional autogen target dependencies to autogen target
- for (cmTarget* depTarget : autogenDependTargets) {
- autogenTarget->AddUtility(depTarget->GetName(), makefile);
- }
-
- // Set FOLDER property in autogen target
- if (!this->AutogenFolder.empty()) {
- autogenTarget->SetProperty("FOLDER", this->AutogenFolder.c_str());
- }
-
// Add autogen target to the origin target dependencies
- this->Target->Target->AddUtility(this->AutogenTargetName, makefile);
+ this->Target->Target->AddUtility(ccName, makefile);
+ } else {
+ // Create custom rcc command
+ {
+ std::vector<std::string> ccByproducts;
+ std::vector<std::string> ccDepends;
+ // Add the .qrc and info file to the custom command dependencies
+ ccDepends.push_back(qrc.QrcFile);
+ ccDepends.push_back(qrc.InfoFile);
+
+ // Add the resource files to the dependencies
+ for (std::string const& fileName : qrc.Resources) {
+ // Add resource file to the custom command dependencies
+ ccDepends.push_back(fileName);
+ }
+ makefile->AddCustomCommandToOutput(ccOutput, ccByproducts, ccDepends,
+ /*main_dependency*/ std::string(),
+ commandLines, ccComment.c_str(),
+ this->Dir.Work.c_str());
+ }
+ // Reconfigure when .qrc file changes
+ makefile->AddCMakeDependFile(qrc.QrcFile);
}
}
+
+ return true;
}
-void cmQtAutoGenInitializer::SetupCustomTargets()
+bool cmQtAutoGenInitializer::SetupCustomTargets()
{
- cmMakefile* makefile = this->Target->Target->GetMakefile();
-
// Create info directory on demand
- if (!cmSystemTools::MakeDirectory(this->DirInfo)) {
- std::string emsg = ("Could not create directory: ");
- emsg += Quoted(this->DirInfo);
+ if (!cmSystemTools::MakeDirectory(this->Dir.Info)) {
+ std::string emsg = ("AutoGen: Could not create directory: ");
+ emsg += Quoted(this->Dir.Info);
cmSystemTools::Error(emsg.c_str());
- }
-
- // Configuration include directories
- std::string includeDir = "include";
- std::map<std::string, std::string> includeDirs;
- for (std::string const& cfg : this->ConfigsList) {
- std::string& dir = includeDirs[cfg];
- dir = "include_";
- dir += cfg;
+ return false;
}
// Generate autogen target info file
- if (this->MocEnabled || this->UicEnabled) {
- if (this->MocEnabled) {
- this->SetupCustomTargetsMoc();
+ if (this->Moc.Enabled || this->Uic.Enabled) {
+ // Write autogen target info files
+ if (!this->SetupWriteAutogenInfo()) {
+ return false;
}
- if (this->UicEnabled) {
- this->SetupCustomTargetsUic();
+ }
+
+ // Write AUTORCC info files
+ if (this->Rcc.Enabled && !this->SetupWriteRccInfo()) {
+ return false;
+ }
+
+ return true;
+}
+
+bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
+{
+ cmMakefile* makefile = this->Target->Target->GetMakefile();
+
+ cmGeneratedFileStream ofs;
+ ofs.SetCopyIfDifferent(true);
+ ofs.Open(this->AutogenTarget.InfoFile, false, true);
+ if (ofs) {
+ // Utility lambdas
+ auto CWrite = [&ofs](const char* key, std::string const& value) {
+ ofs << "set(" << key << " " << cmOutputConverter::EscapeForCMake(value)
+ << ")\n";
+ };
+ auto CWriteUInt = [&ofs](const char* key, unsigned int value) {
+ ofs << "set(" << key << " " << value << ")\n";
+ };
+ auto CWriteList = [&CWrite](const char* key,
+ std::vector<std::string> const& list) {
+ CWrite(key, cmJoin(list, ";"));
+ };
+ auto CWriteNestedLists =
+ [&CWrite](const char* key,
+ std::vector<std::vector<std::string>> const& lists) {
+ std::vector<std::string> seplist;
+ for (const std::vector<std::string>& list : lists) {
+ std::string blist = "{";
+ blist += cmJoin(list, ";");
+ blist += "}";
+ seplist.push_back(std::move(blist));
+ }
+ CWrite(key, cmJoin(seplist, cmQtAutoGen::ListSep));
+ };
+ auto CWriteSet = [&CWrite](const char* key,
+ std::set<std::string> const& list) {
+ CWrite(key, cmJoin(list, ";"));
+ };
+ auto CWriteMap = [&ofs](const char* key,
+ std::map<std::string, std::string> const& map) {
+ for (auto const& item : map) {
+ ofs << "set(" << key << "_" << item.first << " "
+ << cmOutputConverter::EscapeForCMake(item.second) << ")\n";
+ }
+ };
+ auto MfDef = [makefile](const char* key) {
+ return std::string(makefile->GetSafeDefinition(key));
+ };
+
+ // Write
+ ofs << "# Meta\n";
+ CWrite("AM_MULTI_CONFIG", this->MultiConfig ? "TRUE" : "FALSE");
+ CWrite("AM_PARALLEL", this->AutogenTarget.Parallel);
+ CWrite("AM_VERBOSITY", this->Verbosity);
+
+ ofs << "# Directories\n";
+ CWrite("AM_CMAKE_SOURCE_DIR", MfDef("CMAKE_SOURCE_DIR"));
+ CWrite("AM_CMAKE_BINARY_DIR", MfDef("CMAKE_BINARY_DIR"));
+ CWrite("AM_CMAKE_CURRENT_SOURCE_DIR", MfDef("CMAKE_CURRENT_SOURCE_DIR"));
+ CWrite("AM_CMAKE_CURRENT_BINARY_DIR", MfDef("CMAKE_CURRENT_BINARY_DIR"));
+ CWrite("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE",
+ MfDef("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE"));
+ CWrite("AM_BUILD_DIR", this->Dir.Build);
+ CWrite("AM_INCLUDE_DIR", this->Dir.Include);
+ CWriteMap("AM_INCLUDE_DIR", this->Dir.ConfigInclude);
+
+ ofs << "# Files\n";
+ CWriteList("AM_SOURCES", this->AutogenTarget.Sources);
+ CWriteList("AM_HEADERS", this->AutogenTarget.Headers);
+ CWrite("AM_SETTINGS_FILE", this->AutogenTarget.SettingsFile);
+ CWriteMap("AM_SETTINGS_FILE", this->AutogenTarget.ConfigSettingsFile);
+
+ ofs << "# Qt\n";
+ CWriteUInt("AM_QT_VERSION_MAJOR", this->QtVersion.Major);
+ CWrite("AM_QT_MOC_EXECUTABLE", this->Moc.Executable);
+ CWrite("AM_QT_UIC_EXECUTABLE", this->Uic.Executable);
+
+ if (this->Moc.Enabled) {
+ ofs << "# MOC settings\n";
+ CWriteSet("AM_MOC_SKIP", this->Moc.Skip);
+ CWrite("AM_MOC_DEFINITIONS", this->Moc.Defines);
+ CWriteMap("AM_MOC_DEFINITIONS", this->Moc.ConfigDefines);
+ CWrite("AM_MOC_INCLUDES", this->Moc.Includes);
+ CWriteMap("AM_MOC_INCLUDES", this->Moc.ConfigIncludes);
+ CWrite("AM_MOC_OPTIONS",
+ this->Target->GetSafeProperty("AUTOMOC_MOC_OPTIONS"));
+ CWrite("AM_MOC_RELAXED_MODE", MfDef("CMAKE_AUTOMOC_RELAXED_MODE"));
+ CWrite("AM_MOC_MACRO_NAMES",
+ this->Target->GetSafeProperty("AUTOMOC_MACRO_NAMES"));
+ CWrite("AM_MOC_DEPEND_FILTERS",
+ this->Target->GetSafeProperty("AUTOMOC_DEPEND_FILTERS"));
+ CWrite("AM_MOC_PREDEFS_CMD", this->Moc.PredefsCmd);
}
- // Parallel processing
- this->Parallel = GetSafeProperty(this->Target, "AUTOGEN_PARALLEL");
- if (this->Parallel.empty() || (this->Parallel == "AUTO")) {
- // Autodetect number of CPUs
- this->Parallel = std::to_string(GetParallelCPUCount());
+ if (this->Uic.Enabled) {
+ ofs << "# UIC settings\n";
+ CWriteSet("AM_UIC_SKIP", this->Uic.Skip);
+ CWrite("AM_UIC_TARGET_OPTIONS", this->Uic.Options);
+ CWriteMap("AM_UIC_TARGET_OPTIONS", this->Uic.ConfigOptions);
+ CWriteList("AM_UIC_OPTIONS_FILES", this->Uic.FileFiles);
+ CWriteNestedLists("AM_UIC_OPTIONS_OPTIONS", this->Uic.FileOptions);
+ CWriteList("AM_UIC_SEARCH_PATHS", this->Uic.SearchPaths);
}
+ } else {
+ std::string err = "AutoGen: Could not write file ";
+ err += this->AutogenTarget.InfoFile;
+ cmSystemTools::Error(err.c_str());
+ return false;
+ }
+
+ return true;
+}
+bool cmQtAutoGenInitializer::SetupWriteRccInfo()
+{
+ for (Qrc const& qrc : this->Rcc.Qrcs) {
cmGeneratedFileStream ofs;
ofs.SetCopyIfDifferent(true);
- ofs.Open(this->AutogenInfoFile.c_str(), false, true);
+ ofs.Open(qrc.InfoFile, false, true);
if (ofs) {
// Utility lambdas
auto CWrite = [&ofs](const char* key, std::string const& value) {
ofs << "set(" << key << " " << cmOutputConverter::EscapeForCMake(value)
<< ")\n";
};
- auto CWriteList = [&CWrite](const char* key,
- std::vector<std::string> const& list) {
- CWrite(key, cmJoin(list, ";"));
- };
- auto CWriteNestedLists =
- [&CWrite](const char* key,
- std::vector<std::vector<std::string>> const& lists) {
- std::vector<std::string> seplist;
- for (const std::vector<std::string>& list : lists) {
- std::string blist = "{";
- blist += cmJoin(list, ";");
- blist += "}";
- seplist.push_back(std::move(blist));
- }
- CWrite(key, cmJoin(seplist, cmQtAutoGen::ListSep));
- };
- auto CWriteSet = [&CWrite](const char* key,
- std::set<std::string> const& list) {
- CWrite(key, cmJoin(list, ";"));
- };
auto CWriteMap = [&ofs](const char* key,
std::map<std::string, std::string> const& map) {
for (auto const& item : map) {
@@ -936,401 +1213,306 @@ void cmQtAutoGenInitializer::SetupCustomTargets()
<< cmOutputConverter::EscapeForCMake(item.second) << ")\n";
}
};
- auto MfDef = [makefile](const char* key) {
- return std::string(makefile->GetSafeDefinition(key));
- };
// Write
- ofs << "# Meta\n";
- CWrite("AM_MULTI_CONFIG", this->MultiConfig ? "TRUE" : "FALSE");
- CWrite("AM_PARALLEL", this->Parallel);
+ ofs << "# Configurations\n";
+ CWrite("ARCC_MULTI_CONFIG", this->MultiConfig ? "TRUE" : "FALSE");
+ CWrite("ARCC_VERBOSITY", this->Verbosity);
+ ofs << "# Settings file\n";
+ CWrite("ARCC_SETTINGS_FILE", qrc.SettingsFile);
+ CWriteMap("ARCC_SETTINGS_FILE", qrc.ConfigSettingsFile);
ofs << "# Directories\n";
- CWrite("AM_CMAKE_SOURCE_DIR", MfDef("CMAKE_SOURCE_DIR"));
- CWrite("AM_CMAKE_BINARY_DIR", MfDef("CMAKE_BINARY_DIR"));
- CWrite("AM_CMAKE_CURRENT_SOURCE_DIR", MfDef("CMAKE_CURRENT_SOURCE_DIR"));
- CWrite("AM_CMAKE_CURRENT_BINARY_DIR", MfDef("CMAKE_CURRENT_BINARY_DIR"));
- CWrite("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE",
- MfDef("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE"));
- CWrite("AM_BUILD_DIR", this->DirBuild);
- if (this->MultiConfig) {
- CWriteMap("AM_INCLUDE_DIR", includeDirs);
- } else {
- CWrite("AM_INCLUDE_DIR", includeDir);
- }
-
- ofs << "# Files\n";
- CWriteList("AM_SOURCES", this->Sources);
- CWriteList("AM_HEADERS", this->Headers);
- if (this->MultiConfig) {
- std::map<std::string, std::string> settingsFiles;
- for (std::string const& cfg : this->ConfigsList) {
- settingsFiles[cfg] =
- AppendFilenameSuffix(this->AutogenSettingsFile, "_" + cfg);
- }
- CWriteMap("AM_SETTINGS_FILE", settingsFiles);
- } else {
- CWrite("AM_SETTINGS_FILE", this->AutogenSettingsFile);
- }
-
- ofs << "# Qt\n";
- CWrite("AM_QT_VERSION_MAJOR", this->QtVersionMajor);
- CWrite("AM_QT_MOC_EXECUTABLE", this->MocExecutable);
- CWrite("AM_QT_UIC_EXECUTABLE", this->UicExecutable);
-
- if (this->MocEnabled) {
- ofs << "# MOC settings\n";
- CWriteSet("AM_MOC_SKIP", this->MocSkip);
- CWrite("AM_MOC_DEFINITIONS", this->MocDefines);
- CWriteMap("AM_MOC_DEFINITIONS", this->MocDefinesConfig);
- CWrite("AM_MOC_INCLUDES", this->MocIncludes);
- CWriteMap("AM_MOC_INCLUDES", this->MocIncludesConfig);
- CWrite("AM_MOC_OPTIONS",
- GetSafeProperty(this->Target, "AUTOMOC_MOC_OPTIONS"));
- CWrite("AM_MOC_RELAXED_MODE", MfDef("CMAKE_AUTOMOC_RELAXED_MODE"));
- CWrite("AM_MOC_MACRO_NAMES",
- GetSafeProperty(this->Target, "AUTOMOC_MACRO_NAMES"));
- CWrite("AM_MOC_DEPEND_FILTERS",
- GetSafeProperty(this->Target, "AUTOMOC_DEPEND_FILTERS"));
- CWrite("AM_MOC_PREDEFS_CMD", this->MocPredefsCmd);
- }
-
- if (this->UicEnabled) {
- ofs << "# UIC settings\n";
- CWriteSet("AM_UIC_SKIP", this->UicSkip);
- CWrite("AM_UIC_TARGET_OPTIONS", this->UicOptions);
- CWriteMap("AM_UIC_TARGET_OPTIONS", this->UicOptionsConfig);
- CWriteList("AM_UIC_OPTIONS_FILES", this->UicFileFiles);
- CWriteNestedLists("AM_UIC_OPTIONS_OPTIONS", this->UicFileOptions);
- CWriteList("AM_UIC_SEARCH_PATHS", this->UicSearchPaths);
- }
+ CWrite("ARCC_BUILD_DIR", this->Dir.Build);
+ CWrite("ARCC_INCLUDE_DIR", this->Dir.Include);
+ CWriteMap("ARCC_INCLUDE_DIR", this->Dir.ConfigInclude);
+
+ ofs << "# Rcc executable\n";
+ CWrite("ARCC_RCC_EXECUTABLE", this->Rcc.Executable);
+ CWrite("ARCC_RCC_LIST_OPTIONS", cmJoin(this->Rcc.ListOptions, ";"));
+
+ ofs << "# Rcc job\n";
+ CWrite("ARCC_LOCK_FILE", qrc.LockFile);
+ CWrite("ARCC_SOURCE", qrc.QrcFile);
+ CWrite("ARCC_OUTPUT_CHECKSUM", qrc.PathChecksum);
+ CWrite("ARCC_OUTPUT_NAME", cmSystemTools::GetFilenameName(qrc.RccFile));
+ CWrite("ARCC_OPTIONS", cmJoin(qrc.Options, ";"));
+ CWrite("ARCC_INPUTS", cmJoin(qrc.Resources, ";"));
} else {
- return;
+ std::string err = "AutoRcc: Could not write file ";
+ err += qrc.InfoFile;
+ cmSystemTools::Error(err.c_str());
+ return false;
}
}
- // Generate auto RCC info files
- if (this->RccEnabled) {
- for (Qrc const& qrc : this->Qrcs) {
- // Register rcc info file as generated
- makefile->AddCMakeOutputFile(qrc.InfoFile);
-
- cmGeneratedFileStream ofs;
- ofs.SetCopyIfDifferent(true);
- ofs.Open(qrc.InfoFile.c_str(), false, true);
- if (ofs) {
- // Utility lambdas
- auto CWrite = [&ofs](const char* key, std::string const& value) {
- ofs << "set(" << key << " "
- << cmOutputConverter::EscapeForCMake(value) << ")\n";
- };
- auto CWriteMap =
- [&ofs](const char* key,
- std::map<std::string, std::string> const& map) {
- for (auto const& item : map) {
- ofs << "set(" << key << "_" << item.first << " "
- << cmOutputConverter::EscapeForCMake(item.second) << ")\n";
- }
- };
-
- // Write
- ofs << "# Configurations\n";
- CWrite("ARCC_MULTI_CONFIG", this->MultiConfig ? "TRUE" : "FALSE");
-
- ofs << "# Settings file\n";
- if (this->MultiConfig) {
- std::map<std::string, std::string> settingsFiles;
- for (std::string const& cfg : this->ConfigsList) {
- settingsFiles[cfg] =
- AppendFilenameSuffix(qrc.SettingsFile, "_" + cfg);
- }
- CWriteMap("ARCC_SETTINGS_FILE", settingsFiles);
- } else {
- CWrite("ARCC_SETTINGS_FILE", qrc.SettingsFile);
- }
-
- ofs << "# Directories\n";
- CWrite("ARCC_BUILD_DIR", this->DirBuild);
- if (this->MultiConfig) {
- CWriteMap("ARCC_INCLUDE_DIR", includeDirs);
- } else {
- CWrite("ARCC_INCLUDE_DIR", includeDir);
- }
+ return true;
+}
- ofs << "# Rcc executable\n";
- CWrite("ARCC_RCC_EXECUTABLE", this->RccExecutable);
- CWrite("ARCC_RCC_LIST_OPTIONS", cmJoin(this->RccListOptions, ";"));
-
- ofs << "# Rcc job\n";
- CWrite("ARCC_LOCK_FILE", qrc.LockFile);
- CWrite("ARCC_SOURCE", qrc.QrcFile);
- CWrite("ARCC_OUTPUT_CHECKSUM", qrc.PathChecksum);
- CWrite("ARCC_OUTPUT_NAME",
- cmSystemTools::GetFilenameName(qrc.RccFile));
- CWrite("ARCC_OPTIONS", cmJoin(qrc.Options, ";"));
- CWrite("ARCC_INPUTS", cmJoin(qrc.Resources, ";"));
- } else {
- return;
- }
- }
+void cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename,
+ GeneratorT genType)
+{
+ // Register source file in makefile
+ cmMakefile* makefile = this->Target->Target->GetMakefile();
+ {
+ cmSourceFile* gFile = makefile->GetOrCreateSource(filename, true);
+ gFile->SetProperty("GENERATED", "1");
+ gFile->SetProperty("SKIP_AUTOGEN", "On");
}
+
+ // Add source file to source group
+ AddToSourceGroup(makefile, filename, genType);
+
+ // Add source file to target
+ this->Target->AddSource(filename);
}
-void cmQtAutoGenInitializer::SetupCustomTargetsMoc()
+cmQtAutoGenInitializer::IntegerVersion cmQtAutoGenInitializer::GetQtVersion(
+ cmGeneratorTarget const* target)
{
- cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
- cmMakefile* makefile = this->Target->Target->GetMakefile();
+ cmQtAutoGenInitializer::IntegerVersion res;
+ cmMakefile* makefile = target->Target->GetMakefile();
- // Moc predefs command
- if (this->Target->GetPropertyAsBool("AUTOMOC_COMPILER_PREDEFINES") &&
- this->QtVersionGreaterOrEqual(5, 8)) {
- this->MocPredefsCmd =
- makefile->GetSafeDefinition("CMAKE_CXX_COMPILER_PREDEFINES_COMMAND");
+ // -- Major version
+ std::string qtMajor = makefile->GetSafeDefinition("QT_VERSION_MAJOR");
+ if (qtMajor.empty()) {
+ qtMajor = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR");
}
-
- // Moc includes and compile definitions
{
- auto GetIncludeDirs = [this,
- localGen](std::string const& cfg) -> std::string {
- // Get the include dirs for this target, without stripping the implicit
- // include dirs off, see
- // https://gitlab.kitware.com/cmake/cmake/issues/13667
- std::vector<std::string> includeDirs;
- localGen->GetIncludeDirectories(includeDirs, this->Target, "CXX", cfg,
- false);
- return cmJoin(includeDirs, ";");
- };
- auto GetCompileDefinitions =
- [this, localGen](std::string const& cfg) -> std::string {
- std::set<std::string> defines;
- localGen->AddCompileDefinitions(defines, this->Target, cfg, "CXX");
- return cmJoin(defines, ";");
- };
-
- // Default configuration settings
- this->MocIncludes = GetIncludeDirs(this->ConfigDefault);
- this->MocDefines = GetCompileDefinitions(this->ConfigDefault);
- // Other configuration settings
- for (std::string const& cfg : this->ConfigsList) {
- {
- std::string const configIncludeDirs = GetIncludeDirs(cfg);
- if (configIncludeDirs != this->MocIncludes) {
- this->MocIncludesConfig[cfg] = configIncludeDirs;
- }
- }
- {
- std::string const configCompileDefs = GetCompileDefinitions(cfg);
- if (configCompileDefs != this->MocDefines) {
- this->MocDefinesConfig[cfg] = configCompileDefs;
- }
- }
+ const char* targetQtVersion =
+ target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", "");
+ if (targetQtVersion != nullptr) {
+ qtMajor = targetQtVersion;
}
}
- // Moc executable
- {
- std::string mocExec;
- std::string err;
-
- if (this->QtVersionMajor == "5") {
- cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse("Qt5::moc");
- if (tgt != nullptr) {
- mocExec = SafeString(tgt->ImportedGetLocation(""));
- } else {
- err = "AUTOMOC: Qt5::moc target not found";
- }
- } else if (this->QtVersionMajor == "4") {
- cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse("Qt4::moc");
- if (tgt != nullptr) {
- mocExec = SafeString(tgt->ImportedGetLocation(""));
- } else {
- err = "AUTOMOC: Qt4::moc target not found";
+ // -- Minor version
+ std::string qtMinor;
+ if (!qtMajor.empty()) {
+ if (qtMajor == "5") {
+ qtMinor = makefile->GetSafeDefinition("Qt5Core_VERSION_MINOR");
+ }
+ if (qtMinor.empty()) {
+ qtMinor = makefile->GetSafeDefinition("QT_VERSION_MINOR");
+ }
+ {
+ const char* targetQtVersion =
+ target->GetLinkInterfaceDependentStringProperty("QT_MINOR_VERSION",
+ "");
+ if (targetQtVersion != nullptr) {
+ qtMinor = targetQtVersion;
}
- } else {
- err = "The AUTOMOC feature supports only Qt 4 and Qt 5";
}
+ }
- if (err.empty()) {
- this->MocExecutable = mocExec;
- } else {
- err += " (";
- err += this->Target->GetName();
- err += ")";
- cmSystemTools::Error(err.c_str());
+ // -- Convert to integer
+ if (!qtMajor.empty() && !qtMinor.empty()) {
+ unsigned long majorUL(0);
+ unsigned long minorUL(0);
+ if (cmSystemTools::StringToULong(qtMajor.c_str(), &majorUL) &&
+ cmSystemTools::StringToULong(qtMinor.c_str(), &minorUL)) {
+ res.Major = static_cast<unsigned int>(majorUL);
+ res.Minor = static_cast<unsigned int>(minorUL);
}
}
+
+ return res;
}
-void cmQtAutoGenInitializer::SetupCustomTargetsUic()
+bool cmQtAutoGenInitializer::GetMocExecutable()
{
- cmMakefile* makefile = this->Target->Target->GetMakefile();
+ std::string err;
- // Uic search paths
+ // Find moc executable
{
- std::string const usp =
- GetSafeProperty(this->Target, "AUTOUIC_SEARCH_PATHS");
- if (!usp.empty()) {
- cmSystemTools::ExpandListArgument(usp, this->UicSearchPaths);
- std::string const srcDir = makefile->GetCurrentSourceDirectory();
- for (std::string& path : this->UicSearchPaths) {
- path = cmSystemTools::CollapseFullPath(path, srcDir);
+ std::string targetName;
+ if (this->QtVersion.Major == 5) {
+ targetName = "Qt5::moc";
+ } else if (this->QtVersion.Major == 4) {
+ targetName = "Qt4::moc";
+ } else {
+ err = "The AUTOMOC feature supports only Qt 4 and Qt 5";
+ }
+ if (!targetName.empty()) {
+ cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
+ cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName);
+ if (tgt != nullptr) {
+ this->Moc.Executable = tgt->ImportedGetLocation("");
+ } else {
+ err = "Could not find target " + targetName;
}
}
}
- // Uic target options
- {
- auto UicGetOpts = [this](std::string const& cfg) -> std::string {
- std::vector<std::string> opts;
- this->Target->GetAutoUicOptions(opts, cfg);
- return cmJoin(opts, ";");
- };
- // Default settings
- this->UicOptions = UicGetOpts(this->ConfigDefault);
-
- // Configuration specific settings
- for (std::string const& cfg : this->ConfigsList) {
- std::string const configUicOpts = UicGetOpts(cfg);
- if (configUicOpts != this->UicOptions) {
- this->UicOptionsConfig[cfg] = configUicOpts;
+ // Test moc command
+ if (err.empty()) {
+ if (cmSystemTools::FileExists(this->Moc.Executable, true)) {
+ std::vector<std::string> command;
+ command.push_back(this->Moc.Executable);
+ command.push_back("-h");
+ std::string stdOut;
+ std::string stdErr;
+ int retVal = 0;
+ bool result = cmSystemTools::RunSingleCommand(
+ command, &stdOut, &stdErr, &retVal, nullptr,
+ cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto);
+ if (!result) {
+ err = "The moc test command failed: ";
+ err += QuotedCommand(command);
}
+ } else {
+ err = "The moc executable ";
+ err += Quoted(this->Moc.Executable);
+ err += " does not exist";
}
}
- // .ui files skip and options
- {
- std::string const uiExt = "ui";
- std::string pathError;
- for (cmSourceFile* sf : makefile->GetSourceFiles()) {
- // sf->GetExtension() is only valid after sf->GetFullPath() ...
- // Since we're iterating over source files that might be not in the
- // target we need to check for path errors (not existing files).
- std::string const& fPath = sf->GetFullPath(&pathError);
- if (!pathError.empty()) {
- pathError.clear();
- continue;
- }
- if (sf->GetExtension() == uiExt) {
- std::string const absFile = cmSystemTools::GetRealPath(fPath);
- // Check if the .ui file should be skipped
- if (sf->GetPropertyAsBool("SKIP_AUTOUIC") ||
- sf->GetPropertyAsBool("SKIP_AUTOGEN")) {
- this->UicSkip.insert(absFile);
- }
- // Check if the .ui file has uic options
- std::string const uicOpts = GetSafeProperty(sf, "AUTOUIC_OPTIONS");
- if (!uicOpts.empty()) {
- // Check if file isn't skipped
- if (this->UicSkip.count(absFile) == 0) {
- this->UicFileFiles.push_back(absFile);
- std::vector<std::string> optsVec;
- cmSystemTools::ExpandListArgument(uicOpts, optsVec);
- this->UicFileOptions.push_back(std::move(optsVec));
- }
- }
- }
- }
+
+ // Print error
+ if (!err.empty()) {
+ std::string msg = "AutoMoc (";
+ msg += this->Target->GetName();
+ msg += "): ";
+ msg += err;
+ cmSystemTools::Error(msg.c_str());
+ return false;
}
- // Uic executable
- {
- std::string err;
- std::string uicExec;
+ return true;
+}
- cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
- if (this->QtVersionMajor == "5") {
- cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse("Qt5::uic");
- if (tgt != nullptr) {
- uicExec = SafeString(tgt->ImportedGetLocation(""));
- } else {
- // Project does not use Qt5Widgets, but has AUTOUIC ON anyway
- }
- } else if (this->QtVersionMajor == "4") {
- cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse("Qt4::uic");
+bool cmQtAutoGenInitializer::GetUicExecutable()
+{
+ std::string err;
+
+ // Find uic executable
+ {
+ std::string targetName;
+ if (this->QtVersion.Major == 5) {
+ targetName = "Qt5::uic";
+ } else if (this->QtVersion.Major == 4) {
+ targetName = "Qt4::uic";
+ } else {
+ err = "The AUTOUIC feature supports only Qt 4 and Qt 5";
+ }
+ if (!targetName.empty()) {
+ cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
+ cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName);
if (tgt != nullptr) {
- uicExec = SafeString(tgt->ImportedGetLocation(""));
+ this->Uic.Executable = tgt->ImportedGetLocation("");
} else {
- err = "AUTOUIC: Qt4::uic target not found";
+ if (this->QtVersion.Major == 5) {
+ // Project does not use Qt5Widgets, but has AUTOUIC ON anyway
+ } else {
+ err = "Could not find target " + targetName;
+ }
}
- } else {
- err = "The AUTOUIC feature supports only Qt 4 and Qt 5";
}
+ }
- if (err.empty()) {
- this->UicExecutable = uicExec;
+ // Test uic command
+ if (err.empty()) {
+ if (cmSystemTools::FileExists(this->Uic.Executable, true)) {
+ std::vector<std::string> command;
+ command.push_back(this->Uic.Executable);
+ command.push_back("-h");
+ std::string stdOut;
+ std::string stdErr;
+ int retVal = 0;
+ bool result = cmSystemTools::RunSingleCommand(
+ command, &stdOut, &stdErr, &retVal, nullptr,
+ cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto);
+ if (!result) {
+ err = "The uic test command failed: ";
+ err += QuotedCommand(command);
+ }
} else {
- err += " (";
- err += this->Target->GetName();
- err += ")";
- cmSystemTools::Error(err.c_str());
+ err = "The uic executable ";
+ err += Quoted(this->Uic.Executable);
+ err += " does not exist";
}
}
-}
-void cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename,
- GeneratorT genType)
-{
- // Register source file in makefile
- cmMakefile* makefile = this->Target->Target->GetMakefile();
- {
- cmSourceFile* gFile = makefile->GetOrCreateSource(filename, true);
- gFile->SetProperty("GENERATED", "1");
- gFile->SetProperty("SKIP_AUTOGEN", "On");
+ // Print error
+ if (!err.empty()) {
+ std::string msg = "AutoUic (";
+ msg += this->Target->GetName();
+ msg += "): ";
+ msg += err;
+ cmSystemTools::Error(msg.c_str());
+ return false;
}
- // Add source file to source group
- AddToSourceGroup(makefile, filename, genType);
-
- // Add source file to target
- this->Target->AddSource(filename);
+ return true;
}
-std::string cmQtAutoGenInitializer::GetQtMajorVersion(
- cmGeneratorTarget const* target)
+bool cmQtAutoGenInitializer::GetRccExecutable()
{
- cmMakefile* makefile = target->Target->GetMakefile();
- std::string qtMajor = makefile->GetSafeDefinition("QT_VERSION_MAJOR");
- if (qtMajor.empty()) {
- qtMajor = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR");
- }
- const char* targetQtVersion =
- target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", "");
- if (targetQtVersion != nullptr) {
- qtMajor = targetQtVersion;
- }
- return qtMajor;
-}
+ std::string err;
-std::string cmQtAutoGenInitializer::GetQtMinorVersion(
- cmGeneratorTarget const* target, std::string const& qtVersionMajor)
-{
- cmMakefile* makefile = target->Target->GetMakefile();
- std::string qtMinor;
- if (qtVersionMajor == "5") {
- qtMinor = makefile->GetSafeDefinition("Qt5Core_VERSION_MINOR");
- }
- if (qtMinor.empty()) {
- qtMinor = makefile->GetSafeDefinition("QT_VERSION_MINOR");
+ // Find rcc executable
+ {
+ std::string targetName;
+ if (this->QtVersion.Major == 5) {
+ targetName = "Qt5::rcc";
+ } else if (this->QtVersion.Major == 4) {
+ targetName = "Qt4::rcc";
+ } else {
+ err = "The AUTORCC feature supports only Qt 4 and Qt 5";
+ }
+ if (!targetName.empty()) {
+ cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
+ cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName);
+ if (tgt != nullptr) {
+ this->Rcc.Executable = tgt->ImportedGetLocation("");
+ } else {
+ err = "Could not find target " + targetName;
+ }
+ }
}
- const char* targetQtVersion =
- target->GetLinkInterfaceDependentStringProperty("QT_MINOR_VERSION", "");
- if (targetQtVersion != nullptr) {
- qtMinor = targetQtVersion;
+ // Test rcc command
+ if (err.empty()) {
+ if (cmSystemTools::FileExists(this->Rcc.Executable, true)) {
+ std::vector<std::string> command;
+ command.push_back(this->Rcc.Executable);
+ command.push_back("-h");
+ std::string stdOut;
+ std::string stdErr;
+ int retVal = 0;
+ bool result = cmSystemTools::RunSingleCommand(
+ command, &stdOut, &stdErr, &retVal, nullptr,
+ cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto);
+ if (result) {
+ // Detect if rcc supports (-)-list
+ if (this->QtVersion.Major == 5) {
+ if (stdOut.find("--list") != std::string::npos) {
+ this->Rcc.ListOptions.push_back("--list");
+ } else {
+ this->Rcc.ListOptions.push_back("-list");
+ }
+ }
+ } else {
+ err = "The rcc test command failed: ";
+ err += QuotedCommand(command);
+ }
+ } else {
+ err = "The rcc executable ";
+ err += Quoted(this->Rcc.Executable);
+ err += " does not exist";
+ }
}
- return qtMinor;
-}
-bool cmQtAutoGenInitializer::QtVersionGreaterOrEqual(
- unsigned long requestMajor, unsigned long requestMinor) const
-{
- unsigned long majorUL(0);
- unsigned long minorUL(0);
- if (cmSystemTools::StringToULong(this->QtVersionMajor.c_str(), &majorUL) &&
- cmSystemTools::StringToULong(this->QtVersionMinor.c_str(), &minorUL)) {
- return (majorUL > requestMajor) ||
- (majorUL == requestMajor && minorUL >= requestMinor);
+ // Print error
+ if (!err.empty()) {
+ std::string msg = "AutoRcc (";
+ msg += this->Target->GetName();
+ msg += "): ";
+ msg += err;
+ cmSystemTools::Error(msg.c_str());
+ return false;
}
- return false;
+
+ return true;
}
/// @brief Reads the resource files list from from a .qrc file
@@ -1346,9 +1528,9 @@ bool cmQtAutoGenInitializer::RccListInputs(std::string const& fileName,
error += "\n";
return false;
}
- if (!RccListOptions.empty()) {
+ if (!this->Rcc.ListOptions.empty()) {
// Use rcc for file listing
- if (RccExecutable.empty()) {
+ if (this->Rcc.Executable.empty()) {
error = "rcc executable not available";
return false;
}
@@ -1367,8 +1549,9 @@ bool cmQtAutoGenInitializer::RccListInputs(std::string const& fileName,
std::string rccStdErr;
{
std::vector<std::string> cmd;
- cmd.push_back(RccExecutable);
- cmd.insert(cmd.end(), RccListOptions.begin(), RccListOptions.end());
+ cmd.push_back(this->Rcc.Executable);
+ cmd.insert(cmd.end(), this->Rcc.ListOptions.begin(),
+ this->Rcc.ListOptions.end());
cmd.push_back(fileNameName);
result = cmSystemTools::RunSingleCommand(
cmd, &rccStdOut, &rccStdErr, &retVal, fileDir.c_str(),
diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h
index 5fbf0cb..ce00e00 100644
--- a/Source/cmQtAutoGenInitializer.h
+++ b/Source/cmQtAutoGenInitializer.h
@@ -12,15 +12,12 @@
#include <vector>
class cmGeneratorTarget;
+class cmTarget;
/// @brief Initializes the QtAutoGen generators
class cmQtAutoGenInitializer : public cmQtAutoGen
{
public:
- static std::string GetQtMajorVersion(cmGeneratorTarget const* target);
- static std::string GetQtMinorVersion(cmGeneratorTarget const* target,
- std::string const& qtVersionMajor);
-
/// @brief Rcc job information
class Qrc
{
@@ -38,6 +35,7 @@ public:
std::string PathChecksum;
std::string InfoFile;
std::string SettingsFile;
+ std::map<std::string, std::string> ConfigSettingsFile;
std::string RccFile;
bool Generated;
bool Unique;
@@ -46,21 +44,32 @@ public:
};
public:
+ static IntegerVersion GetQtVersion(cmGeneratorTarget const* target);
+
cmQtAutoGenInitializer(cmGeneratorTarget* target, bool mocEnabled,
bool uicEnabled, bool rccEnabled,
- std::string const& qtVersionMajor);
+ IntegerVersion const& qtVersion);
- void InitCustomTargets();
- void SetupCustomTargets();
+ bool InitCustomTargets();
+ bool SetupCustomTargets();
private:
- void SetupCustomTargetsMoc();
- void SetupCustomTargetsUic();
+ bool InitMoc();
+ bool InitUic();
+ bool InitRcc();
+
+ bool InitScanFiles();
+ bool InitAutogenTarget();
+ bool InitRccTargets();
+
+ bool SetupWriteAutogenInfo();
+ bool SetupWriteRccInfo();
void AddGeneratedSource(std::string const& filename, GeneratorT genType);
- bool QtVersionGreaterOrEqual(unsigned long requestMajor,
- unsigned long requestMinor) const;
+ bool GetMocExecutable();
+ bool GetUicExecutable();
+ bool GetRccExecutable();
bool RccListInputs(std::string const& fileName,
std::vector<std::string>& files,
@@ -68,49 +77,80 @@ private:
private:
cmGeneratorTarget* Target;
- bool MocEnabled;
- bool UicEnabled;
- bool RccEnabled;
- bool MultiConfig;
- // Qt
- std::string QtVersionMajor;
- std::string QtVersionMinor;
- std::string MocExecutable;
- std::string UicExecutable;
- std::string RccExecutable;
- std::vector<std::string> RccListOptions;
- // Configurations
+
+ // Configuration
+ IntegerVersion QtVersion;
+ bool MultiConfig = false;
std::string ConfigDefault;
std::vector<std::string> ConfigsList;
- std::string Parallel;
- // Names
- std::string AutogenTargetName;
- std::string AutogenFolder;
- std::string AutogenInfoFile;
- std::string AutogenSettingsFile;
- // Directories
- std::string DirInfo;
- std::string DirBuild;
- std::string DirWork;
- // Sources
- std::vector<std::string> Headers;
- std::vector<std::string> Sources;
- // Moc
- std::string MocPredefsCmd;
- std::set<std::string> MocSkip;
- std::string MocIncludes;
- std::map<std::string, std::string> MocIncludesConfig;
- std::string MocDefines;
- std::map<std::string, std::string> MocDefinesConfig;
- // Uic
- std::set<std::string> UicSkip;
- std::vector<std::string> UicSearchPaths;
- std::string UicOptions;
- std::map<std::string, std::string> UicOptionsConfig;
- std::vector<std::string> UicFileFiles;
- std::vector<std::vector<std::string>> UicFileOptions;
- // Rcc
- std::vector<Qrc> Qrcs;
+ std::string Verbosity;
+ std::string TargetsFolder;
+
+ /// @brief Common directories
+ struct
+ {
+ std::string Info;
+ std::string Build;
+ std::string Work;
+ std::string Include;
+ std::map<std::string, std::string> ConfigInclude;
+ } Dir;
+
+ /// @brief Autogen target variables
+ struct
+ {
+ std::string Name;
+ // Settings
+ std::string Parallel;
+ // Configuration files
+ std::string InfoFile;
+ std::string SettingsFile;
+ std::map<std::string, std::string> ConfigSettingsFile;
+ // Dependencies
+ std::set<std::string> DependFiles;
+ std::set<cmTarget*> DependTargets;
+ // Sources to process
+ std::vector<std::string> Headers;
+ std::vector<std::string> Sources;
+ std::vector<std::string> HeadersGenerated;
+ std::vector<std::string> SourcesGenerated;
+ } AutogenTarget;
+
+ /// @brief Moc only variables
+ struct
+ {
+ bool Enabled = false;
+ std::string Executable;
+ std::string PredefsCmd;
+ std::set<std::string> Skip;
+ std::string Includes;
+ std::map<std::string, std::string> ConfigIncludes;
+ std::string Defines;
+ std::map<std::string, std::string> ConfigDefines;
+ std::string MocsCompilation;
+ } Moc;
+
+ ///@brief Uic only variables
+ struct
+ {
+ bool Enabled = false;
+ std::string Executable;
+ std::set<std::string> Skip;
+ std::vector<std::string> SearchPaths;
+ std::string Options;
+ std::map<std::string, std::string> ConfigOptions;
+ std::vector<std::string> FileFiles;
+ std::vector<std::vector<std::string>> FileOptions;
+ } Uic;
+
+ /// @brief Rcc only variables
+ struct
+ {
+ bool Enabled = false;
+ std::string Executable;
+ std::vector<std::string> ListOptions;
+ std::vector<Qrc> Qrcs;
+ } Rcc;
};
#endif
diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx
index 7aa792f..64ce0e3 100644
--- a/Source/cmQtAutoGenerator.cxx
+++ b/Source/cmQtAutoGenerator.cxx
@@ -17,9 +17,14 @@
// -- Class methods
-void cmQtAutoGenerator::Logger::SetVerbose(bool value)
+void cmQtAutoGenerator::Logger::RaiseVerbosity(std::string const& value)
{
- Verbose_ = value;
+ unsigned long verbosity = 0;
+ if (cmSystemTools::StringToULong(value.c_str(), &verbosity)) {
+ if (this->Verbosity_ < verbosity) {
+ this->Verbosity_ = static_cast<unsigned int>(verbosity);
+ }
+ }
}
void cmQtAutoGenerator::Logger::SetColorOutput(bool value)
@@ -632,7 +637,18 @@ cmQtAutoGenerator::cmQtAutoGenerator()
: FileSys_(&Logger_)
{
// Initialize logger
- Logger_.SetVerbose(cmSystemTools::HasEnv("VERBOSE"));
+ {
+ std::string verbose;
+ if (cmSystemTools::GetEnv("VERBOSE", verbose) && !verbose.empty()) {
+ unsigned long iVerbose = 0;
+ if (cmSystemTools::StringToULong(verbose.c_str(), &iVerbose)) {
+ Logger_.SetVerbosity(static_cast<unsigned int>(iVerbose));
+ } else {
+ // Non numeric verbosity
+ Logger_.SetVerbose(cmSystemTools::IsOn(verbose.c_str()));
+ }
+ }
+ }
{
std::string colorEnv;
cmSystemTools::GetEnv("COLOR", colorEnv);
diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h
index 4e38413..75143f5 100644
--- a/Source/cmQtAutoGenerator.h
+++ b/Source/cmQtAutoGenerator.h
@@ -33,8 +33,11 @@ public:
{
public:
// -- Verbosity
- bool Verbose() const { return this->Verbose_; }
- void SetVerbose(bool value);
+ unsigned int Verbosity() const { return this->Verbosity_; }
+ void SetVerbosity(unsigned int value) { this->Verbosity_ = value; }
+ void RaiseVerbosity(std::string const& value);
+ bool Verbose() const { return (this->Verbosity_ != 0); }
+ void SetVerbose(bool value) { this->Verbosity_ = value ? 1 : 0; }
bool ColorOutput() const { return this->ColorOutput_; }
void SetColorOutput(bool value);
// -- Log info
@@ -56,8 +59,8 @@ public:
private:
std::mutex Mutex_;
- bool volatile Verbose_ = false;
- bool volatile ColorOutput_ = false;
+ unsigned int Verbosity_ = 0;
+ bool ColorOutput_ = false;
};
/// @brief Thread safe file system interface
diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx
index f196b97..c364700 100644
--- a/Source/cmQtAutoGeneratorMocUic.cxx
+++ b/Source/cmQtAutoGeneratorMocUic.cxx
@@ -1222,6 +1222,7 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile)
}
// -- Meta
+ Log().RaiseVerbosity(InfoGet("AM_VERBOSITY"));
Base_.MultiConfig = InfoGetBool("AM_MULTI_CONFIG");
{
unsigned long num = Base_.NumThreads;
@@ -1246,14 +1247,11 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile)
return false;
}
// include directory
- {
- std::string dirRel = InfoGetConfig("AM_INCLUDE_DIR");
- if (dirRel.empty()) {
- Log().ErrorFile(GeneratorT::GEN, InfoFile(),
- "Autogen include directory missing");
- return false;
- }
- Base_.AutogenIncludeDir = Base_.AbsoluteBuildPath(dirRel);
+ Base_.AutogenIncludeDir = InfoGetConfig("AM_INCLUDE_DIR");
+ if (Base_.AutogenIncludeDir.empty()) {
+ Log().ErrorFile(GeneratorT::GEN, InfoFile(),
+ "Autogen include directory missing");
+ return false;
}
// - Files
diff --git a/Source/cmQtAutoGeneratorRcc.cxx b/Source/cmQtAutoGeneratorRcc.cxx
index 3064895..6caa0d8 100644
--- a/Source/cmQtAutoGeneratorRcc.cxx
+++ b/Source/cmQtAutoGeneratorRcc.cxx
@@ -70,6 +70,7 @@ bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile)
}
// - Configurations
+ Log().RaiseVerbosity(InfoGet("ARCC_VERBOSITY"));
MultiConfig_ = makefile->IsOn("ARCC_MULTI_CONFIG");
// - Directories
@@ -140,9 +141,7 @@ bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile)
// Compute rcc output file name
if (IsMultiConfig()) {
- RccFileOutput_ = AutogenBuildDir_;
- RccFileOutput_ += '/';
- RccFileOutput_ += IncludeDir_;
+ RccFileOutput_ = IncludeDir_;
RccFileOutput_ += '/';
RccFileOutput_ += MultiConfigOutput();
} else {
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index 12817ae..32ad0b0 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -34,7 +34,7 @@ cmRST::cmRST(std::ostream& os, std::string const& docroot)
, NoteDirective("^.. note::[ \t]*(.*)$")
, ModuleRST("^#\\[(=*)\\[\\.rst:$")
, CMakeRole("(:cmake)?:("
- "command|generator|variable|envvar|module|policy|"
+ "command|cpack_gen|generator|variable|envvar|module|policy|"
"prop_cache|prop_dir|prop_gbl|prop_inst|prop_sf|"
"prop_test|prop_tgt|"
"manual"
diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx
index 5b29868..5dd4413 100644
--- a/Source/cmSearchPath.cxx
+++ b/Source/cmSearchPath.cxx
@@ -69,7 +69,8 @@ void cmSearchPath::AddUserPath(const std::string& path)
// Process them all from the current directory
for (std::string const& p : outPaths) {
- this->AddPathInternal(p, this->FC->Makefile->GetCurrentSourceDirectory());
+ this->AddPathInternal(
+ p, this->FC->Makefile->GetCurrentSourceDirectory().c_str());
}
}
@@ -83,8 +84,8 @@ void cmSearchPath::AddCMakePath(const std::string& variable)
cmSystemTools::ExpandListArgument(value, expanded);
for (std::string const& p : expanded) {
- this->AddPathInternal(p,
- this->FC->Makefile->GetCurrentSourceDirectory());
+ this->AddPathInternal(
+ p, this->FC->Makefile->GetCurrentSourceDirectory().c_str());
}
}
}
@@ -107,8 +108,8 @@ void cmSearchPath::AddCMakePrefixPath(const std::string& variable)
std::vector<std::string> expanded;
cmSystemTools::ExpandListArgument(value, expanded);
- this->AddPrefixPaths(expanded,
- this->FC->Makefile->GetCurrentSourceDirectory());
+ this->AddPrefixPaths(
+ expanded, this->FC->Makefile->GetCurrentSourceDirectory().c_str());
}
}
diff --git a/Source/cmServerDictionary.h b/Source/cmServerDictionary.h
index 685542c..ebf16eb 100644
--- a/Source/cmServerDictionary.h
+++ b/Source/cmServerDictionary.h
@@ -96,6 +96,7 @@ static const std::string kCTEST_COMMAND = "ctestCommand";
static const std::string kCTEST_INFO = "ctestInfo";
static const std::string kMINIMUM_CMAKE_VERSION = "minimumCMakeVersion";
static const std::string kIS_GENERATOR_PROVIDED_KEY = "isGeneratorProvided";
+static const std::string kIS_INTERFACE_SOURCES_KEY = "isInterfaceSources";
static const std::string kSTART_MAGIC = "[== \"CMake Server\" ==[";
static const std::string kEND_MAGIC = "]== \"CMake Server\" ==]";
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index c267160..af4b466 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -256,7 +256,12 @@ bool cmServerProtocol::DoActivate(const cmServerRequest& /*request*/,
std::pair<int, int> cmServerProtocol1::ProtocolVersion() const
{
- return std::make_pair(1, 2);
+ // Revision history
+ // 1, 1 - Report backtraces in codemodel response
+ // 1, 2 - Add target install destinations to codemodel
+ // 1, 3 - Add a flag to target filegroups indicating whether or not the
+ // filegroup is for INTERFACE_SOURCES
+ return std::make_pair(1, 3);
}
static void setErrorMessage(std::string* errorMessage, const std::string& text)
@@ -593,6 +598,8 @@ cmServerResponse cmServerProtocol1::ProcessCMakeInputs(
return request.Reply(result);
}
+const std::string kInterfaceSourcesLanguageDataKey =
+ "INTERFACE_SOURCES_LD_KEY";
class LanguageData
{
public:
@@ -625,6 +632,12 @@ void LanguageData::SetDefines(const std::set<std::string>& defines)
Defines = std::move(result);
}
+struct FileGroupSources
+{
+ bool IsInterfaceSources;
+ std::vector<std::string> Files;
+};
+
namespace std {
template <>
@@ -652,31 +665,35 @@ struct hash<LanguageData>
} // namespace std
static Json::Value DumpSourceFileGroup(const LanguageData& data,
+ bool isInterfaceSource,
const std::vector<std::string>& files,
const std::string& baseDir)
{
Json::Value result = Json::objectValue;
+ if (isInterfaceSource) {
+ result[kIS_INTERFACE_SOURCES_KEY] = true;
+ }
if (!data.Language.empty()) {
result[kLANGUAGE_KEY] = data.Language;
- if (!data.Flags.empty()) {
- result[kCOMPILE_FLAGS_KEY] = data.Flags;
- }
- if (!data.IncludePathList.empty()) {
- Json::Value includes = Json::arrayValue;
- for (auto const& i : data.IncludePathList) {
- Json::Value tmp = Json::objectValue;
- tmp[kPATH_KEY] = i.first;
- if (i.second) {
- tmp[kIS_SYSTEM_KEY] = i.second;
- }
- includes.append(tmp);
+ }
+ if (!data.Flags.empty()) {
+ result[kCOMPILE_FLAGS_KEY] = data.Flags;
+ }
+ if (!data.IncludePathList.empty()) {
+ Json::Value includes = Json::arrayValue;
+ for (auto const& i : data.IncludePathList) {
+ Json::Value tmp = Json::objectValue;
+ tmp[kPATH_KEY] = i.first;
+ if (i.second) {
+ tmp[kIS_SYSTEM_KEY] = i.second;
}
- result[kINCLUDE_PATH_KEY] = includes;
- }
- if (!data.Defines.empty()) {
- result[kDEFINES_KEY] = fromStringList(data.Defines);
+ includes.append(tmp);
}
+ result[kINCLUDE_PATH_KEY] = includes;
+ }
+ if (!data.Defines.empty()) {
+ result[kDEFINES_KEY] = fromStringList(data.Defines);
}
result[kIS_GENERATED_KEY] = data.IsGenerated;
@@ -691,21 +708,19 @@ static Json::Value DumpSourceFileGroup(const LanguageData& data,
return result;
}
-static Json::Value DumpSourceFilesList(
- cmGeneratorTarget* target, const std::string& config,
- const std::map<std::string, LanguageData>& languageDataMap)
+static void PopulateFileGroupData(
+ cmGeneratorTarget* target, bool isInterfaceSources,
+ const std::vector<cmSourceFile*>& files, const std::string& config,
+ const std::map<std::string, LanguageData>& languageDataMap,
+ std::unordered_map<LanguageData, FileGroupSources>& fileGroups)
{
- // Collect sourcefile groups:
-
- std::vector<cmSourceFile*> files;
- target->GetSourceFiles(files, config);
-
- std::unordered_map<LanguageData, std::vector<std::string>> fileGroups;
for (cmSourceFile* file : files) {
LanguageData fileData;
fileData.Language = file->GetLanguage();
- if (!fileData.Language.empty()) {
- const LanguageData& ld = languageDataMap.at(fileData.Language);
+ if (!fileData.Language.empty() || isInterfaceSources) {
+ const LanguageData& ld = isInterfaceSources
+ ? languageDataMap.at(kInterfaceSourcesLanguageDataKey)
+ : languageDataMap.at(fileData.Language);
cmLocalGenerator* lg = target->GetLocalGenerator();
cmGeneratorExpressionInterpreter genexInterpreter(
lg, target, config, target->GetName(), fileData.Language);
@@ -728,15 +743,19 @@ static Json::Value DumpSourceFilesList(
const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
if (const char* cincludes = file->GetProperty(INCLUDE_DIRECTORIES)) {
- const char* evaluatedIncludes =
+ const std::string& evaluatedIncludes =
genexInterpreter.Evaluate(cincludes, INCLUDE_DIRECTORIES);
lg->AppendIncludeDirectories(includes, evaluatedIncludes, *file);
for (const auto& include : includes) {
+ // INTERFACE_LIBRARY targets do not support the
+ // IsSystemIncludeDirectory call so just set it to false.
+ const bool isSystemInclude = isInterfaceSources
+ ? false
+ : target->IsSystemIncludeDirectory(include, config,
+ fileData.Language);
fileData.IncludePathList.push_back(
- std::make_pair(include,
- target->IsSystemIncludeDirectory(
- include, config, fileData.Language)));
+ std::make_pair(include, isSystemInclude));
}
}
@@ -765,14 +784,71 @@ static Json::Value DumpSourceFilesList(
}
fileData.IsGenerated = file->GetPropertyAsBool("GENERATED");
- std::vector<std::string>& groupFileList = fileGroups[fileData];
- groupFileList.push_back(file->GetFullPath());
+ FileGroupSources& groupFileList = fileGroups[fileData];
+ groupFileList.IsInterfaceSources = isInterfaceSources;
+ groupFileList.Files.push_back(file->GetFullPath());
}
+}
+
+static Json::Value DumpSourceFilesList(
+ cmGeneratorTarget* target, const std::string& config,
+ const std::map<std::string, LanguageData>& languageDataMap)
+{
+ const cmStateEnums::TargetType type = target->GetType();
+ std::unordered_map<LanguageData, FileGroupSources> fileGroups;
+
+ // Collect sourcefile groups:
+
+ std::vector<cmSourceFile*> files;
+ if (type == cmStateEnums::INTERFACE_LIBRARY) {
+ // INTERFACE_LIBRARY targets do not create all the data structures
+ // associated with regular targets. If properties are explicitly specified
+ // for files in INTERFACE_SOURCES then we can get them through the Makefile
+ // rather than the target.
+ files = target->Makefile->GetSourceFiles();
+ } else {
+ target->GetSourceFiles(files, config);
+ PopulateFileGroupData(target, false /* isInterfaceSources */, files,
+ config, languageDataMap, fileGroups);
+ }
+
+ // Collect interface sourcefile groups:
+
+ auto targetProp = target->Target->GetProperty("INTERFACE_SOURCES");
+ if (targetProp != nullptr) {
+ cmGeneratorExpressionInterpreter genexInterpreter(
+ target->GetLocalGenerator(), target, config, target->GetName(), "");
- const std::string baseDir = target->Makefile->GetCurrentSourceDirectory();
+ auto evaluatedSources = cmsys::SystemTools::SplitString(
+ genexInterpreter.Evaluate(targetProp, "INTERFACE_SOURCES"), ';');
+
+ std::map<std::string, cmSourceFile*> filesMap;
+ for (auto file : files) {
+ filesMap[file->GetFullPath()] = file;
+ }
+
+ std::vector<cmSourceFile*> interfaceSourceFiles;
+ for (const std::string& interfaceSourceFilePath : evaluatedSources) {
+ auto entry = filesMap.find(interfaceSourceFilePath);
+ if (entry != filesMap.end()) {
+ // use what we have since it has all the associated properties
+ interfaceSourceFiles.push_back(entry->second);
+ } else {
+ interfaceSourceFiles.push_back(
+ new cmSourceFile(target->Makefile, interfaceSourceFilePath));
+ }
+ }
+
+ PopulateFileGroupData(target, true /* isInterfaceSources */,
+ interfaceSourceFiles, config, languageDataMap,
+ fileGroups);
+ }
+
+ const std::string& baseDir = target->Makefile->GetCurrentSourceDirectory();
Json::Value result = Json::arrayValue;
for (auto const& it : fileGroups) {
- Json::Value group = DumpSourceFileGroup(it.first, it.second, baseDir);
+ Json::Value group = DumpSourceFileGroup(
+ it.first, it.second.IsInterfaceSources, it.second.Files, baseDir);
if (!group.isNull()) {
result.append(group);
}
@@ -797,9 +873,8 @@ static Json::Value DumpCTestInfo(cmLocalGenerator* lg, cmTest* testInfo,
// Remove any config specific variables from the output.
cmGeneratorExpression ge;
- auto cge = ge.Parse(command.c_str());
- const char* processed = cge->Evaluate(lg, config);
-
+ auto cge = ge.Parse(command);
+ const std::string& processed = cge->Evaluate(lg, config);
result[kCTEST_COMMAND] = processed;
// Build up the list of properties that may have been specified
@@ -810,7 +885,7 @@ static Json::Value DumpCTestInfo(cmLocalGenerator* lg, cmTest* testInfo,
// Remove config variables from the value too.
auto cge_value = ge.Parse(prop.second.GetValue());
- const char* processed_value = cge_value->Evaluate(lg, config);
+ const std::string& processed_value = cge_value->Evaluate(lg, config);
entry[kVALUE_KEY] = processed_value;
properties.append(entry);
}
@@ -883,6 +958,59 @@ static Json::Value DumpCTestConfigurationsList(const cmake* cm)
return result;
}
+static void GetTargetProperty(
+ cmGeneratorExpressionInterpreter& genexInterpreter,
+ cmGeneratorTarget* target, const char* propertyName,
+ std::vector<std::string>& propertyValue)
+{
+ auto targetProp = target->Target->GetProperty(propertyName);
+ if (targetProp != nullptr) {
+ propertyValue = cmsys::SystemTools::SplitString(
+ genexInterpreter.Evaluate(targetProp, propertyName), ';');
+ }
+}
+
+static void CreateInterfaceSourcesEntry(
+ cmLocalGenerator* lg, cmGeneratorTarget* target, const std::string& config,
+ std::map<std::string, LanguageData>& languageDataMap)
+{
+ LanguageData& ld = languageDataMap[kInterfaceSourcesLanguageDataKey];
+ ld.Language = "";
+
+ cmGeneratorExpressionInterpreter genexInterpreter(lg, target, config,
+ target->GetName(), "");
+ std::vector<std::string> propertyValue;
+ GetTargetProperty(genexInterpreter, target, "INTERFACE_INCLUDE_DIRECTORIES",
+ propertyValue);
+ for (std::string const& i : propertyValue) {
+ ld.IncludePathList.push_back(
+ std::make_pair(i, false /* isSystemInclude */));
+ }
+
+ propertyValue.clear();
+ GetTargetProperty(genexInterpreter, target,
+ "INTERFACE_SYSTEM_INCLUDE_DIRECTORIES", propertyValue);
+ for (std::string const& i : propertyValue) {
+ ld.IncludePathList.push_back(
+ std::make_pair(i, true /* isSystemInclude */));
+ }
+
+ propertyValue.clear();
+ GetTargetProperty(genexInterpreter, target, "INTERFACE_COMPILE_OPTIONS",
+ propertyValue);
+ for (const auto& s : propertyValue) {
+ ld.Flags += " " + s;
+ }
+
+ propertyValue.clear();
+ GetTargetProperty(genexInterpreter, target, "INTERFACE_COMPILE_DEFINITIONS",
+ propertyValue);
+ if (!propertyValue.empty()) {
+ std::set<std::string> defines(propertyValue.begin(), propertyValue.end());
+ ld.SetDefines(defines);
+ }
+}
+
static Json::Value DumpTarget(cmGeneratorTarget* target,
const std::string& config)
{
@@ -912,11 +1040,6 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
result[kTYPE_KEY] = typeName;
result[kSOURCE_DIRECTORY_KEY] = lg->GetCurrentSourceDirectory();
result[kBUILD_DIRECTORY_KEY] = lg->GetCurrentBinaryDirectory();
-
- if (type == cmStateEnums::INTERFACE_LIBRARY) {
- return result;
- }
-
result[kFULL_NAME_KEY] = target->GetFullName(config);
if (target->Target->GetHaveInstallRule()) {
@@ -1003,8 +1126,22 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
}
std::set<std::string> languages;
- target->GetLanguages(languages, config);
std::map<std::string, LanguageData> languageDataMap;
+ if (type == cmStateEnums::INTERFACE_LIBRARY) {
+ // INTERFACE_LIBRARY targets do not create all the data structures
+ // associated with regular targets. If properties are explicitly specified
+ // for files in INTERFACE_SOURCES then we can get them through the Makefile
+ // rather than the target.
+ for (auto file : target->Makefile->GetSourceFiles()) {
+ const std::string& language = file->GetLanguage();
+ if (!language.empty()) {
+ languages.insert(language);
+ }
+ }
+ } else {
+ target->GetLanguages(languages, config);
+ }
+
for (std::string const& lang : languages) {
LanguageData& ld = languageDataMap[lang];
ld.Language = lang;
@@ -1020,6 +1157,11 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
}
}
+ if (target->Target->GetProperty("INTERFACE_SOURCES") != nullptr) {
+ // Create an entry in the languageDataMap for interface sources.
+ CreateInterfaceSourcesEntry(lg, target, config, languageDataMap);
+ }
+
Json::Value sourceGroupsValue =
DumpSourceFilesList(target, config, languageDataMap);
if (!sourceGroupsValue.empty()) {
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 6792d66..5d1f3f0 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -132,8 +132,8 @@ bool cmSourceFile::FindFullPath(std::string* error)
cmMakefile const* mf = this->Location.GetMakefile();
const char* tryDirs[3] = { nullptr, nullptr, nullptr };
if (this->Location.DirectoryIsAmbiguous()) {
- tryDirs[0] = mf->GetCurrentSourceDirectory();
- tryDirs[1] = mf->GetCurrentBinaryDirectory();
+ tryDirs[0] = mf->GetCurrentSourceDirectory().c_str();
+ tryDirs[1] = mf->GetCurrentBinaryDirectory().c_str();
} else {
tryDirs[0] = "";
}
@@ -296,6 +296,15 @@ const char* cmSourceFile::GetProperty(const std::string& prop) const
return retVal;
}
+const char* cmSourceFile::GetSafeProperty(const std::string& prop) const
+{
+ const char* ret = this->GetProperty(prop);
+ if (!ret) {
+ return "";
+ }
+ return ret;
+}
+
bool cmSourceFile::GetPropertyAsBool(const std::string& prop) const
{
return cmSystemTools::IsOn(this->GetProperty(prop));
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index 1516d98..ab0f229 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -45,7 +45,10 @@ public:
void SetProperty(const std::string& prop, const char* value);
void AppendProperty(const std::string& prop, const char* value,
bool asString = false);
+ ///! Might return a nullptr if the property is not set or invalid
const char* GetProperty(const std::string& prop) const;
+ ///! Always returns a valid pointer
+ const char* GetSafeProperty(const std::string& prop) const;
bool GetPropertyAsBool(const std::string& prop) const;
/** Implement getting a property when called from a CMake language
diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index bd8d318..15433f9 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -205,18 +205,18 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
}
} else if (this->AmbiguousDirectory) {
// Compare possible directory combinations.
- std::string const& srcDir = cmSystemTools::CollapseFullPath(
+ std::string const srcDir = cmSystemTools::CollapseFullPath(
this->Directory, this->Makefile->GetCurrentSourceDirectory());
- std::string const& binDir = cmSystemTools::CollapseFullPath(
+ std::string const binDir = cmSystemTools::CollapseFullPath(
this->Directory, this->Makefile->GetCurrentBinaryDirectory());
if (srcDir != loc.Directory && binDir != loc.Directory) {
return false;
}
} else if (loc.AmbiguousDirectory) {
// Compare possible directory combinations.
- std::string const& srcDir = cmSystemTools::CollapseFullPath(
+ std::string const srcDir = cmSystemTools::CollapseFullPath(
loc.Directory, loc.Makefile->GetCurrentSourceDirectory());
- std::string const& binDir = cmSystemTools::CollapseFullPath(
+ std::string const binDir = cmSystemTools::CollapseFullPath(
loc.Directory, loc.Makefile->GetCurrentBinaryDirectory());
if (srcDir != this->Directory && binDir != this->Directory) {
return false;
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index a57be4d..5651594 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -267,6 +267,7 @@ cmStateSnapshot cmState::Reset()
{
this->GlobalProperties.clear();
this->PropertyDefinitions.clear();
+ this->GlobVerificationManager->Reset();
cmStateDetail::PositionType pos = this->SnapshotData.Truncate();
this->ExecutionListFiles.Truncate();
@@ -280,6 +281,8 @@ cmStateSnapshot cmState::Reset()
it->CompileDefinitionsBacktraces.clear();
it->CompileOptions.clear();
it->CompileOptionsBacktraces.clear();
+ it->LinkOptions.clear();
+ it->LinkOptionsBacktraces.clear();
it->DirectoryEnd = pos;
it->NormalTargetNames.clear();
it->Properties.clear();
diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx
index 85e6366..925b161 100644
--- a/Source/cmStateDirectory.cxx
+++ b/Source/cmStateDirectory.cxx
@@ -84,9 +84,9 @@ void cmStateDirectory::ComputeRelativePathTopBinary()
}
}
-const char* cmStateDirectory::GetCurrentSource() const
+std::string const& cmStateDirectory::GetCurrentSource() const
{
- return this->DirectoryState->Location.c_str();
+ return this->DirectoryState->Location;
}
void cmStateDirectory::SetCurrentSource(std::string const& dir)
@@ -101,9 +101,9 @@ void cmStateDirectory::SetCurrentSource(std::string const& dir)
this->Snapshot_.SetDefinition("CMAKE_CURRENT_SOURCE_DIR", loc);
}
-const char* cmStateDirectory::GetCurrentBinary() const
+std::string const& cmStateDirectory::GetCurrentBinary() const
{
- return this->DirectoryState->OutputLocation.c_str();
+ return this->DirectoryState->OutputLocation;
}
void cmStateDirectory::SetCurrentBinary(std::string const& dir)
@@ -118,14 +118,14 @@ void cmStateDirectory::SetCurrentBinary(std::string const& dir)
this->Snapshot_.SetDefinition("CMAKE_CURRENT_BINARY_DIR", loc);
}
-const char* cmStateDirectory::GetRelativePathTopSource() const
+std::string const& cmStateDirectory::GetRelativePathTopSource() const
{
- return this->DirectoryState->RelativePathTopSource.c_str();
+ return this->DirectoryState->RelativePathTopSource;
}
-const char* cmStateDirectory::GetRelativePathTopBinary() const
+std::string const& cmStateDirectory::GetRelativePathTopBinary() const
{
- return this->DirectoryState->RelativePathTopBinary.c_str();
+ return this->DirectoryState->RelativePathTopBinary;
}
void cmStateDirectory::SetRelativePathTopSource(const char* dir)
@@ -360,6 +360,42 @@ void cmStateDirectory::ClearCompileOptions()
this->Snapshot_.Position->CompileOptionsPosition);
}
+cmStringRange cmStateDirectory::GetLinkOptionsEntries() const
+{
+ return GetPropertyContent(this->DirectoryState->LinkOptions,
+ this->Snapshot_.Position->LinkOptionsPosition);
+}
+
+cmBacktraceRange cmStateDirectory::GetLinkOptionsEntryBacktraces() const
+{
+ return GetPropertyBacktraces(this->DirectoryState->LinkOptions,
+ this->DirectoryState->LinkOptionsBacktraces,
+ this->Snapshot_.Position->LinkOptionsPosition);
+}
+
+void cmStateDirectory::AppendLinkOptionsEntry(const std::string& vec,
+ const cmListFileBacktrace& lfbt)
+{
+ AppendEntry(this->DirectoryState->LinkOptions,
+ this->DirectoryState->LinkOptionsBacktraces,
+ this->Snapshot_.Position->LinkOptionsPosition, vec, lfbt);
+}
+
+void cmStateDirectory::SetLinkOptions(const std::string& vec,
+ const cmListFileBacktrace& lfbt)
+{
+ SetContent(this->DirectoryState->LinkOptions,
+ this->DirectoryState->LinkOptionsBacktraces,
+ this->Snapshot_.Position->LinkOptionsPosition, vec, lfbt);
+}
+
+void cmStateDirectory::ClearLinkOptions()
+{
+ ClearContent(this->DirectoryState->LinkOptions,
+ this->DirectoryState->LinkOptionsBacktraces,
+ this->Snapshot_.Position->LinkOptionsPosition);
+}
+
void cmStateDirectory::SetProperty(const std::string& prop, const char* value,
cmListFileBacktrace const& lfbt)
{
@@ -387,6 +423,14 @@ void cmStateDirectory::SetProperty(const std::string& prop, const char* value,
this->SetCompileDefinitions(value, lfbt);
return;
}
+ if (prop == "LINK_OPTIONS") {
+ if (!value) {
+ this->ClearLinkOptions();
+ return;
+ }
+ this->SetLinkOptions(value, lfbt);
+ return;
+ }
this->DirectoryState->Properties.SetProperty(prop, value);
}
@@ -407,6 +451,10 @@ void cmStateDirectory::AppendProperty(const std::string& prop,
this->AppendCompileDefinitionsEntry(value, lfbt);
return;
}
+ if (prop == "LINK_OPTIONS") {
+ this->AppendLinkOptionsEntry(value, lfbt);
+ return;
+ }
this->DirectoryState->Properties.AppendProperty(prop, value, asString);
}
@@ -426,7 +474,7 @@ const char* cmStateDirectory::GetProperty(const std::string& prop,
if (prop == "PARENT_DIRECTORY") {
cmStateSnapshot parent = this->Snapshot_.GetBuildsystemDirectoryParent();
if (parent.IsValid()) {
- return parent.GetDirectory().GetCurrentSource();
+ return parent.GetDirectory().GetCurrentSource().c_str();
}
return "";
}
@@ -490,6 +538,10 @@ const char* cmStateDirectory::GetProperty(const std::string& prop,
output = cmJoin(this->GetCompileDefinitionsEntries(), ";");
return output.c_str();
}
+ if (prop == "LINK_OPTIONS") {
+ output = cmJoin(this->GetLinkOptionsEntries(), ";");
+ return output.c_str();
+ }
const char* retVal = this->DirectoryState->Properties.GetPropertyValue(prop);
if (!retVal && chain) {
diff --git a/Source/cmStateDirectory.h b/Source/cmStateDirectory.h
index 79bb369..412664f 100644
--- a/Source/cmStateDirectory.h
+++ b/Source/cmStateDirectory.h
@@ -22,13 +22,13 @@ class cmStateDirectory
cmStateSnapshot const& snapshot);
public:
- const char* GetCurrentSource() const;
+ std::string const& GetCurrentSource() const;
void SetCurrentSource(std::string const& dir);
- const char* GetCurrentBinary() const;
+ std::string const& GetCurrentBinary() const;
void SetCurrentBinary(std::string const& dir);
- const char* GetRelativePathTopSource() const;
- const char* GetRelativePathTopBinary() const;
+ std::string const& GetRelativePathTopSource() const;
+ std::string const& GetRelativePathTopBinary() const;
void SetRelativePathTopSource(const char* dir);
void SetRelativePathTopBinary(const char* dir);
@@ -58,6 +58,13 @@ public:
cmListFileBacktrace const& lfbt);
void ClearCompileOptions();
+ cmStringRange GetLinkOptionsEntries() const;
+ cmBacktraceRange GetLinkOptionsEntryBacktraces() const;
+ void AppendLinkOptionsEntry(std::string const& vec,
+ cmListFileBacktrace const& lfbt);
+ void SetLinkOptions(std::string const& vec, cmListFileBacktrace const& lfbt);
+ void ClearLinkOptions();
+
void SetProperty(const std::string& prop, const char* value,
cmListFileBacktrace const& lfbt);
void AppendProperty(const std::string& prop, const char* value,
diff --git a/Source/cmStatePrivate.h b/Source/cmStatePrivate.h
index f36ee37..7177221 100644
--- a/Source/cmStatePrivate.h
+++ b/Source/cmStatePrivate.h
@@ -42,6 +42,7 @@ struct cmStateDetail::SnapshotDataType
std::vector<std::string>::size_type IncludeDirectoryPosition;
std::vector<std::string>::size_type CompileDefinitionsPosition;
std::vector<std::string>::size_type CompileOptionsPosition;
+ std::vector<std::string>::size_type LinkOptionsPosition;
};
struct cmStateDetail::PolicyStackEntry : public cmPolicies::PolicyMap
@@ -84,6 +85,9 @@ struct cmStateDetail::BuildsystemDirectoryStateType
std::vector<std::string> CompileOptions;
std::vector<cmListFileBacktrace> CompileOptionsBacktraces;
+ std::vector<std::string> LinkOptions;
+ std::vector<cmListFileBacktrace> LinkOptionsBacktraces;
+
std::vector<std::string> NormalTargetNames;
std::string ProjectName;
diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx
index 8f5f58c..ec428a6 100644
--- a/Source/cmStateSnapshot.cxx
+++ b/Source/cmStateSnapshot.cxx
@@ -390,6 +390,13 @@ void cmStateSnapshot::InitializeFromParent()
this->Position->BuildSystemDirectory->CompileOptionsBacktraces,
this->Position->CompileOptionsPosition);
+ InitializeContentFromParent(
+ parent->BuildSystemDirectory->LinkOptions,
+ this->Position->BuildSystemDirectory->LinkOptions,
+ parent->BuildSystemDirectory->LinkOptionsBacktraces,
+ this->Position->BuildSystemDirectory->LinkOptionsBacktraces,
+ this->Position->LinkOptionsPosition);
+
const char* include_regex =
parent->BuildSystemDirectory->Properties.GetPropertyValue(
"INCLUDE_REGULAR_EXPRESSION");
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index ed88a1e..1605fd7 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -273,7 +273,7 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
// Scan through the input for all matches.
std::string output;
- if (re.find(input.c_str())) {
+ if (re.find(input)) {
this->Makefile->StoreMatches(re);
std::string::size_type l = re.start();
std::string::size_type r = re.end();
diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx
index c74ca59..9d36228 100644
--- a/Source/cmSubdirCommand.cxx
+++ b/Source/cmSubdirCommand.cxx
@@ -30,18 +30,17 @@ bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args,
// if they specified a relative path then compute the full
std::string srcPath =
- std::string(this->Makefile->GetCurrentSourceDirectory()) + "/" + i;
+ this->Makefile->GetCurrentSourceDirectory() + "/" + i;
if (cmSystemTools::FileIsDirectory(srcPath)) {
std::string binPath =
- std::string(this->Makefile->GetCurrentBinaryDirectory()) + "/" + i;
+ this->Makefile->GetCurrentBinaryDirectory() + "/" + i;
this->Makefile->AddSubDirectory(srcPath, binPath, excludeFromAll, false);
}
// otherwise it is a full path
else if (cmSystemTools::FileIsDirectory(i)) {
// we must compute the binPath from the srcPath, we just take the last
// element from the source path and use that
- std::string binPath =
- std::string(this->Makefile->GetCurrentBinaryDirectory()) + "/" +
+ std::string binPath = this->Makefile->GetCurrentBinaryDirectory() + "/" +
cmSystemTools::GetFilenameName(i);
this->Makefile->AddSubDirectory(i, binPath, excludeFromAll, false);
} else {
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 72fd2bb..79e5ccf 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -42,7 +42,6 @@
#include <ctype.h>
#include <errno.h>
#include <iostream>
-#include <set>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
@@ -372,24 +371,36 @@ bool cmSystemTools::IsOn(const char* val)
if (!val) {
return false;
}
- size_t len = strlen(val);
- if (len > 4) {
- return false;
+ /* clang-format off */
+ // "1"
+ if (val[0] == '1' && val[1] == '\0') {
+ return true;
}
- std::string v(val, len);
-
- static std::set<std::string> onValues;
- if (onValues.empty()) {
- onValues.insert("ON");
- onValues.insert("1");
- onValues.insert("YES");
- onValues.insert("TRUE");
- onValues.insert("Y");
+ // "ON"
+ if ((val[0] == 'O' || val[0] == 'o') &&
+ (val[1] == 'N' || val[1] == 'n') && val[2] == '\0') {
+ return true;
}
- for (char& c : v) {
- c = static_cast<char>(toupper(c));
+ // "Y", "YES"
+ if ((val[0] == 'Y' || val[0] == 'y') && (val[1] == '\0' || (
+ (val[1] == 'E' || val[1] == 'e') &&
+ (val[2] == 'S' || val[2] == 's') && val[3] == '\0'))) {
+ return true;
}
- return (onValues.count(v) > 0);
+ // "TRUE"
+ if ((val[0] == 'T' || val[0] == 't') &&
+ (val[1] == 'R' || val[1] == 'r') &&
+ (val[2] == 'U' || val[2] == 'u') &&
+ (val[3] == 'E' || val[3] == 'e') && val[4] == '\0') {
+ return true;
+ }
+ /* clang-format on */
+ return false;
+}
+
+bool cmSystemTools::IsOn(const std::string& val)
+{
+ return cmSystemTools::IsOn(val.c_str());
}
bool cmSystemTools::IsNOTFOUND(const char* val)
@@ -402,30 +413,50 @@ bool cmSystemTools::IsNOTFOUND(const char* val)
bool cmSystemTools::IsOff(const char* val)
{
- if (!val || !*val) {
+ // ""
+ if (!val || val[0] == '\0') {
return true;
}
- size_t len = strlen(val);
- // Try and avoid toupper() for large strings.
- if (len > 6) {
- return cmSystemTools::IsNOTFOUND(val);
+ /* clang-format off */
+ // "0"
+ if (val[0] == '0' && val[1] == '\0') {
+ return true;
}
-
- static std::set<std::string> offValues;
- if (offValues.empty()) {
- offValues.insert("OFF");
- offValues.insert("0");
- offValues.insert("NO");
- offValues.insert("FALSE");
- offValues.insert("N");
- offValues.insert("IGNORE");
+ // "OFF"
+ if ((val[0] == 'O' || val[0] == 'o') &&
+ (val[1] == 'F' || val[1] == 'f') &&
+ (val[2] == 'F' || val[2] == 'f') && val[3] == '\0') {
+ return true;
}
- // Try and avoid toupper().
- std::string v(val, len);
- for (char& c : v) {
- c = static_cast<char>(toupper(c));
+ // "N", "NO"
+ if ((val[0] == 'N' || val[0] == 'n') && (val[1] == '\0' || (
+ (val[1] == 'O' || val[1] == 'o') && val[2] == '\0'))) {
+ return true;
}
- return (offValues.count(v) > 0);
+ // "FALSE"
+ if ((val[0] == 'F' || val[0] == 'f') &&
+ (val[1] == 'A' || val[1] == 'a') &&
+ (val[2] == 'L' || val[2] == 'l') &&
+ (val[3] == 'S' || val[3] == 's') &&
+ (val[4] == 'E' || val[4] == 'e') && val[5] == '\0') {
+ return true;
+ }
+ // "IGNORE"
+ if ((val[0] == 'I' || val[0] == 'i') &&
+ (val[1] == 'G' || val[1] == 'g') &&
+ (val[2] == 'N' || val[2] == 'n') &&
+ (val[3] == 'O' || val[3] == 'o') &&
+ (val[4] == 'R' || val[4] == 'r') &&
+ (val[5] == 'E' || val[5] == 'e') && val[6] == '\0') {
+ return true;
+ }
+ /* clang-format on */
+ return cmSystemTools::IsNOTFOUND(val);
+}
+
+bool cmSystemTools::IsOff(const std::string& val)
+{
+ return cmSystemTools::IsOff(val.c_str());
}
void cmSystemTools::ParseWindowsCommandLine(const char* command,
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index c0a1b6b..5c383ee 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -129,6 +129,7 @@ public:
* as ifdef.
*/
static bool IsOn(const char* val);
+ static bool IsOn(const std::string& val);
/**
* does a string indicate a false or off value ? Note that this is
@@ -138,6 +139,7 @@ public:
* NOTFOUND, *-NOTFOUND or IGNORE will cause IsOff to return true.
*/
static bool IsOff(const char* val);
+ static bool IsOff(const std::string& val);
///! Return true if value is NOTFOUND or ends in -NOTFOUND.
static bool IsNOTFOUND(const char* value);
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 1868816..cfcb31a 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -166,6 +166,8 @@ public:
std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces;
std::vector<std::string> SourceEntries;
std::vector<cmListFileBacktrace> SourceBacktraces;
+ std::vector<std::string> LinkOptionsEntries;
+ std::vector<cmListFileBacktrace> LinkOptionsBacktraces;
std::vector<std::string> LinkImplementationPropertyEntries;
std::vector<cmListFileBacktrace> LinkImplementationPropertyBacktraces;
};
@@ -276,6 +278,31 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
this->SetPropertyDefault("LINK_SEARCH_START_STATIC", nullptr);
this->SetPropertyDefault("LINK_SEARCH_END_STATIC", nullptr);
this->SetPropertyDefault("FOLDER", nullptr);
+#ifdef __APPLE__
+ if (this->GetGlobalGenerator()->IsXcode()) {
+ this->SetPropertyDefault("XCODE_SCHEME_ADDRESS_SANITIZER", nullptr);
+ this->SetPropertyDefault(
+ "XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN", nullptr);
+ this->SetPropertyDefault("XCODE_SCHEME_THREAD_SANITIZER", nullptr);
+ this->SetPropertyDefault("XCODE_SCHEME_THREAD_SANITIZER_STOP", nullptr);
+ this->SetPropertyDefault("XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER",
+ nullptr);
+ this->SetPropertyDefault(
+ "XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP", nullptr);
+ this->SetPropertyDefault("XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER",
+ nullptr);
+ this->SetPropertyDefault("XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP",
+ nullptr);
+ this->SetPropertyDefault("XCODE_SCHEME_MALLOC_SCRIBBLE", nullptr);
+ this->SetPropertyDefault("XCODE_SCHEME_MALLOC_GUARD_EDGES", nullptr);
+ this->SetPropertyDefault("XCODE_SCHEME_GUARD_MALLOC", nullptr);
+ this->SetPropertyDefault("XCODE_SCHEME_ZOMBIE_OBJECTS", nullptr);
+ this->SetPropertyDefault("XCODE_SCHEME_MALLOC_STACK", nullptr);
+ this->SetPropertyDefault("XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE",
+ nullptr);
+ this->SetPropertyDefault("XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS", nullptr);
+ }
+#endif
}
// Collect the set of configuration types.
@@ -343,17 +370,29 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
this->SystemIncludeDirectories.insert(parentSystemIncludes.begin(),
parentSystemIncludes.end());
- const cmStringRange parentOptions =
+ const cmStringRange parentCompileOptions =
this->Makefile->GetCompileOptionsEntries();
- const cmBacktraceRange parentOptionsBts =
+ const cmBacktraceRange parentCompileOptionsBts =
this->Makefile->GetCompileOptionsBacktraces();
this->Internal->CompileOptionsEntries.insert(
- this->Internal->CompileOptionsEntries.end(), parentOptions.begin(),
- parentOptions.end());
+ this->Internal->CompileOptionsEntries.end(),
+ parentCompileOptions.begin(), parentCompileOptions.end());
this->Internal->CompileOptionsBacktraces.insert(
- this->Internal->CompileOptionsBacktraces.end(), parentOptionsBts.begin(),
- parentOptionsBts.end());
+ this->Internal->CompileOptionsBacktraces.end(),
+ parentCompileOptionsBts.begin(), parentCompileOptionsBts.end());
+
+ const cmStringRange parentLinkOptions =
+ this->Makefile->GetLinkOptionsEntries();
+ const cmBacktraceRange parentLinkOptionsBts =
+ this->Makefile->GetLinkOptionsBacktraces();
+
+ this->Internal->LinkOptionsEntries.insert(
+ this->Internal->LinkOptionsEntries.end(), parentLinkOptions.begin(),
+ parentLinkOptions.end());
+ this->Internal->LinkOptionsBacktraces.insert(
+ this->Internal->LinkOptionsBacktraces.end(),
+ parentLinkOptionsBts.begin(), parentLinkOptionsBts.end());
}
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
@@ -822,6 +861,16 @@ cmBacktraceRange cmTarget::GetSourceBacktraces() const
return cmMakeRange(this->Internal->SourceBacktraces);
}
+cmStringRange cmTarget::GetLinkOptionsEntries() const
+{
+ return cmMakeRange(this->Internal->LinkOptionsEntries);
+}
+
+cmBacktraceRange cmTarget::GetLinkOptionsBacktraces() const
+{
+ return cmMakeRange(this->Internal->LinkOptionsBacktraces);
+}
+
cmStringRange cmTarget::GetLinkImplementationEntries() const
{
return cmMakeRange(this->Internal->LinkImplementationPropertyEntries);
@@ -847,6 +896,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
MAKE_STATIC_PROP(EXPORT_NAME);
MAKE_STATIC_PROP(IMPORTED_GLOBAL);
MAKE_STATIC_PROP(INCLUDE_DIRECTORIES);
+ MAKE_STATIC_PROP(LINK_OPTIONS);
MAKE_STATIC_PROP(LINK_LIBRARIES);
MAKE_STATIC_PROP(MANUALLY_ADDED_DEPENDENCIES);
MAKE_STATIC_PROP(NAME);
@@ -925,6 +975,14 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Internal->CompileDefinitionsBacktraces.push_back(lfbt);
}
+ } else if (prop == propLINK_OPTIONS) {
+ this->Internal->LinkOptionsEntries.clear();
+ this->Internal->LinkOptionsBacktraces.clear();
+ if (value) {
+ this->Internal->LinkOptionsEntries.push_back(value);
+ cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
+ this->Internal->LinkOptionsBacktraces.push_back(lfbt);
+ }
} else if (prop == propLINK_LIBRARIES) {
this->Internal->LinkImplementationPropertyEntries.clear();
this->Internal->LinkImplementationPropertyBacktraces.clear();
@@ -1030,6 +1088,12 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Internal->CompileDefinitionsBacktraces.push_back(lfbt);
}
+ } else if (prop == "LINK_OPTIONS") {
+ if (value && *value) {
+ this->Internal->LinkOptionsEntries.push_back(value);
+ cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
+ this->Internal->LinkOptionsBacktraces.push_back(lfbt);
+ }
} else if (prop == "LINK_LIBRARIES") {
if (value && *value) {
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
@@ -1063,10 +1127,11 @@ void cmTarget::AppendBuildInterfaceIncludes()
this->BuildInterfaceIncludesAppended = true;
if (this->Makefile->IsOn("CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE")) {
- const char* binDir = this->Makefile->GetCurrentBinaryDirectory();
- const char* srcDir = this->Makefile->GetCurrentSourceDirectory();
- const std::string dirs = std::string(binDir ? binDir : "") +
- std::string(binDir ? ";" : "") + std::string(srcDir ? srcDir : "");
+ std::string dirs = this->Makefile->GetCurrentBinaryDirectory();
+ if (!dirs.empty()) {
+ dirs += ';';
+ }
+ dirs += this->Makefile->GetCurrentSourceDirectory();
if (!dirs.empty()) {
this->AppendProperty("INTERFACE_INCLUDE_DIRECTORIES",
("$<BUILD_INTERFACE:" + dirs + ">").c_str());
@@ -1111,6 +1176,21 @@ void cmTarget::InsertCompileDefinition(std::string const& entry,
this->Internal->CompileDefinitionsBacktraces.push_back(bt);
}
+void cmTarget::InsertLinkOption(std::string const& entry,
+ cmListFileBacktrace const& bt, bool before)
+{
+ std::vector<std::string>::iterator position = before
+ ? this->Internal->LinkOptionsEntries.begin()
+ : this->Internal->LinkOptionsEntries.end();
+
+ std::vector<cmListFileBacktrace>::iterator btPosition = before
+ ? this->Internal->LinkOptionsBacktraces.begin()
+ : this->Internal->LinkOptionsBacktraces.end();
+
+ this->Internal->LinkOptionsEntries.insert(position, entry);
+ this->Internal->LinkOptionsBacktraces.insert(btPosition, bt);
+}
+
static void cmTargetCheckLINK_INTERFACE_LIBRARIES(const std::string& prop,
const char* value,
cmMakefile* context,
@@ -1230,6 +1310,7 @@ const char* cmTarget::GetProperty(const std::string& prop) const
MAKE_STATIC_PROP(COMPILE_FEATURES);
MAKE_STATIC_PROP(COMPILE_OPTIONS);
MAKE_STATIC_PROP(COMPILE_DEFINITIONS);
+ MAKE_STATIC_PROP(LINK_OPTIONS);
MAKE_STATIC_PROP(IMPORTED);
MAKE_STATIC_PROP(IMPORTED_GLOBAL);
MAKE_STATIC_PROP(MANUALLY_ADDED_DEPENDENCIES);
@@ -1245,6 +1326,7 @@ const char* cmTarget::GetProperty(const std::string& prop) const
specialProps.insert(propCOMPILE_FEATURES);
specialProps.insert(propCOMPILE_OPTIONS);
specialProps.insert(propCOMPILE_DEFINITIONS);
+ specialProps.insert(propLINK_OPTIONS);
specialProps.insert(propIMPORTED);
specialProps.insert(propIMPORTED_GLOBAL);
specialProps.insert(propMANUALLY_ADDED_DEPENDENCIES);
@@ -1303,6 +1385,15 @@ const char* cmTarget::GetProperty(const std::string& prop) const
output = cmJoin(this->Internal->CompileDefinitionsEntries, ";");
return output.c_str();
}
+ if (prop == propLINK_OPTIONS) {
+ if (this->Internal->LinkOptionsEntries.empty()) {
+ return nullptr;
+ }
+
+ static std::string output;
+ output = cmJoin(this->Internal->LinkOptionsEntries, ";");
+ return output.c_str();
+ }
if (prop == propMANUALLY_ADDED_DEPENDENCIES) {
if (this->Utilities.empty()) {
return nullptr;
@@ -1325,13 +1416,15 @@ const char* cmTarget::GetProperty(const std::string& prop) const
return this->GetMakefile()
->GetStateSnapshot()
.GetDirectory()
- .GetCurrentBinary();
+ .GetCurrentBinary()
+ .c_str();
}
if (prop == propSOURCE_DIR) {
return this->GetMakefile()
->GetStateSnapshot()
.GetDirectory()
- .GetCurrentSource();
+ .GetCurrentSource()
+ .c_str();
}
}
@@ -1347,6 +1440,15 @@ const char* cmTarget::GetProperty(const std::string& prop) const
return retVal;
}
+const char* cmTarget::GetSafeProperty(const std::string& prop) const
+{
+ const char* ret = this->GetProperty(prop);
+ if (!ret) {
+ return "";
+ }
+ return ret;
+}
+
bool cmTarget::GetPropertyAsBool(const std::string& prop) const
{
return cmSystemTools::IsOn(this->GetProperty(prop));
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 3abb47e..7a3ab65 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -200,7 +200,10 @@ public:
void SetProperty(const std::string& prop, const char* value);
void AppendProperty(const std::string& prop, const char* value,
bool asString = false);
+ ///! Might return a nullptr if the property is not set or invalid
const char* GetProperty(const std::string& prop) const;
+ ///! Always returns a valid pointer
+ const char* GetSafeProperty(const std::string& prop) const;
bool GetPropertyAsBool(const std::string& prop) const;
void CheckProperty(const std::string& prop, cmMakefile* context) const;
const char* GetComputedProperty(const std::string& prop,
@@ -239,6 +242,8 @@ public:
cmListFileBacktrace const& bt, bool before = false);
void InsertCompileDefinition(std::string const& entry,
cmListFileBacktrace const& bt);
+ void InsertLinkOption(std::string const& entry,
+ cmListFileBacktrace const& bt, bool before = false);
void AppendBuildInterfaceIncludes();
@@ -265,6 +270,10 @@ public:
cmStringRange GetSourceEntries() const;
cmBacktraceRange GetSourceBacktraces() const;
+
+ cmStringRange GetLinkOptionsEntries() const;
+ cmBacktraceRange GetLinkOptionsBacktraces() const;
+
cmStringRange GetLinkImplementationEntries() const;
cmBacktraceRange GetLinkImplementationBacktraces() const;
diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx
index fc546cc..af142aa 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.cxx
+++ b/Source/cmTargetIncludeDirectoriesCommand.cxx
@@ -35,8 +35,7 @@ std::string cmTargetIncludeDirectoriesCommand::Join(
{
std::string dirs;
std::string sep;
- std::string prefix =
- this->Makefile->GetCurrentSourceDirectory() + std::string("/");
+ std::string prefix = this->Makefile->GetCurrentSourceDirectory() + "/";
for (std::string const& it : content) {
if (cmSystemTools::FileIsFullPath(it) ||
cmGeneratorExpression::Find(it) == 0) {
@@ -56,8 +55,7 @@ bool cmTargetIncludeDirectoriesCommand::HandleDirectContent(
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
tgt->InsertInclude(this->Join(content), lfbt, prepend);
if (system) {
- std::string prefix =
- this->Makefile->GetCurrentSourceDirectory() + std::string("/");
+ std::string prefix = this->Makefile->GetCurrentSourceDirectory() + "/";
std::set<std::string> sdirs;
for (std::string const& it : content) {
if (cmSystemTools::FileIsFullPath(it) ||
diff --git a/Source/cmTargetLinkOptionsCommand.cxx b/Source/cmTargetLinkOptionsCommand.cxx
new file mode 100644
index 0000000..f0f13fd
--- /dev/null
+++ b/Source/cmTargetLinkOptionsCommand.cxx
@@ -0,0 +1,41 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cmTargetLinkOptionsCommand.h"
+
+#include <sstream>
+
+#include "cmAlgorithms.h"
+#include "cmListFileCache.h"
+#include "cmMakefile.h"
+#include "cmTarget.h"
+#include "cmake.h"
+
+class cmExecutionStatus;
+
+bool cmTargetLinkOptionsCommand::InitialPass(
+ std::vector<std::string> const& args, cmExecutionStatus&)
+{
+ return this->HandleArguments(args, "LINK_OPTIONS", PROCESS_BEFORE);
+}
+
+void cmTargetLinkOptionsCommand::HandleMissingTarget(const std::string& name)
+{
+ std::ostringstream e;
+ e << "Cannot specify link options for target \"" << name
+ << "\" which is not built by this project.";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+}
+
+std::string cmTargetLinkOptionsCommand::Join(
+ const std::vector<std::string>& content)
+{
+ return cmJoin(content, ";");
+}
+
+bool cmTargetLinkOptionsCommand::HandleDirectContent(
+ cmTarget* tgt, const std::vector<std::string>& content, bool, bool)
+{
+ cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
+ tgt->InsertLinkOption(this->Join(content), lfbt);
+ return true; // Successfully handled.
+}
diff --git a/Source/cmTargetLinkOptionsCommand.h b/Source/cmTargetLinkOptionsCommand.h
new file mode 100644
index 0000000..a1fc9fc
--- /dev/null
+++ b/Source/cmTargetLinkOptionsCommand.h
@@ -0,0 +1,41 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#ifndef cmTargetLinkOptionsCommand_h
+#define cmTargetLinkOptionsCommand_h
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include <string>
+#include <vector>
+
+#include "cmTargetPropCommandBase.h"
+
+class cmCommand;
+class cmExecutionStatus;
+class cmTarget;
+
+class cmTargetLinkOptionsCommand : public cmTargetPropCommandBase
+{
+public:
+ /**
+ * This is a virtual constructor for the command.
+ */
+ cmCommand* Clone() override { return new cmTargetLinkOptionsCommand; }
+
+ /**
+ * This is called when the command is first encountered in
+ * the CMakeLists.txt file.
+ */
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) override;
+
+private:
+ void HandleMissingTarget(const std::string& name) override;
+
+ bool HandleDirectContent(cmTarget* tgt,
+ const std::vector<std::string>& content,
+ bool prepend, bool system) override;
+ std::string Join(const std::vector<std::string>& content) override;
+};
+
+#endif
diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx
index 3dd3748..7429053 100644
--- a/Source/cmTargetSourcesCommand.cxx
+++ b/Source/cmTargetSourcesCommand.cxx
@@ -5,7 +5,10 @@
#include <sstream>
#include "cmAlgorithms.h"
+#include "cmGeneratorExpression.h"
#include "cmMakefile.h"
+#include "cmPolicies.h"
+#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmake.h"
@@ -17,6 +20,14 @@ bool cmTargetSourcesCommand::InitialPass(std::vector<std::string> const& args,
return this->HandleArguments(args, "SOURCES");
}
+void cmTargetSourcesCommand::HandleInterfaceContent(
+ cmTarget* tgt, const std::vector<std::string>& content, bool prepend,
+ bool system)
+{
+ cmTargetPropCommandBase::HandleInterfaceContent(
+ tgt, ConvertToAbsoluteContent(tgt, content, true), prepend, system);
+}
+
void cmTargetSourcesCommand::HandleMissingTarget(const std::string& name)
{
std::ostringstream e;
@@ -35,6 +46,79 @@ std::string cmTargetSourcesCommand::Join(
bool cmTargetSourcesCommand::HandleDirectContent(
cmTarget* tgt, const std::vector<std::string>& content, bool, bool)
{
- tgt->AppendProperty("SOURCES", this->Join(content).c_str());
+ tgt->AppendProperty(
+ "SOURCES",
+ this->Join(ConvertToAbsoluteContent(tgt, content, false)).c_str());
return true; // Successfully handled.
}
+
+std::vector<std::string> cmTargetSourcesCommand::ConvertToAbsoluteContent(
+ cmTarget* tgt, const std::vector<std::string>& content,
+ bool isInterfaceContent)
+{
+ // Skip conversion in case old behavior has been explicitly requested
+ if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0076) ==
+ cmPolicies::OLD) {
+ return content;
+ }
+
+ bool changedPath = false;
+ std::vector<std::string> absoluteContent;
+ absoluteContent.reserve(content.size());
+ for (std::string const& src : content) {
+ std::string absoluteSrc;
+ if (cmSystemTools::FileIsFullPath(src) ||
+ cmGeneratorExpression::Find(src) == 0 ||
+ (!isInterfaceContent &&
+ (this->Makefile->GetCurrentSourceDirectory() ==
+ tgt->GetMakefile()->GetCurrentSourceDirectory()))) {
+ absoluteSrc = src;
+ } else {
+ changedPath = true;
+ absoluteSrc = this->Makefile->GetCurrentSourceDirectory();
+ absoluteSrc += "/";
+ absoluteSrc += src;
+ }
+ absoluteContent.push_back(absoluteSrc);
+ }
+
+ if (!changedPath) {
+ return content;
+ }
+
+ bool issueMessage = true;
+ bool useAbsoluteContent = false;
+ std::ostringstream e;
+ switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0076)) {
+ case cmPolicies::WARN:
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0076) << "\n";
+ break;
+ case cmPolicies::OLD:
+ issueMessage = false;
+ break;
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::REQUIRED_IF_USED:
+ this->Makefile->IssueMessage(
+ cmake::FATAL_ERROR,
+ cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0076));
+ break;
+ case cmPolicies::NEW: {
+ issueMessage = false;
+ useAbsoluteContent = true;
+ break;
+ }
+ }
+
+ if (issueMessage) {
+ if (isInterfaceContent) {
+ e << "An interface source of target \"" << tgt->GetName()
+ << "\" has a relative path.";
+ } else {
+ e << "A private source from a directory other than that of target \""
+ << tgt->GetName() << "\" has a relative path.";
+ }
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str());
+ }
+
+ return useAbsoluteContent ? absoluteContent : content;
+}
diff --git a/Source/cmTargetSourcesCommand.h b/Source/cmTargetSourcesCommand.h
index ea8776a..b01e3ca 100644
--- a/Source/cmTargetSourcesCommand.h
+++ b/Source/cmTargetSourcesCommand.h
@@ -29,6 +29,11 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
+protected:
+ void HandleInterfaceContent(cmTarget* tgt,
+ const std::vector<std::string>& content,
+ bool prepend, bool system) override;
+
private:
void HandleMissingTarget(const std::string& name) override;
@@ -37,6 +42,10 @@ private:
bool prepend, bool system) override;
std::string Join(const std::vector<std::string>& content) override;
+
+ std::vector<std::string> ConvertToAbsoluteContent(
+ cmTarget* tgt, const std::vector<std::string>& content,
+ bool isInterfaceContent);
};
#endif
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index c532efb..796d2df 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -103,7 +103,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
}
} else {
// Use the command name given.
- exe = ge.Parse(exe.c_str())->Evaluate(this->LG, config);
+ exe = ge.Parse(exe)->Evaluate(this->LG, config);
cmSystemTools::ConvertToUnixSlashes(exe);
}
diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h
index fbe0d78..8237878 100644
--- a/Source/cmTryCompileCommand.h
+++ b/Source/cmTryCompileCommand.h
@@ -16,7 +16,7 @@ class cmExecutionStatus;
/** \class cmTryCompileCommand
* \brief Specifies where to install some files
*
- * cmTryCompileCommand is used to test if soucre code can be compiled
+ * cmTryCompileCommand is used to test if source code can be compiled
*/
class cmTryCompileCommand : public cmCoreTryCompile
{
diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h
index b632ef5..c54622c 100644
--- a/Source/cmTryRunCommand.h
+++ b/Source/cmTryRunCommand.h
@@ -16,7 +16,7 @@ class cmExecutionStatus;
/** \class cmTryRunCommand
* \brief Specifies where to install some files
*
- * cmTryRunCommand is used to test if soucre code can be compiled
+ * cmTryRunCommand is used to test if source code can be compiled
*/
class cmTryRunCommand : public cmCoreTryCompile
{
diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx
index ea012f6..01ef5cb 100644
--- a/Source/cmUseMangledMesaCommand.cxx
+++ b/Source/cmUseMangledMesaCommand.cxx
@@ -82,12 +82,12 @@ void cmUseMangledMesaCommand::CopyAndFullPathMesaHeader(const char* source,
// regular expression for gl GL or xmesa in a file (match(1) of above)
cmsys::RegularExpression glLine("(gl|GL|xmesa)");
while (cmSystemTools::GetLineFromStream(fin, inLine)) {
- if (includeLine.find(inLine.c_str())) {
+ if (includeLine.find(inLine)) {
std::string includeFile = includeLine.match(1);
- if (glDirLine.find(includeFile.c_str())) {
+ if (glDirLine.find(includeFile)) {
std::string gfile = glDirLine.match(3);
fout << "#include \"" << outdir << "/" << gfile << "\"\n";
- } else if (glLine.find(includeFile.c_str())) {
+ } else if (glLine.find(includeFile)) {
fout << "#include \"" << outdir << "/" << includeLine.match(1)
<< "\"\n";
} else {
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index f472d8a..1dff675 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -250,11 +250,10 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator(
this->TargetCompileAsWinRT = false;
this->IsMissingFiles = false;
this->DefaultArtifactDir =
- this->LocalGenerator->GetCurrentBinaryDirectory() + std::string("/") +
+ this->LocalGenerator->GetCurrentBinaryDirectory() + "/" +
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
- this->InSourceBuild =
- (strcmp(this->Makefile->GetCurrentSourceDirectory(),
- this->Makefile->GetCurrentBinaryDirectory()) == 0);
+ this->InSourceBuild = (this->Makefile->GetCurrentSourceDirectory() ==
+ this->Makefile->GetCurrentBinaryDirectory());
}
cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator()
@@ -370,7 +369,7 @@ void cmVisualStudio10TargetGenerator::Generate()
path += "/";
path += this->Name;
path += ProjectFileExtension;
- cmGeneratedFileStream BuildFileStream(path.c_str());
+ cmGeneratedFileStream BuildFileStream(path);
const std::string PathToProjectFile = path;
BuildFileStream.SetCopyIfDifferent(true);
@@ -722,8 +721,7 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences(Elem& e0)
if (!name.empty()) {
std::string path = i.second.GetValue();
if (!cmsys::SystemTools::FileIsFullPath(path)) {
- path = std::string(this->Makefile->GetCurrentSourceDirectory()) +
- "/" + path;
+ path = this->Makefile->GetCurrentSourceDirectory() + "/" + path;
}
ConvertToWindowsSlash(path);
this->DotNetHintReferences[""].push_back(
@@ -929,8 +927,10 @@ void cmVisualStudio10TargetGenerator::WriteXamlFilesGroup(Elem& e0)
e2.SetHasElements();
if (this->ProjectType == csproj && !this->InSourceBuild) {
// add <Link> tag to written XAML source if necessary
- const std::string srcDir = this->Makefile->GetCurrentSourceDirectory();
- const std::string binDir = this->Makefile->GetCurrentBinaryDirectory();
+ const std::string& srcDir =
+ this->Makefile->GetCurrentSourceDirectory();
+ const std::string& binDir =
+ this->Makefile->GetCurrentBinaryDirectory();
std::string link;
if (obj.find(srcDir) == 0) {
link = obj.substr(srcDir.length() + 1);
@@ -1402,7 +1402,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
path += computeProjectFileExtension(this->GeneratorTarget,
*this->Configurations.begin());
path += ".filters";
- cmGeneratedFileStream fout(path.c_str());
+ cmGeneratedFileStream fout(path);
fout.SetCopyIfDifferent(true);
char magic[] = { char(0xEF), char(0xBB), char(0xBF) };
fout.write(magic, 3);
@@ -1746,10 +1746,8 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(Elem& e1,
e2.Element("Link", deployLocation + "\\%(FileName)%(Extension)");
}
for (size_t i = 0; i != this->Configurations.size(); ++i) {
- if (0 ==
- strcmp(
- cge->Evaluate(this->LocalGenerator, this->Configurations[i]),
- "1")) {
+ if (cge->Evaluate(this->LocalGenerator, this->Configurations[i]) ==
+ "1") {
e2.WritePlatformConfigTag("DeploymentContent",
"'$(Configuration)|$(Platform)'=='" +
this->Configurations[i] + "|" +
@@ -1797,14 +1795,14 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(Elem& e1,
ge.Parse(shaderEnableDebug);
for (size_t i = 0; i != this->Configurations.size(); ++i) {
- const char* enableDebug =
+ const std::string& enableDebug =
cge->Evaluate(this->LocalGenerator, this->Configurations[i]);
- if (strlen(enableDebug) > 0) {
+ if (!enableDebug.empty()) {
e2.WritePlatformConfigTag(
"EnableDebuggingInformation",
"'$(Configuration)|$(Platform)'=='" + this->Configurations[i] +
"|" + this->Platform + "'",
- cmSystemTools::IsOn(enableDebug) ? "true" : "false");
+ cmSystemTools::IsOn(enableDebug.c_str()) ? "true" : "false");
}
}
}
@@ -1814,14 +1812,15 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(Elem& e1,
ge.Parse(shaderDisableOptimizations);
for (size_t i = 0; i != this->Configurations.size(); ++i) {
- const char* disableOptimizations =
+ const std::string& disableOptimizations =
cge->Evaluate(this->LocalGenerator, this->Configurations[i]);
- if (strlen(disableOptimizations) > 0) {
+ if (!disableOptimizations.empty()) {
e2.WritePlatformConfigTag(
"DisableOptimizations",
"'$(Configuration)|$(Platform)'=='" + this->Configurations[i] +
"|" + this->Platform + "'",
- (cmSystemTools::IsOn(disableOptimizations) ? "true" : "false"));
+ (cmSystemTools::IsOn(disableOptimizations.c_str()) ? "true"
+ : "false"));
}
}
}
@@ -1882,7 +1881,7 @@ void cmVisualStudio10TargetGenerator::WriteSource(Elem& e2,
std::string sourceRel = this->ConvertPath(sf->GetFullPath(), true);
size_t const maxLen = 250;
if (sf->GetCustomCommand() ||
- ((strlen(this->LocalGenerator->GetCurrentBinaryDirectory()) + 1 +
+ ((this->LocalGenerator->GetCurrentBinaryDirectory().length() + 1 +
sourceRel.length()) <= maxLen)) {
forceRelative = true;
sourceFile = sourceRel;
@@ -1891,7 +1890,7 @@ void cmVisualStudio10TargetGenerator::WriteSource(Elem& e2,
}
}
ConvertToWindowsSlash(sourceFile);
- e2.StartElement(tool.c_str());
+ e2.StartElement(tool);
e2.Attribute("Include", sourceFile);
ToolSource toolSource = { sf, forceRelative };
@@ -2133,7 +2132,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
if (configDependentFlags) {
clOptions.Parse(genexInterpreter.Evaluate(flags, "COMPILE_FLAGS"));
} else {
- clOptions.Parse(flags.c_str());
+ clOptions.Parse(flags);
}
if (!options.empty()) {
std::string expandedOptions;
@@ -2144,7 +2143,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
} else {
this->LocalGenerator->AppendCompileOptions(expandedOptions, options);
}
- clOptions.Parse(expandedOptions.c_str());
+ clOptions.Parse(expandedOptions);
}
if (clOptions.HasFlag("DisableSpecificWarnings")) {
clOptions.AppendFlag("DisableSpecificWarnings",
@@ -2290,14 +2289,51 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions(
if (const char* workingDir = this->GeneratorTarget->GetProperty(
"VS_DEBUGGER_WORKING_DIRECTORY")) {
+ cmGeneratorExpression ge;
+ std::unique_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(workingDir);
+ std::string genWorkingDir =
+ cge->Evaluate(this->LocalGenerator, config);
+
e1.WritePlatformConfigTag("LocalDebuggerWorkingDirectory", cond,
- workingDir);
+ genWorkingDir);
+ }
+
+ if (const char* environment =
+ this->GeneratorTarget->GetProperty("VS_DEBUGGER_ENVIRONMENT")) {
+ cmGeneratorExpression ge;
+ std::unique_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(environment);
+ std::string genEnvironment =
+ cge->Evaluate(this->LocalGenerator, config);
+
+ e1.WritePlatformConfigTag("LocalDebuggerEnvironment", cond,
+ genEnvironment);
}
if (const char* debuggerCommand =
this->GeneratorTarget->GetProperty("VS_DEBUGGER_COMMAND")) {
+
+ cmGeneratorExpression ge;
+ std::unique_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(debuggerCommand);
+ std::string genDebuggerCommand =
+ cge->Evaluate(this->LocalGenerator, config);
+
e1.WritePlatformConfigTag("LocalDebuggerCommand", cond,
- debuggerCommand);
+ genDebuggerCommand);
+ }
+
+ if (const char* commandArguments = this->GeneratorTarget->GetProperty(
+ "VS_DEBUGGER_COMMAND_ARGUMENTS")) {
+ cmGeneratorExpression ge;
+ std::unique_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(commandArguments);
+ std::string genCommandArguments =
+ cge->Evaluate(this->LocalGenerator, config);
+
+ e1.WritePlatformConfigTag("LocalDebuggerCommandArguments", cond,
+ genCommandArguments);
}
std::string name =
@@ -2458,6 +2494,16 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
if (this->MSTools) {
if (this->ProjectType == vcxproj) {
clOptions.FixExceptionHandlingDefault();
+ if (this->GlobalGenerator->GetVersion() >=
+ cmGlobalVisualStudioGenerator::VS15) {
+ // Toolsets that come with VS 2017 may now enable UseFullPaths
+ // by default and there is no negative /FC option that projects
+ // can use to switch it back. Older toolsets disable this by
+ // default anyway so this will not hurt them. If the project
+ // is using an explicit /FC option then parsing flags will
+ // replace this setting with "true" below.
+ clOptions.AddFlag("UseFullPaths", "false");
+ }
clOptions.AddFlag("PrecompiledHeader", "NotUsing");
std::string asmLocation = configName + "/";
clOptions.AddFlag("AssemblerListingLocation", asmLocation);
@@ -2491,8 +2537,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
}
}
- clOptions.Parse(flags.c_str());
- clOptions.Parse(defineFlags.c_str());
+ clOptions.Parse(flags);
+ clOptions.Parse(defineFlags);
std::vector<std::string> targetDefines;
switch (this->ProjectType) {
case vcxproj:
@@ -2529,8 +2575,10 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
}
if (this->MSTools) {
- // If we have the VS_WINRT_COMPONENT set then force Compile as WinRT.
- if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT")) {
+ // If we have the VS_WINRT_COMPONENT or CMAKE_VS_WINRT_BY_DEFAULT
+ // set then force Compile as WinRT.
+ if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") ||
+ this->Makefile->IsOn("CMAKE_VS_WINRT_BY_DEFAULT")) {
clOptions.AddFlag("CompileAsWinRT", "true");
// For WinRT components, add the _WINRT_DLL define to produce a lib
if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY ||
@@ -2659,7 +2707,7 @@ bool cmVisualStudio10TargetGenerator::ComputeRcOptions(
std::string(" ") +
std::string(this->Makefile->GetSafeDefinition(rcConfigFlagsVar));
- rcOptions.Parse(flags.c_str());
+ rcOptions.Parse(flags);
// For historical reasons, add the C preprocessor defines to RC.
Options& clOptions = *(this->ClOptions[configName]);
@@ -2721,8 +2769,8 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions(
// Get preprocessor definitions for this directory.
std::string defineFlags = this->Makefile->GetDefineFlags();
- cudaOptions.Parse(flags.c_str());
- cudaOptions.Parse(defineFlags.c_str());
+ cudaOptions.Parse(flags);
+ cudaOptions.Parse(defineFlags);
cudaOptions.ParseFinish();
// If we haven't explicitly enabled GPU debug information
@@ -2929,7 +2977,7 @@ bool cmVisualStudio10TargetGenerator::ComputeMasmOptions(
std::string(" ") +
std::string(this->Makefile->GetSafeDefinition(configFlagsVar));
- masmOptions.Parse(flags.c_str());
+ masmOptions.Parse(flags);
// Get includes for this target
masmOptions.AddIncludes(this->GetIncludes(configName, "ASM_MASM"));
@@ -2986,7 +3034,7 @@ bool cmVisualStudio10TargetGenerator::ComputeNasmOptions(
this->Makefile->GetSafeDefinition("CMAKE_ASM_NASM_OBJECT_FORMAT")) +
std::string(" ") +
std::string(this->Makefile->GetSafeDefinition(configFlagsVar));
- nasmOptions.Parse(flags.c_str());
+ nasmOptions.Parse(flags);
// Get includes for this target
nasmOptions.AddIncludes(this->GetIncludes(configName, "ASM_NASM"));
@@ -3023,16 +3071,21 @@ void cmVisualStudio10TargetGenerator::WriteLibOptions(
this->GeneratorTarget->GetType() != cmStateEnums::OBJECT_LIBRARY) {
return;
}
+
+ const std::string& linkLanguage =
+ this->GeneratorTarget->GetLinkClosure(config)->LinkerLanguage;
+
std::string libflags;
this->LocalGenerator->GetStaticLibraryFlags(
- libflags, cmSystemTools::UpperCase(config), this->GeneratorTarget);
+ libflags, cmSystemTools::UpperCase(config), linkLanguage,
+ this->GeneratorTarget);
if (!libflags.empty()) {
Elem e2(e1, "Lib");
cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator;
cmVS10GeneratorOptions libOptions(this->LocalGenerator,
cmVisualStudioGeneratorOptions::Linker,
gg->GetLibFlagTable(), this);
- libOptions.Parse(libflags.c_str());
+ libOptions.Parse(libflags);
OptionsHelper oh(libOptions, e2);
oh.PrependInheritedString("AdditionalOptions");
oh.OutputFlagMap();
@@ -3239,6 +3292,11 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
flags += flagsConfig;
}
+ std::vector<std::string> opts;
+ this->GeneratorTarget->GetLinkOptions(opts, config, linkLanguage);
+ // LINK_OPTIONS are escaped.
+ this->LocalGenerator->AppendCompileOptions(flags, opts);
+
cmComputeLinkInformation* pcli =
this->GeneratorTarget->GetLinkInformation(config);
if (!pcli) {
@@ -3373,7 +3431,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
linkOptions.AddFlag("SoName", targetNameSO);
}
- linkOptions.Parse(flags.c_str());
+ linkOptions.Parse(flags);
linkOptions.FixManifestUACFlags();
if (this->MSTools) {
@@ -3740,31 +3798,29 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0)
e2.Element("Project", "{" + this->GlobalGenerator->GetGUID(name) + "}");
e2.Element("Name", name);
this->WriteDotNetReferenceCustomTags(e2, name);
- if (this->Managed) {
- // If the dependency target is not managed (compiled with /clr or
- // C# target) we cannot reference it and have to set
- // 'ReferenceOutputAssembly' to false.
- auto referenceNotManaged =
- dt->GetManagedType("") < cmGeneratorTarget::ManagedType::Mixed;
- // Workaround to check for manually set /clr flags.
- if (referenceNotManaged) {
- if (const auto* flags = dt->GetProperty("COMPILE_OPTIONS")) {
- std::string flagsStr = flags;
- if (flagsStr.find("clr") != std::string::npos) {
- // There is a warning already issued when building the flags.
- referenceNotManaged = false;
- }
+
+ // If the dependency target is not managed (compiled with /clr or
+ // C# target) we cannot reference it and have to set
+ // 'ReferenceOutputAssembly' to false.
+ auto referenceNotManaged =
+ dt->GetManagedType("") < cmGeneratorTarget::ManagedType::Mixed;
+ // Workaround to check for manually set /clr flags.
+ if (referenceNotManaged) {
+ if (const auto* flags = dt->GetProperty("COMPILE_OPTIONS")) {
+ std::string flagsStr = flags;
+ if (flagsStr.find("clr") != std::string::npos) {
+ // There is a warning already issued when building the flags.
+ referenceNotManaged = false;
}
}
- // Workaround for static library C# targets
- if (referenceNotManaged &&
- dt->GetType() == cmStateEnums::STATIC_LIBRARY) {
- referenceNotManaged = !dt->HasLanguage("CSharp", "");
- }
- if (referenceNotManaged) {
- e2.Element("ReferenceOutputAssembly", "false");
- e2.Element("CopyToOutputDirectory", "Never");
- }
+ }
+ // Workaround for static library C# targets
+ if (referenceNotManaged && dt->GetType() == cmStateEnums::STATIC_LIBRARY) {
+ referenceNotManaged = !dt->HasLanguage("CSharp", "");
+ }
+ if (referenceNotManaged) {
+ e2.Element("ReferenceOutputAssembly", "false");
+ e2.Element("CopyToOutputDirectory", "Never");
}
}
}
@@ -4094,8 +4150,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80(Elem& e1)
// this can cause an overwrite problem if projects aren't organized in
// folders
std::string manifestFile =
- this->LocalGenerator->GetCurrentBinaryDirectory() +
- std::string("/WMAppManifest.xml");
+ this->LocalGenerator->GetCurrentBinaryDirectory() + "/WMAppManifest.xml";
std::string artifactDir =
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
ConvertToWindowsSlash(artifactDir);
@@ -4103,7 +4158,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80(Elem& e1)
std::string targetNameXML =
cmVS10EscapeXML(this->GeneratorTarget->GetName());
- cmGeneratedFileStream fout(manifestFile.c_str());
+ cmGeneratedFileStream fout(manifestFile);
fout.SetCopyIfDifferent(true);
/* clang-format off */
@@ -4186,7 +4241,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP81(Elem& e1)
std::string targetNameXML =
cmVS10EscapeXML(this->GeneratorTarget->GetName());
- cmGeneratedFileStream fout(manifestFile.c_str());
+ cmGeneratedFileStream fout(manifestFile);
fout.SetCopyIfDifferent(true);
/* clang-format off */
@@ -4249,7 +4304,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS80(Elem& e1)
std::string targetNameXML =
cmVS10EscapeXML(this->GeneratorTarget->GetName());
- cmGeneratedFileStream fout(manifestFile.c_str());
+ cmGeneratedFileStream fout(manifestFile);
fout.SetCopyIfDifferent(true);
/* clang-format off */
@@ -4304,7 +4359,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS81(Elem& e1)
std::string targetNameXML =
cmVS10EscapeXML(this->GeneratorTarget->GetName());
- cmGeneratedFileStream fout(manifestFile.c_str());
+ cmGeneratedFileStream fout(manifestFile);
fout.SetCopyIfDifferent(true);
/* clang-format off */
@@ -4364,7 +4419,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS10_0(Elem& e1)
std::string targetNameXML =
cmVS10EscapeXML(this->GeneratorTarget->GetName());
- cmGeneratedFileStream fout(manifestFile.c_str());
+ cmGeneratedFileStream fout(manifestFile);
fout.SetCopyIfDifferent(true);
/* clang-format off */
@@ -4531,7 +4586,7 @@ void cmVisualStudio10TargetGenerator::GetCSharpSourceLink(
std::string const& binaryDir = LocalGenerator->GetCurrentBinaryDirectory();
if (!cmSystemTools::IsSubDirectory(sourceFilePath, binaryDir)) {
- const std::string stripFromPath =
+ const std::string& stripFromPath =
this->Makefile->GetCurrentSourceDirectory();
if (sourceFilePath.find(stripFromPath) == 0) {
if (const char* l = sf->GetProperty("VS_CSHARP_Link")) {
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 4afef8b..5d67dcf 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -297,12 +297,12 @@ void cmVisualStudioGeneratorOptions::FixManifestUACFlags()
AddFlag(ENABLE_UAC, "true");
}
-void cmVisualStudioGeneratorOptions::Parse(const char* flags)
+void cmVisualStudioGeneratorOptions::Parse(const std::string& flags)
{
// Parse the input string as a windows command line since the string
// is intended for writing directly into the build files.
std::vector<std::string> args;
- cmSystemTools::ParseWindowsCommandLine(flags, args);
+ cmSystemTools::ParseWindowsCommandLine(flags.c_str(), args);
// Process flags that need to be represented specially in the IDE
// project file.
@@ -366,7 +366,7 @@ void cmVisualStudioGeneratorOptions::Reparse(std::string const& key)
std::string const original = i->second[0];
i->second[0] = "";
this->UnknownFlagField = key;
- this->Parse(original.c_str());
+ this->Parse(original);
}
void cmVisualStudioGeneratorOptions::StoreUnknownFlag(std::string const& flag)
diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h
index c6b594d..a30a67f 100644
--- a/Source/cmVisualStudioGeneratorOptions.h
+++ b/Source/cmVisualStudioGeneratorOptions.h
@@ -42,7 +42,7 @@ public:
void ClearTables();
// Store options from command line flags.
- void Parse(const char* flags);
+ void Parse(const std::string& flags);
void ParseFinish();
void PrependInheritedString(std::string const& key);
diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx
index d3d2db0..c504ef4 100644
--- a/Source/cmWriteFileCommand.cxx
+++ b/Source/cmWriteFileCommand.cxx
@@ -45,16 +45,20 @@ bool cmWriteFileCommand::InitialPass(std::vector<std::string> const& args,
cmSystemTools::MakeDirectory(dir);
mode_t mode = 0;
+ bool writable = false;
// Set permissions to writable
if (cmSystemTools::GetPermissions(fileName.c_str(), mode)) {
- cmSystemTools::SetPermissions(fileName.c_str(),
#if defined(_MSC_VER) || defined(__MINGW32__)
- mode | S_IWRITE
+ writable = mode & S_IWRITE;
+ mode_t newMode = mode | S_IWRITE;
#else
- mode | S_IWUSR | S_IWGRP
+ writable = mode & S_IWUSR;
+ mode_t newMode = mode | S_IWUSR | S_IWGRP;
#endif
- );
+ if (!writable) {
+ cmSystemTools::SetPermissions(fileName.c_str(), newMode);
+ }
}
// If GetPermissions fails, pretend like it is ok. File open will fail if
// the file is not writable
@@ -69,7 +73,7 @@ bool cmWriteFileCommand::InitialPass(std::vector<std::string> const& args,
}
file << message << std::endl;
file.close();
- if (mode) {
+ if (mode && !writable) {
cmSystemTools::SetPermissions(fileName.c_str(), mode);
}
diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx
index f1dce64..58cb9c9 100644
--- a/Source/cmXCodeScheme.cxx
+++ b/Source/cmXCodeScheme.cxx
@@ -143,6 +143,41 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
xout.Attribute("debugServiceExtension", "internal");
xout.Attribute("allowLocationSimulation", "YES");
+ // Diagnostics tab begin
+
+ bool useAddressSanitizer = WriteLaunchActionAttribute(
+ xout, "enableAddressSanitizer",
+ "XCODE_SCHEME_ADDRESS_SANITIZER"); // not allowed with
+ // enableThreadSanitizer=YES
+ WriteLaunchActionAttribute(
+ xout, "enableASanStackUseAfterReturn",
+ "XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN");
+
+ bool useThreadSanitizer = false;
+ if (!useAddressSanitizer) {
+ useThreadSanitizer = WriteLaunchActionAttribute(
+ xout, "enableThreadSanitizer",
+ "XCODE_SCHEME_THREAD_SANITIZER"); // not allowed with
+ // enableAddressSanitizer=YES
+ }
+
+ WriteLaunchActionAttribute(xout, "stopOnEveryThreadSanitizerIssue",
+ "XCODE_SCHEME_THREAD_SANITIZER_STOP");
+
+ WriteLaunchActionAttribute(xout, "enableUBSanitizer",
+ "XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER");
+ WriteLaunchActionAttribute(
+ xout, "stopOnEveryUBSanitizerIssue",
+ "XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP");
+
+ WriteLaunchActionAttribute(
+ xout, "disableMainThreadChecker",
+ "XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER"); // negative enabled!
+ WriteLaunchActionAttribute(xout, "stopOnEveryMainThreadCheckerIssue",
+ "XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP");
+
+ // Diagnostics tab end
+
if (IsExecutable(this->Target)) {
xout.StartElement("BuildableProductRunnable");
xout.BreakAttributes();
@@ -156,12 +191,144 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
xout.EndElement(); // MacroExpansion
+ // Info tab begin
+
+ if (const char* exe =
+ this->Target->GetTarget()->GetProperty("XCODE_SCHEME_EXECUTABLE")) {
+
+ xout.StartElement("PathRunnable");
+ xout.BreakAttributes();
+
+ xout.Attribute("runnableDebuggingMode", "0");
+ xout.Attribute("FilePath", exe);
+
+ xout.EndElement(); // PathRunnable
+ }
+
+ // Info tab end
+
+ // Arguments tab begin
+
+ if (const char* argList =
+ this->Target->GetTarget()->GetProperty("XCODE_SCHEME_ARGUMENTS")) {
+ std::vector<std::string> arguments;
+ cmSystemTools::ExpandListArgument(argList, arguments);
+ if (!arguments.empty()) {
+ xout.StartElement("CommandLineArguments");
+
+ for (auto argument : arguments) {
+ xout.StartElement("CommandLineArgument");
+ xout.BreakAttributes();
+
+ xout.Attribute("argument", argument);
+ xout.Attribute("isEnabled", "YES");
+
+ xout.EndElement(); // CommandLineArgument
+ }
+
+ xout.EndElement(); // CommandLineArguments
+ }
+ }
+
+ if (const char* envList =
+ this->Target->GetTarget()->GetProperty("XCODE_SCHEME_ENVIRONMENT")) {
+ std::vector<std::string> envs;
+ cmSystemTools::ExpandListArgument(envList, envs);
+ if (!envs.empty()) {
+ xout.StartElement("EnvironmentVariables");
+
+ for (auto env : envs) {
+
+ xout.StartElement("EnvironmentVariable");
+ xout.BreakAttributes();
+
+ std::string envValue;
+ const auto p = env.find_first_of('=');
+ if (p != std::string::npos) {
+ envValue = env.substr(p + 1);
+ env.resize(p);
+ }
+
+ xout.Attribute("key", env);
+ xout.Attribute("value", envValue);
+ xout.Attribute("isEnabled", "YES");
+
+ xout.EndElement(); // EnvironmentVariable
+ }
+
+ xout.EndElement(); // EnvironmentVariables
+ }
+ }
+
+ // Arguments tab end
+
xout.StartElement("AdditionalOptions");
+
+ if (!useThreadSanitizer) {
+ WriteLaunchActionAdditionalOption(xout, "MallocScribble", "",
+ "XCODE_SCHEME_MALLOC_SCRIBBLE");
+ }
+
+ if (!useThreadSanitizer && !useAddressSanitizer) {
+ WriteLaunchActionAdditionalOption(xout, "MallocGuardEdges", "",
+ "XCODE_SCHEME_MALLOC_GUARD_EDGES");
+ }
+
+ if (!useThreadSanitizer && !useAddressSanitizer) {
+ WriteLaunchActionAdditionalOption(xout, "DYLD_INSERT_LIBRARIES",
+ "/usr/lib/libgmalloc.dylib",
+ "XCODE_SCHEME_GUARD_MALLOC");
+ }
+
+ WriteLaunchActionAdditionalOption(xout, "NSZombieEnabled", "YES",
+ "XCODE_SCHEME_ZOMBIE_OBJECTS");
+
+ if (!useThreadSanitizer && !useAddressSanitizer) {
+ WriteLaunchActionAdditionalOption(xout, "MallocStackLogging", "",
+ "XCODE_SCHEME_MALLOC_STACK");
+ }
+
+ WriteLaunchActionAdditionalOption(xout, "DYLD_PRINT_APIS", "",
+ "XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE");
+
+ WriteLaunchActionAdditionalOption(xout, "DYLD_PRINT_LIBRARIES", "",
+ "XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS");
+
xout.EndElement();
xout.EndElement(); // LaunchAction
}
+bool cmXCodeScheme::WriteLaunchActionAttribute(cmXMLWriter& xout,
+ const std::string& attrName,
+ const std::string& varName)
+{
+ if (Target->GetTarget()->GetPropertyAsBool(varName)) {
+ xout.Attribute(attrName.c_str(), "YES");
+ return true;
+ }
+ return false;
+}
+
+bool cmXCodeScheme::WriteLaunchActionAdditionalOption(
+ cmXMLWriter& xout, const std::string& key, const std::string& value,
+ const std::string& varName)
+{
+ if (Target->GetTarget()->GetPropertyAsBool(varName)) {
+ xout.StartElement("AdditionalOption");
+ xout.BreakAttributes();
+
+ xout.Attribute("key", key);
+ xout.Attribute("value", value);
+ xout.Attribute("isEnabled", "YES");
+
+ xout.EndElement(); // AdditionalOption
+
+ return true;
+ }
+ return false;
+}
+
void cmXCodeScheme::WriteProfileAction(cmXMLWriter& xout,
const std::string& configuration)
{
diff --git a/Source/cmXCodeScheme.h b/Source/cmXCodeScheme.h
index e5e501a..96c76e6 100644
--- a/Source/cmXCodeScheme.h
+++ b/Source/cmXCodeScheme.h
@@ -41,6 +41,16 @@ private:
const std::string& container);
void WriteLaunchAction(cmXMLWriter& xout, const std::string& configuration,
const std::string& container);
+
+ bool WriteLaunchActionAttribute(cmXMLWriter& xout,
+ const std::string& attrName,
+ const std::string& varName);
+
+ bool WriteLaunchActionAdditionalOption(cmXMLWriter& xout,
+ const std::string& attrName,
+ const std::string& value,
+ const std::string& varName);
+
void WriteProfileAction(cmXMLWriter& xout, const std::string& configuration);
void WriteAnalyzeAction(cmXMLWriter& xout, const std::string& configuration);
void WriteArchiveAction(cmXMLWriter& xout, const std::string& configuration);
diff --git a/Source/cmXMLParser.cxx b/Source/cmXMLParser.cxx
index 920e3a5..4c6c35a 100644
--- a/Source/cmXMLParser.cxx
+++ b/Source/cmXMLParser.cxx
@@ -186,8 +186,8 @@ void cmXMLParserCharacterDataHandler(void* parser, const char* data,
void cmXMLParser::ReportXmlParseError()
{
XML_Parser parser = static_cast<XML_Parser>(this->Parser);
- this->ReportError(XML_GetCurrentLineNumber(parser),
- XML_GetCurrentColumnNumber(parser),
+ this->ReportError(static_cast<int>(XML_GetCurrentLineNumber(parser)),
+ static_cast<int>(XML_GetCurrentColumnNumber(parser)),
XML_ErrorString(XML_GetErrorCode(parser)));
}
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 6edaa74..1bf8f7d 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -407,7 +407,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
for (std::string const& ck : cacheKeys) {
cmStateEnums::CacheEntryType t = this->State->GetCacheEntryType(ck);
if (t != cmStateEnums::STATIC) {
- if (regex.find(ck.c_str())) {
+ if (regex.find(ck)) {
entriesToDelete.push_back(ck);
}
}
@@ -1262,10 +1262,7 @@ int cmake::ActualConfigure()
this->UpdateConversionPathTable();
this->CleanupCommandsAndMacros();
- int res = 0;
- if (this->GetWorkingMode() == NORMAL_MODE) {
- res = this->DoPreConfigureChecks();
- }
+ int res = this->DoPreConfigureChecks();
if (res < 0) {
return -2;
}
@@ -1431,11 +1428,8 @@ int cmake::ActualConfigure()
"CMakeLists.txt ?");
}
- // only save the cache if there were no fatal errors
- if (this->GetWorkingMode() == NORMAL_MODE) {
- this->State->SaveVerificationScript(this->GetHomeOutputDirectory());
- this->SaveCache(this->GetHomeOutputDirectory());
- }
+ this->State->SaveVerificationScript(this->GetHomeOutputDirectory());
+ this->SaveCache(this->GetHomeOutputDirectory());
if (cmSystemTools::GetErrorOccuredFlag()) {
return -1;
}
@@ -1588,7 +1582,7 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
}
int ret = this->Configure();
- if (ret || this->GetWorkingMode() != NORMAL_MODE) {
+ if (ret) {
#if defined(CMAKE_HAVE_VS_GENERATORS)
if (!this->VSSolutionFile.empty() && this->GlobalGenerator) {
// CMake is running to regenerate a Visual Studio build tree
@@ -1634,9 +1628,8 @@ int cmake::Generate()
// Save the cache again after a successful Generate so that any internal
// variables created during Generate are saved. (Specifically target GUIDs
// for the Visual Studio and Xcode generators.)
- if (this->GetWorkingMode() == NORMAL_MODE) {
- this->SaveCache(this->GetHomeOutputDirectory());
- }
+ this->SaveCache(this->GetHomeOutputDirectory());
+
return 0;
}
diff --git a/Source/cmake.h b/Source/cmake.h
index 86e06df..4b4c67c 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -297,8 +297,10 @@ public:
///! this is called by generators to update the progress
void UpdateProgress(const char* msg, float prog);
+#if defined(CMAKE_BUILD_WITH_CMAKE)
///! Get the variable watch object
cmVariableWatch* GetVariableWatch() { return this->VariableWatch; }
+#endif
void GetGeneratorDocumentation(std::vector<cmDocumentationEntry>&);
@@ -493,8 +495,6 @@ protected:
void GenerateGraphViz(const char* fileName) const;
- cmVariableWatch* VariableWatch;
-
private:
ProgressCallbackType ProgressCallback;
void* ProgressCallbackClientData;
@@ -525,6 +525,10 @@ private:
std::string GraphVizFile;
InstalledFilesMap InstalledFiles;
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+ cmVariableWatch* VariableWatch;
+#endif
+
cmState* State;
cmStateSnapshot CurrentSnapshot;
cmMessenger* Messenger;
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 0a75e77..2027722 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -24,6 +24,7 @@
#if defined(CMAKE_BUILD_WITH_CMAKE) && defined(_WIN32)
# include "bindexplib.h"
+# include "cmsys/ConsoleBuf.hxx"
#endif
#if defined(CMAKE_BUILD_WITH_CMAKE) && defined(_WIN32) && !defined(__CYGWIN__)
@@ -1545,6 +1546,15 @@ private:
// still works.
int cmcmd::VisualStudioLink(std::vector<std::string> const& args, int type)
{
+#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+ // Replace streambuf so we output in the system codepage. CMake is set up
+ // to output in Unicode (see SetUTF8Pipes) but the Visual Studio linker
+ // outputs using the system codepage so we need to change behavior when
+ // we run the link command.
+ cmsys::ConsoleBuf::Manager consoleOut(std::cout);
+ cmsys::ConsoleBuf::Manager consoleErr(std::cerr, true);
+#endif
+
if (args.size() < 2) {
return -1;
}
@@ -1775,6 +1785,8 @@ int cmVSLink::LinkIncremental()
if (!fout) {
return -1;
}
+ // Insert a pragma statement to specify utf-8 encoding.
+ fout << "#pragma code_page(65001)\n";
fout << this->Type
<< " /* CREATEPROCESS_MANIFEST_RESOURCE_ID */ "
"24 /* RT_MANIFEST */ \""
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index 96088c8..516104b 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -1193,13 +1193,17 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
# Some Apple compilers produce bad optimizations in this source.
IF(APPLE AND CMAKE_C_COMPILER_ID MATCHES "^(GNU|LLVM)$")
SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -O0")
- ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "XL" AND
- NOT (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND
- NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13.1.1"))
+ ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "XL")
# Tell IBM XL not to warn about our test infinite loop
- # v13.1.1 and newer on Linux ppc64le is clang based and does not accept
- # the -qsuppress option
- SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -qsuppress=1500-010")
+ IF(CMAKE_SYSTEM MATCHES "Linux.*ppc64le"
+ AND CMAKE_C_COMPILER_VERSION VERSION_LESS "16.1.0"
+ AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13.1.1")
+ # v13.1.[1-6] on Linux ppc64le is clang based and does not accept
+ # the -qsuppress option, so just suppress all warnings.
+ SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -w")
+ ELSE()
+ SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -qsuppress=1500-010")
+ ENDIF()
ENDIF()
IF(CMAKE_C_FLAGS MATCHES "-fsanitize=")
SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -DCRASH_USING_ABORT")
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index cfe62b4..7545ec7 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -3495,7 +3495,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
// Chip Model Name
this->ChipID.ModelName =
- this->ExtractValueFromCpuInfoFile(buffer, "model name").c_str();
+ this->ExtractValueFromCpuInfoFile(buffer, "model name");
// L1 Cache size
// Different architectures may show different names for the caches.
@@ -4613,7 +4613,7 @@ std::string SystemInformationImplementation::ExtractValueFromSysCtl(
std::string SystemInformationImplementation::RunProcess(
std::vector<const char*> args)
{
- std::string buffer = "";
+ std::string buffer;
// Run the application
kwsysProcess* gp = kwsysProcess_New();
@@ -4668,11 +4668,7 @@ std::string SystemInformationImplementation::RunProcess(
std::string SystemInformationImplementation::ParseValueFromKStat(
const char* arguments)
{
- std::vector<const char*> args;
- args.clear();
- args.push_back("kstat");
- args.push_back("-p");
-
+ std::vector<std::string> args_string;
std::string command = arguments;
size_t start = std::string::npos;
size_t pos = command.find(' ', 0);
@@ -4691,35 +4687,35 @@ std::string SystemInformationImplementation::ParseValueFromKStat(
}
if (!inQuotes) {
- std::string arg = command.substr(start + 1, pos - start - 1);
+ args_string.push_back(command.substr(start + 1, pos - start - 1));
+ std::string& arg = args_string.back();
// Remove the quotes if any
- size_t quotes = arg.find('"');
- while (quotes != std::string::npos) {
- arg.erase(quotes, 1);
- quotes = arg.find('"');
- }
- args.push_back(arg.c_str());
+ arg.erase(std::remove(arg.begin(), arg.end(), '"'), arg.end());
start = pos;
}
pos = command.find(' ', pos + 1);
}
- std::string lastArg = command.substr(start + 1, command.size() - start - 1);
- args.push_back(lastArg.c_str());
+ args_string.push_back(command.substr(start + 1, command.size() - start - 1));
+ std::vector<const char*> args;
+ args.reserve(3 + args_string.size());
+ args.push_back("kstat");
+ args.push_back("-p");
+ for (size_t i = 0; i < args_string.size(); ++i) {
+ args.push_back(args_string[i].c_str());
+ }
args.push_back(KWSYS_NULLPTR);
std::string buffer = this->RunProcess(args);
- std::string value = "";
+ std::string value;
for (size_t i = buffer.size() - 1; i > 0; i--) {
if (buffer[i] == ' ' || buffer[i] == '\t') {
break;
}
if (buffer[i] != '\n' && buffer[i] != '\r') {
- std::string val = value;
- value = buffer[i];
- value += val;
+ value.insert(0u, 1, buffer[i]);
}
}
return value;
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 0079da2..476fe08 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -686,7 +686,7 @@ public:
for (iterator i = this->begin(); i != this->end(); ++i) {
# if defined(_WIN32)
const std::string s = Encoding::ToNarrow(*i);
- kwsysUnPutEnv(s.c_str());
+ kwsysUnPutEnv(s);
# else
kwsysUnPutEnv(*i);
# endif
@@ -1197,9 +1197,27 @@ bool SystemTools::FileExists(const std::string& filename)
}
return access(filename.c_str(), R_OK) == 0;
#elif defined(_WIN32)
- return (
- GetFileAttributesW(Encoding::ToWindowsExtendedPath(filename).c_str()) !=
- INVALID_FILE_ATTRIBUTES);
+ DWORD attr =
+ GetFileAttributesW(Encoding::ToWindowsExtendedPath(filename).c_str());
+ if (attr == INVALID_FILE_ATTRIBUTES) {
+ return false;
+ }
+
+ if (attr & FILE_ATTRIBUTE_REPARSE_POINT) {
+ // Using 0 instead of GENERIC_READ as it allows reading of file attributes
+ // even if we do not have permission to read the file itself
+ HANDLE handle =
+ CreateFileW(Encoding::ToWindowsExtendedPath(filename).c_str(), 0, 0,
+ NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
+
+ if (handle == INVALID_HANDLE_VALUE) {
+ return false;
+ }
+
+ CloseHandle(handle);
+ }
+
+ return true;
#else
// SCO OpenServer 5.0.7/3.2's command has 711 permission.
# if defined(_SCO_DS)
@@ -1752,11 +1770,11 @@ std::string SystemTools::CropString(const std::string& s, size_t max_len)
return n;
}
-std::vector<kwsys::String> SystemTools::SplitString(const std::string& p,
- char sep, bool isPath)
+std::vector<std::string> SystemTools::SplitString(const std::string& p,
+ char sep, bool isPath)
{
std::string path = p;
- std::vector<kwsys::String> paths;
+ std::vector<std::string> paths;
if (path.empty()) {
return paths;
}
@@ -1973,7 +1991,7 @@ std::string SystemTools::ConvertToUnixOutputPath(const std::string& path)
}
// escape spaces and () in the path
if (ret.find_first_of(" ") != std::string::npos) {
- std::string result = "";
+ std::string result;
char lastch = 1;
for (const char* ch = ret.c_str(); *ch != '\0'; ++ch) {
// if it is already escaped then don't try to escape it again
@@ -3140,7 +3158,7 @@ void SystemTools::AddTranslationPath(const std::string& a,
void SystemTools::AddKeepPath(const std::string& dir)
{
std::string cdir;
- Realpath(SystemTools::CollapseFullPath(dir).c_str(), cdir);
+ Realpath(SystemTools::CollapseFullPath(dir), cdir);
SystemTools::AddTranslationPath(cdir, dir);
}
@@ -3279,13 +3297,12 @@ std::string SystemTools::RelativePath(const std::string& local,
std::string r = SystemTools::CollapseFullPath(remote);
// split up both paths into arrays of strings using / as a separator
- std::vector<kwsys::String> localSplit =
- SystemTools::SplitString(l, '/', true);
- std::vector<kwsys::String> remoteSplit =
+ std::vector<std::string> localSplit = SystemTools::SplitString(l, '/', true);
+ std::vector<std::string> remoteSplit =
SystemTools::SplitString(r, '/', true);
- std::vector<kwsys::String>
+ std::vector<std::string>
commonPath; // store shared parts of path in this array
- std::vector<kwsys::String> finalPath; // store the final relative path here
+ std::vector<std::string> finalPath; // store the final relative path here
// count up how many matching directory names there are from the start
unsigned int sameCount = 0;
while (((sameCount <= (localSplit.size() - 1)) &&
@@ -3325,7 +3342,7 @@ std::string SystemTools::RelativePath(const std::string& local,
}
// for each entry that is not common in the remote path add it
// to the final path.
- for (std::vector<String>::iterator vit = remoteSplit.begin();
+ for (std::vector<std::string>::iterator vit = remoteSplit.begin();
vit != remoteSplit.end(); ++vit) {
if (!vit->empty()) {
finalPath.push_back(*vit);
@@ -3334,7 +3351,7 @@ std::string SystemTools::RelativePath(const std::string& local,
std::string relativePath; // result string
// now turn the array of directories into a unix path by puttint /
// between each entry that does not already have one
- for (std::vector<String>::iterator vit1 = finalPath.begin();
+ for (std::vector<std::string>::iterator vit1 = finalPath.begin();
vit1 != finalPath.end(); ++vit1) {
if (!relativePath.empty() && *relativePath.rbegin() != '/') {
relativePath += "/";
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index 928ee41..8d1f78c 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -10,8 +10,6 @@
#include <string>
#include <vector>
-#include <@KWSYS_NAMESPACE@/String.hxx>
-
#include <sys/types.h>
// include sys/stat.h after sys/types.h
#include <sys/stat.h>
@@ -197,9 +195,9 @@ public:
s starts with a / then the first element of the returned array will
be /, so /foo/bar will be [/, foo, bar]
*/
- static std::vector<String> SplitString(const std::string& s,
- char separator = '/',
- bool isPath = false);
+ static std::vector<std::string> SplitString(const std::string& s,
+ char separator = '/',
+ bool isPath = false);
/**
* Perform a case-independent string comparison
*/
diff --git a/Source/kwsys/Terminal.c b/Source/kwsys/Terminal.c
index f0d9c64..1bcfd0c 100644
--- a/Source/kwsys/Terminal.c
+++ b/Source/kwsys/Terminal.c
@@ -209,27 +209,34 @@ static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100,
}
/* VT100 escape sequence strings. */
-#define KWSYS_TERMINAL_VT100_NORMAL "\33[0m"
-#define KWSYS_TERMINAL_VT100_BOLD "\33[1m"
-#define KWSYS_TERMINAL_VT100_UNDERLINE "\33[4m"
-#define KWSYS_TERMINAL_VT100_BLINK "\33[5m"
-#define KWSYS_TERMINAL_VT100_INVERSE "\33[7m"
-#define KWSYS_TERMINAL_VT100_FOREGROUND_BLACK "\33[30m"
-#define KWSYS_TERMINAL_VT100_FOREGROUND_RED "\33[31m"
-#define KWSYS_TERMINAL_VT100_FOREGROUND_GREEN "\33[32m"
-#define KWSYS_TERMINAL_VT100_FOREGROUND_YELLOW "\33[33m"
-#define KWSYS_TERMINAL_VT100_FOREGROUND_BLUE "\33[34m"
-#define KWSYS_TERMINAL_VT100_FOREGROUND_MAGENTA "\33[35m"
-#define KWSYS_TERMINAL_VT100_FOREGROUND_CYAN "\33[36m"
-#define KWSYS_TERMINAL_VT100_FOREGROUND_WHITE "\33[37m"
-#define KWSYS_TERMINAL_VT100_BACKGROUND_BLACK "\33[40m"
-#define KWSYS_TERMINAL_VT100_BACKGROUND_RED "\33[41m"
-#define KWSYS_TERMINAL_VT100_BACKGROUND_GREEN "\33[42m"
-#define KWSYS_TERMINAL_VT100_BACKGROUND_YELLOW "\33[43m"
-#define KWSYS_TERMINAL_VT100_BACKGROUND_BLUE "\33[44m"
-#define KWSYS_TERMINAL_VT100_BACKGROUND_MAGENTA "\33[45m"
-#define KWSYS_TERMINAL_VT100_BACKGROUND_CYAN "\33[46m"
-#define KWSYS_TERMINAL_VT100_BACKGROUND_WHITE "\33[47m"
+#if defined(__MVS__)
+/* if building on z/OS (aka MVS), assume we are using EBCDIC */
+# define ESCAPE_CHAR "\47"
+#else
+# define ESCAPE_CHAR "\33"
+#endif
+
+#define KWSYS_TERMINAL_VT100_NORMAL ESCAPE_CHAR "[0m"
+#define KWSYS_TERMINAL_VT100_BOLD ESCAPE_CHAR "[1m"
+#define KWSYS_TERMINAL_VT100_UNDERLINE ESCAPE_CHAR "[4m"
+#define KWSYS_TERMINAL_VT100_BLINK ESCAPE_CHAR "[5m"
+#define KWSYS_TERMINAL_VT100_INVERSE ESCAPE_CHAR "[7m"
+#define KWSYS_TERMINAL_VT100_FOREGROUND_BLACK ESCAPE_CHAR "[30m"
+#define KWSYS_TERMINAL_VT100_FOREGROUND_RED ESCAPE_CHAR "[31m"
+#define KWSYS_TERMINAL_VT100_FOREGROUND_GREEN ESCAPE_CHAR "[32m"
+#define KWSYS_TERMINAL_VT100_FOREGROUND_YELLOW ESCAPE_CHAR "[33m"
+#define KWSYS_TERMINAL_VT100_FOREGROUND_BLUE ESCAPE_CHAR "[34m"
+#define KWSYS_TERMINAL_VT100_FOREGROUND_MAGENTA ESCAPE_CHAR "[35m"
+#define KWSYS_TERMINAL_VT100_FOREGROUND_CYAN ESCAPE_CHAR "[36m"
+#define KWSYS_TERMINAL_VT100_FOREGROUND_WHITE ESCAPE_CHAR "[37m"
+#define KWSYS_TERMINAL_VT100_BACKGROUND_BLACK ESCAPE_CHAR "[40m"
+#define KWSYS_TERMINAL_VT100_BACKGROUND_RED ESCAPE_CHAR "[41m"
+#define KWSYS_TERMINAL_VT100_BACKGROUND_GREEN ESCAPE_CHAR "[42m"
+#define KWSYS_TERMINAL_VT100_BACKGROUND_YELLOW ESCAPE_CHAR "[43m"
+#define KWSYS_TERMINAL_VT100_BACKGROUND_BLUE ESCAPE_CHAR "[44m"
+#define KWSYS_TERMINAL_VT100_BACKGROUND_MAGENTA ESCAPE_CHAR "[45m"
+#define KWSYS_TERMINAL_VT100_BACKGROUND_CYAN ESCAPE_CHAR "[46m"
+#define KWSYS_TERMINAL_VT100_BACKGROUND_WHITE ESCAPE_CHAR "[47m"
/* Write VT100 escape sequences to the stream for the given color. */
static void kwsysTerminalSetVT100Color(FILE* stream, int color)
diff --git a/Source/kwsys/testCommandLineArguments.cxx b/Source/kwsys/testCommandLineArguments.cxx
index 0385a3d..ef87436 100644
--- a/Source/kwsys/testCommandLineArguments.cxx
+++ b/Source/kwsys/testCommandLineArguments.cxx
@@ -77,7 +77,7 @@ int testCommandLineArguments(int argc, char* argv[])
int some_int_variable = 10;
double some_double_variable = 10.10;
char* some_string_variable = KWSYS_NULLPTR;
- std::string some_stl_string_variable = "";
+ std::string some_stl_string_variable;
bool some_bool_variable = false;
bool some_bool_variable1 = false;
bool bool_arg1 = false;
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index e6f9701..0477d59 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/testSystemTools.cxx
@@ -206,7 +206,7 @@ static bool CheckFileOperations()
res = false;
}
- if (!kwsys::SystemTools::Touch(testNewFile.c_str(), true)) {
+ if (!kwsys::SystemTools::Touch(testNewFile, true)) {
std::cerr << "Problem with Touch for: " << testNewFile << std::endl;
res = false;
}
@@ -415,7 +415,7 @@ static bool CheckFileOperations()
res = false;
}
- kwsys::SystemTools::Touch(testNewFile.c_str(), true);
+ kwsys::SystemTools::Touch(testNewFile, true);
if (!kwsys::SystemTools::RemoveADirectory(testNewDir)) {
std::cerr << "Problem with RemoveADirectory for: " << testNewDir
<< std::endl;
@@ -806,7 +806,7 @@ static bool CheckFind()
const std::string testFindFile(TEST_SYSTEMTOOLS_BINARY_DIR "/" +
testFindFileName);
- if (!kwsys::SystemTools::Touch(testFindFile.c_str(), true)) {
+ if (!kwsys::SystemTools::Touch(testFindFile, true)) {
std::cerr << "Problem with Touch for: " << testFindFile << std::endl;
// abort here as the existence of the file only makes the test meaningful
return false;
diff --git a/Templates/MSBuild/nasm.xml b/Templates/MSBuild/nasm.xml
index 92f8548..a5dcdd5 100644
--- a/Templates/MSBuild/nasm.xml
+++ b/Templates/MSBuild/nasm.xml
@@ -36,7 +36,7 @@
<DataSource Persistence="ProjectFile" ItemType="NASM" SourceType="Item"/>
</StringProperty.DataSource>
</StringProperty>
- <StringProperty Name="OutputFormat" Category="Assembler Options" HelpUrl="http://www.nasm.us/doc/" DisplayName="Output File Name" Description="Specify Output Filename.-o [value]" Switch="-o [value]"/>
+ <StringProperty Name="OutputFormat" Category="Assembler Options" HelpUrl="http://www.nasm.us/doc/" DisplayName="Output File Name" Description="Specify Output Filename.-o [value]" Switch="-o &quot;[value]&quot;"/>
<BoolProperty Name="tasmmode" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="SciTech TASM compatible mode" Description="assemble in SciTech TASM compatible mode" Switch="-t"/>
<EnumProperty Name="Outputswitch" Category="Assembler Options" HelpUrl="http://www.nasm.us/doc/" DisplayName="Output Switch" Description="Select the type of output format required. Linking Should be disabled for ELF and Binary ,else error will popup">
<EnumValue Name="0" DisplayName="Object File win32" Switch="-fwin32"/>
@@ -48,8 +48,8 @@
<BoolProperty Name="GenerateDebugInformation" Category="Assembler Options" DisplayName="Generate Debug Information" Description="Generates Debug Information. (-g)" HelpUrl="http://www.nasm.us/doc/" Switch="-g"/>
<StringListProperty Name="ErrorReporting" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="Redirect Error Messages to File" Description="Drops the error Message on specified device" Switch="-Z &quot;[value]&quot;"/>
<StringListProperty Name="IncludePaths" Category="General" DisplayName="Include Paths" Description="Sets path for include file. (-I[path])" HelpUrl="http://www.nasm.us/doc/" Switch="-I&quot;[value]&quot;"/>
- <StringListProperty Name="PreprocessorDefinitions" Category="Preprocessor" HelpUrl="http://www.nasm.us/doc/" DisplayName="Preprocessor Definitions" Description="Defines a text macro with the given name. (-D[symbol])" Switch="-D[value]"/>
- <StringListProperty Name="UndefinePreprocessorDefinitions" Category="Preprocessor" HelpUrl="http://www.nasm.us/doc/" DisplayName="Undefine Preprocessor Definitions" Description="Undefines a text macro with the given name. (-U[symbol])" Switch="-U[value]"/>
+ <StringListProperty Name="PreprocessorDefinitions" Category="Preprocessor" HelpUrl="http://www.nasm.us/doc/" DisplayName="Preprocessor Definitions" Description="Defines a text macro with the given name. (-D[symbol])" Switch="-D&quot;[value]&quot;"/>
+ <StringListProperty Name="UndefinePreprocessorDefinitions" Category="Preprocessor" HelpUrl="http://www.nasm.us/doc/" DisplayName="Undefine Preprocessor Definitions" Description="Undefines a text macro with the given name. (-U[symbol])" Switch="-U&quot;[value]&quot;"/>
<EnumProperty Name="ErrorReportingFormat" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="Error Reporting Format" Description="Select the error reporting format ie. GNU or VC">
<EnumValue Name="0" DisplayName="-Xgnu GNU format: Default format" Switch="-Xgnu"/>
<EnumValue Name="1" DisplayName="-Xvc Style used by Microsoft Visual C++" Switch="-Xvc"/>
diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt
index 3b4ff60..39a5131 100644
--- a/Tests/BuildDepends/CMakeLists.txt
+++ b/Tests/BuildDepends/CMakeLists.txt
@@ -345,6 +345,17 @@ is not newer than dependency
${TEST_LINK_DEPENDS}
")
endif()
+
+ set(linkdep2 ${BuildDepends_BINARY_DIR}/Project/linkdep2${CMAKE_EXECUTABLE_SUFFIX})
+ if(${linkdep2} IS_NEWER_THAN ${TEST_LINK_DEPENDS})
+ message("INTERFACE_LINK_DEPENDS worked")
+ else()
+ message(SEND_ERROR "INTERFACE_LINK_DEPENDS failed. Executable
+ ${linkdep2}
+is not newer than dependency
+ ${TEST_LINK_DEPENDS}
+")
+ endif()
endif()
if(EXISTS "${link_depends_no_shared_check_txt}")
diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt
index 127b365..3f41b26 100644
--- a/Tests/BuildDepends/Project/CMakeLists.txt
+++ b/Tests/BuildDepends/Project/CMakeLists.txt
@@ -106,7 +106,12 @@ set_property(
if(TEST_LINK_DEPENDS)
add_executable(linkdep linkdep.cxx)
- set_property(TARGET linkdep PROPERTY LINK_DEPENDS ${TEST_LINK_DEPENDS})
+ set_property(TARGET linkdep PROPERTY LINK_DEPENDS $<1:${TEST_LINK_DEPENDS}>)
+
+ add_library(foo_interface INTERFACE)
+ set_property(TARGET foo_interface PROPERTY INTERFACE_LINK_DEPENDS $<1:${TEST_LINK_DEPENDS}>)
+ add_executable(linkdep2 linkdep.cxx)
+ target_link_libraries(linkdep2 PRIVATE foo_interface)
endif()
add_library(link_depends_no_shared_lib SHARED link_depends_no_shared_lib.c
diff --git a/Tests/CMakeCommands/add_link_options/CMakeLists.txt b/Tests/CMakeCommands/add_link_options/CMakeLists.txt
new file mode 100644
index 0000000..bb7dcbb
--- /dev/null
+++ b/Tests/CMakeCommands/add_link_options/CMakeLists.txt
@@ -0,0 +1,20 @@
+cmake_minimum_required(VERSION 3.11)
+
+project(add_link_options LANGUAGES C)
+
+
+add_link_options(-LINK_FLAG)
+
+add_executable(add_link_options EXCLUDE_FROM_ALL LinkOptionsExe.c)
+
+get_target_property(result add_link_options LINK_OPTIONS)
+if (NOT result MATCHES "-LINK_FLAG")
+ message(SEND_ERROR "add_link_options not populated the LINK_OPTIONS target property")
+endif()
+
+
+add_library(imp UNKNOWN IMPORTED)
+get_target_property(result imp LINK_OPTIONS)
+if (result)
+ message(FATAL_ERROR "add_link_options populated the LINK_OPTIONS target property")
+endif()
diff --git a/Tests/CMakeCommands/add_link_options/LinkOptionsExe.c b/Tests/CMakeCommands/add_link_options/LinkOptionsExe.c
new file mode 100644
index 0000000..8488f4e
--- /dev/null
+++ b/Tests/CMakeCommands/add_link_options/LinkOptionsExe.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/CMakeCommands/target_link_options/CMakeLists.txt b/Tests/CMakeCommands/target_link_options/CMakeLists.txt
new file mode 100644
index 0000000..3bb6ff3
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_options/CMakeLists.txt
@@ -0,0 +1,26 @@
+
+cmake_minimum_required(VERSION 3.11)
+
+project(target_link_options LANGUAGES C)
+
+add_library(target_link_options SHARED LinkOptionsLib.c)
+# Test no items
+target_link_options(target_link_options PRIVATE)
+
+add_library(target_link_options_2 SHARED EXCLUDE_FROM_ALL LinkOptionsLib.c)
+target_link_options(target_link_options_2 PRIVATE -PRIVATE_FLAG INTERFACE -INTERFACE_FLAG)
+get_target_property(result target_link_options_2 LINK_OPTIONS)
+if (NOT result MATCHES "-PRIVATE_FLAG")
+ message(SEND_ERROR "target_link_options not populated the LINK_OPTIONS target property")
+endif()
+get_target_property(result target_link_options_2 INTERFACE_LINK_OPTIONS)
+if (NOT result MATCHES "-INTERFACE_FLAG")
+ message(SEND_ERROR "target_link_options not populated the INTERFACE_LINK_OPTIONS target property of shared library")
+endif()
+
+add_library(target_link_options_3 STATIC EXCLUDE_FROM_ALL LinkOptionsLib.c)
+target_link_options(target_link_options_3 INTERFACE -INTERFACE_FLAG)
+get_target_property(result target_link_options_3 INTERFACE_LINK_OPTIONS)
+if (NOT result MATCHES "-INTERFACE_FLAG")
+ message(SEND_ERROR "target_link_options not populated the INTERFACE_LINK_OPTIONS target property of static library")
+endif()
diff --git a/Tests/CMakeCommands/target_link_options/LinkOptionsLib.c b/Tests/CMakeCommands/target_link_options/LinkOptionsLib.c
new file mode 100644
index 0000000..9bbd24c
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_options/LinkOptionsLib.c
@@ -0,0 +1,7 @@
+#if defined(_WIN32)
+__declspec(dllexport)
+#endif
+ int flags_lib(void)
+{
+ return 0;
+}
diff --git a/Tests/CMakeCommands/target_sources/CMakeLists.txt b/Tests/CMakeCommands/target_sources/CMakeLists.txt
new file mode 100644
index 0000000..ab14855
--- /dev/null
+++ b/Tests/CMakeCommands/target_sources/CMakeLists.txt
@@ -0,0 +1,36 @@
+
+cmake_minimum_required(VERSION 3.12)
+cmake_policy(SET CMP0076 NEW)
+
+project(target_sources)
+
+add_library(target_sources_lib)
+target_compile_definitions(target_sources_lib PRIVATE "-DIS_LIB")
+add_subdirectory(subdir)
+
+set(subdir_fullpath "${CMAKE_CURRENT_LIST_DIR}/subdir")
+
+get_property(target_sources_lib_property TARGET target_sources_lib PROPERTY SOURCES)
+if (NOT "$<1:${subdir_fullpath}/subdir_empty_1.cpp>" IN_LIST target_sources_lib_property)
+ message(SEND_ERROR "target_sources_lib: Generator expression to absolute sub directory file not found")
+endif()
+if (NOT "$<1:${subdir_fullpath}/../empty_1.cpp>" IN_LIST target_sources_lib_property)
+ message(SEND_ERROR "target_sources_lib: Generator expression to absolute main directory file not found")
+endif()
+if (NOT "${subdir_fullpath}/subdir_empty_2.cpp" IN_LIST target_sources_lib_property)
+ message(SEND_ERROR "target_sources_lib: Relative sub directory file not converted to absolute")
+endif()
+if (NOT "$<1:empty_2.cpp>" IN_LIST target_sources_lib_property)
+ message(SEND_ERROR "target_sources_lib: Generator expression to relative main directory file not found")
+endif()
+if (NOT "${subdir_fullpath}/../empty_3.cpp" IN_LIST target_sources_lib_property)
+ message(SEND_ERROR "target_sources_lib: Relative main directory file not converted to absolute")
+endif()
+
+add_executable(target_sources main.cpp)
+target_link_libraries(target_sources target_sources_lib)
+
+get_property(target_sources_property TARGET target_sources PROPERTY SOURCES)
+if (NOT "main.cpp" IN_LIST target_sources_property)
+ message(SEND_ERROR "target_sources: Relative main directory file converted to absolute")
+endif()
diff --git a/Tests/CMakeCommands/target_sources/empty_1.cpp b/Tests/CMakeCommands/target_sources/empty_1.cpp
new file mode 100644
index 0000000..01e5b07
--- /dev/null
+++ b/Tests/CMakeCommands/target_sources/empty_1.cpp
@@ -0,0 +1,21 @@
+#ifdef IS_LIB
+
+# ifdef _WIN32
+__declspec(dllexport)
+# endif
+ int internal_empty_1()
+{
+ return 0;
+}
+
+#else
+
+# ifdef _WIN32
+__declspec(dllexport)
+# endif
+ int empty_1()
+{
+ return 0;
+}
+
+#endif
diff --git a/Tests/CMakeCommands/target_sources/empty_2.cpp b/Tests/CMakeCommands/target_sources/empty_2.cpp
new file mode 100644
index 0000000..48ae8bb
--- /dev/null
+++ b/Tests/CMakeCommands/target_sources/empty_2.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int empty_2()
+{
+ return 0;
+}
diff --git a/Tests/CMakeCommands/target_sources/empty_3.cpp b/Tests/CMakeCommands/target_sources/empty_3.cpp
new file mode 100644
index 0000000..bd3a6d1
--- /dev/null
+++ b/Tests/CMakeCommands/target_sources/empty_3.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int empty_3()
+{
+ return 0;
+}
diff --git a/Tests/CMakeCommands/target_sources/main.cpp b/Tests/CMakeCommands/target_sources/main.cpp
new file mode 100644
index 0000000..622771c
--- /dev/null
+++ b/Tests/CMakeCommands/target_sources/main.cpp
@@ -0,0 +1,16 @@
+#include <iostream>
+
+int empty_1();
+int subdir_empty_1();
+int subdir_empty_2();
+
+int main()
+{
+ int e1 = empty_1();
+ int se1 = subdir_empty_1();
+ int se2 = subdir_empty_2();
+
+ std::cout << e1 << " " << se1 << " " << se2 << std::endl;
+
+ return 0;
+}
diff --git a/Tests/CMakeCommands/target_sources/subdir/CMakeLists.txt b/Tests/CMakeCommands/target_sources/subdir/CMakeLists.txt
new file mode 100644
index 0000000..f749f1d
--- /dev/null
+++ b/Tests/CMakeCommands/target_sources/subdir/CMakeLists.txt
@@ -0,0 +1,6 @@
+
+target_sources(target_sources_lib PUBLIC $<1:${CMAKE_CURRENT_LIST_DIR}/subdir_empty_1.cpp>
+ $<1:${CMAKE_CURRENT_LIST_DIR}/../empty_1.cpp>
+ subdir_empty_2.cpp
+ PRIVATE $<1:empty_2.cpp>
+ ../empty_3.cpp)
diff --git a/Tests/CMakeCommands/target_sources/subdir/subdir_empty_1.cpp b/Tests/CMakeCommands/target_sources/subdir/subdir_empty_1.cpp
new file mode 100644
index 0000000..3c61321
--- /dev/null
+++ b/Tests/CMakeCommands/target_sources/subdir/subdir_empty_1.cpp
@@ -0,0 +1,21 @@
+#ifdef IS_LIB
+
+# ifdef _WIN32
+__declspec(dllexport)
+# endif
+ int internal_subdir_empty_1()
+{
+ return 0;
+}
+
+#else
+
+# ifdef _WIN32
+__declspec(dllexport)
+# endif
+ int subdir_empty_1()
+{
+ return 0;
+}
+
+#endif
diff --git a/Tests/CMakeCommands/target_sources/subdir/subdir_empty_2.cpp b/Tests/CMakeCommands/target_sources/subdir/subdir_empty_2.cpp
new file mode 100644
index 0000000..47fa736
--- /dev/null
+++ b/Tests/CMakeCommands/target_sources/subdir/subdir_empty_2.cpp
@@ -0,0 +1,21 @@
+#ifdef IS_LIB
+
+# ifdef _WIN32
+__declspec(dllexport)
+# endif
+ int internal_subdir_empty_2()
+{
+ return 0;
+}
+
+#else
+
+# ifdef _WIN32
+__declspec(dllexport)
+# endif
+ int subdir_empty_2()
+{
+ return 0;
+}
+
+#endif
diff --git a/Tests/CMakeLib/testRST.expect b/Tests/CMakeLib/testRST.expect
index 1ffd6b9..d7b91d1 100644
--- a/Tests/CMakeLib/testRST.expect
+++ b/Tests/CMakeLib/testRST.expect
@@ -19,6 +19,7 @@ Variable ``VARIABLE_<PLACEHOLDER>`` with trailing placeholder and target.
Environment variable ``SOME_ENV_VAR``.
Environment variable ``some env var`` with space and target.
Generator ``Some Generator`` with space.
+Generator ``Some Generator`` with space.
Inline literal ``~!@#$%^&*( )_+-=\\[]{}'":;,<>.?/``.
Inline link Link Text.
Inline link Link Text <With \-escaped Brackets>.
diff --git a/Tests/CMakeLib/testRST.rst b/Tests/CMakeLib/testRST.rst
index c8587c0..633219f 100644
--- a/Tests/CMakeLib/testRST.rst
+++ b/Tests/CMakeLib/testRST.rst
@@ -26,6 +26,7 @@ Variable :variable:`VARIABLE_<PLACEHOLDER> <target>` with trailing placeholder a
Environment variable :envvar:`SOME_ENV_VAR`.
Environment variable :envvar:`some env var <SOME_ENV_VAR>` with space and target.
Generator :generator:`Some Generator` with space.
+Generator :cpack_gen:`Some Generator` with space.
Inline literal ``~!@#$%^&*( )_+-=\\[]{}'":;,<>.?/``.
Inline link `Link Text <ExternalDest>`_.
Inline link `Link Text \<With \\-escaped Brackets\> <ExternalDest>`_.
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index b8b724e..971d7ff 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -869,33 +869,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BuildDepends")
- set(SimpleInstallInstallDir
- "${CMake_BINARY_DIR}/Tests/SimpleInstall/InstallDirectory")
- add_test(SimpleInstall ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/SimpleInstall"
- "${CMake_BINARY_DIR}/Tests/SimpleInstall"
- ${build_generator_args}
- --build-project TestSimpleInstall
- --build-two-config
- --build-options ${build_options}
- "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}"
- "-DCTEST_TEST_CPACK:BOOL=${CTEST_TEST_CPACK}"
- --test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExe)
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstall")
- add_test(SimpleInstall-Stage2 ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/SimpleInstallS2"
- "${CMake_BINARY_DIR}/Tests/SimpleInstallS2"
- ${build_generator_args}
- --build-project TestSimpleInstall
- --build-two-config
- --build-options ${build_options}
- "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}"
- "-DSTAGE2:BOOL=1"
- --test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExeS2)
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstallS2")
-
set(MissingInstallInstallDir
"${CMake_BINARY_DIR}/Tests/MissingInstall/InstallDirectory")
add_test(MissingInstall ${CMAKE_CTEST_COMMAND}
@@ -1821,7 +1794,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
set_tests_properties ( testdriver2 PROPERTIES DEPENDS testdriver1)
set_tests_properties ( testdriver3 PROPERTIES DEPENDS testdriver2)
set_tests_properties ( linkorder2 PROPERTIES DEPENDS linkorder1)
- set_tests_properties ( SimpleInstall-Stage2 PROPERTIES DEPENDS SimpleInstall)
# Test static linking on toolchains known to support it.
if(CMAKE_C_COMPILER_ID STREQUAL "GNU"
@@ -1940,6 +1912,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
message(STATUS
".vcproj file association indicates VCExpress, avoiding MFC test")
set(CTEST_RUN_MFC OFF)
+ elseif( NOT ov )
+ message(STATUS
+ ".vcproj has no file association, avoiding MFC test")
+ set(CTEST_RUN_MFC OFF)
endif()
endif()
@@ -2256,7 +2232,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
--build-generator "Green Hills MULTI"
--build-project ReturnNum
--build-config $<CONFIGURATION>
- --build-options -DGHS_PRIMARY_TARGET="arm_integrity.tgt"
+ --build-options -DGHS_PRIMARY_TARGET=arm_integrity.tgt
-DGHS_BSP_NAME="simarm"
)
endif ()
@@ -2843,6 +2819,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
ADD_TEST_MACRO(CMakeCommands.target_include_directories target_include_directories)
ADD_TEST_MACRO(CMakeCommands.target_compile_definitions target_compile_definitions)
ADD_TEST_MACRO(CMakeCommands.target_compile_options target_compile_options)
+ ADD_TEST_MACRO(CMakeCommands.target_sources target_sources)
+
+ ADD_TEST_MACRO(CMakeCommands.add_link_options)
+ ADD_TEST_MACRO(CMakeCommands.target_link_options)
# The cmake server-mode test requires python for a simple client.
find_package(PythonInterp QUIET)
@@ -3437,10 +3417,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
)
endif()
- add_test(NAME CMakeWizardTest COMMAND cmake -i)
- set_property(TEST CMakeWizardTest PROPERTY PASS_REGULAR_EXPRESSION
- "The \"cmake -i\" wizard mode is no longer supported.")
-
# Define a set of "contract" tests, each activated by a cache entry
# named "CMake_TEST_CONTRACT_<project>". For each Contract test,
# the project should provide a directory with a CMakeLists.txt file
diff --git a/Tests/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in
index 76f5e4f..f517e64 100644
--- a/Tests/CMakeTests/ListTest.cmake.in
+++ b/Tests/CMakeTests/ListTest.cmake.in
@@ -53,6 +53,10 @@ set(result andy brad)
list(INSERT result -1 bill ken)
TEST("INSERT result -1 bill ken" "andy;bill;ken;brad")
+set(result andy brad)
+list(INSERT result 2 bill ken)
+TEST("INSERT result 2 bill ken" "andy;brad;bill;ken")
+
set(result andy bill brad ken bob)
list(REMOVE_ITEM result bob)
TEST("REMOVE_ITEM result bob" "andy;bill;brad;ken")
diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt
index 59f3e84..5b7c0e6 100644
--- a/Tests/CudaOnly/CMakeLists.txt
+++ b/Tests/CudaOnly/CMakeLists.txt
@@ -1,4 +1,5 @@
+ADD_TEST_MACRO(CudaOnly.CircularLinkLine CudaOnlyCircularLinkLine)
ADD_TEST_MACRO(CudaOnly.EnableStandard CudaOnlyEnableStandard)
ADD_TEST_MACRO(CudaOnly.ExportPTX CudaOnlyExportPTX)
ADD_TEST_MACRO(CudaOnly.GPUDebugFlag CudaOnlyGPUDebugFlag)
diff --git a/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt b/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt
new file mode 100644
index 0000000..c978e51
--- /dev/null
+++ b/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt
@@ -0,0 +1,34 @@
+cmake_minimum_required(VERSION 3.7)
+project (CudaOnlyCircularLinkLine CUDA)
+
+#Goal for this example:
+# Verify that we de-duplicate the device link line
+# Verify that a de-duplicated link line still works with circular static libraries
+
+string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=[compute_30]")
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CUDA_STANDARD 11)
+
+add_library(CUDACircularDeviceLinking1 STATIC file1.cu)
+add_library(CUDACircularDeviceLinking2 STATIC file2.cu)
+add_library(CUDACircularDeviceLinking3 STATIC file3.cu)
+add_executable(CudaOnlyCircularLinkLine main.cu)
+
+target_link_libraries(CUDACircularDeviceLinking1 PUBLIC CUDACircularDeviceLinking2)
+target_link_libraries(CUDACircularDeviceLinking2 PUBLIC CUDACircularDeviceLinking3)
+target_link_libraries(CUDACircularDeviceLinking3 PUBLIC CUDACircularDeviceLinking1)
+
+target_link_libraries(CudaOnlyCircularLinkLine PRIVATE CUDACircularDeviceLinking3)
+
+
+set_target_properties(CUDACircularDeviceLinking1
+ PROPERTIES
+ CUDA_SEPARABLE_COMPILATION ON)
+
+set_target_properties(CUDACircularDeviceLinking2
+ PROPERTIES
+ CUDA_SEPARABLE_COMPILATION ON)
+
+set_target_properties(CUDACircularDeviceLinking3
+ PROPERTIES
+ CUDA_SEPARABLE_COMPILATION ON)
diff --git a/Tests/CudaOnly/CircularLinkLine/file1.cu b/Tests/CudaOnly/CircularLinkLine/file1.cu
new file mode 100644
index 0000000..88ac4e3
--- /dev/null
+++ b/Tests/CudaOnly/CircularLinkLine/file1.cu
@@ -0,0 +1,6 @@
+
+extern __device__ int file2_func(int);
+int __device__ file1_func(int x)
+{
+ return file2_func(x);
+}
diff --git a/Tests/CudaOnly/CircularLinkLine/file2.cu b/Tests/CudaOnly/CircularLinkLine/file2.cu
new file mode 100644
index 0000000..b32dbff
--- /dev/null
+++ b/Tests/CudaOnly/CircularLinkLine/file2.cu
@@ -0,0 +1,6 @@
+
+extern __device__ int file3_func(int);
+int __device__ file2_func(int x)
+{
+ return x + file3_func(x);
+}
diff --git a/Tests/CudaOnly/CircularLinkLine/file3.cu b/Tests/CudaOnly/CircularLinkLine/file3.cu
new file mode 100644
index 0000000..7f67187
--- /dev/null
+++ b/Tests/CudaOnly/CircularLinkLine/file3.cu
@@ -0,0 +1,8 @@
+
+extern __device__ int file1_func(int);
+int __device__ file3_func(int x)
+{
+ if (x > 0)
+ return file1_func(-x);
+ return x;
+}
diff --git a/Tests/CudaOnly/CircularLinkLine/main.cu b/Tests/CudaOnly/CircularLinkLine/main.cu
new file mode 100644
index 0000000..1c19e8d
--- /dev/null
+++ b/Tests/CudaOnly/CircularLinkLine/main.cu
@@ -0,0 +1,5 @@
+
+int main(int argc, char** argv)
+{
+ return 0;
+}
diff --git a/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu b/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu
index 7eecec1..2c7c388 100644
--- a/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu
+++ b/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu
@@ -3,6 +3,9 @@
#include <cuda_runtime.h>
#include <iostream>
+// this test only makes sense for versions of CUDA that ships
+// static libraries that have separable compilation device symbols
+#if __CUDACC_VER_MAJOR__ <= 9
__global__ void deviceCublasSgemm(int n, float alpha, float beta,
const float* d_A, const float* d_B,
float* d_C)
@@ -22,6 +25,7 @@ __global__ void deviceCublasSgemm(int n, float alpha, float beta,
cublasDestroy(cnpHandle);
}
+#endif
int choose_cuda_device()
{
@@ -63,6 +67,7 @@ int main(int argc, char** argv)
return 0;
}
+#if __CUDACC_VER_MAJOR__ <= 9
// initial values that will make sure that the cublasSgemm won't actually
// do any work
int n = 0;
@@ -72,6 +77,7 @@ int main(int argc, char** argv)
float* d_B = nullptr;
float* d_C = nullptr;
deviceCublasSgemm<<<1, 1>>>(n, alpha, beta, d_A, d_B, d_C);
+#endif
return 0;
}
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index 0f1a556..fdb2fa1 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -510,9 +510,9 @@ install(
cmp0022NEW cmp0022OLD
systemlib
EXPORT exp
- RUNTIME DESTINATION $<1:bin>
- LIBRARY DESTINATION $<1:lib> NAMELINK_SKIP
- ARCHIVE DESTINATION $<1:lib>
+ RUNTIME DESTINATION $<1:bin>$<0:/wrong>
+ LIBRARY DESTINATION $<1:lib>$<0:/wrong> NAMELINK_SKIP
+ ARCHIVE DESTINATION $<1:lib>$<0:/wrong>
${maybe_OBJECTS_DESTINATION}
FRAMEWORK DESTINATION Frameworks
BUNDLE DESTINATION Applications
@@ -597,3 +597,27 @@ install(
)
install(DIRECTORY $<1:include/abs>$<0:/wrong> DESTINATION $<1:include>$<0:/wrong>)
install(EXPORT expAbs NAMESPACE expAbs_ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/expAbs)
+
+
+#------------------------------------------------------------------------------
+# test export of INTERFACE_LINK_OPTIONS
+add_library(testLinkOptions INTERFACE)
+target_link_options(testLinkOptions INTERFACE INTERFACE_FLAG)
+
+install(TARGETS testLinkOptions
+ EXPORT RequiredExp DESTINATION lib)
+export(TARGETS testLinkOptions NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake)
+
+
+#------------------------------------------------------------------------------
+# test export of INTERFACE_LINK_DEPENDS
+if(CMAKE_GENERATOR MATCHES "Make|Ninja")
+ add_library(testLinkDepends INTERFACE)
+ set_property(TARGET testLinkDepends PROPERTY INTERFACE_LINK_DEPENDS
+ $<BUILD_INTERFACE:BUILD_LINK_DEPENDS>
+ $<INSTALL_INTERFACE:INSTALL_LINK_DEPENDS>)
+
+ install(TARGETS testLinkDepends
+ EXPORT RequiredExp DESTINATION lib)
+ export(TARGETS testLinkDepends NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake)
+endif()
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 39a89dc..7510d7e 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -472,3 +472,15 @@ if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREA
endif()
endif()
endif()
+
+#---------------------------------------------------------------------------------
+# check that imported libraries have the expected INTERFACE_LINK_OPTIONS property
+checkForProperty(bld_testLinkOptions "INTERFACE_LINK_OPTIONS" "INTERFACE_FLAG")
+checkForProperty(Req::testLinkOptions "INTERFACE_LINK_OPTIONS" "INTERFACE_FLAG")
+
+#---------------------------------------------------------------------------------
+# check that imported libraries have the expected INTERFACE_LINK_DEPENDS property
+if(CMAKE_GENERATOR MATCHES "Make|Ninja")
+ checkForProperty(bld_testLinkDepends "INTERFACE_LINK_DEPENDS" "BUILD_LINK_DEPENDS")
+ checkForProperty(Req::testLinkDepends "INTERFACE_LINK_DEPENDS" "${CMAKE_INSTALL_PREFIX}/INSTALL_LINK_DEPENDS")
+endif()
diff --git a/Tests/ExportImport/Import/A/imp_testLinkOptions.cpp b/Tests/ExportImport/Import/A/imp_testLinkOptions.cpp
new file mode 100644
index 0000000..2b18b2e
--- /dev/null
+++ b/Tests/ExportImport/Import/A/imp_testLinkOptions.cpp
@@ -0,0 +1,8 @@
+
+#include "testSharedLibRequired.h"
+
+int foo()
+{
+ TestSharedLibRequired req;
+ return req.foo();
+}
diff --git a/Tests/FindPackageModeMakefileTest/foo.cpp b/Tests/FindPackageModeMakefileTest/foo.cpp
index 6aea226..7cb9381 100644
--- a/Tests/FindPackageModeMakefileTest/foo.cpp
+++ b/Tests/FindPackageModeMakefileTest/foo.cpp
@@ -1,3 +1,5 @@
+#include "foo.h"
+
int foo()
{
return 1477;
diff --git a/Tests/FindPackageModeMakefileTest/foo.h b/Tests/FindPackageModeMakefileTest/foo.h
index 4ec598a..7051eda 100644
--- a/Tests/FindPackageModeMakefileTest/foo.h
+++ b/Tests/FindPackageModeMakefileTest/foo.h
@@ -1,6 +1,14 @@
#ifndef FOO_H
#define FOO_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
int foo();
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
index 0876871..3fd5541 100644
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -188,7 +188,7 @@ find_package(ArchC 3.1 EXACT NAMES zot)
find_package(ArchD 4.0 EXACT NAMES zot)
unset(CMAKE_LIBRARY_ARCHITECTURE)
-# Test <Package>_DIR environment variable.
+# Test <PackageName>_DIR environment variable.
# We erase the main prefix path to ensure the env var is used.
set(CMAKE_PREFIX_PATH)
set(ENV{EnvA_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/lib/zot-3.1")
diff --git a/Tests/MathTest/CMakeLists.txt b/Tests/MathTest/CMakeLists.txt
index f764b3a..5403d29 100644
--- a/Tests/MathTest/CMakeLists.txt
+++ b/Tests/MathTest/CMakeLists.txt
@@ -13,14 +13,35 @@ set(expressions
"-1 + +1"
"+1 - -1"
"+1 - - + + -(-3 + - - +1)"
+ "1000 -12*5"
+ "1000 +12*-5"
+ "1000 -12*-5"
)
-set(FILE_EXPRESSIONS "")
-foreach(expression
- ${expressions})
- math(EXPR expr "${expression}")
- string(APPEND FILE_EXPRESSIONS "TEST_EXPRESSION(${expression}, ${expr})\n")
-endforeach()
+set(FILE_EXPRESSIONS "extern void test_expression(int x, int y, const char * text);\n")
+
+
+macro(add_math_test expression)
+ math(EXPR result ${expression} ${ARGV1} ${ARGV2})
+ set(CODE "test_expression(${expression}, ${result}, \"${expression}\");")
+ string(APPEND FILE_EXPRESSIONS "${CODE}\n")
+endmacro()
+
+macro(add_math_tests)
+ foreach (expression ${expressions})
+ add_math_test(${expression} ${ARGV0} ${ARGV1})
+ endforeach ()
+endmacro()
+
+add_math_tests()
+add_math_tests("OUTPUT_FORMAT" "DECIMAL")
+add_math_tests("OUTPUT_FORMAT" "HEXADECIMAL")
+
+# Avoid the test with negative result and hexadecimal formatting
+# therefore more tests with a negative result
+add_math_test("-12*5")
+add_math_test("12*-5")
+
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/MathTestTests.h.in"
diff --git a/Tests/MathTest/MathTestExec.cxx b/Tests/MathTest/MathTestExec.cxx
index 124eba4..fbcddc4 100644
--- a/Tests/MathTest/MathTestExec.cxx
+++ b/Tests/MathTest/MathTestExec.cxx
@@ -1,21 +1,43 @@
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
-#define TEST_EXPRESSION(x, y) \
- if ((x) != (y)) { \
- printf("Problem with EXPR: Expression: \"%s\" in C returns %d while in " \
- "CMake returns: %d\n", \
- #x, (x), (y)); \
- res++; \
+int res = 0;
+bool print = false;
+
+void test_expression(int x, int y, const char* text)
+{
+ bool fail = (x) != (y);
+ if (fail) {
+ res++;
+ printf("Problem with EXPR:");
+ }
+ if (fail || print) {
+ printf("Expression: \"%s\" in CMake returns %d", text, (y));
+ if (fail) {
+ printf(" while in C returns: %d", (x));
+ }
+ printf("\n");
}
+}
int main(int argc, char* argv[])
{
- if (argc > 1) {
- printf("Usage: %s\n", argv[0]);
+ if (argc > 2) {
+ printf("Usage: %s [print]\n", argv[0]);
return 1;
}
- int res = 0;
+
+ if (argc > 1) {
+ if (strcmp(argv[1], "print") != 0) {
+ printf("Usage: %s [print]\n", argv[0]);
+ return 1;
+ }
+ print = true;
+ }
+
#include "MathTestTests.h"
+
if (res != 0) {
printf("%s: %d math tests failed\n", argv[0], res);
return 1;
diff --git a/Tests/QtAutogen/AutogenTest.cmake b/Tests/QtAutogen/AutogenTest.cmake
index 8c0a14f..3969a89 100644
--- a/Tests/QtAutogen/AutogenTest.cmake
+++ b/Tests/QtAutogen/AutogenTest.cmake
@@ -6,7 +6,7 @@ if(QT_QMAKE_EXECUTABLE)
list(APPEND CMAKE_PREFIX_PATH ${Qt_PREFIX_DIR})
endif()
-if (QT_TEST_VERSION STREQUAL 4)
+if (QT_TEST_VERSION EQUAL 4)
find_package(Qt4 REQUIRED)
include(UseQt4)
@@ -21,7 +21,7 @@ if (QT_TEST_VERSION STREQUAL 4)
qt4_generate_moc(${ARGN})
endmacro()
-elseif(QT_TEST_VERSION STREQUAL 5)
+elseif(QT_TEST_VERSION EQUAL 5)
find_package(Qt5Widgets REQUIRED)
set(QT_QTCORE_TARGET Qt5::Core)
diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake
index cd05aeb..01ed7e9 100644
--- a/Tests/QtAutogen/CommonTests.cmake
+++ b/Tests/QtAutogen/CommonTests.cmake
@@ -12,7 +12,7 @@ if(QT_TEST_ALLOW_QT_MACROS)
endif()
ADD_AUTOGEN_TEST(UicSkipSource)
ADD_AUTOGEN_TEST(RccSkipSource)
-if(NOT QT_TEST_VERSION STREQUAL 4)
+if(QT_TEST_VERSION GREATER 4)
ADD_AUTOGEN_TEST(MocMacroName mocMacroName)
endif()
ADD_AUTOGEN_TEST(MocDepends)
@@ -23,10 +23,13 @@ endif()
if(QT_TEST_ALLOW_QT_MACROS)
ADD_AUTOGEN_TEST(MocCMP0071)
endif()
+if(QT_TEST_VERSION GREATER 4)
+ ADD_AUTOGEN_TEST(MocOsMacros)
+endif()
ADD_AUTOGEN_TEST(UicInclude uicInclude)
ADD_AUTOGEN_TEST(UicInterface QtAutoUicInterface)
ADD_AUTOGEN_TEST(ObjectLibrary someProgram)
-if(APPLE AND (NOT QT_TEST_VERSION STREQUAL 4))
+if(APPLE AND (QT_TEST_VERSION GREATER 4))
ADD_AUTOGEN_TEST(MacOsFW)
endif()
ADD_AUTOGEN_TEST(Parallel parallel)
@@ -39,7 +42,7 @@ ADD_AUTOGEN_TEST(SameName sameName)
ADD_AUTOGEN_TEST(StaticLibraryCycle slc)
# Rerun tests
ADD_AUTOGEN_TEST(RerunMocBasic)
-if(NOT QT_TEST_VERSION STREQUAL 4)
+if(QT_TEST_VERSION GREATER 4)
ADD_AUTOGEN_TEST(RerunMocPlugin)
endif()
ADD_AUTOGEN_TEST(RerunRccDepends)
diff --git a/Tests/QtAutogen/DefinesTest/CMakeLists.txt b/Tests/QtAutogen/DefinesTest/CMakeLists.txt
index de22845..3761dd8 100644
--- a/Tests/QtAutogen/DefinesTest/CMakeLists.txt
+++ b/Tests/QtAutogen/DefinesTest/CMakeLists.txt
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10)
project(DefinesTest)
# Qt4 only definitions test
-if(NOT QT_TEST_VERSION STREQUAL 4)
+if(NOT QT_TEST_VERSION EQUAL 4)
message(ERROR "Invalid Qt test version. This test is for Qt4 only.")
endif()
diff --git a/Tests/QtAutogen/MocOsMacros/CMakeLists.txt b/Tests/QtAutogen/MocOsMacros/CMakeLists.txt
new file mode 100644
index 0000000..e7b670e
--- /dev/null
+++ b/Tests/QtAutogen/MocOsMacros/CMakeLists.txt
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 3.11)
+project(MocOsMacros)
+include("../AutogenTest.cmake")
+
+# Tests if moc processes Q_OS_XXX macros
+
+message( "Qt5Core_VERSION: ${Qt5Core_VERSION}" )
+message(
+ "CMAKE_CXX_COMPILER_PREDEFINES_COMMAND: "
+ ${CMAKE_CXX_COMPILER_PREDEFINES_COMMAND} )
+
+# On some platforms (e.g. MAC) Q_OS_XXX requires moc to include moc_predefs.h
+# which is supported since Qt 5.8 and requires
+# CMAKE_CXX_COMPILER_PREDEFINES_COMMAND to be defined.
+if( ( ${Qt5Core_VERSION} VERSION_GREATER_EQUAL "5.8" ) AND
+ DEFINED CMAKE_CXX_COMPILER_PREDEFINES_COMMAND
+)
+ message( "Test enabled!" )
+ message(
+ "CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES: "
+ ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES} )
+
+ set(CMAKE_AUTOMOC True)
+ add_executable(mocOsMacros
+ main.cpp
+ TestClass.cpp
+ TestClass.hpp
+ )
+ target_link_libraries(mocOsMacros PRIVATE ${QT_QTCORE_TARGET})
+else()
+ message( "Test disabled!" )
+endif()
diff --git a/Tests/QtAutogen/MocOsMacros/TestClass.cpp b/Tests/QtAutogen/MocOsMacros/TestClass.cpp
new file mode 100644
index 0000000..340d130
--- /dev/null
+++ b/Tests/QtAutogen/MocOsMacros/TestClass.cpp
@@ -0,0 +1,77 @@
+#include "TestClass.hpp"
+#include <iostream>
+
+// -- Mac
+#ifndef Q_OS_MAC
+void TestClass::MacNotDef()
+{
+ std::cout << "MacNotDef\n";
+}
+#else
+void TestClass::MacNotDefElse()
+{
+ std::cout << "MacNotDefElse\n";
+}
+#endif
+
+#ifdef Q_OS_MAC
+void TestClass::MacDef()
+{
+ std::cout << "MacDef\n";
+}
+#else
+void TestClass::MacDefElse()
+{
+ std::cout << "MacDefElse\n";
+}
+#endif
+
+// -- Unix
+#ifndef Q_OS_UNIX
+void TestClass::UnixNotDef()
+{
+ std::cout << "UnixNotDef\n";
+}
+#else
+void TestClass::UnixNotDefElse()
+{
+ std::cout << "UnixNotDefElse\n";
+}
+#endif
+
+#ifdef Q_OS_UNIX
+void TestClass::UnixDef()
+{
+ std::cout << "UnixDef\n";
+}
+#else
+void TestClass::UnixDefElse()
+{
+ std::cout << "UnixDefElse\n";
+}
+#endif
+
+// -- Windows
+#ifndef Q_OS_WIN
+void TestClass::WindowsNotDef()
+{
+ std::cout << "WindowsNotDef\n";
+}
+#else
+void TestClass::WindowsNotDefElse()
+{
+ std::cout << "WindowsNotDefElse\n";
+}
+#endif
+
+#ifdef Q_OS_WIN
+void TestClass::WindowsDef()
+{
+ std::cout << "WindowsDef\n";
+}
+#else
+void TestClass::WindowsDefElse()
+{
+ std::cout << "WindowsDefElse\n";
+}
+#endif
diff --git a/Tests/QtAutogen/MocOsMacros/TestClass.hpp b/Tests/QtAutogen/MocOsMacros/TestClass.hpp
new file mode 100644
index 0000000..53000aa
--- /dev/null
+++ b/Tests/QtAutogen/MocOsMacros/TestClass.hpp
@@ -0,0 +1,52 @@
+#ifndef TestClass_hpp
+#define TestClass_hpp
+
+#include <QObject>
+#include <QtGlobal>
+
+class TestClass : public QObject
+{
+ Q_OBJECT
+public Q_SLOTS:
+
+// -- Mac
+#ifndef Q_OS_MAC
+ void MacNotDef();
+#else
+ void MacNotDefElse();
+#endif
+
+#ifdef Q_OS_MAC
+ void MacDef();
+#else
+ void MacDefElse();
+#endif
+
+// -- Unix
+#ifndef Q_OS_UNIX
+ void UnixNotDef();
+#else
+ void UnixNotDefElse();
+#endif
+
+#ifdef Q_OS_UNIX
+ void UnixDef();
+#else
+ void UnixDefElse();
+#endif
+
+// -- Windows
+#ifndef Q_OS_WIN
+ void WindowsNotDef();
+#else
+ void WindowsNotDefElse();
+#endif
+
+#ifdef Q_OS_WIN
+ void WindowsDef();
+#else
+ void WindowsDefElse();
+#endif
+};
+
+#endif /* TestClass_hpp */
diff --git a/Tests/QtAutogen/MocOsMacros/main.cpp b/Tests/QtAutogen/MocOsMacros/main.cpp
new file mode 100644
index 0000000..f8eec3c
--- /dev/null
+++ b/Tests/QtAutogen/MocOsMacros/main.cpp
@@ -0,0 +1,32 @@
+#include "TestClass.hpp"
+#include <QtGlobal>
+
+int main()
+{
+ TestClass a;
+#ifdef Q_OS_MAC
+ a.MacNotDefElse();
+ a.MacDef();
+#else
+ a.MacNotDef();
+ a.MacDefElse();
+#endif
+
+#ifdef Q_OS_UNIX
+ a.UnixNotDefElse();
+ a.UnixDef();
+#else
+ a.UnixNotDef();
+ a.UnixDefElse();
+#endif
+
+#ifdef Q_OS_WIN
+ a.WindowsNotDefElse();
+ a.WindowsDef();
+#else
+ a.WindowsNotDef();
+ a.WindowsDefElse();
+#endif
+
+ return 0;
+}
diff --git a/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt b/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt
index 0bb0339..6fad80c 100644
--- a/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt
@@ -16,6 +16,7 @@ try_compile(MOC_RERUN
"${mocBasicSrcDir}"
MocBasic
CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
OUTPUT_VARIABLE output
)
diff --git a/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt b/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt
index 8a89b38..b5287c1 100644
--- a/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt
@@ -19,6 +19,7 @@ try_compile(MOC_PLUGIN
"${mocPlugSrcDir}"
MocPlugin
CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
OUTPUT_VARIABLE output
)
diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt
index bc0085f..ca22aeb 100644
--- a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt
@@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.10)
project(MocPlugin)
include("../../AutogenTest.cmake")
-if (NOT QT_TEST_VERSION STREQUAL 5)
- message(SEND_ERROR "Invalid Qt version specified.")
+if (QT_TEST_VERSION LESS 5)
+ message(SEND_ERROR "Qt 5 or higher required.")
endif()
set(CMAKE_AUTOMOC_DEPEND_FILTERS
diff --git a/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt b/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt
index f09865d..4dc24fe 100644
--- a/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt
@@ -19,6 +19,7 @@ try_compile(RCC_DEPENDS
"${rccDepSD}"
RccConfigChange
CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
OUTPUT_VARIABLE output
)
diff --git a/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt
index 52e2488..4268de2 100644
--- a/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt
@@ -21,6 +21,7 @@ try_compile(RCC_DEPENDS
"${rccDepSD}"
RccDepends
CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
OUTPUT_VARIABLE output
)
diff --git a/Tests/QtAutogen/SameName/CMakeLists.txt b/Tests/QtAutogen/SameName/CMakeLists.txt
index c7d6e52..931e40f 100644
--- a/Tests/QtAutogen/SameName/CMakeLists.txt
+++ b/Tests/QtAutogen/SameName/CMakeLists.txt
@@ -28,7 +28,7 @@ set_target_properties(sameName PROPERTIES
)
# Set different compression levels
-if (QT_TEST_VERSION STREQUAL 4)
+if (QT_TEST_VERSION EQUAL 4)
set(rccCompress "-compress")
else()
set(rccCompress "--compress")
diff --git a/Tests/QtAutogen/TestMacros.cmake b/Tests/QtAutogen/TestMacros.cmake
index bc7c7e2..0e27188 100644
--- a/Tests/QtAutogen/TestMacros.cmake
+++ b/Tests/QtAutogen/TestMacros.cmake
@@ -4,6 +4,7 @@ if(NOT _isMultiConfig) # Set in Tests/CMakeLists.txt
list(APPEND Autogen_BUILD_OPTIONS "-DCMAKE_BUILD_TYPE=$<CONFIGURATION>")
endif()
list(APPEND Autogen_BUILD_OPTIONS
+ "-DCMAKE_AUTOGEN_VERBOSE=1"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
)
@@ -49,7 +50,7 @@ if(NON_ASCII_BDIR)
# Qt4 moc does not support utf8 paths in _parameter files generated by
# qtx_wrap_cpp
# https://bugreports.qt.io/browse/QTBUG-35480
- if(QT_TEST_VERSION STREQUAL 4)
+ if(QT_TEST_VERSION EQUAL 4)
set(QT_TEST_ALLOW_QT_MACROS FALSE)
endif()
# On windows qtx_wrap_cpp also fails in Qt5 when used on a path that
diff --git a/Tests/RunCMake/Android/RunCMakeTest.cmake b/Tests/RunCMake/Android/RunCMakeTest.cmake
index 2027c4f..45798ce 100644
--- a/Tests/RunCMake/Android/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Android/RunCMakeTest.cmake
@@ -61,8 +61,12 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK)
list(APPEND _abis_${_version} ${_abis})
endif()
endforeach()
- set(_abis_ ${_abis_${_latest_gcc}})
set(_abis_clang ${_abis_${_latest_clang}})
+ if(_latest_gcc)
+ set(_abis_ ${_abis_${_latest_gcc}})
+ else()
+ set(_abis_ ${_abis_clang})
+ endif()
if(_versions MATCHES "clang")
set(_versions "clang" ${_versions})
endif()
@@ -132,10 +136,11 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK)
set(stl_types
none
system
- gnustl_static
- gnustl_shared
)
+ if(IS_DIRECTORY "${ndk}/sources/cxx-stl/gnu-libstdc++")
+ list(APPEND stl_types gnustl_static gnustl_shared)
+ endif()
if(IS_DIRECTORY "${ndk}/sources/cxx-stl/gabi++/libs")
list(APPEND stl_types gabi++_static gabi++_shared)
endif()
diff --git a/Tests/RunCMake/Android/common.cmake b/Tests/RunCMake/Android/common.cmake
index f931be1..aaa7c89 100644
--- a/Tests/RunCMake/Android/common.cmake
+++ b/Tests/RunCMake/Android/common.cmake
@@ -8,7 +8,6 @@ endif()
foreach(f
"${CMAKE_C_ANDROID_TOOLCHAIN_PREFIX}gcc${CMAKE_C_ANDROID_TOOLCHAIN_SUFFIX}"
"${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}g++${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}"
- "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}cpp${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}"
"${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}ar${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}"
"${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}ld${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}"
)
@@ -61,10 +60,12 @@ execute_process(
if(NOT _res EQUAL 0)
message(SEND_ERROR "Failed to run 'gcc -dumpmachine':\n ${_res}")
endif()
-if(NOT _out STREQUAL "${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}")
+string(REPLACE "--" "-" _out_check "${_out}")
+if(NOT _out_check STREQUAL "${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}"
+ AND NOT (_out STREQUAL "arm--linux-android" AND CMAKE_C_ANDROID_TOOLCHAIN_MACHINE STREQUAL "arm-linux-androideabi"))
message(SEND_ERROR "'gcc -dumpmachine' produced:\n"
" ${_out}\n"
- "which is not equal to CMAKE_C_ANDROID_TOOLCHAIN_MACHINE:\n"
+ "which does not match CMAKE_C_ANDROID_TOOLCHAIN_MACHINE:\n"
" ${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}"
)
endif()
diff --git a/Tests/RunCMake/AndroidMK/AndroidMK.cmake b/Tests/RunCMake/AndroidMK/AndroidMK.cmake
index 3fbb2cf..9137f2b 100644
--- a/Tests/RunCMake/AndroidMK/AndroidMK.cmake
+++ b/Tests/RunCMake/AndroidMK/AndroidMK.cmake
@@ -5,7 +5,9 @@ add_library(car foo.cxx)
add_library(bar bar.c)
add_library(dog foo.cxx)
target_link_libraries(foo PRIVATE car bar dog debug -lm)
-export(TARGETS bar dog car foo ANDROID_MK
+add_library(foo2 foo.cxx)
+target_link_options(foo2 INTERFACE -lm)
+export(TARGETS bar dog car foo foo2 ANDROID_MK
${build_BINARY_DIR}/Android.mk)
-install(TARGETS bar dog car foo DESTINATION lib EXPORT myexp)
+install(TARGETS bar dog car foo foo2 DESTINATION lib EXPORT myexp)
install(EXPORT_ANDROID_MK myexp DESTINATION share/ndk-modules)
diff --git a/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt b/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt
index bbf67a5..a0e5044 100644
--- a/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt
+++ b/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt
@@ -24,3 +24,11 @@ LOCAL_STATIC_LIBRARIES.*car bar dog
LOCAL_EXPORT_LDLIBS := -lm
LOCAL_HAS_CPP := true
include.*PREBUILT_STATIC_LIBRARY.*
+.*
+include.*CLEAR_VARS.*
+LOCAL_MODULE.*foo2
+LOCAL_SRC_FILES.*.*foo2.*
+LOCAL_CPP_FEATURES.*rtti exceptions
+LOCAL_EXPORT_LDFLAGS := -lm
+LOCAL_HAS_CPP := true
+include.*PREBUILT_STATIC_LIBRARY.*
diff --git a/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt b/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt
index 3515fb9..28b1c21 100644
--- a/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt
+++ b/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt
@@ -26,3 +26,11 @@ LOCAL_STATIC_LIBRARIES.*car bar dog
LOCAL_EXPORT_LDLIBS := -lm
LOCAL_HAS_CPP := true
include.*PREBUILT_STATIC_LIBRARY.*
+
+include.*CLEAR_VARS.*
+LOCAL_MODULE.*foo2
+LOCAL_SRC_FILES.*_IMPORT_PREFIX\)/lib.*foo2.*
+LOCAL_CPP_FEATURES.*rtti exceptions
+LOCAL_EXPORT_LDFLAGS := -lm
+LOCAL_HAS_CPP := true
+include.*PREBUILT_STATIC_LIBRARY.*
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 637c5c2..c6c90d0 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -154,6 +154,9 @@ add_RunCMake_test(FPHSA)
add_RunCMake_test(FindBoost)
add_RunCMake_test(FindLua)
add_RunCMake_test(FindOpenGL)
+if(CMake_TEST_UseSWIG)
+ add_RunCMake_test(UseSWIG)
+endif()
if(NOT CMAKE_C_COMPILER_ID MATCHES "Watcom")
add_RunCMake_test(GenerateExportHeader)
endif()
@@ -238,7 +241,9 @@ add_RunCMake_test(include)
add_RunCMake_test(include_directories)
add_RunCMake_test(include_guard)
add_RunCMake_test(list)
+add_RunCMake_test(math)
add_RunCMake_test(message)
+add_RunCMake_test(option)
add_RunCMake_test(project -DCMake_TEST_RESOURCES=${CMake_TEST_RESOURCES})
add_RunCMake_test(project_injected)
add_RunCMake_test(return)
@@ -333,6 +338,8 @@ endif()
add_RunCMake_test(File_Generate)
add_RunCMake_test(ExportWithoutLanguage)
add_RunCMake_test(target_link_libraries)
+add_RunCMake_test(add_link_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID})
+add_RunCMake_test(target_link_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID})
add_RunCMake_test(target_compile_features)
add_RunCMake_test(CheckModules)
@@ -421,7 +428,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
add_RunCMake_test(ctest_labels_for_subprojects)
endif()
-add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ")
+add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;Ext")
# add a test to make sure symbols are exported from a shared library
# for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used
add_RunCMake_test(AutoExportDll)
diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake
index 447b08b..d00ef3b 100644
--- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake
+++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake
@@ -1,10 +1,14 @@
cmake_policy(SET CMP0057 NEW)
-function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACKAGING_TYPE)
+function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACKAGING_TYPE package_target)
if(TEST_TYPE IN_LIST types)
set(RunCMake_TEST_NO_CLEAN TRUE)
- set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build")
- set(full_test_name_ "${TEST_NAME}")
+ if(package_target)
+ set(full_test_name_ "${TEST_NAME}-package-target")
+ else()
+ set(full_test_name_ "${TEST_NAME}")
+ endif()
+ set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${full_test_name_}-build")
if(SUBTEST_SUFFIX)
set(RunCMake_TEST_BINARY_DIR "${RunCMake_TEST_BINARY_DIR}-${SUBTEST_SUFFIX}-subtest")
@@ -67,9 +71,19 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK
unset(pack_params_)
endif()
+ if(package_target)
+ set(cpack_command_ ${CMAKE_COMMAND} --build "${RunCMake_TEST_BINARY_DIR}" --target package)
+ else()
+ set(cpack_command_ ${CMAKE_CPACK_COMMAND} ${pack_params_})
+ endif()
+
# execute cpack
+ set(SETENV)
+ if(ENVIRONMENT)
+ set(SETENV ${CMAKE_COMMAND} -E env "${ENVIRONMENT}")
+ endif()
execute_process(
- COMMAND ${CMAKE_CPACK_COMMAND} ${pack_params_}
+ COMMAND ${SETENV} ${cpack_command_}
WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}"
RESULT_VARIABLE "result_"
OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt"
@@ -113,18 +127,24 @@ endfunction()
function(run_cpack_test TEST_NAME types build PACKAGING_TYPES)
foreach(packaging_type_ IN LISTS PACKAGING_TYPES)
- run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}")
+ run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}" false)
+ endforeach()
+endfunction()
+
+function(run_cpack_test_package_target TEST_NAME types build PACKAGING_TYPES)
+ foreach(packaging_type_ IN LISTS PACKAGING_TYPES)
+ run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}" true)
endforeach()
endfunction()
function(run_cpack_test_subtests TEST_NAME SUBTEST_SUFFIXES types build PACKAGING_TYPES)
foreach(suffix_ IN LISTS SUBTEST_SUFFIXES)
foreach(packaging_type_ IN LISTS PACKAGING_TYPES)
- run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "${suffix_}" false "${packaging_type_}")
+ run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "${suffix_}" false "${packaging_type_}" false)
endforeach()
endforeach()
endfunction()
function(run_cpack_source_test TEST_NAME types)
- run_cpack_test_common_("${TEST_NAME}" "${types}" false "" true "")
+ run_cpack_test_common_("${TEST_NAME}" "${types}" false "" true "" false)
endfunction()
diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake
index f7c5c84..e01f81d 100644
--- a/Tests/RunCMake/CPack/DEB/Helpers.cmake
+++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake
@@ -1,7 +1,7 @@
set(ALL_FILES_GLOB "*.deb")
function(getPackageContent FILE RESULT_VAR)
- execute_process(COMMAND ${DPKG_EXECUTABLE} -c "${FILE}"
+ execute_process(COMMAND ${CMAKE_COMMAND} -E env TZ=Etc/UTC ${DPKG_EXECUTABLE} -c "${FILE}"
OUTPUT_VARIABLE package_content_
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
diff --git a/Tests/RunCMake/CPack/Ext/Helpers.cmake b/Tests/RunCMake/CPack/Ext/Helpers.cmake
new file mode 100644
index 0000000..2c67e06
--- /dev/null
+++ b/Tests/RunCMake/CPack/Ext/Helpers.cmake
@@ -0,0 +1,31 @@
+function(getPackageNameGlobexpr NAME COMPONENT VERSION REVISION FILE_NO RESULT_VAR)
+ set(${RESULT_VAR} "${NAME}-${VERSION}-*.json" PARENT_SCOPE)
+endfunction()
+
+function(getPackageContentList FILE RESULT_VAR)
+ set("${RESULT_VAR}" "" PARENT_SCOPE)
+endfunction()
+
+function(toExpectedContentList FILE_NO CONTENT_VAR)
+ set("${CONTENT_VAR}" "" PARENT_SCOPE)
+endfunction()
+
+set(ALL_FILES_GLOB "*.json")
+
+function(check_ext_json EXPECTED_FILE ACTUAL_FILE)
+ file(READ "${EXPECTED_FILE}" _expected_regex)
+ file(READ "${ACTUAL_FILE}" _actual_contents)
+
+ string(REGEX REPLACE "\n+$" "" _expected_regex "${_expected_regex}")
+ string(REGEX REPLACE "\n+$" "" _actual_contents "${_actual_contents}")
+
+ if(NOT "${_actual_contents}" MATCHES "${_expected_regex}")
+ message(FATAL_ERROR
+ "Output JSON does not match expected regex.\n"
+ "Expected regex:\n"
+ "${_expected_regex}\n"
+ "Actual output:\n"
+ "${_actual_contents}\n"
+ )
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/CPack/Ext/Prerequirements.cmake b/Tests/RunCMake/CPack/Ext/Prerequirements.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/CPack/Ext/Prerequirements.cmake
diff --git a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt
index 4a0e4e6..f02f9d6 100644
--- a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt
+++ b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt
@@ -1 +1 @@
-^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$
+^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*(-package-target)?-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index 4b7f146..91fed3e 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -18,7 +18,8 @@ run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB" true "COMPONENT")
run_cpack_test(INSTALL_SCRIPTS "RPM" false "COMPONENT")
run_cpack_test(LONG_FILENAMES "DEB" false "MONOLITHIC")
run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM" false "COMPONENT")
-run_cpack_test(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ" false "MONOLITHIC;COMPONENT")
+run_cpack_test(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;Ext" false "MONOLITHIC;COMPONENT")
+run_cpack_test_package_target(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;Ext" false "MONOLITHIC;COMPONENT")
run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512" "TGZ" false "MONOLITHIC")
run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false "COMPONENT")
run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false "COMPONENT")
@@ -27,7 +28,11 @@ run_cpack_test(EXTRA_SLASH_IN_PATH "RPM" true "COMPONENT")
run_cpack_source_test(SOURCE_PACKAGE "RPM")
run_cpack_test(SUGGESTS "RPM" false "MONOLITHIC")
run_cpack_test(SYMLINKS "RPM;TGZ" false "MONOLITHIC;COMPONENT")
+set(ENVIRONMENT "SOURCE_DATE_EPOCH=123456789")
+run_cpack_test(TIMESTAMPS "DEB;TGZ" false "COMPONENT")
+unset(ENVIRONMENT)
run_cpack_test(USER_FILELIST "RPM" false "MONOLITHIC")
run_cpack_test(MD5SUMS "DEB" false "MONOLITHIC;COMPONENT")
run_cpack_test(CPACK_INSTALL_SCRIPT "ZIP" false "MONOLITHIC")
run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB" false "MONOLITHIC;COMPONENT")
+run_cpack_test_subtests(EXT "none;good;good_multi;bad_major;bad_minor;invalid_good;invalid_bad;stage_and_package" "Ext" false "MONOLITHIC;COMPONENT")
diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake
index 1f5ab87..af12d37 100644
--- a/Tests/RunCMake/CPack/VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/VerifyResult.cmake
@@ -56,8 +56,12 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0)
set(EXPECTED_FILE_CONTENT_${file_no_} "${EXPECTED_FILE_CONTENT_${file_no_}_LIST}")
toExpectedContentList("${file_no_}" "EXPECTED_FILE_CONTENT_${file_no_}")
- list(SORT PACKAGE_CONTENT)
- list(SORT EXPECTED_FILE_CONTENT_${file_no_})
+ if(NOT PACKAGE_CONTENT STREQUAL "")
+ list(SORT PACKAGE_CONTENT)
+ endif()
+ if(NOT EXPECTED_FILE_CONTENT_${file_no_} STREQUAL "")
+ list(SORT EXPECTED_FILE_CONTENT_${file_no_})
+ endif()
if(PACKAGE_CONTENT STREQUAL EXPECTED_FILE_CONTENT_${file_no_})
set(expected_content_list TRUE)
diff --git a/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake
new file mode 100644
index 0000000..91608c9
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake
@@ -0,0 +1,7 @@
+if(RunCMake_SUBTEST_SUFFIX MATCHES "^(none|good(_multi)?|invalid_good)$"
+ OR RunCMake_SUBTEST_SUFFIX STREQUAL "stage_and_package")
+ set(EXPECTED_FILES_COUNT "1")
+ set(EXPECTED_FILE_CONTENT_1_LIST "/share;/share/cpack-test;/share/cpack-test/f1.txt;/share/cpack-test/f2.txt;/share/cpack-test/f3.txt;/share/cpack-test/f4.txt")
+else()
+ set(EXPECTED_FILES_COUNT "0")
+endif()
diff --git a/Tests/RunCMake/CPack/tests/EXT/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/EXT/VerifyResult.cmake
new file mode 100644
index 0000000..97b74f7
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXT/VerifyResult.cmake
@@ -0,0 +1,3 @@
+if(RunCMake_SUBTEST_SUFFIX MATCHES "^(none|good(_multi)?|invalid_good)")
+ check_ext_json("${src_dir}/tests/EXT/expected-json-1.0.txt" "${FOUND_FILE_1}")
+endif()
diff --git a/Tests/RunCMake/CPack/tests/EXT/bad_major-stderr.txt b/Tests/RunCMake/CPack/tests/EXT/bad_major-stderr.txt
new file mode 100644
index 0000000..372c5e4
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXT/bad_major-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at .*/Modules/Internal/CPack/CPackExt\.cmake:[0-9]+ \(message\):
+ Could not find a suitable version in CPACK_EXT_REQUESTED_VERSIONS
+
+
+CPack Error: Error while executing CPackExt\.cmake
+CPack Error: Cannot initialize the generator Ext
diff --git a/Tests/RunCMake/CPack/tests/EXT/bad_minor-stderr.txt b/Tests/RunCMake/CPack/tests/EXT/bad_minor-stderr.txt
new file mode 100644
index 0000000..372c5e4
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXT/bad_minor-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at .*/Modules/Internal/CPack/CPackExt\.cmake:[0-9]+ \(message\):
+ Could not find a suitable version in CPACK_EXT_REQUESTED_VERSIONS
+
+
+CPack Error: Error while executing CPackExt\.cmake
+CPack Error: Cannot initialize the generator Ext
diff --git a/Tests/RunCMake/CPack/tests/EXT/create_package.cmake b/Tests/RunCMake/CPack/tests/EXT/create_package.cmake
new file mode 100644
index 0000000..e308ccb
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXT/create_package.cmake
@@ -0,0 +1,24 @@
+message("This script could run an external packaging tool")
+
+function(expect_variable VAR)
+ if(NOT ${VAR})
+ message(FATAL_ERROR "${VAR} is unexpectedly not set")
+ endif()
+endfunction()
+
+function(expect_file FILE)
+ if(NOT EXISTS "${FILE}")
+ message(FATAL_ERROR "${FILE} is unexpectedly missing")
+ endif()
+endfunction()
+
+expect_variable(CPACK_COMPONENTS_ALL)
+expect_variable(CPACK_TOPLEVEL_DIRECTORY)
+expect_variable(CPACK_TEMPORARY_DIRECTORY)
+expect_variable(CPACK_PACKAGE_DIRECTORY)
+expect_variable(CPACK_PACKAGE_FILE_NAME)
+
+expect_file(${CPACK_TEMPORARY_DIRECTORY}/f1/share/cpack-test/f1.txt)
+expect_file(${CPACK_TEMPORARY_DIRECTORY}/f2/share/cpack-test/f2.txt)
+expect_file(${CPACK_TEMPORARY_DIRECTORY}/f3/share/cpack-test/f3.txt)
+expect_file(${CPACK_TEMPORARY_DIRECTORY}/f4/share/cpack-test/f4.txt)
diff --git a/Tests/RunCMake/CPack/tests/EXT/expected-json-1.0.txt b/Tests/RunCMake/CPack/tests/EXT/expected-json-1.0.txt
new file mode 100644
index 0000000..b96cf0b
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXT/expected-json-1.0.txt
@@ -0,0 +1,176 @@
+^\{
+ "componentGroups" :[ ]
+ \{
+ "f12" :[ ]
+ \{
+ "components" :[ ]
+ \[
+ "f1",
+ "f2"
+ \],
+ "description" : "Component group for files 1 and 2",
+ "displayName" : "Files 1 and 2",
+ "isBold" : false,
+ "isExpandedByDefault" : false,
+ "name" : "f12",
+ "parentGroup" : "f1234",
+ "subgroups" : \[\]
+ \},
+ "f1234" :[ ]
+ \{
+ "components" : \[\],
+ "description" : "Component group for all files",
+ "displayName" : "Files 1-4",
+ "isBold" : false,
+ "isExpandedByDefault" : false,
+ "name" : "f1234",
+ "subgroups" :[ ]
+ \[
+ "f12",
+ "f34"
+ \]
+ \},
+ "f34" :[ ]
+ \{
+ "components" :[ ]
+ \[
+ "f3",
+ "f4"
+ \],
+ "description" : "Component group for files 3 and 4",
+ "displayName" : "Files 3 and 4",
+ "isBold" : false,
+ "isExpandedByDefault" : false,
+ "name" : "f34",
+ "parentGroup" : "f1234",
+ "subgroups" : \[\]
+ \}
+ \},
+ "components" :[ ]
+ \{
+ "f1" :[ ]
+ \{
+ "archiveFile" : "",
+ "dependencies" : \[\],
+ "description" : "Component for file 1",
+ "displayName" : "File 1",
+ "group" : "f12",
+ "installationTypes" :[ ]
+ \[
+ "full",
+ "f12"
+ \],
+ "isDisabledByDefault" : false,
+ "isDownloaded" : false,
+ "isHidden" : false,
+ "isRequired" : false,
+ "name" : "f1"
+ \},
+ "f2" :[ ]
+ \{
+ "archiveFile" : "",
+ "dependencies" :[ ]
+ \[
+ "f1"
+ \],
+ "description" : "Component for file 2",
+ "displayName" : "File 2",
+ "group" : "f12",
+ "installationTypes" :[ ]
+ \[
+ "full",
+ "f12"
+ \],
+ "isDisabledByDefault" : false,
+ "isDownloaded" : false,
+ "isHidden" : false,
+ "isRequired" : false,
+ "name" : "f2"
+ \},
+ "f3" :[ ]
+ \{
+ "archiveFile" : "",
+ "dependencies" :[ ]
+ \[
+ "f1",
+ "f2"
+ \],
+ "description" : "Component for file 3",
+ "displayName" : "File 3",
+ "group" : "f34",
+ "installationTypes" :[ ]
+ \[
+ "full"
+ \],
+ "isDisabledByDefault" : false,
+ "isDownloaded" : false,
+ "isHidden" : false,
+ "isRequired" : false,
+ "name" : "f3"
+ \},
+ "f4" :[ ]
+ \{
+ "archiveFile" : "",
+ "dependencies" :[ ]
+ \[
+ "f2",
+ "f3",
+ "f1"
+ \],
+ "description" : "Component for file 4",
+ "displayName" : "File 4",
+ "group" : "f34",
+ "installationTypes" :[ ]
+ \[
+ "full"
+ \],
+ "isDisabledByDefault" : false,
+ "isDownloaded" : false,
+ "isHidden" : false,
+ "isRequired" : false,
+ "name" : "f4"
+ \}
+ \},
+ "errorOnAbsoluteInstallDestination" : false,
+ "formatVersionMajor" : 1,
+ "formatVersionMinor" : 0,
+ "installationTypes" :[ ]
+ \{
+ "f12" :[ ]
+ \{
+ "displayName" : "Only files 1 and 2",
+ "index" : 2,
+ "name" : "f12"
+ \},
+ "full" :[ ]
+ \{
+ "displayName" : "Full installation",
+ "index" : 1,
+ "name" : "full"
+ \}
+ \},
+ "packageDescriptionFile" : ".*/Templates/CPack\.GenericDescription\.txt",
+ "packageDescriptionSummary" : "EXT-(none|good(_multi)?|invalid_good)-subtest-(MONOLITHIC|COMPONENT)-type built using CMake",
+ "packageName" : "ext",
+ "packageVersion" : "0\.1\.1",
+ "projects" :[ ]
+ \[
+ \{
+ "component" : "ALL",
+ "components" :[ ]
+ \[
+ "f1",
+ "f2",
+ "f3",
+ "f4"
+ \],
+ "directory" : ".*/Tests/RunCMake/Ext/CPack/EXT-build-(none|good(_multi)?|invalid_good)-subtest",
+ "installationTypes" : \[\],
+ "projectName" : "EXT-(none|good(_multi)?|invalid_good)-subtest-(MONOLITHIC|COMPONENT)-type",
+ "subDirectory" : "/"
+ \}
+ \],
+ "setDestdir" : false,
+ "stripFiles" : false,
+ "warnOnAbsoluteInstallDestination" : false
+\}$
diff --git a/Tests/RunCMake/CPack/tests/EXT/invalid_bad-stderr.txt b/Tests/RunCMake/CPack/tests/EXT/invalid_bad-stderr.txt
new file mode 100644
index 0000000..372c5e4
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXT/invalid_bad-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at .*/Modules/Internal/CPack/CPackExt\.cmake:[0-9]+ \(message\):
+ Could not find a suitable version in CPACK_EXT_REQUESTED_VERSIONS
+
+
+CPack Error: Error while executing CPackExt\.cmake
+CPack Error: Cannot initialize the generator Ext
diff --git a/Tests/RunCMake/CPack/tests/EXT/stage_and_package-stderr.txt b/Tests/RunCMake/CPack/tests/EXT/stage_and_package-stderr.txt
new file mode 100644
index 0000000..40f2743
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXT/stage_and_package-stderr.txt
@@ -0,0 +1 @@
+^This script could run an external packaging tool$
diff --git a/Tests/RunCMake/CPack/tests/EXT/test.cmake b/Tests/RunCMake/CPack/tests/EXT/test.cmake
new file mode 100644
index 0000000..976cb6a
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXT/test.cmake
@@ -0,0 +1,86 @@
+include(CPackComponent)
+
+if(RunCMake_SUBTEST_SUFFIX STREQUAL "none")
+ unset(CPACK_EXT_REQUESTED_VERSIONS)
+elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "good")
+ set(CPACK_EXT_REQUESTED_VERSIONS "1.0")
+elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "good_multi")
+ set(CPACK_EXT_REQUESTED_VERSIONS "1.0;2.0")
+elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "bad_major")
+ set(CPACK_EXT_REQUESTED_VERSIONS "2.0")
+elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "bad_minor")
+ set(CPACK_EXT_REQUESTED_VERSIONS "1.1")
+elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_good")
+ set(CPACK_EXT_REQUESTED_VERSIONS "1;1.0")
+elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_bad")
+ set(CPACK_EXT_REQUESTED_VERSIONS "1")
+elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "stage_and_package")
+ set(CPACK_EXT_ENABLE_STAGING 1)
+ set(CPACK_EXT_PACKAGE_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/create_package.cmake")
+endif()
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f1.txt" test1)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f2.txt" test2)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f3.txt" test3)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f4.txt" test4)
+
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f1.txt" DESTINATION share/cpack-test COMPONENT f1)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f2.txt" DESTINATION share/cpack-test COMPONENT f2)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f3.txt" DESTINATION share/cpack-test COMPONENT f3)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f4.txt" DESTINATION share/cpack-test COMPONENT f4)
+
+cpack_add_component(f1
+ DISPLAY_NAME "File 1"
+ DESCRIPTION "Component for file 1"
+ GROUP f12
+ INSTALL_TYPES full f12
+)
+
+cpack_add_component(f2
+ DISPLAY_NAME "File 2"
+ DESCRIPTION "Component for file 2"
+ GROUP f12
+ DEPENDS f1
+ INSTALL_TYPES full f12
+)
+
+cpack_add_component(f3
+ DISPLAY_NAME "File 3"
+ DESCRIPTION "Component for file 3"
+ GROUP f34
+ DEPENDS f1 f2
+ INSTALL_TYPES full
+)
+
+cpack_add_component(f4
+ DISPLAY_NAME "File 4"
+ DESCRIPTION "Component for file 4"
+ GROUP f34
+ DEPENDS f2 f3 f1
+ INSTALL_TYPES full
+)
+
+cpack_add_component_group(f12
+ DISPLAY_NAME "Files 1 and 2"
+ DESCRIPTION "Component group for files 1 and 2"
+ PARENT_GROUP f1234
+)
+
+cpack_add_component_group(f34
+ DISPLAY_NAME "Files 3 and 4"
+ DESCRIPTION "Component group for files 3 and 4"
+ PARENT_GROUP f1234
+)
+
+cpack_add_component_group(f1234
+ DISPLAY_NAME "Files 1-4"
+ DESCRIPTION "Component group for all files"
+)
+
+cpack_add_install_type(full
+ DISPLAY_NAME "Full installation"
+)
+
+cpack_add_install_type(f12
+ DISPLAY_NAME "Only files 1 and 2"
+)
diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake
index 18ef63c..b4bdb61 100644
--- a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake
@@ -1,7 +1,7 @@
function(checkPackageInfo_ TYPE FILE REGEX)
getPackageInfo("${FILE}" "FILE_INFO_")
if(NOT FILE_INFO_ MATCHES "${REGEX}")
- message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}'; file info: '${FILE_INFO_}'")
+ message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}'; file info: '${FILE_INFO_}'; does not match '${REGEX}'")
endif()
endfunction()
@@ -24,3 +24,15 @@ checkPackageInfo_("name" "${FOUND_FILE_3}" ".*${name_}${whitespaces_}:${whitespa
checkPackageInfo_("group" "${FOUND_FILE_1}" ".*${group_}${whitespaces_}:${whitespaces_}default")
checkPackageInfo_("group" "${FOUND_FILE_2}" ".*${group_}${whitespaces_}:${whitespaces_}second_group")
checkPackageInfo_("group" "${FOUND_FILE_3}" ".*${group_}${whitespaces_}:${whitespaces_}default")
+
+# check package summaries (not available in DEB)
+if(GENERATOR_TYPE STREQUAL "RPM")
+ checkPackageInfo_("summary" "${FOUND_FILE_1}" ".*Summary${whitespaces_}:${whitespaces_}Global summary")
+ checkPackageInfo_("summary" "${FOUND_FILE_2}" ".*Summary${whitespaces_}:${whitespaces_}Summary for pkg_2")
+ checkPackageInfo_("summary" "${FOUND_FILE_3}" ".*Summary${whitespaces_}:${whitespaces_}Global summary")
+endif()
+
+# check package description
+checkPackageInfo_("description" "${FOUND_FILE_1}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_1")
+checkPackageInfo_("description" "${FOUND_FILE_2}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_2")
+checkPackageInfo_("description" "${FOUND_FILE_3}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_3")
diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake
index 8719c0b..dc61d0a 100644
--- a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake
+++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake
@@ -11,6 +11,13 @@ if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM")
set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PACKAGE_${group_} "default")
set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_2_PACKAGE_NAME "second")
set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_2_PACKAGE_${group_} "second_group")
+
+ set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PACKAGE_SUMMARY "Global summary") # not used for DEB
+ set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_2_PACKAGE_SUMMARY "Summary for pkg_2") # not used for DEB
+
+ set(CPACK_COMPONENT_PKG_1_DESCRIPTION "Description for pkg_1")
+ set(CPACK_COMPONENT_PKG_2_DESCRIPTION "Description for pkg_2")
+ set(CPACK_COMPONENT_PKG_3_DESCRIPTION "Description for pkg_3")
endif()
install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1)
diff --git a/Tests/RunCMake/CPack/tests/TIMESTAMPS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/TIMESTAMPS/ExpectedFiles.cmake
new file mode 100644
index 0000000..d1a3a5f
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/TIMESTAMPS/ExpectedFiles.cmake
@@ -0,0 +1,2 @@
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt")
diff --git a/Tests/RunCMake/CPack/tests/TIMESTAMPS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/TIMESTAMPS/VerifyResult.cmake
new file mode 100644
index 0000000..e7e2645
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/TIMESTAMPS/VerifyResult.cmake
@@ -0,0 +1,58 @@
+macro(getFileMetadata_ FILE RESULT_VAR)
+ if(GENERATOR_TYPE STREQUAL "TGZ")
+ # getPackageContent defined for archives omit the metadata (non-verbose)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E env TZ=Etc/UTC ${CMAKE_COMMAND} -E tar -xtvf ${FILE}
+ OUTPUT_VARIABLE ${RESULT_VAR}
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ else()
+ getPackageContent("${FILE}" ${RESULT_VAR})
+ endif()
+endmacro()
+
+function(checkContentTimestamp FILE REGEX)
+ getFileMetadata_("${FILE}" METADATA_)
+
+ if(NOT METADATA_ MATCHES "${REGEX}")
+ string(REPLACE "\n" "\n " metadata_indented "${METADATA_}")
+ message(FATAL_ERROR
+ "Wrong timestamps in file:\n"
+ " ${FILE}\n"
+ "Expected timestamps to match:\n"
+ " ${REGEX}\n"
+ "Actual timestamps:\n"
+ " ${metadata_indented}")
+ endif()
+endfunction()
+
+function(checkTimestamp FILE_NAME)
+ file(READ ${FILE_NAME} ACTUAL_TIMESTAMP OFFSET 4 LIMIT 4 HEX)
+
+ if(NOT ACTUAL_TIMESTAMP STREQUAL "00000000")
+ message(FATAL_ERROR "${FILE_NAME} contains a timestamp [0x${ACTUAL_TIMESTAMP}]")
+ endif()
+endfunction()
+
+# Expected timestamp is UNIX time 123456789
+if(GENERATOR_TYPE STREQUAL "TGZ")
+ set(EXPECTED_TIMESTAMP "29 Nov +1973")
+ set(EXPECTED_FILES foo/ foo/CMakeLists.txt)
+else()
+ set(EXPECTED_TIMESTAMP "1973-11-29 21:33")
+ set(EXPECTED_FILES ./usr/ ./usr/foo/ ./usr/foo/CMakeLists.txt)
+endif()
+
+set(EXPECTED_METADATA)
+foreach(FILE ${EXPECTED_FILES})
+ list(APPEND EXPECTED_METADATA ".* ${EXPECTED_TIMESTAMP} ${FILE}")
+endforeach()
+list(JOIN EXPECTED_METADATA ".*" EXPECTED_REGEX)
+checkContentTimestamp("${FOUND_FILE_1}" "${EXPECTED_REGEX}")
+
+if(GENERATOR_TYPE STREQUAL "TGZ")
+ checkTimestamp("${FOUND_FILE_1}")
+else()
+ execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${FOUND_FILE_1}")
+ checkTimestamp("data.tar.gz")
+ checkTimestamp("control.tar.gz")
+endif()
diff --git a/Tests/RunCMake/CPack/tests/TIMESTAMPS/test.cmake b/Tests/RunCMake/CPack/tests/TIMESTAMPS/test.cmake
new file mode 100644
index 0000000..a193852
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/TIMESTAMPS/test.cmake
@@ -0,0 +1,3 @@
+install(FILES CMakeLists.txt DESTINATION foo COMPONENT test)
+
+set(CPACK_COMPONENTS_ALL test)
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 3bb2a89..cef2b9b 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.1)
include(RunCMake)
run_cmake_command(NoArgs ${CMAKE_COMMAND})
+run_cmake_command(Wizard ${CMAKE_COMMAND} -i)
run_cmake_command(C-no-arg ${CMAKE_COMMAND} -C)
run_cmake_command(C-no-file ${CMAKE_COMMAND} -C nosuchcachefile.txt)
run_cmake_command(cache-no-file ${CMAKE_COMMAND} nosuchsubdir/CMakeCache.txt)
diff --git a/Tests/RunCMake/list/SORT-TooManyArguments-result.txt b/Tests/RunCMake/CommandLine/Wizard-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/list/SORT-TooManyArguments-result.txt
+++ b/Tests/RunCMake/CommandLine/Wizard-result.txt
diff --git a/Tests/RunCMake/CommandLine/Wizard-stderr.txt b/Tests/RunCMake/CommandLine/Wizard-stderr.txt
new file mode 100644
index 0000000..f757aff
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Wizard-stderr.txt
@@ -0,0 +1 @@
+^The "cmake -i" wizard mode is no longer supported\.
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake
index 1150568..24e7202 100644
--- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake
@@ -1,10 +1,12 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.12)
project(FindPkgConfig_IMPORTED_TARGET C)
find_package(PkgConfig REQUIRED)
pkg_check_modules(NCURSES IMPORTED_TARGET QUIET ncurses)
+message(STATUS "source: ${CMAKE_CURRENT_SOURCE_DIR} bin ${CMAKE_CURRENT_BINARY_DIR}")
+
if (NCURSES_FOUND)
set(tgt PkgConfig::NCURSES)
if (NOT TARGET ${tgt})
@@ -66,6 +68,16 @@ if (NOT TARGET PkgConfig::FakePackage1)
message(FATAL_ERROR "No import target for fake package 1 with prefix path")
endif()
+# find targets in subdir and check their visibility
+add_subdirectory(target_subdir)
+if (TARGET PkgConfig::FakePackage1_dir)
+ message(FATAL_ERROR "imported target PkgConfig::FakePackage1_dir is visible outside it's directory")
+endif()
+
+if (NOT TARGET PkgConfig::FakePackage1_global)
+ message(FATAL_ERROR "imported target PkgConfig::FakePackage1_global is not visible outside it's directory")
+endif()
+
# And now do the same for the NO_CMAKE_ENVIRONMENT_PATH - ENV{CMAKE_PREFIX_PATH}
# combination
unset(CMAKE_PREFIX_PATH)
diff --git a/Tests/RunCMake/FindPkgConfig/target_subdir/CMakeLists.txt b/Tests/RunCMake/FindPkgConfig/target_subdir/CMakeLists.txt
new file mode 100644
index 0000000..2171ef6
--- /dev/null
+++ b/Tests/RunCMake/FindPkgConfig/target_subdir/CMakeLists.txt
@@ -0,0 +1,5 @@
+# a target with visibility only in this directory
+pkg_check_modules(FakePackage1_dir REQUIRED QUIET IMPORTED_TARGET cmakeinternalfakepackage1)
+
+# the same with global visibility
+pkg_check_modules(FakePackage1_global REQUIRED QUIET IMPORTED_TARGET GLOBAL cmakeinternalfakepackage1)
diff --git a/Tests/RunCMake/LinkStatic/LinkOptionsLib.c b/Tests/RunCMake/LinkStatic/LinkOptionsLib.c
new file mode 100644
index 0000000..9bbd24c
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/LinkOptionsLib.c
@@ -0,0 +1,7 @@
+#if defined(_WIN32)
+__declspec(dllexport)
+#endif
+ int flags_lib(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake b/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake
index 0d29492..d3a8afb 100644
--- a/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake
+++ b/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake
@@ -1,3 +1,30 @@
include(RunCMake)
run_cmake(LINK_SEARCH_STATIC)
+
+
+macro(run_cmake_target test subtest target)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(${test}-${subtest} ${CMAKE_COMMAND} --build . --target ${target} ${ARGN})
+
+ unset(RunCMake_TEST_BINARY_DIR)
+ unset(RunCMake_TEST_NO_CLEAN)
+endmacro()
+
+if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
+ # Intel compiler does not reject bad flags or objects!
+ set(RunCMake_TEST_OUTPUT_MERGE TRUE)
+ if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release)
+ endif()
+
+ run_cmake(STATIC_LIBRARY_OPTIONS)
+
+ run_cmake_target(STATIC_LIBRARY_OPTIONS basic StaticLinkOptions)
+ run_cmake_target(STATIC_LIBRARY_OPTIONS genex StaticLinkOptions_genex --config Release)
+ run_cmake_target(STATIC_LIBRARY_OPTIONS shared SharedLinkOptions)
+
+ unset(RunCMake_TEST_OPTIONS)
+ unset(RunCMake_TEST_OUTPUT_MERGE)
+endif()
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-check.cmake b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-check.cmake
new file mode 100644
index 0000000..858ce06
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-check.cmake
@@ -0,0 +1,4 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG'.")
+endif()
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-result.txt b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-check.cmake b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-check.cmake
new file mode 100644
index 0000000..a686de9
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-check.cmake
@@ -0,0 +1,7 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_RELEASE")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_RELEASE'.")
+endif()
+if (actual_stdout MATCHES "SHELL:")
+ string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.")
+endif()
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-result.txt b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-check.cmake b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-check.cmake
new file mode 100644
index 0000000..8c1e96e
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-check.cmake
@@ -0,0 +1,4 @@
+
+if (actual_stdout MATCHES "BADFLAG")
+ string (APPEND RunCMake_TEST_FAILED "\nFound unexpected flag 'BADFLAG'.")
+endif()
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-result.txt b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS.cmake b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS.cmake
new file mode 100644
index 0000000..587af1d
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS.cmake
@@ -0,0 +1,21 @@
+
+enable_language(C)
+
+set(obj "${CMAKE_C_OUTPUT_EXTENSION}")
+if(BORLAND)
+ set(pre -)
+endif()
+
+add_library(StaticLinkOptions STATIC LinkOptionsLib.c)
+set_property(TARGET StaticLinkOptions PROPERTY STATIC_LIBRARY_OPTIONS ${pre}BADFLAG${obj})
+
+# static library with generator expression
+add_library(StaticLinkOptions_genex STATIC LinkOptionsLib.c)
+set_property(TARGET StaticLinkOptions_genex PROPERTY STATIC_LIBRARY_OPTIONS
+ $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>
+ "SHELL:" # produces no options
+ )
+
+# shared library do not use property STATIC_LIBRARY_OPTIONS
+add_library(SharedLinkOptions SHARED LinkOptionsLib.c)
+set_property(TARGET SharedLinkOptions PROPERTY STATIC_LIBRARY_OPTIONS ${pre}BADFLAG${obj})
diff --git a/Tests/RunCMake/Ninja/PreventTargetAliasesDupBuildRule.cmake b/Tests/RunCMake/Ninja/PreventTargetAliasesDupBuildRule.cmake
new file mode 100644
index 0000000..da6f86a
--- /dev/null
+++ b/Tests/RunCMake/Ninja/PreventTargetAliasesDupBuildRule.cmake
@@ -0,0 +1,41 @@
+cmake_minimum_required(VERSION 3.12)
+project(Test LANGUAGES C)
+
+# fake launcher executable
+set(input_launcher_executable ${CMAKE_CURRENT_BINARY_DIR}/fake_launcher_executable)
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/fake_launcher_executable "")
+
+# application and executable name
+set(application_target "HelloApp")
+set(application_name "Hello")
+set(executable_name "Hello")
+
+# target built in "<root>/bin"
+add_executable(${application_target} hello.c)
+set_target_properties(${application_target} PROPERTIES
+ OUTPUT_NAME ${executable_name}
+ RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin
+ )
+
+# configured launcher in "<root>"
+set(configured_launcher_executable "${CMAKE_CURRENT_BINARY_DIR}/${application_name}")
+
+# create command to copy the launcher
+add_custom_command(
+ DEPENDS
+ ${input_launcher_executable}
+ OUTPUT
+ ${configured_launcher_executable}
+ COMMAND
+ ${CMAKE_COMMAND} -E copy ${input_launcher_executable} ${configured_launcher_executable}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT
+ "Configuring application launcher: ${application_name}"
+ )
+
+add_custom_target(Configure${application_name}Launcher ALL
+ DEPENDS
+ ${application_target}
+ ${input_launcher_executable}
+ ${configured_launcher_executable}
+ )
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index b6e6cd4..e0ddc9c 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -278,3 +278,10 @@ foreach(ninja_output_path_prefix "sub space" "sub")
run_sub_cmake(SubDirPrefix "${ninja_output_path_prefix}")
run_sub_cmake(CustomCommandWorkingDirectory "${ninja_output_path_prefix}")
endforeach(ninja_output_path_prefix)
+
+function (run_PreventTargetAliasesDupBuildRule)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/PreventTargetAliasesDupBuildRule-build)
+ run_cmake(PreventTargetAliasesDupBuildRule)
+ run_ninja("${RunCMake_TEST_BINARY_DIR}" -w dupbuild=err)
+endfunction ()
+run_PreventTargetAliasesDupBuildRule()
diff --git a/Tests/RunCMake/Syntax/QueryCache-stderr.txt b/Tests/RunCMake/Syntax/QueryCache-stderr.txt
new file mode 100644
index 0000000..db6b2b7
--- /dev/null
+++ b/Tests/RunCMake/Syntax/QueryCache-stderr.txt
@@ -0,0 +1,2 @@
+-->cache value<--
+-->local value<--
diff --git a/Tests/RunCMake/Syntax/QueryCache.cmake b/Tests/RunCMake/Syntax/QueryCache.cmake
new file mode 100644
index 0000000..20c648e
--- /dev/null
+++ b/Tests/RunCMake/Syntax/QueryCache.cmake
@@ -0,0 +1,6 @@
+
+set(query_var "cache value" CACHE STRING "")
+set(query_var "local value")
+
+message("-->$CACHE{query_var}<--")
+message("-->${query_var}<--")
diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
index b8f5fd0..a397620 100644
--- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
@@ -112,6 +112,9 @@ run_cmake(CMP0053-NameWithCarriageReturnQuoted)
run_cmake(CMP0053-NameWithEscapedSpacesQuoted)
run_cmake(CMP0053-NameWithEscapedTabsQuoted)
+# Variable special types
+run_cmake(QueryCache)
+
# Function and macro tests.
run_cmake(FunctionUnmatched)
run_cmake(FunctionUnmatchedForeach)
diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
index 5af6fcd..6c861fa 100644
--- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
+++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
@@ -24,6 +24,7 @@
\* CMP0068
\* CMP0069
\* CMP0073
+ \* CMP0076
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface-result.txt b/Tests/RunCMake/TargetSources/CMP0076-OLD-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInInterface-result.txt
+++ b/Tests/RunCMake/TargetSources/CMP0076-OLD-result.txt
diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface-stderr.txt b/Tests/RunCMake/TargetSources/CMP0076-OLD-stderr.txt
index d47dd4d..d47dd4d 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInInterface-stderr.txt
+++ b/Tests/RunCMake/TargetSources/CMP0076-OLD-stderr.txt
diff --git a/Tests/RunCMake/TargetSources/CMP0076-OLD.cmake b/Tests/RunCMake/TargetSources/CMP0076-OLD.cmake
new file mode 100644
index 0000000..4d8c268
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/CMP0076-OLD.cmake
@@ -0,0 +1,10 @@
+cmake_policy(SET CMP0076 OLD)
+
+add_library(iface INTERFACE)
+target_sources(iface INTERFACE empty_1.cpp)
+
+get_property(iface_sources TARGET iface PROPERTY INTERFACE_SOURCES)
+message(STATUS "iface: ${iface_sources}")
+
+add_executable(main main.cpp)
+target_link_libraries(main iface)
diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN-result.txt b/Tests/RunCMake/TargetSources/CMP0076-WARN-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/CMP0076-WARN-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN-stderr.txt b/Tests/RunCMake/TargetSources/CMP0076-WARN-stderr.txt
new file mode 100644
index 0000000..217c762
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/CMP0076-WARN-stderr.txt
@@ -0,0 +1,21 @@
+CMake Warning \(dev\) at CMP0076-WARN/CMakeLists.txt:2 \(target_sources\):
+ Policy CMP0076 is not set: target_sources\(\) command converts relative paths
+ to absolute. Run "cmake --help-policy CMP0076" for policy details. Use
+ the cmake_policy command to set the policy and suppress this warning.
+
+ An interface source of target "publiclib" has a relative path.
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\) at CMP0076-WARN/CMakeLists.txt:2 \(target_sources\):
+ Policy CMP0076 is not set: target_sources\(\) command converts relative paths
+ to absolute. Run "cmake --help-policy CMP0076" for policy details. Use
+ the cmake_policy command to set the policy and suppress this warning.
+
+ A private source from a directory other than that of target "publiclib" has
+ a relative path.
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Error in CMakeLists.txt:
+ Target "publiclib" contains relative path in its INTERFACE_SOURCES:
+
+ "CMP0076-WARN/subdir_empty_1.cpp"
diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN.cmake b/Tests/RunCMake/TargetSources/CMP0076-WARN.cmake
new file mode 100644
index 0000000..2e07331
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/CMP0076-WARN.cmake
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.12)
+
+add_library(publiclib)
+
+add_subdirectory(CMP0076-WARN)
+
+add_executable(main main.cpp)
+target_link_libraries(main publiclib)
diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN/CMakeLists.txt b/Tests/RunCMake/TargetSources/CMP0076-WARN/CMakeLists.txt
new file mode 100644
index 0000000..f9c7d6d
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/CMP0076-WARN/CMakeLists.txt
@@ -0,0 +1,3 @@
+
+target_sources(publiclib INTERFACE CMP0076-WARN/subdir_empty_1.cpp
+ PRIVATE empty_1.cpp)
diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN/subdir_empty_1.cpp b/Tests/RunCMake/TargetSources/CMP0076-WARN/subdir_empty_1.cpp
new file mode 100644
index 0000000..11ec041
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/CMP0076-WARN/subdir_empty_1.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt
new file mode 100644
index 0000000..4581d8a
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt
@@ -0,0 +1 @@
+-- iface: .*Tests/RunCMake/TargetSources/empty_1.cpp
diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake b/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake
index 8bb6149..0d3e9a4 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake
+++ b/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake
@@ -1,6 +1,10 @@
+cmake_policy(SET CMP0076 NEW)
add_library(iface INTERFACE)
target_sources(iface INTERFACE empty_1.cpp)
+get_property(iface_sources TARGET iface PROPERTY INTERFACE_SOURCES)
+message(STATUS "iface: ${iface_sources}")
+
add_executable(main main.cpp)
target_link_libraries(main iface)
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt
new file mode 100644
index 0000000..7f48082
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt
@@ -0,0 +1 @@
+-- genexlib: \$<1:.*Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp>;\$<1:.*Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/../empty_1.cpp>;\$<1:empty_2.cpp>
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx.cmake b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx.cmake
new file mode 100644
index 0000000..1cdc2a7
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx.cmake
@@ -0,0 +1,10 @@
+cmake_policy(SET CMP0076 NEW)
+
+add_library(genexlib)
+add_subdirectory(RelativePathInSubdirGenEx)
+
+get_property(genexlib_sources TARGET genexlib PROPERTY SOURCES)
+message(STATUS "genexlib: ${genexlib_sources}")
+
+add_executable(genexmain main.cpp)
+target_link_libraries(genexmain genexlib)
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/CMakeLists.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/CMakeLists.txt
new file mode 100644
index 0000000..3bcf454
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/CMakeLists.txt
@@ -0,0 +1,4 @@
+
+target_sources(genexlib PUBLIC $<1:${CMAKE_CURRENT_LIST_DIR}/subdir_empty_1.cpp>
+ $<1:${CMAKE_CURRENT_LIST_DIR}/../empty_1.cpp>
+ PRIVATE $<1:empty_2.cpp>)
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp
new file mode 100644
index 0000000..11ec041
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt
new file mode 100644
index 0000000..aa4851f
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt
@@ -0,0 +1 @@
+-- privatelib: .*Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp;empty_1.cpp
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude.cmake b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude.cmake
new file mode 100644
index 0000000..4acbeca
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude.cmake
@@ -0,0 +1,8 @@
+cmake_policy(SET CMP0076 NEW)
+
+add_library(privatelib)
+
+include("RelativePathInSubdirInclude/CMakeLists.txt")
+
+get_property(privatelib_sources TARGET privatelib PROPERTY SOURCES)
+message(STATUS "privatelib: ${privatelib_sources}")
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/CMakeLists.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/CMakeLists.txt
new file mode 100644
index 0000000..3dcb135
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/CMakeLists.txt
@@ -0,0 +1,3 @@
+
+target_sources(privatelib PRIVATE "${CMAKE_CURRENT_LIST_DIR}/subdir_empty_1.cpp"
+ empty_1.cpp)
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp
new file mode 100644
index 0000000..11ec041
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt
new file mode 100644
index 0000000..5990a05
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt
@@ -0,0 +1 @@
+-- iface: .*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/../empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/../empty_2.cpp
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface.cmake b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface.cmake
new file mode 100644
index 0000000..3652b4f
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface.cmake
@@ -0,0 +1,11 @@
+cmake_policy(SET CMP0076 NEW)
+
+add_library(iface INTERFACE)
+
+add_subdirectory(RelativePathInSubdirInterface)
+
+get_property(iface_sources TARGET iface PROPERTY INTERFACE_SOURCES)
+message(STATUS "iface: ${iface_sources}")
+
+add_executable(main main.cpp)
+target_link_libraries(main iface)
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/CMakeLists.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/CMakeLists.txt
new file mode 100644
index 0000000..02e6966
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/CMakeLists.txt
@@ -0,0 +1,5 @@
+
+target_sources(iface INTERFACE subdir_empty_1.cpp
+ "${CMAKE_CURRENT_LIST_DIR}/subdir_empty_2.cpp"
+ ../empty_1.cpp
+ "${CMAKE_CURRENT_LIST_DIR}/../empty_2.cpp")
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp
new file mode 100644
index 0000000..11ec041
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp
new file mode 100644
index 0000000..11ec041
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt
new file mode 100644
index 0000000..fa5bcbf
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt
@@ -0,0 +1 @@
+-- privatelib: .*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/../empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/../empty_2.cpp
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate.cmake b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate.cmake
new file mode 100644
index 0000000..d0d3dc4
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate.cmake
@@ -0,0 +1,8 @@
+cmake_policy(SET CMP0076 NEW)
+
+add_library(privatelib)
+
+add_subdirectory(RelativePathInSubdirPrivate)
+
+get_property(privatelib_sources TARGET privatelib PROPERTY SOURCES)
+message(STATUS "privatelib: ${privatelib_sources}")
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/CMakeLists.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/CMakeLists.txt
new file mode 100644
index 0000000..56ee853
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/CMakeLists.txt
@@ -0,0 +1,5 @@
+
+target_sources(privatelib PRIVATE subdir_empty_1.cpp
+ "${CMAKE_CURRENT_LIST_DIR}/subdir_empty_2.cpp"
+ ../empty_1.cpp
+ "${CMAKE_CURRENT_LIST_DIR}/../empty_2.cpp")
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp
new file mode 100644
index 0000000..11ec041
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp
new file mode 100644
index 0000000..11ec041
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
index 36d01de..bee8c4e 100644
--- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
+++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
@@ -6,5 +6,11 @@ endif()
run_cmake(OriginDebug)
run_cmake(CMP0026-LOCATION)
+run_cmake(CMP0076-OLD)
+run_cmake(CMP0076-WARN)
run_cmake(RelativePathInInterface)
+run_cmake(RelativePathInSubdirGenEx)
+run_cmake(RelativePathInSubdirInterface)
+run_cmake(RelativePathInSubdirPrivate)
+run_cmake(RelativePathInSubdirInclude)
run_cmake(ExportBuild)
diff --git a/Tests/RunCMake/UseSWIG/CMP0078-NEW-stdout.txt b/Tests/RunCMake/UseSWIG/CMP0078-NEW-stdout.txt
new file mode 100644
index 0000000..d4fa6e4
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/CMP0078-NEW-stdout.txt
@@ -0,0 +1,2 @@
+-- PREFIX='_'
+-- TARGET NAME='example'
diff --git a/Tests/RunCMake/UseSWIG/CMP0078-NEW.cmake b/Tests/RunCMake/UseSWIG/CMP0078-NEW.cmake
new file mode 100644
index 0000000..ce77218
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/CMP0078-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0078 NEW)
+include(CMP0078-common.cmake)
diff --git a/Tests/RunCMake/UseSWIG/CMP0078-OLD-stdout.txt b/Tests/RunCMake/UseSWIG/CMP0078-OLD-stdout.txt
new file mode 100644
index 0000000..62f5371
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/CMP0078-OLD-stdout.txt
@@ -0,0 +1,2 @@
+-- PREFIX=''
+-- TARGET NAME='_example'
diff --git a/Tests/RunCMake/UseSWIG/CMP0078-OLD.cmake b/Tests/RunCMake/UseSWIG/CMP0078-OLD.cmake
new file mode 100644
index 0000000..2c4d142
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/CMP0078-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0078 OLD)
+include(CMP0078-common.cmake)
diff --git a/Tests/RunCMake/UseSWIG/CMP0078-WARN-stderr.txt b/Tests/RunCMake/UseSWIG/CMP0078-WARN-stderr.txt
new file mode 100644
index 0000000..bc8da4c
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/CMP0078-WARN-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at .*/Modules/UseSWIG.cmake:[0-9]+ \(message\):
+ Policy CMP0078 is not set. Run "cmake --help-policy CMP0078" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+Call Stack \(most recent call first\):
+ CMP0078-common.cmake:6 \(swig_add_library\)
+ CMP0078-WARN.cmake:1 \(include\)
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/UseSWIG/CMP0078-WARN-stdout.txt b/Tests/RunCMake/UseSWIG/CMP0078-WARN-stdout.txt
new file mode 100644
index 0000000..62f5371
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/CMP0078-WARN-stdout.txt
@@ -0,0 +1,2 @@
+-- PREFIX=''
+-- TARGET NAME='_example'
diff --git a/Tests/RunCMake/UseSWIG/CMP0078-WARN.cmake b/Tests/RunCMake/UseSWIG/CMP0078-WARN.cmake
new file mode 100644
index 0000000..86b21a5
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/CMP0078-WARN.cmake
@@ -0,0 +1 @@
+include(CMP0078-common.cmake)
diff --git a/Tests/RunCMake/UseSWIG/CMP0078-common.cmake b/Tests/RunCMake/UseSWIG/CMP0078-common.cmake
new file mode 100644
index 0000000..6cf39dc
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/CMP0078-common.cmake
@@ -0,0 +1,10 @@
+
+set(SWIG_EXECUTABLE "swig")
+set(SWIG_DIR "/swig")
+include(UseSWIG)
+
+swig_add_library(example LANGUAGE python TYPE MODULE SOURCES example.i)
+
+get_property(prefix TARGET ${SWIG_MODULE_example_REAL_NAME} PROPERTY PREFIX)
+message(STATUS "PREFIX='${prefix}'")
+message(STATUS "TARGET NAME='${SWIG_MODULE_example_REAL_NAME}'")
diff --git a/Tests/RunCMake/UseSWIG/CMakeLists.txt b/Tests/RunCMake/UseSWIG/CMakeLists.txt
new file mode 100644
index 0000000..d1b0d2c
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.10)
+project(${RunCMake_TEST} C)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake
new file mode 100644
index 0000000..b96622a
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake
@@ -0,0 +1,5 @@
+include(RunCMake)
+
+run_cmake(CMP0078-WARN)
+run_cmake(CMP0078-OLD)
+run_cmake(CMP0078-NEW)
diff --git a/Tests/RunCMake/UseSWIG/example.i b/Tests/RunCMake/UseSWIG/example.i
new file mode 100644
index 0000000..86625aa
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/example.i
@@ -0,0 +1,2 @@
+/* File : example.i */
+%module example
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index 0d178ce..d50de3d 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -7,6 +7,8 @@ run_cmake(VsTargetsFileReferences)
run_cmake(VsCustomProps)
run_cmake(VsDebuggerWorkingDir)
run_cmake(VsDebuggerCommand)
+run_cmake(VsDebuggerCommandArguments)
+run_cmake(VsDebuggerEnvironment)
run_cmake(VsCSharpCustomTags)
run_cmake(VsCSharpReferenceProps)
run_cmake(VsCSharpWithoutSources)
diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake
index 0ded780..440f9f2 100644
--- a/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake
+++ b/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake
@@ -9,7 +9,7 @@ set(debuggerCommandSet FALSE)
file(STRINGS "${vcProjectFile}" lines)
foreach(line IN LISTS lines)
if(line MATCHES "^ *<LocalDebuggerCommand[^>]*>([^<>]+)</LocalDebuggerCommand>$")
- if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command")
+ if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command foo")
message(STATUS "foo.vcxproj has debugger command set")
set(debuggerCommandSet TRUE)
endif()
diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake
index e29adc4..5dcb6d1 100644
--- a/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake
+++ b/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake
@@ -2,4 +2,4 @@ enable_language(CXX)
add_library(foo foo.cpp)
set_target_properties(foo PROPERTIES
- VS_DEBUGGER_COMMAND "my-debugger-command")
+ VS_DEBUGGER_COMMAND "my-debugger-command $<TARGET_PROPERTY:foo,NAME>")
diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake
new file mode 100644
index 0000000..b2e0a43
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake
@@ -0,0 +1,22 @@
+set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
+if(NOT EXISTS "${vcProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
+ return()
+endif()
+
+set(debuggerCommandArgumentsSet FALSE)
+
+file(STRINGS "${vcProjectFile}" lines)
+foreach(line IN LISTS lines)
+ if(line MATCHES "^ *<LocalDebuggerCommandArguments[^>]*>([^<>]+)</LocalDebuggerCommandArguments>$")
+ if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command-arguments foo")
+ message(STATUS "foo.vcxproj has debugger command arguments set")
+ set(debuggerCommandArgumentsSet TRUE)
+ endif()
+ endif()
+endforeach()
+
+if(NOT debuggerCommandArgumentsSet)
+ set(RunCMake_TEST_FAILED "LocalDebuggerCommandArguments not found or not set correctly.")
+ return()
+endif()
diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake
new file mode 100644
index 0000000..aa87cdc
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake
@@ -0,0 +1,5 @@
+enable_language(CXX)
+add_library(foo foo.cpp)
+
+set_target_properties(foo PROPERTIES
+ VS_DEBUGGER_COMMAND_ARGUMENTS "my-debugger-command-arguments $<TARGET_PROPERTY:foo,NAME>")
diff --git a/Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake
new file mode 100644
index 0000000..2427ad4
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake
@@ -0,0 +1,22 @@
+set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
+if(NOT EXISTS "${vcProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
+ return()
+endif()
+
+set(debuggerEnvironmentSet FALSE)
+
+file(STRINGS "${vcProjectFile}" lines)
+foreach(line IN LISTS lines)
+ if(line MATCHES "^ *<LocalDebuggerEnvironment[^>]*>([^<>]+)</LocalDebuggerEnvironment>$")
+ if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-environment foo")
+ message(STATUS "foo.vcxproj has debugger environment set")
+ set(debuggerEnvironmentSet TRUE)
+ endif()
+ endif()
+endforeach()
+
+if(NOT debuggerEnvironmentSet)
+ set(RunCMake_TEST_FAILED "LocalDebuggerEnvironment not found or not set correctly.")
+ return()
+endif()
diff --git a/Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake
new file mode 100644
index 0000000..d5bec4c
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake
@@ -0,0 +1,5 @@
+enable_language(CXX)
+add_library(foo foo.cpp)
+
+set_target_properties(foo PROPERTIES
+ VS_DEBUGGER_ENVIRONMENT "my-debugger-environment $<TARGET_PROPERTY:foo,NAME>")
diff --git a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake
index 637c68c..6a142f8 100644
--- a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake
+++ b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake
@@ -9,7 +9,7 @@ set(debuggerWorkDirSet FALSE)
file(STRINGS "${vcProjectFile}" lines)
foreach(line IN LISTS lines)
if(line MATCHES "^ *<LocalDebuggerWorkingDirectory[^>]*>([^<>]+)</LocalDebuggerWorkingDirectory>$")
- if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-directory")
+ if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-directory foo")
message(STATUS "foo.vcxproj has debugger working dir set")
set(debuggerWorkDirSet TRUE)
endif()
diff --git a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake
index a277c65..36daed0 100644
--- a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake
+++ b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake
@@ -2,4 +2,4 @@ enable_language(CXX)
add_library(foo foo.cpp)
set_target_properties(foo PROPERTIES
- VS_DEBUGGER_WORKING_DIRECTORY "my-debugger-directory")
+ VS_DEBUGGER_WORKING_DIRECTORY "my-debugger-directory $<TARGET_PROPERTY:foo,NAME>")
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index 1150666..fb04005 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -219,6 +219,7 @@ endfunction()
if(NOT XCODE_VERSION VERSION_LESS 7)
XcodeSchemaGeneration()
+ run_cmake(XcodeSchemaProperty)
endif()
if(XCODE_VERSION VERSION_GREATER_EQUAL 8)
diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
new file mode 100644
index 0000000..f675d81
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
@@ -0,0 +1,33 @@
+function(check_property property matcher)
+ set(schema "${RunCMake_TEST_BINARY_DIR}/XcodeSchemaProperty.xcodeproj/xcshareddata/xcschemes/${property}.xcscheme")
+ file(STRINGS ${schema} actual-${property}
+ REGEX "${matcher}" LIMIT_COUNT 1)
+ if(NOT actual-${property})
+ message(SEND_ERROR "Xcode schema property ${property}: Could not find ${matcher} in schema ${schema}")
+ endif()
+endfunction()
+
+check_property("ADDRESS_SANITIZER" "enableAddressSanitizer")
+check_property("ADDRESS_SANITIZER_USE_AFTER_RETURN" "enableASanStackUseAfterReturn")
+check_property("THREAD_SANITIZER" "enableThreadSanitizer")
+check_property("THREAD_SANITIZER_STOP" "stopOnEveryThreadSanitizerIssue")
+check_property("UNDEFINED_BEHAVIOUR_SANITIZER" "enableUBSanitizer")
+check_property("UNDEFINED_BEHAVIOUR_SANITIZER_STOP" "stopOnEveryUBSanitizerIssue")
+check_property("DISABLE_MAIN_THREAD_CHECKER" "disableMainThreadChecker")
+check_property("MAIN_THREAD_CHECKER_STOP" "stopOnEveryMainThreadCheckerIssue")
+
+check_property("MALLOC_SCRIBBLE" "MallocScribble")
+check_property("MALLOC_GUARD_EDGES" "MallocGuardEdges")
+check_property("GUARD_MALLOC" "DYLD_INSERT_LIBRARIES")
+check_property("ZOMBIE_OBJECTS" "NSZombieEnabled")
+check_property("MALLOC_STACK" "MallocStackLogging")
+check_property("DYNAMIC_LINKER_API_USAGE" "DYLD_PRINT_APIS")
+check_property("DYNAMIC_LIBRARY_LOADS" "DYLD_PRINT_LIBRARIES")
+
+check_property("EXECUTABLE" "myExecutable")
+check_property("ARGUMENTS" [=["--foo"]=])
+check_property("ARGUMENTS" [=["--bar=baz"]=])
+check_property("ENVIRONMENT" [=[key="FOO"]=])
+check_property("ENVIRONMENT" [=[value="foo"]=])
+check_property("ENVIRONMENT" [=[key="BAR"]=])
+check_property("ENVIRONMENT" [=[value="bar"]=])
diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
new file mode 100644
index 0000000..2b72a64
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
@@ -0,0 +1,37 @@
+cmake_minimum_required(VERSION 3.7)
+
+set(CMAKE_XCODE_GENERATE_SCHEME ON)
+
+project(XcodeSchemaProperty CXX)
+
+function(create_scheme_for_variable variable)
+ set(CMAKE_XCODE_SCHEME_${variable} ON)
+ add_executable(${variable} main.cpp)
+endfunction()
+
+create_scheme_for_variable(ADDRESS_SANITIZER)
+create_scheme_for_variable(ADDRESS_SANITIZER_USE_AFTER_RETURN)
+create_scheme_for_variable(THREAD_SANITIZER)
+create_scheme_for_variable(THREAD_SANITIZER_STOP)
+create_scheme_for_variable(UNDEFINED_BEHAVIOUR_SANITIZER)
+create_scheme_for_variable(UNDEFINED_BEHAVIOUR_SANITIZER_STOP)
+create_scheme_for_variable(DISABLE_MAIN_THREAD_CHECKER)
+create_scheme_for_variable(MAIN_THREAD_CHECKER_STOP)
+
+create_scheme_for_variable(MALLOC_SCRIBBLE)
+create_scheme_for_variable(MALLOC_GUARD_EDGES)
+create_scheme_for_variable(GUARD_MALLOC)
+create_scheme_for_variable(ZOMBIE_OBJECTS)
+create_scheme_for_variable(MALLOC_STACK)
+create_scheme_for_variable(DYNAMIC_LINKER_API_USAGE)
+create_scheme_for_variable(DYNAMIC_LIBRARY_LOADS)
+
+function(create_scheme_for_property property value)
+ set(XCODE_SCHEME_${property} ON)
+ add_executable(${property} main.cpp)
+ set_target_properties(${property} PROPERTIES XCODE_SCHEME_${property} "${value}")
+endfunction()
+
+create_scheme_for_property(EXECUTABLE myExecutable)
+create_scheme_for_property(ARGUMENTS "--foo;--bar=baz")
+create_scheme_for_property(ENVIRONMENT "FOO=foo;BAR=bar")
diff --git a/Tests/RunCMake/add_link_options/CMakeLists.txt b/Tests/RunCMake/add_link_options/CMakeLists.txt
new file mode 100644
index 0000000..14ef56e
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.11)
+
+project(${RunCMake_TEST} LANGUAGES NONE)
+
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion-build-check.cmake b/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion-build-check.cmake
new file mode 100644
index 0000000..d0ef8de
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion-build-check.cmake
@@ -0,0 +1,2 @@
+
+include ("${CMAKE_CURRENT_LIST_DIR}/LINKER_expansion-validation.cmake")
diff --git a/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion.cmake b/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion.cmake
new file mode 100644
index 0000000..7316ef5
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion.cmake
@@ -0,0 +1,4 @@
+
+set (LINKER_OPTION "LINKER:SHELL:-foo bar")
+
+include ("LINKER_expansion-list.cmake")
diff --git a/Tests/RunCMake/add_link_options/LINKER_expansion-build-check.cmake b/Tests/RunCMake/add_link_options/LINKER_expansion-build-check.cmake
new file mode 100644
index 0000000..d0ef8de
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINKER_expansion-build-check.cmake
@@ -0,0 +1,2 @@
+
+include ("${CMAKE_CURRENT_LIST_DIR}/LINKER_expansion-validation.cmake")
diff --git a/Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake b/Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake
new file mode 100644
index 0000000..34dcc67
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake
@@ -0,0 +1,36 @@
+
+enable_language(C)
+
+add_executable(dump dump.c)
+
+add_link_options("${LINKER_OPTION}")
+
+# ensure no temp file will be used
+string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}")
+string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}")
+
+add_library(example SHARED LinkOptionsLib.c)
+# use LAUNCH facility to dump linker command
+set_property(TARGET example PROPERTY RULE_LAUNCH_LINK "\"${CMAKE_CURRENT_BINARY_DIR}/dump${CMAKE_EXECUTABLE_SUFFIX}\"")
+
+add_dependencies (example dump)
+
+# generate reference for LINKER flag
+if (CMAKE_C_LINKER_WRAPPER_FLAG)
+ set(linker_flag ${CMAKE_C_LINKER_WRAPPER_FLAG})
+ list(GET linker_flag -1 linker_space)
+ if (linker_space STREQUAL " ")
+ list(REMOVE_AT linker_flag -1)
+ else()
+ set(linker_space)
+ endif()
+ list (JOIN linker_flag " " linker_flag)
+ if (CMAKE_C_LINKER_WRAPPER_FLAG_SEP)
+ string (APPEND linker_flag "${linker_space}" "-foo${CMAKE_C_LINKER_WRAPPER_FLAG_SEP}bar")
+ else()
+ set (linker_flag "${linker_flag}${linker_space}-foo ${linker_flag}${linker_space}bar")
+ endif()
+else()
+ set(linker_flag "-foo bar")
+endif()
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LINKER.txt" "${linker_flag}")
diff --git a/Tests/RunCMake/add_link_options/LINKER_expansion-validation.cmake b/Tests/RunCMake/add_link_options/LINKER_expansion-validation.cmake
new file mode 100644
index 0000000..bebd6c7
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINKER_expansion-validation.cmake
@@ -0,0 +1,15 @@
+
+if (actual_stdout MATCHES "(LINKER|SHELL):")
+ set (RunCMake_TEST_FAILED "LINKER: prefix was not expanded.")
+ return()
+endif()
+
+if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/LINKER.txt")
+ set (RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/LINKER.txt: Reference file not found.")
+ return()
+endif()
+file(READ "${RunCMake_TEST_BINARY_DIR}/LINKER.txt" linker_flag)
+
+if (NOT actual_stdout MATCHES "${linker_flag}")
+ set (RunCMake_TEST_FAILED "LINKER: was not expanded correctly.")
+endif()
diff --git a/Tests/RunCMake/add_link_options/LINKER_expansion.cmake b/Tests/RunCMake/add_link_options/LINKER_expansion.cmake
new file mode 100644
index 0000000..42b286d
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINKER_expansion.cmake
@@ -0,0 +1,4 @@
+
+set (LINKER_OPTION "LINKER:-foo,bar")
+
+include ("LINKER_expansion-list.cmake")
diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-check.cmake b/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-check.cmake
new file mode 100644
index 0000000..4a22d7e
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-check.cmake
@@ -0,0 +1,7 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_EXECUTABLE_RELEASE")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_EXECUTABLE_RELEASE'.")
+endif()
+if (actual_stdout MATCHES "BADFLAG_(SHARED|MODULE)_RELEASE")
+ set (RunCMake_TEST_FAILED "Found unexpected 'BADFLAG_(SHARED|MODULE)_RELEASE'.")
+endif()
diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-result.txt b/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-check.cmake b/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-check.cmake
new file mode 100644
index 0000000..d695761
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-check.cmake
@@ -0,0 +1,7 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_MODULE_RELEASE")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_MODULE_RELEASE'.")
+endif()
+if (actual_stdout MATCHES "BADFLAG_(SHARED|EXECUTABLE)_RELEASE")
+ set (RunCMake_TEST_FAILED "Found unexpected 'BADFLAG_(SHARED|EXECUTABLE)_RELEASE'.")
+endif()
diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-result.txt b/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-check.cmake b/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-check.cmake
new file mode 100644
index 0000000..eaac8e3
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-check.cmake
@@ -0,0 +1,7 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_SHARED_RELEASE")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_SHARED_RELEASE'.")
+endif()
+if (actual_stdout MATCHES "BADFLAG_(MODULE|EXECUTABLE)_RELEASE")
+ set (RunCMake_TEST_FAILED "Found unexpected 'BADFLAG_(MODULE|EXECUTABLE)_RELEASE'.")
+endif()
diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-result.txt b/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS.cmake b/Tests/RunCMake/add_link_options/LINK_OPTIONS.cmake
new file mode 100644
index 0000000..802ff4f
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS.cmake
@@ -0,0 +1,17 @@
+
+enable_language(C)
+
+set(obj "${CMAKE_C_OUTPUT_EXTENSION}")
+if(BORLAND)
+ set(pre -)
+endif()
+
+add_link_options($<$<AND:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>,$<CONFIG:Release>>:${pre}BADFLAG_SHARED_RELEASE${obj}>)
+add_link_options($<$<AND:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>,$<CONFIG:Release>>:${pre}BADFLAG_MODULE_RELEASE${obj}>)
+add_link_options($<$<AND:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>,$<CONFIG:Release>>:${pre}BADFLAG_EXECUTABLE_RELEASE${obj}>)
+
+add_library(LinkOptions_shared SHARED LinkOptionsLib.c)
+
+add_library(LinkOptions_mod MODULE LinkOptionsLib.c)
+
+add_executable(LinkOptions_exe LinkOptionsExe.c)
diff --git a/Tests/RunCMake/add_link_options/LinkOptionsExe.c b/Tests/RunCMake/add_link_options/LinkOptionsExe.c
new file mode 100644
index 0000000..8488f4e
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LinkOptionsExe.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/add_link_options/LinkOptionsLib.c b/Tests/RunCMake/add_link_options/LinkOptionsLib.c
new file mode 100644
index 0000000..9bbd24c
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LinkOptionsLib.c
@@ -0,0 +1,7 @@
+#if defined(_WIN32)
+__declspec(dllexport)
+#endif
+ int flags_lib(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/add_link_options/RunCMakeTest.cmake b/Tests/RunCMake/add_link_options/RunCMakeTest.cmake
new file mode 100644
index 0000000..4f5df72
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/RunCMakeTest.cmake
@@ -0,0 +1,38 @@
+
+include(RunCMake)
+
+macro(run_cmake_target test subtest target)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(${test}-${subtest} ${CMAKE_COMMAND} --build . --target ${target} ${ARGN})
+
+ unset(RunCMake_TEST_BINARY_DIR)
+ unset(RunCMake_TEST_NO_CLEAN)
+endmacro()
+
+if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
+ # Intel compiler does not reject bad flags or objects!
+ set(RunCMake_TEST_OUTPUT_MERGE TRUE)
+ if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release)
+ endif()
+
+ run_cmake(LINK_OPTIONS)
+
+ run_cmake_target(LINK_OPTIONS shared LinkOptions_shared --config Release)
+ run_cmake_target(LINK_OPTIONS mod LinkOptions_mod --config Release)
+ run_cmake_target(LINK_OPTIONS exe LinkOptions_exe --config Release)
+
+ unset(RunCMake_TEST_OPTIONS)
+ unset(RunCMake_TEST_OUTPUT_MERGE)
+endif()
+
+run_cmake(bad_SHELL_usage)
+
+if(RunCMake_GENERATOR MATCHES "(Ninja|Makefile)")
+ run_cmake(LINKER_expansion)
+ run_cmake_target(LINKER_expansion build all)
+
+ run_cmake(LINKER_SHELL_expansion)
+ run_cmake_target(LINKER_SHELL_expansion build all)
+endif()
diff --git a/Tests/RunCMake/add_link_options/bad_SHELL_usage-result.txt b/Tests/RunCMake/add_link_options/bad_SHELL_usage-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/bad_SHELL_usage-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/add_link_options/bad_SHELL_usage-stderr.txt b/Tests/RunCMake/add_link_options/bad_SHELL_usage-stderr.txt
new file mode 100644
index 0000000..02d09f3
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/bad_SHELL_usage-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at bad_SHELL_usage.cmake:6 \(add_library\):
+ 'SHELL:' prefix is not supported as part of 'LINKER:' arguments.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:5 \(include\)
diff --git a/Tests/RunCMake/add_link_options/bad_SHELL_usage.cmake b/Tests/RunCMake/add_link_options/bad_SHELL_usage.cmake
new file mode 100644
index 0000000..324893d
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/bad_SHELL_usage.cmake
@@ -0,0 +1,6 @@
+
+enable_language(C)
+
+add_link_options("LINKER:-foo,SHELL:-bar")
+
+add_library(example SHARED LinkOptionsLib.c)
diff --git a/Tests/RunCMake/add_link_options/dump.c b/Tests/RunCMake/add_link_options/dump.c
new file mode 100644
index 0000000..8baa313
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/dump.c
@@ -0,0 +1,13 @@
+
+#include "stdio.h"
+
+int main(int argc, char* argv[])
+{
+ int i;
+
+ for (i = 1; i < argc; i++)
+ printf("%s ", argv[i]);
+ printf("\n");
+
+ return 0;
+}
diff --git a/Tests/RunCMake/ctest_memcheck/DummyAddressLeakSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyAddressLeakSanitizer-result.txt
deleted file mode 100644
index b57e2de..0000000
--- a/Tests/RunCMake/ctest_memcheck/DummyAddressLeakSanitizer-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-(-1|255)
diff --git a/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-result.txt
deleted file mode 100644
index b57e2de..0000000
--- a/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-(-1|255)
diff --git a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt
deleted file mode 100644
index b57e2de..0000000
--- a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-(-1|255)
diff --git a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-result.txt b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-result.txt
deleted file mode 100644
index b57e2de..0000000
--- a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-(-1|255)
diff --git a/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt
deleted file mode 100644
index b57e2de..0000000
--- a/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-(-1|255)
diff --git a/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt b/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt
deleted file mode 100644
index b57e2de..0000000
--- a/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-(-1|255)
diff --git a/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt
deleted file mode 100644
index b57e2de..0000000
--- a/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-(-1|255)
diff --git a/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt
deleted file mode 100644
index b57e2de..0000000
--- a/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-(-1|255)
diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-result.txt
deleted file mode 100644
index b57e2de..0000000
--- a/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-(-1|255)
diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt
deleted file mode 100644
index b57e2de..0000000
--- a/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-(-1|255)
diff --git a/Tests/RunCMake/export/ExportPropertiesUndefined.cmake b/Tests/RunCMake/export/ExportPropertiesUndefined.cmake
new file mode 100644
index 0000000..aa529f2
--- /dev/null
+++ b/Tests/RunCMake/export/ExportPropertiesUndefined.cmake
@@ -0,0 +1,11 @@
+enable_language(CXX)
+add_library(foo empty.cpp)
+set_target_properties(foo PROPERTIES
+ EXPORT_PROPERTIES "NotDefinedProp"
+)
+export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake")
+install(TARGETS foo EXPORT fooExport
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake
index 10ced90..46bb1fc 100644
--- a/Tests/RunCMake/export/RunCMakeTest.cmake
+++ b/Tests/RunCMake/export/RunCMakeTest.cmake
@@ -8,3 +8,4 @@ run_cmake(NoExportSet)
run_cmake(ForbiddenToExportInterfaceProperties)
run_cmake(ForbiddenToExportImportedProperties)
run_cmake(ForbiddenToExportPropertyWithGenExp)
+run_cmake(ExportPropertiesUndefined)
diff --git a/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt b/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt
new file mode 100644
index 0000000..cb3c99f
--- /dev/null
+++ b/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt
@@ -0,0 +1,6 @@
+-- PROG_ABS='PROG_ABS-NOTFOUND'
+-- PROG_ABS_NPD='PROG_ABS_NPD-NOTFOUND'
+-- PROG_CWD='PROG_CWD-NOTFOUND'
+-- PROG_CWD_NPD='PROG_CWD_NPD-NOTFOUND'
+-- PROG_CWD_DOT='[^']*/Tests/RunCMake/find_program/testCWD'
+-- PROG_CWD_DOT_NPD='[^']*/Tests/RunCMake/find_program/testCWD'
diff --git a/Tests/RunCMake/find_program/RelAndAbsPath.cmake b/Tests/RunCMake/find_program/RelAndAbsPath.cmake
new file mode 100644
index 0000000..9a42c5e
--- /dev/null
+++ b/Tests/RunCMake/find_program/RelAndAbsPath.cmake
@@ -0,0 +1,63 @@
+# testNoSuchFile should only be found if the file absolute path is
+# incorrectly prepended with the search path.
+
+function(strip_windows_path_prefix p outvar)
+ if(CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
+ string(REGEX REPLACE "^.:" "" p "${p}")
+ endif()
+ set(${outvar} "${p}" PARENT_SCOPE)
+endfunction()
+
+strip_windows_path_prefix("${CMAKE_CURRENT_SOURCE_DIR}" srcdir)
+
+file(MAKE_DIRECTORY "tmp${srcdir}")
+configure_file(testCWD "tmp${srcdir}/testNoSuchFile" COPYONLY)
+
+find_program(PROG_ABS
+ NAMES "${srcdir}/testNoSuchFile"
+ PATHS "${CMAKE_CURRENT_BINARY_DIR}/tmp"
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG_ABS='${PROG_ABS}'")
+
+find_program(PROG_ABS_NPD
+ NAMES "${srcdir}/testNoSuchFile"
+ PATHS "${CMAKE_CURRENT_BINARY_DIR}/tmp"
+ NAMES_PER_DIR
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG_ABS_NPD='${PROG_ABS_NPD}'")
+
+# ./testCWD should not be found without '.' being in the path list.
+
+configure_file(testCWD testCWD COPYONLY)
+
+find_program(PROG_CWD
+ NAMES testCWD
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG_CWD='${PROG_CWD}'")
+
+find_program(PROG_CWD_NPD
+ NAMES testCWD
+ NAMES_PER_DIR
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG_CWD_NPD='${PROG_CWD_NPD}'")
+
+# Confirm that adding '.' to path does locate ./testCWD.
+
+find_program(PROG_CWD_DOT
+ NAMES testCWD
+ PATHS .
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG_CWD_DOT='${PROG_CWD_DOT}'")
+
+find_program(PROG_CWD_DOT_NPD
+ NAMES testCWD
+ PATHS .
+ NAMES_PER_DIR
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG_CWD_DOT_NPD='${PROG_CWD_DOT_NPD}'")
diff --git a/Tests/RunCMake/find_program/RunCMakeTest.cmake b/Tests/RunCMake/find_program/RunCMakeTest.cmake
index 89307c1..6903f05 100644
--- a/Tests/RunCMake/find_program/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_program/RunCMakeTest.cmake
@@ -3,6 +3,7 @@ include(RunCMake)
run_cmake(EnvAndHints)
run_cmake(DirsPerName)
run_cmake(NamesPerDir)
+run_cmake(RelAndAbsPath)
if(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN)$")
run_cmake(WindowsCom)
diff --git a/Tests/RunCMake/find_program/testCWD b/Tests/RunCMake/find_program/testCWD
new file mode 100755
index 0000000..1a24852
--- /dev/null
+++ b/Tests/RunCMake/find_program/testCWD
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/Tests/RunCMake/install/CODE-genex-bad-result.txt b/Tests/RunCMake/install/CODE-genex-bad-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/CODE-genex-bad-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/CODE-genex-bad-stderr.txt b/Tests/RunCMake/install/CODE-genex-bad-stderr.txt
new file mode 100644
index 0000000..9844158
--- /dev/null
+++ b/Tests/RunCMake/install/CODE-genex-bad-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<NOTAGENEX>
+
+ Expression did not evaluate to a known generator expression
diff --git a/Tests/RunCMake/install/CODE-genex-bad.cmake b/Tests/RunCMake/install/CODE-genex-bad.cmake
new file mode 100644
index 0000000..1663b39
--- /dev/null
+++ b/Tests/RunCMake/install/CODE-genex-bad.cmake
@@ -0,0 +1 @@
+install(CODE "message(\"$<NOTAGENEX>\")")
diff --git a/Tests/RunCMake/install/CODE-genex-check.cmake b/Tests/RunCMake/install/CODE-genex-check.cmake
new file mode 100644
index 0000000..422c532
--- /dev/null
+++ b/Tests/RunCMake/install/CODE-genex-check.cmake
@@ -0,0 +1,7 @@
+execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake
+ OUTPUT_VARIABLE out ERROR_VARIABLE err)
+if(NOT out MATCHES "-- Install configuration: .*-- codegenexlib")
+ string(REGEX REPLACE "\n" "\n " out " ${out}")
+ string(APPEND RunCMake_TEST_FAILED
+ "\"-- codegenexlib\" was not found:\n${out}")
+endif()
diff --git a/Tests/RunCMake/install/CODE-genex.cmake b/Tests/RunCMake/install/CODE-genex.cmake
new file mode 100644
index 0000000..3b8513d
--- /dev/null
+++ b/Tests/RunCMake/install/CODE-genex.cmake
@@ -0,0 +1,2 @@
+add_library( codegenexlib INTERFACE )
+install(CODE "message( STATUS \"$<TARGET_PROPERTY:codegenexlib,NAME>\")")
diff --git a/Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake b/Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake
new file mode 100644
index 0000000..c14998e
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^dir;dir/empty.txt$]])
diff --git a/Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake b/Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake
new file mode 100644
index 0000000..e57aab0
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake
@@ -0,0 +1 @@
+install(DIRECTORY dir/ noexist/ DESTINATION dir OPTIONAL)
diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake b/Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake
new file mode 100644
index 0000000..7a20edc
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^dir1;dir1/empty\.c;dir1/empty\.h;dir2;dir2/pattern;dir2/pattern/empty\.txt;dir3;dir3/empty\.c;dir3/empty\.h;dir3/empty\.txt;dir4;dir4/empty\.c;dir4/empty\.h;dir4/empty\.txt;empty$]])
diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN.cmake b/Tests/RunCMake/install/DIRECTORY-PATTERN.cmake
new file mode 100644
index 0000000..74d8043
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-PATTERN.cmake
@@ -0,0 +1,36 @@
+install(
+ DIRECTORY pattern/
+ DESTINATION dir1
+ FILES_MATCHING
+ PATTERN "*.h"
+ REGEX "\\.c$"
+ )
+
+# FIXME: If/when CMake gains a good way to read file permissions, we should
+# check that these permissions were set correctly.
+install(
+ DIRECTORY pattern
+ DESTINATION dir2
+ FILE_PERMISSIONS OWNER_READ OWNER_WRITE
+ DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
+ PATTERN "*.h" EXCLUDE
+ REGEX "\\.c$" EXCLUDE
+ )
+
+install(
+ DIRECTORY pattern/
+ DESTINATION dir3
+ PATTERN "*.h"
+ PERMISSIONS OWNER_READ OWNER_WRITE
+ )
+
+install(
+ DIRECTORY pattern/
+ DESTINATION dir4
+ USE_SOURCE_PERMISSIONS
+ )
+
+install(
+ DIRECTORY
+ DESTINATION empty
+ )
diff --git a/Tests/RunCMake/install/Deprecated-all-check.cmake b/Tests/RunCMake/install/Deprecated-all-check.cmake
new file mode 100644
index 0000000..9ea33a6
--- /dev/null
+++ b/Tests/RunCMake/install/Deprecated-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^bin;bin/myexe(\.exe)?;scripts1;scripts1/script;scripts1/script\.bat;scripts2;scripts2/script;scripts2/script\.bat;scripts3;scripts3/script;scripts3/script\.bat;src;src/empty\.c;src/obj1\.c;src/obj\2.c$]])
diff --git a/Tests/RunCMake/install/Deprecated.cmake b/Tests/RunCMake/install/Deprecated.cmake
new file mode 100644
index 0000000..c435cb5
--- /dev/null
+++ b/Tests/RunCMake/install/Deprecated.cmake
@@ -0,0 +1,13 @@
+enable_language(C)
+
+add_executable(myexe main.c)
+
+install_files(/src FILES empty.c)
+install_files(/src .c obj1)
+install_files(/src "^obj2.c$")
+
+install_targets(/bin myexe)
+
+install_programs(/scripts1 FILES script script.bat)
+install_programs(/scripts2 script script.bat)
+install_programs(/scripts3 "^script(\.bat)?$")
diff --git a/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake b/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake
new file mode 100644
index 0000000..2997a8d
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^src;src/main.c$]])
diff --git a/Tests/RunCMake/install/FILES-OPTIONAL.cmake b/Tests/RunCMake/install/FILES-OPTIONAL.cmake
new file mode 100644
index 0000000..812bf4f
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-OPTIONAL.cmake
@@ -0,0 +1 @@
+install(FILES main.c noexist.c DESTINATION src OPTIONAL)
diff --git a/Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake b/Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake
new file mode 100644
index 0000000..b8ba6d0
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^src;src/empty.c]])
diff --git a/Tests/RunCMake/install/FILES-PERMISSIONS.cmake b/Tests/RunCMake/install/FILES-PERMISSIONS.cmake
new file mode 100644
index 0000000..999c271
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-PERMISSIONS.cmake
@@ -0,0 +1,5 @@
+install(
+ FILES empty.c
+ DESTINATION src
+ PERMISSIONS OWNER_READ OWNER_WRITE
+ )
diff --git a/Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt b/Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake b/Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake
new file mode 100644
index 0000000..27ff683
--- /dev/null
+++ b/Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake
@@ -0,0 +1,10 @@
+enable_language(C)
+set(CMAKE_INSTALL_MFC_LIBRARIES 1)
+set(CMAKE_INSTALL_DEBUG_LIBRARIES 1)
+set(CMAKE_INSTALL_UCRT_LIBRARIES 1)
+set(CMAKE_INSTALL_OPENMP_LIBRARIES 1)
+include(InstallRequiredSystemLibraries)
+
+# FIXME: This test emits warnings because InstallRequiredSystemLibraries
+# doesn't currently work properly. The warnings have been suppressed in
+# InstallRequiredSystemLibraries-stderr.txt. This needs to be fixed.
diff --git a/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake
new file mode 100644
index 0000000..16ff1e1
--- /dev/null
+++ b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^bin;bin/myexe(\.exe)?;postinstall;preinstall]])
diff --git a/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake
new file mode 100644
index 0000000..357c688
--- /dev/null
+++ b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake
@@ -0,0 +1,7 @@
+enable_language(C)
+
+add_executable(myexe main.c)
+set_property(TARGET myexe PROPERTY PRE_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/preinstall.cmake")
+set_property(TARGET myexe PROPERTY POST_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/postinstall.cmake")
+
+install(TARGETS myexe DESTINATION bin)
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index f004ce9..91524a6 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -65,12 +65,34 @@ run_cmake(CMP0062-NEW)
run_cmake(CMP0062-WARN)
run_cmake(TARGETS-NAMELINK_COMPONENT-bad-all)
run_cmake(TARGETS-NAMELINK_COMPONENT-bad-exc)
+run_cmake(CODE-genex)
+run_cmake(CODE-genex-bad)
if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]")
run_install_test(FILES-TARGET_OBJECTS)
endif()
+run_install_test(TARGETS-InstallFromSubDir)
+run_install_test(TARGETS-OPTIONAL)
+run_install_test(FILES-OPTIONAL)
+run_install_test(DIRECTORY-OPTIONAL)
+
+set(RunCMake_TEST_OPTIONS "-DCMAKE_BUILD_TYPE:STRING=Debug")
+run_install_test(TARGETS-OUTPUT_NAME)
+unset(RunCMake_TEST_OPTIONS)
+
+run_install_test(Deprecated)
+run_install_test(PRE_POST_INSTALL_SCRIPT)
+run_install_test(SCRIPT)
+run_install_test(TARGETS-CONFIGURATIONS)
+run_install_test(DIRECTORY-PATTERN)
+run_install_test(TARGETS-Parts)
+run_install_test(FILES-PERMISSIONS)
+run_install_test(TARGETS-RPATH)
+run_install_test(InstallRequiredSystemLibraries)
+
set(run_install_test_components 1)
run_install_test(FILES-EXCLUDE_FROM_ALL)
run_install_test(TARGETS-EXCLUDE_FROM_ALL)
run_install_test(TARGETS-NAMELINK_COMPONENT)
+run_install_test(SCRIPT-COMPONENT)
diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake
new file mode 100644
index 0000000..48d8e1a
--- /dev/null
+++ b/Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^empty1.txt;empty2.txt$]])
diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake
new file mode 100644
index 0000000..48d8e1a
--- /dev/null
+++ b/Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake
@@ -0,0 +1 @@
+check_installed([[^empty1.txt;empty2.txt$]])
diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake
new file mode 100644
index 0000000..e09a102
--- /dev/null
+++ b/Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake
@@ -0,0 +1 @@
+check_installed([[^$]])
diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT.cmake
new file mode 100644
index 0000000..aaa9bd4
--- /dev/null
+++ b/Tests/RunCMake/install/SCRIPT-COMPONENT.cmake
@@ -0,0 +1,5 @@
+install(
+ SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/install_script.cmake"
+ CODE "write_empty_file(empty2.txt)"
+ COMPONENT dev
+ )
diff --git a/Tests/RunCMake/install/SCRIPT-all-check.cmake b/Tests/RunCMake/install/SCRIPT-all-check.cmake
new file mode 100644
index 0000000..48d8e1a
--- /dev/null
+++ b/Tests/RunCMake/install/SCRIPT-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^empty1.txt;empty2.txt$]])
diff --git a/Tests/RunCMake/install/SCRIPT.cmake b/Tests/RunCMake/install/SCRIPT.cmake
new file mode 100644
index 0000000..f857b54
--- /dev/null
+++ b/Tests/RunCMake/install/SCRIPT.cmake
@@ -0,0 +1,4 @@
+install(
+ SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/install_script.cmake"
+ CODE "write_empty_file(empty2.txt)"
+ )
diff --git a/Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake
new file mode 100644
index 0000000..2866e7f
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^src;src/main-d.c$]])
diff --git a/Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake
new file mode 100644
index 0000000..5531cd2
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake
@@ -0,0 +1,2 @@
+install(FILES main.c DESTINATION src CONFIGURATIONS Debug RENAME main-d.c)
+install(FILES main.c DESTINATION src CONFIGURATIONS Release RENAME main-r.c)
diff --git a/Tests/RunCMake/install/TARGETS-InstallFromSubDir-all-check.cmake b/Tests/RunCMake/install/TARGETS-InstallFromSubDir-all-check.cmake
new file mode 100644
index 0000000..1d747c3
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-InstallFromSubDir-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^bin;bin/myexe(\.exe)?;bin/subexe(\.exe)?$]])
diff --git a/Tests/RunCMake/install/TARGETS-InstallFromSubDir.cmake b/Tests/RunCMake/install/TARGETS-InstallFromSubDir.cmake
new file mode 100644
index 0000000..8615d6e
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-InstallFromSubDir.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+add_executable(myexe main.c)
+add_subdirectory(TARGETS-InstallFromSubDir)
+install(TARGETS myexe subexe DESTINATION bin)
diff --git a/Tests/RunCMake/install/TARGETS-InstallFromSubDir/CMakeLists.txt b/Tests/RunCMake/install/TARGETS-InstallFromSubDir/CMakeLists.txt
new file mode 100644
index 0000000..477d938
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-InstallFromSubDir/CMakeLists.txt
@@ -0,0 +1 @@
+add_executable(subexe ../main.c)
diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake b/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake
new file mode 100644
index 0000000..bcf71dd
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^bin;bin/myexe(\.exe)?$]])
diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt b/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt
new file mode 100644
index 0000000..86e3ec0
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt
@@ -0,0 +1 @@
+^WARNING: Target "notall" has EXCLUDE_FROM_ALL set and will not be built by default but an install rule has been provided for it\. CMake does not define behavior for this case\.$
diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake b/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake
new file mode 100644
index 0000000..d3c5cda
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+add_executable(myexe main.c)
+add_executable(notall EXCLUDE_FROM_ALL main.c)
+install(TARGETS myexe notall DESTINATION bin OPTIONAL)
diff --git a/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake
new file mode 100644
index 0000000..5daecc8
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake
@@ -0,0 +1,13 @@
+if(WIN32)
+ set(test123 [[bin/test1out\.exe;bin/test2deb\.exe;bin/test3exc\.exe]])
+ set(libtest45 [[bin/libtest4\.dll;bin/libtest4\.dll\.a;bin/libtest5ar\.a]])
+ set(test45 [[bin/test4\.dll;bin/test4\.lib;bin/test5ar\.lib]])
+
+ check_installed("^bin;(${libtest45};${test123})|(${test123};${test45})\$")
+elseif(CYGWIN)
+ check_installed([[^bin;bin/cygtest4\.dll;bin/libtest4\.dll\.a;bin/libtest5ar\.a;bin/test1out\.exe;bin/test2deb\.exe;bin/test3exc\.exe$]])
+elseif(APPLE)
+ check_installed([[^bin;bin/libtest4lib\.dylib;bin/libtest5ar\.a;bin/test1out;bin/test2deb;bin/test3exc$]])
+else()
+ check_installed([[^bin;bin/libtest4lib\.so;bin/libtest5ar\.a;bin/test1out;bin/test2deb;bin/test3exc$]])
+endif()
diff --git a/Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake
new file mode 100644
index 0000000..67e7069
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake
@@ -0,0 +1,27 @@
+enable_language(C)
+
+add_executable(test1 main.c)
+set_property(TARGET test1 PROPERTY OUTPUT_NAME test1out)
+set_property(TARGET test1 PROPERTY RELEASE_OUTPUT_NAME test1rel)
+
+add_executable(test2 main.c)
+set_property(TARGET test2 PROPERTY OUTPUT_NAME test2out)
+set_property(TARGET test2 PROPERTY DEBUG_OUTPUT_NAME test2deb)
+
+add_executable(test3 main.c)
+set_property(TARGET test3 PROPERTY RUNTIME_OUTPUT_NAME test3exc)
+
+add_library(test4 SHARED obj1.c)
+set_property(TARGET test4 PROPERTY LIBRARY_OUTPUT_NAME test4lib)
+
+add_library(test5 STATIC obj1.c)
+set_property(TARGET test5 PROPERTY ARCHIVE_OUTPUT_NAME test5ar)
+
+install(TARGETS
+ test1
+ test2
+ test3
+ test4
+ test5
+ DESTINATION bin
+ )
diff --git a/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake b/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake
new file mode 100644
index 0000000..6245839
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^include;include/obj1\.h;lib;lib/(mylib\.lib|(lib|cyg)mylib\.a)$]])
diff --git a/Tests/RunCMake/install/TARGETS-Parts.cmake b/Tests/RunCMake/install/TARGETS-Parts.cmake
new file mode 100644
index 0000000..2a46ab9
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-Parts.cmake
@@ -0,0 +1,7 @@
+enable_language(C)
+add_library(mylib STATIC obj1.c)
+set_property(TARGET mylib PROPERTY PUBLIC_HEADER obj1.h)
+install(TARGETS mylib
+ ARCHIVE DESTINATION lib
+ PUBLIC_HEADER DESTINATION include
+ )
diff --git a/Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake b/Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake
new file mode 100644
index 0000000..fa52d65
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake
@@ -0,0 +1,14 @@
+execute_process(
+ COMMAND "${CMAKE_INSTALL_PREFIX}/bin/myexe"
+ RESULT_VARIABLE MYEXE_RESULT
+ OUTPUT_VARIABLE MYEXE_OUTPUT
+ ERROR_VARIABLE MYEXE_ERROR
+ )
+
+if(NOT MYEXE_RESULT EQUAL "0")
+ set(RunCMake_TEST_FAILED "myexe returned [${MYEXE_RESULT}], was expecting [0]")
+elseif(NOT MYEXE_OUTPUT STREQUAL "")
+ set(RunCMake_TEST_FAILED "myexe printed nonempty output:\n${MYEXE_OUTPUT}")
+elseif(NOT MYEXE_ERROR STREQUAL "")
+ set(RunCMake_TEST_FAILED "myexe printed nonempty error:\n${MYEXE_ERROR}")
+endif()
diff --git a/Tests/RunCMake/install/TARGETS-RPATH.cmake b/Tests/RunCMake/install/TARGETS-RPATH.cmake
new file mode 100644
index 0000000..b75deff
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RPATH.cmake
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.9)
+
+enable_language(C)
+
+set(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
+add_library(mylib SHARED obj1.c)
+add_executable(myexe testobj1.c)
+target_link_libraries(myexe mylib)
+set_property(TARGET myexe PROPERTY INSTALL_RPATH "${CMAKE_CURRENT_BINARY_DIR}/root-all/bin")
+set_target_properties(mylib PROPERTIES VERSION 1.0 SOVERSION 1)
+
+install(TARGETS mylib myexe
+ DESTINATION bin
+ )
diff --git a/Tests/RunCMake/install/install_script.cmake b/Tests/RunCMake/install/install_script.cmake
new file mode 100644
index 0000000..1f8522c
--- /dev/null
+++ b/Tests/RunCMake/install/install_script.cmake
@@ -0,0 +1,5 @@
+function(write_empty_file FILENAME)
+ file(WRITE "${CMAKE_INSTALL_PREFIX}/${FILENAME}" "")
+endfunction()
+
+write_empty_file(empty1.txt)
diff --git a/Tests/RunCMake/install/obj1.c b/Tests/RunCMake/install/obj1.c
index 2411aab..70007df 100644
--- a/Tests/RunCMake/install/obj1.c
+++ b/Tests/RunCMake/install/obj1.c
@@ -1,4 +1,7 @@
-int obj1(void)
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int obj1(void)
{
return 0;
}
diff --git a/Tests/RunCMake/install/obj1.h b/Tests/RunCMake/install/obj1.h
new file mode 100644
index 0000000..d88d5d2
--- /dev/null
+++ b/Tests/RunCMake/install/obj1.h
@@ -0,0 +1,6 @@
+#ifndef OBJ1_H
+#define OBJ1_H
+
+int obj1(void);
+
+#endif /* OBJ1_H */
diff --git a/Tests/RunCMake/install/pattern/empty.c b/Tests/RunCMake/install/pattern/empty.c
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/install/pattern/empty.c
diff --git a/Tests/RunCMake/install/pattern/empty.h b/Tests/RunCMake/install/pattern/empty.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/install/pattern/empty.h
diff --git a/Tests/RunCMake/install/pattern/empty.txt b/Tests/RunCMake/install/pattern/empty.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/install/pattern/empty.txt
diff --git a/Tests/RunCMake/install/postinstall.cmake b/Tests/RunCMake/install/postinstall.cmake
new file mode 100644
index 0000000..7607f40
--- /dev/null
+++ b/Tests/RunCMake/install/postinstall.cmake
@@ -0,0 +1 @@
+file(WRITE "${CMAKE_INSTALL_PREFIX}/postinstall" "postinstall")
diff --git a/Tests/RunCMake/install/preinstall.cmake b/Tests/RunCMake/install/preinstall.cmake
new file mode 100644
index 0000000..4b28d16
--- /dev/null
+++ b/Tests/RunCMake/install/preinstall.cmake
@@ -0,0 +1 @@
+file(WRITE "${CMAKE_INSTALL_PREFIX}/preinstall" "preinstall")
diff --git a/Tests/SimpleInstallS2/scripts/sample_script b/Tests/RunCMake/install/script
index 81f9f53..81f9f53 100755
--- a/Tests/SimpleInstallS2/scripts/sample_script
+++ b/Tests/RunCMake/install/script
diff --git a/Tests/SimpleInstallS2/scripts/sample_script.bat b/Tests/RunCMake/install/script.bat
index a9af38c..a9af38c 100755
--- a/Tests/SimpleInstallS2/scripts/sample_script.bat
+++ b/Tests/RunCMake/install/script.bat
diff --git a/Tests/RunCMake/install/testobj1.c b/Tests/RunCMake/install/testobj1.c
new file mode 100644
index 0000000..081ef20
--- /dev/null
+++ b/Tests/RunCMake/install/testobj1.c
@@ -0,0 +1,9 @@
+#ifdef _WIN32
+__declspec(dllimport)
+#endif
+ int obj1(void);
+
+int main(void)
+{
+ return obj1();
+}
diff --git a/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt b/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt
index 6e15c0b..9b9c5e0 100644
--- a/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt
+++ b/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt
@@ -1,4 +1,4 @@
^CMake Error at INSERT-InvalidIndex.cmake:2 \(list\):
- list index: 3 out of range \(-3, 2\)
+ list index: 4 out of range \(-3, 3\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/INSERT-InvalidIndex.cmake b/Tests/RunCMake/list/INSERT-InvalidIndex.cmake
index 4103d97..12ac114 100644
--- a/Tests/RunCMake/list/INSERT-InvalidIndex.cmake
+++ b/Tests/RunCMake/list/INSERT-InvalidIndex.cmake
@@ -1,2 +1,2 @@
set(mylist alpha bravo charlie)
-list(INSERT mylist 3 delta)
+list(INSERT mylist 4 delta)
diff --git a/Tests/RunCMake/list/RunCMakeTest.cmake b/Tests/RunCMake/list/RunCMakeTest.cmake
index bdc23a4..a8a0b57 100644
--- a/Tests/RunCMake/list/RunCMakeTest.cmake
+++ b/Tests/RunCMake/list/RunCMakeTest.cmake
@@ -20,7 +20,6 @@ run_cmake(JOIN-TooManyArguments)
run_cmake(LENGTH-TooManyArguments)
run_cmake(REMOVE_DUPLICATES-TooManyArguments)
run_cmake(REVERSE-TooManyArguments)
-run_cmake(SORT-TooManyArguments)
run_cmake(SUBLIST-TooManyArguments)
run_cmake(FILTER-NotList)
@@ -84,3 +83,16 @@ run_cmake(TRANSFORM-GENEX_STRIP)
run_cmake(TRANSFORM-APPEND)
run_cmake(TRANSFORM-PREPEND)
run_cmake(TRANSFORM-REPLACE)
+
+# argument tests
+run_cmake(SORT-WrongOption)
+run_cmake(SORT-BadCaseOption)
+run_cmake(SORT-BadCompareOption)
+run_cmake(SORT-BadOrderOption)
+run_cmake(SORT-DuplicateOrderOption)
+run_cmake(SORT-DuplicateCompareOption)
+run_cmake(SORT-DuplicateCaseOption)
+run_cmake(SORT-NoCaseOption)
+
+# Successful tests
+run_cmake(SORT)
diff --git a/Tests/RunCMake/list/SORT-BadCaseOption-result.txt b/Tests/RunCMake/list/SORT-BadCaseOption-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-BadCaseOption-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/SORT-BadCaseOption-stderr.txt b/Tests/RunCMake/list/SORT-BadCaseOption-stderr.txt
new file mode 100644
index 0000000..87dd502
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-BadCaseOption-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at SORT-BadCaseOption.cmake:1 \(list\):
+ list sub-command SORT value "BAD_CASE_OPTION" for option "CASE" is invalid.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/SORT-BadCaseOption.cmake b/Tests/RunCMake/list/SORT-BadCaseOption.cmake
new file mode 100644
index 0000000..ac5c102
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-BadCaseOption.cmake
@@ -0,0 +1 @@
+list(SORT mylist CASE BAD_CASE_OPTION)
diff --git a/Tests/RunCMake/list/SORT-BadCompareOption-result.txt b/Tests/RunCMake/list/SORT-BadCompareOption-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-BadCompareOption-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/SORT-BadCompareOption-stderr.txt b/Tests/RunCMake/list/SORT-BadCompareOption-stderr.txt
new file mode 100644
index 0000000..51b4de2
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-BadCompareOption-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at SORT-BadCompareOption.cmake:1 \(list\):
+ list sub-command SORT value "BAD_COMPARE_OPTION" for option "COMPARE" is
+ invalid.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/SORT-BadCompareOption.cmake b/Tests/RunCMake/list/SORT-BadCompareOption.cmake
new file mode 100644
index 0000000..d5c632e
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-BadCompareOption.cmake
@@ -0,0 +1 @@
+list(SORT mylist COMPARE BAD_COMPARE_OPTION)
diff --git a/Tests/RunCMake/list/SORT-BadOrderOption-result.txt b/Tests/RunCMake/list/SORT-BadOrderOption-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-BadOrderOption-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/SORT-BadOrderOption-stderr.txt b/Tests/RunCMake/list/SORT-BadOrderOption-stderr.txt
new file mode 100644
index 0000000..7984e5c
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-BadOrderOption-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at SORT-BadOrderOption.cmake:1 \(list\):
+ list sub-command SORT value "BAD_ODER_OPTION" for option "ORDER" is
+ invalid.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/SORT-BadOrderOption.cmake b/Tests/RunCMake/list/SORT-BadOrderOption.cmake
new file mode 100644
index 0000000..e232197
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-BadOrderOption.cmake
@@ -0,0 +1 @@
+list(SORT mylist ORDER BAD_ODER_OPTION)
diff --git a/Tests/RunCMake/list/SORT-DuplicateCaseOption-result.txt b/Tests/RunCMake/list/SORT-DuplicateCaseOption-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-DuplicateCaseOption-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/SORT-DuplicateCaseOption-stderr.txt b/Tests/RunCMake/list/SORT-DuplicateCaseOption-stderr.txt
new file mode 100644
index 0000000..b893f50
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-DuplicateCaseOption-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at SORT-DuplicateCaseOption.cmake:2 \(list\):
+ list sub-command SORT option "CASE" has been specified multiple times.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/SORT-DuplicateCaseOption.cmake b/Tests/RunCMake/list/SORT-DuplicateCaseOption.cmake
new file mode 100644
index 0000000..ba52b24
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-DuplicateCaseOption.cmake
@@ -0,0 +1,2 @@
+set (mylist a b c)
+list(SORT mylist CASE INSENSITIVE CASE INSENSITIVE )
diff --git a/Tests/RunCMake/list/SORT-DuplicateCompareOption-result.txt b/Tests/RunCMake/list/SORT-DuplicateCompareOption-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-DuplicateCompareOption-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/SORT-DuplicateCompareOption-stderr.txt b/Tests/RunCMake/list/SORT-DuplicateCompareOption-stderr.txt
new file mode 100644
index 0000000..83624be
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-DuplicateCompareOption-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at SORT-DuplicateCompareOption.cmake:2 \(list\):
+ list sub-command SORT option "COMPARE" has been specified multiple times.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/SORT-DuplicateCompareOption.cmake b/Tests/RunCMake/list/SORT-DuplicateCompareOption.cmake
new file mode 100644
index 0000000..fd2e31d
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-DuplicateCompareOption.cmake
@@ -0,0 +1,2 @@
+set (mylist a b c)
+list(SORT mylist COMPARE STRING COMPARE STRING)
diff --git a/Tests/RunCMake/list/SORT-DuplicateOrderOption-result.txt b/Tests/RunCMake/list/SORT-DuplicateOrderOption-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-DuplicateOrderOption-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/SORT-DuplicateOrderOption-stderr.txt b/Tests/RunCMake/list/SORT-DuplicateOrderOption-stderr.txt
new file mode 100644
index 0000000..9e95178
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-DuplicateOrderOption-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at SORT-DuplicateOrderOption.cmake:2 \(list\):
+ list sub-command SORT option "ORDER" has been specified multiple times.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/SORT-DuplicateOrderOption.cmake b/Tests/RunCMake/list/SORT-DuplicateOrderOption.cmake
new file mode 100644
index 0000000..26d9c7d
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-DuplicateOrderOption.cmake
@@ -0,0 +1,2 @@
+set (mylist a b c)
+list(SORT mylist ORDER ASCENDING ORDER ASCENDING)
diff --git a/Tests/RunCMake/list/SORT-NoCaseOption-result.txt b/Tests/RunCMake/list/SORT-NoCaseOption-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-NoCaseOption-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/SORT-NoCaseOption-stderr.txt b/Tests/RunCMake/list/SORT-NoCaseOption-stderr.txt
new file mode 100644
index 0000000..5c63e77
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-NoCaseOption-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at SORT-NoCaseOption.cmake:1 \(list\):
+ list sub-command SORT missing argument for option "CASE".
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/SORT-NoCaseOption.cmake b/Tests/RunCMake/list/SORT-NoCaseOption.cmake
new file mode 100644
index 0000000..57cc429
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-NoCaseOption.cmake
@@ -0,0 +1 @@
+list(SORT mylist CASE)
diff --git a/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt b/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt
deleted file mode 100644
index d3fad60..0000000
--- a/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-^CMake Error at SORT-TooManyArguments.cmake:1 \(list\):
- list sub-command SORT only takes one argument.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/SORT-WrongOption-result.txt b/Tests/RunCMake/list/SORT-WrongOption-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-WrongOption-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/SORT-WrongOption-stderr.txt b/Tests/RunCMake/list/SORT-WrongOption-stderr.txt
new file mode 100644
index 0000000..597cb29
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-WrongOption-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at SORT-WrongOption.cmake:1 \(list\):
+ list sub-command SORT option "one_too_many" is unknown.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/SORT-TooManyArguments.cmake b/Tests/RunCMake/list/SORT-WrongOption.cmake
index 81b195d..81b195d 100644
--- a/Tests/RunCMake/list/SORT-TooManyArguments.cmake
+++ b/Tests/RunCMake/list/SORT-WrongOption.cmake
diff --git a/Tests/RunCMake/list/SORT.cmake b/Tests/RunCMake/list/SORT.cmake
new file mode 100644
index 0000000..4a9e064
--- /dev/null
+++ b/Tests/RunCMake/list/SORT.cmake
@@ -0,0 +1,114 @@
+set(source_unsorted
+ c/B.h
+ a/c.h
+ B/a.h
+ )
+
+## Test with default options
+set(expected
+ B/a.h
+ a/c.h
+ c/B.h
+ )
+set(list ${source_unsorted})
+list(SORT list)
+if (NOT expected STREQUAL list)
+ message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE STRING)")
+endif ()
+
+
+## Test CASE INSENSITIVE ORDER ASCENDING COMPARE STRING
+set(expected
+ a/c.h
+ B/a.h
+ c/B.h
+ )
+set(list ${source_unsorted})
+list(SORT list CASE INSENSITIVE ORDER ASCENDING COMPARE STRING)
+if (NOT expected STREQUAL list)
+ message(FATAL_ERROR "wrong sort result with command list(SORT list CASE INSENSITIVE ORDER ASCENDING COMPARE STRING)")
+endif ()
+
+## Test CASE INSENSITIVE ORDER DESCENDING COMPARE STRING
+set(expected
+ c/B.h
+ B/a.h
+ a/c.h
+ )
+set(list ${source_unsorted})
+list(SORT list CASE INSENSITIVE ORDER DESCENDING COMPARE STRING)
+if (NOT expected STREQUAL list)
+ message(FATAL_ERROR "wrong sort result with command list(SORT list CASE INSENSITIVE ORDER DESCENDING COMPARE STRING)")
+endif ()
+
+## Test CASE SENSITIVE ORDER ASCENDING COMPARE STRING
+set(expected
+ B/a.h
+ a/c.h
+ c/B.h
+ )
+set(list ${source_unsorted})
+list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE STRING)
+if (NOT expected STREQUAL list)
+ message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE STRING)")
+endif ()
+
+## Test CASE SENSITIVE ORDER DESCENDING COMPARE STRING
+set(expected
+ c/B.h
+ a/c.h
+ B/a.h
+ )
+set(list ${source_unsorted})
+list(SORT list CASE SENSITIVE ORDER DESCENDING COMPARE STRING)
+if (NOT expected STREQUAL list)
+ message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER DESCENDING COMPARE STRING)")
+endif ()
+
+## Test CASE INSENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME
+set(expected
+ B/a.h
+ c/B.h
+ a/c.h
+ )
+set(list ${source_unsorted})
+list(SORT list CASE INSENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME)
+if (NOT expected STREQUAL list)
+ message(FATAL_ERROR "wrong sort result with command list(SORT list CASE INSENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME)")
+endif ()
+
+## Test CASE INSENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME
+set(expected
+ a/c.h
+ c/B.h
+ B/a.h
+ )
+set(list ${source_unsorted})
+list(SORT list CASE INSENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME)
+if (NOT expected STREQUAL list)
+ message(FATAL_ERROR "wrong sort result with command list(SORT list CASE INSENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME)")
+endif ()
+
+## Test CASE SENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME
+set(expected
+ c/B.h
+ B/a.h
+ a/c.h
+ )
+set(list ${source_unsorted})
+list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME)
+if (NOT expected STREQUAL list)
+ message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME)")
+endif ()
+
+## Test CASE SENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME
+set(expected
+ a/c.h
+ B/a.h
+ c/B.h
+ )
+set(list ${source_unsorted})
+list(SORT list CASE SENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME)
+if (NOT expected STREQUAL list)
+ message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME)")
+endif ()
diff --git a/Tests/RunCMake/math/CMakeLists.txt b/Tests/RunCMake/math/CMakeLists.txt
new file mode 100644
index 0000000..12cd3c7
--- /dev/null
+++ b/Tests/RunCMake/math/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.4)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/math/MATH-DivideByZero-result.txt b/Tests/RunCMake/math/MATH-DivideByZero-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-DivideByZero-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/math/MATH-DivideByZero-stderr.txt b/Tests/RunCMake/math/MATH-DivideByZero-stderr.txt
new file mode 100644
index 0000000..66ad633
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-DivideByZero-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at MATH-DivideByZero.cmake:1 \(math\):
+ math cannot evaluate the expression: "100/0": divide by zero.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/math/MATH-DivideByZero.cmake b/Tests/RunCMake/math/MATH-DivideByZero.cmake
new file mode 100644
index 0000000..3ac161e
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-DivideByZero.cmake
@@ -0,0 +1 @@
+math(EXPR var "100/0")
diff --git a/Tests/RunCMake/math/MATH-DoubleOption-result.txt b/Tests/RunCMake/math/MATH-DoubleOption-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-DoubleOption-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/math/MATH-DoubleOption-stderr.txt b/Tests/RunCMake/math/MATH-DoubleOption-stderr.txt
new file mode 100644
index 0000000..767a060
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-DoubleOption-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at MATH-DoubleOption.cmake:1 \(math\):
+ math EXPR called with incorrect arguments.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/math/MATH-DoubleOption.cmake b/Tests/RunCMake/math/MATH-DoubleOption.cmake
new file mode 100644
index 0000000..7bcb78e
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-DoubleOption.cmake
@@ -0,0 +1 @@
+math(EXPR var "10*10" OUTPUT_FORMAT DECIMAL OUTPUT_FORMAT HEXADECIMAL)
diff --git a/Tests/RunCMake/math/MATH-InvalidExpression-result.txt b/Tests/RunCMake/math/MATH-InvalidExpression-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-InvalidExpression-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt b/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt
new file mode 100644
index 0000000..9e73ed5
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at MATH-InvalidExpression.cmake:1 \(math\):
+ math cannot parse the expression: "INVALID": syntax error, unexpected \$end,
+ expecting exp_PLUS or exp_MINUS or exp_OPENPARENT or exp_NUMBER \(7\).
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/math/MATH-InvalidExpression.cmake b/Tests/RunCMake/math/MATH-InvalidExpression.cmake
new file mode 100644
index 0000000..6e37128
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-InvalidExpression.cmake
@@ -0,0 +1 @@
+math(EXPR var "INVALID")
diff --git a/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt b/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt
new file mode 100644
index 0000000..732ce6f
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt
@@ -0,0 +1,8 @@
+^CMake Warning \(dev\) at MATH-ToleratedExpression.cmake:1 \(math\):
+ Unexpected character in expression at position 1: '
+
+ Unexpected character in expression at position 7: '
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/math/MATH-ToleratedExpression.cmake b/Tests/RunCMake/math/MATH-ToleratedExpression.cmake
new file mode 100644
index 0000000..d1be218
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-ToleratedExpression.cmake
@@ -0,0 +1,4 @@
+math(EXPR var "'2*1-1'")
+if(NOT var EQUAL 1)
+ message(FATAL_ERROR "Expression did not evaluate to 1")
+endif()
diff --git a/Tests/RunCMake/math/MATH-TooManyArguments-result.txt b/Tests/RunCMake/math/MATH-TooManyArguments-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-TooManyArguments-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt b/Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt
new file mode 100644
index 0000000..fdcfecf
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at MATH-TooManyArguments.cmake:1 \(math\):
+ math EXPR called with incorrect arguments.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/math/MATH-TooManyArguments.cmake b/Tests/RunCMake/math/MATH-TooManyArguments.cmake
new file mode 100644
index 0000000..969dc80
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-TooManyArguments.cmake
@@ -0,0 +1 @@
+math(EXPR var "10*10" OUTPUT_FORMAT DECIMAL OUTPUT_FORMAT )
diff --git a/Tests/RunCMake/math/MATH-WrongArgument-result.txt b/Tests/RunCMake/math/MATH-WrongArgument-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-WrongArgument-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/math/MATH-WrongArgument-stderr.txt b/Tests/RunCMake/math/MATH-WrongArgument-stderr.txt
new file mode 100644
index 0000000..bbe54bf
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-WrongArgument-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at MATH-WrongArgument.cmake:1 \(math\):
+ math sub-command EXPR option "OUT" is unknown.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/math/MATH-WrongArgument.cmake b/Tests/RunCMake/math/MATH-WrongArgument.cmake
new file mode 100644
index 0000000..fb6d2e7
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-WrongArgument.cmake
@@ -0,0 +1 @@
+math(EXPR var "10*10" OUT HEX )
diff --git a/Tests/RunCMake/math/MATH.cmake b/Tests/RunCMake/math/MATH.cmake
new file mode 100644
index 0000000..a5f50cd
--- /dev/null
+++ b/Tests/RunCMake/math/MATH.cmake
@@ -0,0 +1,12 @@
+macro(math_test expression expected)
+ math(EXPR evaluated ${expression} ${ARGN})
+ if (NOT evaluated STREQUAL ${expected})
+ message(FATAL_ERROR "wrong math result: ${evaluated} != ${expected}")
+ endif ()
+endmacro()
+
+
+math_test("100 * 10" 1000)
+math_test("100 * 10" 1000 OUTPUT_FORMAT DECIMAL)
+math_test("100 * 0xA" 1000 OUTPUT_FORMAT DECIMAL)
+math_test("100 * 0xA" 0x3e8 OUTPUT_FORMAT HEXADECIMAL)
diff --git a/Tests/RunCMake/math/RunCMakeTest.cmake b/Tests/RunCMake/math/RunCMakeTest.cmake
new file mode 100644
index 0000000..a4d5c31
--- /dev/null
+++ b/Tests/RunCMake/math/RunCMakeTest.cmake
@@ -0,0 +1,9 @@
+include(RunCMake)
+
+run_cmake(MATH)
+run_cmake(MATH-WrongArgument)
+run_cmake(MATH-DoubleOption)
+run_cmake(MATH-TooManyArguments)
+run_cmake(MATH-InvalidExpression)
+run_cmake(MATH-ToleratedExpression)
+run_cmake(MATH-DivideByZero)
diff --git a/Tests/RunCMake/option/CMP0077-NEW.cmake b/Tests/RunCMake/option/CMP0077-NEW.cmake
new file mode 100644
index 0000000..d4c518b
--- /dev/null
+++ b/Tests/RunCMake/option/CMP0077-NEW.cmake
@@ -0,0 +1,14 @@
+
+#Verify that option DOESN'T overwrite existing normal variable when the policy
+#is set to NEW
+cmake_policy(SET CMP0077 NEW)
+set(OPT_LOCAL_VAR FALSE)
+option(OPT_LOCAL_VAR "TEST_VAR" ON)
+if(OPT_LOCAL_VAR)
+ message(FATAL_ERROR "option failed to overwrite existing normal variable")
+endif()
+
+get_property(_exists_in_cache CACHE OPT_LOCAL_VAR PROPERTY VALUE SET)
+if(_exists_in_cache)
+ message(FATAL_ERROR "value should not exist in cache as it was already a local variable")
+endif()
diff --git a/Tests/RunCMake/option/CMP0077-OLD.cmake b/Tests/RunCMake/option/CMP0077-OLD.cmake
new file mode 100644
index 0000000..4c52d4b
--- /dev/null
+++ b/Tests/RunCMake/option/CMP0077-OLD.cmake
@@ -0,0 +1,9 @@
+
+#Verify that option overwrites existing normal variable when the policy
+#is set to OLD
+cmake_policy(SET CMP0077 OLD)
+set(OPT_LOCAL_VAR FALSE)
+option(OPT_LOCAL_VAR "TEST_VAR" ON)
+if(NOT OPT_LOCAL_VAR)
+ message(FATAL_ERROR "option failed to overwrite existing normal variable")
+endif()
diff --git a/Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake b/Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake
new file mode 100644
index 0000000..f62a853
--- /dev/null
+++ b/Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake
@@ -0,0 +1,14 @@
+
+#Verify that when both a cache and local version of a value exist that CMake
+#doesn't produce a CMP0077 warning and that we get the expected values.
+option(OPT_LOCAL_VAR "TEST_VAR" ON)
+set(OPT_LOCAL_VAR FALSE)
+option(OPT_LOCAL_VAR "TEST_VAR" ON)
+if(OPT_LOCAL_VAR)
+ message(FATAL_ERROR "option improperly set a cache variable that already exists")
+endif()
+
+get_property(_exists_in_cache CACHE OPT_LOCAL_VAR PROPERTY VALUE SET)
+if(NOT _exists_in_cache)
+ message(FATAL_ERROR "value should exist in cache")
+endif()
diff --git a/Tests/RunCMake/option/CMP0077-WARN-stderr.txt b/Tests/RunCMake/option/CMP0077-WARN-stderr.txt
new file mode 100644
index 0000000..0d02ffb
--- /dev/null
+++ b/Tests/RunCMake/option/CMP0077-WARN-stderr.txt
@@ -0,0 +1,7 @@
+CMake Warning \(dev\) at CMP0077-WARN.cmake:5 \(option\):
+ Policy CMP0077 is not set: option\(\) honors normal variables. Run "cmake
+ --help-policy CMP0077" for policy details. Use the cmake_policy command to
+ set the policy and suppress this warning.
+
+ For compatibility with older versions of CMake, option is clearing the
+ normal variable 'OPT_LOCAL_VAR'.
diff --git a/Tests/RunCMake/option/CMP0077-WARN.cmake b/Tests/RunCMake/option/CMP0077-WARN.cmake
new file mode 100644
index 0000000..7f99456
--- /dev/null
+++ b/Tests/RunCMake/option/CMP0077-WARN.cmake
@@ -0,0 +1,5 @@
+
+#Verify that option overwrites existing normal variable when the policy
+#is set to OLD
+set(OPT_LOCAL_VAR FALSE)
+option(OPT_LOCAL_VAR "TEST_VAR" ON)
diff --git a/Tests/RunCMake/option/CMakeLists.txt b/Tests/RunCMake/option/CMakeLists.txt
new file mode 100644
index 0000000..11dc49a
--- /dev/null
+++ b/Tests/RunCMake/option/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.12)
+project(${RunCMake_TEST} CXX)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/option/RunCMakeTest.cmake b/Tests/RunCMake/option/RunCMakeTest.cmake
new file mode 100644
index 0000000..979afa1
--- /dev/null
+++ b/Tests/RunCMake/option/RunCMakeTest.cmake
@@ -0,0 +1,6 @@
+include(RunCMake)
+
+run_cmake(CMP0077-OLD)
+run_cmake(CMP0077-NEW)
+run_cmake(CMP0077-WARN)
+run_cmake(CMP0077-SECOND-PASS)
diff --git a/Tests/RunCMake/set_property/LINK_OPTIONS-stdout.txt b/Tests/RunCMake/set_property/LINK_OPTIONS-stdout.txt
new file mode 100644
index 0000000..033792a
--- /dev/null
+++ b/Tests/RunCMake/set_property/LINK_OPTIONS-stdout.txt
@@ -0,0 +1,2 @@
+-- Target LINK_OPTIONS is 'a;b;c;d;;e'
+-- Directory LINK_OPTIONS is 'a;b;c;d;;e'
diff --git a/Tests/RunCMake/set_property/LINK_OPTIONS.cmake b/Tests/RunCMake/set_property/LINK_OPTIONS.cmake
new file mode 100644
index 0000000..6daf41b
--- /dev/null
+++ b/Tests/RunCMake/set_property/LINK_OPTIONS.cmake
@@ -0,0 +1,3 @@
+include(Common.cmake)
+test_target_property(LINK_OPTIONS)
+test_directory_property(LINK_OPTIONS)
diff --git a/Tests/RunCMake/set_property/RunCMakeTest.cmake b/Tests/RunCMake/set_property/RunCMakeTest.cmake
index b966e89..77da703 100644
--- a/Tests/RunCMake/set_property/RunCMakeTest.cmake
+++ b/Tests/RunCMake/set_property/RunCMakeTest.cmake
@@ -5,6 +5,7 @@ run_cmake(COMPILE_FEATURES)
run_cmake(COMPILE_OPTIONS)
run_cmake(IMPORTED_GLOBAL)
run_cmake(INCLUDE_DIRECTORIES)
+run_cmake(LINK_OPTIONS)
run_cmake(LINK_LIBRARIES)
run_cmake(SOURCES)
run_cmake(TYPE)
diff --git a/Tests/RunCMake/target_link_options/CMakeLists.txt b/Tests/RunCMake/target_link_options/CMakeLists.txt
new file mode 100644
index 0000000..14ef56e
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.11)
+
+project(${RunCMake_TEST} LANGUAGES NONE)
+
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER-check.cmake b/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER-check.cmake
new file mode 100644
index 0000000..d0ef8de
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER-check.cmake
@@ -0,0 +1,2 @@
+
+include ("${CMAKE_CURRENT_LIST_DIR}/LINKER_expansion-validation.cmake")
diff --git a/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER_SHELL-check.cmake b/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER_SHELL-check.cmake
new file mode 100644
index 0000000..d0ef8de
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER_SHELL-check.cmake
@@ -0,0 +1,2 @@
+
+include ("${CMAKE_CURRENT_LIST_DIR}/LINKER_expansion-validation.cmake")
diff --git a/Tests/RunCMake/target_link_options/LINKER_expansion-validation.cmake b/Tests/RunCMake/target_link_options/LINKER_expansion-validation.cmake
new file mode 100644
index 0000000..1af8f13
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINKER_expansion-validation.cmake
@@ -0,0 +1,15 @@
+
+if (actual_stdout MATCHES "LINKER:")
+ set (RunCMake_TEST_FAILED "LINKER: prefix was not expanded.")
+ return()
+endif()
+
+if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/LINKER.txt")
+ set (RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/LINKER.txt: Reference file not found.")
+ return()
+endif()
+file(READ "${RunCMake_TEST_BINARY_DIR}/LINKER.txt" linker_flag)
+
+if (NOT actual_stdout MATCHES "${linker_flag}")
+ set (RunCMake_TEST_FAILED "LINKER: was not expanded correctly.")
+endif()
diff --git a/Tests/RunCMake/target_link_options/LINKER_expansion.cmake b/Tests/RunCMake/target_link_options/LINKER_expansion.cmake
new file mode 100644
index 0000000..b344867
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINKER_expansion.cmake
@@ -0,0 +1,49 @@
+
+enable_language(C)
+
+add_executable(dump dump.c)
+
+# ensure no temp file will be used
+string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}")
+string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}")
+
+
+# Use LINKER alone
+add_library(linker SHARED LinkOptionsLib.c)
+target_link_options(linker PRIVATE "LINKER:-foo,bar")
+
+# use LAUNCH facility to dump linker command
+set_property(TARGET linker PROPERTY RULE_LAUNCH_LINK "\"${CMAKE_CURRENT_BINARY_DIR}/dump${CMAKE_EXECUTABLE_SUFFIX}\"")
+
+add_dependencies (linker dump)
+
+
+# Use LINKER with SHELL
+add_library(linker_shell SHARED LinkOptionsLib.c)
+target_link_options(linker_shell PRIVATE "LINKER:SHELL:-foo bar")
+
+# use LAUNCH facility to dump linker command
+set_property(TARGET linker_shell PROPERTY RULE_LAUNCH_LINK "\"${CMAKE_CURRENT_BINARY_DIR}/dump${CMAKE_EXECUTABLE_SUFFIX}\"")
+
+add_dependencies (linker_shell dump)
+
+
+# generate reference for LINKER flag
+if (CMAKE_C_LINKER_WRAPPER_FLAG)
+ set(linker_flag ${CMAKE_C_LINKER_WRAPPER_FLAG})
+ list(GET linker_flag -1 linker_space)
+ if (linker_space STREQUAL " ")
+ list(REMOVE_AT linker_flag -1)
+ else()
+ set(linker_space)
+ endif()
+ list (JOIN linker_flag " " linker_flag)
+ if (CMAKE_C_LINKER_WRAPPER_FLAG_SEP)
+ string (APPEND linker_flag "${linker_space}" "-foo${CMAKE_C_LINKER_WRAPPER_FLAG_SEP}bar")
+ else()
+ set (linker_flag "${linker_flag}${linker_space}-foo ${linker_flag}${linker_space}bar")
+ endif()
+else()
+ set(linker_flag "-foo bar")
+endif()
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LINKER.txt" "${linker_flag}")
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-check.cmake
new file mode 100644
index 0000000..7799506
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-check.cmake
@@ -0,0 +1,7 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_PRIVATE")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_PRIVATE'.")
+endif()
+if (actual_stdout MATCHES "BADFLAG_INTERFACE")
+ string (APPEND RunCMake_TEST_FAILED "\nFound unexpected 'BADFLAG_INTERFACE'.")
+endif()
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-check.cmake
new file mode 100644
index 0000000..a686de9
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-check.cmake
@@ -0,0 +1,7 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_RELEASE")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_RELEASE'.")
+endif()
+if (actual_stdout MATCHES "SHELL:")
+ string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.")
+endif()
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-check.cmake
new file mode 100644
index 0000000..6c5ffdb
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-check.cmake
@@ -0,0 +1,4 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_INTERFACE")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_INTERFACE'.")
+endif()
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-check.cmake
new file mode 100644
index 0000000..6c5ffdb
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-check.cmake
@@ -0,0 +1,4 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_INTERFACE")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_INTERFACE'.")
+endif()
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-check.cmake
new file mode 100644
index 0000000..a686de9
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-check.cmake
@@ -0,0 +1,7 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_RELEASE")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_RELEASE'.")
+endif()
+if (actual_stdout MATCHES "SHELL:")
+ string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.")
+endif()
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-check.cmake
new file mode 100644
index 0000000..a686de9
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-check.cmake
@@ -0,0 +1,7 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_RELEASE")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_RELEASE'.")
+endif()
+if (actual_stdout MATCHES "SHELL:")
+ string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.")
+endif()
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-check.cmake
new file mode 100644
index 0000000..b68e451
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-check.cmake
@@ -0,0 +1,7 @@
+
+if (actual_stdout MATCHES "BADFLAG_RELEASE")
+ set (RunCMake_TEST_FAILED "Found 'BADFLAG_RELEASE' which was not expected.")
+endif()
+if (actual_stdout MATCHES "SHELL:")
+ string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.")
+endif()
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake
new file mode 100644
index 0000000..bb04841
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake
@@ -0,0 +1,55 @@
+
+enable_language(C)
+
+set(obj "${CMAKE_C_OUTPUT_EXTENSION}")
+if(BORLAND)
+ set(pre -)
+endif()
+
+# basic configuration
+add_library(LinkOptions SHARED LinkOptionsLib.c)
+target_link_options(LinkOptions
+ PRIVATE ${pre}BADFLAG_PRIVATE${obj}
+ INTERFACE ${pre}BADFLAG_INTERFACE${obj})
+
+
+# INTERFACE_LINK_OPTIONS
+add_library(LinkOptions_producer SHARED LinkOptionsLib.c)
+target_link_options(LinkOptions_producer
+ INTERFACE ${pre}BADFLAG_INTERFACE${obj})
+
+add_executable(LinkOptions_consumer LinkOptionsExe.c)
+target_link_libraries(LinkOptions_consumer PRIVATE LinkOptions_producer)
+
+
+# static library with INTERFACE_LINK_OPTIONS
+add_library(LinkOptions_producer_static STATIC LinkOptionsLib.c)
+target_link_options(LinkOptions_producer_static
+ INTERFACE ${pre}BADFLAG_INTERFACE${obj})
+
+add_executable(LinkOptions_consumer_static LinkOptionsExe.c)
+target_link_libraries(LinkOptions_consumer_static PRIVATE LinkOptions_producer_static)
+
+
+# static library with generator expression
+add_library(LinkOptions_static STATIC LinkOptionsLib.c)
+target_link_options(LinkOptions_static PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>
+ "SHELL:" # produces no options
+ )
+
+
+# shared library with generator expression
+add_library(LinkOptions_shared SHARED LinkOptionsLib.c)
+target_link_options(LinkOptions_shared PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>
+ "SHELL:" # produces no options
+ )
+
+
+# module library with generator expression
+add_library(LinkOptions_mod MODULE LinkOptionsLib.c)
+target_link_options(LinkOptions_mod PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>)
+
+
+# executable with generator expression
+add_executable(LinkOptions_exe LinkOptionsExe.c)
+target_link_options(LinkOptions_exe PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>)
diff --git a/Tests/RunCMake/target_link_options/LinkOptionsExe.c b/Tests/RunCMake/target_link_options/LinkOptionsExe.c
new file mode 100644
index 0000000..8488f4e
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LinkOptionsExe.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/target_link_options/LinkOptionsLib.c b/Tests/RunCMake/target_link_options/LinkOptionsLib.c
new file mode 100644
index 0000000..9bbd24c
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LinkOptionsLib.c
@@ -0,0 +1,7 @@
+#if defined(_WIN32)
+__declspec(dllexport)
+#endif
+ int flags_lib(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake
new file mode 100644
index 0000000..1eaa5d2
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake
@@ -0,0 +1,41 @@
+
+include(RunCMake)
+
+macro(run_cmake_target test subtest target)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(${test}-${subtest} ${CMAKE_COMMAND} --build . --target ${target} ${ARGN})
+
+ unset(RunCMake_TEST_BINARY_DIR)
+ unset(RunCMake_TEST_NO_CLEAN)
+endmacro()
+
+if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
+ # Intel compiler does not reject bad flags or objects!
+ set(RunCMake_TEST_OUTPUT_MERGE TRUE)
+ if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release)
+ endif()
+
+ run_cmake(LINK_OPTIONS)
+
+ run_cmake_target(LINK_OPTIONS basic LinkOptions)
+ run_cmake_target(LINK_OPTIONS interface LinkOptions_consumer)
+ run_cmake_target(LINK_OPTIONS interface-static LinkOptions_consumer_static)
+ run_cmake_target(LINK_OPTIONS static LinkOptions_static --config Release)
+ run_cmake_target(LINK_OPTIONS shared LinkOptions_shared --config Release)
+ run_cmake_target(LINK_OPTIONS mod LinkOptions_mod --config Release)
+ run_cmake_target(LINK_OPTIONS exe LinkOptions_exe --config Release)
+
+ unset(RunCMake_TEST_OPTIONS)
+ unset(RunCMake_TEST_OUTPUT_MERGE)
+endif()
+
+run_cmake(bad_SHELL_usage)
+
+if(RunCMake_GENERATOR MATCHES "(Ninja|Makefile)")
+ run_cmake(LINKER_expansion)
+
+ run_cmake_target(LINKER_expansion LINKER linker)
+ run_cmake_target(LINKER_expansion LINKER_SHELL linker_shell)
+endif()
diff --git a/Tests/RunCMake/target_link_options/bad_SHELL_usage-result.txt b/Tests/RunCMake/target_link_options/bad_SHELL_usage-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/bad_SHELL_usage-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_link_options/bad_SHELL_usage-stderr.txt b/Tests/RunCMake/target_link_options/bad_SHELL_usage-stderr.txt
new file mode 100644
index 0000000..bffd80a
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/bad_SHELL_usage-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at bad_SHELL_usage.cmake:4 \(add_library\):
+ 'SHELL:' prefix is not supported as part of 'LINKER:' arguments.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:5 \(include\)
diff --git a/Tests/RunCMake/target_link_options/bad_SHELL_usage.cmake b/Tests/RunCMake/target_link_options/bad_SHELL_usage.cmake
new file mode 100644
index 0000000..b0adf19
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/bad_SHELL_usage.cmake
@@ -0,0 +1,5 @@
+
+enable_language(C)
+
+add_library(example SHARED LinkOptionsLib.c)
+target_link_options(example PRIVATE "LINKER:-foo,SHELL:-bar")
diff --git a/Tests/RunCMake/target_link_options/dump.c b/Tests/RunCMake/target_link_options/dump.c
new file mode 100644
index 0000000..8baa313
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/dump.c
@@ -0,0 +1,13 @@
+
+#include "stdio.h"
+
+int main(int argc, char* argv[])
+{
+ int i;
+
+ for (i = 1; i < argc; i++)
+ printf("%s ", argv[i]);
+ printf("\n");
+
+ return 0;
+}
diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt
deleted file mode 100644
index a07f687..0000000
--- a/Tests/SimpleInstall/CMakeLists.txt
+++ /dev/null
@@ -1,398 +0,0 @@
-cmake_minimum_required (VERSION 3.9)
-project (TestSimpleInstall)
-set(CMAKE_VERBOSE_MAKEFILE 1)
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
- "${TestSimpleInstall_BINARY_DIR}/bin")
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
- "${TestSimpleInstall_BINARY_DIR}/lib/static")
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
- "${TestSimpleInstall_BINARY_DIR}/lib")
-
-# Skip generating the rpath pointing at the build tree to make sure
-# the executable is installed with the proper rpath in the install
-# tree.
-set(CMAKE_SKIP_BUILD_RPATH 1)
-
-# Make sure the executable can run from the install tree.
-set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
-
-# Skip the dependency that causes a build when installing. This
-# avoids infinite loops when the post-build rule below installs.
-set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1)
-set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY 1)
-
-set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix")
-
-set(EXTRA_INSTALL_FLAGS)
-message("Extra install: ${EXTRA_INSTALL_FLAGS}")
-
-if(STAGE2)
- set(LIBPATHS
- ${CMAKE_INSTALL_PREFIX}/MyTest/lib/static
- ${CMAKE_INSTALL_PREFIX}/MyTest/lib
- )
- set(t1NAMES test1 test1${CMAKE_DEBUG_POSTFIX} test1rel)
- set(t2NAMES test2 test2${CMAKE_DEBUG_POSTFIX})
- set(t4NAMES test4out test4out${CMAKE_DEBUG_POSTFIX})
-
- # Make sure the install script ran.
- set(CMAKE_INSTALL_SCRIPT_DID_RUN 0)
- include(${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake OPTIONAL)
- if(CMAKE_INSTALL_SCRIPT_DID_RUN)
- message(STATUS "Stage 1 did run install script 2.")
- else()
- message(SEND_ERROR "Stage 1 did not run install script 2.")
- endif()
-
- if(CYGWIN OR MINGW)
- set(LIBPATHS ${LIBPATHS} "${CMAKE_INSTALL_PREFIX}/MyTest/bin")
- endif()
- message("Search for library in: ${LIBPATHS}")
-
- set(TEST1_LIBRARY "TEST1_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE)
- set(TEST2_LIBRARY "TEST2_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE)
- set(TEST4_LIBRARY "TEST4_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE)
-
- find_library(TEST1_LIBRARY
- NAMES ${t1NAMES}
- PATHS ${LIBPATHS}
- DOC "First library")
- find_library(TEST2_LIBRARY
- NAMES ${t2NAMES}
- PATHS ${LIBPATHS}
- DOC "Second library")
- find_library(TEST4_LIBRARY
- NAMES ${t4NAMES}
- PATHS ${LIBPATHS}
- DOC "Fourth library")
-
- # Test importing a library found on disk.
- add_library(lib_test4 UNKNOWN IMPORTED)
- set_property(TARGET lib_test4 PROPERTY IMPORTED_LOCATION ${TEST4_LIBRARY})
-
- include_directories(${CMAKE_INSTALL_PREFIX}/MyTest/include)
- add_executable (SimpleInstExeS2 inst2.cxx foo.c foo.h)
- target_link_libraries(SimpleInstExeS2 ${TEST1_LIBRARY} ${TEST2_LIBRARY} lib_test4)
- set(install_target SimpleInstExeS2)
-
- if("${TEST1_LIBRARY}" MATCHES "static")
- message(STATUS "test1 correctly found in lib/static")
- else()
- message(SEND_ERROR "test1 not found in lib/static!")
- endif()
-
- # Check for failure of configuration-specific installation.
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Release/lib1debug.h")
- message(FATAL_ERROR "Debug-configuration file installed for Release!")
- endif()
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Debug/lib1release.h")
- message(FATAL_ERROR "Release-configuration file installed for Debug!")
- endif()
-
- # Check for failure of directory installation.
- if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/TSD.h")
- message(FATAL_ERROR "Directory installation did not install TSD.h")
- endif()
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS")
- message(FATAL_ERROR "Directory installation installed CVS directory.")
- endif()
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS")
- message(FATAL_ERROR "Directory installation installed CVS directory.")
- endif()
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CMakeLists.txt")
- message(FATAL_ERROR "Directory installation installed CMakeLists.txt.")
- endif()
- if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.h")
- message(FATAL_ERROR "Directory installation did not install alternate TSD.h")
- endif()
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.cxx")
- message(FATAL_ERROR "Directory installation installed alternate TSD.cxx")
- endif()
-
- # Check that scripts properly installed.
- if(WIN32 AND NOT CYGWIN)
- set(BAT .bat)
- else()
- set(BAT)
- endif()
- foreach(loc share share/old1 share/old2 share/old3 share/alt)
- set(CUR_SCRIPT "${CMAKE_INSTALL_PREFIX}/MyTest/${loc}/sample_script${BAT}")
- execute_process(
- COMMAND ${CUR_SCRIPT}
- RESULT_VARIABLE SAMPLE_SCRIPT_RESULT
- OUTPUT_VARIABLE SAMPLE_SCRIPT_OUTPUT
- )
- if(NOT "${SAMPLE_SCRIPT_RESULT}" STREQUAL "0")
- message(FATAL_ERROR
- "Sample script [${CUR_SCRIPT}] failed: [${SAMPLE_SCRIPT_RESULT}]")
- endif()
- if(NOT "${SAMPLE_SCRIPT_OUTPUT}" MATCHES "Sample Script Output")
- message(FATAL_ERROR
- "Bad sample script [${CUR_SCRIPT}] output: [${SAMPLE_SCRIPT_OUTPUT}]")
- endif()
- endforeach()
-
- # Check for failure of empty directory installation.
- if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty")
- message(FATAL_ERROR "Empty directory installation did not install.")
- endif()
- file(GLOB EMPTY_FILES "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty/*")
- if(EMPTY_FILES)
- message(FATAL_ERROR "Empty directory installed [${EMPTY_FILES}].")
- endif()
-
- # Make sure the test executable can run from the install tree.
- set_target_properties(SimpleInstExeS2 PROPERTIES
- INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
-
- install_targets(/MyTest/bin SimpleInstExeS2)
-
-# try to import the exported targets again
- set(SimpleInstallS1_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
- find_package(SimpleInstallS1 REQUIRED)
- get_target_property(simpleInstallImported S1_SimpleInstall IMPORTED)
- if(NOT simpleInstallImported)
- message(FATAL_ERROR "Target S1_SimpleInstall could not be imported")
- endif()
-
-else()
- # Wipe out the install directory to do a fresh test.
- file(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/MyTest)
-
- # this is stage 1, so create libraries and modules and install everything
- add_library(test1 STATIC lib1.cxx)
- add_library(test2 SHARED lib2.cxx)
- add_library(test3 MODULE lib3.cxx)
- add_library(test4 SHARED lib4.cxx)
-
- # Test <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME properties.
- set_property(TARGET test4 PROPERTY ARCHIVE_OUTPUT_NAME test4out)
- set_property(TARGET test4 PROPERTY LIBRARY_OUTPUT_NAME test4out)
-
- add_executable (SimpleInstall inst.cxx foo.c foo.h)
- target_link_libraries(SimpleInstall test1 test2 test4)
- set(install_target SimpleInstall)
-
- set_target_properties(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe)
- # Disable VERSION test until it is implemented in the Xcode generator.
- if(NOT XCODE)
- set_target_properties(SimpleInstall PROPERTIES VERSION 1.2)
- endif()
-
- # Make sure the test executable can run from the install tree.
- set_target_properties(SimpleInstall PROPERTIES
- INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
-
- # Test per-configuration output name.
- set_target_properties(test1 PROPERTIES RELEASE_OUTPUT_NAME test1rel)
- set_target_properties(test2 PROPERTIES PUBLIC_HEADER foo.h)
-
- if(CMAKE_GENERATOR MATCHES "Makefiles")
- add_subdirectory(TestSubDir)
- add_dependencies(SimpleInstall TSD)
- endif()
-
- add_dependencies(SimpleInstall test3)
- add_dependencies(test2 test3)
- add_dependencies(test4 test2)
-
- install(TARGETS SimpleInstall test1 test2 test3 EXPORT SimpleInstallS1
- RUNTIME DESTINATION MyTest/bin COMPONENT Runtime # .exe, .dll
- LIBRARY DESTINATION MyTest/lib COMPONENT Runtime # .so, mod.dll
- ARCHIVE DESTINATION MyTest/lib/static COMPONENT Development # .a, .lib
- PUBLIC_HEADER DESTINATION MyTest/include COMPONENT Development
- )
-
- install(TARGETS test4 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
- RUNTIME DESTINATION MyTest/bin
- LIBRARY DESTINATION MyTest/lib
- ARCHIVE DESTINATION MyTest/lib/static
- OPTIONAL # for coverage...target should always exist
- )
- install(FILES lib1.h DESTINATION MyTest/include/$<1:foo>$<0:/wrong>)
- install(FILES lib2.h
- DESTINATION $<1:MyTest/include/foo>$<0:/wrong>
- COMPONENT Development
- PERMISSIONS OWNER_READ OWNER_WRITE
- RENAME lib2renamed.h
- )
-
- # Test old-style install commands.
- install_files(/MyTest/include FILES lib3.h)
- install_files(/MyTest/include/old .h lib3)
- install_files(/MyTest/include/old "^lib2.h$")
- install_programs(/MyTest/share/old1 FILES
- scripts/sample_script scripts/sample_script.bat)
- install_programs(/MyTest/share/old2
- scripts/sample_script scripts/sample_script.bat)
-
-# "export" the targets collected in "SimpleInstallS1"
- install(EXPORT SimpleInstallS1 FILE SimpleInstallS1Config.cmake
- DESTINATION MyTest/lib
- NAMESPACE S1_ )
-
- export(TARGETS SimpleInstall test1 test2 test3
- FILE "${CMAKE_CURRENT_BINARY_DIR}/SimpleInstallS1Config.cmake"
- NAMESPACE S2_ )
-
- add_subdirectory(scripts)
-
- # Test optional installation.
- install(FILES does_not_exist.h DESTINATION MyTest/include/foo OPTIONAL)
-
- # Test configuration-specific installation.
- install(FILES lib1.h RENAME lib1release.h CONFIGURATIONS Release
- DESTINATION MyTest/include/Release
- )
- install(FILES lib1.h RENAME lib1debug.h CONFIGURATIONS Debug
- DESTINATION MyTest/include/Debug
- )
-
- # Test directory installation.
- file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS")
- file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS")
- install(
- DIRECTORY TestSubDir $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share>$<0:/wrong>
- FILE_PERMISSIONS OWNER_READ OWNER_WRITE
- DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
- GROUP_READ GROUP_EXECUTE
- PATTERN "CVS" EXCLUDE
- REGEX "\\.txt$" EXCLUDE
- PATTERN "scripts/*" PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
- )
-
- # Alternate directory installation for coverage.
- install(
- DIRECTORY $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share/alt>$<0:/wrong>
- COMPONENT Development
- USE_SOURCE_PERMISSIONS
- PATTERN "CVS" EXCLUDE
- REGEX "\\.txt$" EXCLUDE
- )
- install(
- DIRECTORY TestSubDir DESTINATION $<1:MyTest/share/alt>$<0:/wrong>
- FILE_PERMISSIONS OWNER_READ OWNER_WRITE
- DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
- GROUP_READ GROUP_EXECUTE
- FILES_MATCHING PATTERN "*.h"
- )
-
- # Test empty directory installation.
- install(DIRECTORY DESTINATION MyTest/share/empty)
-
- # Test optional directory installation.
- install(DIRECTORY does-not-exist DESTINATION MyTest/share OPTIONAL)
-
- # Test user-specified install scripts, with and without COMPONENT.
- install(
- SCRIPT InstallScript1.cmake
- CODE "set(INSTALL_CODE_DID_RUN 1)"
- SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript2.cmake
- )
- install(
- SCRIPT InstallScript3.cmake
- CODE "set(INSTALL_CODE_WITH_COMPONENT_DID_RUN 1)"
- SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript4.cmake
- COMPONENT Development
- )
- set_directory_properties(PROPERTIES
- ADDITIONAL_MAKE_CLEAN_FILES
- "${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake;${CMAKE_INSTALL_PREFIX}/InstallScript4Out.cmake")
-
- set_target_properties(SimpleInstall PROPERTIES PRE_INSTALL_SCRIPT
- ${CMAKE_CURRENT_SOURCE_DIR}/PreInstall.cmake)
- set_target_properties(SimpleInstall PROPERTIES POST_INSTALL_SCRIPT
- ${CMAKE_CURRENT_SOURCE_DIR}/PostInstall.cmake)
- set_target_properties(test4 PROPERTIES VERSION 1.2 SOVERSION 3
- INSTALL_NAME_DIR @executable_path/../lib)
-endif()
-
-get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
-if(_isMultiConfig)
- set(SI_CONFIG --config $<CONFIGURATION>)
-else()
- set(SI_CONFIG)
-endif()
-
-# Dummy test of CPack
-set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Test of packaging with cpack")
-set(CPACK_PACKAGE_VENDOR "Kitware")
-set(CPACK_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/PackageScript.cmake")
-
-if(WIN32 AND NOT UNIX)
- find_program(NSIS_MAKENSIS NAMES makensis
- PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS]
- DOC "Where is makensis.exe located"
- )
- if(NOT NSIS_MAKENSIS)
- set(CPACK_GENERATOR TGZ)
- endif()
-endif()
-if(UNIX AND NOT APPLE)
- set(CPACK_GENERATOR "TGZ;STGZ;TZ")
- # find_program(found_compress
- # NAMES compress)
- # if(found_compress)
- # find_program(file_command NAMES file)
- # if(NOT file_command)
- # set(file_command file)
- # endif()
- # execute_process(COMMAND ${file_command} ${found_compress}
- # OUTPUT_VARIABLE output)
- # set(SKIP_TZ FALSE)
- # if("${output}" MATCHES "script")
- # set(SKIP_TZ TRUE)
- # endif()
- # if("${output}" MATCHES "dummy.sh")
- # set(SKIP_TZ TRUE)
- # endif()
- # if(NOT SKIP_TZ)
- # message("compress found and it was not a script")
- # message("output from file command: [${output}]")
- # list(APPEND CPACK_GENERATOR "TZ")
- # else()
- # message("compress found, but it was a script so don't use it")
- # message("output from file command: [${output}]")
- # endif()
- # endif()
- find_program(found_bz2
- NAMES bzip2)
- if(found_bz2)
- list(APPEND CPACK_GENERATOR "TBZ2")
- endif()
-endif()
-
-set(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install")
-set(CMAKE_INSTALL_MFC_LIBRARIES 1)
-set(CMAKE_INSTALL_DEBUG_LIBRARIES 1)
-set(CMAKE_INSTALL_UCRT_LIBRARIES 1)
-set(CMAKE_INSTALL_OPENMP_LIBRARIES 1)
-include(InstallRequiredSystemLibraries)
-
-if(CTEST_TEST_CPACK)
- set(package_command COMMAND
- ${CMAKE_COMMAND} --build . --target package ${SI_CONFIG}
- )
-
- # Avoid settings that require the .zip file command line tools...
- # (just build an NSIS installer without component support)
- #
- set(CPACK_BINARY_ZIP OFF)
- set(CPACK_MONOLITHIC_INSTALL ON)
-else()
- set(package_command)
-endif()
-
-include(CPack)
-
-set(install_command COMMAND
- ${CMAKE_COMMAND} --build . --target install ${SI_CONFIG}
- )
-
-add_custom_command(
- TARGET ${install_target}
- POST_BUILD
- ${install_command}
- ${package_command}
- COMMENT "Install Project"
- )
diff --git a/Tests/SimpleInstall/InstallScript1.cmake b/Tests/SimpleInstall/InstallScript1.cmake
deleted file mode 100644
index ef9da57..0000000
--- a/Tests/SimpleInstall/InstallScript1.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-message("This is install script 1.")
-set(INSTALL_SCRIPT_1_DID_RUN 1)
-if(INSTALL_CODE_DID_RUN)
- message(FATAL_ERROR "Install script 1 did not run before install code.")
-endif()
diff --git a/Tests/SimpleInstall/InstallScript2.cmake b/Tests/SimpleInstall/InstallScript2.cmake
deleted file mode 100644
index c1d20a3..0000000
--- a/Tests/SimpleInstall/InstallScript2.cmake
+++ /dev/null
@@ -1,14 +0,0 @@
-message("This is install script 2.")
-if(INSTALL_SCRIPT_1_DID_RUN)
- message("Install script ordering works.")
-else()
- message(FATAL_ERROR "Install script 1 did not run before install script 2.")
-endif()
-if(INSTALL_CODE_DID_RUN)
- message("Install code ordering works.")
-else()
- message(FATAL_ERROR "Install script 2 did not run after install code.")
-endif()
-file(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake"
- "set(CMAKE_INSTALL_SCRIPT_DID_RUN 1)\n"
- )
diff --git a/Tests/SimpleInstall/InstallScript3.cmake b/Tests/SimpleInstall/InstallScript3.cmake
deleted file mode 100644
index 6485156..0000000
--- a/Tests/SimpleInstall/InstallScript3.cmake
+++ /dev/null
@@ -1,12 +0,0 @@
-message("This is install script 3.")
-set(INSTALL_SCRIPT_3_DID_RUN 1)
-if(INSTALL_CODE_WITH_COMPONENT_DID_RUN)
- message(FATAL_ERROR "Install script 3 did not run before install code with component.")
-endif()
-
-if(CMAKE_INSTALL_COMPONENT)
-if(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development")
- message("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"")
- message(FATAL_ERROR "Install script 3 should only run for \"Development\" INSTALL COMPONENT.")
-endif()
-endif()
diff --git a/Tests/SimpleInstall/InstallScript4.cmake b/Tests/SimpleInstall/InstallScript4.cmake
deleted file mode 100644
index 34d0a73..0000000
--- a/Tests/SimpleInstall/InstallScript4.cmake
+++ /dev/null
@@ -1,22 +0,0 @@
-message("This is install script 4.")
-if(INSTALL_SCRIPT_3_DID_RUN)
- message("Install script ordering works.")
-else()
- message(FATAL_ERROR "Install script 3 did not run before install script 4.")
-endif()
-if(INSTALL_CODE_WITH_COMPONENT_DID_RUN)
- message("Install code ordering works.")
-else()
- message(FATAL_ERROR "Install script 4 did not run after install with component code.")
-endif()
-
-if(CMAKE_INSTALL_COMPONENT)
-if(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development")
- message("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"")
- message(FATAL_ERROR "Install script 4 should only run for \"Development\" INSTALL COMPONENT.")
-endif()
-endif()
-
-file(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScript4Out.cmake"
- "set(CMAKE_INSTALL_SCRIPT_4_DID_RUN 1)\n"
- )
diff --git a/Tests/SimpleInstall/PackageScript.cmake b/Tests/SimpleInstall/PackageScript.cmake
deleted file mode 100644
index 53b7909..0000000
--- a/Tests/SimpleInstall/PackageScript.cmake
+++ /dev/null
@@ -1,10 +0,0 @@
-message("This is packaging script")
-message("It writes a file with all variables available in ${CMAKE_INSTALL_PREFIX}/AllVariables.txt")
-
-file(WRITE ${CMAKE_INSTALL_PREFIX}/AllVariables.txt "")
-get_cmake_property(res VARIABLES)
-foreach(var ${res})
- file(APPEND ${CMAKE_INSTALL_PREFIX}/AllVariables.txt
- "${var} \"${${var}}\"\n")
-endforeach()
-
diff --git a/Tests/SimpleInstall/PostInstall.cmake b/Tests/SimpleInstall/PostInstall.cmake
deleted file mode 100644
index d616221..0000000
--- a/Tests/SimpleInstall/PostInstall.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-message("In post install")
-if(PRE_INSTALL_DID_RUN)
- message("Pre and post install work fine")
-else()
- message(FATAL_ERROR "Pre install did not run before post install")
-endif()
diff --git a/Tests/SimpleInstall/PreInstall.cmake b/Tests/SimpleInstall/PreInstall.cmake
deleted file mode 100644
index 7a9851e..0000000
--- a/Tests/SimpleInstall/PreInstall.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-message("This is in pre install")
-set(PRE_INSTALL_DID_RUN 1)
diff --git a/Tests/SimpleInstall/TestSubDir/CMakeLists.txt b/Tests/SimpleInstall/TestSubDir/CMakeLists.txt
deleted file mode 100644
index 860e104..0000000
--- a/Tests/SimpleInstall/TestSubDir/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-add_executable(TSD TSD.cxx TSD_utils.cxx)
-install_files(/MyTest/include FILES TSD.h)
-install_targets(/MyTest/bin TSD)
diff --git a/Tests/SimpleInstall/TestSubDir/TSD.cxx b/Tests/SimpleInstall/TestSubDir/TSD.cxx
deleted file mode 100644
index 8fc3878..0000000
--- a/Tests/SimpleInstall/TestSubDir/TSD.cxx
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <stdio.h>
-
-#include "TSD.h"
-
-int main()
-{
- int res = TSD("TEST");
- printf("Hello from TSD\n");
- return res;
-}
diff --git a/Tests/SimpleInstall/TestSubDir/TSD.h b/Tests/SimpleInstall/TestSubDir/TSD.h
deleted file mode 100644
index 6a3c1af..0000000
--- a/Tests/SimpleInstall/TestSubDir/TSD.h
+++ /dev/null
@@ -1 +0,0 @@
-int TSD(const char*);
diff --git a/Tests/SimpleInstall/TestSubDir/TSD_utils.cxx b/Tests/SimpleInstall/TestSubDir/TSD_utils.cxx
deleted file mode 100644
index 0f32894..0000000
--- a/Tests/SimpleInstall/TestSubDir/TSD_utils.cxx
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <string.h>
-
-int TSD(const char* foo)
-{
- if (strcmp(foo, "TEST") == 0) {
- return 0;
- }
- return 1;
-}
diff --git a/Tests/SimpleInstall/foo.c b/Tests/SimpleInstall/foo.c
deleted file mode 100644
index 45d5b2b..0000000
--- a/Tests/SimpleInstall/foo.c
+++ /dev/null
@@ -1,6 +0,0 @@
-char* foo = "Foo";
-
-int SomeFunctionInFoo()
-{
- return 5;
-}
diff --git a/Tests/SimpleInstall/foo.h b/Tests/SimpleInstall/foo.h
deleted file mode 100644
index 216cdf6..0000000
--- a/Tests/SimpleInstall/foo.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern char* foo;
-extern int SomeFunctionInFoo();
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/Tests/SimpleInstall/inst.cxx b/Tests/SimpleInstall/inst.cxx
deleted file mode 100644
index 7815f86..0000000
--- a/Tests/SimpleInstall/inst.cxx
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "foo.h"
-
-#ifdef STAGE_2
-# include <foo/lib1.h>
-# include <foo/lib2renamed.h>
-# include <lib3.h>
-# include <old/lib2.h>
-# include <old/lib3.h>
-#else
-# include "lib1.h"
-# include "lib2.h"
-#endif
-
-#include "lib4.h"
-
-#include <stdio.h>
-
-int main()
-{
- if (Lib1Func() != 2.0) {
- printf("Problem with lib1\n");
- return 1;
- }
- if (Lib2Func() != 1.0) {
- printf("Problem with lib2\n");
- return 1;
- }
- if (Lib4Func() != 4.0) {
- printf("Problem with lib4\n");
- return 1;
- }
- printf("The value of Foo: %s\n", foo);
- return SomeFunctionInFoo() - 5;
-}
diff --git a/Tests/SimpleInstall/inst2.cxx b/Tests/SimpleInstall/inst2.cxx
deleted file mode 100644
index c70b93a..0000000
--- a/Tests/SimpleInstall/inst2.cxx
+++ /dev/null
@@ -1,2 +0,0 @@
-#define STAGE_2
-#include "inst.cxx"
diff --git a/Tests/SimpleInstall/lib1.cxx b/Tests/SimpleInstall/lib1.cxx
deleted file mode 100644
index 7aa9052..0000000
--- a/Tests/SimpleInstall/lib1.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "lib1.h"
-
-float Lib1Func()
-{
- return 2.0;
-}
diff --git a/Tests/SimpleInstall/lib1.h b/Tests/SimpleInstall/lib1.h
deleted file mode 100644
index 0d64e76..0000000
--- a/Tests/SimpleInstall/lib1.h
+++ /dev/null
@@ -1 +0,0 @@
-extern float Lib1Func();
diff --git a/Tests/SimpleInstall/lib2.cxx b/Tests/SimpleInstall/lib2.cxx
deleted file mode 100644
index dccc48b..0000000
--- a/Tests/SimpleInstall/lib2.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "lib2.h"
-
-float Lib2Func()
-{
- return 1.0;
-}
diff --git a/Tests/SimpleInstall/lib2.h b/Tests/SimpleInstall/lib2.h
deleted file mode 100644
index 044e775..0000000
--- a/Tests/SimpleInstall/lib2.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifdef _WIN32
-# ifdef test2_EXPORTS
-# define CM_TEST_LIB_EXPORT __declspec(dllexport)
-# else
-# define CM_TEST_LIB_EXPORT __declspec(dllimport)
-# endif
-#else
-# define CM_TEST_LIB_EXPORT
-#endif
-
-CM_TEST_LIB_EXPORT float Lib2Func();
diff --git a/Tests/SimpleInstall/lib3.cxx b/Tests/SimpleInstall/lib3.cxx
deleted file mode 100644
index da8dbf9..0000000
--- a/Tests/SimpleInstall/lib3.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "lib3.h"
-
-float Lib3Func()
-{
- return 2.0;
-}
diff --git a/Tests/SimpleInstall/lib3.h b/Tests/SimpleInstall/lib3.h
deleted file mode 100644
index e02bbc4..0000000
--- a/Tests/SimpleInstall/lib3.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifdef _WIN32
-# ifdef test3_EXPORTS
-# define CM_TEST_LIB_EXPORT __declspec(dllexport)
-# else
-# define CM_TEST_LIB_EXPORT __declspec(dllimport)
-# endif
-#else
-# define CM_TEST_LIB_EXPORT
-#endif
-
-CM_TEST_LIB_EXPORT float Lib3Func();
diff --git a/Tests/SimpleInstall/lib4.cxx b/Tests/SimpleInstall/lib4.cxx
deleted file mode 100644
index fbede5c..0000000
--- a/Tests/SimpleInstall/lib4.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "lib4.h"
-
-float Lib4Func()
-{
- return 4.0;
-}
diff --git a/Tests/SimpleInstall/lib4.h b/Tests/SimpleInstall/lib4.h
deleted file mode 100644
index e1a221e..0000000
--- a/Tests/SimpleInstall/lib4.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifdef _WIN32
-# ifdef test4_EXPORTS
-# define CM_TEST_LIB_EXPORT __declspec(dllexport)
-# else
-# define CM_TEST_LIB_EXPORT __declspec(dllimport)
-# endif
-#else
-# define CM_TEST_LIB_EXPORT
-#endif
-
-CM_TEST_LIB_EXPORT float Lib4Func();
diff --git a/Tests/SimpleInstall/scripts/.gitattributes b/Tests/SimpleInstall/scripts/.gitattributes
deleted file mode 100644
index 5e3db2f..0000000
--- a/Tests/SimpleInstall/scripts/.gitattributes
+++ /dev/null
@@ -1 +0,0 @@
-sample_script crlf=input
diff --git a/Tests/SimpleInstall/scripts/CMakeLists.txt b/Tests/SimpleInstall/scripts/CMakeLists.txt
deleted file mode 100644
index ec34e8c..0000000
--- a/Tests/SimpleInstall/scripts/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-install_programs(/MyTest/share/old3 "^sample_script(\\.bat)?$")
diff --git a/Tests/SimpleInstall/scripts/sample_script b/Tests/SimpleInstall/scripts/sample_script
deleted file mode 100755
index 81f9f53..0000000
--- a/Tests/SimpleInstall/scripts/sample_script
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-echo "Sample Script Output"
diff --git a/Tests/SimpleInstall/scripts/sample_script.bat b/Tests/SimpleInstall/scripts/sample_script.bat
deleted file mode 100755
index a9af38c..0000000
--- a/Tests/SimpleInstall/scripts/sample_script.bat
+++ /dev/null
@@ -1 +0,0 @@
-@echo Sample Script Output
diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt
deleted file mode 100644
index 22150ca..0000000
--- a/Tests/SimpleInstallS2/CMakeLists.txt
+++ /dev/null
@@ -1,397 +0,0 @@
-cmake_minimum_required (VERSION 3.9)
-project (TestSimpleInstall)
-set(CMAKE_VERBOSE_MAKEFILE 1)
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
- "${TestSimpleInstall_BINARY_DIR}/bin")
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
- "${TestSimpleInstall_BINARY_DIR}/lib/static")
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
- "${TestSimpleInstall_BINARY_DIR}/lib")
-
-# Skip generating the rpath pointing at the build tree to make sure
-# the executable is installed with the proper rpath in the install
-# tree.
-set(CMAKE_SKIP_BUILD_RPATH 1)
-
-# Make sure the executable can run from the install tree.
-set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
-
-# Skip the dependency that causes a build when installing. This
-# avoids infinite loops when the post-build rule below installs.
-set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1)
-set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY 1)
-
-set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix")
-
-set(EXTRA_INSTALL_FLAGS)
-message("Extra install: ${EXTRA_INSTALL_FLAGS}")
-
-if(STAGE2)
- set(LIBPATHS
- ${CMAKE_INSTALL_PREFIX}/MyTest/lib/static
- ${CMAKE_INSTALL_PREFIX}/MyTest/lib
- )
- set(t1NAMES test1 test1${CMAKE_DEBUG_POSTFIX} test1rel)
- set(t2NAMES test2 test2${CMAKE_DEBUG_POSTFIX})
- set(t4NAMES test4out test4out${CMAKE_DEBUG_POSTFIX})
-
- # Make sure the install script ran.
- set(CMAKE_INSTALL_SCRIPT_DID_RUN 0)
- include(${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake OPTIONAL)
- if(CMAKE_INSTALL_SCRIPT_DID_RUN)
- message(STATUS "Stage 1 did run install script 2.")
- else()
- message(SEND_ERROR "Stage 1 did not run install script 2.")
- endif()
-
- if(CYGWIN OR MINGW)
- set(LIBPATHS ${LIBPATHS} "${CMAKE_INSTALL_PREFIX}/MyTest/bin")
- endif()
- message("Search for library in: ${LIBPATHS}")
-
- set(TEST1_LIBRARY "TEST1_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE)
- set(TEST2_LIBRARY "TEST2_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE)
- set(TEST4_LIBRARY "TEST4_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE)
-
- find_library(TEST1_LIBRARY
- NAMES ${t1NAMES}
- PATHS ${LIBPATHS}
- DOC "First library")
- find_library(TEST2_LIBRARY
- NAMES ${t2NAMES}
- PATHS ${LIBPATHS}
- DOC "Second library")
- find_library(TEST4_LIBRARY
- NAMES ${t4NAMES}
- PATHS ${LIBPATHS}
- DOC "Fourth library")
-
- # Test importing a library found on disk.
- add_library(lib_test4 UNKNOWN IMPORTED)
- set_property(TARGET lib_test4 PROPERTY IMPORTED_LOCATION ${TEST4_LIBRARY})
-
- include_directories(${CMAKE_INSTALL_PREFIX}/MyTest/include)
- add_executable (SimpleInstExeS2 inst2.cxx foo.c foo.h)
- target_link_libraries(SimpleInstExeS2 ${TEST1_LIBRARY} ${TEST2_LIBRARY} lib_test4)
- set(install_target SimpleInstExeS2)
-
- if("${TEST1_LIBRARY}" MATCHES "static")
- message(STATUS "test1 correctly found in lib/static")
- else()
- message(SEND_ERROR "test1 not found in lib/static!")
- endif()
-
- # Check for failure of configuration-specific installation.
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Release/lib1debug.h")
- message(FATAL_ERROR "Debug-configuration file installed for Release!")
- endif()
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Debug/lib1release.h")
- message(FATAL_ERROR "Release-configuration file installed for Debug!")
- endif()
-
- # Check for failure of directory installation.
- if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/TSD.h")
- message(FATAL_ERROR "Directory installation did not install TSD.h")
- endif()
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS")
- message(FATAL_ERROR "Directory installation installed CVS directory.")
- endif()
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS")
- message(FATAL_ERROR "Directory installation installed CVS directory.")
- endif()
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CMakeLists.txt")
- message(FATAL_ERROR "Directory installation installed CMakeLists.txt.")
- endif()
- if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.h")
- message(FATAL_ERROR "Directory installation did not install alternate TSD.h")
- endif()
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.cxx")
- message(FATAL_ERROR "Directory installation installed alternate TSD.cxx")
- endif()
-
- # Check that scripts properly installed.
- if(WIN32 AND NOT CYGWIN)
- set(BAT .bat)
- else()
- set(BAT)
- endif()
- foreach(loc share share/old1 share/old2 share/old3 share/alt)
- set(CUR_SCRIPT "${CMAKE_INSTALL_PREFIX}/MyTest/${loc}/sample_script${BAT}")
- execute_process(
- COMMAND ${CUR_SCRIPT}
- RESULT_VARIABLE SAMPLE_SCRIPT_RESULT
- OUTPUT_VARIABLE SAMPLE_SCRIPT_OUTPUT
- )
- if(NOT "${SAMPLE_SCRIPT_RESULT}" STREQUAL "0")
- message(FATAL_ERROR
- "Sample script [${CUR_SCRIPT}] failed: [${SAMPLE_SCRIPT_RESULT}]")
- endif()
- if(NOT "${SAMPLE_SCRIPT_OUTPUT}" MATCHES "Sample Script Output")
- message(FATAL_ERROR
- "Bad sample script [${CUR_SCRIPT}] output: [${SAMPLE_SCRIPT_OUTPUT}]")
- endif()
- endforeach()
-
- # Check for failure of empty directory installation.
- if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty")
- message(FATAL_ERROR "Empty directory installation did not install.")
- endif()
- file(GLOB EMPTY_FILES "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty/*")
- if(EMPTY_FILES)
- message(FATAL_ERROR "Empty directory installed [${EMPTY_FILES}].")
- endif()
-
- # Make sure the test executable can run from the install tree.
- set_target_properties(SimpleInstExeS2 PROPERTIES
- INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
-
- install_targets(/MyTest/bin SimpleInstExeS2)
-
-# try to import the exported targets again
- set(SimpleInstallS1_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
- find_package(SimpleInstallS1 REQUIRED)
- get_target_property(simpleInstallImported S1_SimpleInstall IMPORTED)
- if(NOT simpleInstallImported)
- message(FATAL_ERROR "Target S1_SimpleInstall could not be imported")
- endif()
-
-else()
- # Wipe out the install directory to do a fresh test.
- file(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/MyTest)
-
- # this is stage 1, so create libraries and modules and install everything
- add_library(test1 STATIC lib1.cxx)
- add_library(test2 SHARED lib2.cxx)
- add_library(test3 MODULE lib3.cxx)
- add_library(test4 SHARED lib4.cxx)
-
- # Test <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME properties.
- set_property(TARGET test4 PROPERTY ARCHIVE_OUTPUT_NAME test4out)
- set_property(TARGET test4 PROPERTY LIBRARY_OUTPUT_NAME test4out)
-
- add_executable (SimpleInstall inst.cxx foo.c foo.h)
- target_link_libraries(SimpleInstall test1 test2 test4)
- set(install_target SimpleInstall)
-
- set_target_properties(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe)
- # Disable VERSION test until it is implemented in the Xcode generator.
- if(NOT XCODE)
- set_target_properties(SimpleInstall PROPERTIES VERSION 1.2)
- endif()
-
- # Make sure the test executable can run from the install tree.
- set_target_properties(SimpleInstall PROPERTIES
- INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
-
- # Test per-configuration output name.
- set_target_properties(test1 PROPERTIES RELEASE_OUTPUT_NAME test1rel)
- set_target_properties(test2 PROPERTIES PUBLIC_HEADER foo.h)
-
- if(CMAKE_GENERATOR MATCHES "Makefiles")
- add_subdirectory(TestSubDir)
- add_dependencies(SimpleInstall TSD)
- endif()
-
- add_dependencies(SimpleInstall test3)
- add_dependencies(test2 test3)
- add_dependencies(test4 test2)
-
- install(TARGETS SimpleInstall test1 test2 test3 EXPORT SimpleInstallS1
- RUNTIME DESTINATION MyTest/bin COMPONENT Runtime # .exe, .dll
- LIBRARY DESTINATION MyTest/lib COMPONENT Runtime # .so, mod.dll
- ARCHIVE DESTINATION MyTest/lib/static COMPONENT Development # .a, .lib
- PUBLIC_HEADER DESTINATION MyTest/include COMPONENT Development
- )
-
- install(TARGETS test4 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
- RUNTIME DESTINATION MyTest/bin
- LIBRARY DESTINATION MyTest/lib
- ARCHIVE DESTINATION MyTest/lib/static
- OPTIONAL # for coverage...target should always exist
- )
- install(FILES lib1.h DESTINATION MyTest/include/$<1:foo>$<0:/wrong>)
- install(FILES lib2.h
- DESTINATION $<1:MyTest/include/foo>$<0:/wrong>
- COMPONENT Development
- PERMISSIONS OWNER_READ OWNER_WRITE
- RENAME lib2renamed.h
- )
-
- # Test old-style install commands.
- install_files(/MyTest/include FILES lib3.h)
- install_files(/MyTest/include/old .h lib3)
- install_files(/MyTest/include/old "^lib2.h$")
- install_programs(/MyTest/share/old1 FILES
- scripts/sample_script scripts/sample_script.bat)
- install_programs(/MyTest/share/old2
- scripts/sample_script scripts/sample_script.bat)
-
-# "export" the targets collected in "SimpleInstallS1"
- install(EXPORT SimpleInstallS1 FILE SimpleInstallS1Config.cmake
- DESTINATION MyTest/lib
- NAMESPACE S1_ )
-
- export(TARGETS SimpleInstall test1 test2 test3
- FILE "${CMAKE_CURRENT_BINARY_DIR}/SimpleInstallS1Config.cmake"
- NAMESPACE S2_ )
-
- add_subdirectory(scripts)
-
- # Test optional installation.
- install(FILES does_not_exist.h DESTINATION MyTest/include/foo OPTIONAL)
-
- # Test configuration-specific installation.
- install(FILES lib1.h RENAME lib1release.h CONFIGURATIONS Release
- DESTINATION MyTest/include/Release
- )
- install(FILES lib1.h RENAME lib1debug.h CONFIGURATIONS Debug
- DESTINATION MyTest/include/Debug
- )
-
- # Test directory installation.
- file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS")
- file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS")
- install(
- DIRECTORY TestSubDir $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share>$<0:/wrong>
- FILE_PERMISSIONS OWNER_READ OWNER_WRITE
- DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
- GROUP_READ GROUP_EXECUTE
- PATTERN "CVS" EXCLUDE
- REGEX "\\.txt$" EXCLUDE
- PATTERN "scripts/*" PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
- )
-
- # Alternate directory installation for coverage.
- install(
- DIRECTORY $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share/alt>$<0:/wrong>
- COMPONENT Development
- USE_SOURCE_PERMISSIONS
- PATTERN "CVS" EXCLUDE
- REGEX "\\.txt$" EXCLUDE
- )
- install(
- DIRECTORY TestSubDir DESTINATION $<1:MyTest/share/alt>$<0:/wrong>
- FILE_PERMISSIONS OWNER_READ OWNER_WRITE
- DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
- GROUP_READ GROUP_EXECUTE
- FILES_MATCHING PATTERN "*.h"
- )
-
- # Test empty directory installation.
- install(DIRECTORY DESTINATION MyTest/share/empty)
-
- # Test optional directory installation.
- install(DIRECTORY does-not-exist DESTINATION MyTest/share OPTIONAL)
-
- # Test user-specified install scripts, with and without COMPONENT.
- install(
- SCRIPT InstallScript1.cmake
- CODE "set(INSTALL_CODE_DID_RUN 1)"
- SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript2.cmake
- )
- install(
- SCRIPT InstallScript3.cmake
- CODE "set(INSTALL_CODE_WITH_COMPONENT_DID_RUN 1)"
- SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript4.cmake
- COMPONENT Development
- )
- set_directory_properties(PROPERTIES
- ADDITIONAL_MAKE_CLEAN_FILES
- "${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake;${CMAKE_INSTALL_PREFIX}/InstallScript4Out.cmake")
-
- set_target_properties(SimpleInstall PROPERTIES PRE_INSTALL_SCRIPT
- ${CMAKE_CURRENT_SOURCE_DIR}/PreInstall.cmake)
- set_target_properties(SimpleInstall PROPERTIES POST_INSTALL_SCRIPT
- ${CMAKE_CURRENT_SOURCE_DIR}/PostInstall.cmake)
- set_target_properties(test4 PROPERTIES VERSION 1.2 SOVERSION 3
- INSTALL_NAME_DIR @executable_path/../lib)
-endif()
-
-get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
-if(_isMultiConfig)
- set(SI_CONFIG --config $<CONFIGURATION>)
-else()
- set(SI_CONFIG)
-endif()
-
-# Dummy test of CPack
-set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Test of packaging with cpack")
-set(CPACK_PACKAGE_VENDOR "Kitware")
-set(CPACK_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/PackageScript.cmake")
-
-if(WIN32 AND NOT UNIX)
- find_program(NSIS_MAKENSIS NAMES makensis
- PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS]
- DOC "Where is makensis.exe located"
- )
- if(NOT NSIS_MAKENSIS)
- set(CPACK_GENERATOR TGZ)
- endif()
-endif()
-if(UNIX AND NOT APPLE)
- set(CPACK_GENERATOR "TGZ;STGZ;TZ")
- # find_program(found_compress
- # NAMES compress)
- # if(found_compress)
- # find_program(file_command NAMES file)
- # if(NOT file_command)
- # set(file_command file)
- # endif()
- # execute_process(COMMAND ${file_command} ${found_compress}
- # OUTPUT_VARIABLE output)
- # set(SKIP_TZ FALSE)
- # if("${output}" MATCHES "script")
- # set(SKIP_TZ TRUE)
- # endif()
- # if("${output}" MATCHES "dummy.sh")
- # set(SKIP_TZ TRUE)
- # endif()
- # if(NOT SKIP_TZ)
- # message("compress found and it was not a script")
- # message("output from file command: [${output}]")
- # list(APPEND CPACK_GENERATOR "TZ")
- # else()
- # message("compress found, but it was a script so don't use it")
- # message("output from file command: [${output}]")
- # endif()
- # endif()
- find_program(found_bz2
- NAMES bzip2)
- if(found_bz2)
- list(APPEND CPACK_GENERATOR "TBZ2")
- endif()
-endif()
-
-set(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install")
-set(CMAKE_INSTALL_MFC_LIBRARIES 1)
-set(CMAKE_INSTALL_DEBUG_LIBRARIES 1)
-set(CMAKE_INSTALL_UCRT_LIBRARIES 1)
-include(InstallRequiredSystemLibraries)
-
-if(CTEST_TEST_CPACK)
- set(package_command COMMAND
- ${CMAKE_COMMAND} --build . --target package ${SI_CONFIG}
- )
-
- # Avoid settings that require the .zip file command line tools...
- # (just build an NSIS installer without component support)
- #
- set(CPACK_BINARY_ZIP OFF)
- set(CPACK_MONOLITHIC_INSTALL ON)
-else()
- set(package_command)
-endif()
-
-include(CPack)
-
-set(install_command COMMAND
- ${CMAKE_COMMAND} --build . --target install ${SI_CONFIG}
- )
-
-add_custom_command(
- TARGET ${install_target}
- POST_BUILD
- ${install_command}
- ${package_command}
- COMMENT "Install Project"
- )
diff --git a/Tests/SimpleInstallS2/InstallScript1.cmake b/Tests/SimpleInstallS2/InstallScript1.cmake
deleted file mode 100644
index ef9da57..0000000
--- a/Tests/SimpleInstallS2/InstallScript1.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-message("This is install script 1.")
-set(INSTALL_SCRIPT_1_DID_RUN 1)
-if(INSTALL_CODE_DID_RUN)
- message(FATAL_ERROR "Install script 1 did not run before install code.")
-endif()
diff --git a/Tests/SimpleInstallS2/InstallScript2.cmake b/Tests/SimpleInstallS2/InstallScript2.cmake
deleted file mode 100644
index c1d20a3..0000000
--- a/Tests/SimpleInstallS2/InstallScript2.cmake
+++ /dev/null
@@ -1,14 +0,0 @@
-message("This is install script 2.")
-if(INSTALL_SCRIPT_1_DID_RUN)
- message("Install script ordering works.")
-else()
- message(FATAL_ERROR "Install script 1 did not run before install script 2.")
-endif()
-if(INSTALL_CODE_DID_RUN)
- message("Install code ordering works.")
-else()
- message(FATAL_ERROR "Install script 2 did not run after install code.")
-endif()
-file(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake"
- "set(CMAKE_INSTALL_SCRIPT_DID_RUN 1)\n"
- )
diff --git a/Tests/SimpleInstallS2/InstallScript3.cmake b/Tests/SimpleInstallS2/InstallScript3.cmake
deleted file mode 100644
index 6485156..0000000
--- a/Tests/SimpleInstallS2/InstallScript3.cmake
+++ /dev/null
@@ -1,12 +0,0 @@
-message("This is install script 3.")
-set(INSTALL_SCRIPT_3_DID_RUN 1)
-if(INSTALL_CODE_WITH_COMPONENT_DID_RUN)
- message(FATAL_ERROR "Install script 3 did not run before install code with component.")
-endif()
-
-if(CMAKE_INSTALL_COMPONENT)
-if(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development")
- message("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"")
- message(FATAL_ERROR "Install script 3 should only run for \"Development\" INSTALL COMPONENT.")
-endif()
-endif()
diff --git a/Tests/SimpleInstallS2/InstallScript4.cmake b/Tests/SimpleInstallS2/InstallScript4.cmake
deleted file mode 100644
index 34d0a73..0000000
--- a/Tests/SimpleInstallS2/InstallScript4.cmake
+++ /dev/null
@@ -1,22 +0,0 @@
-message("This is install script 4.")
-if(INSTALL_SCRIPT_3_DID_RUN)
- message("Install script ordering works.")
-else()
- message(FATAL_ERROR "Install script 3 did not run before install script 4.")
-endif()
-if(INSTALL_CODE_WITH_COMPONENT_DID_RUN)
- message("Install code ordering works.")
-else()
- message(FATAL_ERROR "Install script 4 did not run after install with component code.")
-endif()
-
-if(CMAKE_INSTALL_COMPONENT)
-if(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development")
- message("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"")
- message(FATAL_ERROR "Install script 4 should only run for \"Development\" INSTALL COMPONENT.")
-endif()
-endif()
-
-file(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScript4Out.cmake"
- "set(CMAKE_INSTALL_SCRIPT_4_DID_RUN 1)\n"
- )
diff --git a/Tests/SimpleInstallS2/PackageScript.cmake b/Tests/SimpleInstallS2/PackageScript.cmake
deleted file mode 100644
index 53b7909..0000000
--- a/Tests/SimpleInstallS2/PackageScript.cmake
+++ /dev/null
@@ -1,10 +0,0 @@
-message("This is packaging script")
-message("It writes a file with all variables available in ${CMAKE_INSTALL_PREFIX}/AllVariables.txt")
-
-file(WRITE ${CMAKE_INSTALL_PREFIX}/AllVariables.txt "")
-get_cmake_property(res VARIABLES)
-foreach(var ${res})
- file(APPEND ${CMAKE_INSTALL_PREFIX}/AllVariables.txt
- "${var} \"${${var}}\"\n")
-endforeach()
-
diff --git a/Tests/SimpleInstallS2/PostInstall.cmake b/Tests/SimpleInstallS2/PostInstall.cmake
deleted file mode 100644
index d616221..0000000
--- a/Tests/SimpleInstallS2/PostInstall.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-message("In post install")
-if(PRE_INSTALL_DID_RUN)
- message("Pre and post install work fine")
-else()
- message(FATAL_ERROR "Pre install did not run before post install")
-endif()
diff --git a/Tests/SimpleInstallS2/PreInstall.cmake b/Tests/SimpleInstallS2/PreInstall.cmake
deleted file mode 100644
index 7a9851e..0000000
--- a/Tests/SimpleInstallS2/PreInstall.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-message("This is in pre install")
-set(PRE_INSTALL_DID_RUN 1)
diff --git a/Tests/SimpleInstallS2/TestSubDir/CMakeLists.txt b/Tests/SimpleInstallS2/TestSubDir/CMakeLists.txt
deleted file mode 100644
index 860e104..0000000
--- a/Tests/SimpleInstallS2/TestSubDir/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-add_executable(TSD TSD.cxx TSD_utils.cxx)
-install_files(/MyTest/include FILES TSD.h)
-install_targets(/MyTest/bin TSD)
diff --git a/Tests/SimpleInstallS2/TestSubDir/TSD.cxx b/Tests/SimpleInstallS2/TestSubDir/TSD.cxx
deleted file mode 100644
index 8fc3878..0000000
--- a/Tests/SimpleInstallS2/TestSubDir/TSD.cxx
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <stdio.h>
-
-#include "TSD.h"
-
-int main()
-{
- int res = TSD("TEST");
- printf("Hello from TSD\n");
- return res;
-}
diff --git a/Tests/SimpleInstallS2/TestSubDir/TSD.h b/Tests/SimpleInstallS2/TestSubDir/TSD.h
deleted file mode 100644
index 6a3c1af..0000000
--- a/Tests/SimpleInstallS2/TestSubDir/TSD.h
+++ /dev/null
@@ -1 +0,0 @@
-int TSD(const char*);
diff --git a/Tests/SimpleInstallS2/TestSubDir/TSD_utils.cxx b/Tests/SimpleInstallS2/TestSubDir/TSD_utils.cxx
deleted file mode 100644
index 0f32894..0000000
--- a/Tests/SimpleInstallS2/TestSubDir/TSD_utils.cxx
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <string.h>
-
-int TSD(const char* foo)
-{
- if (strcmp(foo, "TEST") == 0) {
- return 0;
- }
- return 1;
-}
diff --git a/Tests/SimpleInstallS2/foo.c b/Tests/SimpleInstallS2/foo.c
deleted file mode 100644
index 45d5b2b..0000000
--- a/Tests/SimpleInstallS2/foo.c
+++ /dev/null
@@ -1,6 +0,0 @@
-char* foo = "Foo";
-
-int SomeFunctionInFoo()
-{
- return 5;
-}
diff --git a/Tests/SimpleInstallS2/foo.h b/Tests/SimpleInstallS2/foo.h
deleted file mode 100644
index 216cdf6..0000000
--- a/Tests/SimpleInstallS2/foo.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern char* foo;
-extern int SomeFunctionInFoo();
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/Tests/SimpleInstallS2/inst.cxx b/Tests/SimpleInstallS2/inst.cxx
deleted file mode 100644
index 7815f86..0000000
--- a/Tests/SimpleInstallS2/inst.cxx
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "foo.h"
-
-#ifdef STAGE_2
-# include <foo/lib1.h>
-# include <foo/lib2renamed.h>
-# include <lib3.h>
-# include <old/lib2.h>
-# include <old/lib3.h>
-#else
-# include "lib1.h"
-# include "lib2.h"
-#endif
-
-#include "lib4.h"
-
-#include <stdio.h>
-
-int main()
-{
- if (Lib1Func() != 2.0) {
- printf("Problem with lib1\n");
- return 1;
- }
- if (Lib2Func() != 1.0) {
- printf("Problem with lib2\n");
- return 1;
- }
- if (Lib4Func() != 4.0) {
- printf("Problem with lib4\n");
- return 1;
- }
- printf("The value of Foo: %s\n", foo);
- return SomeFunctionInFoo() - 5;
-}
diff --git a/Tests/SimpleInstallS2/inst2.cxx b/Tests/SimpleInstallS2/inst2.cxx
deleted file mode 100644
index c70b93a..0000000
--- a/Tests/SimpleInstallS2/inst2.cxx
+++ /dev/null
@@ -1,2 +0,0 @@
-#define STAGE_2
-#include "inst.cxx"
diff --git a/Tests/SimpleInstallS2/lib1.cxx b/Tests/SimpleInstallS2/lib1.cxx
deleted file mode 100644
index 7aa9052..0000000
--- a/Tests/SimpleInstallS2/lib1.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "lib1.h"
-
-float Lib1Func()
-{
- return 2.0;
-}
diff --git a/Tests/SimpleInstallS2/lib1.h b/Tests/SimpleInstallS2/lib1.h
deleted file mode 100644
index 0d64e76..0000000
--- a/Tests/SimpleInstallS2/lib1.h
+++ /dev/null
@@ -1 +0,0 @@
-extern float Lib1Func();
diff --git a/Tests/SimpleInstallS2/lib2.cxx b/Tests/SimpleInstallS2/lib2.cxx
deleted file mode 100644
index dccc48b..0000000
--- a/Tests/SimpleInstallS2/lib2.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "lib2.h"
-
-float Lib2Func()
-{
- return 1.0;
-}
diff --git a/Tests/SimpleInstallS2/lib2.h b/Tests/SimpleInstallS2/lib2.h
deleted file mode 100644
index 044e775..0000000
--- a/Tests/SimpleInstallS2/lib2.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifdef _WIN32
-# ifdef test2_EXPORTS
-# define CM_TEST_LIB_EXPORT __declspec(dllexport)
-# else
-# define CM_TEST_LIB_EXPORT __declspec(dllimport)
-# endif
-#else
-# define CM_TEST_LIB_EXPORT
-#endif
-
-CM_TEST_LIB_EXPORT float Lib2Func();
diff --git a/Tests/SimpleInstallS2/lib3.cxx b/Tests/SimpleInstallS2/lib3.cxx
deleted file mode 100644
index da8dbf9..0000000
--- a/Tests/SimpleInstallS2/lib3.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "lib3.h"
-
-float Lib3Func()
-{
- return 2.0;
-}
diff --git a/Tests/SimpleInstallS2/lib3.h b/Tests/SimpleInstallS2/lib3.h
deleted file mode 100644
index e02bbc4..0000000
--- a/Tests/SimpleInstallS2/lib3.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifdef _WIN32
-# ifdef test3_EXPORTS
-# define CM_TEST_LIB_EXPORT __declspec(dllexport)
-# else
-# define CM_TEST_LIB_EXPORT __declspec(dllimport)
-# endif
-#else
-# define CM_TEST_LIB_EXPORT
-#endif
-
-CM_TEST_LIB_EXPORT float Lib3Func();
diff --git a/Tests/SimpleInstallS2/lib4.cxx b/Tests/SimpleInstallS2/lib4.cxx
deleted file mode 100644
index fbede5c..0000000
--- a/Tests/SimpleInstallS2/lib4.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "lib4.h"
-
-float Lib4Func()
-{
- return 4.0;
-}
diff --git a/Tests/SimpleInstallS2/lib4.h b/Tests/SimpleInstallS2/lib4.h
deleted file mode 100644
index e1a221e..0000000
--- a/Tests/SimpleInstallS2/lib4.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifdef _WIN32
-# ifdef test4_EXPORTS
-# define CM_TEST_LIB_EXPORT __declspec(dllexport)
-# else
-# define CM_TEST_LIB_EXPORT __declspec(dllimport)
-# endif
-#else
-# define CM_TEST_LIB_EXPORT
-#endif
-
-CM_TEST_LIB_EXPORT float Lib4Func();
diff --git a/Tests/SimpleInstallS2/scripts/.gitattributes b/Tests/SimpleInstallS2/scripts/.gitattributes
deleted file mode 100644
index 5e3db2f..0000000
--- a/Tests/SimpleInstallS2/scripts/.gitattributes
+++ /dev/null
@@ -1 +0,0 @@
-sample_script crlf=input
diff --git a/Tests/SimpleInstallS2/scripts/CMakeLists.txt b/Tests/SimpleInstallS2/scripts/CMakeLists.txt
deleted file mode 100644
index ec34e8c..0000000
--- a/Tests/SimpleInstallS2/scripts/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-install_programs(/MyTest/share/old3 "^sample_script(\\.bat)?$")
diff --git a/Tests/UseSWIG/BasicConfiguration.cmake b/Tests/UseSWIG/BasicConfiguration.cmake
index ad34d39..fd3ac40 100644
--- a/Tests/UseSWIG/BasicConfiguration.cmake
+++ b/Tests/UseSWIG/BasicConfiguration.cmake
@@ -58,7 +58,6 @@ if(${language} MATCHES lua)
set(SWIG_LANG_LIBRARIES ${LUA_LIBRARIES})
endif()
-set(UseSWIG_TARGET_NAME_PREFERENCE STANDARD)
unset(CMAKE_SWIG_FLAGS)
set (CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/Tests/UseSWIG/BasicCsharp/CMakeLists.txt b/Tests/UseSWIG/BasicCsharp/CMakeLists.txt
index 84743ef..1a6c763 100644
--- a/Tests/UseSWIG/BasicCsharp/CMakeLists.txt
+++ b/Tests/UseSWIG/BasicCsharp/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.12)
+cmake_minimum_required(VERSION 3.12...3.13)
project(TestBasicCsharp CXX CSharp)
diff --git a/Tests/UseSWIG/BasicPerl/CMakeLists.txt b/Tests/UseSWIG/BasicPerl/CMakeLists.txt
index 476ef0e..cf02de7 100644
--- a/Tests/UseSWIG/BasicPerl/CMakeLists.txt
+++ b/Tests/UseSWIG/BasicPerl/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.1...3.13)
project(TestBasicPerl CXX)
diff --git a/Tests/UseSWIG/BasicPython/CMakeLists.txt b/Tests/UseSWIG/BasicPython/CMakeLists.txt
index cf1d821..8bbd1cb 100644
--- a/Tests/UseSWIG/BasicPython/CMakeLists.txt
+++ b/Tests/UseSWIG/BasicPython/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.1...3.13)
project(TestBasicPython CXX)
diff --git a/Tests/UseSWIG/CMakeLists.txt b/Tests/UseSWIG/CMakeLists.txt
index cc29b77..4c3d901 100644
--- a/Tests/UseSWIG/CMakeLists.txt
+++ b/Tests/UseSWIG/CMakeLists.txt
@@ -88,3 +88,14 @@ add_test(NAME UseSWIG.ModuleVersion2 COMMAND
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+
+
+add_test(NAME UseSWIG.UseTargetINCLUDE_DIRECTORIES COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES"
+ "${CMake_BINARY_DIR}/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES"
+ ${build_generator_args}
+ --build-project TestModuleVersion2
+ --build-options ${build_options}
+ )
diff --git a/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt b/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt
index 452f9e2..a7ee210 100644
--- a/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt
+++ b/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.1...3.13)
project(TestModuleVersion2 CXX)
@@ -16,7 +16,6 @@ else()
set (PS ":")
endif()
-set(UseSWIG_TARGET_NAME_PREFERENCE STANDARD)
set (UseSWIG_MODULE_VERSION 2)
unset(CMAKE_SWIG_FLAGS)
diff --git a/Tests/UseSWIG/MultipleModules/CMakeLists.txt b/Tests/UseSWIG/MultipleModules/CMakeLists.txt
index 25dd6b3..f1dc379 100644
--- a/Tests/UseSWIG/MultipleModules/CMakeLists.txt
+++ b/Tests/UseSWIG/MultipleModules/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.1...3.13)
project(TestMultipleModules CXX)
@@ -19,7 +19,6 @@ else()
set (PS ":")
endif()
-set(UseSWIG_TARGET_NAME_PREFERENCE STANDARD)
unset(CMAKE_SWIG_FLAGS)
set_property(SOURCE "../example.i" PROPERTY CPLUSPLUS ON)
diff --git a/Tests/UseSWIG/MultiplePython/CMakeLists.txt b/Tests/UseSWIG/MultiplePython/CMakeLists.txt
index a1651fb..8f87755 100644
--- a/Tests/UseSWIG/MultiplePython/CMakeLists.txt
+++ b/Tests/UseSWIG/MultiplePython/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.1...3.13)
project(TestMultiplePython CXX)
@@ -17,7 +17,6 @@ else()
set (PS ":")
endif()
-set(UseSWIG_TARGET_NAME_PREFERENCE STANDARD)
unset(CMAKE_SWIG_FLAGS)
set_property(SOURCE "../example.i" PROPERTY CPLUSPLUS ON)
diff --git a/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt
new file mode 100644
index 0000000..fbb72d5
--- /dev/null
+++ b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt
@@ -0,0 +1,45 @@
+cmake_minimum_required(VERSION 3.1...3.13)
+
+project(TestUseTargetINCLUDE_DIRECTORIES CXX)
+
+include(CTest)
+
+find_package(SWIG REQUIRED)
+include(${SWIG_USE_FILE})
+
+find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
+
+unset(CMAKE_SWIG_FLAGS)
+
+set_property(SOURCE "example.i" PROPERTY CPLUSPLUS ON)
+set_property(SOURCE "example.i" PROPERTY COMPILE_OPTIONS -includeall)
+
+swig_add_library(example1
+ LANGUAGE python
+ OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/example1"
+ SOURCES example.i ../example.cxx)
+set_target_properties (example1 PROPERTIES
+ INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/.."
+ SWIG_USE_TARGET_INCLUDE_DIRECTORIES TRUE
+ OUTPUT_NAME example1
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1"
+ ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1"
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1")
+target_link_libraries(example1 PRIVATE Python3::Python)
+
+
+# Check that source property override target property
+set_property(SOURCE "example.i" PROPERTY USE_TARGET_INCLUDE_DIRECTORIES TRUE)
+
+swig_add_library(example2
+ LANGUAGE python
+ OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/example2"
+ SOURCES example.i ../example.cxx)
+set_target_properties (example2 PROPERTIES
+ INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/.."
+ SWIG_USE_TARGET_INCLUDE_DIRECTORIES FALSE
+ OUTPUT_NAME example2
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2"
+ ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2"
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2")
+target_link_libraries(example2 PRIVATE Python3::Python)
diff --git a/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/example.i b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/example.i
new file mode 100644
index 0000000..fbdf724
--- /dev/null
+++ b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/example.i
@@ -0,0 +1,9 @@
+/* File : example.i */
+%module example
+
+%{
+#include "example.h"
+%}
+
+/* Let's just grab the original header file here */
+%include "example.h"
diff --git a/Tests/VSNASM/CMakeLists.txt b/Tests/VSNASM/CMakeLists.txt
index c2e29df..821d022 100644
--- a/Tests/VSNASM/CMakeLists.txt
+++ b/Tests/VSNASM/CMakeLists.txt
@@ -1,10 +1,20 @@
cmake_minimum_required(VERSION 2.8.12)
project(VSNASM C ASM_NASM)
+
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
add_definitions(-DTESTx64)
string(APPEND CMAKE_ASM_NASM_FLAGS " -DTEST2x64")
else()
add_definitions(-DTESTi386)
endif()
+
+# Test quoting for definitions with spaces.
+add_definitions("-DEAX_COMMA_SPACE_ZERO=eax, 0")
+
+# Test quoting for file names with spaces. The file is generated because CMake
+# itself cannot have files with spaces.
+file(READ bar.asm BAR_ASM_CONTENTS)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/bar baz.asm" "${BAR_ASM_CONTENTS}")
+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
-add_executable(VSNASM main.c foo.asm)
+add_executable(VSNASM main.c foo.asm "${CMAKE_CURRENT_BINARY_DIR}/bar baz.asm")
diff --git a/Tests/VSNASM/bar.asm b/Tests/VSNASM/bar.asm
new file mode 100644
index 0000000..b486d82
--- /dev/null
+++ b/Tests/VSNASM/bar.asm
@@ -0,0 +1,13 @@
+section .text
+%ifdef TEST2x64
+global bar
+%else
+global _bar
+%endif
+%ifdef TESTx64
+bar:
+%else
+_bar:
+%endif
+ mov EAX_COMMA_SPACE_ZERO
+ ret
diff --git a/Tests/VSNASM/include/foo-proc.asm b/Tests/VSNASM/include/foo-proc.asm
index 450a791..eb5bb2b 100644
--- a/Tests/VSNASM/include/foo-proc.asm
+++ b/Tests/VSNASM/include/foo-proc.asm
@@ -3,5 +3,5 @@ foo:
%else
_foo:
%endif
- mov eax, 0
+ mov EAX_COMMA_SPACE_ZERO
ret
diff --git a/Tests/VSNASM/main.c b/Tests/VSNASM/main.c
index 18ddb78..b1401b6 100644
--- a/Tests/VSNASM/main.c
+++ b/Tests/VSNASM/main.c
@@ -1,5 +1,6 @@
extern int foo(void);
+extern int bar(void);
int main(void)
{
- return foo();
+ return foo() + bar();
}
diff --git a/Utilities/IWYU/mapping.imp b/Utilities/IWYU/mapping.imp
index 892cdcb..5af8b85 100644
--- a/Utilities/IWYU/mapping.imp
+++ b/Utilities/IWYU/mapping.imp
@@ -52,6 +52,9 @@
#{ symbol: [ "std::pair", private, "<map>", public ] },
#{ symbol: [ "std::pair", private, "<set>", public ] },
+ # HACK: iwyu wrongly thinks that <system_error> is needed for std::hash
+ { symbol: [ "std::hash", private, "<functional>", public ] },
+
# __decay_and_strip is used internally in the C++11 standard library.
# IWYU does not classify it as internal and suggests to add <type_traits>.
# To ignore it, we simply map it to a file that is included anyway.
diff --git a/Utilities/Release/CMakeLogo.ico b/Utilities/Release/CMakeLogo.ico
index e13bb15..c100612 100644
--- a/Utilities/Release/CMakeLogo.ico
+++ b/Utilities/Release/CMakeLogo.ico
Binary files differ
diff --git a/Utilities/Release/linux64_release.cmake b/Utilities/Release/linux64_release.cmake
index 04a74ac..f2ca2d5 100644
--- a/Utilities/Release/linux64_release.cmake
+++ b/Utilities/Release/linux64_release.cmake
@@ -34,6 +34,7 @@ OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.1.0h/include
OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.1.0h/lib/libssl.a
PYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3
CPACK_SYSTEM_NAME:STRING=Linux-x86_64
+BUILD_CursesDialog:BOOL=ON
BUILD_QtDialog:BOOL=TRUE
CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE
CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3
diff --git a/Utilities/Release/osx_release.cmake b/Utilities/Release/osx_release.cmake
index c69eb11..be11d47 100644
--- a/Utilities/Release/osx_release.cmake
+++ b/Utilities/Release/osx_release.cmake
@@ -19,6 +19,7 @@ CMAKE_OSX_ARCHITECTURES:STRING=x86_64
CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7
CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE
CPACK_SYSTEM_NAME:STRING=Darwin-x86_64
+BUILD_CursesDialog:BOOL=ON
BUILD_QtDialog:BOOL=TRUE
CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3
CMake_INSTALL_DEPENDENCIES:BOOL=ON
diff --git a/Utilities/Scripts/update-liblzma.bash b/Utilities/Scripts/update-liblzma.bash
index 088eb91..fdf66b3 100755
--- a/Utilities/Scripts/update-liblzma.bash
+++ b/Utilities/Scripts/update-liblzma.bash
@@ -7,8 +7,8 @@ shopt -s dotglob
readonly name="liblzma"
readonly ownership="liblzma upstream <xz-devel@tukaani.org>"
readonly subtree="Utilities/cmliblzma"
-readonly repo="http://git.tukaani.org/xz.git"
-readonly tag="v5.0.8"
+readonly repo="https://git.tukaani.org/xz.git"
+readonly tag="v5.2.4"
readonly shortlog=false
readonly paths="
COPYING
@@ -24,6 +24,10 @@ extract_source () {
mv src/common .
mv src/liblzma .
rmdir src
+ rm liblzma/Makefile.*
+ rm liblzma/*/Makefile.*
+ rm liblzma/liblzma.map
+ rm liblzma/validate_map.sh
popd
}
diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py
index b0c8f71..ebf44da 100644
--- a/Utilities/Sphinx/cmake.py
+++ b/Utilities/Sphinx/cmake.py
@@ -144,6 +144,7 @@ class _cmake_index_entry:
_cmake_index_objs = {
'command': _cmake_index_entry('command'),
+ 'cpack_gen': _cmake_index_entry('cpack generator'),
'envvar': _cmake_index_entry('envvar'),
'generator': _cmake_index_entry('generator'),
'manual': _cmake_index_entry('manual'),
@@ -325,6 +326,7 @@ class CMakeDomain(Domain):
label = 'CMake'
object_types = {
'command': ObjType('command', 'command'),
+ 'cpack_gen': ObjType('cpack_gen', 'cpack_gen'),
'envvar': ObjType('envvar', 'envvar'),
'generator': ObjType('generator', 'generator'),
'variable': ObjType('variable', 'variable'),
@@ -358,6 +360,7 @@ class CMakeDomain(Domain):
}
roles = {
'command': CMakeXRefRole(fix_parens = True, lowercase = True),
+ 'cpack_gen': CMakeXRefRole(),
'envvar': CMakeXRefRole(),
'generator': CMakeXRefRole(),
'variable': CMakeXRefRole(),
diff --git a/Utilities/Sphinx/create_identifiers.py b/Utilities/Sphinx/create_identifiers.py
index e638950..6716b48 100755
--- a/Utilities/Sphinx/create_identifiers.py
+++ b/Utilities/Sphinx/create_identifiers.py
@@ -21,6 +21,7 @@ newlines = []
for line in lines:
mapping = (("command", "command"),
+ ("cpack generator", "cpack_gen"),
("envvar", "envvar"),
("variable", "variable"),
("generator", "generator"),
diff --git a/Utilities/Sphinx/static/cmake-favicon.ico b/Utilities/Sphinx/static/cmake-favicon.ico
index fce8f92..ae529f5 100644
--- a/Utilities/Sphinx/static/cmake-favicon.ico
+++ b/Utilities/Sphinx/static/cmake-favicon.ico
Binary files differ
diff --git a/Utilities/Sphinx/static/cmake-logo-16.png b/Utilities/Sphinx/static/cmake-logo-16.png
index 2039c25..9c95b75 100644
--- a/Utilities/Sphinx/static/cmake-logo-16.png
+++ b/Utilities/Sphinx/static/cmake-logo-16.png
Binary files differ
diff --git a/Utilities/cmliblzma/CMakeLists.txt b/Utilities/cmliblzma/CMakeLists.txt
index bb3b8a7..e9f8826 100644
--- a/Utilities/cmliblzma/CMakeLists.txt
+++ b/Utilities/cmliblzma/CMakeLists.txt
@@ -6,22 +6,6 @@ include(CheckSymbolExists)
include(CheckTypeSize)
include(TestBigEndian)
-CHECK_C_SOURCE_COMPILES(
- "int test (void *restrict x);\nint main (void) {return 0;}"
- HAVE_RESTRICT)
-
-CHECK_C_SOURCE_COMPILES(
-"typedef struct abc *d;\nint test (d __restrict x);\nint main (void) {return 0;}"
- HAVE___RESTRICT)
-
-CHECK_C_SOURCE_COMPILES(
- "static inline int test (void) {return 0;}\nint main (void) {return test();}"
- HAVE_INLINE)
-
-CHECK_C_SOURCE_COMPILES (
- "static __inline int test (void) {return 0;}\nint main (void) {return test();}"
- HAVE___INLINE)
-
CHECK_INCLUDE_FILE(byteswap.h HAVE_BYTESWAP_H)
CHECK_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H)
CHECK_INCLUDE_FILE(limits.h HAVE_LIMITS_H)
@@ -95,7 +79,7 @@ CHECK_TYPE_SIZE("unsigned short" SIZE_OF_UNSIGNED_SHORT)
CHECK_TYPE_SIZE("unsigned" SIZE_OF_UNSIGNED)
CHECK_TYPE_SIZE("unsigned long" SIZE_OF_UNSIGNED_LONG)
CHECK_TYPE_SIZE("unsigned long long" SIZE_OF_UNSIGNED_LONG_LONG)
-CHECK_TYPE_SIZE("size_t" SIZE_OF_SIZE_T)
+CHECK_TYPE_SIZE("size_t" SIZEOF_SIZE_T)
CHECK_TYPE_SIZE("__int64" __INT64)
CHECK_TYPE_SIZE("unsigned __int64" UNSIGNED___INT64)
diff --git a/Utilities/cmliblzma/COPYING b/Utilities/cmliblzma/COPYING
index 43c90d0..20e60d5 100644
--- a/Utilities/cmliblzma/COPYING
+++ b/Utilities/cmliblzma/COPYING
@@ -47,7 +47,7 @@ XZ Utils Licensing
naturally it is not legally required. Here is an example of a good
notice to put into "about box" or into documentation:
- This software includes code from XZ Utils <http://tukaani.org/xz/>.
+ This software includes code from XZ Utils <https://tukaani.org/xz/>.
The following license texts are included in the following files:
- COPYING.LGPLv2.1: GNU Lesser General Public License version 2.1
diff --git a/Utilities/cmliblzma/common/common_w32res.rc b/Utilities/cmliblzma/common/common_w32res.rc
index fdb88d1..a70de34 100644
--- a/Utilities/cmliblzma/common/common_w32res.rc
+++ b/Utilities/cmliblzma/common/common_w32res.rc
@@ -17,7 +17,7 @@
#define MY_VERSION LZMA_VERSION_MAJOR,LZMA_VERSION_MINOR,LZMA_VERSION_PATCH,MY_BUILD
#define MY_FILENAME MY_NAME MY_SUFFIX
-#define MY_COMPANY "The Tukaani Project <http://tukaani.org/>"
+#define MY_COMPANY "The Tukaani Project <https://tukaani.org/>"
#define MY_PRODUCT PACKAGE_NAME " <" PACKAGE_URL ">"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
diff --git a/Utilities/cmliblzma/common/sysdefs.h b/Utilities/cmliblzma/common/sysdefs.h
index a6edea8..22f487b 100644
--- a/Utilities/cmliblzma/common/sysdefs.h
+++ b/Utilities/cmliblzma/common/sysdefs.h
@@ -18,6 +18,7 @@
#if defined(_MSC_VER)
# pragma warning(push,1)
+# pragma warning(disable: 4028) /* formal parameter different from decl */
# pragma warning(disable: 4142) /* benign redefinition of type */
# pragma warning(disable: 4761) /* integral size mismatch in argument */
#endif
@@ -124,9 +125,9 @@
// The code currently assumes that size_t is either 32-bit or 64-bit.
#ifndef SIZE_MAX
-# if SIZE_OF_SIZE_T == 4
+# if SIZEOF_SIZE_T == 4
# define SIZE_MAX UINT32_MAX
-# elif SIZE_OF_SIZE_T == 8
+# elif SIZEOF_SIZE_T == 8
# define SIZE_MAX UINT64_MAX
# else
# error size_t is not 32-bit or 64-bit
@@ -175,6 +176,16 @@ typedef unsigned char _Bool;
# include <memory.h>
#endif
+// As of MSVC 2013, inline and restrict are supported with
+// non-standard keywords.
+#if defined(_WIN32) && defined(_MSC_VER)
+# ifndef inline
+# define inline __inline
+# endif
+# ifndef restrict
+# define restrict __restrict
+# endif
+#endif
////////////
// Macros //
diff --git a/Utilities/cmliblzma/common/tuklib_integer.h b/Utilities/cmliblzma/common/tuklib_integer.h
index 5e8262a..5d82685 100644
--- a/Utilities/cmliblzma/common/tuklib_integer.h
+++ b/Utilities/cmliblzma/common/tuklib_integer.h
@@ -106,6 +106,17 @@
#endif
+////////////////////////////////
+// Compiler-specific features //
+////////////////////////////////
+
+// Newer Intel C compilers require immintrin.h for _bit_scan_reverse()
+// and such functions.
+#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500)
+# include <immintrin.h>
+#endif
+
+
///////////////////
// Byte swapping //
///////////////////
@@ -329,8 +340,8 @@ unaligned_read32le(const uint8_t *buf)
static inline void
unaligned_write16be(uint8_t *buf, uint16_t num)
{
- buf[0] = num >> 8;
- buf[1] = num;
+ buf[0] = (uint8_t)(num >> 8);
+ buf[1] = (uint8_t)num;
return;
}
@@ -338,8 +349,8 @@ unaligned_write16be(uint8_t *buf, uint16_t num)
static inline void
unaligned_write16le(uint8_t *buf, uint16_t num)
{
- buf[0] = num;
- buf[1] = num >> 8;
+ buf[0] = (uint8_t)num;
+ buf[1] = (uint8_t)(num >> 8);
return;
}
@@ -347,10 +358,10 @@ unaligned_write16le(uint8_t *buf, uint16_t num)
static inline void
unaligned_write32be(uint8_t *buf, uint32_t num)
{
- buf[0] = num >> 24;
- buf[1] = num >> 16;
- buf[2] = num >> 8;
- buf[3] = num;
+ buf[0] = (uint8_t)(num >> 24);
+ buf[1] = (uint8_t)(num >> 16);
+ buf[2] = (uint8_t)(num >> 8);
+ buf[3] = (uint8_t)num;
return;
}
@@ -358,10 +369,10 @@ unaligned_write32be(uint8_t *buf, uint32_t num)
static inline void
unaligned_write32le(uint8_t *buf, uint32_t num)
{
- buf[0] = num;
- buf[1] = num >> 8;
- buf[2] = num >> 16;
- buf[3] = num >> 24;
+ buf[0] = (uint8_t)num;
+ buf[1] = (uint8_t)(num >> 8);
+ buf[2] = (uint8_t)(num >> 16);
+ buf[3] = (uint8_t)(num >> 24);
return;
}
diff --git a/Utilities/cmliblzma/config.h.in b/Utilities/cmliblzma/config.h.in
index 9c53150..06f7fcb 100644
--- a/Utilities/cmliblzma/config.h.in
+++ b/Utilities/cmliblzma/config.h.in
@@ -29,7 +29,7 @@
@SIZE_OF_UNSIGNED_CODE@
@SIZE_OF_UNSIGNED_LONG_CODE@
@SIZE_OF_UNSIGNED_LONG_LONG_CODE@
-@SIZE_OF_SIZE_T_CODE@
+@SIZEOF_SIZE_T_CODE@
/*
* If we lack int64_t, define it to the first of __int64, int, long, and long long
@@ -180,32 +180,6 @@ typedef uint64_t uintmax_t;
#cmakedefine uintptr_t @uintptr_t@
-
-#cmakedefine HAVE_RESTRICT
-#cmakedefine HAVE___RESTRICT
-
-#cmakedefine HAVE_INLINE
-#cmakedefine HAVE___INLINE
-
-#ifndef HAVE_RESTRICT
-# ifdef HAVE___RESTRICT
-# define LZMA_RESTRICT __restrict
-# else
-# define LZMA_RESTRICT
-# endif
-#else
-# define LZMA_RESTRICT restrict
-#endif /* HAVE_RESTRICT */
-
-#ifndef HAVE_INLINE
-# ifdef HAVE___INLINE
-# define inline __inline
-# else
-# define inline
-# endif
-#endif /* HAVE_INLINE */
-
-
#cmakedefine WORDS_BIGENDIAN 1
#cmakedefine HAVE_BYTESWAP_H 1
diff --git a/Utilities/cmliblzma/liblzma/api/lzma.h b/Utilities/cmliblzma/liblzma/api/lzma.h
index fb874c3..aa88e42 100644
--- a/Utilities/cmliblzma/liblzma/api/lzma.h
+++ b/Utilities/cmliblzma/liblzma/api/lzma.h
@@ -82,12 +82,20 @@
# if !defined(UINT32_C) || !defined(UINT64_C) \
|| !defined(UINT32_MAX) || !defined(UINT64_MAX)
/*
- * MSVC has no C99 support, and thus it cannot be used to
- * compile liblzma. The liblzma API has to still be usable
- * from MSVC, so we need to define the required standard
- * integer types here.
+ * MSVC versions older than 2013 have no C99 support, and
+ * thus they cannot be used to compile liblzma. Using an
+ * existing liblzma.dll with old MSVC can work though(*),
+ * but we need to define the required standard integer
+ * types here in a MSVC-specific way.
+ *
+ * (*) If you do this, the existing liblzma.dll probably uses
+ * a different runtime library than your MSVC-built
+ * application. Mixing runtimes is generally bad, but
+ * in this case it should work as long as you avoid
+ * the few rarely-needed liblzma functions that allocate
+ * memory and expect the caller to free it using free().
*/
-# if defined(_WIN32) && defined(_MSC_VER)
+# if defined(_WIN32) && defined(_MSC_VER) && _MSC_VER < 1800
typedef unsigned __int8 uint8_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
@@ -211,7 +219,11 @@
*/
#ifndef lzma_nothrow
# if defined(__cplusplus)
-# define lzma_nothrow throw()
+# if __cplusplus >= 201103L
+# define lzma_nothrow noexcept
+# else
+# define lzma_nothrow throw()
+# endif
# elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
# define lzma_nothrow __attribute__((__nothrow__))
# else
@@ -286,7 +298,7 @@ extern "C" {
#include "lzma/filter.h"
#include "lzma/bcj.h"
#include "lzma/delta.h"
-#include "lzma/lzma.h"
+#include "lzma/lzma12.h"
/* Container formats */
#include "lzma/container.h"
diff --git a/Utilities/cmliblzma/liblzma/api/lzma/base.h b/Utilities/cmliblzma/liblzma/api/lzma/base.h
index 43dde8d..a6005ac 100644
--- a/Utilities/cmliblzma/liblzma/api/lzma/base.h
+++ b/Utilities/cmliblzma/liblzma/api/lzma/base.h
@@ -240,12 +240,12 @@ typedef enum {
/**
* \brief The `action' argument for lzma_code()
*
- * After the first use of LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, or LZMA_FINISH,
- * the same `action' must is used until lzma_code() returns LZMA_STREAM_END.
- * Also, the amount of input (that is, strm->avail_in) must not be modified
- * by the application until lzma_code() returns LZMA_STREAM_END. Changing the
- * `action' or modifying the amount of input will make lzma_code() return
- * LZMA_PROG_ERROR.
+ * After the first use of LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, LZMA_FULL_BARRIER,
+ * or LZMA_FINISH, the same `action' must is used until lzma_code() returns
+ * LZMA_STREAM_END. Also, the amount of input (that is, strm->avail_in) must
+ * not be modified by the application until lzma_code() returns
+ * LZMA_STREAM_END. Changing the `action' or modifying the amount of input
+ * will make lzma_code() return LZMA_PROG_ERROR.
*/
typedef enum {
LZMA_RUN = 0,
@@ -293,7 +293,7 @@ typedef enum {
*
* All the input data going to the current Block must have
* been given to the encoder (the last bytes can still be
- * pending in* next_in). Call lzma_code() with LZMA_FULL_FLUSH
+ * pending in *next_in). Call lzma_code() with LZMA_FULL_FLUSH
* until it returns LZMA_STREAM_END. Then continue normally
* with LZMA_RUN or finish the Stream with LZMA_FINISH.
*
@@ -302,6 +302,29 @@ typedef enum {
* no unfinished Block, no empty Block is created.
*/
+ LZMA_FULL_BARRIER = 4,
+ /**<
+ * \brief Finish encoding of the current Block
+ *
+ * This is like LZMA_FULL_FLUSH except that this doesn't
+ * necessarily wait until all the input has been made
+ * available via the output buffer. That is, lzma_code()
+ * might return LZMA_STREAM_END as soon as all the input
+ * has been consumed (avail_in == 0).
+ *
+ * LZMA_FULL_BARRIER is useful with a threaded encoder if
+ * one wants to split the .xz Stream into Blocks at specific
+ * offsets but doesn't care if the output isn't flushed
+ * immediately. Using LZMA_FULL_BARRIER allows keeping
+ * the threads busy while LZMA_FULL_FLUSH would make
+ * lzma_code() wait until all the threads have finished
+ * until more data could be passed to the encoder.
+ *
+ * With a lzma_stream initialized with the single-threaded
+ * lzma_stream_encoder() or lzma_easy_encoder(),
+ * LZMA_FULL_BARRIER is an alias for LZMA_FULL_FLUSH.
+ */
+
LZMA_FINISH = 3
/**<
* \brief Finish the coding operation
@@ -332,11 +355,19 @@ typedef enum {
* malloc() and free(). C++ users should note that the custom memory
* handling functions must not throw exceptions.
*
- * liblzma doesn't make an internal copy of lzma_allocator. Thus, it is
- * OK to change these function pointers in the middle of the coding
- * process, but obviously it must be done carefully to make sure that the
- * replacement `free' can deallocate memory allocated by the earlier
- * `alloc' function(s).
+ * Single-threaded mode only: liblzma doesn't make an internal copy of
+ * lzma_allocator. Thus, it is OK to change these function pointers in
+ * the middle of the coding process, but obviously it must be done
+ * carefully to make sure that the replacement `free' can deallocate
+ * memory allocated by the earlier `alloc' function(s).
+ *
+ * Multithreaded mode: liblzma might internally store pointers to the
+ * lzma_allocator given via the lzma_stream structure. The application
+ * must not change the allocator pointer in lzma_stream or the contents
+ * of the pointed lzma_allocator structure until lzma_end() has been used
+ * to free the memory associated with that lzma_stream. The allocation
+ * functions might be called simultaneously from multiple threads, and
+ * thus they must be thread safe.
*/
typedef struct {
/**
@@ -448,7 +479,8 @@ typedef struct lzma_internal_s lzma_internal;
*
* Application may modify the values of total_in and total_out as it wants.
* They are updated by liblzma to match the amount of data read and
- * written, but aren't used for anything else.
+ * written but aren't used for anything else except as a possible return
+ * values from lzma_get_progress().
*/
typedef struct {
const uint8_t *next_in; /**< Pointer to the next input byte. */
@@ -464,8 +496,10 @@ typedef struct {
*
* In most cases this is NULL which makes liblzma use
* the standard malloc() and free().
+ *
+ * \note In 5.0.x this is not a const pointer.
*/
- lzma_allocator *allocator;
+ const lzma_allocator *allocator;
/** Internal state is not visible to applications. */
lzma_internal *internal;
@@ -547,6 +581,25 @@ extern LZMA_API(void) lzma_end(lzma_stream *strm) lzma_nothrow;
/**
+ * \brief Get progress information
+ *
+ * In single-threaded mode, applications can get progress information from
+ * strm->total_in and strm->total_out. In multi-threaded mode this is less
+ * useful because a significant amount of both input and output data gets
+ * buffered internally by liblzma. This makes total_in and total_out give
+ * misleading information and also makes the progress indicator updates
+ * non-smooth.
+ *
+ * This function gives realistic progress information also in multi-threaded
+ * mode by taking into account the progress made by each thread. In
+ * single-threaded mode *progress_in and *progress_out are set to
+ * strm->total_in and strm->total_out, respectively.
+ */
+extern LZMA_API(void) lzma_get_progress(lzma_stream *strm,
+ uint64_t *progress_in, uint64_t *progress_out) lzma_nothrow;
+
+
+/**
* \brief Get the memory usage of decoder filter chain
*
* This function is currently supported only when *strm has been initialized
@@ -591,11 +644,16 @@ extern LZMA_API(uint64_t) lzma_memlimit_get(const lzma_stream *strm)
* This function is supported only when *strm has been initialized with
* a function that takes a memlimit argument.
*
+ * liblzma 5.2.3 and earlier has a bug where memlimit value of 0 causes
+ * this function to do nothing (leaving the limit unchanged) and still
+ * return LZMA_OK. Later versions treat 0 as if 1 had been specified (so
+ * lzma_memlimit_get() will return 1 even if you specify 0 here).
+ *
* \return - LZMA_OK: New memory usage limit successfully set.
* - LZMA_MEMLIMIT_ERROR: The new limit is too small.
* The limit was not changed.
* - LZMA_PROG_ERROR: Invalid arguments, e.g. *strm doesn't
- * support memory usage limit or memlimit was zero.
+ * support memory usage limit.
*/
extern LZMA_API(lzma_ret) lzma_memlimit_set(
lzma_stream *strm, uint64_t memlimit) lzma_nothrow;
diff --git a/Utilities/cmliblzma/liblzma/api/lzma/block.h b/Utilities/cmliblzma/liblzma/api/lzma/block.h
index e6710a7..7bdcfd7 100644
--- a/Utilities/cmliblzma/liblzma/api/lzma/block.h
+++ b/Utilities/cmliblzma/liblzma/api/lzma/block.h
@@ -31,11 +31,16 @@ typedef struct {
/**
* \brief Block format version
*
- * To prevent API and ABI breakages if new features are needed in
- * the Block field, a version number is used to indicate which
- * fields in this structure are in use. For now, version must always
- * be zero. With non-zero version, most Block related functions will
- * return LZMA_OPTIONS_ERROR.
+ * To prevent API and ABI breakages when new features are needed,
+ * a version number is used to indicate which fields in this
+ * structure are in use:
+ * - liblzma >= 5.0.0: version = 0 is supported.
+ * - liblzma >= 5.1.4beta: Support for version = 1 was added,
+ * which adds the ignore_check field.
+ *
+ * If version is greater than one, most Block related functions
+ * will return LZMA_OPTIONS_ERROR (lzma_block_header_decode() works
+ * with any version value).
*
* Read by:
* - All functions that take pointer to lzma_block as argument,
@@ -233,7 +238,28 @@ typedef struct {
lzma_reserved_enum reserved_enum2;
lzma_reserved_enum reserved_enum3;
lzma_reserved_enum reserved_enum4;
- lzma_bool reserved_bool1;
+
+ /**
+ * \brief A flag to Block decoder to not verify the Check field
+ *
+ * This field is supported by liblzma >= 5.1.4beta if .version >= 1.
+ *
+ * If this is set to true, the integrity check won't be calculated
+ * and verified. Unless you know what you are doing, you should
+ * leave this to false. (A reason to set this to true is when the
+ * file integrity is verified externally anyway and you want to
+ * speed up the decompression, which matters mostly when using
+ * SHA-256 as the integrity check.)
+ *
+ * If .version >= 1, read by:
+ * - lzma_block_decoder()
+ * - lzma_block_buffer_decode()
+ *
+ * Written by (.version is ignored):
+ * - lzma_block_header_decode() always sets this to false
+ */
+ lzma_bool ignore_check;
+
lzma_bool reserved_bool2;
lzma_bool reserved_bool3;
lzma_bool reserved_bool4;
@@ -310,10 +336,14 @@ extern LZMA_API(lzma_ret) lzma_block_header_encode(
/**
* \brief Decode Block Header
*
- * block->version should be set to the highest value supported by the
- * application; currently the only possible version is zero. This function
- * will set version to the lowest value that still supports all the features
- * required by the Block Header.
+ * block->version should (usually) be set to the highest value supported
+ * by the application. If the application sets block->version to a value
+ * higher than supported by the current liblzma version, this function will
+ * downgrade block->version to the highest value supported by it. Thus one
+ * should check the value of block->version after calling this function if
+ * block->version was set to a non-zero value and the application doesn't
+ * otherwise know that the liblzma version being used is new enough to
+ * support the specified block->version.
*
* The size of the Block Header must have already been decoded with
* lzma_block_header_size_decode() macro and stored to block->header_size.
@@ -344,7 +374,7 @@ extern LZMA_API(lzma_ret) lzma_block_header_encode(
* block->header_size is invalid or block->filters is NULL.
*/
extern LZMA_API(lzma_ret) lzma_block_header_decode(lzma_block *block,
- lzma_allocator *allocator, const uint8_t *in)
+ const lzma_allocator *allocator, const uint8_t *in)
lzma_nothrow lzma_attr_warn_unused_result;
@@ -493,7 +523,25 @@ extern LZMA_API(size_t) lzma_block_buffer_bound(size_t uncompressed_size)
* - LZMA_PROG_ERROR
*/
extern LZMA_API(lzma_ret) lzma_block_buffer_encode(
- lzma_block *block, lzma_allocator *allocator,
+ lzma_block *block, const lzma_allocator *allocator,
+ const uint8_t *in, size_t in_size,
+ uint8_t *out, size_t *out_pos, size_t out_size)
+ lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
+ * \brief Single-call uncompressed .xz Block encoder
+ *
+ * This is like lzma_block_buffer_encode() except this doesn't try to
+ * compress the data and instead encodes the data using LZMA2 uncompressed
+ * chunks. The required output buffer size can be determined with
+ * lzma_block_buffer_bound().
+ *
+ * Since the data won't be compressed, this function ignores block->filters.
+ * This function doesn't take lzma_allocator because this function doesn't
+ * allocate any memory from the heap.
+ */
+extern LZMA_API(lzma_ret) lzma_block_uncomp_encode(lzma_block *block,
const uint8_t *in, size_t in_size,
uint8_t *out, size_t *out_pos, size_t out_size)
lzma_nothrow lzma_attr_warn_unused_result;
@@ -527,7 +575,7 @@ extern LZMA_API(lzma_ret) lzma_block_buffer_encode(
* - LZMA_PROG_ERROR
*/
extern LZMA_API(lzma_ret) lzma_block_buffer_decode(
- lzma_block *block, lzma_allocator *allocator,
+ lzma_block *block, const lzma_allocator *allocator,
const uint8_t *in, size_t *in_pos, size_t in_size,
uint8_t *out, size_t *out_pos, size_t out_size)
lzma_nothrow;
diff --git a/Utilities/cmliblzma/liblzma/api/lzma/container.h b/Utilities/cmliblzma/liblzma/api/lzma/container.h
index 7a9ffc6..9fbf4df 100644
--- a/Utilities/cmliblzma/liblzma/api/lzma/container.h
+++ b/Utilities/cmliblzma/liblzma/api/lzma/container.h
@@ -61,6 +61,131 @@
/**
+ * \brief Multithreading options
+ */
+typedef struct {
+ /**
+ * \brief Flags
+ *
+ * Set this to zero if no flags are wanted.
+ *
+ * No flags are currently supported.
+ */
+ uint32_t flags;
+
+ /**
+ * \brief Number of worker threads to use
+ */
+ uint32_t threads;
+
+ /**
+ * \brief Maximum uncompressed size of a Block
+ *
+ * The encoder will start a new .xz Block every block_size bytes.
+ * Using LZMA_FULL_FLUSH or LZMA_FULL_BARRIER with lzma_code()
+ * the caller may tell liblzma to start a new Block earlier.
+ *
+ * With LZMA2, a recommended block size is 2-4 times the LZMA2
+ * dictionary size. With very small dictionaries, it is recommended
+ * to use at least 1 MiB block size for good compression ratio, even
+ * if this is more than four times the dictionary size. Note that
+ * these are only recommendations for typical use cases; feel free
+ * to use other values. Just keep in mind that using a block size
+ * less than the LZMA2 dictionary size is waste of RAM.
+ *
+ * Set this to 0 to let liblzma choose the block size depending
+ * on the compression options. For LZMA2 it will be 3*dict_size
+ * or 1 MiB, whichever is more.
+ *
+ * For each thread, about 3 * block_size bytes of memory will be
+ * allocated. This may change in later liblzma versions. If so,
+ * the memory usage will probably be reduced, not increased.
+ */
+ uint64_t block_size;
+
+ /**
+ * \brief Timeout to allow lzma_code() to return early
+ *
+ * Multithreading can make liblzma to consume input and produce
+ * output in a very bursty way: it may first read a lot of input
+ * to fill internal buffers, then no input or output occurs for
+ * a while.
+ *
+ * In single-threaded mode, lzma_code() won't return until it has
+ * either consumed all the input or filled the output buffer. If
+ * this is done in multithreaded mode, it may cause a call
+ * lzma_code() to take even tens of seconds, which isn't acceptable
+ * in all applications.
+ *
+ * To avoid very long blocking times in lzma_code(), a timeout
+ * (in milliseconds) may be set here. If lzma_code() would block
+ * longer than this number of milliseconds, it will return with
+ * LZMA_OK. Reasonable values are 100 ms or more. The xz command
+ * line tool uses 300 ms.
+ *
+ * If long blocking times are fine for you, set timeout to a special
+ * value of 0, which will disable the timeout mechanism and will make
+ * lzma_code() block until all the input is consumed or the output
+ * buffer has been filled.
+ *
+ * \note Even with a timeout, lzma_code() might sometimes take
+ * somewhat long time to return. No timing guarantees
+ * are made.
+ */
+ uint32_t timeout;
+
+ /**
+ * \brief Compression preset (level and possible flags)
+ *
+ * The preset is set just like with lzma_easy_encoder().
+ * The preset is ignored if filters below is non-NULL.
+ */
+ uint32_t preset;
+
+ /**
+ * \brief Filter chain (alternative to a preset)
+ *
+ * If this is NULL, the preset above is used. Otherwise the preset
+ * is ignored and the filter chain specified here is used.
+ */
+ const lzma_filter *filters;
+
+ /**
+ * \brief Integrity check type
+ *
+ * See check.h for available checks. The xz command line tool
+ * defaults to LZMA_CHECK_CRC64, which is a good choice if you
+ * are unsure.
+ */
+ lzma_check check;
+
+ /*
+ * Reserved space to allow possible future extensions without
+ * breaking the ABI. You should not touch these, because the names
+ * of these variables may change. These are and will never be used
+ * with the currently supported options, so it is safe to leave these
+ * uninitialized.
+ */
+ lzma_reserved_enum reserved_enum1;
+ lzma_reserved_enum reserved_enum2;
+ lzma_reserved_enum reserved_enum3;
+ uint32_t reserved_int1;
+ uint32_t reserved_int2;
+ uint32_t reserved_int3;
+ uint32_t reserved_int4;
+ uint64_t reserved_int5;
+ uint64_t reserved_int6;
+ uint64_t reserved_int7;
+ uint64_t reserved_int8;
+ void *reserved_ptr1;
+ void *reserved_ptr2;
+ void *reserved_ptr3;
+ void *reserved_ptr4;
+
+} lzma_mt;
+
+
+/**
* \brief Calculate approximate memory usage of easy encoder
*
* This function is a wrapper for lzma_raw_encoder_memusage().
@@ -165,7 +290,8 @@ extern LZMA_API(lzma_ret) lzma_easy_encoder(
*/
extern LZMA_API(lzma_ret) lzma_easy_buffer_encode(
uint32_t preset, lzma_check check,
- lzma_allocator *allocator, const uint8_t *in, size_t in_size,
+ const lzma_allocator *allocator,
+ const uint8_t *in, size_t in_size,
uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;
@@ -191,6 +317,49 @@ extern LZMA_API(lzma_ret) lzma_stream_encoder(lzma_stream *strm,
/**
+ * \brief Calculate approximate memory usage of multithreaded .xz encoder
+ *
+ * Since doing the encoding in threaded mode doesn't affect the memory
+ * requirements of single-threaded decompressor, you can use
+ * lzma_easy_decoder_memusage(options->preset) or
+ * lzma_raw_decoder_memusage(options->filters) to calculate
+ * the decompressor memory requirements.
+ *
+ * \param options Compression options
+ *
+ * \return Number of bytes of memory required for encoding with the
+ * given options. If an error occurs, for example due to
+ * unsupported preset or filter chain, UINT64_MAX is returned.
+ */
+extern LZMA_API(uint64_t) lzma_stream_encoder_mt_memusage(
+ const lzma_mt *options) lzma_nothrow lzma_attr_pure;
+
+
+/**
+ * \brief Initialize multithreaded .xz Stream encoder
+ *
+ * This provides the functionality of lzma_easy_encoder() and
+ * lzma_stream_encoder() as a single function for multithreaded use.
+ *
+ * The supported actions for lzma_code() are LZMA_RUN, LZMA_FULL_FLUSH,
+ * LZMA_FULL_BARRIER, and LZMA_FINISH. Support for LZMA_SYNC_FLUSH might be
+ * added in the future.
+ *
+ * \param strm Pointer to properly prepared lzma_stream
+ * \param options Pointer to multithreaded compression options
+ *
+ * \return - LZMA_OK
+ * - LZMA_MEM_ERROR
+ * - LZMA_UNSUPPORTED_CHECK
+ * - LZMA_OPTIONS_ERROR
+ * - LZMA_PROG_ERROR
+ */
+extern LZMA_API(lzma_ret) lzma_stream_encoder_mt(
+ lzma_stream *strm, const lzma_mt *options)
+ lzma_nothrow lzma_attr_warn_unused_result;
+
+
+/**
* \brief Initialize .lzma encoder (legacy file format)
*
* The .lzma format is sometimes called the LZMA_Alone format, which is the
@@ -269,7 +438,8 @@ extern LZMA_API(size_t) lzma_stream_buffer_bound(size_t uncompressed_size)
*/
extern LZMA_API(lzma_ret) lzma_stream_buffer_encode(
lzma_filter *filters, lzma_check check,
- lzma_allocator *allocator, const uint8_t *in, size_t in_size,
+ const lzma_allocator *allocator,
+ const uint8_t *in, size_t in_size,
uint8_t *out, size_t *out_pos, size_t out_size)
lzma_nothrow lzma_attr_warn_unused_result;
@@ -305,6 +475,30 @@ extern LZMA_API(lzma_ret) lzma_stream_buffer_encode(
/**
+ * This flag makes lzma_code() not calculate and verify the integrity check
+ * of the compressed data in .xz files. This means that invalid integrity
+ * check values won't be detected and LZMA_DATA_ERROR won't be returned in
+ * such cases.
+ *
+ * This flag only affects the checks of the compressed data itself; the CRC32
+ * values in the .xz headers will still be verified normally.
+ *
+ * Don't use this flag unless you know what you are doing. Possible reasons
+ * to use this flag:
+ *
+ * - Trying to recover data from a corrupt .xz file.
+ *
+ * - Speeding up decompression, which matters mostly with SHA-256
+ * or with files that have compressed extremely well. It's recommended
+ * to not use this flag for this purpose unless the file integrity is
+ * verified externally in some other way.
+ *
+ * Support for this flag was added in liblzma 5.1.4beta.
+ */
+#define LZMA_IGNORE_CHECK UINT32_C(0x10)
+
+
+/**
* This flag enables decoding of concatenated files with file formats that
* allow concatenating compressed files as is. From the formats currently
* supported by liblzma, only the .xz format allows concatenated files.
@@ -326,7 +520,10 @@ extern LZMA_API(lzma_ret) lzma_stream_buffer_encode(
*
* \param strm Pointer to properly prepared lzma_stream
* \param memlimit Memory usage limit as bytes. Use UINT64_MAX
- * to effectively disable the limiter.
+ * to effectively disable the limiter. liblzma
+ * 5.2.3 and earlier don't allow 0 here and return
+ * LZMA_PROG_ERROR; later versions treat 0 as if 1
+ * had been specified.
* \param flags Bitwise-or of zero or more of the decoder flags:
* LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK,
* LZMA_TELL_ANY_CHECK, LZMA_CONCATENATED
@@ -350,7 +547,10 @@ extern LZMA_API(lzma_ret) lzma_stream_decoder(
*
* \param strm Pointer to properly prepared lzma_stream
* \param memlimit Memory usage limit as bytes. Use UINT64_MAX
- * to effectively disable the limiter.
+ * to effectively disable the limiter. liblzma
+ * 5.2.3 and earlier don't allow 0 here and return
+ * LZMA_PROG_ERROR; later versions treat 0 as if 1
+ * had been specified.
* \param flags Bitwise-or of flags, or zero for no flags.
*
* \return - LZMA_OK: Initialization was successful.
@@ -366,9 +566,16 @@ extern LZMA_API(lzma_ret) lzma_auto_decoder(
/**
* \brief Initialize .lzma decoder (legacy file format)
*
+ * \param strm Pointer to properly prepared lzma_stream
+ * \param memlimit Memory usage limit as bytes. Use UINT64_MAX
+ * to effectively disable the limiter. liblzma
+ * 5.2.3 and earlier don't allow 0 here and return
+ * LZMA_PROG_ERROR; later versions treat 0 as if 1
+ * had been specified.
+ *
* Valid `action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH.
- * There is no need to use LZMA_FINISH, but allowing it may simplify
- * certain types of applications.
+ * There is no need to use LZMA_FINISH, but it's allowed because it may
+ * simplify certain types of applications.
*
* \return - LZMA_OK
* - LZMA_MEM_ERROR
@@ -418,7 +625,8 @@ extern LZMA_API(lzma_ret) lzma_alone_decoder(
* - LZMA_PROG_ERROR
*/
extern LZMA_API(lzma_ret) lzma_stream_buffer_decode(
- uint64_t *memlimit, uint32_t flags, lzma_allocator *allocator,
+ uint64_t *memlimit, uint32_t flags,
+ const lzma_allocator *allocator,
const uint8_t *in, size_t *in_pos, size_t in_size,
uint8_t *out, size_t *out_pos, size_t out_size)
lzma_nothrow lzma_attr_warn_unused_result;
diff --git a/Utilities/cmliblzma/liblzma/api/lzma/filter.h b/Utilities/cmliblzma/liblzma/api/lzma/filter.h
index e0bc163..4e78752 100644
--- a/Utilities/cmliblzma/liblzma/api/lzma/filter.h
+++ b/Utilities/cmliblzma/liblzma/api/lzma/filter.h
@@ -116,8 +116,9 @@ extern LZMA_API(lzma_bool) lzma_filter_decoder_is_supported(lzma_vli id)
* is not NULL.
* - LZMA_PROG_ERROR: src or dest is NULL.
*/
-extern LZMA_API(lzma_ret) lzma_filters_copy(const lzma_filter *src,
- lzma_filter *dest, lzma_allocator *allocator) lzma_nothrow;
+extern LZMA_API(lzma_ret) lzma_filters_copy(
+ const lzma_filter *src, lzma_filter *dest,
+ const lzma_allocator *allocator) lzma_nothrow;
/**
@@ -256,7 +257,7 @@ extern LZMA_API(lzma_ret) lzma_filters_update(
* won't necessarily meet that bound.)
*/
extern LZMA_API(lzma_ret) lzma_raw_buffer_encode(
- const lzma_filter *filters, lzma_allocator *allocator,
+ const lzma_filter *filters, const lzma_allocator *allocator,
const uint8_t *in, size_t in_size, uint8_t *out,
size_t *out_pos, size_t out_size) lzma_nothrow;
@@ -280,7 +281,7 @@ extern LZMA_API(lzma_ret) lzma_raw_buffer_encode(
* which no data is written to is out[out_size].
*/
extern LZMA_API(lzma_ret) lzma_raw_buffer_decode(
- const lzma_filter *filters, lzma_allocator *allocator,
+ const lzma_filter *filters, const lzma_allocator *allocator,
const uint8_t *in, size_t *in_pos, size_t in_size,
uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;
@@ -356,7 +357,7 @@ extern LZMA_API(lzma_ret) lzma_properties_encode(
* - LZMA_MEM_ERROR
*/
extern LZMA_API(lzma_ret) lzma_properties_decode(
- lzma_filter *filter, lzma_allocator *allocator,
+ lzma_filter *filter, const lzma_allocator *allocator,
const uint8_t *props, size_t props_size) lzma_nothrow;
@@ -419,6 +420,6 @@ extern LZMA_API(lzma_ret) lzma_filter_flags_encode(const lzma_filter *filter,
* - LZMA_PROG_ERROR
*/
extern LZMA_API(lzma_ret) lzma_filter_flags_decode(
- lzma_filter *filter, lzma_allocator *allocator,
+ lzma_filter *filter, const lzma_allocator *allocator,
const uint8_t *in, size_t *in_pos, size_t in_size)
lzma_nothrow lzma_attr_warn_unused_result;
diff --git a/Utilities/cmliblzma/liblzma/api/lzma/hardware.h b/Utilities/cmliblzma/liblzma/api/lzma/hardware.h
index e7dd03c..5321d9a 100644
--- a/Utilities/cmliblzma/liblzma/api/lzma/hardware.h
+++ b/Utilities/cmliblzma/liblzma/api/lzma/hardware.h
@@ -48,3 +48,17 @@
* of RAM on the specific operating system.
*/
extern LZMA_API(uint64_t) lzma_physmem(void) lzma_nothrow;
+
+
+/**
+ * \brief Get the number of processor cores or threads
+ *
+ * This function may be useful when determining how many threads to use.
+ * If the hardware supports more than one thread per CPU core, the number
+ * of hardware threads is returned if that information is available.
+ *
+ * \brief On success, the number of available CPU threads or cores is
+ * returned. If this information isn't available or an error
+ * occurs, zero is returned.
+ */
+extern LZMA_API(uint32_t) lzma_cputhreads(void) lzma_nothrow;
diff --git a/Utilities/cmliblzma/liblzma/api/lzma/index.h b/Utilities/cmliblzma/liblzma/api/lzma/index.h
index 16bacc2..3dac6fb 100644
--- a/Utilities/cmliblzma/liblzma/api/lzma/index.h
+++ b/Utilities/cmliblzma/liblzma/api/lzma/index.h
@@ -303,7 +303,7 @@ extern LZMA_API(uint64_t) lzma_index_memused(const lzma_index *i)
* \return On success, a pointer to an empty initialized lzma_index is
* returned. If allocation fails, NULL is returned.
*/
-extern LZMA_API(lzma_index *) lzma_index_init(lzma_allocator *allocator)
+extern LZMA_API(lzma_index *) lzma_index_init(const lzma_allocator *allocator)
lzma_nothrow;
@@ -312,8 +312,8 @@ extern LZMA_API(lzma_index *) lzma_index_init(lzma_allocator *allocator)
*
* If i is NULL, this does nothing.
*/
-extern LZMA_API(void) lzma_index_end(lzma_index *i, lzma_allocator *allocator)
- lzma_nothrow;
+extern LZMA_API(void) lzma_index_end(
+ lzma_index *i, const lzma_allocator *allocator) lzma_nothrow;
/**
@@ -341,7 +341,7 @@ extern LZMA_API(void) lzma_index_end(lzma_index *i, lzma_allocator *allocator)
* - LZMA_PROG_ERROR
*/
extern LZMA_API(lzma_ret) lzma_index_append(
- lzma_index *i, lzma_allocator *allocator,
+ lzma_index *i, const lzma_allocator *allocator,
lzma_vli unpadded_size, lzma_vli uncompressed_size)
lzma_nothrow lzma_attr_warn_unused_result;
@@ -564,8 +564,8 @@ extern LZMA_API(lzma_bool) lzma_index_iter_locate(
* - LZMA_MEM_ERROR
* - LZMA_PROG_ERROR
*/
-extern LZMA_API(lzma_ret) lzma_index_cat(
- lzma_index *dest, lzma_index *src, lzma_allocator *allocator)
+extern LZMA_API(lzma_ret) lzma_index_cat(lzma_index *dest, lzma_index *src,
+ const lzma_allocator *allocator)
lzma_nothrow lzma_attr_warn_unused_result;
@@ -575,7 +575,7 @@ extern LZMA_API(lzma_ret) lzma_index_cat(
* \return A copy of the lzma_index, or NULL if memory allocation failed.
*/
extern LZMA_API(lzma_index *) lzma_index_dup(
- const lzma_index *i, lzma_allocator *allocator)
+ const lzma_index *i, const lzma_allocator *allocator)
lzma_nothrow lzma_attr_warn_unused_result;
@@ -586,8 +586,7 @@ extern LZMA_API(lzma_index *) lzma_index_dup(
* \param i Pointer to lzma_index which should be encoded.
*
* The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH.
- * It is enough to use only one of them (you can choose freely; use LZMA_RUN
- * to support liblzma versions older than 5.0.0).
+ * It is enough to use only one of them (you can choose freely).
*
* \return - LZMA_OK: Initialization succeeded, continue with lzma_code().
* - LZMA_MEM_ERROR
@@ -610,16 +609,21 @@ extern LZMA_API(lzma_ret) lzma_index_encoder(
* to a new lzma_index, which the application
* has to later free with lzma_index_end().
* \param memlimit How much memory the resulting lzma_index is
- * allowed to require.
+ * allowed to require. liblzma 5.2.3 and earlier
+ * don't allow 0 here and return LZMA_PROG_ERROR;
+ * later versions treat 0 as if 1 had been specified.
*
- * The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH.
- * It is enough to use only one of them (you can choose freely; use LZMA_RUN
- * to support liblzma versions older than 5.0.0).
+ * Valid `action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH.
+ * There is no need to use LZMA_FINISH, but it's allowed because it may
+ * simplify certain types of applications.
*
* \return - LZMA_OK: Initialization succeeded, continue with lzma_code().
* - LZMA_MEM_ERROR
- * - LZMA_MEMLIMIT_ERROR
* - LZMA_PROG_ERROR
+ *
+ * liblzma 5.2.3 and older list also LZMA_MEMLIMIT_ERROR here
+ * but that error code has never been possible from this
+ * initialization function.
*/
extern LZMA_API(lzma_ret) lzma_index_decoder(
lzma_stream *strm, lzma_index **i, uint64_t memlimit)
@@ -677,6 +681,6 @@ extern LZMA_API(lzma_ret) lzma_index_buffer_encode(const lzma_index *i,
* - LZMA_PROG_ERROR
*/
extern LZMA_API(lzma_ret) lzma_index_buffer_decode(lzma_index **i,
- uint64_t *memlimit, lzma_allocator *allocator,
+ uint64_t *memlimit, const lzma_allocator *allocator,
const uint8_t *in, size_t *in_pos, size_t in_size)
lzma_nothrow;
diff --git a/Utilities/cmliblzma/liblzma/api/lzma/index_hash.h b/Utilities/cmliblzma/liblzma/api/lzma/index_hash.h
index fa2e048..9287f1d 100644
--- a/Utilities/cmliblzma/liblzma/api/lzma/index_hash.h
+++ b/Utilities/cmliblzma/liblzma/api/lzma/index_hash.h
@@ -37,7 +37,7 @@ typedef struct lzma_index_hash_s lzma_index_hash;
* pointer than the index_hash that was given as an argument.
*/
extern LZMA_API(lzma_index_hash *) lzma_index_hash_init(
- lzma_index_hash *index_hash, lzma_allocator *allocator)
+ lzma_index_hash *index_hash, const lzma_allocator *allocator)
lzma_nothrow lzma_attr_warn_unused_result;
@@ -45,7 +45,7 @@ extern LZMA_API(lzma_index_hash *) lzma_index_hash_init(
* \brief Deallocate lzma_index_hash structure
*/
extern LZMA_API(void) lzma_index_hash_end(
- lzma_index_hash *index_hash, lzma_allocator *allocator)
+ lzma_index_hash *index_hash, const lzma_allocator *allocator)
lzma_nothrow;
diff --git a/Utilities/cmliblzma/liblzma/api/lzma/lzma.h b/Utilities/cmliblzma/liblzma/api/lzma/lzma12.h
index 3f8e095..4e32fa3 100644
--- a/Utilities/cmliblzma/liblzma/api/lzma/lzma.h
+++ b/Utilities/cmliblzma/liblzma/api/lzma/lzma12.h
@@ -1,5 +1,5 @@
/**
- * \file lzma/lzma.h
+ * \file lzma/lzma12.h
* \brief LZMA1 and LZMA2 filters
*/
diff --git a/Utilities/cmliblzma/liblzma/api/lzma/version.h b/Utilities/cmliblzma/liblzma/api/lzma/version.h
index 09866b9..143c7de 100644
--- a/Utilities/cmliblzma/liblzma/api/lzma/version.h
+++ b/Utilities/cmliblzma/liblzma/api/lzma/version.h
@@ -21,8 +21,8 @@
* Version number split into components
*/
#define LZMA_VERSION_MAJOR 5
-#define LZMA_VERSION_MINOR 0
-#define LZMA_VERSION_PATCH 8
+#define LZMA_VERSION_MINOR 2
+#define LZMA_VERSION_PATCH 4
#define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE
#ifndef LZMA_VERSION_COMMIT
diff --git a/Utilities/cmliblzma/liblzma/check/check.c b/Utilities/cmliblzma/liblzma/check/check.c
index 979b0a8..428ddae 100644
--- a/Utilities/cmliblzma/liblzma/check/check.c
+++ b/Utilities/cmliblzma/liblzma/check/check.c
@@ -16,6 +16,9 @@
extern LZMA_API(lzma_bool)
lzma_check_is_supported(lzma_check type)
{
+ if ((unsigned int)(type) > LZMA_CHECK_ID_MAX)
+ return false;
+
static const lzma_bool available_checks[LZMA_CHECK_ID_MAX + 1] = {
true, // LZMA_CHECK_NONE
@@ -53,9 +56,6 @@ lzma_check_is_supported(lzma_check type)
false, // Reserved
};
- if ((unsigned int)(type) > LZMA_CHECK_ID_MAX)
- return false;
-
return available_checks[(unsigned int)(type)];
}
@@ -63,6 +63,9 @@ lzma_check_is_supported(lzma_check type)
extern LZMA_API(uint32_t)
lzma_check_size(lzma_check type)
{
+ if ((unsigned int)(type) > LZMA_CHECK_ID_MAX)
+ return UINT32_MAX;
+
// See file-format.txt section 2.1.1.2.
static const uint8_t check_sizes[LZMA_CHECK_ID_MAX + 1] = {
0,
@@ -73,9 +76,6 @@ lzma_check_size(lzma_check type)
64, 64, 64
};
- if ((unsigned int)(type) > LZMA_CHECK_ID_MAX)
- return UINT32_MAX;
-
return check_sizes[(unsigned int)(type)];
}
diff --git a/Utilities/cmliblzma/liblzma/check/check.h b/Utilities/cmliblzma/liblzma/check/check.h
index e100d2b..3007d88 100644
--- a/Utilities/cmliblzma/liblzma/check/check.h
+++ b/Utilities/cmliblzma/liblzma/check/check.h
@@ -15,6 +15,53 @@
#include "common.h"
+// If the function for external SHA-256 is missing, use the internal SHA-256
+// code. Due to how configure works, these defines can only get defined when
+// both a usable header and a type have already been found.
+#if !(defined(HAVE_CC_SHA256_INIT) \
+ || defined(HAVE_SHA256_INIT) \
+ || defined(HAVE_SHA256INIT))
+# define HAVE_INTERNAL_SHA256 1
+#endif
+
+#if defined(HAVE_INTERNAL_SHA256)
+// Nothing
+#elif defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H)
+# include <CommonCrypto/CommonDigest.h>
+#elif defined(HAVE_SHA256_H)
+# include <sys/types.h>
+# include <sha256.h>
+#elif defined(HAVE_SHA2_H)
+# include <sys/types.h>
+# include <sha2.h>
+#endif
+
+#if defined(HAVE_INTERNAL_SHA256)
+/// State for the internal SHA-256 implementation
+typedef struct {
+ /// Internal state
+ uint32_t state[8];
+
+ /// Size of the message excluding padding
+ uint64_t size;
+} lzma_sha256_state;
+#elif defined(HAVE_CC_SHA256_CTX)
+typedef CC_SHA256_CTX lzma_sha256_state;
+#elif defined(HAVE_SHA256_CTX)
+typedef SHA256_CTX lzma_sha256_state;
+#elif defined(HAVE_SHA2_CTX)
+typedef SHA2_CTX lzma_sha256_state;
+#endif
+
+#if defined(HAVE_INTERNAL_SHA256)
+// Nothing
+#elif defined(HAVE_CC_SHA256_INIT)
+# define LZMA_SHA256FUNC(x) CC_SHA256_ ## x
+#elif defined(HAVE_SHA256_INIT)
+# define LZMA_SHA256FUNC(x) SHA256_ ## x
+#elif defined(HAVE_SHA256INIT)
+# define LZMA_SHA256FUNC(x) SHA256 ## x
+#endif
// Index hashing needs the best possible hash function (preferably
// a cryptographic hash) for maximum reliability.
@@ -43,14 +90,7 @@ typedef struct {
union {
uint32_t crc32;
uint64_t crc64;
-
- struct {
- /// Internal state
- uint32_t state[8];
-
- /// Size of the message excluding padding
- uint64_t size;
- } sha256;
+ lzma_sha256_state sha256;
} state;
} lzma_check_state;
@@ -82,6 +122,8 @@ extern void lzma_check_update(lzma_check_state *check, lzma_check type,
extern void lzma_check_finish(lzma_check_state *check, lzma_check type);
+#ifndef LZMA_SHA256FUNC
+
/// Prepare SHA-256 state for new input.
extern void lzma_sha256_init(lzma_check_state *check);
@@ -92,4 +134,39 @@ extern void lzma_sha256_update(
/// Finish the SHA-256 calculation and store the result to check->buffer.u8.
extern void lzma_sha256_finish(lzma_check_state *check);
+
+#else
+
+static inline void
+lzma_sha256_init(lzma_check_state *check)
+{
+ LZMA_SHA256FUNC(Init)(&check->state.sha256);
+}
+
+
+static inline void
+lzma_sha256_update(const uint8_t *buf, size_t size, lzma_check_state *check)
+{
+#if defined(HAVE_CC_SHA256_INIT) && SIZE_MAX > UINT32_MAX
+ // Darwin's CC_SHA256_Update takes uint32_t as the buffer size,
+ // so use a loop to support size_t.
+ while (size > UINT32_MAX) {
+ LZMA_SHA256FUNC(Update)(&check->state.sha256, buf, UINT32_MAX);
+ buf += UINT32_MAX;
+ size -= UINT32_MAX;
+ }
+#endif
+
+ LZMA_SHA256FUNC(Update)(&check->state.sha256, buf, size);
+}
+
+
+static inline void
+lzma_sha256_finish(lzma_check_state *check)
+{
+ LZMA_SHA256FUNC(Final)(check->buffer.u8, &check->state.sha256);
+}
+
+#endif
+
#endif
diff --git a/Utilities/cmliblzma/liblzma/check/crc32_fast.c b/Utilities/cmliblzma/liblzma/check/crc32_fast.c
index c2c3cb7..3de0263 100644
--- a/Utilities/cmliblzma/liblzma/check/crc32_fast.c
+++ b/Utilities/cmliblzma/liblzma/check/crc32_fast.c
@@ -33,8 +33,6 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc)
#endif
if (size > 8) {
- const uint8_t * limit;
-
// Fix the alignment, if needed. The if statement above
// ensures that this won't read past the end of buf[].
while ((uintptr_t)(buf) & 7) {
@@ -43,7 +41,7 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc)
}
// Calculate the position where to stop.
- limit = buf + (size & ~(size_t)(7));
+ const uint8_t *const limit = buf + (size & ~(size_t)(7));
// Calculate how many bytes must be calculated separately
// before returning the result.
@@ -51,8 +49,6 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc)
// Calculate the CRC32 using the slice-by-eight algorithm.
while (buf < limit) {
- uint32_t tmp;
-
crc ^= *(const uint32_t *)(buf);
buf += 4;
@@ -61,7 +57,7 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc)
^ lzma_crc32_table[5][C(crc)]
^ lzma_crc32_table[4][D(crc)];
- tmp = *(const uint32_t *)(buf);
+ const uint32_t tmp = *(const uint32_t *)(buf);
buf += 4;
// At least with some compilers, it is critical for
diff --git a/Utilities/cmliblzma/liblzma/check/crc64_fast.c b/Utilities/cmliblzma/liblzma/check/crc64_fast.c
index 1436557..52af29e 100644
--- a/Utilities/cmliblzma/liblzma/check/crc64_fast.c
+++ b/Utilities/cmliblzma/liblzma/check/crc64_fast.c
@@ -36,14 +36,12 @@ lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc)
#endif
if (size > 4) {
- const uint8_t *limit;
-
while ((uintptr_t)(buf) & 3) {
crc = lzma_crc64_table[0][*buf++ ^ A1(crc)] ^ S8(crc);
--size;
}
- limit = buf + (size & ~(size_t)(3));
+ const uint8_t *const limit = buf + (size & ~(size_t)(3));
size &= (size_t)(3);
while (buf < limit) {
diff --git a/Utilities/cmliblzma/liblzma/check/sha256.c b/Utilities/cmliblzma/liblzma/check/sha256.c
index 3af6aa6..5eede5c 100644
--- a/Utilities/cmliblzma/liblzma/check/sha256.c
+++ b/Utilities/cmliblzma/liblzma/check/sha256.c
@@ -21,22 +21,22 @@
//
///////////////////////////////////////////////////////////////////////////////
-// Avoid bogus warnings in transform().
-#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 2) || __GNUC__ > 4
-# pragma GCC diagnostic ignored "-Wuninitialized"
-#endif
-
#include "check.h"
-// At least on x86, GCC is able to optimize this to a rotate instruction.
-#define rotr_32(num, amount) ((num) >> (amount) | (num) << (32 - (amount)))
+// Rotate a uint32_t. GCC can optimize this to a rotate instruction
+// at least on x86.
+static inline uint32_t
+rotr_32(uint32_t num, unsigned amount)
+{
+ return (num >> amount) | (num << (32 - amount));
+}
-#define blk0(i) (W[i] = data[i])
+#define blk0(i) (W[i] = conv32be(data[i]))
#define blk2(i) (W[i & 15] += s1(W[(i - 2) & 15]) + W[(i - 7) & 15] \
+ s0(W[(i - 15) & 15]))
#define Ch(x, y, z) (z ^ (x & (y ^ z)))
-#define Maj(x, y, z) ((x & y) | (z & (x | y)))
+#define Maj(x, y, z) ((x & (y ^ z)) + (y & z))
#define a(i) T[(0 - i) & 7]
#define b(i) T[(1 - i) & 7]
@@ -47,16 +47,17 @@
#define g(i) T[(6 - i) & 7]
#define h(i) T[(7 - i) & 7]
-#define R(i) \
- h(i) += S1(e(i)) + Ch(e(i), f(i), g(i)) + SHA256_K[i + j] \
- + (j ? blk2(i) : blk0(i)); \
+#define R(i, j, blk) \
+ h(i) += S1(e(i)) + Ch(e(i), f(i), g(i)) + SHA256_K[i + j] + blk; \
d(i) += h(i); \
h(i) += S0(a(i)) + Maj(a(i), b(i), c(i))
+#define R0(i) R(i, 0, blk0(i))
+#define R2(i) R(i, j, blk2(i))
-#define S0(x) (rotr_32(x, 2) ^ rotr_32(x, 13) ^ rotr_32(x, 22))
-#define S1(x) (rotr_32(x, 6) ^ rotr_32(x, 11) ^ rotr_32(x, 25))
-#define s0(x) (rotr_32(x, 7) ^ rotr_32(x, 18) ^ (x >> 3))
-#define s1(x) (rotr_32(x, 17) ^ rotr_32(x, 19) ^ (x >> 10))
+#define S0(x) rotr_32(x ^ rotr_32(x ^ rotr_32(x, 9), 11), 2)
+#define S1(x) rotr_32(x ^ rotr_32(x ^ rotr_32(x, 14), 5), 6)
+#define s0(x) (rotr_32(x ^ rotr_32(x, 11), 7) ^ (x >> 3))
+#define s1(x) (rotr_32(x ^ rotr_32(x, 2), 17) ^ (x >> 10))
static const uint32_t SHA256_K[64] = {
@@ -84,17 +85,22 @@ transform(uint32_t state[8], const uint32_t data[16])
{
uint32_t W[16];
uint32_t T[8];
- unsigned int j;
// Copy state[] to working vars.
memcpy(T, state, sizeof(T));
- // 64 operations, partially loop unrolled
- for (j = 0; j < 64; j += 16) {
- R( 0); R( 1); R( 2); R( 3);
- R( 4); R( 5); R( 6); R( 7);
- R( 8); R( 9); R(10); R(11);
- R(12); R(13); R(14); R(15);
+ // The first 16 operations unrolled
+ R0( 0); R0( 1); R0( 2); R0( 3);
+ R0( 4); R0( 5); R0( 6); R0( 7);
+ R0( 8); R0( 9); R0(10); R0(11);
+ R0(12); R0(13); R0(14); R0(15);
+
+ // The remaining 48 operations partially unrolled
+ for (unsigned int j = 16; j < 64; j += 16) {
+ R2( 0); R2( 1); R2( 2); R2( 3);
+ R2( 4); R2( 5); R2( 6); R2( 7);
+ R2( 8); R2( 9); R2(10); R2(11);
+ R2(12); R2(13); R2(14); R2(15);
}
// Add the working vars back into state[].
@@ -112,19 +118,7 @@ transform(uint32_t state[8], const uint32_t data[16])
static void
process(lzma_check_state *check)
{
-#ifdef WORDS_BIGENDIAN
transform(check->state.sha256.state, check->buffer.u32);
-
-#else
- uint32_t data[16];
- size_t i;
-
- for (i = 0; i < 16; ++i)
- data[i] = bswap32(check->buffer.u32[i]);
-
- transform(check->state.sha256.state, data);
-#endif
-
return;
}
@@ -174,8 +168,6 @@ lzma_sha256_update(const uint8_t *buf, size_t size, lzma_check_state *check)
extern void
lzma_sha256_finish(lzma_check_state *check)
{
- size_t i;
-
// Add padding as described in RFC 3174 (it describes SHA-1 but
// the same padding style is used for SHA-256 too).
size_t pos = check->state.sha256.size & 0x3F;
@@ -197,7 +189,7 @@ lzma_sha256_finish(lzma_check_state *check)
process(check);
- for (i = 0; i < 8; ++i)
+ for (size_t i = 0; i < 8; ++i)
check->buffer.u32[i] = conv32be(check->state.sha256.state[i]);
return;
diff --git a/Utilities/cmliblzma/liblzma/common/alone_decoder.c b/Utilities/cmliblzma/liblzma/common/alone_decoder.c
index 5f5e564..77d0a9b 100644
--- a/Utilities/cmliblzma/liblzma/common/alone_decoder.c
+++ b/Utilities/cmliblzma/liblzma/common/alone_decoder.c
@@ -15,7 +15,7 @@
#include "lz_decoder.h"
-struct lzma_coder_s {
+typedef struct {
lzma_next_coder next;
enum {
@@ -46,17 +46,19 @@ struct lzma_coder_s {
/// Options decoded from the header needed to initialize
/// the LZMA decoder
lzma_options_lzma options;
-};
+} lzma_alone_coder;
static lzma_ret
-alone_decode(lzma_coder *coder,
- lzma_allocator *allocator lzma_attribute((__unused__)),
- const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
- size_t in_size, uint8_t *LZMA_RESTRICT out,
- size_t *LZMA_RESTRICT out_pos, size_t out_size,
+alone_decode(void *coder_ptr,
+ const lzma_allocator *allocator lzma_attribute((__unused__)),
+ const uint8_t *restrict in, size_t *restrict in_pos,
+ size_t in_size, uint8_t *restrict out,
+ size_t *restrict out_pos, size_t out_size,
lzma_action action)
{
+ lzma_alone_coder *coder = coder_ptr;
+
while (*out_pos < out_size
&& (coder->sequence == SEQ_CODE || *in_pos < in_size))
switch (coder->sequence) {
@@ -126,17 +128,19 @@ alone_decode(lzma_coder *coder,
// Fall through
case SEQ_CODER_INIT: {
- lzma_ret ret;
+ if (coder->memusage > coder->memlimit)
+ return LZMA_MEMLIMIT_ERROR;
lzma_filter_info filters[2] = {
- { 0, &lzma_lzma_decoder_init, &coder->options },
- { 0, NULL, NULL }
+ {
+ .init = &lzma_lzma_decoder_init,
+ .options = &coder->options,
+ }, {
+ .init = NULL,
+ }
};
- if (coder->memusage > coder->memlimit)
- return LZMA_MEMLIMIT_ERROR;
-
- ret = lzma_next_filter_init(&coder->next,
+ const lzma_ret ret = lzma_next_filter_init(&coder->next,
allocator, filters);
if (ret != LZMA_OK)
return ret;
@@ -164,8 +168,9 @@ alone_decode(lzma_coder *coder,
static void
-alone_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
+alone_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
{
+ lzma_alone_coder *coder = coder_ptr;
lzma_next_end(&coder->next, allocator);
lzma_free(coder, allocator);
return;
@@ -173,9 +178,11 @@ alone_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
static lzma_ret
-alone_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
+alone_decoder_memconfig(void *coder_ptr, uint64_t *memusage,
uint64_t *old_memlimit, uint64_t new_memlimit)
{
+ lzma_alone_coder *coder = coder_ptr;
+
*memusage = coder->memusage;
*old_memlimit = coder->memlimit;
@@ -191,34 +198,34 @@ alone_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
extern lzma_ret
-lzma_alone_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_alone_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
uint64_t memlimit, bool picky)
{
lzma_next_coder_init(&lzma_alone_decoder_init, next, allocator);
- if (memlimit == 0)
- return LZMA_PROG_ERROR;
+ lzma_alone_coder *coder = next->coder;
- if (next->coder == NULL) {
- next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
- if (next->coder == NULL)
+ if (coder == NULL) {
+ coder = lzma_alloc(sizeof(lzma_alone_coder), allocator);
+ if (coder == NULL)
return LZMA_MEM_ERROR;
+ next->coder = coder;
next->code = &alone_decode;
next->end = &alone_decoder_end;
next->memconfig = &alone_decoder_memconfig;
- next->coder->next = LZMA_NEXT_CODER_INIT;
+ coder->next = LZMA_NEXT_CODER_INIT;
}
- next->coder->sequence = SEQ_PROPERTIES;
- next->coder->picky = picky;
- next->coder->pos = 0;
- next->coder->options.dict_size = 0;
- next->coder->options.preset_dict = NULL;
- next->coder->options.preset_dict_size = 0;
- next->coder->uncompressed_size = 0;
- next->coder->memlimit = memlimit;
- next->coder->memusage = LZMA_MEMUSAGE_BASE;
+ coder->sequence = SEQ_PROPERTIES;
+ coder->picky = picky;
+ coder->pos = 0;
+ coder->options.dict_size = 0;
+ coder->options.preset_dict = NULL;
+ coder->options.preset_dict_size = 0;
+ coder->uncompressed_size = 0;
+ coder->memlimit = my_max(1, memlimit);
+ coder->memusage = LZMA_MEMUSAGE_BASE;
return LZMA_OK;
}
@@ -227,7 +234,7 @@ lzma_alone_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern LZMA_API(lzma_ret)
lzma_alone_decoder(lzma_stream *strm, uint64_t memlimit)
{
- lzma_next_strm_init2(lzma_alone_decoder_init, strm, memlimit, false);
+ lzma_next_strm_init(lzma_alone_decoder_init, strm, memlimit, false);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
diff --git a/Utilities/cmliblzma/liblzma/common/alone_decoder.h b/Utilities/cmliblzma/liblzma/common/alone_decoder.h
index f666fc3..dfa031a 100644
--- a/Utilities/cmliblzma/liblzma/common/alone_decoder.h
+++ b/Utilities/cmliblzma/liblzma/common/alone_decoder.h
@@ -17,7 +17,7 @@
extern lzma_ret lzma_alone_decoder_init(
- lzma_next_coder *next, lzma_allocator *allocator,
+ lzma_next_coder *next, const lzma_allocator *allocator,
uint64_t memlimit, bool picky);
#endif
diff --git a/Utilities/cmliblzma/liblzma/common/alone_encoder.c b/Utilities/cmliblzma/liblzma/common/alone_encoder.c
index 4207b4a..4853cfd 100644
--- a/Utilities/cmliblzma/liblzma/common/alone_encoder.c
+++ b/Utilities/cmliblzma/liblzma/common/alone_encoder.c
@@ -17,7 +17,7 @@
#define ALONE_HEADER_SIZE (1 + 4 + 8)
-struct lzma_coder_s {
+typedef struct {
lzma_next_coder next;
enum {
@@ -27,17 +27,19 @@ struct lzma_coder_s {
size_t header_pos;
uint8_t header[ALONE_HEADER_SIZE];
-};
+} lzma_alone_coder;
static lzma_ret
-alone_encode(lzma_coder *coder,
- lzma_allocator *allocator lzma_attribute((__unused__)),
- const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
- size_t in_size, uint8_t *LZMA_RESTRICT out,
- size_t *LZMA_RESTRICT out_pos, size_t out_size,
+alone_encode(void *coder_ptr,
+ const lzma_allocator *allocator lzma_attribute((__unused__)),
+ const uint8_t *restrict in, size_t *restrict in_pos,
+ size_t in_size, uint8_t *restrict out,
+ size_t *restrict out_pos, size_t out_size,
lzma_action action)
{
+ lzma_alone_coder *coder = coder_ptr;
+
while (*out_pos < out_size)
switch (coder->sequence) {
case SEQ_HEADER:
@@ -65,8 +67,9 @@ alone_encode(lzma_coder *coder,
static void
-alone_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
+alone_encoder_end(void *coder_ptr, const lzma_allocator *allocator)
{
+ lzma_alone_coder *coder = coder_ptr;
lzma_next_end(&coder->next, allocator);
lzma_free(coder, allocator);
return;
@@ -75,36 +78,31 @@ alone_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
// At least for now, this is not used by any internal function.
static lzma_ret
-alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+alone_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_options_lzma *options)
{
- uint32_t d;
-
- // Initialize the LZMA encoder.
- const lzma_filter_info filters[2] = {
- { 0, &lzma_lzma_encoder_init, (void *)(options) },
- { 0, NULL, NULL }
- };
-
lzma_next_coder_init(&alone_encoder_init, next, allocator);
- if (next->coder == NULL) {
- next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
- if (next->coder == NULL)
+ lzma_alone_coder *coder = next->coder;
+
+ if (coder == NULL) {
+ coder = lzma_alloc(sizeof(lzma_alone_coder), allocator);
+ if (coder == NULL)
return LZMA_MEM_ERROR;
+ next->coder = coder;
next->code = &alone_encode;
next->end = &alone_encoder_end;
- next->coder->next = LZMA_NEXT_CODER_INIT;
+ coder->next = LZMA_NEXT_CODER_INIT;
}
// Basic initializations
- next->coder->sequence = SEQ_HEADER;
- next->coder->header_pos = 0;
+ coder->sequence = SEQ_HEADER;
+ coder->header_pos = 0;
// Encode the header:
// - Properties (1 byte)
- if (lzma_lzma_lclppb_encode(options, next->coder->header))
+ if (lzma_lzma_lclppb_encode(options, coder->header))
return LZMA_OPTIONS_ERROR;
// - Dictionary size (4 bytes)
@@ -115,7 +113,7 @@ alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
// one is the next unless it is UINT32_MAX. While the header would
// allow any 32-bit integer, we do this to keep the decoder of liblzma
// accepting the resulting files.
- d = options->dict_size - 1;
+ uint32_t d = options->dict_size - 1;
d |= d >> 2;
d |= d >> 3;
d |= d >> 4;
@@ -124,18 +122,28 @@ alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
if (d != UINT32_MAX)
++d;
- unaligned_write32le(next->coder->header + 1, d);
+ unaligned_write32le(coder->header + 1, d);
// - Uncompressed size (always unknown and using EOPM)
- memset(next->coder->header + 1 + 4, 0xFF, 8);
+ memset(coder->header + 1 + 4, 0xFF, 8);
+
+ // Initialize the LZMA encoder.
+ const lzma_filter_info filters[2] = {
+ {
+ .init = &lzma_lzma_encoder_init,
+ .options = (void *)(options),
+ }, {
+ .init = NULL,
+ }
+ };
- return lzma_next_filter_init(&next->coder->next, allocator, filters);
+ return lzma_next_filter_init(&coder->next, allocator, filters);
}
/*
extern lzma_ret
-lzma_alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_alone_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_options_alone *options)
{
lzma_next_coder_init(&alone_encoder_init, next, allocator, options);
@@ -146,7 +154,7 @@ lzma_alone_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern LZMA_API(lzma_ret)
lzma_alone_encoder(lzma_stream *strm, const lzma_options_lzma *options)
{
- lzma_next_strm_init1(alone_encoder_init, strm, options);
+ lzma_next_strm_init(alone_encoder_init, strm, options);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
diff --git a/Utilities/cmliblzma/liblzma/common/auto_decoder.c b/Utilities/cmliblzma/liblzma/common/auto_decoder.c
index 24cf489..6895c7c 100644
--- a/Utilities/cmliblzma/liblzma/common/auto_decoder.c
+++ b/Utilities/cmliblzma/liblzma/common/auto_decoder.c
@@ -14,7 +14,7 @@
#include "alone_decoder.h"
-struct lzma_coder_s {
+typedef struct {
/// Stream decoder or LZMA_Alone decoder
lzma_next_coder next;
@@ -26,15 +26,17 @@ struct lzma_coder_s {
SEQ_CODE,
SEQ_FINISH,
} sequence;
-};
+} lzma_auto_coder;
static lzma_ret
-auto_decode(lzma_coder *coder, lzma_allocator *allocator,
- const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
- size_t in_size, uint8_t *LZMA_RESTRICT out,
- size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action)
+auto_decode(void *coder_ptr, const lzma_allocator *allocator,
+ const uint8_t *restrict in, size_t *restrict in_pos,
+ size_t in_size, uint8_t *restrict out,
+ size_t *restrict out_pos, size_t out_size, lzma_action action)
{
+ lzma_auto_coder *coder = coder_ptr;
+
switch (coder->sequence) {
case SEQ_INIT:
if (*in_pos >= in_size)
@@ -100,8 +102,9 @@ auto_decode(lzma_coder *coder, lzma_allocator *allocator,
static void
-auto_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
+auto_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
{
+ lzma_auto_coder *coder = coder_ptr;
lzma_next_end(&coder->next, allocator);
lzma_free(coder, allocator);
return;
@@ -109,8 +112,10 @@ auto_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
static lzma_check
-auto_decoder_get_check(const lzma_coder *coder)
+auto_decoder_get_check(const void *coder_ptr)
{
+ const lzma_auto_coder *coder = coder_ptr;
+
// It is LZMA_Alone if get_check is NULL.
return coder->next.get_check == NULL ? LZMA_CHECK_NONE
: coder->next.get_check(coder->next.coder);
@@ -118,9 +123,11 @@ auto_decoder_get_check(const lzma_coder *coder)
static lzma_ret
-auto_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
+auto_decoder_memconfig(void *coder_ptr, uint64_t *memusage,
uint64_t *old_memlimit, uint64_t new_memlimit)
{
+ lzma_auto_coder *coder = coder_ptr;
+
lzma_ret ret;
if (coder->next.memconfig != NULL) {
@@ -132,7 +139,10 @@ auto_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
// the current memory usage.
*memusage = LZMA_MEMUSAGE_BASE;
*old_memlimit = coder->memlimit;
+
ret = LZMA_OK;
+ if (new_memlimit != 0 && new_memlimit < *memusage)
+ ret = LZMA_MEMLIMIT_ERROR;
}
if (ret == LZMA_OK && new_memlimit != 0)
@@ -143,32 +153,31 @@ auto_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
static lzma_ret
-auto_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+auto_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
uint64_t memlimit, uint32_t flags)
{
lzma_next_coder_init(&auto_decoder_init, next, allocator);
- if (memlimit == 0)
- return LZMA_PROG_ERROR;
-
if (flags & ~LZMA_SUPPORTED_FLAGS)
return LZMA_OPTIONS_ERROR;
- if (next->coder == NULL) {
- next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
- if (next->coder == NULL)
+ lzma_auto_coder *coder = next->coder;
+ if (coder == NULL) {
+ coder = lzma_alloc(sizeof(lzma_auto_coder), allocator);
+ if (coder == NULL)
return LZMA_MEM_ERROR;
+ next->coder = coder;
next->code = &auto_decode;
next->end = &auto_decoder_end;
next->get_check = &auto_decoder_get_check;
next->memconfig = &auto_decoder_memconfig;
- next->coder->next = LZMA_NEXT_CODER_INIT;
+ coder->next = LZMA_NEXT_CODER_INIT;
}
- next->coder->memlimit = memlimit;
- next->coder->flags = flags;
- next->coder->sequence = SEQ_INIT;
+ coder->memlimit = my_max(1, memlimit);
+ coder->flags = flags;
+ coder->sequence = SEQ_INIT;
return LZMA_OK;
}
@@ -177,7 +186,7 @@ auto_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern LZMA_API(lzma_ret)
lzma_auto_decoder(lzma_stream *strm, uint64_t memlimit, uint32_t flags)
{
- lzma_next_strm_init2(auto_decoder_init, strm, memlimit, flags);
+ lzma_next_strm_init(auto_decoder_init, strm, memlimit, flags);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
diff --git a/Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c b/Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c
index b4bd388..b0ded90 100644
--- a/Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c
+++ b/Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c
@@ -14,13 +14,10 @@
extern LZMA_API(lzma_ret)
-lzma_block_buffer_decode(lzma_block *block, lzma_allocator *allocator,
+lzma_block_buffer_decode(lzma_block *block, const lzma_allocator *allocator,
const uint8_t *in, size_t *in_pos, size_t in_size,
uint8_t *out, size_t *out_pos, size_t out_size)
{
- lzma_next_coder block_decoder;
- lzma_ret ret;
-
if (in_pos == NULL || (in == NULL && *in_pos != in_size)
|| *in_pos > in_size || out_pos == NULL
|| (out == NULL && *out_pos != out_size)
@@ -28,8 +25,9 @@ lzma_block_buffer_decode(lzma_block *block, lzma_allocator *allocator,
return LZMA_PROG_ERROR;
// Initialize the Block decoder.
- block_decoder = LZMA_NEXT_CODER_INIT;
- ret = lzma_block_decoder_init(&block_decoder, allocator, block);
+ lzma_next_coder block_decoder = LZMA_NEXT_CODER_INIT;
+ lzma_ret ret = lzma_block_decoder_init(
+ &block_decoder, allocator, block);
if (ret == LZMA_OK) {
// Save the positions so that we can restore them in case
diff --git a/Utilities/cmliblzma/liblzma/common/block_buffer_encoder.c b/Utilities/cmliblzma/liblzma/common/block_buffer_encoder.c
index 136f7f5..39e263a 100644
--- a/Utilities/cmliblzma/liblzma/common/block_buffer_encoder.c
+++ b/Utilities/cmliblzma/liblzma/common/block_buffer_encoder.c
@@ -10,6 +10,7 @@
//
///////////////////////////////////////////////////////////////////////////////
+#include "block_buffer_encoder.h"
#include "block_encoder.h"
#include "filter_encoder.h"
#include "lzma2_encoder.h"
@@ -28,11 +29,9 @@
+ LZMA_CHECK_SIZE_MAX + 3) & ~3)
-static lzma_vli
-lzma2_bound(lzma_vli uncompressed_size)
+static uint64_t
+lzma2_bound(uint64_t uncompressed_size)
{
- lzma_vli overhead;
-
// Prevent integer overflow in overhead calculation.
if (uncompressed_size > COMPRESSED_SIZE_MAX)
return 0;
@@ -41,7 +40,7 @@ lzma2_bound(lzma_vli uncompressed_size)
// uncompressed_size up to the next multiple of LZMA2_CHUNK_MAX,
// multiply by the size of per-chunk header, and add one byte for
// the end marker.
- overhead = ((uncompressed_size + LZMA2_CHUNK_MAX - 1)
+ const uint64_t overhead = ((uncompressed_size + LZMA2_CHUNK_MAX - 1)
/ LZMA2_CHUNK_MAX)
* LZMA2_HEADER_UNCOMPRESSED + 1;
@@ -53,30 +52,36 @@ lzma2_bound(lzma_vli uncompressed_size)
}
-extern LZMA_API(size_t)
-lzma_block_buffer_bound(size_t uncompressed_size)
+extern uint64_t
+lzma_block_buffer_bound64(uint64_t uncompressed_size)
{
- // For now, if the data doesn't compress, we always use uncompressed
- // chunks of LZMA2. In future we may use Subblock filter too, but
- // but for simplicity we probably will still use the same bound
- // calculation even though Subblock filter would have slightly less
- // overhead.
- lzma_vli lzma2_size = lzma2_bound(uncompressed_size);
+ // If the data doesn't compress, we always use uncompressed
+ // LZMA2 chunks.
+ uint64_t lzma2_size = lzma2_bound(uncompressed_size);
if (lzma2_size == 0)
return 0;
// Take Block Padding into account.
- lzma2_size = (lzma2_size + 3) & ~LZMA_VLI_C(3);
+ lzma2_size = (lzma2_size + 3) & ~UINT64_C(3);
-#if SIZE_MAX < LZMA_VLI_MAX
- // Catch the possible integer overflow on 32-bit systems. There's no
- // overflow on 64-bit systems, because lzma2_bound() already takes
+ // No risk of integer overflow because lzma2_bound() already takes
// into account the size of the headers in the Block.
- if (SIZE_MAX - HEADERS_BOUND < lzma2_size)
+ return HEADERS_BOUND + lzma2_size;
+}
+
+
+extern LZMA_API(size_t)
+lzma_block_buffer_bound(size_t uncompressed_size)
+{
+ uint64_t ret = lzma_block_buffer_bound64(uncompressed_size);
+
+#if SIZE_MAX < UINT64_MAX
+ // Catch the possible integer overflow on 32-bit systems.
+ if (ret > SIZE_MAX)
return 0;
#endif
- return HEADERS_BOUND + lzma2_size;
+ return ret;
}
@@ -84,17 +89,12 @@ static lzma_ret
block_encode_uncompressed(lzma_block *block, const uint8_t *in, size_t in_size,
uint8_t *out, size_t *out_pos, size_t out_size)
{
- size_t in_pos = 0;
- uint8_t control = 0x01; // Dictionary reset
- lzma_filter *filters_orig;
-
- // TODO: Figure out if the last filter is LZMA2 or Subblock and use
- // that filter to encode the uncompressed chunks.
-
// Use LZMA2 uncompressed chunks. We wouldn't need a dictionary at
// all, but LZMA2 always requires a dictionary, so use the minimum
// value to minimize memory usage of the decoder.
- lzma_options_lzma lzma2 = { LZMA_DICT_SIZE_MIN };
+ lzma_options_lzma lzma2 = {
+ .dict_size = LZMA_DICT_SIZE_MIN,
+ };
lzma_filter filters[2];
filters[0].id = LZMA_FILTER_LZMA2;
@@ -103,7 +103,7 @@ block_encode_uncompressed(lzma_block *block, const uint8_t *in, size_t in_size,
// Set the above filter options to *block temporarily so that we can
// encode the Block Header.
- filters_orig = block->filters;
+ lzma_filter *filters_orig = block->filters;
block->filters = filters;
if (lzma_block_header_size(block) != LZMA_OK) {
@@ -132,17 +132,18 @@ block_encode_uncompressed(lzma_block *block, const uint8_t *in, size_t in_size,
*out_pos += block->header_size;
// Encode the data using LZMA2 uncompressed chunks.
+ size_t in_pos = 0;
+ uint8_t control = 0x01; // Dictionary reset
while (in_pos < in_size) {
- size_t copy_size;
-
// Control byte: Indicate uncompressed chunk, of which
// the first resets the dictionary.
out[(*out_pos)++] = control;
control = 0x02; // No dictionary reset
// Size of the uncompressed chunk
- copy_size = my_min(in_size - in_pos, LZMA2_CHUNK_MAX);
+ const size_t copy_size
+ = my_min(in_size - in_pos, LZMA2_CHUNK_MAX);
out[(*out_pos)++] = (copy_size - 1) >> 8;
out[(*out_pos)++] = (copy_size - 1) & 0xFF;
@@ -163,27 +164,18 @@ block_encode_uncompressed(lzma_block *block, const uint8_t *in, size_t in_size,
static lzma_ret
-block_encode_normal(lzma_block *block, lzma_allocator *allocator,
+block_encode_normal(lzma_block *block, const lzma_allocator *allocator,
const uint8_t *in, size_t in_size,
uint8_t *out, size_t *out_pos, size_t out_size)
{
- size_t out_start;
- lzma_next_coder raw_encoder = LZMA_NEXT_CODER_INIT;
- lzma_ret ret;
-
// Find out the size of the Block Header.
- block->compressed_size = lzma2_bound(in_size);
- if (block->compressed_size == 0)
- return LZMA_DATA_ERROR;
-
- block->uncompressed_size = in_size;
return_if_error(lzma_block_header_size(block));
// Reserve space for the Block Header and skip it for now.
if (out_size - *out_pos <= block->header_size)
return LZMA_BUF_ERROR;
- out_start = *out_pos;
+ const size_t out_start = *out_pos;
*out_pos += block->header_size;
// Limit out_size so that we stop encoding if the output would grow
@@ -193,7 +185,8 @@ block_encode_normal(lzma_block *block, lzma_allocator *allocator,
// TODO: In many common cases this could be optimized to use
// significantly less memory.
- ret = lzma_raw_encoder_init(
+ lzma_next_coder raw_encoder = LZMA_NEXT_CODER_INIT;
+ lzma_ret ret = lzma_raw_encoder_init(
&raw_encoder, allocator, block->filters);
if (ret == LZMA_OK) {
@@ -227,15 +220,12 @@ block_encode_normal(lzma_block *block, lzma_allocator *allocator,
}
-extern LZMA_API(lzma_ret)
-lzma_block_buffer_encode(lzma_block *block, lzma_allocator *allocator,
+static lzma_ret
+block_buffer_encode(lzma_block *block, const lzma_allocator *allocator,
const uint8_t *in, size_t in_size,
- uint8_t *out, size_t *out_pos, size_t out_size)
+ uint8_t *out, size_t *out_pos, size_t out_size,
+ bool try_to_compress)
{
- size_t check_size;
- lzma_ret ret;
- size_t i;
-
// Validate the arguments.
if (block == NULL || (in == NULL && in_size != 0) || out == NULL
|| out_pos == NULL || *out_pos > out_size)
@@ -243,11 +233,11 @@ lzma_block_buffer_encode(lzma_block *block, lzma_allocator *allocator,
// The contents of the structure may depend on the version so
// check the version before validating the contents of *block.
- if (block->version != 0)
+ if (block->version > 1)
return LZMA_OPTIONS_ERROR;
if ((unsigned int)(block->check) > LZMA_CHECK_ID_MAX
- || block->filters == NULL)
+ || (try_to_compress && block->filters == NULL))
return LZMA_PROG_ERROR;
if (!lzma_check_is_supported(block->check))
@@ -259,7 +249,7 @@ lzma_block_buffer_encode(lzma_block *block, lzma_allocator *allocator,
out_size -= (out_size - *out_pos) & 3;
// Get the size of the Check field.
- check_size = lzma_check_size(block->check);
+ const size_t check_size = lzma_check_size(block->check);
assert(check_size != UINT32_MAX);
// Reserve space for the Check field.
@@ -268,9 +258,19 @@ lzma_block_buffer_encode(lzma_block *block, lzma_allocator *allocator,
out_size -= check_size;
+ // Initialize block->uncompressed_size and calculate the worst-case
+ // value for block->compressed_size.
+ block->uncompressed_size = in_size;
+ block->compressed_size = lzma2_bound(in_size);
+ if (block->compressed_size == 0)
+ return LZMA_DATA_ERROR;
+
// Do the actual compression.
- ret = block_encode_normal(block, allocator,
- in, in_size, out, out_pos, out_size);
+ lzma_ret ret = LZMA_BUF_ERROR;
+ if (try_to_compress)
+ ret = block_encode_normal(block, allocator,
+ in, in_size, out, out_pos, out_size);
+
if (ret != LZMA_OK) {
// If the error was something else than output buffer
// becoming full, return the error now.
@@ -291,7 +291,7 @@ lzma_block_buffer_encode(lzma_block *block, lzma_allocator *allocator,
// Block Padding. No buffer overflow here, because we already adjusted
// out_size so that (out_size - out_start) is a multiple of four.
// Thus, if the buffer is full, the loop body can never run.
- for (i = (size_t)(block->compressed_size); i & 3; ++i) {
+ for (size_t i = (size_t)(block->compressed_size); i & 3; ++i) {
assert(*out_pos < out_size);
out[(*out_pos)++] = 0x00;
}
@@ -313,3 +313,25 @@ lzma_block_buffer_encode(lzma_block *block, lzma_allocator *allocator,
return LZMA_OK;
}
+
+
+extern LZMA_API(lzma_ret)
+lzma_block_buffer_encode(lzma_block *block, const lzma_allocator *allocator,
+ const uint8_t *in, size_t in_size,
+ uint8_t *out, size_t *out_pos, size_t out_size)
+{
+ return block_buffer_encode(block, allocator,
+ in, in_size, out, out_pos, out_size, true);
+}
+
+
+extern LZMA_API(lzma_ret)
+lzma_block_uncomp_encode(lzma_block *block,
+ const uint8_t *in, size_t in_size,
+ uint8_t *out, size_t *out_pos, size_t out_size)
+{
+ // It won't allocate any memory from heap so no need
+ // for lzma_allocator.
+ return block_buffer_encode(block, NULL,
+ in, in_size, out, out_pos, out_size, false);
+}
diff --git a/Utilities/cmliblzma/liblzma/common/block_buffer_encoder.h b/Utilities/cmliblzma/liblzma/common/block_buffer_encoder.h
new file mode 100644
index 0000000..653207f
--- /dev/null
+++ b/Utilities/cmliblzma/liblzma/common/block_buffer_encoder.h
@@ -0,0 +1,24 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file block_buffer_encoder.h
+/// \brief Single-call .xz Block encoder
+//
+// Author: Lasse Collin
+//
+// This file has been put into the public domain.
+// You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef LZMA_BLOCK_BUFFER_ENCODER_H
+#define LZMA_BLOCK_BUFFER_ENCODER_H
+
+#include "common.h"
+
+
+/// uint64_t version of lzma_block_buffer_bound(). It is used by
+/// stream_encoder_mt.c. Probably the original lzma_block_buffer_bound()
+/// should have been 64-bit, but fixing it would break the ABI.
+extern uint64_t lzma_block_buffer_bound64(uint64_t uncompressed_size);
+
+#endif
diff --git a/Utilities/cmliblzma/liblzma/common/block_decoder.c b/Utilities/cmliblzma/liblzma/common/block_decoder.c
index 35996e7..075bd27 100644
--- a/Utilities/cmliblzma/liblzma/common/block_decoder.c
+++ b/Utilities/cmliblzma/liblzma/common/block_decoder.c
@@ -15,7 +15,7 @@
#include "check.h"
-struct lzma_coder_s {
+typedef struct {
enum {
SEQ_CODE,
SEQ_PADDING,
@@ -45,7 +45,10 @@ struct lzma_coder_s {
/// Check of the uncompressed data
lzma_check_state check;
-};
+
+ /// True if the integrity check won't be calculated and verified.
+ bool ignore_check;
+} lzma_block_coder;
static inline bool
@@ -71,11 +74,13 @@ is_size_valid(lzma_vli size, lzma_vli reference)
static lzma_ret
-block_decode(lzma_coder *coder, lzma_allocator *allocator,
- const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
- size_t in_size, uint8_t *LZMA_RESTRICT out,
- size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action)
+block_decode(void *coder_ptr, const lzma_allocator *allocator,
+ const uint8_t *restrict in, size_t *restrict in_pos,
+ size_t in_size, uint8_t *restrict out,
+ size_t *restrict out_pos, size_t out_size, lzma_action action)
{
+ lzma_block_coder *coder = coder_ptr;
+
switch (coder->sequence) {
case SEQ_CODE: {
const size_t in_start = *in_pos;
@@ -97,8 +102,9 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator,
coder->block->uncompressed_size))
return LZMA_DATA_ERROR;
- lzma_check_update(&coder->check, coder->block->check,
- out + out_start, out_used);
+ if (!coder->ignore_check)
+ lzma_check_update(&coder->check, coder->block->check,
+ out + out_start, out_used);
if (ret != LZMA_STREAM_END)
return ret;
@@ -140,7 +146,9 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator,
if (coder->block->check == LZMA_CHECK_NONE)
return LZMA_STREAM_END;
- lzma_check_finish(&coder->check, coder->block->check);
+ if (!coder->ignore_check)
+ lzma_check_finish(&coder->check, coder->block->check);
+
coder->sequence = SEQ_CHECK;
// Fall through
@@ -155,7 +163,8 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator,
// Validate the Check only if we support it.
// coder->check.buffer may be uninitialized
// when the Check ID is not supported.
- if (lzma_check_is_supported(coder->block->check)
+ if (!coder->ignore_check
+ && lzma_check_is_supported(coder->block->check)
&& memcmp(coder->block->raw_check,
coder->check.buffer.u8,
check_size) != 0)
@@ -170,8 +179,9 @@ block_decode(lzma_coder *coder, lzma_allocator *allocator,
static void
-block_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
+block_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
{
+ lzma_block_coder *coder = coder_ptr;
lzma_next_end(&coder->next, allocator);
lzma_free(coder, allocator);
return;
@@ -179,7 +189,7 @@ block_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
extern lzma_ret
-lzma_block_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_block_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
lzma_block *block)
{
lzma_next_coder_init(&lzma_block_decoder_init, next, allocator);
@@ -191,27 +201,29 @@ lzma_block_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|| !lzma_vli_is_valid(block->uncompressed_size))
return LZMA_PROG_ERROR;
- // Allocate and initialize *next->coder if needed.
- if (next->coder == NULL) {
- next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
- if (next->coder == NULL)
+ // Allocate *next->coder if needed.
+ lzma_block_coder *coder = next->coder;
+ if (coder == NULL) {
+ coder = lzma_alloc(sizeof(lzma_block_coder), allocator);
+ if (coder == NULL)
return LZMA_MEM_ERROR;
+ next->coder = coder;
next->code = &block_decode;
next->end = &block_decoder_end;
- next->coder->next = LZMA_NEXT_CODER_INIT;
+ coder->next = LZMA_NEXT_CODER_INIT;
}
// Basic initializations
- next->coder->sequence = SEQ_CODE;
- next->coder->block = block;
- next->coder->compressed_size = 0;
- next->coder->uncompressed_size = 0;
+ coder->sequence = SEQ_CODE;
+ coder->block = block;
+ coder->compressed_size = 0;
+ coder->uncompressed_size = 0;
// If Compressed Size is not known, we calculate the maximum allowed
// value so that encoded size of the Block (including Block Padding)
// is still a valid VLI and a multiple of four.
- next->coder->compressed_limit
+ coder->compressed_limit
= block->compressed_size == LZMA_VLI_UNKNOWN
? (LZMA_VLI_MAX & ~LZMA_VLI_C(3))
- block->header_size
@@ -221,11 +233,14 @@ lzma_block_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
// Initialize the check. It's caller's problem if the Check ID is not
// supported, and the Block decoder cannot verify the Check field.
// Caller can test lzma_check_is_supported(block->check).
- next->coder->check_pos = 0;
- lzma_check_init(&next->coder->check, block->check);
+ coder->check_pos = 0;
+ lzma_check_init(&coder->check, block->check);
+
+ coder->ignore_check = block->version >= 1
+ ? block->ignore_check : false;
// Initialize the filter chain.
- return lzma_raw_decoder_init(&next->coder->next, allocator,
+ return lzma_raw_decoder_init(&coder->next, allocator,
block->filters);
}
@@ -233,7 +248,7 @@ lzma_block_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern LZMA_API(lzma_ret)
lzma_block_decoder(lzma_stream *strm, lzma_block *block)
{
- lzma_next_strm_init1(lzma_block_decoder_init, strm, block);
+ lzma_next_strm_init(lzma_block_decoder_init, strm, block);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
diff --git a/Utilities/cmliblzma/liblzma/common/block_decoder.h b/Utilities/cmliblzma/liblzma/common/block_decoder.h
index 7da9df6..718c5ce 100644
--- a/Utilities/cmliblzma/liblzma/common/block_decoder.h
+++ b/Utilities/cmliblzma/liblzma/common/block_decoder.h
@@ -17,6 +17,6 @@
extern lzma_ret lzma_block_decoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, lzma_block *block);
+ const lzma_allocator *allocator, lzma_block *block);
#endif
diff --git a/Utilities/cmliblzma/liblzma/common/block_encoder.c b/Utilities/cmliblzma/liblzma/common/block_encoder.c
index ed74827..168846a 100644
--- a/Utilities/cmliblzma/liblzma/common/block_encoder.c
+++ b/Utilities/cmliblzma/liblzma/common/block_encoder.c
@@ -15,7 +15,7 @@
#include "check.h"
-struct lzma_coder_s {
+typedef struct {
/// The filters in the chain; initialized with lzma_raw_decoder_init().
lzma_next_coder next;
@@ -41,15 +41,17 @@ struct lzma_coder_s {
/// Check of the uncompressed data
lzma_check_state check;
-};
+} lzma_block_coder;
static lzma_ret
-block_encode(lzma_coder *coder, lzma_allocator *allocator,
- const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
- size_t in_size, uint8_t *LZMA_RESTRICT out,
- size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action)
+block_encode(void *coder_ptr, const lzma_allocator *allocator,
+ const uint8_t *restrict in, size_t *restrict in_pos,
+ size_t in_size, uint8_t *restrict out,
+ size_t *restrict out_pos, size_t out_size, lzma_action action)
{
+ lzma_block_coder *coder = coder_ptr;
+
// Check that our amount of input stays in proper limits.
if (LZMA_VLI_MAX - coder->uncompressed_size < in_size - *in_pos)
return LZMA_DATA_ERROR;
@@ -134,8 +136,9 @@ block_encode(lzma_coder *coder, lzma_allocator *allocator,
static void
-block_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
+block_encoder_end(void *coder_ptr, const lzma_allocator *allocator)
{
+ lzma_block_coder *coder = coder_ptr;
lzma_next_end(&coder->next, allocator);
lzma_free(coder, allocator);
return;
@@ -143,10 +146,12 @@ block_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
static lzma_ret
-block_encoder_update(lzma_coder *coder, lzma_allocator *allocator,
+block_encoder_update(void *coder_ptr, const lzma_allocator *allocator,
const lzma_filter *filters lzma_attribute((__unused__)),
const lzma_filter *reversed_filters)
{
+ lzma_block_coder *coder = coder_ptr;
+
if (coder->sequence != SEQ_CODE)
return LZMA_PROG_ERROR;
@@ -156,7 +161,7 @@ block_encoder_update(lzma_coder *coder, lzma_allocator *allocator,
extern lzma_ret
-lzma_block_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_block_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
lzma_block *block)
{
lzma_next_coder_init(&lzma_block_encoder_init, next, allocator);
@@ -166,7 +171,7 @@ lzma_block_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
// The contents of the structure may depend on the version so
// check the version first.
- if (block->version != 0)
+ if (block->version > 1)
return LZMA_OPTIONS_ERROR;
// If the Check ID is not supported, we cannot calculate the check and
@@ -178,37 +183,38 @@ lzma_block_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
return LZMA_UNSUPPORTED_CHECK;
// Allocate and initialize *next->coder if needed.
- if (next->coder == NULL) {
- next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
- if (next->coder == NULL)
+ lzma_block_coder *coder = next->coder;
+ if (coder == NULL) {
+ coder = lzma_alloc(sizeof(lzma_block_coder), allocator);
+ if (coder == NULL)
return LZMA_MEM_ERROR;
+ next->coder = coder;
next->code = &block_encode;
next->end = &block_encoder_end;
next->update = &block_encoder_update;
- next->coder->next = LZMA_NEXT_CODER_INIT;
+ coder->next = LZMA_NEXT_CODER_INIT;
}
// Basic initializations
- next->coder->sequence = SEQ_CODE;
- next->coder->block = block;
- next->coder->compressed_size = 0;
- next->coder->uncompressed_size = 0;
- next->coder->pos = 0;
+ coder->sequence = SEQ_CODE;
+ coder->block = block;
+ coder->compressed_size = 0;
+ coder->uncompressed_size = 0;
+ coder->pos = 0;
// Initialize the check
- lzma_check_init(&next->coder->check, block->check);
+ lzma_check_init(&coder->check, block->check);
// Initialize the requested filters.
- return lzma_raw_encoder_init(&next->coder->next, allocator,
- block->filters);
+ return lzma_raw_encoder_init(&coder->next, allocator, block->filters);
}
extern LZMA_API(lzma_ret)
lzma_block_encoder(lzma_stream *strm, lzma_block *block)
{
- lzma_next_strm_init1(lzma_block_encoder_init, strm, block);
+ lzma_next_strm_init(lzma_block_encoder_init, strm, block);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
diff --git a/Utilities/cmliblzma/liblzma/common/block_encoder.h b/Utilities/cmliblzma/liblzma/common/block_encoder.h
index b9eff0b..bd97c18 100644
--- a/Utilities/cmliblzma/liblzma/common/block_encoder.h
+++ b/Utilities/cmliblzma/liblzma/common/block_encoder.h
@@ -42,6 +42,6 @@
extern lzma_ret lzma_block_encoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, lzma_block *block);
+ const lzma_allocator *allocator, lzma_block *block);
#endif
diff --git a/Utilities/cmliblzma/liblzma/common/block_header_decoder.c b/Utilities/cmliblzma/liblzma/common/block_header_decoder.c
index f6e470e..1dd982f 100644
--- a/Utilities/cmliblzma/liblzma/common/block_header_decoder.c
+++ b/Utilities/cmliblzma/liblzma/common/block_header_decoder.c
@@ -15,14 +15,12 @@
static void
-free_properties(lzma_block *block, lzma_allocator *allocator)
+free_properties(lzma_block *block, const lzma_allocator *allocator)
{
- size_t i;
-
// Free allocated filter options. The last array member is not
// touched after the initialization in the beginning of
// lzma_block_header_decode(), so we don't need to touch that here.
- for (i = 0; i < LZMA_FILTERS_MAX; ++i) {
+ for (size_t i = 0; i < LZMA_FILTERS_MAX; ++i) {
lzma_free(block->filters[i].options, allocator);
block->filters[i].id = LZMA_VLI_UNKNOWN;
block->filters[i].options = NULL;
@@ -34,15 +32,8 @@ free_properties(lzma_block *block, lzma_allocator *allocator)
extern LZMA_API(lzma_ret)
lzma_block_header_decode(lzma_block *block,
- lzma_allocator *allocator, const uint8_t *in)
+ const lzma_allocator *allocator, const uint8_t *in)
{
- const size_t filter_count = (in[1] & 3) + 1;
- size_t in_size;
- size_t i;
-
- // Start after the Block Header Size and Block Flags fields.
- size_t in_pos = 2;
-
// NOTE: We consider the header to be corrupt not only when the
// CRC32 doesn't match, but also when variable-length integers
// are invalid or over 63 bits, or if the header is too small
@@ -50,13 +41,21 @@ lzma_block_header_decode(lzma_block *block,
// Initialize the filter options array. This way the caller can
// safely free() the options even if an error occurs in this function.
- for (i = 0; i <= LZMA_FILTERS_MAX; ++i) {
+ for (size_t i = 0; i <= LZMA_FILTERS_MAX; ++i) {
block->filters[i].id = LZMA_VLI_UNKNOWN;
block->filters[i].options = NULL;
}
- // Always zero for now.
- block->version = 0;
+ // Versions 0 and 1 are supported. If a newer version was specified,
+ // we need to downgrade it.
+ if (block->version > 1)
+ block->version = 1;
+
+ // This isn't a Block Header option, but since the decompressor will
+ // read it if version >= 1, it's better to initialize it here than
+ // to expect the caller to do it since in almost all cases this
+ // should be false.
+ block->ignore_check = false;
// Validate Block Header Size and Check type. The caller must have
// already set these, so it is a programming error if this test fails.
@@ -65,7 +64,7 @@ lzma_block_header_decode(lzma_block *block,
return LZMA_PROG_ERROR;
// Exclude the CRC32 field.
- in_size = block->header_size - 4;
+ const size_t in_size = block->header_size - 4;
// Verify CRC32
if (lzma_crc32(in, in_size, 0) != unaligned_read32le(in + in_size))
@@ -75,6 +74,9 @@ lzma_block_header_decode(lzma_block *block,
if (in[1] & 0x3C)
return LZMA_OPTIONS_ERROR;
+ // Start after the Block Header Size and Block Flags fields.
+ size_t in_pos = 2;
+
// Compressed Size
if (in[1] & 0x40) {
return_if_error(lzma_vli_decode(&block->compressed_size,
@@ -96,7 +98,8 @@ lzma_block_header_decode(lzma_block *block,
block->uncompressed_size = LZMA_VLI_UNKNOWN;
// Filter Flags
- for (i = 0; i < filter_count; ++i) {
+ const size_t filter_count = (in[1] & 3) + 1;
+ for (size_t i = 0; i < filter_count; ++i) {
const lzma_ret ret = lzma_filter_flags_decode(
&block->filters[i], allocator,
in, &in_pos, in_size);
diff --git a/Utilities/cmliblzma/liblzma/common/block_header_encoder.c b/Utilities/cmliblzma/liblzma/common/block_header_encoder.c
index 650295c..5c5f542 100644
--- a/Utilities/cmliblzma/liblzma/common/block_header_encoder.c
+++ b/Utilities/cmliblzma/liblzma/common/block_header_encoder.c
@@ -17,14 +17,12 @@
extern LZMA_API(lzma_ret)
lzma_block_header_size(lzma_block *block)
{
- size_t i;
+ if (block->version > 1)
+ return LZMA_OPTIONS_ERROR;
// Block Header Size + Block Flags + CRC32.
uint32_t size = 1 + 1 + 4;
- if (block->version != 0)
- return LZMA_OPTIONS_ERROR;
-
// Compressed Size
if (block->compressed_size != LZMA_VLI_UNKNOWN) {
const uint32_t add = lzma_vli_size(block->compressed_size);
@@ -47,13 +45,12 @@ lzma_block_header_size(lzma_block *block)
if (block->filters == NULL || block->filters[0].id == LZMA_VLI_UNKNOWN)
return LZMA_PROG_ERROR;
- for (i = 0; block->filters[i].id != LZMA_VLI_UNKNOWN; ++i) {
- uint32_t add;
-
+ for (size_t i = 0; block->filters[i].id != LZMA_VLI_UNKNOWN; ++i) {
// Don't allow too many filters.
if (i == LZMA_FILTERS_MAX)
return LZMA_PROG_ERROR;
+ uint32_t add;
return_if_error(lzma_filter_flags_size(&add,
block->filters + i));
@@ -76,23 +73,20 @@ lzma_block_header_size(lzma_block *block)
extern LZMA_API(lzma_ret)
lzma_block_header_encode(const lzma_block *block, uint8_t *out)
{
- size_t out_size;
- size_t out_pos = 2;
- size_t filter_count = 0;
-
// Validate everything but filters.
if (lzma_block_unpadded_size(block) == 0
|| !lzma_vli_is_valid(block->uncompressed_size))
return LZMA_PROG_ERROR;
// Indicate the size of the buffer _excluding_ the CRC32 field.
- out_size = block->header_size - 4;
+ const size_t out_size = block->header_size - 4;
// Store the Block Header Size.
out[0] = out_size / 4;
// We write Block Flags in pieces.
out[1] = 0x00;
+ size_t out_pos = 2;
// Compressed Size
if (block->compressed_size != LZMA_VLI_UNKNOWN) {
@@ -114,6 +108,7 @@ lzma_block_header_encode(const lzma_block *block, uint8_t *out)
if (block->filters == NULL || block->filters[0].id == LZMA_VLI_UNKNOWN)
return LZMA_PROG_ERROR;
+ size_t filter_count = 0;
do {
// There can be a maximum of four filters.
if (filter_count == LZMA_FILTERS_MAX)
diff --git a/Utilities/cmliblzma/liblzma/common/block_util.c b/Utilities/cmliblzma/liblzma/common/block_util.c
index 4cd34d1..00c7fe8 100644
--- a/Utilities/cmliblzma/liblzma/common/block_util.c
+++ b/Utilities/cmliblzma/liblzma/common/block_util.c
@@ -17,14 +17,11 @@
extern LZMA_API(lzma_ret)
lzma_block_compressed_size(lzma_block *block, lzma_vli unpadded_size)
{
- uint32_t container_size;
- lzma_vli compressed_size;
-
// Validate everything but Uncompressed Size and filters.
if (lzma_block_unpadded_size(block) == 0)
return LZMA_PROG_ERROR;
- container_size = block->header_size
+ const uint32_t container_size = block->header_size
+ lzma_check_size(block->check);
// Validate that Compressed Size will be greater than zero.
@@ -34,7 +31,7 @@ lzma_block_compressed_size(lzma_block *block, lzma_vli unpadded_size)
// Calculate what Compressed Size is supposed to be.
// If Compressed Size was present in Block Header,
// compare that the new value matches it.
- compressed_size = unpadded_size - container_size;
+ const lzma_vli compressed_size = unpadded_size - container_size;
if (block->compressed_size != LZMA_VLI_UNKNOWN
&& block->compressed_size != compressed_size)
return LZMA_DATA_ERROR;
@@ -48,15 +45,13 @@ lzma_block_compressed_size(lzma_block *block, lzma_vli unpadded_size)
extern LZMA_API(lzma_vli)
lzma_block_unpadded_size(const lzma_block *block)
{
- lzma_vli unpadded_size;
-
// Validate the values that we are interested in i.e. all but
// Uncompressed Size and the filters.
//
// NOTE: This function is used for validation too, so it is
// essential that these checks are always done even if
// Compressed Size is unknown.
- if (block == NULL || block->version != 0
+ if (block == NULL || block->version > 1
|| block->header_size < LZMA_BLOCK_HEADER_SIZE_MIN
|| block->header_size > LZMA_BLOCK_HEADER_SIZE_MAX
|| (block->header_size & 3)
@@ -71,7 +66,7 @@ lzma_block_unpadded_size(const lzma_block *block)
return LZMA_VLI_UNKNOWN;
// Calculate Unpadded Size and validate it.
- unpadded_size = block->compressed_size
+ const lzma_vli unpadded_size = block->compressed_size
+ block->header_size
+ lzma_check_size(block->check);
diff --git a/Utilities/cmliblzma/liblzma/common/common.c b/Utilities/cmliblzma/liblzma/common/common.c
index 2e723c8..57e3f8e 100644
--- a/Utilities/cmliblzma/liblzma/common/common.c
+++ b/Utilities/cmliblzma/liblzma/common/common.c
@@ -36,14 +36,14 @@ lzma_version_string(void)
///////////////////////
extern void * lzma_attribute((__malloc__)) lzma_attr_alloc_size(1)
-lzma_alloc(size_t size, lzma_allocator *allocator)
+lzma_alloc(size_t size, const lzma_allocator *allocator)
{
- void *ptr;
-
// Some malloc() variants return NULL if called with size == 0.
if (size == 0)
size = 1;
+ void *ptr;
+
if (allocator != NULL && allocator->alloc != NULL)
ptr = allocator->alloc(allocator->opaque, 1, size);
else
@@ -53,8 +53,29 @@ lzma_alloc(size_t size, lzma_allocator *allocator)
}
+extern void * lzma_attribute((__malloc__)) lzma_attr_alloc_size(1)
+lzma_alloc_zero(size_t size, const lzma_allocator *allocator)
+{
+ // Some calloc() variants return NULL if called with size == 0.
+ if (size == 0)
+ size = 1;
+
+ void *ptr;
+
+ if (allocator != NULL && allocator->alloc != NULL) {
+ ptr = allocator->alloc(allocator->opaque, 1, size);
+ if (ptr != NULL)
+ memzero(ptr, size);
+ } else {
+ ptr = calloc(1, size);
+ }
+
+ return ptr;
+}
+
+
extern void
-lzma_free(void *ptr, lzma_allocator *allocator)
+lzma_free(void *ptr, const lzma_allocator *allocator)
{
if (allocator != NULL && allocator->free != NULL)
allocator->free(allocator->opaque, ptr);
@@ -70,9 +91,9 @@ lzma_free(void *ptr, lzma_allocator *allocator)
//////////
extern size_t
-lzma_bufcpy(const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
- size_t in_size, uint8_t *LZMA_RESTRICT out,
- size_t *LZMA_RESTRICT out_pos, size_t out_size)
+lzma_bufcpy(const uint8_t *restrict in, size_t *restrict in_pos,
+ size_t in_size, uint8_t *restrict out,
+ size_t *restrict out_pos, size_t out_size)
{
const size_t in_avail = in_size - *in_pos;
const size_t out_avail = out_size - *out_pos;
@@ -88,7 +109,7 @@ lzma_bufcpy(const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
extern lzma_ret
-lzma_next_filter_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_next_filter_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters)
{
lzma_next_coder_init(filters[0].init, next, allocator);
@@ -99,7 +120,7 @@ lzma_next_filter_init(lzma_next_coder *next, lzma_allocator *allocator,
extern lzma_ret
-lzma_next_filter_update(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_next_filter_update(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter *reversed_filters)
{
// Check that the application isn't trying to change the Filter ID.
@@ -117,7 +138,7 @@ lzma_next_filter_update(lzma_next_coder *next, lzma_allocator *allocator,
extern void
-lzma_next_end(lzma_next_coder *next, lzma_allocator *allocator)
+lzma_next_end(lzma_next_coder *next, const lzma_allocator *allocator)
{
if (next->init != (uintptr_t)(NULL)) {
// To avoid tiny end functions that simply call
@@ -156,10 +177,8 @@ lzma_strm_init(lzma_stream *strm)
strm->internal->next = LZMA_NEXT_CODER_INIT;
}
- strm->internal->supported_actions[LZMA_RUN] = false;
- strm->internal->supported_actions[LZMA_SYNC_FLUSH] = false;
- strm->internal->supported_actions[LZMA_FULL_FLUSH] = false;
- strm->internal->supported_actions[LZMA_FINISH] = false;
+ memzero(strm->internal->supported_actions,
+ sizeof(strm->internal->supported_actions));
strm->internal->sequence = ISEQ_RUN;
strm->internal->allow_buf_error = false;
@@ -173,16 +192,12 @@ lzma_strm_init(lzma_stream *strm)
extern LZMA_API(lzma_ret)
lzma_code(lzma_stream *strm, lzma_action action)
{
- size_t in_pos = 0;
- size_t out_pos = 0;
- lzma_ret ret;
-
// Sanity checks
if ((strm->next_in == NULL && strm->avail_in != 0)
|| (strm->next_out == NULL && strm->avail_out != 0)
|| strm->internal == NULL
|| strm->internal->next.code == NULL
- || (unsigned int)(action) > LZMA_FINISH
+ || (unsigned int)(action) > LZMA_ACTION_MAX
|| !strm->internal->supported_actions[action])
return LZMA_PROG_ERROR;
@@ -217,6 +232,10 @@ lzma_code(lzma_stream *strm, lzma_action action)
case LZMA_FINISH:
strm->internal->sequence = ISEQ_FINISH;
break;
+
+ case LZMA_FULL_BARRIER:
+ strm->internal->sequence = ISEQ_FULL_BARRIER;
+ break;
}
break;
@@ -244,6 +263,13 @@ lzma_code(lzma_stream *strm, lzma_action action)
break;
+ case ISEQ_FULL_BARRIER:
+ if (action != LZMA_FULL_BARRIER
+ || strm->internal->avail_in != strm->avail_in)
+ return LZMA_PROG_ERROR;
+
+ break;
+
case ISEQ_END:
return LZMA_STREAM_END;
@@ -252,7 +278,9 @@ lzma_code(lzma_stream *strm, lzma_action action)
return LZMA_PROG_ERROR;
}
- ret = strm->internal->next.code(
+ size_t in_pos = 0;
+ size_t out_pos = 0;
+ lzma_ret ret = strm->internal->next.code(
strm->internal->next.coder, strm->allocator,
strm->next_in, &in_pos, strm->avail_in,
strm->next_out, &out_pos, strm->avail_out, action);
@@ -267,7 +295,9 @@ lzma_code(lzma_stream *strm, lzma_action action)
strm->internal->avail_in = strm->avail_in;
- switch (ret) {
+ // Cast is needed to silence a warning about LZMA_TIMED_OUT, which
+ // isn't part of lzma_ret enumeration.
+ switch ((unsigned int)(ret)) {
case LZMA_OK:
// Don't return LZMA_BUF_ERROR when it happens the first time.
// This is to avoid returning LZMA_BUF_ERROR when avail_out
@@ -283,9 +313,16 @@ lzma_code(lzma_stream *strm, lzma_action action)
}
break;
+ case LZMA_TIMED_OUT:
+ strm->internal->allow_buf_error = false;
+ ret = LZMA_OK;
+ break;
+
case LZMA_STREAM_END:
if (strm->internal->sequence == ISEQ_SYNC_FLUSH
- || strm->internal->sequence == ISEQ_FULL_FLUSH)
+ || strm->internal->sequence == ISEQ_FULL_FLUSH
+ || strm->internal->sequence
+ == ISEQ_FULL_BARRIER)
strm->internal->sequence = ISEQ_RUN;
else
strm->internal->sequence = ISEQ_END;
@@ -325,6 +362,22 @@ lzma_end(lzma_stream *strm)
}
+extern LZMA_API(void)
+lzma_get_progress(lzma_stream *strm,
+ uint64_t *progress_in, uint64_t *progress_out)
+{
+ if (strm->internal->next.get_progress != NULL) {
+ strm->internal->next.get_progress(strm->internal->next.coder,
+ progress_in, progress_out);
+ } else {
+ *progress_in = strm->total_in;
+ *progress_out = strm->total_out;
+ }
+
+ return;
+}
+
+
extern LZMA_API(lzma_check)
lzma_get_check(const lzma_stream *strm)
{
@@ -382,8 +435,10 @@ lzma_memlimit_set(lzma_stream *strm, uint64_t new_memlimit)
|| strm->internal->next.memconfig == NULL)
return LZMA_PROG_ERROR;
- if (new_memlimit != 0 && new_memlimit < LZMA_MEMUSAGE_BASE)
- return LZMA_MEMLIMIT_ERROR;
+ // Zero is a special value that cannot be used as an actual limit.
+ // If 0 was specified, use 1 instead.
+ if (new_memlimit == 0)
+ new_memlimit = 1;
return strm->internal->next.memconfig(strm->internal->next.coder,
&memusage, &old_memlimit, new_memlimit);
diff --git a/Utilities/cmliblzma/liblzma/common/common.h b/Utilities/cmliblzma/liblzma/common/common.h
index a6a2818..dde3ae0 100644
--- a/Utilities/cmliblzma/liblzma/common/common.h
+++ b/Utilities/cmliblzma/liblzma/common/common.h
@@ -48,6 +48,13 @@
#define LZMA_BUFFER_SIZE 4096
+/// Maximum number of worker threads within one multithreaded component.
+/// The limit exists solely to make it simpler to prevent integer overflows
+/// when allocating structures etc. This should be big enough for now...
+/// the code won't scale anywhere close to this number anyway.
+#define LZMA_THREADS_MAX 16384
+
+
/// Starting value for memory usage estimates. Instead of calculating size
/// of _every_ structure and taking into account malloc() overhead etc., we
/// add a base size to all memory usage estimates. It's not very accurate
@@ -65,12 +72,20 @@
( LZMA_TELL_NO_CHECK \
| LZMA_TELL_UNSUPPORTED_CHECK \
| LZMA_TELL_ANY_CHECK \
+ | LZMA_IGNORE_CHECK \
| LZMA_CONCATENATED )
-/// Type of encoder/decoder specific data; the actual structure is defined
-/// differently in different coders.
-typedef struct lzma_coder_s lzma_coder;
+/// Largest valid lzma_action value as unsigned integer.
+#define LZMA_ACTION_MAX ((unsigned int)(LZMA_FULL_BARRIER))
+
+
+/// Special return value (lzma_ret) to indicate that a timeout was reached
+/// and lzma_code() must not return LZMA_BUF_ERROR. This is converted to
+/// LZMA_OK in lzma_code(). This is not in the lzma_ret enumeration because
+/// there's no need to have it in the public API.
+#define LZMA_TIMED_OUT 32
+
typedef struct lzma_next_coder_s lzma_next_coder;
@@ -79,7 +94,7 @@ typedef struct lzma_filter_info_s lzma_filter_info;
/// Type of a function used to initialize a filter encoder or decoder
typedef lzma_ret (*lzma_init_function)(
- lzma_next_coder *next, lzma_allocator *allocator,
+ lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters);
/// Type of a function to do some kind of coding work (filters, Stream,
@@ -87,15 +102,15 @@ typedef lzma_ret (*lzma_init_function)(
/// input and output buffers, but for simplicity they still use this same
/// function prototype.
typedef lzma_ret (*lzma_code_function)(
- lzma_coder *coder, lzma_allocator *allocator,
- const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
- size_t in_size, uint8_t *LZMA_RESTRICT out,
- size_t *LZMA_RESTRICT out_pos, size_t out_size,
+ void *coder, const lzma_allocator *allocator,
+ const uint8_t *restrict in, size_t *restrict in_pos,
+ size_t in_size, uint8_t *restrict out,
+ size_t *restrict out_pos, size_t out_size,
lzma_action action);
/// Type of a function to free the memory allocated for the coder
typedef void (*lzma_end_function)(
- lzma_coder *coder, lzma_allocator *allocator);
+ void *coder, const lzma_allocator *allocator);
/// Raw coder validates and converts an array of lzma_filter structures to
@@ -118,7 +133,7 @@ struct lzma_filter_info_s {
/// Hold data and function pointers of the next filter in the chain.
struct lzma_next_coder_s {
/// Pointer to coder-specific data
- lzma_coder *coder;
+ void *coder;
/// Filter ID. This is LZMA_VLI_UNKNOWN when this structure doesn't
/// point to a filter coder.
@@ -138,35 +153,41 @@ struct lzma_next_coder_s {
/// lzma_next_coder.coder.
lzma_end_function end;
+ /// Pointer to a function to get progress information. If this is NULL,
+ /// lzma_stream.total_in and .total_out are used instead.
+ void (*get_progress)(void *coder,
+ uint64_t *progress_in, uint64_t *progress_out);
+
/// Pointer to function to return the type of the integrity check.
/// Most coders won't support this.
- lzma_check (*get_check)(const lzma_coder *coder);
+ lzma_check (*get_check)(const void *coder);
/// Pointer to function to get and/or change the memory usage limit.
/// If new_memlimit == 0, the limit is not changed.
- lzma_ret (*memconfig)(lzma_coder *coder, uint64_t *memusage,
+ lzma_ret (*memconfig)(void *coder, uint64_t *memusage,
uint64_t *old_memlimit, uint64_t new_memlimit);
/// Update the filter-specific options or the whole filter chain
/// in the encoder.
- lzma_ret (*update)(lzma_coder *coder, lzma_allocator *allocator,
+ lzma_ret (*update)(void *coder, const lzma_allocator *allocator,
const lzma_filter *filters,
const lzma_filter *reversed_filters);
};
-/// Constant to initialize lzma_next_coder structure
-static const lzma_next_coder LZMA_NEXT_CODER_INIT =
- {
- NULL,
- LZMA_VLI_UNKNOWN,
- (uintptr_t)(NULL),
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- };
+/// Macro to initialize lzma_next_coder structure
+#define LZMA_NEXT_CODER_INIT \
+ (lzma_next_coder){ \
+ .coder = NULL, \
+ .init = (uintptr_t)(NULL), \
+ .id = LZMA_VLI_UNKNOWN, \
+ .code = NULL, \
+ .end = NULL, \
+ .get_progress = NULL, \
+ .get_check = NULL, \
+ .memconfig = NULL, \
+ .update = NULL, \
+ }
/// Internal data for lzma_strm_init, lzma_code, and lzma_end. A pointer to
@@ -184,6 +205,7 @@ struct lzma_internal_s {
ISEQ_SYNC_FLUSH,
ISEQ_FULL_FLUSH,
ISEQ_FINISH,
+ ISEQ_FULL_BARRIER,
ISEQ_END,
ISEQ_ERROR,
} sequence;
@@ -194,7 +216,7 @@ struct lzma_internal_s {
size_t avail_in;
/// Indicates which lzma_action values are allowed by next.code.
- bool supported_actions[4];
+ bool supported_actions[LZMA_ACTION_MAX + 1];
/// If true, lzma_code will return LZMA_BUF_ERROR if no progress was
/// made (no input consumed and no output produced by next.code).
@@ -203,15 +225,21 @@ struct lzma_internal_s {
/// Allocates memory
-extern void *lzma_alloc(size_t size, lzma_allocator *allocator)
+extern void *lzma_alloc(size_t size, const lzma_allocator *allocator)
lzma_attribute((__malloc__)) lzma_attr_alloc_size(1);
+/// Allocates memory and zeroes it (like calloc()). This can be faster
+/// than lzma_alloc() + memzero() while being backward compatible with
+/// custom allocators.
+extern void * lzma_attribute((__malloc__)) lzma_attr_alloc_size(1)
+ lzma_alloc_zero(size_t size, const lzma_allocator *allocator);
+
/// Frees memory
-extern void lzma_free(void *ptr, lzma_allocator *allocator);
+extern void lzma_free(void *ptr, const lzma_allocator *allocator);
/// Allocates strm->internal if it is NULL, and initializes *strm and
-/// strm->internal. This function is only called via lzma_next_strm_init2 macro.
+/// strm->internal. This function is only called via lzma_next_strm_init macro.
extern lzma_ret lzma_strm_init(lzma_stream *strm);
/// Initializes the next filter in the chain, if any. This takes care of
@@ -219,24 +247,26 @@ extern lzma_ret lzma_strm_init(lzma_stream *strm);
/// than the filter being initialized now. This way the actual filter
/// initialization functions don't need to use lzma_next_coder_init macro.
extern lzma_ret lzma_next_filter_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters);
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters);
/// Update the next filter in the chain, if any. This checks that
/// the application is not trying to change the Filter IDs.
extern lzma_ret lzma_next_filter_update(
- lzma_next_coder *next, lzma_allocator *allocator,
+ lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter *reversed_filters);
/// Frees the memory allocated for next->coder either using next->end or,
/// if next->end is NULL, using lzma_free.
-extern void lzma_next_end(lzma_next_coder *next, lzma_allocator *allocator);
+extern void lzma_next_end(lzma_next_coder *next,
+ const lzma_allocator *allocator);
/// Copy as much data as possible from in[] to out[] and update *in_pos
/// and *out_pos accordingly. Returns the number of bytes copied.
-extern size_t lzma_bufcpy(const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
- size_t in_size, uint8_t *LZMA_RESTRICT out,
- size_t *LZMA_RESTRICT out_pos, size_t out_size);
+extern size_t lzma_bufcpy(const uint8_t *restrict in, size_t *restrict in_pos,
+ size_t in_size, uint8_t *restrict out,
+ size_t *restrict out_pos, size_t out_size);
/// \brief Return if expression doesn't evaluate to LZMA_OK
@@ -269,37 +299,15 @@ do { \
/// (The function being called will use lzma_next_coder_init()). If
/// initialization fails, memory that wasn't freed by func() is freed
/// along strm->internal.
-#define lzma_next_strm_init1(func, strm, arg1) \
+#define lzma_next_strm_init(func, strm, ...) \
do { \
- lzma_ret ret_; \
- return_if_error(lzma_strm_init(strm)); \
- ret_ = func(&(strm)->internal->next, (strm)->allocator, arg1); \
- if (ret_ != LZMA_OK) { \
- lzma_end(strm); \
- return ret_; \
- } \
-} while (0)
-
-#define lzma_next_strm_init2(func, strm, arg1, arg2) \
-do { \
- lzma_ret ret_; \
- return_if_error(lzma_strm_init(strm)); \
- ret_ = func(&(strm)->internal->next, (strm)->allocator, arg1, arg2); \
- if (ret_ != LZMA_OK) { \
- lzma_end(strm); \
- return ret_; \
- } \
-} while (0)
-
-#define lzma_next_strm_init3(func, strm, arg1, arg2, arg3) \
-do { \
- lzma_ret ret_; \
- return_if_error(lzma_strm_init(strm)); \
- ret_ = func(&(strm)->internal->next, (strm)->allocator, arg1, arg2, arg3); \
- if (ret_ != LZMA_OK) { \
- lzma_end(strm); \
- return ret_; \
- } \
+ return_if_error(lzma_strm_init(strm)); \
+ const lzma_ret ret_ = func(&(strm)->internal->next, \
+ (strm)->allocator, __VA_ARGS__); \
+ if (ret_ != LZMA_OK) { \
+ lzma_end(strm); \
+ return ret_; \
+ } \
} while (0)
#endif
diff --git a/Utilities/cmliblzma/liblzma/common/easy_buffer_encoder.c b/Utilities/cmliblzma/liblzma/common/easy_buffer_encoder.c
index c4be34c..48eb56f 100644
--- a/Utilities/cmliblzma/liblzma/common/easy_buffer_encoder.c
+++ b/Utilities/cmliblzma/liblzma/common/easy_buffer_encoder.c
@@ -15,8 +15,8 @@
extern LZMA_API(lzma_ret)
lzma_easy_buffer_encode(uint32_t preset, lzma_check check,
- lzma_allocator *allocator, const uint8_t *in, size_t in_size,
- uint8_t *out, size_t *out_pos, size_t out_size)
+ const lzma_allocator *allocator, const uint8_t *in,
+ size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size)
{
lzma_options_easy opt_easy;
if (lzma_easy_preset(&opt_easy, preset))
diff --git a/Utilities/cmliblzma/liblzma/common/easy_encoder.c b/Utilities/cmliblzma/liblzma/common/easy_encoder.c
index d13ccd7..5cb492d 100644
--- a/Utilities/cmliblzma/liblzma/common/easy_encoder.c
+++ b/Utilities/cmliblzma/liblzma/common/easy_encoder.c
@@ -11,7 +11,6 @@
///////////////////////////////////////////////////////////////////////////////
#include "easy_preset.h"
-#include "stream_encoder.h"
extern LZMA_API(lzma_ret)
diff --git a/Utilities/cmliblzma/liblzma/common/filter_buffer_decoder.c b/Utilities/cmliblzma/liblzma/common/filter_buffer_decoder.c
index 65665c1..6620986 100644
--- a/Utilities/cmliblzma/liblzma/common/filter_buffer_decoder.c
+++ b/Utilities/cmliblzma/liblzma/common/filter_buffer_decoder.c
@@ -14,30 +14,27 @@
extern LZMA_API(lzma_ret)
-lzma_raw_buffer_decode(const lzma_filter *filters, lzma_allocator *allocator,
+lzma_raw_buffer_decode(
+ const lzma_filter *filters, const lzma_allocator *allocator,
const uint8_t *in, size_t *in_pos, size_t in_size,
uint8_t *out, size_t *out_pos, size_t out_size)
{
- lzma_next_coder next = LZMA_NEXT_CODER_INIT;
- size_t in_start;
- size_t out_start;
- lzma_ret ret;
-
// Validate what isn't validated later in filter_common.c.
if (in == NULL || in_pos == NULL || *in_pos > in_size || out == NULL
|| out_pos == NULL || *out_pos > out_size)
return LZMA_PROG_ERROR;
// Initialize the decoer.
+ lzma_next_coder next = LZMA_NEXT_CODER_INIT;
return_if_error(lzma_raw_decoder_init(&next, allocator, filters));
// Store the positions so that we can restore them if something
// goes wrong.
- in_start = *in_pos;
- out_start = *out_pos;
+ const size_t in_start = *in_pos;
+ const size_t out_start = *out_pos;
// Do the actual decoding and free decoder's memory.
- ret = next.code(next.coder, allocator, in, in_pos, in_size,
+ lzma_ret ret = next.code(next.coder, allocator, in, in_pos, in_size,
out, out_pos, out_size, LZMA_FINISH);
if (ret == LZMA_STREAM_END) {
diff --git a/Utilities/cmliblzma/liblzma/common/filter_buffer_encoder.c b/Utilities/cmliblzma/liblzma/common/filter_buffer_encoder.c
index b23329f..dda18e3 100644
--- a/Utilities/cmliblzma/liblzma/common/filter_buffer_encoder.c
+++ b/Utilities/cmliblzma/liblzma/common/filter_buffer_encoder.c
@@ -14,29 +14,27 @@
extern LZMA_API(lzma_ret)
-lzma_raw_buffer_encode(const lzma_filter *filters, lzma_allocator *allocator,
- const uint8_t *in, size_t in_size, uint8_t *out,
- size_t *out_pos, size_t out_size)
+lzma_raw_buffer_encode(
+ const lzma_filter *filters, const lzma_allocator *allocator,
+ const uint8_t *in, size_t in_size,
+ uint8_t *out, size_t *out_pos, size_t out_size)
{
- lzma_next_coder next = LZMA_NEXT_CODER_INIT;
- size_t out_start;
- size_t in_pos = 0;
- lzma_ret ret;
-
// Validate what isn't validated later in filter_common.c.
if ((in == NULL && in_size != 0) || out == NULL
|| out_pos == NULL || *out_pos > out_size)
return LZMA_PROG_ERROR;
// Initialize the encoder
+ lzma_next_coder next = LZMA_NEXT_CODER_INIT;
return_if_error(lzma_raw_encoder_init(&next, allocator, filters));
// Store the output position so that we can restore it if
// something goes wrong.
- out_start = *out_pos;
+ const size_t out_start = *out_pos;
// Do the actual encoding and free coder's memory.
- ret = next.code(next.coder, allocator, in, &in_pos, in_size,
+ size_t in_pos = 0;
+ lzma_ret ret = next.code(next.coder, allocator, in, &in_pos, in_size,
out, out_pos, out_size, LZMA_FINISH);
lzma_next_end(&next, allocator);
diff --git a/Utilities/cmliblzma/liblzma/common/filter_common.c b/Utilities/cmliblzma/liblzma/common/filter_common.c
index d2b9e08..9ad5d5d 100644
--- a/Utilities/cmliblzma/liblzma/common/filter_common.c
+++ b/Utilities/cmliblzma/liblzma/common/filter_common.c
@@ -36,101 +36,100 @@ static const struct {
} features[] = {
#if defined (HAVE_ENCODER_LZMA1) || defined(HAVE_DECODER_LZMA1)
{
- LZMA_FILTER_LZMA1,
- sizeof(lzma_options_lzma),
- false,
- true,
- true,
+ .id = LZMA_FILTER_LZMA1,
+ .options_size = sizeof(lzma_options_lzma),
+ .non_last_ok = false,
+ .last_ok = true,
+ .changes_size = true,
},
#endif
#if defined(HAVE_ENCODER_LZMA2) || defined(HAVE_DECODER_LZMA2)
{
- LZMA_FILTER_LZMA2,
- sizeof(lzma_options_lzma),
- false,
- true,
- true,
+ .id = LZMA_FILTER_LZMA2,
+ .options_size = sizeof(lzma_options_lzma),
+ .non_last_ok = false,
+ .last_ok = true,
+ .changes_size = true,
},
#endif
#if defined(HAVE_ENCODER_X86) || defined(HAVE_DECODER_X86)
{
- LZMA_FILTER_X86,
- sizeof(lzma_options_bcj),
- true,
- false,
- false,
+ .id = LZMA_FILTER_X86,
+ .options_size = sizeof(lzma_options_bcj),
+ .non_last_ok = true,
+ .last_ok = false,
+ .changes_size = false,
},
#endif
#if defined(HAVE_ENCODER_POWERPC) || defined(HAVE_DECODER_POWERPC)
{
- LZMA_FILTER_POWERPC,
- sizeof(lzma_options_bcj),
- true,
- false,
- false,
+ .id = LZMA_FILTER_POWERPC,
+ .options_size = sizeof(lzma_options_bcj),
+ .non_last_ok = true,
+ .last_ok = false,
+ .changes_size = false,
},
#endif
#if defined(HAVE_ENCODER_IA64) || defined(HAVE_DECODER_IA64)
{
- LZMA_FILTER_IA64,
- sizeof(lzma_options_bcj),
- true,
- false,
- false,
+ .id = LZMA_FILTER_IA64,
+ .options_size = sizeof(lzma_options_bcj),
+ .non_last_ok = true,
+ .last_ok = false,
+ .changes_size = false,
},
#endif
#if defined(HAVE_ENCODER_ARM) || defined(HAVE_DECODER_ARM)
{
- LZMA_FILTER_ARM,
- sizeof(lzma_options_bcj),
- true,
- false,
- false,
+ .id = LZMA_FILTER_ARM,
+ .options_size = sizeof(lzma_options_bcj),
+ .non_last_ok = true,
+ .last_ok = false,
+ .changes_size = false,
},
#endif
#if defined(HAVE_ENCODER_ARMTHUMB) || defined(HAVE_DECODER_ARMTHUMB)
{
- LZMA_FILTER_ARMTHUMB,
- sizeof(lzma_options_bcj),
- true,
- false,
- false,
+ .id = LZMA_FILTER_ARMTHUMB,
+ .options_size = sizeof(lzma_options_bcj),
+ .non_last_ok = true,
+ .last_ok = false,
+ .changes_size = false,
},
#endif
#if defined(HAVE_ENCODER_SPARC) || defined(HAVE_DECODER_SPARC)
{
- LZMA_FILTER_SPARC,
- sizeof(lzma_options_bcj),
- true,
- false,
- false,
+ .id = LZMA_FILTER_SPARC,
+ .options_size = sizeof(lzma_options_bcj),
+ .non_last_ok = true,
+ .last_ok = false,
+ .changes_size = false,
},
#endif
#if defined(HAVE_ENCODER_DELTA) || defined(HAVE_DECODER_DELTA)
{
- LZMA_FILTER_DELTA,
- sizeof(lzma_options_delta),
- true,
- false,
- false,
+ .id = LZMA_FILTER_DELTA,
+ .options_size = sizeof(lzma_options_delta),
+ .non_last_ok = true,
+ .last_ok = false,
+ .changes_size = false,
},
#endif
{
- LZMA_VLI_UNKNOWN
+ .id = LZMA_VLI_UNKNOWN
}
};
extern LZMA_API(lzma_ret)
lzma_filters_copy(const lzma_filter *src, lzma_filter *dest,
- lzma_allocator *allocator)
+ const lzma_allocator *allocator)
{
- size_t i;
- lzma_ret ret;
-
if (src == NULL || dest == NULL)
return LZMA_PROG_ERROR;
+ lzma_ret ret;
+ size_t i;
for (i = 0; src[i].id != LZMA_VLI_UNKNOWN; ++i) {
// There must be a maximum of four filters plus
// the array terminator.
@@ -194,6 +193,10 @@ error:
static lzma_ret
validate_chain(const lzma_filter *filters, size_t *count)
{
+ // There must be at least one filter.
+ if (filters == NULL || filters[0].id == LZMA_VLI_UNKNOWN)
+ return LZMA_PROG_ERROR;
+
// Number of non-last filters that may change the size of the data
// significantly (that is, more than 1-2 % or so).
size_t changes_size_count = 0;
@@ -207,11 +210,6 @@ validate_chain(const lzma_filter *filters, size_t *count)
bool last_ok = false;
size_t i = 0;
-
- // There must be at least one filter.
- if (filters == NULL || filters[0].id == LZMA_VLI_UNKNOWN)
- return LZMA_PROG_ERROR;
-
do {
size_t j;
for (j = 0; filters[i].id != features[j].id; ++j)
@@ -241,21 +239,18 @@ validate_chain(const lzma_filter *filters, size_t *count)
extern lzma_ret
-lzma_raw_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_raw_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter *options,
lzma_filter_find coder_find, bool is_encoder)
{
- lzma_filter_info filters[LZMA_FILTERS_MAX + 1];
- size_t count;
- size_t i;
- lzma_ret ret;
-
// Do some basic validation and get the number of filters.
+ size_t count;
return_if_error(validate_chain(options, &count));
// Set the filter functions and copy the options pointer.
+ lzma_filter_info filters[LZMA_FILTERS_MAX + 1];
if (is_encoder) {
- for (i = 0; i < count; ++i) {
+ for (size_t i = 0; i < count; ++i) {
// The order of the filters is reversed in the
// encoder. It allows more efficient handling
// of the uncompressed data.
@@ -271,7 +266,7 @@ lzma_raw_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
filters[j].options = options[i].options;
}
} else {
- for (i = 0; i < count; ++i) {
+ for (size_t i = 0; i < count; ++i) {
const lzma_filter_coder *const fc
= coder_find(options[i].id);
if (fc == NULL || fc->init == NULL)
@@ -288,7 +283,7 @@ lzma_raw_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
filters[count].init = NULL;
// Initialize the filters.
- ret = lzma_next_filter_init(next, allocator, filters);
+ const lzma_ret ret = lzma_next_filter_init(next, allocator, filters);
if (ret != LZMA_OK)
lzma_next_end(next, allocator);
@@ -300,9 +295,6 @@ extern uint64_t
lzma_raw_coder_memusage(lzma_filter_find coder_find,
const lzma_filter *filters)
{
- uint64_t total = 0;
- size_t i = 0;
-
// The chain has to have at least one filter.
{
size_t tmp;
@@ -310,6 +302,9 @@ lzma_raw_coder_memusage(lzma_filter_find coder_find,
return UINT64_MAX;
}
+ uint64_t total = 0;
+ size_t i = 0;
+
do {
const lzma_filter_coder *const fc
= coder_find(filters[i].id);
diff --git a/Utilities/cmliblzma/liblzma/common/filter_common.h b/Utilities/cmliblzma/liblzma/common/filter_common.h
index cd61fc0..42a26a2 100644
--- a/Utilities/cmliblzma/liblzma/common/filter_common.h
+++ b/Utilities/cmliblzma/liblzma/common/filter_common.h
@@ -36,7 +36,7 @@ typedef const lzma_filter_coder *(*lzma_filter_find)(lzma_vli id);
extern lzma_ret lzma_raw_coder_init(
- lzma_next_coder *next, lzma_allocator *allocator,
+ lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter *filters,
lzma_filter_find coder_find, bool is_encoder);
diff --git a/Utilities/cmliblzma/liblzma/common/filter_decoder.c b/Utilities/cmliblzma/liblzma/common/filter_decoder.c
index cce2b30..c75b0a8 100644
--- a/Utilities/cmliblzma/liblzma/common/filter_decoder.c
+++ b/Utilities/cmliblzma/liblzma/common/filter_decoder.c
@@ -35,7 +35,8 @@ typedef struct {
/// \return - LZMA_OK: Properties decoded successfully.
/// - LZMA_OPTIONS_ERROR: Unsupported properties
/// - LZMA_MEM_ERROR: Memory allocation failed.
- lzma_ret (*props_decode)(void **options, lzma_allocator *allocator,
+ lzma_ret (*props_decode)(
+ void **options, const lzma_allocator *allocator,
const uint8_t *props, size_t props_size);
} lzma_filter_decoder;
@@ -44,74 +45,74 @@ typedef struct {
static const lzma_filter_decoder decoders[] = {
#ifdef HAVE_DECODER_LZMA1
{
- LZMA_FILTER_LZMA1,
- &lzma_lzma_decoder_init,
- &lzma_lzma_decoder_memusage,
- &lzma_lzma_props_decode,
+ .id = LZMA_FILTER_LZMA1,
+ .init = &lzma_lzma_decoder_init,
+ .memusage = &lzma_lzma_decoder_memusage,
+ .props_decode = &lzma_lzma_props_decode,
},
#endif
#ifdef HAVE_DECODER_LZMA2
{
- LZMA_FILTER_LZMA2,
- &lzma_lzma2_decoder_init,
- &lzma_lzma2_decoder_memusage,
- &lzma_lzma2_props_decode,
+ .id = LZMA_FILTER_LZMA2,
+ .init = &lzma_lzma2_decoder_init,
+ .memusage = &lzma_lzma2_decoder_memusage,
+ .props_decode = &lzma_lzma2_props_decode,
},
#endif
#ifdef HAVE_DECODER_X86
{
- LZMA_FILTER_X86,
- &lzma_simple_x86_decoder_init,
- NULL,
- &lzma_simple_props_decode,
+ .id = LZMA_FILTER_X86,
+ .init = &lzma_simple_x86_decoder_init,
+ .memusage = NULL,
+ .props_decode = &lzma_simple_props_decode,
},
#endif
#ifdef HAVE_DECODER_POWERPC
{
- LZMA_FILTER_POWERPC,
- &lzma_simple_powerpc_decoder_init,
- NULL,
- &lzma_simple_props_decode,
+ .id = LZMA_FILTER_POWERPC,
+ .init = &lzma_simple_powerpc_decoder_init,
+ .memusage = NULL,
+ .props_decode = &lzma_simple_props_decode,
},
#endif
#ifdef HAVE_DECODER_IA64
{
- LZMA_FILTER_IA64,
- &lzma_simple_ia64_decoder_init,
- NULL,
- &lzma_simple_props_decode,
+ .id = LZMA_FILTER_IA64,
+ .init = &lzma_simple_ia64_decoder_init,
+ .memusage = NULL,
+ .props_decode = &lzma_simple_props_decode,
},
#endif
#ifdef HAVE_DECODER_ARM
{
- LZMA_FILTER_ARM,
- &lzma_simple_arm_decoder_init,
- NULL,
- &lzma_simple_props_decode,
+ .id = LZMA_FILTER_ARM,
+ .init = &lzma_simple_arm_decoder_init,
+ .memusage = NULL,
+ .props_decode = &lzma_simple_props_decode,
},
#endif
#ifdef HAVE_DECODER_ARMTHUMB
{
- LZMA_FILTER_ARMTHUMB,
- &lzma_simple_armthumb_decoder_init,
- NULL,
- &lzma_simple_props_decode,
+ .id = LZMA_FILTER_ARMTHUMB,
+ .init = &lzma_simple_armthumb_decoder_init,
+ .memusage = NULL,
+ .props_decode = &lzma_simple_props_decode,
},
#endif
#ifdef HAVE_DECODER_SPARC
{
- LZMA_FILTER_SPARC,
- &lzma_simple_sparc_decoder_init,
- NULL,
- &lzma_simple_props_decode,
+ .id = LZMA_FILTER_SPARC,
+ .init = &lzma_simple_sparc_decoder_init,
+ .memusage = NULL,
+ .props_decode = &lzma_simple_props_decode,
},
#endif
#ifdef HAVE_DECODER_DELTA
{
- LZMA_FILTER_DELTA,
- &lzma_delta_decoder_init,
- &lzma_delta_coder_memusage,
- &lzma_delta_props_decode,
+ .id = LZMA_FILTER_DELTA,
+ .init = &lzma_delta_decoder_init,
+ .memusage = &lzma_delta_coder_memusage,
+ .props_decode = &lzma_delta_props_decode,
},
#endif
};
@@ -120,8 +121,7 @@ static const lzma_filter_decoder decoders[] = {
static const lzma_filter_decoder *
decoder_find(lzma_vli id)
{
- size_t i;
- for (i = 0; i < ARRAY_SIZE(decoders); ++i)
+ for (size_t i = 0; i < ARRAY_SIZE(decoders); ++i)
if (decoders[i].id == id)
return decoders + i;
@@ -137,7 +137,7 @@ lzma_filter_decoder_is_supported(lzma_vli id)
extern lzma_ret
-lzma_raw_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_raw_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter *options)
{
return lzma_raw_coder_init(next, allocator,
@@ -148,7 +148,7 @@ lzma_raw_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern LZMA_API(lzma_ret)
lzma_raw_decoder(lzma_stream *strm, const lzma_filter *options)
{
- lzma_next_strm_init1(lzma_raw_decoder_init, strm, options);
+ lzma_next_strm_init(lzma_raw_decoder_init, strm, options);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
@@ -166,14 +166,13 @@ lzma_raw_decoder_memusage(const lzma_filter *filters)
extern LZMA_API(lzma_ret)
-lzma_properties_decode(lzma_filter *filter, lzma_allocator *allocator,
+lzma_properties_decode(lzma_filter *filter, const lzma_allocator *allocator,
const uint8_t *props, size_t props_size)
{
- const lzma_filter_decoder *const fd = decoder_find(filter->id);
-
// Make it always NULL so that the caller can always safely free() it.
filter->options = NULL;
+ const lzma_filter_decoder *const fd = decoder_find(filter->id);
if (fd == NULL)
return LZMA_OPTIONS_ERROR;
diff --git a/Utilities/cmliblzma/liblzma/common/filter_decoder.h b/Utilities/cmliblzma/liblzma/common/filter_decoder.h
index d5c68bd..a2e255f 100644
--- a/Utilities/cmliblzma/liblzma/common/filter_decoder.h
+++ b/Utilities/cmliblzma/liblzma/common/filter_decoder.h
@@ -17,7 +17,7 @@
extern lzma_ret lzma_raw_decoder_init(
- lzma_next_coder *next, lzma_allocator *allocator,
+ lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter *options);
#endif
diff --git a/Utilities/cmliblzma/liblzma/common/filter_encoder.c b/Utilities/cmliblzma/liblzma/common/filter_encoder.c
index 9fdb100..c5d8f39 100644
--- a/Utilities/cmliblzma/liblzma/common/filter_encoder.c
+++ b/Utilities/cmliblzma/liblzma/common/filter_encoder.c
@@ -30,11 +30,11 @@ typedef struct {
/// invalid, UINT64_MAX is returned.
uint64_t (*memusage)(const void *options);
- /// Calculates the minimum sane size for Blocks (or other types of
- /// chunks) to which the input data can be split to make
- /// multithreaded encoding possible. If this is NULL, it is assumed
- /// that the encoder is fast enough with single thread.
- lzma_vli (*chunk_size)(const void *options);
+ /// Calculates the recommended Uncompressed Size for .xz Blocks to
+ /// which the input data can be split to make multithreaded
+ /// encoding possible. If this is NULL, it is assumed that
+ /// the encoder is fast enough with single thread.
+ uint64_t (*block_size)(const void *options);
/// Tells the size of the Filter Properties field. If options are
/// invalid, UINT32_MAX is returned. If this is NULL, props_size_fixed
@@ -56,101 +56,95 @@ typedef struct {
static const lzma_filter_encoder encoders[] = {
#ifdef HAVE_ENCODER_LZMA1
{
- LZMA_FILTER_LZMA1,
- &lzma_lzma_encoder_init,
- &lzma_lzma_encoder_memusage,
- NULL, // FIXME
- NULL,
- 5,
- &lzma_lzma_props_encode,
+ .id = LZMA_FILTER_LZMA1,
+ .init = &lzma_lzma_encoder_init,
+ .memusage = &lzma_lzma_encoder_memusage,
+ .block_size = NULL, // FIXME
+ .props_size_get = NULL,
+ .props_size_fixed = 5,
+ .props_encode = &lzma_lzma_props_encode,
},
#endif
#ifdef HAVE_ENCODER_LZMA2
{
- LZMA_FILTER_LZMA2,
- &lzma_lzma2_encoder_init,
- &lzma_lzma2_encoder_memusage,
- NULL, // FIXME
- NULL,
- 1,
- &lzma_lzma2_props_encode,
+ .id = LZMA_FILTER_LZMA2,
+ .init = &lzma_lzma2_encoder_init,
+ .memusage = &lzma_lzma2_encoder_memusage,
+ .block_size = &lzma_lzma2_block_size, // FIXME
+ .props_size_get = NULL,
+ .props_size_fixed = 1,
+ .props_encode = &lzma_lzma2_props_encode,
},
#endif
#ifdef HAVE_ENCODER_X86
{
- LZMA_FILTER_X86,
- &lzma_simple_x86_encoder_init,
- NULL,
- NULL,
- &lzma_simple_props_size,
- 0,
- &lzma_simple_props_encode,
+ .id = LZMA_FILTER_X86,
+ .init = &lzma_simple_x86_encoder_init,
+ .memusage = NULL,
+ .block_size = NULL,
+ .props_size_get = &lzma_simple_props_size,
+ .props_encode = &lzma_simple_props_encode,
},
#endif
#ifdef HAVE_ENCODER_POWERPC
{
- LZMA_FILTER_POWERPC,
- &lzma_simple_powerpc_encoder_init,
- NULL,
- NULL,
- &lzma_simple_props_size,
- 0,
- &lzma_simple_props_encode,
+ .id = LZMA_FILTER_POWERPC,
+ .init = &lzma_simple_powerpc_encoder_init,
+ .memusage = NULL,
+ .block_size = NULL,
+ .props_size_get = &lzma_simple_props_size,
+ .props_encode = &lzma_simple_props_encode,
},
#endif
#ifdef HAVE_ENCODER_IA64
{
- LZMA_FILTER_IA64,
- &lzma_simple_ia64_encoder_init,
- NULL,
- NULL,
- &lzma_simple_props_size,
- 0,
- &lzma_simple_props_encode,
+ .id = LZMA_FILTER_IA64,
+ .init = &lzma_simple_ia64_encoder_init,
+ .memusage = NULL,
+ .block_size = NULL,
+ .props_size_get = &lzma_simple_props_size,
+ .props_encode = &lzma_simple_props_encode,
},
#endif
#ifdef HAVE_ENCODER_ARM
{
- LZMA_FILTER_ARM,
- &lzma_simple_arm_encoder_init,
- NULL,
- NULL,
- &lzma_simple_props_size,
- 0,
- &lzma_simple_props_encode,
+ .id = LZMA_FILTER_ARM,
+ .init = &lzma_simple_arm_encoder_init,
+ .memusage = NULL,
+ .block_size = NULL,
+ .props_size_get = &lzma_simple_props_size,
+ .props_encode = &lzma_simple_props_encode,
},
#endif
#ifdef HAVE_ENCODER_ARMTHUMB
{
- LZMA_FILTER_ARMTHUMB,
- &lzma_simple_armthumb_encoder_init,
- NULL,
- NULL,
- &lzma_simple_props_size,
- 0,
- &lzma_simple_props_encode,
+ .id = LZMA_FILTER_ARMTHUMB,
+ .init = &lzma_simple_armthumb_encoder_init,
+ .memusage = NULL,
+ .block_size = NULL,
+ .props_size_get = &lzma_simple_props_size,
+ .props_encode = &lzma_simple_props_encode,
},
#endif
#ifdef HAVE_ENCODER_SPARC
{
- LZMA_FILTER_SPARC,
- &lzma_simple_sparc_encoder_init,
- NULL,
- NULL,
- &lzma_simple_props_size,
- 0,
- &lzma_simple_props_encode,
+ .id = LZMA_FILTER_SPARC,
+ .init = &lzma_simple_sparc_encoder_init,
+ .memusage = NULL,
+ .block_size = NULL,
+ .props_size_get = &lzma_simple_props_size,
+ .props_encode = &lzma_simple_props_encode,
},
#endif
#ifdef HAVE_ENCODER_DELTA
{
- LZMA_FILTER_DELTA,
- &lzma_delta_encoder_init,
- &lzma_delta_coder_memusage,
- NULL,
- NULL,
- 1,
- &lzma_delta_props_encode,
+ .id = LZMA_FILTER_DELTA,
+ .init = &lzma_delta_encoder_init,
+ .memusage = &lzma_delta_coder_memusage,
+ .block_size = NULL,
+ .props_size_get = NULL,
+ .props_size_fixed = 1,
+ .props_encode = &lzma_delta_props_encode,
},
#endif
};
@@ -159,8 +153,7 @@ static const lzma_filter_encoder encoders[] = {
static const lzma_filter_encoder *
encoder_find(lzma_vli id)
{
- size_t i;
- for (i = 0; i < ARRAY_SIZE(encoders); ++i)
+ for (size_t i = 0; i < ARRAY_SIZE(encoders); ++i)
if (encoders[i].id == id)
return encoders + i;
@@ -178,10 +171,6 @@ lzma_filter_encoder_is_supported(lzma_vli id)
extern LZMA_API(lzma_ret)
lzma_filters_update(lzma_stream *strm, const lzma_filter *filters)
{
- size_t i;
- size_t count = 1;
- lzma_filter reversed_filters[LZMA_FILTERS_MAX + 1];
-
if (strm->internal->next.update == NULL)
return LZMA_PROG_ERROR;
@@ -191,10 +180,12 @@ lzma_filters_update(lzma_stream *strm, const lzma_filter *filters)
// The actual filter chain in the encoder is reversed. Some things
// still want the normal order chain, so we provide both.
+ size_t count = 1;
while (filters[count].id != LZMA_VLI_UNKNOWN)
++count;
- for (i = 0; i < count; ++i)
+ lzma_filter reversed_filters[LZMA_FILTERS_MAX + 1];
+ for (size_t i = 0; i < count; ++i)
reversed_filters[count - i - 1] = filters[i];
reversed_filters[count].id = LZMA_VLI_UNKNOWN;
@@ -205,7 +196,7 @@ lzma_filters_update(lzma_stream *strm, const lzma_filter *filters)
extern lzma_ret
-lzma_raw_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_raw_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter *options)
{
return lzma_raw_coder_init(next, allocator,
@@ -216,7 +207,7 @@ lzma_raw_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern LZMA_API(lzma_ret)
lzma_raw_encoder(lzma_stream *strm, const lzma_filter *options)
{
- lzma_next_strm_init3(lzma_raw_coder_init, strm, options,
+ lzma_next_strm_init(lzma_raw_coder_init, strm, options,
(lzma_filter_find)(&encoder_find), true);
strm->internal->supported_actions[LZMA_RUN] = true;
@@ -235,20 +226,19 @@ lzma_raw_encoder_memusage(const lzma_filter *filters)
}
-/*
-extern LZMA_API(lzma_vli)
-lzma_chunk_size(const lzma_filter *filters)
+extern uint64_t
+lzma_mt_block_size(const lzma_filter *filters)
{
- lzma_vli max = 0;
+ uint64_t max = 0;
for (size_t i = 0; filters[i].id != LZMA_VLI_UNKNOWN; ++i) {
const lzma_filter_encoder *const fe
= encoder_find(filters[i].id);
- if (fe->chunk_size != NULL) {
- const lzma_vli size
- = fe->chunk_size(filters[i].options);
- if (size == LZMA_VLI_UNKNOWN)
- return LZMA_VLI_UNKNOWN;
+ if (fe->block_size != NULL) {
+ const uint64_t size
+ = fe->block_size(filters[i].options);
+ if (size == 0)
+ return 0;
if (size > max)
max = size;
@@ -257,7 +247,6 @@ lzma_chunk_size(const lzma_filter *filters)
return max;
}
-*/
extern LZMA_API(lzma_ret)
diff --git a/Utilities/cmliblzma/liblzma/common/filter_encoder.h b/Utilities/cmliblzma/liblzma/common/filter_encoder.h
index 5bc137f..f1d5683 100644
--- a/Utilities/cmliblzma/liblzma/common/filter_encoder.h
+++ b/Utilities/cmliblzma/liblzma/common/filter_encoder.h
@@ -16,12 +16,12 @@
#include "common.h"
-// FIXME: Might become a part of the public API once finished.
-// extern lzma_vli lzma_chunk_size(const lzma_filter *filters);
+// FIXME: Might become a part of the public API.
+extern uint64_t lzma_mt_block_size(const lzma_filter *filters);
extern lzma_ret lzma_raw_encoder_init(
- lzma_next_coder *next, lzma_allocator *allocator,
+ lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter *filters);
#endif
diff --git a/Utilities/cmliblzma/liblzma/common/filter_flags_decoder.c b/Utilities/cmliblzma/liblzma/common/filter_flags_decoder.c
index aa2dbd5..ddfb085 100644
--- a/Utilities/cmliblzma/liblzma/common/filter_flags_decoder.c
+++ b/Utilities/cmliblzma/liblzma/common/filter_flags_decoder.c
@@ -15,12 +15,9 @@
extern LZMA_API(lzma_ret)
lzma_filter_flags_decode(
- lzma_filter *filter, lzma_allocator *allocator,
+ lzma_filter *filter, const lzma_allocator *allocator,
const uint8_t *in, size_t *in_pos, size_t in_size)
{
- lzma_vli props_size;
- lzma_ret ret;
-
// Set the pointer to NULL so the caller can always safely free it.
filter->options = NULL;
@@ -32,6 +29,7 @@ lzma_filter_flags_decode(
return LZMA_DATA_ERROR;
// Size of Properties
+ lzma_vli props_size;
return_if_error(lzma_vli_decode(&props_size, NULL,
in, in_pos, in_size));
@@ -39,7 +37,7 @@ lzma_filter_flags_decode(
if (in_size - *in_pos < props_size)
return LZMA_DATA_ERROR;
- ret = lzma_properties_decode(
+ const lzma_ret ret = lzma_properties_decode(
filter, allocator, in + *in_pos, props_size);
*in_pos += props_size;
diff --git a/Utilities/cmliblzma/liblzma/common/filter_flags_encoder.c b/Utilities/cmliblzma/liblzma/common/filter_flags_encoder.c
index 755c407..d110566 100644
--- a/Utilities/cmliblzma/liblzma/common/filter_flags_encoder.c
+++ b/Utilities/cmliblzma/liblzma/common/filter_flags_encoder.c
@@ -31,8 +31,6 @@ extern LZMA_API(lzma_ret)
lzma_filter_flags_encode(const lzma_filter *filter,
uint8_t *out, size_t *out_pos, size_t out_size)
{
- uint32_t props_size;
-
// Filter ID
if (filter->id >= LZMA_FILTER_RESERVED_START)
return LZMA_PROG_ERROR;
@@ -41,6 +39,7 @@ lzma_filter_flags_encode(const lzma_filter *filter,
out, out_pos, out_size));
// Size of Properties
+ uint32_t props_size;
return_if_error(lzma_properties_size(&props_size, filter));
return_if_error(lzma_vli_encode(props_size, NULL,
out, out_pos, out_size));
diff --git a/Utilities/cmliblzma/liblzma/common/stream_encoder.h b/Utilities/cmliblzma/liblzma/common/hardware_cputhreads.c
index 46a7aed..f468366 100644
--- a/Utilities/cmliblzma/liblzma/common/stream_encoder.h
+++ b/Utilities/cmliblzma/liblzma/common/hardware_cputhreads.c
@@ -1,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////////
//
-/// \file stream_encoder.h
-/// \brief Encodes .xz Streams
+/// \file hardware_cputhreads.c
+/// \brief Get the number of CPU threads or cores
//
// Author: Lasse Collin
//
@@ -10,14 +10,13 @@
//
///////////////////////////////////////////////////////////////////////////////
-#ifndef LZMA_STREAM_ENCODER_H
-#define LZMA_STREAM_ENCODER_H
-
#include "common.h"
+#include "tuklib_cpucores.h"
-extern lzma_ret lzma_stream_encoder_init(
- lzma_next_coder *next, lzma_allocator *allocator,
- const lzma_filter *filters, lzma_check check);
-#endif
+extern LZMA_API(uint32_t)
+lzma_cputhreads(void)
+{
+ return tuklib_cpucores();
+}
diff --git a/Utilities/cmliblzma/liblzma/common/index.c b/Utilities/cmliblzma/liblzma/common/index.c
index 26135d2..26e4e51 100644
--- a/Utilities/cmliblzma/liblzma/common/index.c
+++ b/Utilities/cmliblzma/liblzma/common/index.c
@@ -191,8 +191,8 @@ index_tree_init(index_tree *tree)
/// Helper for index_tree_end()
static void
-index_tree_node_end(index_tree_node *node, lzma_allocator *allocator,
- void (*free_func)(void *node, lzma_allocator *allocator))
+index_tree_node_end(index_tree_node *node, const lzma_allocator *allocator,
+ void (*free_func)(void *node, const lzma_allocator *allocator))
{
// The tree won't ever be very huge, so recursion should be fine.
// 20 levels in the tree is likely quite a lot already in practice.
@@ -202,22 +202,21 @@ index_tree_node_end(index_tree_node *node, lzma_allocator *allocator,
if (node->right != NULL)
index_tree_node_end(node->right, allocator, free_func);
- if (free_func != NULL)
- free_func(node, allocator);
-
- lzma_free(node, allocator);
+ free_func(node, allocator);
return;
}
-/// Free the meory allocated for a tree. If free_func is not NULL,
-/// it is called on each node before freeing the node. This is used
-/// to free the Record groups from each index_stream before freeing
-/// the index_stream itself.
+/// Free the memory allocated for a tree. Each node is freed using the
+/// given free_func which is either &lzma_free or &index_stream_end.
+/// The latter is used to free the Record groups from each index_stream
+/// before freeing the index_stream itself.
static void
-index_tree_end(index_tree *tree, lzma_allocator *allocator,
- void (*free_func)(void *node, lzma_allocator *allocator))
+index_tree_end(index_tree *tree, const lzma_allocator *allocator,
+ void (*free_func)(void *node, const lzma_allocator *allocator))
{
+ assert(free_func != NULL);
+
if (tree->root != NULL)
index_tree_node_end(tree->root, allocator, free_func);
@@ -230,7 +229,6 @@ index_tree_end(index_tree *tree, lzma_allocator *allocator,
static void
index_tree_append(index_tree *tree, index_tree_node *node)
{
- uint32_t up;
node->parent = tree->rightmost;
node->left = NULL;
node->right = NULL;
@@ -259,10 +257,8 @@ index_tree_append(index_tree *tree, index_tree_node *node)
// and thus know the state of the tree just by looking at the node
// count. From the node count we can calculate how many steps to go
// up in the tree to find the rotation root.
- up = tree->count ^ (UINT32_C(1) << bsr32(tree->count));
+ uint32_t up = tree->count ^ (UINT32_C(1) << bsr32(tree->count));
if (up != 0) {
- index_tree_node *pivot;
-
// Locate the root node for the rotation.
up = ctz32(tree->count) + 2;
do {
@@ -270,7 +266,7 @@ index_tree_append(index_tree *tree, index_tree_node *node)
} while (--up > 0);
// Rotate left using node as the rotation root.
- pivot = node->right;
+ index_tree_node *pivot = node->right;
if (node->parent == NULL) {
tree->root = pivot;
@@ -342,8 +338,8 @@ index_tree_locate(const index_tree *tree, lzma_vli target)
/// Allocate and initialize a new Stream using the given base offsets.
static index_stream *
index_stream_init(lzma_vli compressed_base, lzma_vli uncompressed_base,
- lzma_vli stream_number, lzma_vli block_number_base,
- lzma_allocator *allocator)
+ uint32_t stream_number, lzma_vli block_number_base,
+ const lzma_allocator *allocator)
{
index_stream *s = lzma_alloc(sizeof(index_stream), allocator);
if (s == NULL)
@@ -371,16 +367,17 @@ index_stream_init(lzma_vli compressed_base, lzma_vli uncompressed_base,
/// Free the memory allocated for a Stream and its Record groups.
static void
-index_stream_end(void *node, lzma_allocator *allocator)
+index_stream_end(void *node, const lzma_allocator *allocator)
{
index_stream *s = node;
- index_tree_end(&s->groups, allocator, NULL);
+ index_tree_end(&s->groups, allocator, &lzma_free);
+ lzma_free(s, allocator);
return;
}
static lzma_index *
-index_init_plain(lzma_allocator *allocator)
+index_init_plain(const lzma_allocator *allocator)
{
lzma_index *i = lzma_alloc(sizeof(lzma_index), allocator);
if (i != NULL) {
@@ -398,15 +395,13 @@ index_init_plain(lzma_allocator *allocator)
extern LZMA_API(lzma_index *)
-lzma_index_init(lzma_allocator *allocator)
+lzma_index_init(const lzma_allocator *allocator)
{
- index_stream *s;
-
lzma_index *i = index_init_plain(allocator);
if (i == NULL)
return NULL;
- s = index_stream_init(0, 0, 1, 0, allocator);
+ index_stream *s = index_stream_init(0, 0, 1, 0, allocator);
if (s == NULL) {
lzma_free(i, allocator);
return NULL;
@@ -419,7 +414,7 @@ lzma_index_init(lzma_allocator *allocator)
extern LZMA_API(void)
-lzma_index_end(lzma_index *i, lzma_allocator *allocator)
+lzma_index_end(lzma_index *i, const lzma_allocator *allocator)
{
// NOTE: If you modify this function, check also the bottom
// of lzma_index_cat().
@@ -605,8 +600,6 @@ lzma_index_padding_size(const lzma_index *i)
extern LZMA_API(lzma_ret)
lzma_index_stream_flags(lzma_index *i, const lzma_stream_flags *stream_flags)
{
- index_stream *s;
-
if (i == NULL || stream_flags == NULL)
return LZMA_PROG_ERROR;
@@ -614,7 +607,7 @@ lzma_index_stream_flags(lzma_index *i, const lzma_stream_flags *stream_flags)
return_if_error(lzma_stream_flags_compare(
stream_flags, stream_flags));
- s = (index_stream *)(i->streams.rightmost);
+ index_stream *s = (index_stream *)(i->streams.rightmost);
s->stream_flags = *stream_flags;
return LZMA_OK;
@@ -624,17 +617,14 @@ lzma_index_stream_flags(lzma_index *i, const lzma_stream_flags *stream_flags)
extern LZMA_API(lzma_ret)
lzma_index_stream_padding(lzma_index *i, lzma_vli stream_padding)
{
- index_stream *s;
- lzma_vli old_stream_padding;
-
if (i == NULL || stream_padding > LZMA_VLI_MAX
|| (stream_padding & 3) != 0)
return LZMA_PROG_ERROR;
- s = (index_stream *)(i->streams.rightmost);
+ index_stream *s = (index_stream *)(i->streams.rightmost);
// Check that the new value won't make the file grow too big.
- old_stream_padding = s->stream_padding;
+ const lzma_vli old_stream_padding = s->stream_padding;
s->stream_padding = 0;
if (lzma_index_file_size(i) + stream_padding > LZMA_VLI_MAX) {
s->stream_padding = old_stream_padding;
@@ -647,29 +637,23 @@ lzma_index_stream_padding(lzma_index *i, lzma_vli stream_padding)
extern LZMA_API(lzma_ret)
-lzma_index_append(lzma_index *i, lzma_allocator *allocator,
+lzma_index_append(lzma_index *i, const lzma_allocator *allocator,
lzma_vli unpadded_size, lzma_vli uncompressed_size)
{
- index_stream *s;
- index_group *g;
- lzma_vli compressed_base;
- lzma_vli uncompressed_base;
- uint32_t index_list_size_add;
-
// Validate.
if (i == NULL || unpadded_size < UNPADDED_SIZE_MIN
|| unpadded_size > UNPADDED_SIZE_MAX
|| uncompressed_size > LZMA_VLI_MAX)
return LZMA_PROG_ERROR;
- s = (index_stream *)(i->streams.rightmost);
- g = (index_group *)(s->groups.rightmost);
+ index_stream *s = (index_stream *)(i->streams.rightmost);
+ index_group *g = (index_group *)(s->groups.rightmost);
- compressed_base = g == NULL ? 0
+ const lzma_vli compressed_base = g == NULL ? 0
: vli_ceil4(g->records[g->last].unpadded_sum);
- uncompressed_base = g == NULL ? 0
+ const lzma_vli uncompressed_base = g == NULL ? 0
: g->records[g->last].uncompressed_sum;
- index_list_size_add = lzma_vli_size(unpadded_size)
+ const uint32_t index_list_size_add = lzma_vli_size(unpadded_size)
+ lzma_vli_size(uncompressed_size);
// Check that the file size will stay within limits.
@@ -780,10 +764,9 @@ index_cat_helper(const index_cat_info *info, index_stream *this)
extern LZMA_API(lzma_ret)
-lzma_index_cat(lzma_index *LZMA_RESTRICT dest, lzma_index *LZMA_RESTRICT src,
- lzma_allocator *allocator)
+lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src,
+ const lzma_allocator *allocator)
{
- index_cat_info info;
const lzma_vli dest_file_size = lzma_index_file_size(dest);
// Check that we don't exceed the file size limits.
@@ -813,12 +796,10 @@ lzma_index_cat(lzma_index *LZMA_RESTRICT dest, lzma_index *LZMA_RESTRICT src,
index_stream *s = (index_stream *)(dest->streams.rightmost);
index_group *g = (index_group *)(s->groups.rightmost);
if (g != NULL && g->last + 1 < g->allocated) {
- index_group *newg;
-
assert(g->node.left == NULL);
assert(g->node.right == NULL);
- newg = lzma_alloc(sizeof(index_group)
+ index_group *newg = lzma_alloc(sizeof(index_group)
+ (g->last + 1)
* sizeof(index_record),
allocator);
@@ -848,17 +829,21 @@ lzma_index_cat(lzma_index *LZMA_RESTRICT dest, lzma_index *LZMA_RESTRICT src,
s->groups.rightmost = &newg->node;
lzma_free(g, allocator);
+
+ // NOTE: newg isn't leaked here because
+ // newg == (void *)&newg->node.
}
}
// Add all the Streams from src to dest. Update the base offsets
// of each Stream from src.
- info.uncompressed_size = dest->uncompressed_size;
- info.file_size = dest_file_size;
- info.stream_number_add = dest->streams.count;
- info.block_number_add = dest->record_count;
- info.streams = &dest->streams;
-
+ const index_cat_info info = {
+ .uncompressed_size = dest->uncompressed_size,
+ .file_size = dest_file_size,
+ .stream_number_add = dest->streams.count,
+ .block_number_add = dest->record_count,
+ .streams = &dest->streams,
+ };
index_cat_helper(&info, (index_stream *)(src->streams.root));
// Update info about all the combined Streams.
@@ -877,26 +862,18 @@ lzma_index_cat(lzma_index *LZMA_RESTRICT dest, lzma_index *LZMA_RESTRICT src,
/// Duplicate an index_stream.
static index_stream *
-index_dup_stream(const index_stream *src, lzma_allocator *allocator)
+index_dup_stream(const index_stream *src, const lzma_allocator *allocator)
{
- index_stream *dest;
- index_group *destg;
- index_group *srcg;
- size_t i = 0;
-
// Catch a somewhat theoretical integer overflow.
if (src->record_count > PREALLOC_MAX)
return NULL;
// Allocate and initialize a new Stream.
- dest = index_stream_init(src->node.compressed_base,
+ index_stream *dest = index_stream_init(src->node.compressed_base,
src->node.uncompressed_base, src->number,
src->block_number_base, allocator);
-
- // Return immediately if allocation failed or if there are
- // no groups to duplicate.
- if (dest == NULL || src->groups.leftmost == NULL)
- return dest;
+ if (dest == NULL)
+ return NULL;
// Copy the overall information.
dest->record_count = src->record_count;
@@ -904,10 +881,14 @@ index_dup_stream(const index_stream *src, lzma_allocator *allocator)
dest->stream_flags = src->stream_flags;
dest->stream_padding = src->stream_padding;
+ // Return if there are no groups to duplicate.
+ if (src->groups.leftmost == NULL)
+ return dest;
+
// Allocate memory for the Records. We put all the Records into
// a single group. It's simplest and also tends to make
// lzma_index_locate() a little bit faster with very big Indexes.
- destg = lzma_alloc(sizeof(index_group)
+ index_group *destg = lzma_alloc(sizeof(index_group)
+ src->record_count * sizeof(index_record),
allocator);
if (destg == NULL) {
@@ -923,7 +904,8 @@ index_dup_stream(const index_stream *src, lzma_allocator *allocator)
destg->last = src->record_count - 1;
// Go through all the groups in src and copy the Records into destg.
- srcg = (index_group *)(src->groups.leftmost);
+ const index_group *srcg = (const index_group *)(src->groups.leftmost);
+ size_t i = 0;
do {
memcpy(destg->records + i, srcg->records,
(srcg->last + 1) * sizeof(index_record));
@@ -941,11 +923,8 @@ index_dup_stream(const index_stream *src, lzma_allocator *allocator)
extern LZMA_API(lzma_index *)
-lzma_index_dup(const lzma_index *src, lzma_allocator *allocator)
+lzma_index_dup(const lzma_index *src, const lzma_allocator *allocator)
{
- index_stream *srcstream;
- index_stream *deststream;
-
// Allocate the base structure (no initial Stream).
lzma_index *dest = index_init_plain(allocator);
if (dest == NULL)
@@ -958,9 +937,11 @@ lzma_index_dup(const lzma_index *src, lzma_allocator *allocator)
dest->index_list_size = src->index_list_size;
// Copy the Streams and the groups in them.
- srcstream = (index_stream *)(src->streams.leftmost);
+ const index_stream *srcstream
+ = (const index_stream *)(src->streams.leftmost);
do {
- deststream = index_dup_stream(srcstream, allocator);
+ index_stream *deststream = index_dup_stream(
+ srcstream, allocator);
if (deststream == NULL) {
lzma_index_end(dest, allocator);
return NULL;
@@ -1031,6 +1012,8 @@ iter_set_info(lzma_index_iter *iter)
iter->internal[ITER_GROUP].p = NULL;
}
+ // NOTE: lzma_index_iter.stream.number is lzma_vli but we use uint32_t
+ // internally.
iter->stream.number = stream->number;
iter->stream.block_count = stream->record_count;
iter->stream.compressed_offset = stream->node.compressed_base;
@@ -1119,19 +1102,14 @@ lzma_index_iter_rewind(lzma_index_iter *iter)
extern LZMA_API(lzma_bool)
lzma_index_iter_next(lzma_index_iter *iter, lzma_index_iter_mode mode)
{
- const lzma_index *i;
- const index_stream *stream;
- const index_group *group;
- size_t record;
-
// Catch unsupported mode values.
if ((unsigned int)(mode) > LZMA_INDEX_ITER_NONEMPTY_BLOCK)
return true;
- i = iter->internal[ITER_INDEX].p;
- stream = iter->internal[ITER_STREAM].p;
- group = NULL;
- record = iter->internal[ITER_RECORD].s;
+ const lzma_index *i = iter->internal[ITER_INDEX].p;
+ const index_stream *stream = iter->internal[ITER_STREAM].p;
+ const index_group *group = NULL;
+ size_t record = iter->internal[ITER_RECORD].s;
// If we are being asked for the next Stream, leave group to NULL
// so that the rest of the this function thinks that this Stream
@@ -1231,10 +1209,6 @@ again:
extern LZMA_API(lzma_bool)
lzma_index_iter_locate(lzma_index_iter *iter, lzma_vli target)
{
- const index_stream *stream;
- const index_group *group;
- size_t left, right;
-
const lzma_index *i = iter->internal[ITER_INDEX].p;
// If the target is past the end of the file, return immediately.
@@ -1242,12 +1216,12 @@ lzma_index_iter_locate(lzma_index_iter *iter, lzma_vli target)
return true;
// Locate the Stream containing the target offset.
- stream = index_tree_locate(&i->streams, target);
+ const index_stream *stream = index_tree_locate(&i->streams, target);
assert(stream != NULL);
target -= stream->node.uncompressed_base;
// Locate the group containing the target offset.
- group = index_tree_locate(&stream->groups, target);
+ const index_group *group = index_tree_locate(&stream->groups, target);
assert(group != NULL);
// Use binary search to locate the exact Record. It is the first
@@ -1255,8 +1229,8 @@ lzma_index_iter_locate(lzma_index_iter *iter, lzma_vli target)
// This is because we want the rightmost Record that fullfills the
// search criterion. It is possible that there are empty Blocks;
// we don't want to return them.
- left = 0;
- right = group->last;
+ size_t left = 0;
+ size_t right = group->last;
while (left < right) {
const size_t pos = left + (right - left) / 2;
diff --git a/Utilities/cmliblzma/liblzma/common/index_decoder.c b/Utilities/cmliblzma/liblzma/common/index_decoder.c
index 943cfd5..cc07a1b 100644
--- a/Utilities/cmliblzma/liblzma/common/index_decoder.c
+++ b/Utilities/cmliblzma/liblzma/common/index_decoder.c
@@ -14,7 +14,7 @@
#include "check.h"
-struct lzma_coder_s {
+typedef struct {
enum {
SEQ_INDICATOR,
SEQ_COUNT,
@@ -50,18 +50,20 @@ struct lzma_coder_s {
/// CRC32 of the List of Records field
uint32_t crc32;
-};
+} lzma_index_coder;
static lzma_ret
-index_decode(lzma_coder *coder, lzma_allocator *allocator,
- const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
+index_decode(void *coder_ptr, const lzma_allocator *allocator,
+ const uint8_t *restrict in, size_t *restrict in_pos,
size_t in_size,
- uint8_t *LZMA_RESTRICT out lzma_attribute((__unused__)),
- size_t *LZMA_RESTRICT out_pos lzma_attribute((__unused__)),
+ uint8_t *restrict out lzma_attribute((__unused__)),
+ size_t *restrict out_pos lzma_attribute((__unused__)),
size_t out_size lzma_attribute((__unused__)),
lzma_action action lzma_attribute((__unused__)))
{
+ lzma_index_coder *coder = coder_ptr;
+
// Similar optimization as in index_encoder.c
const size_t in_start = *in_pos;
lzma_ret ret = LZMA_OK;
@@ -207,8 +209,9 @@ out:
static void
-index_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
+index_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
{
+ lzma_index_coder *coder = coder_ptr;
lzma_index_end(coder->index, allocator);
lzma_free(coder, allocator);
return;
@@ -216,9 +219,11 @@ index_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
static lzma_ret
-index_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
+index_decoder_memconfig(void *coder_ptr, uint64_t *memusage,
uint64_t *old_memlimit, uint64_t new_memlimit)
{
+ lzma_index_coder *coder = coder_ptr;
+
*memusage = lzma_index_memusage(1, coder->count);
*old_memlimit = coder->memlimit;
@@ -234,7 +239,7 @@ index_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
static lzma_ret
-index_decoder_reset(lzma_coder *coder, lzma_allocator *allocator,
+index_decoder_reset(lzma_index_coder *coder, const lzma_allocator *allocator,
lzma_index **i, uint64_t memlimit)
{
// Remember the pointer given by the application. We will set it
@@ -251,7 +256,7 @@ index_decoder_reset(lzma_coder *coder, lzma_allocator *allocator,
// Initialize the rest.
coder->sequence = SEQ_INDICATOR;
- coder->memlimit = memlimit;
+ coder->memlimit = my_max(1, memlimit);
coder->count = 0; // Needs to be initialized due to _memconfig().
coder->pos = 0;
coder->crc32 = 0;
@@ -261,35 +266,37 @@ index_decoder_reset(lzma_coder *coder, lzma_allocator *allocator,
static lzma_ret
-index_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+index_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
lzma_index **i, uint64_t memlimit)
{
lzma_next_coder_init(&index_decoder_init, next, allocator);
- if (i == NULL || memlimit == 0)
+ if (i == NULL)
return LZMA_PROG_ERROR;
- if (next->coder == NULL) {
- next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
- if (next->coder == NULL)
+ lzma_index_coder *coder = next->coder;
+ if (coder == NULL) {
+ coder = lzma_alloc(sizeof(lzma_index_coder), allocator);
+ if (coder == NULL)
return LZMA_MEM_ERROR;
+ next->coder = coder;
next->code = &index_decode;
next->end = &index_decoder_end;
next->memconfig = &index_decoder_memconfig;
- next->coder->index = NULL;
+ coder->index = NULL;
} else {
- lzma_index_end(next->coder->index, allocator);
+ lzma_index_end(coder->index, allocator);
}
- return index_decoder_reset(next->coder, allocator, i, memlimit);
+ return index_decoder_reset(coder, allocator, i, memlimit);
}
extern LZMA_API(lzma_ret)
lzma_index_decoder(lzma_stream *strm, lzma_index **i, uint64_t memlimit)
{
- lzma_next_strm_init2(index_decoder_init, strm, i, memlimit);
+ lzma_next_strm_init(index_decoder_init, strm, i, memlimit);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
@@ -299,27 +306,25 @@ lzma_index_decoder(lzma_stream *strm, lzma_index **i, uint64_t memlimit)
extern LZMA_API(lzma_ret)
-lzma_index_buffer_decode(
- lzma_index **i, uint64_t *memlimit, lzma_allocator *allocator,
+lzma_index_buffer_decode(lzma_index **i, uint64_t *memlimit,
+ const lzma_allocator *allocator,
const uint8_t *in, size_t *in_pos, size_t in_size)
{
- lzma_coder coder;
- lzma_ret ret;
-
- // Store the input start position so that we can restore it in case
- // of an error.
- const size_t in_start = *in_pos;
-
// Sanity checks
if (i == NULL || memlimit == NULL
|| in == NULL || in_pos == NULL || *in_pos > in_size)
return LZMA_PROG_ERROR;
// Initialize the decoder.
+ lzma_index_coder coder;
return_if_error(index_decoder_reset(&coder, allocator, i, *memlimit));
+ // Store the input start position so that we can restore it in case
+ // of an error.
+ const size_t in_start = *in_pos;
+
// Do the actual decoding.
- ret = index_decode(&coder, allocator, in, in_pos, in_size,
+ lzma_ret ret = index_decode(&coder, allocator, in, in_pos, in_size,
NULL, NULL, 0, LZMA_RUN);
if (ret == LZMA_STREAM_END) {
diff --git a/Utilities/cmliblzma/liblzma/common/index_encoder.c b/Utilities/cmliblzma/liblzma/common/index_encoder.c
index 194bf21..ac97d0c 100644
--- a/Utilities/cmliblzma/liblzma/common/index_encoder.c
+++ b/Utilities/cmliblzma/liblzma/common/index_encoder.c
@@ -15,7 +15,7 @@
#include "check.h"
-struct lzma_coder_s {
+typedef struct {
enum {
SEQ_INDICATOR,
SEQ_COUNT,
@@ -37,19 +37,21 @@ struct lzma_coder_s {
/// CRC32 of the List of Records field
uint32_t crc32;
-};
+} lzma_index_coder;
static lzma_ret
-index_encode(lzma_coder *coder,
- lzma_allocator *allocator lzma_attribute((__unused__)),
- const uint8_t *LZMA_RESTRICT in lzma_attribute((__unused__)),
- size_t *LZMA_RESTRICT in_pos lzma_attribute((__unused__)),
+index_encode(void *coder_ptr,
+ const lzma_allocator *allocator lzma_attribute((__unused__)),
+ const uint8_t *restrict in lzma_attribute((__unused__)),
+ size_t *restrict in_pos lzma_attribute((__unused__)),
size_t in_size lzma_attribute((__unused__)),
- uint8_t *LZMA_RESTRICT out, size_t *LZMA_RESTRICT out_pos,
+ uint8_t *restrict out, size_t *restrict out_pos,
size_t out_size,
lzma_action action lzma_attribute((__unused__)))
{
+ lzma_index_coder *coder = coder_ptr;
+
// Position where to start calculating CRC32. The idea is that we
// need to call lzma_crc32() only once per call to index_encode().
const size_t out_start = *out_pos;
@@ -159,7 +161,7 @@ out:
static void
-index_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
+index_encoder_end(void *coder, const lzma_allocator *allocator)
{
lzma_free(coder, allocator);
return;
@@ -167,7 +169,7 @@ index_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
static void
-index_encoder_reset(lzma_coder *coder, const lzma_index *i)
+index_encoder_reset(lzma_index_coder *coder, const lzma_index *i)
{
lzma_index_iter_init(&coder->iter, i);
@@ -181,7 +183,7 @@ index_encoder_reset(lzma_coder *coder, const lzma_index *i)
extern lzma_ret
-lzma_index_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_index_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_index *i)
{
lzma_next_coder_init(&lzma_index_encoder_init, next, allocator);
@@ -190,7 +192,7 @@ lzma_index_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
return LZMA_PROG_ERROR;
if (next->coder == NULL) {
- next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
+ next->coder = lzma_alloc(sizeof(lzma_index_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
@@ -207,7 +209,7 @@ lzma_index_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern LZMA_API(lzma_ret)
lzma_index_encoder(lzma_stream *strm, const lzma_index *i)
{
- lzma_next_strm_init1(lzma_index_encoder_init, strm, i);
+ lzma_next_strm_init(lzma_index_encoder_init, strm, i);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
@@ -220,10 +222,6 @@ extern LZMA_API(lzma_ret)
lzma_index_buffer_encode(const lzma_index *i,
uint8_t *out, size_t *out_pos, size_t out_size)
{
- lzma_coder coder;
- size_t out_start;
- lzma_ret ret;
-
// Validate the arguments.
if (i == NULL || out == NULL || out_pos == NULL || *out_pos > out_size)
return LZMA_PROG_ERROR;
@@ -234,12 +232,13 @@ lzma_index_buffer_encode(const lzma_index *i,
// The Index encoder needs just one small data structure so we can
// allocate it on stack.
+ lzma_index_coder coder;
index_encoder_reset(&coder, i);
// Do the actual encoding. This should never fail, but store
// the original *out_pos just in case.
- out_start = *out_pos;
- ret = index_encode(&coder, NULL, NULL, NULL, 0,
+ const size_t out_start = *out_pos;
+ lzma_ret ret = index_encode(&coder, NULL, NULL, NULL, 0,
out, out_pos, out_size, LZMA_RUN);
if (ret == LZMA_STREAM_END) {
diff --git a/Utilities/cmliblzma/liblzma/common/index_encoder.h b/Utilities/cmliblzma/liblzma/common/index_encoder.h
index a13c94d..4d55cd1 100644
--- a/Utilities/cmliblzma/liblzma/common/index_encoder.h
+++ b/Utilities/cmliblzma/liblzma/common/index_encoder.h
@@ -17,7 +17,7 @@
extern lzma_ret lzma_index_encoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_index *i);
+ const lzma_allocator *allocator, const lzma_index *i);
#endif
diff --git a/Utilities/cmliblzma/liblzma/common/index_hash.c b/Utilities/cmliblzma/liblzma/common/index_hash.c
index 0cf86b3..d7a0344 100644
--- a/Utilities/cmliblzma/liblzma/common/index_hash.c
+++ b/Utilities/cmliblzma/liblzma/common/index_hash.c
@@ -70,7 +70,8 @@ struct lzma_index_hash_s {
extern LZMA_API(lzma_index_hash *)
-lzma_index_hash_init(lzma_index_hash *index_hash, lzma_allocator *allocator)
+lzma_index_hash_init(lzma_index_hash *index_hash,
+ const lzma_allocator *allocator)
{
if (index_hash == NULL) {
index_hash = lzma_alloc(sizeof(lzma_index_hash), allocator);
@@ -101,7 +102,8 @@ lzma_index_hash_init(lzma_index_hash *index_hash, lzma_allocator *allocator)
extern LZMA_API(void)
-lzma_index_hash_end(lzma_index_hash *index_hash, lzma_allocator *allocator)
+lzma_index_hash_end(lzma_index_hash *index_hash,
+ const lzma_allocator *allocator)
{
lzma_free(index_hash, allocator);
return;
@@ -124,14 +126,13 @@ static lzma_ret
hash_append(lzma_index_hash_info *info, lzma_vli unpadded_size,
lzma_vli uncompressed_size)
{
- const lzma_vli sizes[2] = { unpadded_size, uncompressed_size };
-
info->blocks_size += vli_ceil4(unpadded_size);
info->uncompressed_size += uncompressed_size;
info->index_list_size += lzma_vli_size(unpadded_size)
+ lzma_vli_size(uncompressed_size);
++info->count;
+ const lzma_vli sizes[2] = { unpadded_size, uncompressed_size };
lzma_check_update(&info->check, LZMA_CHECK_BEST,
(const uint8_t *)(sizes), sizeof(sizes));
@@ -174,9 +175,6 @@ extern LZMA_API(lzma_ret)
lzma_index_hash_decode(lzma_index_hash *index_hash, const uint8_t *in,
size_t *in_pos, size_t in_size)
{
- size_t in_start;
- lzma_ret ret;
-
// Catch zero input buffer here, because in contrast to Index encoder
// and decoder functions, applications call this function directly
// instead of via lzma_code(), which does the buffer checking.
@@ -186,8 +184,8 @@ lzma_index_hash_decode(lzma_index_hash *index_hash, const uint8_t *in,
// NOTE: This function has many similarities to index_encode() and
// index_decode() functions found from index_encoder.c and
// index_decoder.c. See the comments especially in index_encoder.c.
- in_start = *in_pos;
- ret = LZMA_OK;
+ const size_t in_start = *in_pos;
+ lzma_ret ret = LZMA_OK;
while (*in_pos < in_size)
switch (index_hash->sequence) {
diff --git a/Utilities/cmliblzma/liblzma/common/memcmplen.h b/Utilities/cmliblzma/liblzma/common/memcmplen.h
new file mode 100644
index 0000000..c1efc9e
--- /dev/null
+++ b/Utilities/cmliblzma/liblzma/common/memcmplen.h
@@ -0,0 +1,175 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file memcmplen.h
+/// \brief Optimized comparison of two buffers
+//
+// Author: Lasse Collin
+//
+// This file has been put into the public domain.
+// You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef LZMA_MEMCMPLEN_H
+#define LZMA_MEMCMPLEN_H
+
+#include "common.h"
+
+#ifdef HAVE_IMMINTRIN_H
+# include <immintrin.h>
+#endif
+
+
+/// Find out how many equal bytes the two buffers have.
+///
+/// \param buf1 First buffer
+/// \param buf2 Second buffer
+/// \param len How many bytes have already been compared and will
+/// be assumed to match
+/// \param limit How many bytes to compare at most, including the
+/// already-compared bytes. This must be significantly
+/// smaller than UINT32_MAX to avoid integer overflows.
+/// Up to LZMA_MEMCMPLEN_EXTRA bytes may be read past
+/// the specified limit from both buf1 and buf2.
+///
+/// \return Number of equal bytes in the buffers is returned.
+/// This is always at least len and at most limit.
+///
+/// \note LZMA_MEMCMPLEN_EXTRA defines how many extra bytes may be read.
+/// It's rounded up to 2^n. This extra amount needs to be
+/// allocated in the buffers being used. It needs to be
+/// initialized too to keep Valgrind quiet.
+static inline uint32_t lzma_attribute((__always_inline__))
+lzma_memcmplen(const uint8_t *buf1, const uint8_t *buf2,
+ uint32_t len, uint32_t limit)
+{
+ assert(len <= limit);
+ assert(limit <= UINT32_MAX / 2);
+
+#if defined(TUKLIB_FAST_UNALIGNED_ACCESS) \
+ && ((TUKLIB_GNUC_REQ(3, 4) && defined(__x86_64__)) \
+ || (defined(__INTEL_COMPILER) && defined(__x86_64__)) \
+ || (defined(__INTEL_COMPILER) && defined(_M_X64)) \
+ || (defined(_MSC_VER) && defined(_M_X64)))
+ // NOTE: This will use 64-bit unaligned access which
+ // TUKLIB_FAST_UNALIGNED_ACCESS wasn't meant to permit, but
+ // it's convenient here at least as long as it's x86-64 only.
+ //
+ // I keep this x86-64 only for now since that's where I know this
+ // to be a good method. This may be fine on other 64-bit CPUs too.
+ // On big endian one should use xor instead of subtraction and switch
+ // to __builtin_clzll().
+#define LZMA_MEMCMPLEN_EXTRA 8
+ while (len < limit) {
+ const uint64_t x = *(const uint64_t *)(buf1 + len)
+ - *(const uint64_t *)(buf2 + len);
+ if (x != 0) {
+# if defined(_M_X64) // MSVC or Intel C compiler on Windows
+ unsigned long tmp;
+ _BitScanForward64(&tmp, x);
+ len += (uint32_t)tmp >> 3;
+# else // GCC, clang, or Intel C compiler
+ len += (uint32_t)__builtin_ctzll(x) >> 3;
+# endif
+ return my_min(len, limit);
+ }
+
+ len += 8;
+ }
+
+ return limit;
+
+#elif defined(TUKLIB_FAST_UNALIGNED_ACCESS) \
+ && defined(HAVE__MM_MOVEMASK_EPI8) \
+ && ((defined(__GNUC__) && defined(__SSE2_MATH__)) \
+ || (defined(__INTEL_COMPILER) && defined(__SSE2__)) \
+ || (defined(_MSC_VER) && defined(_M_IX86_FP) \
+ && _M_IX86_FP >= 2))
+ // NOTE: Like above, this will use 128-bit unaligned access which
+ // TUKLIB_FAST_UNALIGNED_ACCESS wasn't meant to permit.
+ //
+ // SSE2 version for 32-bit and 64-bit x86. On x86-64 the above
+ // version is sometimes significantly faster and sometimes
+ // slightly slower than this SSE2 version, so this SSE2
+ // version isn't used on x86-64.
+# define LZMA_MEMCMPLEN_EXTRA 16
+ while (len < limit) {
+ const uint32_t x = 0xFFFF ^ _mm_movemask_epi8(_mm_cmpeq_epi8(
+ _mm_loadu_si128((const __m128i *)(buf1 + len)),
+ _mm_loadu_si128((const __m128i *)(buf2 + len))));
+
+ if (x != 0) {
+# if defined(__INTEL_COMPILER)
+ len += _bit_scan_forward(x);
+# elif defined(_MSC_VER)
+ unsigned long tmp;
+ _BitScanForward(&tmp, x);
+ len += tmp;
+# else
+ len += __builtin_ctz(x);
+# endif
+ return my_min(len, limit);
+ }
+
+ len += 16;
+ }
+
+ return limit;
+
+#elif defined(TUKLIB_FAST_UNALIGNED_ACCESS) && !defined(WORDS_BIGENDIAN)
+ // Generic 32-bit little endian method
+# define LZMA_MEMCMPLEN_EXTRA 4
+ while (len < limit) {
+ uint32_t x = *(const uint32_t *)(buf1 + len)
+ - *(const uint32_t *)(buf2 + len);
+ if (x != 0) {
+ if ((x & 0xFFFF) == 0) {
+ len += 2;
+ x >>= 16;
+ }
+
+ if ((x & 0xFF) == 0)
+ ++len;
+
+ return my_min(len, limit);
+ }
+
+ len += 4;
+ }
+
+ return limit;
+
+#elif defined(TUKLIB_FAST_UNALIGNED_ACCESS) && defined(WORDS_BIGENDIAN)
+ // Generic 32-bit big endian method
+# define LZMA_MEMCMPLEN_EXTRA 4
+ while (len < limit) {
+ uint32_t x = *(const uint32_t *)(buf1 + len)
+ ^ *(const uint32_t *)(buf2 + len);
+ if (x != 0) {
+ if ((x & 0xFFFF0000) == 0) {
+ len += 2;
+ x <<= 16;
+ }
+
+ if ((x & 0xFF000000) == 0)
+ ++len;
+
+ return my_min(len, limit);
+ }
+
+ len += 4;
+ }
+
+ return limit;
+
+#else
+ // Simple portable version that doesn't use unaligned access.
+# define LZMA_MEMCMPLEN_EXTRA 0
+ while (len < limit && buf1[len] == buf2[len])
+ ++len;
+
+ return len;
+#endif
+}
+
+#endif
diff --git a/Utilities/cmliblzma/liblzma/common/outqueue.c b/Utilities/cmliblzma/liblzma/common/outqueue.c
new file mode 100644
index 0000000..2dc8a38
--- /dev/null
+++ b/Utilities/cmliblzma/liblzma/common/outqueue.c
@@ -0,0 +1,184 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file outqueue.c
+/// \brief Output queue handling in multithreaded coding
+//
+// Author: Lasse Collin
+//
+// This file has been put into the public domain.
+// You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "outqueue.h"
+
+
+/// This is to ease integer overflow checking: We may allocate up to
+/// 2 * LZMA_THREADS_MAX buffers and we need some extra memory for other
+/// data structures (that's the second /2).
+#define BUF_SIZE_MAX (UINT64_MAX / LZMA_THREADS_MAX / 2 / 2)
+
+
+static lzma_ret
+get_options(uint64_t *bufs_alloc_size, uint32_t *bufs_count,
+ uint64_t buf_size_max, uint32_t threads)
+{
+ if (threads > LZMA_THREADS_MAX || buf_size_max > BUF_SIZE_MAX)
+ return LZMA_OPTIONS_ERROR;
+
+ // The number of buffers is twice the number of threads.
+ // This wastes RAM but keeps the threads busy when buffers
+ // finish out of order.
+ //
+ // NOTE: If this is changed, update BUF_SIZE_MAX too.
+ *bufs_count = threads * 2;
+ *bufs_alloc_size = *bufs_count * buf_size_max;
+
+ return LZMA_OK;
+}
+
+
+extern uint64_t
+lzma_outq_memusage(uint64_t buf_size_max, uint32_t threads)
+{
+ uint64_t bufs_alloc_size;
+ uint32_t bufs_count;
+
+ if (get_options(&bufs_alloc_size, &bufs_count, buf_size_max, threads)
+ != LZMA_OK)
+ return UINT64_MAX;
+
+ return sizeof(lzma_outq) + bufs_count * sizeof(lzma_outbuf)
+ + bufs_alloc_size;
+}
+
+
+extern lzma_ret
+lzma_outq_init(lzma_outq *outq, const lzma_allocator *allocator,
+ uint64_t buf_size_max, uint32_t threads)
+{
+ uint64_t bufs_alloc_size;
+ uint32_t bufs_count;
+
+ // Set bufs_count and bufs_alloc_size.
+ return_if_error(get_options(&bufs_alloc_size, &bufs_count,
+ buf_size_max, threads));
+
+ // Allocate memory if needed.
+ if (outq->buf_size_max != buf_size_max
+ || outq->bufs_allocated != bufs_count) {
+ lzma_outq_end(outq, allocator);
+
+#if SIZE_MAX < UINT64_MAX
+ if (bufs_alloc_size > SIZE_MAX)
+ return LZMA_MEM_ERROR;
+#endif
+
+ outq->bufs = lzma_alloc(bufs_count * sizeof(lzma_outbuf),
+ allocator);
+ outq->bufs_mem = lzma_alloc((size_t)(bufs_alloc_size),
+ allocator);
+
+ if (outq->bufs == NULL || outq->bufs_mem == NULL) {
+ lzma_outq_end(outq, allocator);
+ return LZMA_MEM_ERROR;
+ }
+ }
+
+ // Initialize the rest of the main structure. Initialization of
+ // outq->bufs[] is done when they are actually needed.
+ outq->buf_size_max = (size_t)(buf_size_max);
+ outq->bufs_allocated = bufs_count;
+ outq->bufs_pos = 0;
+ outq->bufs_used = 0;
+ outq->read_pos = 0;
+
+ return LZMA_OK;
+}
+
+
+extern void
+lzma_outq_end(lzma_outq *outq, const lzma_allocator *allocator)
+{
+ lzma_free(outq->bufs, allocator);
+ outq->bufs = NULL;
+
+ lzma_free(outq->bufs_mem, allocator);
+ outq->bufs_mem = NULL;
+
+ return;
+}
+
+
+extern lzma_outbuf *
+lzma_outq_get_buf(lzma_outq *outq)
+{
+ // Caller must have checked it with lzma_outq_has_buf().
+ assert(outq->bufs_used < outq->bufs_allocated);
+
+ // Initialize the new buffer.
+ lzma_outbuf *buf = &outq->bufs[outq->bufs_pos];
+ buf->buf = outq->bufs_mem + outq->bufs_pos * outq->buf_size_max;
+ buf->size = 0;
+ buf->finished = false;
+
+ // Update the queue state.
+ if (++outq->bufs_pos == outq->bufs_allocated)
+ outq->bufs_pos = 0;
+
+ ++outq->bufs_used;
+
+ return buf;
+}
+
+
+extern bool
+lzma_outq_is_readable(const lzma_outq *outq)
+{
+ uint32_t i = outq->bufs_pos - outq->bufs_used;
+ if (outq->bufs_pos < outq->bufs_used)
+ i += outq->bufs_allocated;
+
+ return outq->bufs[i].finished;
+}
+
+
+extern lzma_ret
+lzma_outq_read(lzma_outq *restrict outq, uint8_t *restrict out,
+ size_t *restrict out_pos, size_t out_size,
+ lzma_vli *restrict unpadded_size,
+ lzma_vli *restrict uncompressed_size)
+{
+ // There must be at least one buffer from which to read.
+ if (outq->bufs_used == 0)
+ return LZMA_OK;
+
+ // Get the buffer.
+ uint32_t i = outq->bufs_pos - outq->bufs_used;
+ if (outq->bufs_pos < outq->bufs_used)
+ i += outq->bufs_allocated;
+
+ lzma_outbuf *buf = &outq->bufs[i];
+
+ // If it isn't finished yet, we cannot read from it.
+ if (!buf->finished)
+ return LZMA_OK;
+
+ // Copy from the buffer to output.
+ lzma_bufcpy(buf->buf, &outq->read_pos, buf->size,
+ out, out_pos, out_size);
+
+ // Return if we didn't get all the data from the buffer.
+ if (outq->read_pos < buf->size)
+ return LZMA_OK;
+
+ // The buffer was finished. Tell the caller its size information.
+ *unpadded_size = buf->unpadded_size;
+ *uncompressed_size = buf->uncompressed_size;
+
+ // Free this buffer for further use.
+ --outq->bufs_used;
+ outq->read_pos = 0;
+
+ return LZMA_STREAM_END;
+}
diff --git a/Utilities/cmliblzma/liblzma/common/outqueue.h b/Utilities/cmliblzma/liblzma/common/outqueue.h
new file mode 100644
index 0000000..079634d
--- /dev/null
+++ b/Utilities/cmliblzma/liblzma/common/outqueue.h
@@ -0,0 +1,156 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file outqueue.h
+/// \brief Output queue handling in multithreaded coding
+//
+// Author: Lasse Collin
+//
+// This file has been put into the public domain.
+// You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "common.h"
+
+
+/// Output buffer for a single thread
+typedef struct {
+ /// Pointer to the output buffer of lzma_outq.buf_size_max bytes
+ uint8_t *buf;
+
+ /// Amount of data written to buf
+ size_t size;
+
+ /// Additional size information
+ lzma_vli unpadded_size;
+ lzma_vli uncompressed_size;
+
+ /// True when no more data will be written into this buffer.
+ ///
+ /// \note This is read by another thread and thus access
+ /// to this variable needs a mutex.
+ bool finished;
+
+} lzma_outbuf;
+
+
+typedef struct {
+ /// Array of buffers that are used cyclically.
+ lzma_outbuf *bufs;
+
+ /// Memory allocated for all the buffers
+ uint8_t *bufs_mem;
+
+ /// Amount of buffer space available in each buffer
+ size_t buf_size_max;
+
+ /// Number of buffers allocated
+ uint32_t bufs_allocated;
+
+ /// Position in the bufs array. The next buffer to be taken
+ /// into use is bufs[bufs_pos].
+ uint32_t bufs_pos;
+
+ /// Number of buffers in use
+ uint32_t bufs_used;
+
+ /// Position in the buffer in lzma_outq_read()
+ size_t read_pos;
+
+} lzma_outq;
+
+
+/**
+ * \brief Calculate the memory usage of an output queue
+ *
+ * \return Approximate memory usage in bytes or UINT64_MAX on error.
+ */
+extern uint64_t lzma_outq_memusage(uint64_t buf_size_max, uint32_t threads);
+
+
+/// \brief Initialize an output queue
+///
+/// \param outq Pointer to an output queue. Before calling
+/// this function the first time, *outq should
+/// have been zeroed with memzero() so that this
+/// function knows that there are no previous
+/// allocations to free.
+/// \param allocator Pointer to allocator or NULL
+/// \param buf_size_max Maximum amount of data that a single buffer
+/// in the queue may need to store.
+/// \param threads Number of buffers that may be in use
+/// concurrently. Note that more than this number
+/// of buffers will actually get allocated to
+/// improve performance when buffers finish
+/// out of order.
+///
+/// \return - LZMA_OK
+/// - LZMA_MEM_ERROR
+///
+extern lzma_ret lzma_outq_init(
+ lzma_outq *outq, const lzma_allocator *allocator,
+ uint64_t buf_size_max, uint32_t threads);
+
+
+/// \brief Free the memory associated with the output queue
+extern void lzma_outq_end(lzma_outq *outq, const lzma_allocator *allocator);
+
+
+/// \brief Get a new buffer
+///
+/// lzma_outq_has_buf() must be used to check that there is a buffer
+/// available before calling lzma_outq_get_buf().
+///
+extern lzma_outbuf *lzma_outq_get_buf(lzma_outq *outq);
+
+
+/// \brief Test if there is data ready to be read
+///
+/// Call to this function must be protected with the same mutex that
+/// is used to protect lzma_outbuf.finished.
+///
+extern bool lzma_outq_is_readable(const lzma_outq *outq);
+
+
+/// \brief Read finished data
+///
+/// \param outq Pointer to an output queue
+/// \param out Beginning of the output buffer
+/// \param out_pos The next byte will be written to
+/// out[*out_pos].
+/// \param out_size Size of the out buffer; the first byte into
+/// which no data is written to is out[out_size].
+/// \param unpadded_size Unpadded Size from the Block encoder
+/// \param uncompressed_size Uncompressed Size from the Block encoder
+///
+/// \return - LZMA: All OK. Either no data was available or the buffer
+/// being read didn't become empty yet.
+/// - LZMA_STREAM_END: The buffer being read was finished.
+/// *unpadded_size and *uncompressed_size were set.
+///
+/// \note This reads lzma_outbuf.finished variables and thus call
+/// to this function needs to be protected with a mutex.
+///
+extern lzma_ret lzma_outq_read(lzma_outq *restrict outq,
+ uint8_t *restrict out, size_t *restrict out_pos,
+ size_t out_size, lzma_vli *restrict unpadded_size,
+ lzma_vli *restrict uncompressed_size);
+
+
+/// \brief Test if there is at least one buffer free
+///
+/// This must be used before getting a new buffer with lzma_outq_get_buf().
+///
+static inline bool
+lzma_outq_has_buf(const lzma_outq *outq)
+{
+ return outq->bufs_used < outq->bufs_allocated;
+}
+
+
+/// \brief Test if the queue is completely empty
+static inline bool
+lzma_outq_is_empty(const lzma_outq *outq)
+{
+ return outq->bufs_used == 0;
+}
diff --git a/Utilities/cmliblzma/liblzma/common/stream_buffer_decoder.c b/Utilities/cmliblzma/liblzma/common/stream_buffer_decoder.c
index 9e2e1da..b9745b5 100644
--- a/Utilities/cmliblzma/liblzma/common/stream_buffer_decoder.c
+++ b/Utilities/cmliblzma/liblzma/common/stream_buffer_decoder.c
@@ -15,13 +15,10 @@
extern LZMA_API(lzma_ret)
lzma_stream_buffer_decode(uint64_t *memlimit, uint32_t flags,
- lzma_allocator *allocator,
+ const lzma_allocator *allocator,
const uint8_t *in, size_t *in_pos, size_t in_size,
uint8_t *out, size_t *out_pos, size_t out_size)
{
- lzma_next_coder stream_decoder = LZMA_NEXT_CODER_INIT;
- lzma_ret ret;
-
// Sanity checks
if (in_pos == NULL || (in == NULL && *in_pos != in_size)
|| *in_pos > in_size || out_pos == NULL
@@ -36,7 +33,8 @@ lzma_stream_buffer_decode(uint64_t *memlimit, uint32_t flags,
// Initialize the Stream decoder.
// TODO: We need something to tell the decoder that it can use the
// output buffer as workspace, and thus save significant amount of RAM.
- ret = lzma_stream_decoder_init(
+ lzma_next_coder stream_decoder = LZMA_NEXT_CODER_INIT;
+ lzma_ret ret = lzma_stream_decoder_init(
&stream_decoder, allocator, *memlimit, flags);
if (ret == LZMA_OK) {
diff --git a/Utilities/cmliblzma/liblzma/common/stream_buffer_encoder.c b/Utilities/cmliblzma/liblzma/common/stream_buffer_encoder.c
index 8bca87f..af49554 100644
--- a/Utilities/cmliblzma/liblzma/common/stream_buffer_encoder.c
+++ b/Utilities/cmliblzma/liblzma/common/stream_buffer_encoder.c
@@ -42,13 +42,10 @@ lzma_stream_buffer_bound(size_t uncompressed_size)
extern LZMA_API(lzma_ret)
lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check,
- lzma_allocator *allocator, const uint8_t *in, size_t in_size,
+ const lzma_allocator *allocator,
+ const uint8_t *in, size_t in_size,
uint8_t *out, size_t *out_pos_ptr, size_t out_size)
{
- lzma_stream_flags stream_flags = { 0 };
- lzma_block block = { 0 };
- size_t out_pos;
-
// Sanity checks
if (filters == NULL || (unsigned int)(check) > LZMA_CHECK_ID_MAX
|| (in == NULL && in_size != 0) || out == NULL
@@ -65,7 +62,7 @@ lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check,
// Use a local copy. We update *out_pos_ptr only if everything
// succeeds.
- out_pos = *out_pos_ptr;
+ size_t out_pos = *out_pos_ptr;
// Check that there's enough space for both Stream Header and
// Stream Footer.
@@ -77,7 +74,10 @@ lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check,
out_size -= LZMA_STREAM_HEADER_SIZE;
// Encode the Stream Header.
- stream_flags.check = check;
+ lzma_stream_flags stream_flags = {
+ .version = 0,
+ .check = check,
+ };
if (lzma_stream_header_encode(&stream_flags, out + out_pos)
!= LZMA_OK)
@@ -86,8 +86,11 @@ lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check,
out_pos += LZMA_STREAM_HEADER_SIZE;
// Encode a Block but only if there is at least one byte of input.
- block.check = check;
- block.filters = filters;
+ lzma_block block = {
+ .version = 0,
+ .check = check,
+ .filters = filters,
+ };
if (in_size > 0)
return_if_error(lzma_block_buffer_encode(&block, allocator,
@@ -95,8 +98,6 @@ lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check,
// Index
{
- lzma_ret ret;
-
// Create an Index. It will have one Record if there was
// at least one byte of input to encode. Otherwise the
// Index will be empty.
@@ -104,7 +105,7 @@ lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check,
if (i == NULL)
return LZMA_MEM_ERROR;
- ret = LZMA_OK;
+ lzma_ret ret = LZMA_OK;
if (in_size > 0)
ret = lzma_index_append(i, allocator,
diff --git a/Utilities/cmliblzma/liblzma/common/stream_decoder.c b/Utilities/cmliblzma/liblzma/common/stream_decoder.c
index 5e9a220..fdd8ff2 100644
--- a/Utilities/cmliblzma/liblzma/common/stream_decoder.c
+++ b/Utilities/cmliblzma/liblzma/common/stream_decoder.c
@@ -14,7 +14,7 @@
#include "block_decoder.h"
-struct lzma_coder_s {
+typedef struct {
enum {
SEQ_STREAM_HEADER,
SEQ_BLOCK_HEADER,
@@ -57,6 +57,10 @@ struct lzma_coder_s {
/// If true, LZMA_GET_CHECK is returned after decoding Stream Header.
bool tell_any_check;
+ /// If true, we will tell the Block decoder to skip calculating
+ /// and verifying the integrity check.
+ bool ignore_check;
+
/// If true, we will decode concatenated Streams that possibly have
/// Stream Padding between or after them. LZMA_STREAM_END is returned
/// once the application isn't giving us any new input, and we aren't
@@ -76,11 +80,11 @@ struct lzma_coder_s {
/// Buffer to hold Stream Header, Block Header, and Stream Footer.
/// Block Header has biggest maximum size.
uint8_t buffer[LZMA_BLOCK_HEADER_SIZE_MAX];
-};
+} lzma_stream_coder;
static lzma_ret
-stream_decoder_reset(lzma_coder *coder, lzma_allocator *allocator)
+stream_decoder_reset(lzma_stream_coder *coder, const lzma_allocator *allocator)
{
// Initialize the Index hash used to verify the Index.
coder->index_hash = lzma_index_hash_init(coder->index_hash, allocator);
@@ -96,18 +100,18 @@ stream_decoder_reset(lzma_coder *coder, lzma_allocator *allocator)
static lzma_ret
-stream_decode(lzma_coder *coder, lzma_allocator *allocator,
- const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
- size_t in_size, uint8_t *LZMA_RESTRICT out,
- size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action)
+stream_decode(void *coder_ptr, const lzma_allocator *allocator,
+ const uint8_t *restrict in, size_t *restrict in_pos,
+ size_t in_size, uint8_t *restrict out,
+ size_t *restrict out_pos, size_t out_size, lzma_action action)
{
+ lzma_stream_coder *coder = coder_ptr;
+
// When decoding the actual Block, it may be able to produce more
// output even if we don't give it any new input.
while (true)
switch (coder->sequence) {
case SEQ_STREAM_HEADER: {
- lzma_ret ret;
-
// Copy the Stream Header to the internal buffer.
lzma_bufcpy(in, in_pos, in_size, coder->buffer, &coder->pos,
LZMA_STREAM_HEADER_SIZE);
@@ -119,7 +123,7 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator,
coder->pos = 0;
// Decode the Stream Header.
- ret = lzma_stream_header_decode(
+ const lzma_ret ret = lzma_stream_header_decode(
&coder->stream_flags, coder->buffer);
if (ret != LZMA_OK)
return ret == LZMA_FORMAT_ERROR && !coder->first_stream
@@ -156,11 +160,6 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator,
// Fall through
case SEQ_BLOCK_HEADER: {
- lzma_filter filters[LZMA_FILTERS_MAX + 1];
- uint64_t memusage;
- lzma_ret ret;
- size_t i;
-
if (*in_pos >= in_size)
return LZMA_OK;
@@ -189,20 +188,28 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator,
coder->pos = 0;
- // Version 0 is currently the only possible version.
- coder->block_options.version = 0;
+ // Version 1 is needed to support the .ignore_check option.
+ coder->block_options.version = 1;
// Set up a buffer to hold the filter chain. Block Header
// decoder will initialize all members of this array so
// we don't need to do it here.
+ lzma_filter filters[LZMA_FILTERS_MAX + 1];
coder->block_options.filters = filters;
// Decode the Block Header.
return_if_error(lzma_block_header_decode(&coder->block_options,
allocator, coder->buffer));
+ // If LZMA_IGNORE_CHECK was used, this flag needs to be set.
+ // It has to be set after lzma_block_header_decode() because
+ // it always resets this to false.
+ coder->block_options.ignore_check = coder->ignore_check;
+
// Check the memory usage limit.
- memusage = lzma_raw_decoder_memusage(filters);
+ const uint64_t memusage = lzma_raw_decoder_memusage(filters);
+ lzma_ret ret;
+
if (memusage == UINT64_MAX) {
// One or more unknown Filter IDs.
ret = LZMA_OPTIONS_ERROR;
@@ -228,7 +235,7 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator,
// Free the allocated filter options since they are needed
// only to initialize the Block decoder.
- for (i = 0; i < LZMA_FILTERS_MAX; ++i)
+ for (size_t i = 0; i < LZMA_FILTERS_MAX; ++i)
lzma_free(filters[i].options, allocator);
coder->block_options.filters = NULL;
@@ -264,8 +271,6 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator,
}
case SEQ_INDEX: {
- lzma_ret ret;
-
// If we don't have any input, don't call
// lzma_index_hash_decode() since it would return
// LZMA_BUF_ERROR, which we must not do here.
@@ -274,7 +279,7 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator,
// Decode the Index and compare it to the hash calculated
// from the sizes of the Blocks (if any).
- ret = lzma_index_hash_decode(coder->index_hash,
+ const lzma_ret ret = lzma_index_hash_decode(coder->index_hash,
in, in_pos, in_size);
if (ret != LZMA_STREAM_END)
return ret;
@@ -285,9 +290,6 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator,
// Fall through
case SEQ_STREAM_FOOTER: {
- lzma_stream_flags footer_flags;
- lzma_ret ret;
-
// Copy the Stream Footer to the internal buffer.
lzma_bufcpy(in, in_pos, in_size, coder->buffer, &coder->pos,
LZMA_STREAM_HEADER_SIZE);
@@ -301,7 +303,8 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator,
// Decode the Stream Footer. The decoder gives
// LZMA_FORMAT_ERROR if the magic bytes don't match,
// so convert that return code to LZMA_DATA_ERROR.
- ret = lzma_stream_footer_decode(
+ lzma_stream_flags footer_flags;
+ const lzma_ret ret = lzma_stream_footer_decode(
&footer_flags, coder->buffer);
if (ret != LZMA_OK)
return ret == LZMA_FORMAT_ERROR
@@ -374,8 +377,9 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator,
static void
-stream_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
+stream_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
{
+ lzma_stream_coder *coder = coder_ptr;
lzma_next_end(&coder->block_decoder, allocator);
lzma_index_hash_end(coder->index_hash, allocator);
lzma_free(coder, allocator);
@@ -384,16 +388,19 @@ stream_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
static lzma_check
-stream_decoder_get_check(const lzma_coder *coder)
+stream_decoder_get_check(const void *coder_ptr)
{
+ const lzma_stream_coder *coder = coder_ptr;
return coder->stream_flags.check;
}
static lzma_ret
-stream_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
+stream_decoder_memconfig(void *coder_ptr, uint64_t *memusage,
uint64_t *old_memlimit, uint64_t new_memlimit)
{
+ lzma_stream_coder *coder = coder_ptr;
+
*memusage = coder->memusage;
*old_memlimit = coder->memlimit;
@@ -409,48 +416,49 @@ stream_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
extern lzma_ret
-lzma_stream_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_stream_decoder_init(
+ lzma_next_coder *next, const lzma_allocator *allocator,
uint64_t memlimit, uint32_t flags)
{
lzma_next_coder_init(&lzma_stream_decoder_init, next, allocator);
- if (memlimit == 0)
- return LZMA_PROG_ERROR;
-
if (flags & ~LZMA_SUPPORTED_FLAGS)
return LZMA_OPTIONS_ERROR;
- if (next->coder == NULL) {
- next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
- if (next->coder == NULL)
+ lzma_stream_coder *coder = next->coder;
+ if (coder == NULL) {
+ coder = lzma_alloc(sizeof(lzma_stream_coder), allocator);
+ if (coder == NULL)
return LZMA_MEM_ERROR;
+ next->coder = coder;
next->code = &stream_decode;
next->end = &stream_decoder_end;
next->get_check = &stream_decoder_get_check;
next->memconfig = &stream_decoder_memconfig;
- next->coder->block_decoder = LZMA_NEXT_CODER_INIT;
- next->coder->index_hash = NULL;
+ coder->block_decoder = LZMA_NEXT_CODER_INIT;
+ coder->index_hash = NULL;
}
- next->coder->memlimit = memlimit;
- next->coder->memusage = LZMA_MEMUSAGE_BASE;
- next->coder->tell_no_check = (flags & LZMA_TELL_NO_CHECK) != 0;
- next->coder->tell_unsupported_check
+ coder->memlimit = my_max(1, memlimit);
+ coder->memusage = LZMA_MEMUSAGE_BASE;
+ coder->tell_no_check = (flags & LZMA_TELL_NO_CHECK) != 0;
+ coder->tell_unsupported_check
= (flags & LZMA_TELL_UNSUPPORTED_CHECK) != 0;
- next->coder->tell_any_check = (flags & LZMA_TELL_ANY_CHECK) != 0;
- next->coder->concatenated = (flags & LZMA_CONCATENATED) != 0;
- next->coder->first_stream = true;
+ coder->tell_any_check = (flags & LZMA_TELL_ANY_CHECK) != 0;
+ coder->ignore_check = (flags & LZMA_IGNORE_CHECK) != 0;
+ coder->concatenated = (flags & LZMA_CONCATENATED) != 0;
+ coder->first_stream = true;
- return stream_decoder_reset(next->coder, allocator);
+ return stream_decoder_reset(coder, allocator);
}
extern LZMA_API(lzma_ret)
lzma_stream_decoder(lzma_stream *strm, uint64_t memlimit, uint32_t flags)
{
- lzma_next_strm_init2(lzma_stream_decoder_init, strm, memlimit, flags);
+ lzma_next_strm_init(lzma_stream_decoder_init, strm, memlimit, flags);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
diff --git a/Utilities/cmliblzma/liblzma/common/stream_decoder.h b/Utilities/cmliblzma/liblzma/common/stream_decoder.h
index e54ac28..c13c6ba 100644
--- a/Utilities/cmliblzma/liblzma/common/stream_decoder.h
+++ b/Utilities/cmliblzma/liblzma/common/stream_decoder.h
@@ -15,7 +15,8 @@
#include "common.h"
-extern lzma_ret lzma_stream_decoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, uint64_t memlimit, uint32_t flags);
+extern lzma_ret lzma_stream_decoder_init(
+ lzma_next_coder *next, const lzma_allocator *allocator,
+ uint64_t memlimit, uint32_t flags);
#endif
diff --git a/Utilities/cmliblzma/liblzma/common/stream_encoder.c b/Utilities/cmliblzma/liblzma/common/stream_encoder.c
index 1ba45ac..858cba4 100644
--- a/Utilities/cmliblzma/liblzma/common/stream_encoder.c
+++ b/Utilities/cmliblzma/liblzma/common/stream_encoder.c
@@ -10,12 +10,11 @@
//
///////////////////////////////////////////////////////////////////////////////
-#include "stream_encoder.h"
#include "block_encoder.h"
#include "index_encoder.h"
-struct lzma_coder_s {
+typedef struct {
enum {
SEQ_STREAM_HEADER,
SEQ_BLOCK_INIT,
@@ -26,7 +25,7 @@ struct lzma_coder_s {
} sequence;
/// True if Block encoder has been initialized by
- /// lzma_stream_encoder_init() or stream_encoder_update()
+ /// stream_encoder_init() or stream_encoder_update()
/// and thus doesn't need to be initialized in stream_encode().
bool block_encoder_is_initialized;
@@ -56,11 +55,11 @@ struct lzma_coder_s {
/// Buffer to hold Stream Header, Block Header, and Stream Footer.
/// Block Header has biggest maximum size.
uint8_t buffer[LZMA_BLOCK_HEADER_SIZE_MAX];
-};
+} lzma_stream_coder;
static lzma_ret
-block_encoder_init(lzma_coder *coder, lzma_allocator *allocator)
+block_encoder_init(lzma_stream_coder *coder, const lzma_allocator *allocator)
{
// Prepare the Block options. Even though Block encoder doesn't need
// compressed_size, uncompressed_size, and header_size to be
@@ -79,11 +78,13 @@ block_encoder_init(lzma_coder *coder, lzma_allocator *allocator)
static lzma_ret
-stream_encode(lzma_coder *coder, lzma_allocator *allocator,
- const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
- size_t in_size, uint8_t *LZMA_RESTRICT out,
- size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action)
+stream_encode(void *coder_ptr, const lzma_allocator *allocator,
+ const uint8_t *restrict in, size_t *restrict in_pos,
+ size_t in_size, uint8_t *restrict out,
+ size_t *restrict out_pos, size_t out_size, lzma_action action)
{
+ lzma_stream_coder *coder = coder_ptr;
+
// Main loop
while (*out_pos < out_size)
switch (coder->sequence) {
@@ -126,7 +127,7 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator,
}
// Initialize the Block encoder unless it was already
- // initialized by lzma_stream_encoder_init() or
+ // initialized by stream_encoder_init() or
// stream_encoder_update().
if (!coder->block_encoder_is_initialized)
return_if_error(block_encoder_init(coder, allocator));
@@ -147,13 +148,12 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator,
}
case SEQ_BLOCK_ENCODE: {
- lzma_vli unpadded_size;
-
- static const lzma_action convert[4] = {
+ static const lzma_action convert[LZMA_ACTION_MAX + 1] = {
LZMA_RUN,
LZMA_SYNC_FLUSH,
LZMA_FINISH,
LZMA_FINISH,
+ LZMA_FINISH,
};
const lzma_ret ret = coder->block_encoder.code(
@@ -164,7 +164,7 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator,
return ret;
// Add a new Index Record.
- unpadded_size = lzma_block_unpadded_size(
+ const lzma_vli unpadded_size = lzma_block_unpadded_size(
&coder->block_options);
assert(unpadded_size != 0);
return_if_error(lzma_index_append(coder->index, allocator,
@@ -176,12 +176,6 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator,
}
case SEQ_INDEX_ENCODE: {
- const lzma_stream_flags stream_flags = {
- 0,
- lzma_index_size(coder->index),
- coder->block_options.check,
- };
-
// Call the Index encoder. It doesn't take any input, so
// those pointers can be NULL.
const lzma_ret ret = coder->index_encoder.code(
@@ -192,6 +186,11 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator,
return ret;
// Encode the Stream Footer into coder->buffer.
+ const lzma_stream_flags stream_flags = {
+ .version = 0,
+ .backward_size = lzma_index_size(coder->index),
+ .check = coder->block_options.check,
+ };
if (lzma_stream_footer_encode(&stream_flags, coder->buffer)
!= LZMA_OK)
@@ -212,15 +211,15 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator,
static void
-stream_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
+stream_encoder_end(void *coder_ptr, const lzma_allocator *allocator)
{
- size_t i;
+ lzma_stream_coder *coder = coder_ptr;
lzma_next_end(&coder->block_encoder, allocator);
lzma_next_end(&coder->index_encoder, allocator);
lzma_index_end(coder->index, allocator);
- for (i = 0; coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i)
+ for (size_t i = 0; coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i)
lzma_free(coder->filters[i].options, allocator);
lzma_free(coder, allocator);
@@ -229,22 +228,20 @@ stream_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
static lzma_ret
-stream_encoder_update(lzma_coder *coder, lzma_allocator *allocator,
+stream_encoder_update(void *coder_ptr, const lzma_allocator *allocator,
const lzma_filter *filters,
const lzma_filter *reversed_filters)
{
- size_t i;
+ lzma_stream_coder *coder = coder_ptr;
if (coder->sequence <= SEQ_BLOCK_INIT) {
- lzma_ret ret;
-
// There is no incomplete Block waiting to be finished,
// thus we can change the whole filter chain. Start by
// trying to initialize the Block encoder with the new
// chain. This way we detect if the chain is valid.
coder->block_encoder_is_initialized = false;
coder->block_options.filters = (lzma_filter *)(filters);
- ret = block_encoder_init(coder, allocator);
+ const lzma_ret ret = block_encoder_init(coder, allocator);
coder->block_options.filters = coder->filters;
if (ret != LZMA_OK)
return ret;
@@ -264,62 +261,66 @@ stream_encoder_update(lzma_coder *coder, lzma_allocator *allocator,
}
// Free the copy of the old chain and make a copy of the new chain.
- for (i = 0; coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i)
+ for (size_t i = 0; coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i)
lzma_free(coder->filters[i].options, allocator);
return lzma_filters_copy(filters, coder->filters, allocator);
}
-extern lzma_ret
-lzma_stream_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+static lzma_ret
+stream_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter *filters, lzma_check check)
{
- lzma_stream_flags stream_flags = { 0, 0, check };
-
- lzma_next_coder_init(&lzma_stream_encoder_init, next, allocator);
+ lzma_next_coder_init(&stream_encoder_init, next, allocator);
if (filters == NULL)
return LZMA_PROG_ERROR;
- if (next->coder == NULL) {
- next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
- if (next->coder == NULL)
+ lzma_stream_coder *coder = next->coder;
+
+ if (coder == NULL) {
+ coder = lzma_alloc(sizeof(lzma_stream_coder), allocator);
+ if (coder == NULL)
return LZMA_MEM_ERROR;
+ next->coder = coder;
next->code = &stream_encode;
next->end = &stream_encoder_end;
next->update = &stream_encoder_update;
- next->coder->filters[0].id = LZMA_VLI_UNKNOWN;
- next->coder->block_encoder = LZMA_NEXT_CODER_INIT;
- next->coder->index_encoder = LZMA_NEXT_CODER_INIT;
- next->coder->index = NULL;
+ coder->filters[0].id = LZMA_VLI_UNKNOWN;
+ coder->block_encoder = LZMA_NEXT_CODER_INIT;
+ coder->index_encoder = LZMA_NEXT_CODER_INIT;
+ coder->index = NULL;
}
// Basic initializations
- next->coder->sequence = SEQ_STREAM_HEADER;
- next->coder->block_options.version = 0;
- next->coder->block_options.check = check;
+ coder->sequence = SEQ_STREAM_HEADER;
+ coder->block_options.version = 0;
+ coder->block_options.check = check;
// Initialize the Index
- lzma_index_end(next->coder->index, allocator);
- next->coder->index = lzma_index_init(allocator);
- if (next->coder->index == NULL)
+ lzma_index_end(coder->index, allocator);
+ coder->index = lzma_index_init(allocator);
+ if (coder->index == NULL)
return LZMA_MEM_ERROR;
// Encode the Stream Header
+ lzma_stream_flags stream_flags = {
+ .version = 0,
+ .check = check,
+ };
return_if_error(lzma_stream_header_encode(
- &stream_flags, next->coder->buffer));
+ &stream_flags, coder->buffer));
- next->coder->buffer_pos = 0;
- next->coder->buffer_size = LZMA_STREAM_HEADER_SIZE;
+ coder->buffer_pos = 0;
+ coder->buffer_size = LZMA_STREAM_HEADER_SIZE;
// Initialize the Block encoder. This way we detect unsupported
// filter chains when initializing the Stream encoder instead of
// giving an error after Stream Header has already written out.
- return stream_encoder_update(
- next->coder, allocator, filters, NULL);
+ return stream_encoder_update(coder, allocator, filters, NULL);
}
@@ -327,11 +328,12 @@ extern LZMA_API(lzma_ret)
lzma_stream_encoder(lzma_stream *strm,
const lzma_filter *filters, lzma_check check)
{
- lzma_next_strm_init2(lzma_stream_encoder_init, strm, filters, check);
+ lzma_next_strm_init(stream_encoder_init, strm, filters, check);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_SYNC_FLUSH] = true;
strm->internal->supported_actions[LZMA_FULL_FLUSH] = true;
+ strm->internal->supported_actions[LZMA_FULL_BARRIER] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
return LZMA_OK;
diff --git a/Utilities/cmliblzma/liblzma/common/stream_encoder_mt.c b/Utilities/cmliblzma/liblzma/common/stream_encoder_mt.c
new file mode 100644
index 0000000..2efe44c
--- /dev/null
+++ b/Utilities/cmliblzma/liblzma/common/stream_encoder_mt.c
@@ -0,0 +1,1143 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file stream_encoder_mt.c
+/// \brief Multithreaded .xz Stream encoder
+//
+// Author: Lasse Collin
+//
+// This file has been put into the public domain.
+// You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "filter_encoder.h"
+#include "easy_preset.h"
+#include "block_encoder.h"
+#include "block_buffer_encoder.h"
+#include "index_encoder.h"
+#include "outqueue.h"
+
+
+/// Maximum supported block size. This makes it simpler to prevent integer
+/// overflows if we are given unusually large block size.
+#define BLOCK_SIZE_MAX (UINT64_MAX / LZMA_THREADS_MAX)
+
+
+typedef enum {
+ /// Waiting for work.
+ THR_IDLE,
+
+ /// Encoding is in progress.
+ THR_RUN,
+
+ /// Encoding is in progress but no more input data will
+ /// be read.
+ THR_FINISH,
+
+ /// The main thread wants the thread to stop whatever it was doing
+ /// but not exit.
+ THR_STOP,
+
+ /// The main thread wants the thread to exit. We could use
+ /// cancellation but since there's stopped anyway, this is lazier.
+ THR_EXIT,
+
+} worker_state;
+
+typedef struct lzma_stream_coder_s lzma_stream_coder;
+
+typedef struct worker_thread_s worker_thread;
+struct worker_thread_s {
+ worker_state state;
+
+ /// Input buffer of coder->block_size bytes. The main thread will
+ /// put new input into this and update in_size accordingly. Once
+ /// no more input is coming, state will be set to THR_FINISH.
+ uint8_t *in;
+
+ /// Amount of data available in the input buffer. This is modified
+ /// only by the main thread.
+ size_t in_size;
+
+ /// Output buffer for this thread. This is set by the main
+ /// thread every time a new Block is started with this thread
+ /// structure.
+ lzma_outbuf *outbuf;
+
+ /// Pointer to the main structure is needed when putting this
+ /// thread back to the stack of free threads.
+ lzma_stream_coder *coder;
+
+ /// The allocator is set by the main thread. Since a copy of the
+ /// pointer is kept here, the application must not change the
+ /// allocator before calling lzma_end().
+ const lzma_allocator *allocator;
+
+ /// Amount of uncompressed data that has already been compressed.
+ uint64_t progress_in;
+
+ /// Amount of compressed data that is ready.
+ uint64_t progress_out;
+
+ /// Block encoder
+ lzma_next_coder block_encoder;
+
+ /// Compression options for this Block
+ lzma_block block_options;
+
+ /// Next structure in the stack of free worker threads.
+ worker_thread *next;
+
+ mythread_mutex mutex;
+ mythread_cond cond;
+
+ /// The ID of this thread is used to join the thread
+ /// when it's not needed anymore.
+ mythread thread_id;
+};
+
+
+struct lzma_stream_coder_s {
+ enum {
+ SEQ_STREAM_HEADER,
+ SEQ_BLOCK,
+ SEQ_INDEX,
+ SEQ_STREAM_FOOTER,
+ } sequence;
+
+ /// Start a new Block every block_size bytes of input unless
+ /// LZMA_FULL_FLUSH or LZMA_FULL_BARRIER is used earlier.
+ size_t block_size;
+
+ /// The filter chain currently in use
+ lzma_filter filters[LZMA_FILTERS_MAX + 1];
+
+
+ /// Index to hold sizes of the Blocks
+ lzma_index *index;
+
+ /// Index encoder
+ lzma_next_coder index_encoder;
+
+
+ /// Stream Flags for encoding the Stream Header and Stream Footer.
+ lzma_stream_flags stream_flags;
+
+ /// Buffer to hold Stream Header and Stream Footer.
+ uint8_t header[LZMA_STREAM_HEADER_SIZE];
+
+ /// Read position in header[]
+ size_t header_pos;
+
+
+ /// Output buffer queue for compressed data
+ lzma_outq outq;
+
+
+ /// Maximum wait time if cannot use all the input and cannot
+ /// fill the output buffer. This is in milliseconds.
+ uint32_t timeout;
+
+
+ /// Error code from a worker thread
+ lzma_ret thread_error;
+
+ /// Array of allocated thread-specific structures
+ worker_thread *threads;
+
+ /// Number of structures in "threads" above. This is also the
+ /// number of threads that will be created at maximum.
+ uint32_t threads_max;
+
+ /// Number of thread structures that have been initialized, and
+ /// thus the number of worker threads actually created so far.
+ uint32_t threads_initialized;
+
+ /// Stack of free threads. When a thread finishes, it puts itself
+ /// back into this stack. This starts as empty because threads
+ /// are created only when actually needed.
+ worker_thread *threads_free;
+
+ /// The most recent worker thread to which the main thread writes
+ /// the new input from the application.
+ worker_thread *thr;
+
+
+ /// Amount of uncompressed data in Blocks that have already
+ /// been finished.
+ uint64_t progress_in;
+
+ /// Amount of compressed data in Stream Header + Blocks that
+ /// have already been finished.
+ uint64_t progress_out;
+
+
+ mythread_mutex mutex;
+ mythread_cond cond;
+};
+
+
+/// Tell the main thread that something has gone wrong.
+static void
+worker_error(worker_thread *thr, lzma_ret ret)
+{
+ assert(ret != LZMA_OK);
+ assert(ret != LZMA_STREAM_END);
+
+ mythread_sync(thr->coder->mutex) {
+ if (thr->coder->thread_error == LZMA_OK)
+ thr->coder->thread_error = ret;
+
+ mythread_cond_signal(&thr->coder->cond);
+ }
+
+ return;
+}
+
+
+static worker_state
+worker_encode(worker_thread *thr, worker_state state)
+{
+ assert(thr->progress_in == 0);
+ assert(thr->progress_out == 0);
+
+ // Set the Block options.
+ thr->block_options = (lzma_block){
+ .version = 0,
+ .check = thr->coder->stream_flags.check,
+ .compressed_size = thr->coder->outq.buf_size_max,
+ .uncompressed_size = thr->coder->block_size,
+
+ // TODO: To allow changing the filter chain, the filters
+ // array must be copied to each worker_thread.
+ .filters = thr->coder->filters,
+ };
+
+ // Calculate maximum size of the Block Header. This amount is
+ // reserved in the beginning of the buffer so that Block Header
+ // along with Compressed Size and Uncompressed Size can be
+ // written there.
+ lzma_ret ret = lzma_block_header_size(&thr->block_options);
+ if (ret != LZMA_OK) {
+ worker_error(thr, ret);
+ return THR_STOP;
+ }
+
+ // Initialize the Block encoder.
+ ret = lzma_block_encoder_init(&thr->block_encoder,
+ thr->allocator, &thr->block_options);
+ if (ret != LZMA_OK) {
+ worker_error(thr, ret);
+ return THR_STOP;
+ }
+
+ size_t in_pos = 0;
+ size_t in_size = 0;
+
+ thr->outbuf->size = thr->block_options.header_size;
+ const size_t out_size = thr->coder->outq.buf_size_max;
+
+ do {
+ mythread_sync(thr->mutex) {
+ // Store in_pos and out_pos into *thr so that
+ // an application may read them via
+ // lzma_get_progress() to get progress information.
+ //
+ // NOTE: These aren't updated when the encoding
+ // finishes. Instead, the final values are taken
+ // later from thr->outbuf.
+ thr->progress_in = in_pos;
+ thr->progress_out = thr->outbuf->size;
+
+ while (in_size == thr->in_size
+ && thr->state == THR_RUN)
+ mythread_cond_wait(&thr->cond, &thr->mutex);
+
+ state = thr->state;
+ in_size = thr->in_size;
+ }
+
+ // Return if we were asked to stop or exit.
+ if (state >= THR_STOP)
+ return state;
+
+ lzma_action action = state == THR_FINISH
+ ? LZMA_FINISH : LZMA_RUN;
+
+ // Limit the amount of input given to the Block encoder
+ // at once. This way this thread can react fairly quickly
+ // if the main thread wants us to stop or exit.
+ static const size_t in_chunk_max = 16384;
+ size_t in_limit = in_size;
+ if (in_size - in_pos > in_chunk_max) {
+ in_limit = in_pos + in_chunk_max;
+ action = LZMA_RUN;
+ }
+
+ ret = thr->block_encoder.code(
+ thr->block_encoder.coder, thr->allocator,
+ thr->in, &in_pos, in_limit, thr->outbuf->buf,
+ &thr->outbuf->size, out_size, action);
+ } while (ret == LZMA_OK && thr->outbuf->size < out_size);
+
+ switch (ret) {
+ case LZMA_STREAM_END:
+ assert(state == THR_FINISH);
+
+ // Encode the Block Header. By doing it after
+ // the compression, we can store the Compressed Size
+ // and Uncompressed Size fields.
+ ret = lzma_block_header_encode(&thr->block_options,
+ thr->outbuf->buf);
+ if (ret != LZMA_OK) {
+ worker_error(thr, ret);
+ return THR_STOP;
+ }
+
+ break;
+
+ case LZMA_OK:
+ // The data was incompressible. Encode it using uncompressed
+ // LZMA2 chunks.
+ //
+ // First wait that we have gotten all the input.
+ mythread_sync(thr->mutex) {
+ while (thr->state == THR_RUN)
+ mythread_cond_wait(&thr->cond, &thr->mutex);
+
+ state = thr->state;
+ in_size = thr->in_size;
+ }
+
+ if (state >= THR_STOP)
+ return state;
+
+ // Do the encoding. This takes care of the Block Header too.
+ thr->outbuf->size = 0;
+ ret = lzma_block_uncomp_encode(&thr->block_options,
+ thr->in, in_size, thr->outbuf->buf,
+ &thr->outbuf->size, out_size);
+
+ // It shouldn't fail.
+ if (ret != LZMA_OK) {
+ worker_error(thr, LZMA_PROG_ERROR);
+ return THR_STOP;
+ }
+
+ break;
+
+ default:
+ worker_error(thr, ret);
+ return THR_STOP;
+ }
+
+ // Set the size information that will be read by the main thread
+ // to write the Index field.
+ thr->outbuf->unpadded_size
+ = lzma_block_unpadded_size(&thr->block_options);
+ assert(thr->outbuf->unpadded_size != 0);
+ thr->outbuf->uncompressed_size = thr->block_options.uncompressed_size;
+
+ return THR_FINISH;
+}
+
+
+static MYTHREAD_RET_TYPE
+worker_start(void *thr_ptr)
+{
+ worker_thread *thr = thr_ptr;
+ worker_state state = THR_IDLE; // Init to silence a warning
+
+ while (true) {
+ // Wait for work.
+ mythread_sync(thr->mutex) {
+ while (true) {
+ // The thread is already idle so if we are
+ // requested to stop, just set the state.
+ if (thr->state == THR_STOP) {
+ thr->state = THR_IDLE;
+ mythread_cond_signal(&thr->cond);
+ }
+
+ state = thr->state;
+ if (state != THR_IDLE)
+ break;
+
+ mythread_cond_wait(&thr->cond, &thr->mutex);
+ }
+ }
+
+ assert(state != THR_IDLE);
+ assert(state != THR_STOP);
+
+ if (state <= THR_FINISH)
+ state = worker_encode(thr, state);
+
+ if (state == THR_EXIT)
+ break;
+
+ // Mark the thread as idle unless the main thread has
+ // told us to exit. Signal is needed for the case
+ // where the main thread is waiting for the threads to stop.
+ mythread_sync(thr->mutex) {
+ if (thr->state != THR_EXIT) {
+ thr->state = THR_IDLE;
+ mythread_cond_signal(&thr->cond);
+ }
+ }
+
+ mythread_sync(thr->coder->mutex) {
+ // Mark the output buffer as finished if
+ // no errors occurred.
+ thr->outbuf->finished = state == THR_FINISH;
+
+ // Update the main progress info.
+ thr->coder->progress_in
+ += thr->outbuf->uncompressed_size;
+ thr->coder->progress_out += thr->outbuf->size;
+ thr->progress_in = 0;
+ thr->progress_out = 0;
+
+ // Return this thread to the stack of free threads.
+ thr->next = thr->coder->threads_free;
+ thr->coder->threads_free = thr;
+
+ mythread_cond_signal(&thr->coder->cond);
+ }
+ }
+
+ // Exiting, free the resources.
+ mythread_mutex_destroy(&thr->mutex);
+ mythread_cond_destroy(&thr->cond);
+
+ lzma_next_end(&thr->block_encoder, thr->allocator);
+ lzma_free(thr->in, thr->allocator);
+ return MYTHREAD_RET_VALUE;
+}
+
+
+/// Make the threads stop but not exit. Optionally wait for them to stop.
+static void
+threads_stop(lzma_stream_coder *coder, bool wait_for_threads)
+{
+ // Tell the threads to stop.
+ for (uint32_t i = 0; i < coder->threads_initialized; ++i) {
+ mythread_sync(coder->threads[i].mutex) {
+ coder->threads[i].state = THR_STOP;
+ mythread_cond_signal(&coder->threads[i].cond);
+ }
+ }
+
+ if (!wait_for_threads)
+ return;
+
+ // Wait for the threads to settle in the idle state.
+ for (uint32_t i = 0; i < coder->threads_initialized; ++i) {
+ mythread_sync(coder->threads[i].mutex) {
+ while (coder->threads[i].state != THR_IDLE)
+ mythread_cond_wait(&coder->threads[i].cond,
+ &coder->threads[i].mutex);
+ }
+ }
+
+ return;
+}
+
+
+/// Stop the threads and free the resources associated with them.
+/// Wait until the threads have exited.
+static void
+threads_end(lzma_stream_coder *coder, const lzma_allocator *allocator)
+{
+ for (uint32_t i = 0; i < coder->threads_initialized; ++i) {
+ mythread_sync(coder->threads[i].mutex) {
+ coder->threads[i].state = THR_EXIT;
+ mythread_cond_signal(&coder->threads[i].cond);
+ }
+ }
+
+ for (uint32_t i = 0; i < coder->threads_initialized; ++i) {
+ int ret = mythread_join(coder->threads[i].thread_id);
+ assert(ret == 0);
+ (void)ret;
+ }
+
+ lzma_free(coder->threads, allocator);
+ return;
+}
+
+
+/// Initialize a new worker_thread structure and create a new thread.
+static lzma_ret
+initialize_new_thread(lzma_stream_coder *coder,
+ const lzma_allocator *allocator)
+{
+ worker_thread *thr = &coder->threads[coder->threads_initialized];
+
+ thr->in = lzma_alloc(coder->block_size, allocator);
+ if (thr->in == NULL)
+ return LZMA_MEM_ERROR;
+
+ if (mythread_mutex_init(&thr->mutex))
+ goto error_mutex;
+
+ if (mythread_cond_init(&thr->cond))
+ goto error_cond;
+
+ thr->state = THR_IDLE;
+ thr->allocator = allocator;
+ thr->coder = coder;
+ thr->progress_in = 0;
+ thr->progress_out = 0;
+ thr->block_encoder = LZMA_NEXT_CODER_INIT;
+
+ if (mythread_create(&thr->thread_id, &worker_start, thr))
+ goto error_thread;
+
+ ++coder->threads_initialized;
+ coder->thr = thr;
+
+ return LZMA_OK;
+
+error_thread:
+ mythread_cond_destroy(&thr->cond);
+
+error_cond:
+ mythread_mutex_destroy(&thr->mutex);
+
+error_mutex:
+ lzma_free(thr->in, allocator);
+ return LZMA_MEM_ERROR;
+}
+
+
+static lzma_ret
+get_thread(lzma_stream_coder *coder, const lzma_allocator *allocator)
+{
+ // If there are no free output subqueues, there is no
+ // point to try getting a thread.
+ if (!lzma_outq_has_buf(&coder->outq))
+ return LZMA_OK;
+
+ // If there is a free structure on the stack, use it.
+ mythread_sync(coder->mutex) {
+ if (coder->threads_free != NULL) {
+ coder->thr = coder->threads_free;
+ coder->threads_free = coder->threads_free->next;
+ }
+ }
+
+ if (coder->thr == NULL) {
+ // If there are no uninitialized structures left, return.
+ if (coder->threads_initialized == coder->threads_max)
+ return LZMA_OK;
+
+ // Initialize a new thread.
+ return_if_error(initialize_new_thread(coder, allocator));
+ }
+
+ // Reset the parts of the thread state that have to be done
+ // in the main thread.
+ mythread_sync(coder->thr->mutex) {
+ coder->thr->state = THR_RUN;
+ coder->thr->in_size = 0;
+ coder->thr->outbuf = lzma_outq_get_buf(&coder->outq);
+ mythread_cond_signal(&coder->thr->cond);
+ }
+
+ return LZMA_OK;
+}
+
+
+static lzma_ret
+stream_encode_in(lzma_stream_coder *coder, const lzma_allocator *allocator,
+ const uint8_t *restrict in, size_t *restrict in_pos,
+ size_t in_size, lzma_action action)
+{
+ while (*in_pos < in_size
+ || (coder->thr != NULL && action != LZMA_RUN)) {
+ if (coder->thr == NULL) {
+ // Get a new thread.
+ const lzma_ret ret = get_thread(coder, allocator);
+ if (coder->thr == NULL)
+ return ret;
+ }
+
+ // Copy the input data to thread's buffer.
+ size_t thr_in_size = coder->thr->in_size;
+ lzma_bufcpy(in, in_pos, in_size, coder->thr->in,
+ &thr_in_size, coder->block_size);
+
+ // Tell the Block encoder to finish if
+ // - it has got block_size bytes of input; or
+ // - all input was used and LZMA_FINISH, LZMA_FULL_FLUSH,
+ // or LZMA_FULL_BARRIER was used.
+ //
+ // TODO: LZMA_SYNC_FLUSH and LZMA_SYNC_BARRIER.
+ const bool finish = thr_in_size == coder->block_size
+ || (*in_pos == in_size && action != LZMA_RUN);
+
+ bool block_error = false;
+
+ mythread_sync(coder->thr->mutex) {
+ if (coder->thr->state == THR_IDLE) {
+ // Something has gone wrong with the Block
+ // encoder. It has set coder->thread_error
+ // which we will read a few lines later.
+ block_error = true;
+ } else {
+ // Tell the Block encoder its new amount
+ // of input and update the state if needed.
+ coder->thr->in_size = thr_in_size;
+
+ if (finish)
+ coder->thr->state = THR_FINISH;
+
+ mythread_cond_signal(&coder->thr->cond);
+ }
+ }
+
+ if (block_error) {
+ lzma_ret ret;
+
+ mythread_sync(coder->mutex) {
+ ret = coder->thread_error;
+ }
+
+ return ret;
+ }
+
+ if (finish)
+ coder->thr = NULL;
+ }
+
+ return LZMA_OK;
+}
+
+
+/// Wait until more input can be consumed, more output can be read, or
+/// an optional timeout is reached.
+static bool
+wait_for_work(lzma_stream_coder *coder, mythread_condtime *wait_abs,
+ bool *has_blocked, bool has_input)
+{
+ if (coder->timeout != 0 && !*has_blocked) {
+ // Every time when stream_encode_mt() is called via
+ // lzma_code(), *has_blocked starts as false. We set it
+ // to true here and calculate the absolute time when
+ // we must return if there's nothing to do.
+ //
+ // The idea of *has_blocked is to avoid unneeded calls
+ // to mythread_condtime_set(), which may do a syscall
+ // depending on the operating system.
+ *has_blocked = true;
+ mythread_condtime_set(wait_abs, &coder->cond, coder->timeout);
+ }
+
+ bool timed_out = false;
+
+ mythread_sync(coder->mutex) {
+ // There are four things that we wait. If one of them
+ // becomes possible, we return.
+ // - If there is input left, we need to get a free
+ // worker thread and an output buffer for it.
+ // - Data ready to be read from the output queue.
+ // - A worker thread indicates an error.
+ // - Time out occurs.
+ while ((!has_input || coder->threads_free == NULL
+ || !lzma_outq_has_buf(&coder->outq))
+ && !lzma_outq_is_readable(&coder->outq)
+ && coder->thread_error == LZMA_OK
+ && !timed_out) {
+ if (coder->timeout != 0)
+ timed_out = mythread_cond_timedwait(
+ &coder->cond, &coder->mutex,
+ wait_abs) != 0;
+ else
+ mythread_cond_wait(&coder->cond,
+ &coder->mutex);
+ }
+ }
+
+ return timed_out;
+}
+
+
+static lzma_ret
+stream_encode_mt(void *coder_ptr, const lzma_allocator *allocator,
+ const uint8_t *restrict in, size_t *restrict in_pos,
+ size_t in_size, uint8_t *restrict out,
+ size_t *restrict out_pos, size_t out_size, lzma_action action)
+{
+ lzma_stream_coder *coder = coder_ptr;
+
+ switch (coder->sequence) {
+ case SEQ_STREAM_HEADER:
+ lzma_bufcpy(coder->header, &coder->header_pos,
+ sizeof(coder->header),
+ out, out_pos, out_size);
+ if (coder->header_pos < sizeof(coder->header))
+ return LZMA_OK;
+
+ coder->header_pos = 0;
+ coder->sequence = SEQ_BLOCK;
+
+ // Fall through
+
+ case SEQ_BLOCK: {
+ // Initialized to silence warnings.
+ lzma_vli unpadded_size = 0;
+ lzma_vli uncompressed_size = 0;
+ lzma_ret ret = LZMA_OK;
+
+ // These are for wait_for_work().
+ bool has_blocked = false;
+ mythread_condtime wait_abs;
+
+ while (true) {
+ mythread_sync(coder->mutex) {
+ // Check for Block encoder errors.
+ ret = coder->thread_error;
+ if (ret != LZMA_OK) {
+ assert(ret != LZMA_STREAM_END);
+ break;
+ }
+
+ // Try to read compressed data to out[].
+ ret = lzma_outq_read(&coder->outq,
+ out, out_pos, out_size,
+ &unpadded_size,
+ &uncompressed_size);
+ }
+
+ if (ret == LZMA_STREAM_END) {
+ // End of Block. Add it to the Index.
+ ret = lzma_index_append(coder->index,
+ allocator, unpadded_size,
+ uncompressed_size);
+
+ // If we didn't fill the output buffer yet,
+ // try to read more data. Maybe the next
+ // outbuf has been finished already too.
+ if (*out_pos < out_size)
+ continue;
+ }
+
+ if (ret != LZMA_OK) {
+ // coder->thread_error was set or
+ // lzma_index_append() failed.
+ threads_stop(coder, false);
+ return ret;
+ }
+
+ // Try to give uncompressed data to a worker thread.
+ ret = stream_encode_in(coder, allocator,
+ in, in_pos, in_size, action);
+ if (ret != LZMA_OK) {
+ threads_stop(coder, false);
+ return ret;
+ }
+
+ // See if we should wait or return.
+ //
+ // TODO: LZMA_SYNC_FLUSH and LZMA_SYNC_BARRIER.
+ if (*in_pos == in_size) {
+ // LZMA_RUN: More data is probably coming
+ // so return to let the caller fill the
+ // input buffer.
+ if (action == LZMA_RUN)
+ return LZMA_OK;
+
+ // LZMA_FULL_BARRIER: The same as with
+ // LZMA_RUN but tell the caller that the
+ // barrier was completed.
+ if (action == LZMA_FULL_BARRIER)
+ return LZMA_STREAM_END;
+
+ // Finishing or flushing isn't completed until
+ // all input data has been encoded and copied
+ // to the output buffer.
+ if (lzma_outq_is_empty(&coder->outq)) {
+ // LZMA_FINISH: Continue to encode
+ // the Index field.
+ if (action == LZMA_FINISH)
+ break;
+
+ // LZMA_FULL_FLUSH: Return to tell
+ // the caller that flushing was
+ // completed.
+ if (action == LZMA_FULL_FLUSH)
+ return LZMA_STREAM_END;
+ }
+ }
+
+ // Return if there is no output space left.
+ // This check must be done after testing the input
+ // buffer, because we might want to use a different
+ // return code.
+ if (*out_pos == out_size)
+ return LZMA_OK;
+
+ // Neither in nor out has been used completely.
+ // Wait until there's something we can do.
+ if (wait_for_work(coder, &wait_abs, &has_blocked,
+ *in_pos < in_size))
+ return LZMA_TIMED_OUT;
+ }
+
+ // All Blocks have been encoded and the threads have stopped.
+ // Prepare to encode the Index field.
+ return_if_error(lzma_index_encoder_init(
+ &coder->index_encoder, allocator,
+ coder->index));
+ coder->sequence = SEQ_INDEX;
+
+ // Update the progress info to take the Index and
+ // Stream Footer into account. Those are very fast to encode
+ // so in terms of progress information they can be thought
+ // to be ready to be copied out.
+ coder->progress_out += lzma_index_size(coder->index)
+ + LZMA_STREAM_HEADER_SIZE;
+ }
+
+ // Fall through
+
+ case SEQ_INDEX: {
+ // Call the Index encoder. It doesn't take any input, so
+ // those pointers can be NULL.
+ const lzma_ret ret = coder->index_encoder.code(
+ coder->index_encoder.coder, allocator,
+ NULL, NULL, 0,
+ out, out_pos, out_size, LZMA_RUN);
+ if (ret != LZMA_STREAM_END)
+ return ret;
+
+ // Encode the Stream Footer into coder->buffer.
+ coder->stream_flags.backward_size
+ = lzma_index_size(coder->index);
+ if (lzma_stream_footer_encode(&coder->stream_flags,
+ coder->header) != LZMA_OK)
+ return LZMA_PROG_ERROR;
+
+ coder->sequence = SEQ_STREAM_FOOTER;
+ }
+
+ // Fall through
+
+ case SEQ_STREAM_FOOTER:
+ lzma_bufcpy(coder->header, &coder->header_pos,
+ sizeof(coder->header),
+ out, out_pos, out_size);
+ return coder->header_pos < sizeof(coder->header)
+ ? LZMA_OK : LZMA_STREAM_END;
+ }
+
+ assert(0);
+ return LZMA_PROG_ERROR;
+}
+
+
+static void
+stream_encoder_mt_end(void *coder_ptr, const lzma_allocator *allocator)
+{
+ lzma_stream_coder *coder = coder_ptr;
+
+ // Threads must be killed before the output queue can be freed.
+ threads_end(coder, allocator);
+ lzma_outq_end(&coder->outq, allocator);
+
+ for (size_t i = 0; coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i)
+ lzma_free(coder->filters[i].options, allocator);
+
+ lzma_next_end(&coder->index_encoder, allocator);
+ lzma_index_end(coder->index, allocator);
+
+ mythread_cond_destroy(&coder->cond);
+ mythread_mutex_destroy(&coder->mutex);
+
+ lzma_free(coder, allocator);
+ return;
+}
+
+
+/// Options handling for lzma_stream_encoder_mt_init() and
+/// lzma_stream_encoder_mt_memusage()
+static lzma_ret
+get_options(const lzma_mt *options, lzma_options_easy *opt_easy,
+ const lzma_filter **filters, uint64_t *block_size,
+ uint64_t *outbuf_size_max)
+{
+ // Validate some of the options.
+ if (options == NULL)
+ return LZMA_PROG_ERROR;
+
+ if (options->flags != 0 || options->threads == 0
+ || options->threads > LZMA_THREADS_MAX)
+ return LZMA_OPTIONS_ERROR;
+
+ if (options->filters != NULL) {
+ // Filter chain was given, use it as is.
+ *filters = options->filters;
+ } else {
+ // Use a preset.
+ if (lzma_easy_preset(opt_easy, options->preset))
+ return LZMA_OPTIONS_ERROR;
+
+ *filters = opt_easy->filters;
+ }
+
+ // Block size
+ if (options->block_size > 0) {
+ if (options->block_size > BLOCK_SIZE_MAX)
+ return LZMA_OPTIONS_ERROR;
+
+ *block_size = options->block_size;
+ } else {
+ // Determine the Block size from the filter chain.
+ *block_size = lzma_mt_block_size(*filters);
+ if (*block_size == 0)
+ return LZMA_OPTIONS_ERROR;
+
+ assert(*block_size <= BLOCK_SIZE_MAX);
+ }
+
+ // Calculate the maximum amount output that a single output buffer
+ // may need to hold. This is the same as the maximum total size of
+ // a Block.
+ *outbuf_size_max = lzma_block_buffer_bound64(*block_size);
+ if (*outbuf_size_max == 0)
+ return LZMA_MEM_ERROR;
+
+ return LZMA_OK;
+}
+
+
+static void
+get_progress(void *coder_ptr, uint64_t *progress_in, uint64_t *progress_out)
+{
+ lzma_stream_coder *coder = coder_ptr;
+
+ // Lock coder->mutex to prevent finishing threads from moving their
+ // progress info from the worker_thread structure to lzma_stream_coder.
+ mythread_sync(coder->mutex) {
+ *progress_in = coder->progress_in;
+ *progress_out = coder->progress_out;
+
+ for (size_t i = 0; i < coder->threads_initialized; ++i) {
+ mythread_sync(coder->threads[i].mutex) {
+ *progress_in += coder->threads[i].progress_in;
+ *progress_out += coder->threads[i]
+ .progress_out;
+ }
+ }
+ }
+
+ return;
+}
+
+
+static lzma_ret
+stream_encoder_mt_init(lzma_next_coder *next, const lzma_allocator *allocator,
+ const lzma_mt *options)
+{
+ lzma_next_coder_init(&stream_encoder_mt_init, next, allocator);
+
+ // Get the filter chain.
+ lzma_options_easy easy;
+ const lzma_filter *filters;
+ uint64_t block_size;
+ uint64_t outbuf_size_max;
+ return_if_error(get_options(options, &easy, &filters,
+ &block_size, &outbuf_size_max));
+
+#if SIZE_MAX < UINT64_MAX
+ if (block_size > SIZE_MAX)
+ return LZMA_MEM_ERROR;
+#endif
+
+ // Validate the filter chain so that we can give an error in this
+ // function instead of delaying it to the first call to lzma_code().
+ // The memory usage calculation verifies the filter chain as
+ // a side effect so we take advatange of that.
+ if (lzma_raw_encoder_memusage(filters) == UINT64_MAX)
+ return LZMA_OPTIONS_ERROR;
+
+ // Validate the Check ID.
+ if ((unsigned int)(options->check) > LZMA_CHECK_ID_MAX)
+ return LZMA_PROG_ERROR;
+
+ if (!lzma_check_is_supported(options->check))
+ return LZMA_UNSUPPORTED_CHECK;
+
+ // Allocate and initialize the base structure if needed.
+ lzma_stream_coder *coder = next->coder;
+ if (coder == NULL) {
+ coder = lzma_alloc(sizeof(lzma_stream_coder), allocator);
+ if (coder == NULL)
+ return LZMA_MEM_ERROR;
+
+ next->coder = coder;
+
+ // For the mutex and condition variable initializations
+ // the error handling has to be done here because
+ // stream_encoder_mt_end() doesn't know if they have
+ // already been initialized or not.
+ if (mythread_mutex_init(&coder->mutex)) {
+ lzma_free(coder, allocator);
+ next->coder = NULL;
+ return LZMA_MEM_ERROR;
+ }
+
+ if (mythread_cond_init(&coder->cond)) {
+ mythread_mutex_destroy(&coder->mutex);
+ lzma_free(coder, allocator);
+ next->coder = NULL;
+ return LZMA_MEM_ERROR;
+ }
+
+ next->code = &stream_encode_mt;
+ next->end = &stream_encoder_mt_end;
+ next->get_progress = &get_progress;
+// next->update = &stream_encoder_mt_update;
+
+ coder->filters[0].id = LZMA_VLI_UNKNOWN;
+ coder->index_encoder = LZMA_NEXT_CODER_INIT;
+ coder->index = NULL;
+ memzero(&coder->outq, sizeof(coder->outq));
+ coder->threads = NULL;
+ coder->threads_max = 0;
+ coder->threads_initialized = 0;
+ }
+
+ // Basic initializations
+ coder->sequence = SEQ_STREAM_HEADER;
+ coder->block_size = (size_t)(block_size);
+ coder->thread_error = LZMA_OK;
+ coder->thr = NULL;
+
+ // Allocate the thread-specific base structures.
+ assert(options->threads > 0);
+ if (coder->threads_max != options->threads) {
+ threads_end(coder, allocator);
+
+ coder->threads = NULL;
+ coder->threads_max = 0;
+
+ coder->threads_initialized = 0;
+ coder->threads_free = NULL;
+
+ coder->threads = lzma_alloc(
+ options->threads * sizeof(worker_thread),
+ allocator);
+ if (coder->threads == NULL)
+ return LZMA_MEM_ERROR;
+
+ coder->threads_max = options->threads;
+ } else {
+ // Reuse the old structures and threads. Tell the running
+ // threads to stop and wait until they have stopped.
+ threads_stop(coder, true);
+ }
+
+ // Output queue
+ return_if_error(lzma_outq_init(&coder->outq, allocator,
+ outbuf_size_max, options->threads));
+
+ // Timeout
+ coder->timeout = options->timeout;
+
+ // Free the old filter chain and copy the new one.
+ for (size_t i = 0; coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i)
+ lzma_free(coder->filters[i].options, allocator);
+
+ return_if_error(lzma_filters_copy(
+ filters, coder->filters, allocator));
+
+ // Index
+ lzma_index_end(coder->index, allocator);
+ coder->index = lzma_index_init(allocator);
+ if (coder->index == NULL)
+ return LZMA_MEM_ERROR;
+
+ // Stream Header
+ coder->stream_flags.version = 0;
+ coder->stream_flags.check = options->check;
+ return_if_error(lzma_stream_header_encode(
+ &coder->stream_flags, coder->header));
+
+ coder->header_pos = 0;
+
+ // Progress info
+ coder->progress_in = 0;
+ coder->progress_out = LZMA_STREAM_HEADER_SIZE;
+
+ return LZMA_OK;
+}
+
+
+extern LZMA_API(lzma_ret)
+lzma_stream_encoder_mt(lzma_stream *strm, const lzma_mt *options)
+{
+ lzma_next_strm_init(stream_encoder_mt_init, strm, options);
+
+ strm->internal->supported_actions[LZMA_RUN] = true;
+// strm->internal->supported_actions[LZMA_SYNC_FLUSH] = true;
+ strm->internal->supported_actions[LZMA_FULL_FLUSH] = true;
+ strm->internal->supported_actions[LZMA_FULL_BARRIER] = true;
+ strm->internal->supported_actions[LZMA_FINISH] = true;
+
+ return LZMA_OK;
+}
+
+
+// This function name is a monster but it's consistent with the older
+// monster names. :-( 31 chars is the max that C99 requires so in that
+// sense it's not too long. ;-)
+extern LZMA_API(uint64_t)
+lzma_stream_encoder_mt_memusage(const lzma_mt *options)
+{
+ lzma_options_easy easy;
+ const lzma_filter *filters;
+ uint64_t block_size;
+ uint64_t outbuf_size_max;
+
+ if (get_options(options, &easy, &filters, &block_size,
+ &outbuf_size_max) != LZMA_OK)
+ return UINT64_MAX;
+
+ // Memory usage of the input buffers
+ const uint64_t inbuf_memusage = options->threads * block_size;
+
+ // Memory usage of the filter encoders
+ uint64_t filters_memusage = lzma_raw_encoder_memusage(filters);
+ if (filters_memusage == UINT64_MAX)
+ return UINT64_MAX;
+
+ filters_memusage *= options->threads;
+
+ // Memory usage of the output queue
+ const uint64_t outq_memusage = lzma_outq_memusage(
+ outbuf_size_max, options->threads);
+ if (outq_memusage == UINT64_MAX)
+ return UINT64_MAX;
+
+ // Sum them with overflow checking.
+ uint64_t total_memusage = LZMA_MEMUSAGE_BASE
+ + sizeof(lzma_stream_coder)
+ + options->threads * sizeof(worker_thread);
+
+ if (UINT64_MAX - total_memusage < inbuf_memusage)
+ return UINT64_MAX;
+
+ total_memusage += inbuf_memusage;
+
+ if (UINT64_MAX - total_memusage < filters_memusage)
+ return UINT64_MAX;
+
+ total_memusage += filters_memusage;
+
+ if (UINT64_MAX - total_memusage < outq_memusage)
+ return UINT64_MAX;
+
+ return total_memusage + outq_memusage;
+}
diff --git a/Utilities/cmliblzma/liblzma/common/stream_flags_decoder.c b/Utilities/cmliblzma/liblzma/common/stream_flags_decoder.c
index 8cf48a4..1bc2f97 100644
--- a/Utilities/cmliblzma/liblzma/common/stream_flags_decoder.c
+++ b/Utilities/cmliblzma/liblzma/common/stream_flags_decoder.c
@@ -30,15 +30,13 @@ stream_flags_decode(lzma_stream_flags *options, const uint8_t *in)
extern LZMA_API(lzma_ret)
lzma_stream_header_decode(lzma_stream_flags *options, const uint8_t *in)
{
- uint32_t crc;
-
// Magic
if (memcmp(in, lzma_header_magic, sizeof(lzma_header_magic)) != 0)
return LZMA_FORMAT_ERROR;
// Verify the CRC32 so we can distinguish between corrupt
// and unsupported files.
- crc = lzma_crc32(in + sizeof(lzma_header_magic),
+ const uint32_t crc = lzma_crc32(in + sizeof(lzma_header_magic),
LZMA_STREAM_FLAGS_SIZE, 0);
if (crc != unaligned_read32le(in + sizeof(lzma_header_magic)
+ LZMA_STREAM_FLAGS_SIZE))
@@ -61,15 +59,13 @@ lzma_stream_header_decode(lzma_stream_flags *options, const uint8_t *in)
extern LZMA_API(lzma_ret)
lzma_stream_footer_decode(lzma_stream_flags *options, const uint8_t *in)
{
- uint32_t crc;
-
// Magic
if (memcmp(in + sizeof(uint32_t) * 2 + LZMA_STREAM_FLAGS_SIZE,
lzma_footer_magic, sizeof(lzma_footer_magic)) != 0)
return LZMA_FORMAT_ERROR;
// CRC32
- crc = lzma_crc32(in + sizeof(uint32_t),
+ const uint32_t crc = lzma_crc32(in + sizeof(uint32_t),
sizeof(uint32_t) + LZMA_STREAM_FLAGS_SIZE, 0);
if (crc != unaligned_read32le(in))
return LZMA_DATA_ERROR;
diff --git a/Utilities/cmliblzma/liblzma/common/stream_flags_encoder.c b/Utilities/cmliblzma/liblzma/common/stream_flags_encoder.c
index 290339e..4e71715 100644
--- a/Utilities/cmliblzma/liblzma/common/stream_flags_encoder.c
+++ b/Utilities/cmliblzma/liblzma/common/stream_flags_encoder.c
@@ -29,8 +29,6 @@ stream_flags_encode(const lzma_stream_flags *options, uint8_t *out)
extern LZMA_API(lzma_ret)
lzma_stream_header_encode(const lzma_stream_flags *options, uint8_t *out)
{
- uint32_t crc;
-
assert(sizeof(lzma_header_magic) + LZMA_STREAM_FLAGS_SIZE
+ 4 == LZMA_STREAM_HEADER_SIZE);
@@ -45,7 +43,7 @@ lzma_stream_header_encode(const lzma_stream_flags *options, uint8_t *out)
return LZMA_PROG_ERROR;
// CRC32 of the Stream Header
- crc = lzma_crc32(out + sizeof(lzma_header_magic),
+ const uint32_t crc = lzma_crc32(out + sizeof(lzma_header_magic),
LZMA_STREAM_FLAGS_SIZE, 0);
unaligned_write32le(out + sizeof(lzma_header_magic)
@@ -58,8 +56,6 @@ lzma_stream_header_encode(const lzma_stream_flags *options, uint8_t *out)
extern LZMA_API(lzma_ret)
lzma_stream_footer_encode(const lzma_stream_flags *options, uint8_t *out)
{
- uint32_t crc;
-
assert(2 * 4 + LZMA_STREAM_FLAGS_SIZE + sizeof(lzma_footer_magic)
== LZMA_STREAM_HEADER_SIZE);
@@ -77,7 +73,7 @@ lzma_stream_footer_encode(const lzma_stream_flags *options, uint8_t *out)
return LZMA_PROG_ERROR;
// CRC32
- crc = lzma_crc32(
+ const uint32_t crc = lzma_crc32(
out + 4, 4 + LZMA_STREAM_FLAGS_SIZE, 0);
unaligned_write32le(out, crc);
diff --git a/Utilities/cmliblzma/liblzma/common/vli_decoder.c b/Utilities/cmliblzma/liblzma/common/vli_decoder.c
index 1c66384..c181828 100644
--- a/Utilities/cmliblzma/liblzma/common/vli_decoder.c
+++ b/Utilities/cmliblzma/liblzma/common/vli_decoder.c
@@ -14,8 +14,8 @@
extern LZMA_API(lzma_ret)
-lzma_vli_decode(lzma_vli *LZMA_RESTRICT vli, size_t *vli_pos,
- const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
+lzma_vli_decode(lzma_vli *restrict vli, size_t *vli_pos,
+ const uint8_t *restrict in, size_t *restrict in_pos,
size_t in_size)
{
// If we haven't been given vli_pos, work in single-call mode.
diff --git a/Utilities/cmliblzma/liblzma/common/vli_encoder.c b/Utilities/cmliblzma/liblzma/common/vli_encoder.c
index 09e90cb..f864269 100644
--- a/Utilities/cmliblzma/liblzma/common/vli_encoder.c
+++ b/Utilities/cmliblzma/liblzma/common/vli_encoder.c
@@ -15,7 +15,7 @@
extern LZMA_API(lzma_ret)
lzma_vli_encode(lzma_vli vli, size_t *vli_pos,
- uint8_t *LZMA_RESTRICT out, size_t *LZMA_RESTRICT out_pos,
+ uint8_t *restrict out, size_t *restrict out_pos,
size_t out_size)
{
// If we haven't been given vli_pos, work in single-call mode.
diff --git a/Utilities/cmliblzma/liblzma/common/vli_size.c b/Utilities/cmliblzma/liblzma/common/vli_size.c
index 8b931e4..ec1b4fa 100644
--- a/Utilities/cmliblzma/liblzma/common/vli_size.c
+++ b/Utilities/cmliblzma/liblzma/common/vli_size.c
@@ -16,11 +16,10 @@
extern LZMA_API(uint32_t)
lzma_vli_size(lzma_vli vli)
{
- uint32_t i = 0;
-
if (vli > LZMA_VLI_MAX)
return 0;
+ uint32_t i = 0;
do {
vli >>= 7;
++i;
diff --git a/Utilities/cmliblzma/liblzma/delta/delta_common.c b/Utilities/cmliblzma/liblzma/delta/delta_common.c
index 803e674..4768201 100644
--- a/Utilities/cmliblzma/liblzma/delta/delta_common.c
+++ b/Utilities/cmliblzma/liblzma/delta/delta_common.c
@@ -15,8 +15,9 @@
static void
-delta_coder_end(lzma_coder *coder, lzma_allocator *allocator)
+delta_coder_end(void *coder_ptr, const lzma_allocator *allocator)
{
+ lzma_delta_coder *coder = coder_ptr;
lzma_next_end(&coder->next, allocator);
lzma_free(coder, allocator);
return;
@@ -24,20 +25,21 @@ delta_coder_end(lzma_coder *coder, lzma_allocator *allocator)
extern lzma_ret
-lzma_delta_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_delta_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters)
{
- const lzma_options_delta *opt;
-
// Allocate memory for the decoder if needed.
- if (next->coder == NULL) {
- next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
- if (next->coder == NULL)
+ lzma_delta_coder *coder = next->coder;
+ if (coder == NULL) {
+ coder = lzma_alloc(sizeof(lzma_delta_coder), allocator);
+ if (coder == NULL)
return LZMA_MEM_ERROR;
+ next->coder = coder;
+
// End function is the same for encoder and decoder.
next->end = &delta_coder_end;
- next->coder->next = LZMA_NEXT_CODER_INIT;
+ coder->next = LZMA_NEXT_CODER_INIT;
}
// Validate the options.
@@ -45,16 +47,15 @@ lzma_delta_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
return LZMA_OPTIONS_ERROR;
// Set the delta distance.
- opt = filters[0].options;
- next->coder->distance = opt->dist;
+ const lzma_options_delta *opt = filters[0].options;
+ coder->distance = opt->dist;
// Initialize the rest of the variables.
- next->coder->pos = 0;
- memzero(next->coder->history, LZMA_DELTA_DIST_MAX);
+ coder->pos = 0;
+ memzero(coder->history, LZMA_DELTA_DIST_MAX);
// Initialize the next decoder in the chain, if any.
- return lzma_next_filter_init(&next->coder->next,
- allocator, filters + 1);
+ return lzma_next_filter_init(&coder->next, allocator, filters + 1);
}
@@ -68,5 +69,5 @@ lzma_delta_coder_memusage(const void *options)
|| opt->dist > LZMA_DELTA_DIST_MAX)
return UINT64_MAX;
- return sizeof(lzma_coder);
+ return sizeof(lzma_delta_coder);
}
diff --git a/Utilities/cmliblzma/liblzma/delta/delta_decoder.c b/Utilities/cmliblzma/liblzma/delta/delta_decoder.c
index 28df727..6859afa 100644
--- a/Utilities/cmliblzma/liblzma/delta/delta_decoder.c
+++ b/Utilities/cmliblzma/liblzma/delta/delta_decoder.c
@@ -15,12 +15,11 @@
static void
-decode_buffer(lzma_coder *coder, uint8_t *buffer, size_t size)
+decode_buffer(lzma_delta_coder *coder, uint8_t *buffer, size_t size)
{
- size_t i;
const size_t distance = coder->distance;
- for (i = 0; i < size; ++i) {
+ for (size_t i = 0; i < size; ++i) {
buffer[i] += coder->history[(distance + coder->pos) & 0xFF];
coder->history[coder->pos-- & 0xFF] = buffer[i];
}
@@ -28,17 +27,18 @@ decode_buffer(lzma_coder *coder, uint8_t *buffer, size_t size)
static lzma_ret
-delta_decode(lzma_coder *coder, lzma_allocator *allocator,
- const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
- size_t in_size, uint8_t *LZMA_RESTRICT out,
- size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action)
+delta_decode(void *coder_ptr, const lzma_allocator *allocator,
+ const uint8_t *restrict in, size_t *restrict in_pos,
+ size_t in_size, uint8_t *restrict out,
+ size_t *restrict out_pos, size_t out_size, lzma_action action)
{
- const size_t out_start = *out_pos;
- lzma_ret ret;
+ lzma_delta_coder *coder = coder_ptr;
assert(coder->next.code != NULL);
- ret = coder->next.code(coder->next.coder, allocator,
+ const size_t out_start = *out_pos;
+
+ const lzma_ret ret = coder->next.code(coder->next.coder, allocator,
in, in_pos, in_size, out, out_pos, out_size,
action);
@@ -49,7 +49,7 @@ delta_decode(lzma_coder *coder, lzma_allocator *allocator,
extern lzma_ret
-lzma_delta_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_delta_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters)
{
next->code = &delta_decode;
@@ -58,15 +58,14 @@ lzma_delta_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern lzma_ret
-lzma_delta_props_decode(void **options, lzma_allocator *allocator,
+lzma_delta_props_decode(void **options, const lzma_allocator *allocator,
const uint8_t *props, size_t props_size)
{
- lzma_options_delta *opt;
-
if (props_size != 1)
return LZMA_OPTIONS_ERROR;
- opt = lzma_alloc(sizeof(lzma_options_delta), allocator);
+ lzma_options_delta *opt
+ = lzma_alloc(sizeof(lzma_options_delta), allocator);
if (opt == NULL)
return LZMA_MEM_ERROR;
diff --git a/Utilities/cmliblzma/liblzma/delta/delta_decoder.h b/Utilities/cmliblzma/liblzma/delta/delta_decoder.h
index ae89acc..ad89cc6 100644
--- a/Utilities/cmliblzma/liblzma/delta/delta_decoder.h
+++ b/Utilities/cmliblzma/liblzma/delta/delta_decoder.h
@@ -16,10 +16,11 @@
#include "delta_common.h"
extern lzma_ret lzma_delta_decoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters);
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters);
extern lzma_ret lzma_delta_props_decode(
- void **options, lzma_allocator *allocator,
+ void **options, const lzma_allocator *allocator,
const uint8_t *props, size_t props_size);
#endif
diff --git a/Utilities/cmliblzma/liblzma/delta/delta_encoder.c b/Utilities/cmliblzma/liblzma/delta/delta_encoder.c
index a39c154..3841651 100644
--- a/Utilities/cmliblzma/liblzma/delta/delta_encoder.c
+++ b/Utilities/cmliblzma/liblzma/delta/delta_encoder.c
@@ -18,13 +18,12 @@
/// is the first filter in the chain (and thus the last filter in the
/// encoder's filter stack).
static void
-copy_and_encode(lzma_coder *coder,
- const uint8_t *LZMA_RESTRICT in, uint8_t *LZMA_RESTRICT out, size_t size)
+copy_and_encode(lzma_delta_coder *coder,
+ const uint8_t *restrict in, uint8_t *restrict out, size_t size)
{
- size_t i;
const size_t distance = coder->distance;
- for (i = 0; i < size; ++i) {
+ for (size_t i = 0; i < size; ++i) {
const uint8_t tmp = coder->history[
(distance + coder->pos) & 0xFF];
coder->history[coder->pos-- & 0xFF] = in[i];
@@ -36,12 +35,11 @@ copy_and_encode(lzma_coder *coder,
/// Encodes the data in place. This is used when we are the last filter
/// in the chain (and thus non-last filter in the encoder's filter stack).
static void
-encode_in_place(lzma_coder *coder, uint8_t *buffer, size_t size)
+encode_in_place(lzma_delta_coder *coder, uint8_t *buffer, size_t size)
{
- size_t i;
const size_t distance = coder->distance;
- for (i = 0; i < size; ++i) {
+ for (size_t i = 0; i < size; ++i) {
const uint8_t tmp = coder->history[
(distance + coder->pos) & 0xFF];
coder->history[coder->pos-- & 0xFF] = buffer[i];
@@ -51,11 +49,13 @@ encode_in_place(lzma_coder *coder, uint8_t *buffer, size_t size)
static lzma_ret
-delta_encode(lzma_coder *coder, lzma_allocator *allocator,
- const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
- size_t in_size, uint8_t *LZMA_RESTRICT out,
- size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action)
+delta_encode(void *coder_ptr, const lzma_allocator *allocator,
+ const uint8_t *restrict in, size_t *restrict in_pos,
+ size_t in_size, uint8_t *restrict out,
+ size_t *restrict out_pos, size_t out_size, lzma_action action)
{
+ lzma_delta_coder *coder = coder_ptr;
+
lzma_ret ret;
if (coder->next.code == NULL) {
@@ -86,10 +86,12 @@ delta_encode(lzma_coder *coder, lzma_allocator *allocator,
static lzma_ret
-delta_encoder_update(lzma_coder *coder, lzma_allocator *allocator,
+delta_encoder_update(void *coder_ptr, const lzma_allocator *allocator,
const lzma_filter *filters_null lzma_attribute((__unused__)),
const lzma_filter *reversed_filters)
{
+ lzma_delta_coder *coder = coder_ptr;
+
// Delta doesn't and will never support changing the options in
// the middle of encoding. If the app tries to change them, we
// simply ignore them.
@@ -99,7 +101,7 @@ delta_encoder_update(lzma_coder *coder, lzma_allocator *allocator,
extern lzma_ret
-lzma_delta_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_delta_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters)
{
next->code = &delta_encode;
@@ -111,13 +113,12 @@ lzma_delta_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern lzma_ret
lzma_delta_props_encode(const void *options, uint8_t *out)
{
- const lzma_options_delta *opt = options;
-
// The caller must have already validated the options, so it's
// LZMA_PROG_ERROR if they are invalid.
if (lzma_delta_coder_memusage(options) == UINT64_MAX)
return LZMA_PROG_ERROR;
+ const lzma_options_delta *opt = options;
out[0] = opt->dist - LZMA_DELTA_DIST_MIN;
return LZMA_OK;
diff --git a/Utilities/cmliblzma/liblzma/delta/delta_encoder.h b/Utilities/cmliblzma/liblzma/delta/delta_encoder.h
index a447862..4ab9847 100644
--- a/Utilities/cmliblzma/liblzma/delta/delta_encoder.h
+++ b/Utilities/cmliblzma/liblzma/delta/delta_encoder.h
@@ -16,7 +16,8 @@
#include "delta_common.h"
extern lzma_ret lzma_delta_encoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters);
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters);
extern lzma_ret lzma_delta_props_encode(const void *options, uint8_t *out);
diff --git a/Utilities/cmliblzma/liblzma/delta/delta_private.h b/Utilities/cmliblzma/liblzma/delta/delta_private.h
index 62b7fed..0d6cb38 100644
--- a/Utilities/cmliblzma/liblzma/delta/delta_private.h
+++ b/Utilities/cmliblzma/liblzma/delta/delta_private.h
@@ -15,7 +15,7 @@
#include "delta_common.h"
-struct lzma_coder_s {
+typedef struct {
/// Next coder in the chain
lzma_next_coder next;
@@ -27,11 +27,11 @@ struct lzma_coder_s {
/// Buffer to hold history of the original data
uint8_t history[LZMA_DELTA_DIST_MAX];
-};
+} lzma_delta_coder;
extern lzma_ret lzma_delta_coder_init(
- lzma_next_coder *next, lzma_allocator *allocator,
+ lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters);
#endif
diff --git a/Utilities/cmliblzma/liblzma/liblzma.pc.in b/Utilities/cmliblzma/liblzma/liblzma.pc.in
index 7f11f1a..9fa4891 100644
--- a/Utilities/cmliblzma/liblzma/liblzma.pc.in
+++ b/Utilities/cmliblzma/liblzma/liblzma.pc.in
@@ -16,4 +16,4 @@ URL: @PACKAGE_URL@
Version: @PACKAGE_VERSION@
Cflags: -I${includedir}
Libs: -L${libdir} -llzma
-Libs.private: @PTHREAD_CFLAGS@ @PTHREAD_LIBS@
+Libs.private: @PTHREAD_CFLAGS@ @LIBS@
diff --git a/Utilities/cmliblzma/liblzma/lz/lz_decoder.c b/Utilities/cmliblzma/liblzma/lz/lz_decoder.c
index 9fa1bdc..c708644 100644
--- a/Utilities/cmliblzma/liblzma/lz/lz_decoder.c
+++ b/Utilities/cmliblzma/liblzma/lz/lz_decoder.c
@@ -20,7 +20,7 @@
#include "lz_decoder.h"
-struct lzma_coder_s {
+typedef struct {
/// Dictionary (history buffer)
lzma_dict dict;
@@ -48,7 +48,7 @@ struct lzma_coder_s {
size_t size;
uint8_t buffer[LZMA_BUFFER_SIZE];
} temp;
-};
+} lzma_coder;
static void
@@ -64,22 +64,18 @@ lz_decoder_reset(lzma_coder *coder)
static lzma_ret
decode_buffer(lzma_coder *coder,
- const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
- size_t in_size, uint8_t *LZMA_RESTRICT out,
- size_t *LZMA_RESTRICT out_pos, size_t out_size)
+ const uint8_t *restrict in, size_t *restrict in_pos,
+ size_t in_size, uint8_t *restrict out,
+ size_t *restrict out_pos, size_t out_size)
{
while (true) {
- size_t copy_size;
- size_t dict_start;
- lzma_ret ret;
-
// Wrap the dictionary if needed.
if (coder->dict.pos == coder->dict.size)
coder->dict.pos = 0;
// Store the current dictionary position. It is needed to know
// where to start copying to the out[] buffer.
- dict_start = coder->dict.pos;
+ const size_t dict_start = coder->dict.pos;
// Calculate how much we allow coder->lz.code() to decode.
// It must not decode past the end of the dictionary
@@ -90,13 +86,13 @@ decode_buffer(lzma_coder *coder,
coder->dict.size - coder->dict.pos);
// Call the coder->lz.code() to do the actual decoding.
- ret = coder->lz.code(
+ const lzma_ret ret = coder->lz.code(
coder->lz.coder, &coder->dict,
in, in_pos, in_size);
// Copy the decoded data from the dictionary to the out[]
// buffer.
- copy_size = coder->dict.pos - dict_start;
+ const size_t copy_size = coder->dict.pos - dict_start;
assert(copy_size <= out_size - *out_pos);
memcpy(out + *out_pos, coder->dict.buf + dict_start,
copy_size);
@@ -129,13 +125,15 @@ decode_buffer(lzma_coder *coder,
static lzma_ret
-lz_decode(lzma_coder *coder,
- lzma_allocator *allocator lzma_attribute((__unused__)),
- const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
- size_t in_size, uint8_t *LZMA_RESTRICT out,
- size_t *LZMA_RESTRICT out_pos, size_t out_size,
+lz_decode(void *coder_ptr,
+ const lzma_allocator *allocator lzma_attribute((__unused__)),
+ const uint8_t *restrict in, size_t *restrict in_pos,
+ size_t in_size, uint8_t *restrict out,
+ size_t *restrict out_pos, size_t out_size,
lzma_action action)
{
+ lzma_coder *coder = coder_ptr;
+
if (coder->next.code == NULL)
return decode_buffer(coder, in, in_pos, in_size,
out, out_pos, out_size);
@@ -143,15 +141,13 @@ lz_decode(lzma_coder *coder,
// We aren't the last coder in the chain, we need to decode
// our input to a temporary buffer.
while (*out_pos < out_size) {
- lzma_ret ret;
-
// Fill the temporary buffer if it is empty.
if (!coder->next_finished
&& coder->temp.pos == coder->temp.size) {
coder->temp.pos = 0;
coder->temp.size = 0;
- ret = coder->next.code(
+ const lzma_ret ret = coder->next.code(
coder->next.coder,
allocator, in, in_pos, in_size,
coder->temp.buffer, &coder->temp.size,
@@ -173,7 +169,7 @@ lz_decode(lzma_coder *coder,
return LZMA_OK;
}
- ret = decode_buffer(coder, coder->temp.buffer,
+ const lzma_ret ret = decode_buffer(coder, coder->temp.buffer,
&coder->temp.pos, coder->temp.size,
out, out_pos, out_size);
@@ -190,8 +186,10 @@ lz_decode(lzma_coder *coder,
static void
-lz_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
+lz_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
{
+ lzma_coder *coder = coder_ptr;
+
lzma_next_end(&coder->next, allocator);
lzma_free(coder->dict.buf, allocator);
@@ -206,32 +204,33 @@ lz_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
extern lzma_ret
-lzma_lz_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_lz_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters,
lzma_ret (*lz_init)(lzma_lz_decoder *lz,
- lzma_allocator *allocator, const void *options,
+ const lzma_allocator *allocator, const void *options,
lzma_lz_options *lz_options))
{
- lzma_lz_options lz_options;
-
// Allocate the base structure if it isn't already allocated.
- if (next->coder == NULL) {
- next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
- if (next->coder == NULL)
+ lzma_coder *coder = next->coder;
+ if (coder == NULL) {
+ coder = lzma_alloc(sizeof(lzma_coder), allocator);
+ if (coder == NULL)
return LZMA_MEM_ERROR;
+ next->coder = coder;
next->code = &lz_decode;
next->end = &lz_decoder_end;
- next->coder->dict.buf = NULL;
- next->coder->dict.size = 0;
- next->coder->lz = LZMA_LZ_DECODER_INIT;
- next->coder->next = LZMA_NEXT_CODER_INIT;
+ coder->dict.buf = NULL;
+ coder->dict.size = 0;
+ coder->lz = LZMA_LZ_DECODER_INIT;
+ coder->next = LZMA_NEXT_CODER_INIT;
}
// Allocate and initialize the LZ-based decoder. It will also give
// us the dictionary size.
- return_if_error(lz_init(&next->coder->lz, allocator,
+ lzma_lz_options lz_options;
+ return_if_error(lz_init(&coder->lz, allocator,
filters[0].options, &lz_options));
// If the dictionary size is very small, increase it to 4096 bytes.
@@ -255,14 +254,14 @@ lzma_lz_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
lz_options.dict_size = (lz_options.dict_size + 15) & ~((size_t)(15));
// Allocate and initialize the dictionary.
- if (next->coder->dict.size != lz_options.dict_size) {
- lzma_free(next->coder->dict.buf, allocator);
- next->coder->dict.buf
+ if (coder->dict.size != lz_options.dict_size) {
+ lzma_free(coder->dict.buf, allocator);
+ coder->dict.buf
= lzma_alloc(lz_options.dict_size, allocator);
- if (next->coder->dict.buf == NULL)
+ if (coder->dict.buf == NULL)
return LZMA_MEM_ERROR;
- next->coder->dict.size = lz_options.dict_size;
+ coder->dict.size = lz_options.dict_size;
}
lz_decoder_reset(next->coder);
@@ -275,21 +274,20 @@ lzma_lz_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
const size_t copy_size = my_min(lz_options.preset_dict_size,
lz_options.dict_size);
const size_t offset = lz_options.preset_dict_size - copy_size;
- memcpy(next->coder->dict.buf, lz_options.preset_dict + offset,
+ memcpy(coder->dict.buf, lz_options.preset_dict + offset,
copy_size);
- next->coder->dict.pos = copy_size;
- next->coder->dict.full = copy_size;
+ coder->dict.pos = copy_size;
+ coder->dict.full = copy_size;
}
// Miscellaneous initializations
- next->coder->next_finished = false;
- next->coder->this_finished = false;
- next->coder->temp.pos = 0;
- next->coder->temp.size = 0;
+ coder->next_finished = false;
+ coder->this_finished = false;
+ coder->temp.pos = 0;
+ coder->temp.size = 0;
// Initialize the next filter in the chain, if any.
- return lzma_next_filter_init(&next->coder->next, allocator,
- filters + 1);
+ return lzma_next_filter_init(&coder->next, allocator, filters + 1);
}
@@ -301,7 +299,8 @@ lzma_lz_decoder_memusage(size_t dictionary_size)
extern void
-lzma_lz_decoder_uncompressed(lzma_coder *coder, lzma_vli uncompressed_size)
+lzma_lz_decoder_uncompressed(void *coder_ptr, lzma_vli uncompressed_size)
{
+ lzma_coder *coder = coder_ptr;
coder->lz.set_uncompressed(coder->lz.coder, uncompressed_size);
}
diff --git a/Utilities/cmliblzma/liblzma/lz/lz_decoder.h b/Utilities/cmliblzma/liblzma/lz/lz_decoder.h
index 76011f2..754ccf3 100644
--- a/Utilities/cmliblzma/liblzma/lz/lz_decoder.h
+++ b/Utilities/cmliblzma/liblzma/lz/lz_decoder.h
@@ -53,45 +53,45 @@ typedef struct {
typedef struct {
/// Data specific to the LZ-based decoder
- lzma_coder *coder;
+ void *coder;
/// Function to decode from in[] to *dict
- lzma_ret (*code)(lzma_coder *LZMA_RESTRICT coder,
- lzma_dict *LZMA_RESTRICT dict, const uint8_t *LZMA_RESTRICT in,
- size_t *LZMA_RESTRICT in_pos, size_t in_size);
+ lzma_ret (*code)(void *coder,
+ lzma_dict *restrict dict, const uint8_t *restrict in,
+ size_t *restrict in_pos, size_t in_size);
- void (*reset)(lzma_coder *coder, const void *options);
+ void (*reset)(void *coder, const void *options);
/// Set the uncompressed size
- void (*set_uncompressed)(lzma_coder *coder,
- lzma_vli uncompressed_size);
+ void (*set_uncompressed)(void *coder, lzma_vli uncompressed_size);
/// Free allocated resources
- void (*end)(lzma_coder *coder, lzma_allocator *allocator);
+ void (*end)(void *coder, const lzma_allocator *allocator);
} lzma_lz_decoder;
-static const lzma_lz_decoder LZMA_LZ_DECODER_INIT =
- {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- };
+#define LZMA_LZ_DECODER_INIT \
+ (lzma_lz_decoder){ \
+ .coder = NULL, \
+ .code = NULL, \
+ .reset = NULL, \
+ .set_uncompressed = NULL, \
+ .end = NULL, \
+ }
extern lzma_ret lzma_lz_decoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters,
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters,
lzma_ret (*lz_init)(lzma_lz_decoder *lz,
- lzma_allocator *allocator, const void *options,
+ const lzma_allocator *allocator, const void *options,
lzma_lz_options *lz_options));
extern uint64_t lzma_lz_decoder_memusage(size_t dictionary_size);
extern void lzma_lz_decoder_uncompressed(
- lzma_coder *coder, lzma_vli uncompressed_size);
+ void *coder, lzma_vli uncompressed_size);
//////////////////////
@@ -151,15 +151,13 @@ dict_repeat(lzma_dict *dict, uint32_t distance, uint32_t *len)
dict->pos += left;
} else {
- uint32_t copy_pos;
- uint32_t copy_size;
-
// The bigger the dictionary, the more rare this
// case occurs. We need to "wrap" the dict, thus
// we might need two memcpy() to copy all the data.
assert(dict->full == dict->size);
- copy_pos = dict->pos - distance - 1 + dict->size;
- copy_size = dict->size - copy_pos;
+ const uint32_t copy_pos
+ = dict->pos - distance - 1 + dict->size;
+ uint32_t copy_size = dict->size - copy_pos;
if (copy_size < left) {
memmove(dict->buf + dict->pos, dict->buf + copy_pos,
@@ -202,9 +200,9 @@ dict_put(lzma_dict *dict, uint8_t byte)
/// Copies arbitrary amount of data into the dictionary.
static inline void
-dict_write(lzma_dict *LZMA_RESTRICT dict, const uint8_t *LZMA_RESTRICT in,
- size_t *LZMA_RESTRICT in_pos, size_t in_size,
- size_t *LZMA_RESTRICT left)
+dict_write(lzma_dict *restrict dict, const uint8_t *restrict in,
+ size_t *restrict in_pos, size_t in_size,
+ size_t *restrict left)
{
// NOTE: If we are being given more data than the size of the
// dictionary, it could be possible to optimize the LZ decoder
diff --git a/Utilities/cmliblzma/liblzma/lz/lz_encoder.c b/Utilities/cmliblzma/liblzma/lz/lz_encoder.c
index 1dae924..9a74b7c 100644
--- a/Utilities/cmliblzma/liblzma/lz/lz_encoder.c
+++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder.c
@@ -20,8 +20,10 @@
# include "lz_encoder_hash_table.h"
#endif
+#include "memcmplen.h"
-struct lzma_coder_s {
+
+typedef struct {
/// LZ-based encoder e.g. LZMA
lzma_lz_encoder lz;
@@ -30,7 +32,7 @@ struct lzma_coder_s {
/// Next coder in the chain
lzma_next_coder next;
-};
+} lzma_coder;
/// \brief Moves the data in the input window to free space for new data
@@ -43,18 +45,16 @@ struct lzma_coder_s {
static void
move_window(lzma_mf *mf)
{
- uint32_t move_offset;
- size_t move_size;
-
// Align the move to a multiple of 16 bytes. Some LZ-based encoders
// like LZMA use the lowest bits of mf->read_pos to know the
// alignment of the uncompressed data. We also get better speed
// for memmove() with aligned buffers.
assert(mf->read_pos > mf->keep_size_before);
- move_offset = (mf->read_pos - mf->keep_size_before) & ~UINT32_C(15);
+ const uint32_t move_offset
+ = (mf->read_pos - mf->keep_size_before) & ~UINT32_C(15);
assert(mf->write_pos > move_offset);
- move_size = mf->write_pos - move_offset;
+ const size_t move_size = mf->write_pos - move_offset;
assert(move_offset + move_size <= mf->size);
@@ -78,12 +78,10 @@ move_window(lzma_mf *mf)
/// This function must not be called once it has returned LZMA_STREAM_END.
///
static lzma_ret
-fill_window(lzma_coder *coder, lzma_allocator *allocator, const uint8_t *in,
- size_t *in_pos, size_t in_size, lzma_action action)
+fill_window(lzma_coder *coder, const lzma_allocator *allocator,
+ const uint8_t *in, size_t *in_pos, size_t in_size,
+ lzma_action action)
{
- size_t write_pos;
- lzma_ret ret;
-
assert(coder->mf.read_pos <= coder->mf.write_pos);
// Move the sliding window if needed.
@@ -93,7 +91,8 @@ fill_window(lzma_coder *coder, lzma_allocator *allocator, const uint8_t *in,
// Maybe this is ugly, but lzma_mf uses uint32_t for most things
// (which I find cleanest), but we need size_t here when filling
// the history window.
- write_pos = coder->mf.write_pos;
+ size_t write_pos = coder->mf.write_pos;
+ lzma_ret ret;
if (coder->next.code == NULL) {
// Not using a filter, simply memcpy() as much as possible.
lzma_bufcpy(in, in_pos, in_size, coder->mf.buffer,
@@ -111,6 +110,12 @@ fill_window(lzma_coder *coder, lzma_allocator *allocator, const uint8_t *in,
coder->mf.write_pos = write_pos;
+ // Silence Valgrind. lzma_memcmplen() can read extra bytes
+ // and Valgrind will give warnings if those bytes are uninitialized
+ // because Valgrind cannot see that the values of the uninitialized
+ // bytes are eventually ignored.
+ memzero(coder->mf.buffer + write_pos, LZMA_MEMCMPLEN_EXTRA);
+
// If end of stream has been reached or flushing completed, we allow
// the encoder to process all the input (that is, read_pos is allowed
// to reach write_pos). Otherwise we keep keep_size_after bytes
@@ -134,7 +139,7 @@ fill_window(lzma_coder *coder, lzma_allocator *allocator, const uint8_t *in,
&& coder->mf.read_pos < coder->mf.read_limit) {
// Match finder may update coder->pending and expects it to
// start from zero, so use a temporary variable.
- const size_t pending = coder->mf.pending;
+ const uint32_t pending = coder->mf.pending;
coder->mf.pending = 0;
// Rewind read_pos so that the match finder can hash
@@ -152,16 +157,16 @@ fill_window(lzma_coder *coder, lzma_allocator *allocator, const uint8_t *in,
static lzma_ret
-lz_encode(lzma_coder *coder, lzma_allocator *allocator,
- const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
+lz_encode(void *coder_ptr, const lzma_allocator *allocator,
+ const uint8_t *restrict in, size_t *restrict in_pos,
size_t in_size,
- uint8_t *LZMA_RESTRICT out, size_t *LZMA_RESTRICT out_pos,
+ uint8_t *restrict out, size_t *restrict out_pos,
size_t out_size, lzma_action action)
{
+ lzma_coder *coder = coder_ptr;
+
while (*out_pos < out_size
&& (*in_pos < in_size || action != LZMA_RUN)) {
- lzma_ret ret;
-
// Read more data to coder->mf.buffer if needed.
if (coder->mf.action == LZMA_RUN && coder->mf.read_pos
>= coder->mf.read_limit)
@@ -169,7 +174,7 @@ lz_encode(lzma_coder *coder, lzma_allocator *allocator,
in, in_pos, in_size, action));
// Encode
- ret = coder->lz.code(coder->lz.coder,
+ const lzma_ret ret = coder->lz.code(coder->lz.coder,
&coder->mf, out, out_pos, out_size);
if (ret != LZMA_OK) {
// Setting this to LZMA_RUN for cases when we are
@@ -185,17 +190,9 @@ lz_encode(lzma_coder *coder, lzma_allocator *allocator,
static bool
-lz_encoder_prepare(lzma_mf *mf, lzma_allocator *allocator,
+lz_encoder_prepare(lzma_mf *mf, const lzma_allocator *allocator,
const lzma_lz_options *lz_options)
{
- bool is_bt;
- uint32_t new_count;
- uint32_t reserve;
- uint32_t old_size;
- uint32_t hash_bytes;
- uint32_t hs;
- uint32_t old_count;
-
// For now, the dictionary size is limited to 1.5 GiB. This may grow
// in the future if needed, but it needs a little more work than just
// changing this check.
@@ -221,14 +218,14 @@ lz_encoder_prepare(lzma_mf *mf, lzma_allocator *allocator,
// to size_t.
// - Memory usage calculation needs something too, e.g. use uint64_t
// for mf->size.
- reserve = lz_options->dict_size / 2;
+ uint32_t reserve = lz_options->dict_size / 2;
if (reserve > (UINT32_C(1) << 30))
reserve /= 2;
reserve += (lz_options->before_size + lz_options->match_len_max
+ lz_options->after_size) / 2 + (UINT32_C(1) << 19);
- old_size = mf->size;
+ const uint32_t old_size = mf->size;
mf->size = mf->keep_size_before + reserve + mf->keep_size_after;
// Deallocate the old history buffer if it exists but has different
@@ -298,11 +295,12 @@ lz_encoder_prepare(lzma_mf *mf, lzma_allocator *allocator,
// Calculate the sizes of mf->hash and mf->son and check that
// nice_len is big enough for the selected match finder.
- hash_bytes = lz_options->match_finder & 0x0F;
+ const uint32_t hash_bytes = lz_options->match_finder & 0x0F;
if (hash_bytes > mf->nice_len)
return true;
- is_bt = (lz_options->match_finder & 0x10) != 0;
+ const bool is_bt = (lz_options->match_finder & 0x10) != 0;
+ uint32_t hs;
if (hash_bytes == 2) {
hs = 0xFFFF;
@@ -338,25 +336,22 @@ lz_encoder_prepare(lzma_mf *mf, lzma_allocator *allocator,
hs += HASH_4_SIZE;
*/
- // If the above code calculating hs is modified, make sure that
- // this assertion stays valid (UINT32_MAX / 5 is not strictly the
- // exact limit). If it doesn't, you need to calculate that
- // hash_size_sum + sons_count cannot overflow.
- assert(hs < UINT32_MAX / 5);
-
- old_count = mf->hash_size_sum + mf->sons_count;
- mf->hash_size_sum = hs;
+ const uint32_t old_hash_count = mf->hash_count;
+ const uint32_t old_sons_count = mf->sons_count;
+ mf->hash_count = hs;
mf->sons_count = mf->cyclic_size;
if (is_bt)
mf->sons_count *= 2;
- new_count = mf->hash_size_sum + mf->sons_count;
-
// Deallocate the old hash array if it exists and has different size
// than what is needed now.
- if (old_count != new_count) {
+ if (old_hash_count != mf->hash_count
+ || old_sons_count != mf->sons_count) {
lzma_free(mf->hash, allocator);
mf->hash = NULL;
+
+ lzma_free(mf->son, allocator);
+ mf->son = NULL;
}
// Maximum number of match finder cycles
@@ -373,16 +368,23 @@ lz_encoder_prepare(lzma_mf *mf, lzma_allocator *allocator,
static bool
-lz_encoder_init(lzma_mf *mf, lzma_allocator *allocator,
+lz_encoder_init(lzma_mf *mf, const lzma_allocator *allocator,
const lzma_lz_options *lz_options)
{
- size_t alloc_count;
-
// Allocate the history buffer.
if (mf->buffer == NULL) {
- mf->buffer = lzma_alloc(mf->size, allocator);
+ // lzma_memcmplen() is used for the dictionary buffer
+ // so we need to allocate a few extra bytes to prevent
+ // it from reading past the end of the buffer.
+ mf->buffer = lzma_alloc(mf->size + LZMA_MEMCMPLEN_EXTRA,
+ allocator);
if (mf->buffer == NULL)
return true;
+
+ // Keep Valgrind happy with lzma_memcmplen() and initialize
+ // the extra bytes whose value may get read but which will
+ // effectively get ignored.
+ memzero(mf->buffer + mf->size, LZMA_MEMCMPLEN_EXTRA);
}
// Use cyclic_size as initial mf->offset. This allows
@@ -396,43 +398,48 @@ lz_encoder_init(lzma_mf *mf, lzma_allocator *allocator,
mf->write_pos = 0;
mf->pending = 0;
- // Allocate match finder's hash array.
- alloc_count = mf->hash_size_sum + mf->sons_count;
-
#if UINT32_MAX >= SIZE_MAX / 4
// Check for integer overflow. (Huge dictionaries are not
// possible on 32-bit CPU.)
- if (alloc_count > SIZE_MAX / sizeof(uint32_t))
+ if (mf->hash_count > SIZE_MAX / sizeof(uint32_t)
+ || mf->sons_count > SIZE_MAX / sizeof(uint32_t))
return true;
#endif
+ // Allocate and initialize the hash table. Since EMPTY_HASH_VALUE
+ // is zero, we can use lzma_alloc_zero() or memzero() for mf->hash.
+ //
+ // We don't need to initialize mf->son, but not doing that may
+ // make Valgrind complain in normalization (see normalize() in
+ // lz_encoder_mf.c). Skipping the initialization is *very* good
+ // when big dictionary is used but only small amount of data gets
+ // actually compressed: most of the mf->son won't get actually
+ // allocated by the kernel, so we avoid wasting RAM and improve
+ // initialization speed a lot.
if (mf->hash == NULL) {
- mf->hash = lzma_alloc(alloc_count * sizeof(uint32_t),
+ mf->hash = lzma_alloc_zero(mf->hash_count * sizeof(uint32_t),
+ allocator);
+ mf->son = lzma_alloc(mf->sons_count * sizeof(uint32_t),
allocator);
- if (mf->hash == NULL)
- return true;
- }
- mf->son = mf->hash + mf->hash_size_sum;
- mf->cyclic_pos = 0;
+ if (mf->hash == NULL || mf->son == NULL) {
+ lzma_free(mf->hash, allocator);
+ mf->hash = NULL;
+
+ lzma_free(mf->son, allocator);
+ mf->son = NULL;
- // Initialize the hash table. Since EMPTY_HASH_VALUE is zero, we
- // can use memset().
+ return true;
+ }
+ } else {
/*
- for (uint32_t i = 0; i < hash_size_sum; ++i)
- mf->hash[i] = EMPTY_HASH_VALUE;
+ for (uint32_t i = 0; i < mf->hash_count; ++i)
+ mf->hash[i] = EMPTY_HASH_VALUE;
*/
- memzero(mf->hash, (size_t)(mf->hash_size_sum) * sizeof(uint32_t));
+ memzero(mf->hash, mf->hash_count * sizeof(uint32_t));
+ }
- // We don't need to initialize mf->son, but not doing that will
- // make Valgrind complain in normalization (see normalize() in
- // lz_encoder_mf.c).
- //
- // Skipping this initialization is *very* good when big dictionary is
- // used but only small amount of data gets actually compressed: most
- // of the mf->hash won't get actually allocated by the kernel, so
- // we avoid wasting RAM and improve initialization speed a lot.
- //memzero(mf->son, (size_t)(mf->sons_count) * sizeof(uint32_t));
+ mf->cyclic_pos = 0;
// Handle preset dictionary.
if (lz_options->preset_dict != NULL
@@ -457,24 +464,32 @@ extern uint64_t
lzma_lz_encoder_memusage(const lzma_lz_options *lz_options)
{
// Old buffers must not exist when calling lz_encoder_prepare().
- lzma_mf mf = { NULL };
+ lzma_mf mf = {
+ .buffer = NULL,
+ .hash = NULL,
+ .son = NULL,
+ .hash_count = 0,
+ .sons_count = 0,
+ };
// Setup the size information into mf.
if (lz_encoder_prepare(&mf, NULL, lz_options))
return UINT64_MAX;
// Calculate the memory usage.
- return (uint64_t)(mf.hash_size_sum + mf.sons_count)
- * sizeof(uint32_t)
- + (uint64_t)(mf.size) + sizeof(lzma_coder);
+ return ((uint64_t)(mf.hash_count) + mf.sons_count) * sizeof(uint32_t)
+ + mf.size + sizeof(lzma_coder);
}
static void
-lz_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
+lz_encoder_end(void *coder_ptr, const lzma_allocator *allocator)
{
+ lzma_coder *coder = coder_ptr;
+
lzma_next_end(&coder->next, allocator);
+ lzma_free(coder->mf.son, allocator);
lzma_free(coder->mf.hash, allocator);
lzma_free(coder->mf.buffer, allocator);
@@ -489,10 +504,12 @@ lz_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
static lzma_ret
-lz_encoder_update(lzma_coder *coder, lzma_allocator *allocator,
+lz_encoder_update(void *coder_ptr, const lzma_allocator *allocator,
const lzma_filter *filters_null lzma_attribute((__unused__)),
const lzma_filter *reversed_filters)
{
+ lzma_coder *coder = coder_ptr;
+
if (coder->lz.options_update == NULL)
return LZMA_PROG_ERROR;
@@ -505,58 +522,63 @@ lz_encoder_update(lzma_coder *coder, lzma_allocator *allocator,
extern lzma_ret
-lzma_lz_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_lz_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters,
lzma_ret (*lz_init)(lzma_lz_encoder *lz,
- lzma_allocator *allocator, const void *options,
+ const lzma_allocator *allocator, const void *options,
lzma_lz_options *lz_options))
{
- lzma_lz_options lz_options;
-
#ifdef HAVE_SMALL
// We need that the CRC32 table has been initialized.
lzma_crc32_init();
#endif
// Allocate and initialize the base data structure.
- if (next->coder == NULL) {
- next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
- if (next->coder == NULL)
+ lzma_coder *coder = next->coder;
+ if (coder == NULL) {
+ coder = lzma_alloc(sizeof(lzma_coder), allocator);
+ if (coder == NULL)
return LZMA_MEM_ERROR;
+ next->coder = coder;
next->code = &lz_encode;
next->end = &lz_encoder_end;
next->update = &lz_encoder_update;
- next->coder->lz.coder = NULL;
- next->coder->lz.code = NULL;
- next->coder->lz.end = NULL;
-
- next->coder->mf.buffer = NULL;
- next->coder->mf.hash = NULL;
- next->coder->mf.hash_size_sum = 0;
- next->coder->mf.sons_count = 0;
-
- next->coder->next = LZMA_NEXT_CODER_INIT;
+ coder->lz.coder = NULL;
+ coder->lz.code = NULL;
+ coder->lz.end = NULL;
+
+ // mf.size is initialized to silence Valgrind
+ // when used on optimized binaries (GCC may reorder
+ // code in a way that Valgrind gets unhappy).
+ coder->mf.buffer = NULL;
+ coder->mf.size = 0;
+ coder->mf.hash = NULL;
+ coder->mf.son = NULL;
+ coder->mf.hash_count = 0;
+ coder->mf.sons_count = 0;
+
+ coder->next = LZMA_NEXT_CODER_INIT;
}
// Initialize the LZ-based encoder.
- return_if_error(lz_init(&next->coder->lz, allocator,
+ lzma_lz_options lz_options;
+ return_if_error(lz_init(&coder->lz, allocator,
filters[0].options, &lz_options));
- // Setup the size information into next->coder->mf and deallocate
+ // Setup the size information into coder->mf and deallocate
// old buffers if they have wrong size.
- if (lz_encoder_prepare(&next->coder->mf, allocator, &lz_options))
+ if (lz_encoder_prepare(&coder->mf, allocator, &lz_options))
return LZMA_OPTIONS_ERROR;
// Allocate new buffers if needed, and do the rest of
// the initialization.
- if (lz_encoder_init(&next->coder->mf, allocator, &lz_options))
+ if (lz_encoder_init(&coder->mf, allocator, &lz_options))
return LZMA_MEM_ERROR;
// Initialize the next filter in the chain, if any.
- return lzma_next_filter_init(&next->coder->next, allocator,
- filters + 1);
+ return lzma_next_filter_init(&coder->next, allocator, filters + 1);
}
diff --git a/Utilities/cmliblzma/liblzma/lz/lz_encoder.h b/Utilities/cmliblzma/liblzma/lz/lz_encoder.h
index dcb4b2c..426dcd8 100644
--- a/Utilities/cmliblzma/liblzma/lz/lz_encoder.h
+++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder.h
@@ -119,7 +119,7 @@ struct lzma_mf_s {
lzma_action action;
/// Number of elements in hash[]
- uint32_t hash_size_sum;
+ uint32_t hash_count;
/// Number of elements in son[]
uint32_t sons_count;
@@ -191,19 +191,18 @@ typedef struct {
typedef struct {
/// Data specific to the LZ-based encoder
- lzma_coder *coder;
+ void *coder;
/// Function to encode from *dict to out[]
- lzma_ret (*code)(lzma_coder *LZMA_RESTRICT coder,
- lzma_mf *LZMA_RESTRICT mf, uint8_t *LZMA_RESTRICT out,
- size_t *LZMA_RESTRICT out_pos, size_t out_size);
+ lzma_ret (*code)(void *coder,
+ lzma_mf *restrict mf, uint8_t *restrict out,
+ size_t *restrict out_pos, size_t out_size);
/// Free allocated resources
- void (*end)(lzma_coder *coder, lzma_allocator *allocator);
+ void (*end)(void *coder, const lzma_allocator *allocator);
/// Update the options in the middle of the encoding.
- lzma_ret (*options_update)(lzma_coder *coder,
- const lzma_filter *filter);
+ lzma_ret (*options_update)(void *coder, const lzma_filter *filter);
} lzma_lz_encoder;
@@ -218,7 +217,7 @@ typedef struct {
/// Get pointer to the first byte not ran through the match finder
-static inline uint8_t *
+static inline const uint8_t *
mf_ptr(const lzma_mf *mf)
{
return mf->buffer + mf->read_pos;
@@ -296,10 +295,10 @@ mf_read(lzma_mf *mf, uint8_t *out, size_t *out_pos, size_t out_size,
extern lzma_ret lzma_lz_encoder_init(
- lzma_next_coder *next, lzma_allocator *allocator,
+ lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters,
lzma_ret (*lz_init)(lzma_lz_encoder *lz,
- lzma_allocator *allocator, const void *options,
+ const lzma_allocator *allocator, const void *options,
lzma_lz_options *lz_options));
diff --git a/Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h b/Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h
index de17c54..342a333 100644
--- a/Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h
+++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder_hash.h
@@ -39,22 +39,25 @@
// Endianness doesn't matter in hash_2_calc() (no effect on the output).
#ifdef TUKLIB_FAST_UNALIGNED_ACCESS
# define hash_2_calc() \
- hash_value = *(const uint16_t *)(cur)
+ const uint32_t hash_value = *(const uint16_t *)(cur)
#else
# define hash_2_calc() \
- hash_value = (uint32_t)(cur[0]) | ((uint32_t)(cur[1]) << 8)
+ const uint32_t hash_value \
+ = (uint32_t)(cur[0]) | ((uint32_t)(cur[1]) << 8)
#endif
#define hash_3_calc() \
- temp = hash_table[cur[0]] ^ cur[1]; \
- hash_2_value = temp & HASH_2_MASK; \
- hash_value = (temp ^ ((uint32_t)(cur[2]) << 8)) & mf->hash_mask
+ const uint32_t temp = hash_table[cur[0]] ^ cur[1]; \
+ const uint32_t hash_2_value = temp & HASH_2_MASK; \
+ const uint32_t hash_value \
+ = (temp ^ ((uint32_t)(cur[2]) << 8)) & mf->hash_mask
#define hash_4_calc() \
- temp = hash_table[cur[0]] ^ cur[1]; \
- hash_2_value = temp & HASH_2_MASK; \
- hash_3_value = (temp ^ ((uint32_t)(cur[2]) << 8)) & HASH_3_MASK; \
- hash_value = (temp ^ ((uint32_t)(cur[2]) << 8) \
+ const uint32_t temp = hash_table[cur[0]] ^ cur[1]; \
+ const uint32_t hash_2_value = temp & HASH_2_MASK; \
+ const uint32_t hash_3_value \
+ = (temp ^ ((uint32_t)(cur[2]) << 8)) & HASH_3_MASK; \
+ const uint32_t hash_value = (temp ^ ((uint32_t)(cur[2]) << 8) \
^ (hash_table[cur[3]] << 5)) & mf->hash_mask
diff --git a/Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c b/Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c
index 50c3459..7852077 100644
--- a/Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c
+++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder_mf.c
@@ -13,6 +13,7 @@
#include "lz_encoder.h"
#include "lz_encoder_hash.h"
+#include "memcmplen.h"
/// \brief Find matches starting from the current byte
@@ -32,9 +33,8 @@ lzma_mf_find(lzma_mf *mf, uint32_t *count_ptr, lzma_match *matches)
if (count > 0) {
#ifndef NDEBUG
- uint32_t i;
// Validate the matches.
- for (i = 0; i < count; ++i) {
+ for (uint32_t i = 0; i < count; ++i) {
assert(matches[i].len <= mf->nice_len);
assert(matches[i].dist < mf->read_pos);
assert(memcmp(mf_ptr(mf) - 1,
@@ -50,9 +50,6 @@ lzma_mf_find(lzma_mf *mf, uint32_t *count_ptr, lzma_match *matches)
// If a match of maximum search length was found, try to
// extend the match to maximum possible length.
if (len_best == mf->nice_len) {
- uint8_t *p1;
- uint8_t *p2;
-
// The limit for the match length is either the
// maximum match length supported by the LZ-based
// encoder or the number of bytes left in the
@@ -63,15 +60,13 @@ lzma_mf_find(lzma_mf *mf, uint32_t *count_ptr, lzma_match *matches)
// Pointer to the byte we just ran through
// the match finder.
- p1 = mf_ptr(mf) - 1;
+ const uint8_t *p1 = mf_ptr(mf) - 1;
// Pointer to the beginning of the match. We need -1
// here because the match distances are zero based.
- p2 = p1 - matches[count - 1].dist - 1;
+ const uint8_t *p2 = p1 - matches[count - 1].dist - 1;
- while (len_best < limit
- && p1[len_best] == p2[len_best])
- ++len_best;
+ len_best = lzma_memcmplen(p1, p2, len_best, limit);
}
}
@@ -112,36 +107,35 @@ lzma_mf_find(lzma_mf *mf, uint32_t *count_ptr, lzma_match *matches)
static void
normalize(lzma_mf *mf)
{
- uint32_t i;
- uint32_t subvalue;
- uint32_t count;
- uint32_t *hash;
-
assert(mf->read_pos + mf->offset == MUST_NORMALIZE_POS);
// In future we may not want to touch the lowest bits, because there
// may be match finders that use larger resolution than one byte.
- subvalue = (MUST_NORMALIZE_POS - mf->cyclic_size);
+ const uint32_t subvalue
+ = (MUST_NORMALIZE_POS - mf->cyclic_size);
// & (~(UINT32_C(1) << 10) - 1);
- count = mf->hash_size_sum + mf->sons_count;
- hash = mf->hash;
-
- for (i = 0; i < count; ++i) {
+ for (uint32_t i = 0; i < mf->hash_count; ++i) {
// If the distance is greater than the dictionary size,
// we can simply mark the hash element as empty.
+ if (mf->hash[i] <= subvalue)
+ mf->hash[i] = EMPTY_HASH_VALUE;
+ else
+ mf->hash[i] -= subvalue;
+ }
+
+ for (uint32_t i = 0; i < mf->sons_count; ++i) {
+ // Do the same for mf->son.
//
- // NOTE: Only the first mf->hash_size_sum elements are
- // initialized for sure. There may be uninitialized elements
- // in mf->son. Since we go through both mf->hash and
- // mf->son here in normalization, Valgrind may complain
- // that the "if" below depends on uninitialized value. In
- // this case it is safe to ignore the warning. See also the
- // comments in lz_encoder_init() in lz_encoder.c.
- if (hash[i] <= subvalue)
- hash[i] = EMPTY_HASH_VALUE;
+ // NOTE: There may be uninitialized elements in mf->son.
+ // Valgrind may complain that the "if" below depends on
+ // an uninitialized value. In this case it is safe to ignore
+ // the warning. See also the comments in lz_encoder_init()
+ // in lz_encoder.c.
+ if (mf->son[i] <= subvalue)
+ mf->son[i] = EMPTY_HASH_VALUE;
else
- hash[i] -= subvalue;
+ mf->son[i] -= subvalue;
}
// Update offset to match the new locations.
@@ -204,14 +198,15 @@ move_pending(lzma_mf *mf)
move_pending(mf); \
ret_op; \
} \
- cur = mf_ptr(mf); \
- pos = mf->read_pos + mf->offset
+ const uint8_t *cur = mf_ptr(mf); \
+ const uint32_t pos = mf->read_pos + mf->offset
/// Header for find functions. "return 0" indicates that zero matches
/// were found.
#define header_find(is_bt, len_min) \
- header(is_bt, len_min, return 0)
+ header(is_bt, len_min, return 0); \
+ uint32_t matches_count = 0
/// Header for a loop in a skip function. "continue" tells to skip the rest
@@ -268,19 +263,15 @@ hc_find_func(
while (true) {
const uint32_t delta = pos - cur_match;
- const uint8_t *pb;
if (depth-- == 0 || delta >= cyclic_size)
return matches;
- pb = cur - delta;
+ const uint8_t *const pb = cur - delta;
cur_match = son[cyclic_pos - delta
+ (delta > cyclic_pos ? cyclic_size : 0)];
if (pb[len_best] == cur[len_best] && pb[0] == cur[0]) {
- uint32_t len = 0;
- while (++len != len_limit)
- if (pb[len] != cur[len])
- break;
+ uint32_t len = lzma_memcmplen(pb, cur, 1, len_limit);
if (len_best < len) {
len_best = len;
@@ -313,27 +304,21 @@ do { \
extern uint32_t
lzma_mf_hc3_find(lzma_mf *mf, lzma_match *matches)
{
- const uint8_t *cur;
- uint32_t pos;
- uint32_t temp, hash_value, hash_2_value; /* hash_3_calc */
- uint32_t delta2, cur_match;
- uint32_t len_best = 2;
- uint32_t matches_count = 0;
-
header_find(false, 3);
hash_3_calc();
- delta2 = pos - mf->hash[hash_2_value];
- cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value];
+ const uint32_t delta2 = pos - mf->hash[hash_2_value];
+ const uint32_t cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value];
mf->hash[hash_2_value] = pos;
mf->hash[FIX_3_HASH_SIZE + hash_value] = pos;
+ uint32_t len_best = 2;
+
if (delta2 < mf->cyclic_size && *(cur - delta2) == *cur) {
- for ( ; len_best != len_limit; ++len_best)
- if (*(cur + len_best - delta2) != cur[len_best])
- break;
+ len_best = lzma_memcmplen(cur - delta2, cur,
+ len_best, len_limit);
matches[0].len = len_best;
matches[0].dist = delta2 - 1;
@@ -353,22 +338,18 @@ extern void
lzma_mf_hc3_skip(lzma_mf *mf, uint32_t amount)
{
do {
- const uint8_t *cur;
- uint32_t pos;
- uint32_t temp, hash_value, hash_2_value; /* hash_3_calc */
- uint32_t cur_match;
-
if (mf_avail(mf) < 3) {
move_pending(mf);
continue;
}
- cur = mf_ptr(mf);
- pos = mf->read_pos + mf->offset;
+ const uint8_t *cur = mf_ptr(mf);
+ const uint32_t pos = mf->read_pos + mf->offset;
hash_3_calc();
- cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value];
+ const uint32_t cur_match
+ = mf->hash[FIX_3_HASH_SIZE + hash_value];
mf->hash[hash_2_value] = pos;
mf->hash[FIX_3_HASH_SIZE + hash_value] = pos;
@@ -384,25 +365,21 @@ lzma_mf_hc3_skip(lzma_mf *mf, uint32_t amount)
extern uint32_t
lzma_mf_hc4_find(lzma_mf *mf, lzma_match *matches)
{
- const uint8_t *cur;
- uint32_t pos;
- uint32_t temp, hash_value, hash_2_value, hash_3_value; /* hash_4_calc */
- uint32_t delta2, delta3, cur_match;
- uint32_t len_best = 1;
- uint32_t matches_count = 0;
-
header_find(false, 4);
hash_4_calc();
- delta2 = pos - mf->hash[hash_2_value];
- delta3 = pos - mf->hash[FIX_3_HASH_SIZE + hash_3_value];
- cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value];
+ uint32_t delta2 = pos - mf->hash[hash_2_value];
+ const uint32_t delta3
+ = pos - mf->hash[FIX_3_HASH_SIZE + hash_3_value];
+ const uint32_t cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value];
mf->hash[hash_2_value ] = pos;
mf->hash[FIX_3_HASH_SIZE + hash_3_value] = pos;
mf->hash[FIX_4_HASH_SIZE + hash_value] = pos;
+ uint32_t len_best = 1;
+
if (delta2 < mf->cyclic_size && *(cur - delta2) == *cur) {
len_best = 2;
matches[0].len = 2;
@@ -418,9 +395,8 @@ lzma_mf_hc4_find(lzma_mf *mf, lzma_match *matches)
}
if (matches_count != 0) {
- for ( ; len_best != len_limit; ++len_best)
- if (*(cur + len_best - delta2) != cur[len_best])
- break;
+ len_best = lzma_memcmplen(cur - delta2, cur,
+ len_best, len_limit);
matches[matches_count - 1].len = len_best;
@@ -441,22 +417,18 @@ extern void
lzma_mf_hc4_skip(lzma_mf *mf, uint32_t amount)
{
do {
- const uint8_t *cur;
- uint32_t pos;
- uint32_t temp, hash_value, hash_2_value, hash_3_value; /* hash_4_calc */
- uint32_t cur_match;
-
if (mf_avail(mf) < 4) {
move_pending(mf);
continue;
}
- cur = mf_ptr(mf);
- pos = mf->read_pos + mf->offset;
+ const uint8_t *cur = mf_ptr(mf);
+ const uint32_t pos = mf->read_pos + mf->offset;
hash_4_calc();
- cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value];
+ const uint32_t cur_match
+ = mf->hash[FIX_4_HASH_SIZE + hash_value];
mf->hash[hash_2_value] = pos;
mf->hash[FIX_3_HASH_SIZE + hash_3_value] = pos;
@@ -494,10 +466,6 @@ bt_find_func(
uint32_t len1 = 0;
while (true) {
- uint32_t *pair;
- const uint8_t *pb;
- uint32_t len;
-
const uint32_t delta = pos - cur_match;
if (depth-- == 0 || delta >= cyclic_size) {
*ptr0 = EMPTY_HASH_VALUE;
@@ -505,17 +473,15 @@ bt_find_func(
return matches;
}
- pair = son + ((cyclic_pos - delta
+ uint32_t *const pair = son + ((cyclic_pos - delta
+ (delta > cyclic_pos ? cyclic_size : 0))
<< 1);
- pb = cur - delta;
- len = my_min(len0, len1);
+ const uint8_t *const pb = cur - delta;
+ uint32_t len = my_min(len0, len1);
if (pb[len] == cur[len]) {
- while (++len != len_limit)
- if (pb[len] != cur[len])
- break;
+ len = lzma_memcmplen(pb, cur, len + 1, len_limit);
if (len_best < len) {
len_best = len;
@@ -564,10 +530,6 @@ bt_skip_func(
uint32_t len1 = 0;
while (true) {
- uint32_t *pair;
- const uint8_t *pb;
- uint32_t len;
-
const uint32_t delta = pos - cur_match;
if (depth-- == 0 || delta >= cyclic_size) {
*ptr0 = EMPTY_HASH_VALUE;
@@ -575,16 +537,14 @@ bt_skip_func(
return;
}
- pair = son + ((cyclic_pos - delta
+ uint32_t *pair = son + ((cyclic_pos - delta
+ (delta > cyclic_pos ? cyclic_size : 0))
<< 1);
- pb = cur - delta;
- len = my_min(len0, len1);
+ const uint8_t *pb = cur - delta;
+ uint32_t len = my_min(len0, len1);
if (pb[len] == cur[len]) {
- while (++len != len_limit)
- if (pb[len] != cur[len])
- break;
+ len = lzma_memcmplen(pb, cur, len + 1, len_limit);
if (len == len_limit) {
*ptr1 = pair[0];
@@ -626,17 +586,11 @@ do { \
extern uint32_t
lzma_mf_bt2_find(lzma_mf *mf, lzma_match *matches)
{
- const uint8_t *cur;
- uint32_t pos;
- uint32_t hash_value; /* hash_2_calc */
- uint32_t cur_match;
- uint32_t matches_count = 0;
-
header_find(true, 2);
hash_2_calc();
- cur_match = mf->hash[hash_value];
+ const uint32_t cur_match = mf->hash[hash_value];
mf->hash[hash_value] = pos;
bt_find(1);
@@ -647,16 +601,11 @@ extern void
lzma_mf_bt2_skip(lzma_mf *mf, uint32_t amount)
{
do {
- const uint8_t *cur;
- uint32_t pos;
- uint32_t hash_value; /* hash_2_calc */
- uint32_t cur_match;
-
header_skip(true, 2);
hash_2_calc();
- cur_match = mf->hash[hash_value];
+ const uint32_t cur_match = mf->hash[hash_value];
mf->hash[hash_value] = pos;
bt_skip();
@@ -670,27 +619,21 @@ lzma_mf_bt2_skip(lzma_mf *mf, uint32_t amount)
extern uint32_t
lzma_mf_bt3_find(lzma_mf *mf, lzma_match *matches)
{
- const uint8_t *cur;
- uint32_t pos;
- uint32_t temp, hash_value, hash_2_value; /* hash_3_calc */
- uint32_t delta2, cur_match;
- uint32_t len_best = 2;
- uint32_t matches_count = 0;
-
header_find(true, 3);
hash_3_calc();
- delta2 = pos - mf->hash[hash_2_value];
- cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value];
+ const uint32_t delta2 = pos - mf->hash[hash_2_value];
+ const uint32_t cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value];
mf->hash[hash_2_value] = pos;
mf->hash[FIX_3_HASH_SIZE + hash_value] = pos;
+ uint32_t len_best = 2;
+
if (delta2 < mf->cyclic_size && *(cur - delta2) == *cur) {
- for ( ; len_best != len_limit; ++len_best)
- if (*(cur + len_best - delta2) != cur[len_best])
- break;
+ len_best = lzma_memcmplen(
+ cur, cur - delta2, len_best, len_limit);
matches[0].len = len_best;
matches[0].dist = delta2 - 1;
@@ -710,16 +653,12 @@ extern void
lzma_mf_bt3_skip(lzma_mf *mf, uint32_t amount)
{
do {
- const uint8_t *cur;
- uint32_t pos;
- uint32_t temp, hash_value, hash_2_value; /* hash_3_calc */
- uint32_t cur_match;
-
header_skip(true, 3);
hash_3_calc();
- cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value];
+ const uint32_t cur_match
+ = mf->hash[FIX_3_HASH_SIZE + hash_value];
mf->hash[hash_2_value] = pos;
mf->hash[FIX_3_HASH_SIZE + hash_value] = pos;
@@ -735,25 +674,21 @@ lzma_mf_bt3_skip(lzma_mf *mf, uint32_t amount)
extern uint32_t
lzma_mf_bt4_find(lzma_mf *mf, lzma_match *matches)
{
- const uint8_t *cur;
- uint32_t pos;
- uint32_t temp, hash_value, hash_2_value, hash_3_value; /* hash_4_calc */
- uint32_t delta2, delta3, cur_match;
- uint32_t len_best = 1;
- uint32_t matches_count = 0;
-
header_find(true, 4);
hash_4_calc();
- delta2 = pos - mf->hash[hash_2_value];
- delta3 = pos - mf->hash[FIX_3_HASH_SIZE + hash_3_value];
- cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value];
+ uint32_t delta2 = pos - mf->hash[hash_2_value];
+ const uint32_t delta3
+ = pos - mf->hash[FIX_3_HASH_SIZE + hash_3_value];
+ const uint32_t cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value];
mf->hash[hash_2_value] = pos;
mf->hash[FIX_3_HASH_SIZE + hash_3_value] = pos;
mf->hash[FIX_4_HASH_SIZE + hash_value] = pos;
+ uint32_t len_best = 1;
+
if (delta2 < mf->cyclic_size && *(cur - delta2) == *cur) {
len_best = 2;
matches[0].len = 2;
@@ -769,9 +704,8 @@ lzma_mf_bt4_find(lzma_mf *mf, lzma_match *matches)
}
if (matches_count != 0) {
- for ( ; len_best != len_limit; ++len_best)
- if (*(cur + len_best - delta2) != cur[len_best])
- break;
+ len_best = lzma_memcmplen(
+ cur, cur - delta2, len_best, len_limit);
matches[matches_count - 1].len = len_best;
@@ -792,16 +726,12 @@ extern void
lzma_mf_bt4_skip(lzma_mf *mf, uint32_t amount)
{
do {
- const uint8_t *cur;
- uint32_t pos;
- uint32_t temp, hash_value, hash_2_value, hash_3_value; /* hash_4_calc */
- uint32_t cur_match;
-
header_skip(true, 4);
hash_4_calc();
- cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value];
+ const uint32_t cur_match
+ = mf->hash[FIX_4_HASH_SIZE + hash_value];
mf->hash[hash_2_value] = pos;
mf->hash[FIX_3_HASH_SIZE + hash_3_value] = pos;
diff --git a/Utilities/cmliblzma/liblzma/lzma/fastpos.h b/Utilities/cmliblzma/liblzma/lzma/fastpos.h
index 5a834d6..a3feea5 100644
--- a/Utilities/cmliblzma/liblzma/lzma/fastpos.h
+++ b/Utilities/cmliblzma/liblzma/lzma/fastpos.h
@@ -14,15 +14,15 @@
#ifndef LZMA_FASTPOS_H
#define LZMA_FASTPOS_H
-// LZMA encodes match distances (positions) by storing the highest two
-// bits using a six-bit value [0, 63], and then the missing lower bits.
-// Dictionary size is also stored using this encoding in the new .lzma
+// LZMA encodes match distances by storing the highest two bits using
+// a six-bit value [0, 63], and then the missing lower bits.
+// Dictionary size is also stored using this encoding in the .xz
// file format header.
//
// fastpos.h provides a way to quickly find out the correct six-bit
// values. The following table gives some examples of this encoding:
//
-// pos return
+// dist return
// 0 0
// 1 1
// 2 2
@@ -48,10 +48,10 @@
// Provided functions or macros
// ----------------------------
//
-// get_pos_slot(pos) is the basic version. get_pos_slot_2(pos)
-// assumes that pos >= FULL_DISTANCES, thus the result is at least
-// FULL_DISTANCES_BITS * 2. Using get_pos_slot(pos) instead of
-// get_pos_slot_2(pos) would give the same result, but get_pos_slot_2(pos)
+// get_dist_slot(dist) is the basic version. get_dist_slot_2(dist)
+// assumes that dist >= FULL_DISTANCES, thus the result is at least
+// FULL_DISTANCES_BITS * 2. Using get_dist_slot(dist) instead of
+// get_dist_slot_2(dist) would give the same result, but get_dist_slot_2(dist)
// should be tiny bit faster due to the assumption being made.
//
//
@@ -75,16 +75,15 @@
// on all systems I have tried. The size optimized version is sometimes
// slightly faster, but sometimes it is a lot slower.
-#include "config.h"
-
#ifdef HAVE_SMALL
-# define get_pos_slot(pos) ((pos) <= 4 ? (pos) : get_pos_slot_2(pos))
+# define get_dist_slot(dist) \
+ ((dist) <= 4 ? (dist) : get_dist_slot_2(dist))
static inline uint32_t
-get_pos_slot_2(uint32_t pos)
+get_dist_slot_2(uint32_t dist)
{
- const uint32_t i = bsr32(pos);
- return (i + i) + ((pos >> (i - 1)) & 1);
+ const uint32_t i = bsr32(dist);
+ return (i + i) + ((dist >> (i - 1)) & 1);
}
@@ -101,39 +100,39 @@ extern const uint8_t lzma_fastpos[1 << FASTPOS_BITS];
#define fastpos_limit(extra, n) \
(UINT32_C(1) << (FASTPOS_BITS + fastpos_shift(extra, n)))
-#define fastpos_result(pos, extra, n) \
- lzma_fastpos[(pos) >> fastpos_shift(extra, n)] \
+#define fastpos_result(dist, extra, n) \
+ lzma_fastpos[(dist) >> fastpos_shift(extra, n)] \
+ 2 * fastpos_shift(extra, n)
static inline uint32_t
-get_pos_slot(uint32_t pos)
+get_dist_slot(uint32_t dist)
{
// If it is small enough, we can pick the result directly from
// the precalculated table.
- if (pos < fastpos_limit(0, 0))
- return lzma_fastpos[pos];
+ if (dist < fastpos_limit(0, 0))
+ return lzma_fastpos[dist];
- if (pos < fastpos_limit(0, 1))
- return fastpos_result(pos, 0, 1);
+ if (dist < fastpos_limit(0, 1))
+ return fastpos_result(dist, 0, 1);
- return fastpos_result(pos, 0, 2);
+ return fastpos_result(dist, 0, 2);
}
#ifdef FULL_DISTANCES_BITS
static inline uint32_t
-get_pos_slot_2(uint32_t pos)
+get_dist_slot_2(uint32_t dist)
{
- assert(pos >= FULL_DISTANCES);
+ assert(dist >= FULL_DISTANCES);
- if (pos < fastpos_limit(FULL_DISTANCES_BITS - 1, 0))
- return fastpos_result(pos, FULL_DISTANCES_BITS - 1, 0);
+ if (dist < fastpos_limit(FULL_DISTANCES_BITS - 1, 0))
+ return fastpos_result(dist, FULL_DISTANCES_BITS - 1, 0);
- if (pos < fastpos_limit(FULL_DISTANCES_BITS - 1, 1))
- return fastpos_result(pos, FULL_DISTANCES_BITS - 1, 1);
+ if (dist < fastpos_limit(FULL_DISTANCES_BITS - 1, 1))
+ return fastpos_result(dist, FULL_DISTANCES_BITS - 1, 1);
- return fastpos_result(pos, FULL_DISTANCES_BITS - 1, 2);
+ return fastpos_result(dist, FULL_DISTANCES_BITS - 1, 2);
}
#endif
diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c b/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c
index bd2a737..878c870 100644
--- a/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c
+++ b/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.c
@@ -16,7 +16,7 @@
#include "lzma_decoder.h"
-struct lzma_coder_s {
+typedef struct {
enum sequence {
SEQ_CONTROL,
SEQ_UNCOMPRESSED_1,
@@ -50,14 +50,16 @@ struct lzma_coder_s {
bool need_dictionary_reset;
lzma_options_lzma options;
-};
+} lzma_lzma2_coder;
static lzma_ret
-lzma2_decode(lzma_coder *LZMA_RESTRICT coder, lzma_dict *LZMA_RESTRICT dict,
- const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
+lzma2_decode(void *coder_ptr, lzma_dict *restrict dict,
+ const uint8_t *restrict in, size_t *restrict in_pos,
size_t in_size)
{
+ lzma_lzma2_coder *restrict coder = coder_ptr;
+
// With SEQ_LZMA it is possible that no new input is needed to do
// some progress. The rest of the sequences assume that there is
// at least one byte of input.
@@ -209,8 +211,10 @@ lzma2_decode(lzma_coder *LZMA_RESTRICT coder, lzma_dict *LZMA_RESTRICT dict,
static void
-lzma2_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
+lzma2_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
{
+ lzma_lzma2_coder *coder = coder_ptr;
+
assert(coder->lzma.end == NULL);
lzma_free(coder->lzma.coder, allocator);
@@ -221,34 +225,36 @@ lzma2_decoder_end(lzma_coder *coder, lzma_allocator *allocator)
static lzma_ret
-lzma2_decoder_init(lzma_lz_decoder *lz, lzma_allocator *allocator,
+lzma2_decoder_init(lzma_lz_decoder *lz, const lzma_allocator *allocator,
const void *opt, lzma_lz_options *lz_options)
{
- const lzma_options_lzma *options = opt;
-
- if (lz->coder == NULL) {
- lz->coder = lzma_alloc(sizeof(lzma_coder), allocator);
- if (lz->coder == NULL)
+ lzma_lzma2_coder *coder = lz->coder;
+ if (coder == NULL) {
+ coder = lzma_alloc(sizeof(lzma_lzma2_coder), allocator);
+ if (coder == NULL)
return LZMA_MEM_ERROR;
+ lz->coder = coder;
lz->code = &lzma2_decode;
lz->end = &lzma2_decoder_end;
- lz->coder->lzma = LZMA_LZ_DECODER_INIT;
+ coder->lzma = LZMA_LZ_DECODER_INIT;
}
- lz->coder->sequence = SEQ_CONTROL;
- lz->coder->need_properties = true;
- lz->coder->need_dictionary_reset = options->preset_dict == NULL
+ const lzma_options_lzma *options = opt;
+
+ coder->sequence = SEQ_CONTROL;
+ coder->need_properties = true;
+ coder->need_dictionary_reset = options->preset_dict == NULL
|| options->preset_dict_size == 0;
- return lzma_lzma_decoder_create(&lz->coder->lzma,
+ return lzma_lzma_decoder_create(&coder->lzma,
allocator, options, lz_options);
}
extern lzma_ret
-lzma_lzma2_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_lzma2_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters)
{
// LZMA2 can only be the last filter in the chain. This is enforced
@@ -263,17 +269,15 @@ lzma_lzma2_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern uint64_t
lzma_lzma2_decoder_memusage(const void *options)
{
- return sizeof(lzma_coder)
+ return sizeof(lzma_lzma2_coder)
+ lzma_lzma_decoder_memusage_nocheck(options);
}
extern lzma_ret
-lzma_lzma2_props_decode(void **options, lzma_allocator *allocator,
+lzma_lzma2_props_decode(void **options, const lzma_allocator *allocator,
const uint8_t *props, size_t props_size)
{
- lzma_options_lzma *opt;
-
if (props_size != 1)
return LZMA_OPTIONS_ERROR;
@@ -285,7 +289,8 @@ lzma_lzma2_props_decode(void **options, lzma_allocator *allocator,
if (props[0] > 40)
return LZMA_OPTIONS_ERROR;
- opt = lzma_alloc(sizeof(lzma_options_lzma), allocator);
+ lzma_options_lzma *opt = lzma_alloc(
+ sizeof(lzma_options_lzma), allocator);
if (opt == NULL)
return LZMA_MEM_ERROR;
diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.h b/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.h
index fac4ac4..ef2dcbf 100644
--- a/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.h
+++ b/Utilities/cmliblzma/liblzma/lzma/lzma2_decoder.h
@@ -17,12 +17,13 @@
#include "common.h"
extern lzma_ret lzma_lzma2_decoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters);
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters);
extern uint64_t lzma_lzma2_decoder_memusage(const void *options);
extern lzma_ret lzma_lzma2_props_decode(
- void **options, lzma_allocator *allocator,
+ void **options, const lzma_allocator *allocator,
const uint8_t *props, size_t props_size);
#endif
diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c b/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c
index a3651a7..63588ee 100644
--- a/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c
+++ b/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.c
@@ -17,7 +17,7 @@
#include "lzma2_encoder.h"
-struct lzma_coder_s {
+typedef struct {
enum {
SEQ_INIT,
SEQ_LZMA_ENCODE,
@@ -27,7 +27,7 @@ struct lzma_coder_s {
} sequence;
/// LZMA encoder
- lzma_coder *lzma;
+ void *lzma;
/// LZMA options currently in use.
lzma_options_lzma opt_cur;
@@ -48,20 +48,19 @@ struct lzma_coder_s {
/// Buffer to hold the chunk header and LZMA compressed data
uint8_t buf[LZMA2_HEADER_MAX + LZMA2_CHUNK_MAX];
-};
+} lzma_lzma2_coder;
static void
-lzma2_header_lzma(lzma_coder *coder)
+lzma2_header_lzma(lzma_lzma2_coder *coder)
{
- size_t pos;
- size_t size;
-
assert(coder->uncompressed_size > 0);
assert(coder->uncompressed_size <= LZMA2_UNCOMPRESSED_MAX);
assert(coder->compressed_size > 0);
assert(coder->compressed_size <= LZMA2_CHUNK_MAX);
+ size_t pos;
+
if (coder->need_properties) {
pos = 0;
@@ -82,7 +81,7 @@ lzma2_header_lzma(lzma_coder *coder)
coder->buf_pos = pos;
// Uncompressed size
- size = coder->uncompressed_size - 1;
+ size_t size = coder->uncompressed_size - 1;
coder->buf[pos++] += size >> 16;
coder->buf[pos++] = (size >> 8) & 0xFF;
coder->buf[pos++] = size & 0xFF;
@@ -109,7 +108,7 @@ lzma2_header_lzma(lzma_coder *coder)
static void
-lzma2_header_uncompressed(lzma_coder *coder)
+lzma2_header_uncompressed(lzma_lzma2_coder *coder)
{
assert(coder->uncompressed_size > 0);
assert(coder->uncompressed_size <= LZMA2_CHUNK_MAX);
@@ -134,10 +133,12 @@ lzma2_header_uncompressed(lzma_coder *coder)
static lzma_ret
-lzma2_encode(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
- uint8_t *LZMA_RESTRICT out, size_t *LZMA_RESTRICT out_pos,
+lzma2_encode(void *coder_ptr, lzma_mf *restrict mf,
+ uint8_t *restrict out, size_t *restrict out_pos,
size_t out_size)
{
+ lzma_lzma2_coder *restrict coder = coder_ptr;
+
while (*out_pos < out_size)
switch (coder->sequence) {
case SEQ_INIT:
@@ -163,9 +164,6 @@ lzma2_encode(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
// Fall through
case SEQ_LZMA_ENCODE: {
- uint32_t read_start;
- lzma_ret ret;
-
// Calculate how much more uncompressed data this chunk
// could accept.
const uint32_t left = LZMA2_UNCOMPRESSED_MAX
@@ -186,10 +184,10 @@ lzma2_encode(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
// Save the start position so that we can update
// coder->uncompressed_size.
- read_start = mf->read_pos - mf->read_ahead;
+ const uint32_t read_start = mf->read_pos - mf->read_ahead;
// Call the LZMA encoder until the chunk is finished.
- ret = lzma_lzma_encode(coder->lzma, mf,
+ const lzma_ret ret = lzma_lzma_encode(coder->lzma, mf,
coder->buf + LZMA2_HEADER_MAX,
&coder->compressed_size,
LZMA2_CHUNK_MAX, limit);
@@ -266,8 +264,9 @@ lzma2_encode(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
static void
-lzma2_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
+lzma2_encoder_end(void *coder_ptr, const lzma_allocator *allocator)
{
+ lzma_lzma2_coder *coder = coder_ptr;
lzma_free(coder->lzma, allocator);
lzma_free(coder, allocator);
return;
@@ -275,9 +274,9 @@ lzma2_encoder_end(lzma_coder *coder, lzma_allocator *allocator)
static lzma_ret
-lzma2_encoder_options_update(lzma_coder *coder, const lzma_filter *filter)
+lzma2_encoder_options_update(void *coder_ptr, const lzma_filter *filter)
{
- lzma_options_lzma *opt;
+ lzma_lzma2_coder *coder = coder_ptr;
// New options can be set only when there is no incomplete chunk.
// This is the case at the beginning of the raw stream and right
@@ -287,7 +286,7 @@ lzma2_encoder_options_update(lzma_coder *coder, const lzma_filter *filter)
// Look if there are new options. At least for now,
// only lc/lp/pb can be changed.
- opt = filter->options;
+ const lzma_options_lzma *opt = filter->options;
if (coder->opt_cur.lc != opt->lc || coder->opt_cur.lp != opt->lp
|| coder->opt_cur.pb != opt->pb) {
// Validate the options.
@@ -310,36 +309,38 @@ lzma2_encoder_options_update(lzma_coder *coder, const lzma_filter *filter)
static lzma_ret
-lzma2_encoder_init(lzma_lz_encoder *lz, lzma_allocator *allocator,
+lzma2_encoder_init(lzma_lz_encoder *lz, const lzma_allocator *allocator,
const void *options, lzma_lz_options *lz_options)
{
if (options == NULL)
return LZMA_PROG_ERROR;
- if (lz->coder == NULL) {
- lz->coder = lzma_alloc(sizeof(lzma_coder), allocator);
- if (lz->coder == NULL)
+ lzma_lzma2_coder *coder = lz->coder;
+ if (coder == NULL) {
+ coder = lzma_alloc(sizeof(lzma_lzma2_coder), allocator);
+ if (coder == NULL)
return LZMA_MEM_ERROR;
+ lz->coder = coder;
lz->code = &lzma2_encode;
lz->end = &lzma2_encoder_end;
lz->options_update = &lzma2_encoder_options_update;
- lz->coder->lzma = NULL;
+ coder->lzma = NULL;
}
- lz->coder->opt_cur = *(const lzma_options_lzma *)(options);
+ coder->opt_cur = *(const lzma_options_lzma *)(options);
- lz->coder->sequence = SEQ_INIT;
- lz->coder->need_properties = true;
- lz->coder->need_state_reset = false;
- lz->coder->need_dictionary_reset
- = lz->coder->opt_cur.preset_dict == NULL
- || lz->coder->opt_cur.preset_dict_size == 0;
+ coder->sequence = SEQ_INIT;
+ coder->need_properties = true;
+ coder->need_state_reset = false;
+ coder->need_dictionary_reset
+ = coder->opt_cur.preset_dict == NULL
+ || coder->opt_cur.preset_dict_size == 0;
// Initialize LZMA encoder
- return_if_error(lzma_lzma_encoder_create(&lz->coder->lzma, allocator,
- &lz->coder->opt_cur, lz_options));
+ return_if_error(lzma_lzma_encoder_create(&coder->lzma, allocator,
+ &coder->opt_cur, lz_options));
// Make sure that we will always have enough history available in
// case we need to use uncompressed chunks. They are used when the
@@ -355,7 +356,7 @@ lzma2_encoder_init(lzma_lz_encoder *lz, lzma_allocator *allocator,
extern lzma_ret
-lzma_lzma2_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_lzma2_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters)
{
return lzma_lz_encoder_init(
@@ -370,7 +371,7 @@ lzma_lzma2_encoder_memusage(const void *options)
if (lzma_mem == UINT64_MAX)
return UINT64_MAX;
- return sizeof(lzma_coder) + lzma_mem;
+ return sizeof(lzma_lzma2_coder) + lzma_mem;
}
@@ -393,7 +394,17 @@ lzma_lzma2_props_encode(const void *options, uint8_t *out)
if (d == UINT32_MAX)
out[0] = 40;
else
- out[0] = get_pos_slot(d + 1) - 24;
+ out[0] = get_dist_slot(d + 1) - 24;
return LZMA_OK;
}
+
+
+extern uint64_t
+lzma_lzma2_block_size(const void *options)
+{
+ const lzma_options_lzma *const opt = options;
+
+ // Use at least 1 MiB to keep compression ratio better.
+ return my_max((uint64_t)(opt->dict_size) * 3, UINT64_C(1) << 20);
+}
diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.h b/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.h
index ca19ef4..515f183 100644
--- a/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.h
+++ b/Utilities/cmliblzma/liblzma/lzma/lzma2_encoder.h
@@ -31,11 +31,13 @@
extern lzma_ret lzma_lzma2_encoder_init(
- lzma_next_coder *next, lzma_allocator *allocator,
+ lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters);
extern uint64_t lzma_lzma2_encoder_memusage(const void *options);
extern lzma_ret lzma_lzma2_props_encode(const void *options, uint8_t *out);
+extern uint64_t lzma_lzma2_block_size(const void *options);
+
#endif
diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_common.h b/Utilities/cmliblzma/liblzma/lzma/lzma_common.h
index 36267dc..09efd38 100644
--- a/Utilities/cmliblzma/liblzma/lzma/lzma_common.h
+++ b/Utilities/cmliblzma/liblzma/lzma/lzma_common.h
@@ -129,15 +129,12 @@ static inline void
literal_init(probability (*probs)[LITERAL_CODER_SIZE],
uint32_t lc, uint32_t lp)
{
- uint32_t coders;
- uint32_t i, j;
-
assert(lc + lp <= LZMA_LCLP_MAX);
- coders = 1U << (lc + lp);
+ const uint32_t coders = 1U << (lc + lp);
- for (i = 0; i < coders; ++i)
- for (j = 0; j < LITERAL_CODER_SIZE; ++j)
+ for (uint32_t i = 0; i < coders; ++i)
+ for (uint32_t j = 0; j < LITERAL_CODER_SIZE; ++j)
bit_reset(probs[i][j]);
return;
@@ -174,53 +171,54 @@ literal_init(probability (*probs)[LITERAL_CODER_SIZE],
// Match distance //
////////////////////
-// Different set of probabilities is used for match distances that have very
+// Different sets of probabilities are used for match distances that have very
// short match length: Lengths of 2, 3, and 4 bytes have a separate set of
// probabilities for each length. The matches with longer length use a shared
// set of probabilities.
-#define LEN_TO_POS_STATES 4
+#define DIST_STATES 4
// Macro to get the index of the appropriate probability array.
-#define get_len_to_pos_state(len) \
- ((len) < LEN_TO_POS_STATES + MATCH_LEN_MIN \
+#define get_dist_state(len) \
+ ((len) < DIST_STATES + MATCH_LEN_MIN \
? (len) - MATCH_LEN_MIN \
- : LEN_TO_POS_STATES - 1)
+ : DIST_STATES - 1)
-// The highest two bits of a match distance (pos slot) are encoded using six
-// bits. See fastpos.h for more explanation.
-#define POS_SLOT_BITS 6
-#define POS_SLOTS (1 << POS_SLOT_BITS)
+// The highest two bits of a match distance (distance slot) are encoded
+// using six bits. See fastpos.h for more explanation.
+#define DIST_SLOT_BITS 6
+#define DIST_SLOTS (1 << DIST_SLOT_BITS)
// Match distances up to 127 are fully encoded using probabilities. Since
-// the highest two bits (pos slot) are always encoded using six bits, the
-// distances 0-3 don't need any additional bits to encode, since the pos
-// slot itself is the same as the actual distance. START_POS_MODEL_INDEX
-// indicates the first pos slot where at least one additional bit is needed.
-#define START_POS_MODEL_INDEX 4
+// the highest two bits (distance slot) are always encoded using six bits,
+// the distances 0-3 don't need any additional bits to encode, since the
+// distance slot itself is the same as the actual distance. DIST_MODEL_START
+// indicates the first distance slot where at least one additional bit is
+// needed.
+#define DIST_MODEL_START 4
// Match distances greater than 127 are encoded in three pieces:
-// - pos slot: the highest two bits
+// - distance slot: the highest two bits
// - direct bits: 2-26 bits below the highest two bits
// - alignment bits: four lowest bits
//
// Direct bits don't use any probabilities.
//
-// The pos slot value of 14 is for distances 128-191 (see the table in
+// The distance slot value of 14 is for distances 128-191 (see the table in
// fastpos.h to understand why).
-#define END_POS_MODEL_INDEX 14
+#define DIST_MODEL_END 14
-// Pos slots that indicate a distance <= 127.
-#define FULL_DISTANCES_BITS (END_POS_MODEL_INDEX / 2)
+// Distance slots that indicate a distance <= 127.
+#define FULL_DISTANCES_BITS (DIST_MODEL_END / 2)
#define FULL_DISTANCES (1 << FULL_DISTANCES_BITS)
// For match distances greater than 127, only the highest two bits and the
// lowest four bits (alignment) is encoded using probabilities.
#define ALIGN_BITS 4
-#define ALIGN_TABLE_SIZE (1 << ALIGN_BITS)
-#define ALIGN_MASK (ALIGN_TABLE_SIZE - 1)
+#define ALIGN_SIZE (1 << ALIGN_BITS)
+#define ALIGN_MASK (ALIGN_SIZE - 1)
// LZMA remembers the four most recent match distances. Reusing these distances
// tends to take less space than re-encoding the actual distance value.
-#define REP_DISTANCES 4
+#define REPS 4
#endif
diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c b/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c
index 3c0f393..d0f29b7 100644
--- a/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c
+++ b/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.c
@@ -16,6 +16,12 @@
#include "lzma_decoder.h"
#include "range_decoder.h"
+// The macros unroll loops with switch statements.
+// Silence warnings about missing fall-through comments.
+#if TUKLIB_GNUC_REQ(7, 0)
+# pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
+#endif
+
#ifdef HAVE_SMALL
@@ -114,33 +120,33 @@ do { \
case seq ## _CHOICE: \
rc_if_0(ld.choice, seq ## _CHOICE) { \
rc_update_0(ld.choice); \
- rc_bit_case(ld.low[pos_state][symbol], 0, 0, seq ## _LOW0); \
- rc_bit_case(ld.low[pos_state][symbol], 0, 0, seq ## _LOW1); \
- rc_bit_case(ld.low[pos_state][symbol], 0, 0, seq ## _LOW2); \
+ rc_bit_case(ld.low[pos_state][symbol], , , seq ## _LOW0); \
+ rc_bit_case(ld.low[pos_state][symbol], , , seq ## _LOW1); \
+ rc_bit_case(ld.low[pos_state][symbol], , , seq ## _LOW2); \
target = symbol - LEN_LOW_SYMBOLS + MATCH_LEN_MIN; \
} else { \
rc_update_1(ld.choice); \
case seq ## _CHOICE2: \
rc_if_0(ld.choice2, seq ## _CHOICE2) { \
rc_update_0(ld.choice2); \
- rc_bit_case(ld.mid[pos_state][symbol], 0, 0, \
+ rc_bit_case(ld.mid[pos_state][symbol], , , \
seq ## _MID0); \
- rc_bit_case(ld.mid[pos_state][symbol], 0, 0, \
+ rc_bit_case(ld.mid[pos_state][symbol], , , \
seq ## _MID1); \
- rc_bit_case(ld.mid[pos_state][symbol], 0, 0, \
+ rc_bit_case(ld.mid[pos_state][symbol], , , \
seq ## _MID2); \
target = symbol - LEN_MID_SYMBOLS \
+ MATCH_LEN_MIN + LEN_LOW_SYMBOLS; \
} else { \
rc_update_1(ld.choice2); \
- rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH0); \
- rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH1); \
- rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH2); \
- rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH3); \
- rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH4); \
- rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH5); \
- rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH6); \
- rc_bit_case(ld.high[symbol], 0, 0, seq ## _HIGH7); \
+ rc_bit_case(ld.high[symbol], , , seq ## _HIGH0); \
+ rc_bit_case(ld.high[symbol], , , seq ## _HIGH1); \
+ rc_bit_case(ld.high[symbol], , , seq ## _HIGH2); \
+ rc_bit_case(ld.high[symbol], , , seq ## _HIGH3); \
+ rc_bit_case(ld.high[symbol], , , seq ## _HIGH4); \
+ rc_bit_case(ld.high[symbol], , , seq ## _HIGH5); \
+ rc_bit_case(ld.high[symbol], , , seq ## _HIGH6); \
+ rc_bit_case(ld.high[symbol], , , seq ## _HIGH7); \
target = symbol - LEN_HIGH_SYMBOLS \
+ MATCH_LEN_MIN \
+ LEN_LOW_SYMBOLS + LEN_MID_SYMBOLS; \
@@ -161,7 +167,7 @@ typedef struct {
} lzma_length_decoder;
-struct lzma_coder_s {
+typedef struct {
///////////////////
// Probabilities //
///////////////////
@@ -193,15 +199,15 @@ struct lzma_coder_s {
/// Probability tree for the highest two bits of the match distance.
/// There is a separate probability tree for match lengths of
/// 2 (i.e. MATCH_LEN_MIN), 3, 4, and [5, 273].
- probability pos_slot[LEN_TO_POS_STATES][POS_SLOTS];
+ probability dist_slot[DIST_STATES][DIST_SLOTS];
/// Probability trees for additional bits for match distance when the
/// distance is in the range [4, 127].
- probability pos_special[FULL_DISTANCES - END_POS_MODEL_INDEX];
+ probability pos_special[FULL_DISTANCES - DIST_MODEL_END];
/// Probability tree for the lowest four bits of a match distance
/// that is equal to or greater than 128.
- probability pos_align[ALIGN_TABLE_SIZE];
+ probability pos_align[ALIGN_SIZE];
/// Length of a normal match
lzma_length_decoder match_len_decoder;
@@ -245,8 +251,8 @@ struct lzma_coder_s {
SEQ_LITERAL_WRITE,
SEQ_IS_REP,
seq_len(SEQ_MATCH_LEN),
- seq_6(SEQ_POS_SLOT),
- SEQ_POS_MODEL,
+ seq_6(SEQ_DIST_SLOT),
+ SEQ_DIST_MODEL,
SEQ_DIRECT,
seq_4(SEQ_ALIGN),
SEQ_EOPM,
@@ -277,14 +283,27 @@ struct lzma_coder_s {
/// If decoding a literal: match byte.
/// If decoding a match: length of the match.
uint32_t len;
-};
+} lzma_lzma1_decoder;
static lzma_ret
-lzma_decode(lzma_coder *LZMA_RESTRICT coder, lzma_dict *LZMA_RESTRICT dictptr,
- const uint8_t *LZMA_RESTRICT in,
- size_t *LZMA_RESTRICT in_pos, size_t in_size)
+lzma_decode(void *coder_ptr, lzma_dict *restrict dictptr,
+ const uint8_t *restrict in,
+ size_t *restrict in_pos, size_t in_size)
{
+ lzma_lzma1_decoder *restrict coder = coder_ptr;
+
+ ////////////////////
+ // Initialization //
+ ////////////////////
+
+ {
+ const lzma_ret ret = rc_read_init(
+ &coder->rc, in, in_pos, in_size);
+ if (ret != LZMA_STREAM_END)
+ return ret;
+ }
+
///////////////
// Variables //
///////////////
@@ -331,16 +350,6 @@ lzma_decode(lzma_coder *LZMA_RESTRICT coder, lzma_dict *LZMA_RESTRICT dictptr,
if (no_eopm && coder->uncompressed_size < dict.limit - dict.pos)
dict.limit = dict.pos + (size_t)(coder->uncompressed_size);
- ////////////////////
- // Initialization //
- ////////////////////
-
- if (!rc_read_init(&coder->rc, in, in_pos, in_size))
- return LZMA_OK;
-
- rc = coder->rc;
- rc_in_pos = *in_pos;
-
// The main decoder loop. The "switch" is used to restart the decoder at
// correct location. Once restarted, the "switch" is no longer used.
switch (coder->sequence)
@@ -356,21 +365,6 @@ lzma_decode(lzma_coder *LZMA_RESTRICT coder, lzma_dict *LZMA_RESTRICT dictptr,
break;
rc_if_0(coder->is_match[state][pos_state], SEQ_IS_MATCH) {
- static const lzma_lzma_state next_state[] = {
- STATE_LIT_LIT,
- STATE_LIT_LIT,
- STATE_LIT_LIT,
- STATE_LIT_LIT,
- STATE_MATCH_LIT_LIT,
- STATE_REP_LIT_LIT,
- STATE_SHORTREP_LIT_LIT,
- STATE_MATCH_LIT,
- STATE_REP_LIT,
- STATE_SHORTREP_LIT,
- STATE_MATCH_LIT,
- STATE_REP_LIT
- };
-
rc_update_0(coder->is_match[state][pos_state]);
// It's a literal i.e. a single 8-bit byte.
@@ -388,21 +382,16 @@ lzma_decode(lzma_coder *LZMA_RESTRICT coder, lzma_dict *LZMA_RESTRICT dictptr,
rc_bit(probs[symbol], , , SEQ_LITERAL);
} while (symbol < (1 << 8));
#else
- rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL0);
- rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL1);
- rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL2);
- rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL3);
- rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL4);
- rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL5);
- rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL6);
- rc_bit_case(probs[symbol], 0, 0, SEQ_LITERAL7);
+ rc_bit_case(probs[symbol], , , SEQ_LITERAL0);
+ rc_bit_case(probs[symbol], , , SEQ_LITERAL1);
+ rc_bit_case(probs[symbol], , , SEQ_LITERAL2);
+ rc_bit_case(probs[symbol], , , SEQ_LITERAL3);
+ rc_bit_case(probs[symbol], , , SEQ_LITERAL4);
+ rc_bit_case(probs[symbol], , , SEQ_LITERAL5);
+ rc_bit_case(probs[symbol], , , SEQ_LITERAL6);
+ rc_bit_case(probs[symbol], , , SEQ_LITERAL7);
#endif
} else {
-#ifndef HAVE_SMALL
- uint32_t match_bit;
- uint32_t subcoder_index;
-#endif
-
// Decode literal with match byte.
//
// We store the byte we compare against
@@ -441,6 +430,8 @@ lzma_decode(lzma_coder *LZMA_RESTRICT coder, lzma_dict *LZMA_RESTRICT dictptr,
} while (symbol < (1 << 8));
#else
// Unroll the loop.
+ uint32_t match_bit;
+ uint32_t subcoder_index;
# define d(seq) \
case seq: \
@@ -474,6 +465,20 @@ lzma_decode(lzma_coder *LZMA_RESTRICT coder, lzma_dict *LZMA_RESTRICT dictptr,
// Use a lookup table to update to literal state,
// since compared to other state updates, this would
// need two branches.
+ static const lzma_lzma_state next_state[] = {
+ STATE_LIT_LIT,
+ STATE_LIT_LIT,
+ STATE_LIT_LIT,
+ STATE_LIT_LIT,
+ STATE_MATCH_LIT_LIT,
+ STATE_REP_LIT_LIT,
+ STATE_SHORTREP_LIT_LIT,
+ STATE_MATCH_LIT,
+ STATE_REP_LIT,
+ STATE_SHORTREP_LIT,
+ STATE_MATCH_LIT,
+ STATE_REP_LIT
+ };
state = next_state[state];
case SEQ_LITERAL_WRITE:
@@ -509,28 +514,28 @@ lzma_decode(lzma_coder *LZMA_RESTRICT coder, lzma_dict *LZMA_RESTRICT dictptr,
// Prepare to decode the highest two bits of the
// match distance.
- probs = coder->pos_slot[get_len_to_pos_state(len)];
+ probs = coder->dist_slot[get_dist_state(len)];
symbol = 1;
#ifdef HAVE_SMALL
- case SEQ_POS_SLOT:
+ case SEQ_DIST_SLOT:
do {
- rc_bit(probs[symbol], , , SEQ_POS_SLOT);
- } while (symbol < POS_SLOTS);
+ rc_bit(probs[symbol], , , SEQ_DIST_SLOT);
+ } while (symbol < DIST_SLOTS);
#else
- rc_bit_case(probs[symbol], 0, 0, SEQ_POS_SLOT0);
- rc_bit_case(probs[symbol], 0, 0, SEQ_POS_SLOT1);
- rc_bit_case(probs[symbol], 0, 0, SEQ_POS_SLOT2);
- rc_bit_case(probs[symbol], 0, 0, SEQ_POS_SLOT3);
- rc_bit_case(probs[symbol], 0, 0, SEQ_POS_SLOT4);
- rc_bit_case(probs[symbol], 0, 0, SEQ_POS_SLOT5);
+ rc_bit_case(probs[symbol], , , SEQ_DIST_SLOT0);
+ rc_bit_case(probs[symbol], , , SEQ_DIST_SLOT1);
+ rc_bit_case(probs[symbol], , , SEQ_DIST_SLOT2);
+ rc_bit_case(probs[symbol], , , SEQ_DIST_SLOT3);
+ rc_bit_case(probs[symbol], , , SEQ_DIST_SLOT4);
+ rc_bit_case(probs[symbol], , , SEQ_DIST_SLOT5);
#endif
// Get rid of the highest bit that was needed for
// indexing of the probability array.
- symbol -= POS_SLOTS;
+ symbol -= DIST_SLOTS;
assert(symbol <= 63);
- if (symbol < START_POS_MODEL_INDEX) {
+ if (symbol < DIST_MODEL_START) {
// Match distances [0, 3] have only two bits.
rep0 = symbol;
} else {
@@ -540,7 +545,7 @@ lzma_decode(lzma_coder *LZMA_RESTRICT coder, lzma_dict *LZMA_RESTRICT dictptr,
assert(limit >= 1 && limit <= 30);
rep0 = 2 + (symbol & 1);
- if (symbol < END_POS_MODEL_INDEX) {
+ if (symbol < DIST_MODEL_END) {
// Prepare to decode the low bits for
// a distance of [4, 127].
assert(limit <= 5);
@@ -560,38 +565,38 @@ lzma_decode(lzma_coder *LZMA_RESTRICT coder, lzma_dict *LZMA_RESTRICT dictptr,
- symbol - 1;
symbol = 1;
offset = 0;
- case SEQ_POS_MODEL:
+ case SEQ_DIST_MODEL:
#ifdef HAVE_SMALL
do {
rc_bit(probs[symbol], ,
rep0 += 1 << offset,
- SEQ_POS_MODEL);
+ SEQ_DIST_MODEL);
} while (++offset < limit);
#else
switch (limit) {
case 5:
assert(offset == 0);
- rc_bit(probs[symbol], 0,
+ rc_bit(probs[symbol], ,
rep0 += 1,
- SEQ_POS_MODEL);
+ SEQ_DIST_MODEL);
++offset;
--limit;
case 4:
- rc_bit(probs[symbol], 0,
+ rc_bit(probs[symbol], ,
rep0 += 1 << offset,
- SEQ_POS_MODEL);
+ SEQ_DIST_MODEL);
++offset;
--limit;
case 3:
- rc_bit(probs[symbol], 0,
+ rc_bit(probs[symbol], ,
rep0 += 1 << offset,
- SEQ_POS_MODEL);
+ SEQ_DIST_MODEL);
++offset;
--limit;
case 2:
- rc_bit(probs[symbol], 0,
+ rc_bit(probs[symbol], ,
rep0 += 1 << offset,
- SEQ_POS_MODEL);
+ SEQ_DIST_MODEL);
++offset;
--limit;
case 1:
@@ -601,9 +606,9 @@ lzma_decode(lzma_coder *LZMA_RESTRICT coder, lzma_dict *LZMA_RESTRICT dictptr,
// rc_bit_last() here to omit
// the unneeded updating of
// "symbol".
- rc_bit_last(probs[symbol], 0,
+ rc_bit_last(probs[symbol], ,
rep0 += 1 << offset,
- SEQ_POS_MODEL);
+ SEQ_DIST_MODEL);
}
#endif
} else {
@@ -635,19 +640,19 @@ lzma_decode(lzma_coder *LZMA_RESTRICT coder, lzma_dict *LZMA_RESTRICT dictptr,
} while (++offset < ALIGN_BITS);
#else
case SEQ_ALIGN0:
- rc_bit(coder->pos_align[symbol], 0,
+ rc_bit(coder->pos_align[symbol], ,
rep0 += 1, SEQ_ALIGN0);
case SEQ_ALIGN1:
- rc_bit(coder->pos_align[symbol], 0,
+ rc_bit(coder->pos_align[symbol], ,
rep0 += 2, SEQ_ALIGN1);
case SEQ_ALIGN2:
- rc_bit(coder->pos_align[symbol], 0,
+ rc_bit(coder->pos_align[symbol], ,
rep0 += 4, SEQ_ALIGN2);
case SEQ_ALIGN3:
- // Like in SEQ_POS_MODEL, we don't
+ // Like in SEQ_DIST_MODEL, we don't
// need "symbol" for anything else
// than indexing the probability array.
- rc_bit_last(coder->pos_align[symbol], 0,
+ rc_bit_last(coder->pos_align[symbol], ,
rep0 += 8, SEQ_ALIGN3);
#endif
@@ -732,11 +737,9 @@ lzma_decode(lzma_coder *LZMA_RESTRICT coder, lzma_dict *LZMA_RESTRICT dictptr,
// is stored to rep0 and rep1, rep2 and rep3
// are updated accordingly.
rc_if_0(coder->is_rep1[state], SEQ_IS_REP1) {
- uint32_t distance;
-
rc_update_0(coder->is_rep1[state]);
- distance = rep1;
+ const uint32_t distance = rep1;
rep1 = rep0;
rep0 = distance;
@@ -745,23 +748,19 @@ lzma_decode(lzma_coder *LZMA_RESTRICT coder, lzma_dict *LZMA_RESTRICT dictptr,
case SEQ_IS_REP2:
rc_if_0(coder->is_rep2[state],
SEQ_IS_REP2) {
- uint32_t distance;
-
rc_update_0(coder->is_rep2[
state]);
- distance = rep2;
+ const uint32_t distance = rep2;
rep2 = rep1;
rep1 = rep0;
rep0 = distance;
} else {
- uint32_t distance;
-
rc_update_1(coder->is_rep2[
state]);
- distance = rep3;
+ const uint32_t distance = rep3;
rep3 = rep2;
rep2 = rep1;
rep1 = rep0;
@@ -849,26 +848,17 @@ out:
static void
-lzma_decoder_uncompressed(lzma_coder *coder, lzma_vli uncompressed_size)
+lzma_decoder_uncompressed(void *coder_ptr, lzma_vli uncompressed_size)
{
+ lzma_lzma1_decoder *coder = coder_ptr;
coder->uncompressed_size = uncompressed_size;
}
-/*
-extern void
-lzma_lzma_decoder_uncompressed(void *coder_ptr, lzma_vli uncompressed_size)
-{
- // This is hack.
- (*(lzma_coder **)(coder))->uncompressed_size = uncompressed_size;
-}
-*/
static void
-lzma_decoder_reset(lzma_coder *coder, const void *opt)
+lzma_decoder_reset(void *coder_ptr, const void *opt)
{
- uint32_t i, j, pos_state;
- uint32_t num_pos_states;
-
+ lzma_lzma1_decoder *coder = coder_ptr;
const lzma_options_lzma *options = opt;
// NOTE: We assume that lc/lp/pb are valid since they were
@@ -895,8 +885,8 @@ lzma_decoder_reset(lzma_coder *coder, const void *opt)
rc_reset(coder->rc);
// Bit and bittree decoders
- for (i = 0; i < STATES; ++i) {
- for (j = 0; j <= coder->pos_mask; ++j) {
+ for (uint32_t i = 0; i < STATES; ++i) {
+ for (uint32_t j = 0; j <= coder->pos_mask; ++j) {
bit_reset(coder->is_match[i][j]);
bit_reset(coder->is_rep0_long[i][j]);
}
@@ -907,22 +897,22 @@ lzma_decoder_reset(lzma_coder *coder, const void *opt)
bit_reset(coder->is_rep2[i]);
}
- for (i = 0; i < LEN_TO_POS_STATES; ++i)
- bittree_reset(coder->pos_slot[i], POS_SLOT_BITS);
+ for (uint32_t i = 0; i < DIST_STATES; ++i)
+ bittree_reset(coder->dist_slot[i], DIST_SLOT_BITS);
- for (i = 0; i < FULL_DISTANCES - END_POS_MODEL_INDEX; ++i)
+ for (uint32_t i = 0; i < FULL_DISTANCES - DIST_MODEL_END; ++i)
bit_reset(coder->pos_special[i]);
bittree_reset(coder->pos_align, ALIGN_BITS);
// Len decoders (also bit/bittree)
- num_pos_states = 1U << options->pb;
+ const uint32_t num_pos_states = 1U << options->pb;
bit_reset(coder->match_len_decoder.choice);
bit_reset(coder->match_len_decoder.choice2);
bit_reset(coder->rep_len_decoder.choice);
bit_reset(coder->rep_len_decoder.choice2);
- for (pos_state = 0; pos_state < num_pos_states; ++pos_state) {
+ for (uint32_t pos_state = 0; pos_state < num_pos_states; ++pos_state) {
bittree_reset(coder->match_len_decoder.low[pos_state],
LEN_LOW_BITS);
bittree_reset(coder->match_len_decoder.mid[pos_state],
@@ -949,13 +939,11 @@ lzma_decoder_reset(lzma_coder *coder, const void *opt)
extern lzma_ret
-lzma_lzma_decoder_create(lzma_lz_decoder *lz, lzma_allocator *allocator,
+lzma_lzma_decoder_create(lzma_lz_decoder *lz, const lzma_allocator *allocator,
const void *opt, lzma_lz_options *lz_options)
{
- const lzma_options_lzma *options = opt;
-
if (lz->coder == NULL) {
- lz->coder = lzma_alloc(sizeof(lzma_coder), allocator);
+ lz->coder = lzma_alloc(sizeof(lzma_lzma1_decoder), allocator);
if (lz->coder == NULL)
return LZMA_MEM_ERROR;
@@ -966,6 +954,7 @@ lzma_lzma_decoder_create(lzma_lz_decoder *lz, lzma_allocator *allocator,
// All dictionary sizes are OK here. LZ decoder will take care of
// the special cases.
+ const lzma_options_lzma *options = opt;
lz_options->dict_size = options->dict_size;
lz_options->preset_dict = options->preset_dict;
lz_options->preset_dict_size = options->preset_dict_size;
@@ -978,7 +967,7 @@ lzma_lzma_decoder_create(lzma_lz_decoder *lz, lzma_allocator *allocator,
/// initialization (lzma_lzma_decoder_init() passes function pointer to
/// the LZ initialization).
static lzma_ret
-lzma_decoder_init(lzma_lz_decoder *lz, lzma_allocator *allocator,
+lzma_decoder_init(lzma_lz_decoder *lz, const lzma_allocator *allocator,
const void *options, lzma_lz_options *lz_options)
{
if (!is_lclppb_valid(options))
@@ -995,7 +984,7 @@ lzma_decoder_init(lzma_lz_decoder *lz, lzma_allocator *allocator,
extern lzma_ret
-lzma_lzma_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_lzma_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters)
{
// LZMA can only be the last filter in the chain. This is enforced
@@ -1027,7 +1016,8 @@ extern uint64_t
lzma_lzma_decoder_memusage_nocheck(const void *options)
{
const lzma_options_lzma *const opt = options;
- return sizeof(lzma_coder) + lzma_lz_decoder_memusage(opt->dict_size);
+ return sizeof(lzma_lzma1_decoder)
+ + lzma_lz_decoder_memusage(opt->dict_size);
}
@@ -1042,15 +1032,14 @@ lzma_lzma_decoder_memusage(const void *options)
extern lzma_ret
-lzma_lzma_props_decode(void **options, lzma_allocator *allocator,
+lzma_lzma_props_decode(void **options, const lzma_allocator *allocator,
const uint8_t *props, size_t props_size)
{
- lzma_options_lzma *opt;
-
if (props_size != 5)
return LZMA_OPTIONS_ERROR;
- opt = lzma_alloc(sizeof(lzma_options_lzma), allocator);
+ lzma_options_lzma *opt
+ = lzma_alloc(sizeof(lzma_options_lzma), allocator);
if (opt == NULL)
return LZMA_MEM_ERROR;
diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.h b/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.h
index a463a76..fa8ecb2 100644
--- a/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.h
+++ b/Utilities/cmliblzma/liblzma/lzma/lzma_decoder.h
@@ -19,12 +19,13 @@
/// Allocates and initializes LZMA decoder
extern lzma_ret lzma_lzma_decoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters);
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters);
extern uint64_t lzma_lzma_decoder_memusage(const void *options);
extern lzma_ret lzma_lzma_props_decode(
- void **options, lzma_allocator *allocator,
+ void **options, const lzma_allocator *allocator,
const uint8_t *props, size_t props_size);
@@ -40,7 +41,7 @@ extern bool lzma_lzma_lclppb_decode(
/// Allocate and setup function pointers only. This is used by LZMA1 and
/// LZMA2 decoders.
extern lzma_ret lzma_lzma_decoder_create(
- lzma_lz_decoder *lz, lzma_allocator *allocator,
+ lzma_lz_decoder *lz, const lzma_allocator *allocator,
const void *opt, lzma_lz_options *lz_options);
/// Gets memory usage without validating lc/lp/pb. This is used by LZMA2
diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c
index e8738f4..ba9ce69 100644
--- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c
+++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.c
@@ -28,14 +28,11 @@ literal_matched(lzma_range_encoder *rc, probability *subcoder,
symbol += UINT32_C(1) << 8;
do {
- uint32_t match_bit;
- uint32_t subcoder_index;
- uint32_t bit;
-
match_byte <<= 1;
- match_bit = match_byte & offset;
- subcoder_index = offset + match_bit + (symbol >> 8);
- bit = (symbol >> 7) & 1;
+ const uint32_t match_bit = match_byte & offset;
+ const uint32_t subcoder_index
+ = offset + match_bit + (symbol >> 8);
+ const uint32_t bit = (symbol >> 7) & 1;
rc_bit(rc, &subcoder[subcoder_index], bit);
symbol <<= 1;
@@ -46,7 +43,7 @@ literal_matched(lzma_range_encoder *rc, probability *subcoder,
static inline void
-literal(lzma_coder *coder, lzma_mf *mf, uint32_t position)
+literal(lzma_lzma1_encoder *coder, lzma_mf *mf, uint32_t position)
{
// Locate the literal byte to be encoded and the subcoder.
const uint8_t cur_byte = mf->buffer[
@@ -80,19 +77,16 @@ literal(lzma_coder *coder, lzma_mf *mf, uint32_t position)
static void
length_update_prices(lzma_length_encoder *lc, const uint32_t pos_state)
{
- uint32_t a0, a1, b0, b1;
- uint32_t *prices;
- uint32_t i;
-
const uint32_t table_size = lc->table_size;
lc->counters[pos_state] = table_size;
- a0 = rc_bit_0_price(lc->choice);
- a1 = rc_bit_1_price(lc->choice);
- b0 = a1 + rc_bit_0_price(lc->choice2);
- b1 = a1 + rc_bit_1_price(lc->choice2);
- prices = lc->prices[pos_state];
+ const uint32_t a0 = rc_bit_0_price(lc->choice);
+ const uint32_t a1 = rc_bit_1_price(lc->choice);
+ const uint32_t b0 = a1 + rc_bit_0_price(lc->choice2);
+ const uint32_t b1 = a1 + rc_bit_1_price(lc->choice2);
+ uint32_t *const prices = lc->prices[pos_state];
+ uint32_t i;
for (i = 0; i < table_size && i < LEN_LOW_SYMBOLS; ++i)
prices[i] = a0 + rc_bittree_price(lc->low[pos_state],
LEN_LOW_BITS, i);
@@ -146,39 +140,36 @@ length(lzma_range_encoder *rc, lzma_length_encoder *lc,
///////////
static inline void
-match(lzma_coder *coder, const uint32_t pos_state,
+match(lzma_lzma1_encoder *coder, const uint32_t pos_state,
const uint32_t distance, const uint32_t len)
{
- uint32_t pos_slot;
- uint32_t len_to_pos_state;
-
update_match(coder->state);
length(&coder->rc, &coder->match_len_encoder, pos_state, len,
coder->fast_mode);
- pos_slot = get_pos_slot(distance);
- len_to_pos_state = get_len_to_pos_state(len);
- rc_bittree(&coder->rc, coder->pos_slot[len_to_pos_state],
- POS_SLOT_BITS, pos_slot);
+ const uint32_t dist_slot = get_dist_slot(distance);
+ const uint32_t dist_state = get_dist_state(len);
+ rc_bittree(&coder->rc, coder->dist_slot[dist_state],
+ DIST_SLOT_BITS, dist_slot);
- if (pos_slot >= START_POS_MODEL_INDEX) {
- const uint32_t footer_bits = (pos_slot >> 1) - 1;
- const uint32_t base = (2 | (pos_slot & 1)) << footer_bits;
- const uint32_t pos_reduced = distance - base;
+ if (dist_slot >= DIST_MODEL_START) {
+ const uint32_t footer_bits = (dist_slot >> 1) - 1;
+ const uint32_t base = (2 | (dist_slot & 1)) << footer_bits;
+ const uint32_t dist_reduced = distance - base;
- if (pos_slot < END_POS_MODEL_INDEX) {
- // Careful here: base - pos_slot - 1 can be -1, but
+ if (dist_slot < DIST_MODEL_END) {
+ // Careful here: base - dist_slot - 1 can be -1, but
// rc_bittree_reverse starts at probs[1], not probs[0].
rc_bittree_reverse(&coder->rc,
- coder->pos_special + base - pos_slot - 1,
- footer_bits, pos_reduced);
+ coder->dist_special + base - dist_slot - 1,
+ footer_bits, dist_reduced);
} else {
- rc_direct(&coder->rc, pos_reduced >> ALIGN_BITS,
+ rc_direct(&coder->rc, dist_reduced >> ALIGN_BITS,
footer_bits - ALIGN_BITS);
rc_bittree_reverse(
- &coder->rc, coder->pos_align,
- ALIGN_BITS, pos_reduced & ALIGN_MASK);
+ &coder->rc, coder->dist_align,
+ ALIGN_BITS, dist_reduced & ALIGN_MASK);
++coder->align_price_count;
}
}
@@ -196,7 +187,7 @@ match(lzma_coder *coder, const uint32_t pos_state,
////////////////////
static inline void
-rep_match(lzma_coder *coder, const uint32_t pos_state,
+rep_match(lzma_lzma1_encoder *coder, const uint32_t pos_state,
const uint32_t rep, const uint32_t len)
{
if (rep == 0) {
@@ -240,7 +231,7 @@ rep_match(lzma_coder *coder, const uint32_t pos_state,
//////////
static void
-encode_symbol(lzma_coder *coder, lzma_mf *mf,
+encode_symbol(lzma_lzma1_encoder *coder, lzma_mf *mf,
uint32_t back, uint32_t len, uint32_t position)
{
const uint32_t pos_state = position & coder->pos_mask;
@@ -256,7 +247,7 @@ encode_symbol(lzma_coder *coder, lzma_mf *mf,
rc_bit(&coder->rc,
&coder->is_match[coder->state][pos_state], 1);
- if (back < REP_DISTANCES) {
+ if (back < REPS) {
// It's a repeated match i.e. the same distance
// has been used earlier.
rc_bit(&coder->rc, &coder->is_rep[coder->state], 1);
@@ -264,7 +255,7 @@ encode_symbol(lzma_coder *coder, lzma_mf *mf,
} else {
// Normal match
rc_bit(&coder->rc, &coder->is_rep[coder->state], 0);
- match(coder, pos_state, back - REP_DISTANCES, len);
+ match(coder, pos_state, back - REPS, len);
}
}
@@ -274,7 +265,7 @@ encode_symbol(lzma_coder *coder, lzma_mf *mf,
static bool
-encode_init(lzma_coder *coder, lzma_mf *mf)
+encode_init(lzma_lzma1_encoder *coder, lzma_mf *mf)
{
assert(mf_position(mf) == 0);
@@ -302,7 +293,7 @@ encode_init(lzma_coder *coder, lzma_mf *mf)
static void
-encode_eopm(lzma_coder *coder, uint32_t position)
+encode_eopm(lzma_lzma1_encoder *coder, uint32_t position)
{
const uint32_t pos_state = position & coder->pos_mask;
rc_bit(&coder->rc, &coder->is_match[coder->state][pos_state], 1);
@@ -318,23 +309,18 @@ encode_eopm(lzma_coder *coder, uint32_t position)
extern lzma_ret
-lzma_lzma_encode(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
- uint8_t *LZMA_RESTRICT out, size_t *LZMA_RESTRICT out_pos,
+lzma_lzma_encode(lzma_lzma1_encoder *restrict coder, lzma_mf *restrict mf,
+ uint8_t *restrict out, size_t *restrict out_pos,
size_t out_size, uint32_t limit)
{
- uint32_t position;
-
// Initialize the stream if no data has been encoded yet.
if (!coder->is_initialized && !encode_init(coder, mf))
return LZMA_OK;
// Get the lowest bits of the uncompressed offset from the LZ layer.
- position = mf_position(mf);
+ uint32_t position = mf_position(mf);
while (true) {
- uint32_t len;
- uint32_t back;
-
// Encode pending bits, if any. Calling this before encoding
// the next symbol is needed only with plain LZMA, since
// LZMA2 always provides big enough buffer to flush
@@ -367,12 +353,14 @@ lzma_lzma_encode(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
// Get optimal match (repeat position and length).
// Value ranges for pos:
- // - [0, REP_DISTANCES): repeated match
- // - [REP_DISTANCES, UINT32_MAX):
- // match at (pos - REP_DISTANCES)
+ // - [0, REPS): repeated match
+ // - [REPS, UINT32_MAX):
+ // match at (pos - REPS)
// - UINT32_MAX: not a match but a literal
// Value ranges for len:
// - [MATCH_LEN_MIN, MATCH_LEN_MAX]
+ uint32_t len;
+ uint32_t back;
if (coder->fast_mode)
lzma_lzma_optimum_fast(coder, mf, &back, &len);
@@ -414,8 +402,8 @@ lzma_lzma_encode(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
static lzma_ret
-lzma_encode(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
- uint8_t *LZMA_RESTRICT out, size_t *LZMA_RESTRICT out_pos,
+lzma_encode(void *coder, lzma_mf *restrict mf,
+ uint8_t *restrict out, size_t *restrict out_pos,
size_t out_size)
{
// Plain LZMA has no support for sync-flushing.
@@ -465,12 +453,10 @@ static void
length_encoder_reset(lzma_length_encoder *lencoder,
const uint32_t num_pos_states, const bool fast_mode)
{
- size_t pos_state;
-
bit_reset(lencoder->choice);
bit_reset(lencoder->choice2);
- for (pos_state = 0; pos_state < num_pos_states; ++pos_state) {
+ for (size_t pos_state = 0; pos_state < num_pos_states; ++pos_state) {
bittree_reset(lencoder->low[pos_state], LEN_LOW_BITS);
bittree_reset(lencoder->mid[pos_state], LEN_MID_BITS);
}
@@ -478,7 +464,7 @@ length_encoder_reset(lzma_length_encoder *lencoder,
bittree_reset(lencoder->high, LEN_HIGH_BITS);
if (!fast_mode)
- for (pos_state = 0; pos_state < num_pos_states;
+ for (uint32_t pos_state = 0; pos_state < num_pos_states;
++pos_state)
length_update_prices(lencoder, pos_state);
@@ -487,10 +473,9 @@ length_encoder_reset(lzma_length_encoder *lencoder,
extern lzma_ret
-lzma_lzma_encoder_reset(lzma_coder *coder, const lzma_options_lzma *options)
+lzma_lzma_encoder_reset(lzma_lzma1_encoder *coder,
+ const lzma_options_lzma *options)
{
- size_t i, j;
-
if (!is_options_valid(options))
return LZMA_OPTIONS_ERROR;
@@ -503,14 +488,14 @@ lzma_lzma_encoder_reset(lzma_coder *coder, const lzma_options_lzma *options)
// State
coder->state = STATE_LIT_LIT;
- for (i = 0; i < REP_DISTANCES; ++i)
+ for (size_t i = 0; i < REPS; ++i)
coder->reps[i] = 0;
literal_init(coder->literal, options->lc, options->lp);
// Bit encoders
- for (i = 0; i < STATES; ++i) {
- for (j = 0; j <= coder->pos_mask; ++j) {
+ for (size_t i = 0; i < STATES; ++i) {
+ for (size_t j = 0; j <= coder->pos_mask; ++j) {
bit_reset(coder->is_match[i][j]);
bit_reset(coder->is_rep0_long[i][j]);
}
@@ -521,14 +506,14 @@ lzma_lzma_encoder_reset(lzma_coder *coder, const lzma_options_lzma *options)
bit_reset(coder->is_rep2[i]);
}
- for (i = 0; i < FULL_DISTANCES - END_POS_MODEL_INDEX; ++i)
- bit_reset(coder->pos_special[i]);
+ for (size_t i = 0; i < FULL_DISTANCES - DIST_MODEL_END; ++i)
+ bit_reset(coder->dist_special[i]);
// Bit tree encoders
- for (i = 0; i < LEN_TO_POS_STATES; ++i)
- bittree_reset(coder->pos_slot[i], POS_SLOT_BITS);
+ for (size_t i = 0; i < DIST_STATES; ++i)
+ bittree_reset(coder->dist_slot[i], DIST_SLOT_BITS);
- bittree_reset(coder->pos_align, ALIGN_BITS);
+ bittree_reset(coder->dist_align, ALIGN_BITS);
// Length encoders
length_encoder_reset(&coder->match_len_encoder,
@@ -561,20 +546,18 @@ lzma_lzma_encoder_reset(lzma_coder *coder, const lzma_options_lzma *options)
extern lzma_ret
-lzma_lzma_encoder_create(lzma_coder **coder_ptr, lzma_allocator *allocator,
+lzma_lzma_encoder_create(void **coder_ptr,
+ const lzma_allocator *allocator,
const lzma_options_lzma *options, lzma_lz_options *lz_options)
{
- lzma_coder *coder;
- uint32_t log_size = 0;
-
- // Allocate lzma_coder if it wasn't already allocated.
+ // Allocate lzma_lzma1_encoder if it wasn't already allocated.
if (*coder_ptr == NULL) {
- *coder_ptr = lzma_alloc(sizeof(lzma_coder), allocator);
+ *coder_ptr = lzma_alloc(sizeof(lzma_lzma1_encoder), allocator);
if (*coder_ptr == NULL)
return LZMA_MEM_ERROR;
}
- coder = *coder_ptr;
+ lzma_lzma1_encoder *coder = *coder_ptr;
// Set compression mode. We haven't validates the options yet,
// but it's OK here, since nothing bad happens with invalid
@@ -590,6 +573,7 @@ lzma_lzma_encoder_create(lzma_coder **coder_ptr, lzma_allocator *allocator,
// Set dist_table_size.
// Round the dictionary size up to next 2^n.
+ uint32_t log_size = 0;
while ((UINT32_C(1) << log_size) < options->dict_size)
++log_size;
@@ -622,7 +606,7 @@ lzma_lzma_encoder_create(lzma_coder **coder_ptr, lzma_allocator *allocator,
static lzma_ret
-lzma_encoder_init(lzma_lz_encoder *lz, lzma_allocator *allocator,
+lzma_encoder_init(lzma_lz_encoder *lz, const lzma_allocator *allocator,
const void *options, lzma_lz_options *lz_options)
{
lz->code = &lzma_encode;
@@ -632,7 +616,7 @@ lzma_encoder_init(lzma_lz_encoder *lz, lzma_allocator *allocator,
extern lzma_ret
-lzma_lzma_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_lzma_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters)
{
return lzma_lz_encoder_init(
@@ -643,19 +627,17 @@ lzma_lzma_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern uint64_t
lzma_lzma_encoder_memusage(const void *options)
{
- lzma_lz_options lz_options;
- uint64_t lz_memusage;
-
if (!is_options_valid(options))
return UINT64_MAX;
+ lzma_lz_options lz_options;
set_lz_options(&lz_options, options);
- lz_memusage = lzma_lz_encoder_memusage(&lz_options);
+ const uint64_t lz_memusage = lzma_lz_encoder_memusage(&lz_options);
if (lz_memusage == UINT64_MAX)
return UINT64_MAX;
- return (uint64_t)(sizeof(lzma_coder)) + lz_memusage;
+ return (uint64_t)(sizeof(lzma_lzma1_encoder)) + lz_memusage;
}
diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h
index abb8d8b..6cfdf22 100644
--- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h
+++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder.h
@@ -17,8 +17,12 @@
#include "common.h"
+typedef struct lzma_lzma1_encoder_s lzma_lzma1_encoder;
+
+
extern lzma_ret lzma_lzma_encoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters);
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters);
extern uint64_t lzma_lzma_encoder_memusage(const void *options);
@@ -35,18 +39,18 @@ extern bool lzma_lzma_lclppb_encode(
/// Initializes raw LZMA encoder; this is used by LZMA2.
extern lzma_ret lzma_lzma_encoder_create(
- lzma_coder **coder_ptr, lzma_allocator *allocator,
+ void **coder_ptr, const lzma_allocator *allocator,
const lzma_options_lzma *options, lzma_lz_options *lz_options);
/// Resets an already initialized LZMA encoder; this is used by LZMA2.
extern lzma_ret lzma_lzma_encoder_reset(
- lzma_coder *coder, const lzma_options_lzma *options);
+ lzma_lzma1_encoder *coder, const lzma_options_lzma *options);
-extern lzma_ret lzma_lzma_encode(lzma_coder *LZMA_RESTRICT coder,
- lzma_mf *LZMA_RESTRICT mf, uint8_t *LZMA_RESTRICT out,
- size_t *LZMA_RESTRICT out_pos, size_t out_size,
+extern lzma_ret lzma_lzma_encode(lzma_lzma1_encoder *restrict coder,
+ lzma_mf *restrict mf, uint8_t *restrict out,
+ size_t *restrict out_pos, size_t out_size,
uint32_t read_limit);
#endif
diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c
index f983126..6c53d2b 100644
--- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c
+++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_fast.c
@@ -10,6 +10,7 @@
///////////////////////////////////////////////////////////////////////////////
#include "lzma_encoder_private.h"
+#include "memcmplen.h"
#define change_pair(small_dist, big_dist) \
@@ -17,17 +18,10 @@
extern void
-lzma_lzma_optimum_fast(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
- uint32_t *LZMA_RESTRICT back_res, uint32_t *LZMA_RESTRICT len_res)
+lzma_lzma_optimum_fast(lzma_lzma1_encoder *restrict coder,
+ lzma_mf *restrict mf,
+ uint32_t *restrict back_res, uint32_t *restrict len_res)
{
- const uint8_t *buf;
- uint32_t buf_avail;
- uint32_t i;
- uint32_t rep_len = 0;
- uint32_t rep_index = 0;
- uint32_t back_main = 0;
- uint32_t limit;
-
const uint32_t nice_len = mf->nice_len;
uint32_t len_main;
@@ -40,8 +34,8 @@ lzma_lzma_optimum_fast(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT m
matches_count = coder->matches_count;
}
- buf = mf_ptr(mf) - 1;
- buf_avail = my_min(mf_avail(mf) + 1, MATCH_LEN_MAX);
+ const uint8_t *buf = mf_ptr(mf) - 1;
+ const uint32_t buf_avail = my_min(mf_avail(mf) + 1, MATCH_LEN_MAX);
if (buf_avail < 2) {
// There's not enough input left to encode a match.
@@ -51,9 +45,10 @@ lzma_lzma_optimum_fast(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT m
}
// Look for repeated matches; scan the previous four match distances
- for (i = 0; i < REP_DISTANCES; ++i) {
- uint32_t len;
+ uint32_t rep_len = 0;
+ uint32_t rep_index = 0;
+ for (uint32_t i = 0; i < REPS; ++i) {
// Pointer to the beginning of the match candidate
const uint8_t *const buf_back = buf - coder->reps[i] - 1;
@@ -64,8 +59,8 @@ lzma_lzma_optimum_fast(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT m
// The first two bytes matched.
// Calculate the length of the match.
- for (len = 2; len < buf_avail
- && buf[len] == buf_back[len]; ++len) ;
+ const uint32_t len = lzma_memcmplen(
+ buf, buf_back, 2, buf_avail);
// If we have found a repeated match that is at least
// nice_len long, return it immediately.
@@ -85,13 +80,13 @@ lzma_lzma_optimum_fast(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT m
// We didn't find a long enough repeated match. Encode it as a normal
// match if the match length is at least nice_len.
if (len_main >= nice_len) {
- *back_res = coder->matches[matches_count - 1].dist
- + REP_DISTANCES;
+ *back_res = coder->matches[matches_count - 1].dist + REPS;
*len_res = len_main;
mf_skip(mf, len_main - 1);
return;
}
+ uint32_t back_main = 0;
if (len_main >= 2) {
back_main = coder->matches[matches_count - 1].dist;
@@ -158,27 +153,17 @@ lzma_lzma_optimum_fast(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT m
// the old buf pointer instead of recalculating it with mf_ptr().
++buf;
- limit = len_main - 1;
-
- for (i = 0; i < REP_DISTANCES; ++i) {
- uint32_t len;
-
- const uint8_t *const buf_back = buf - coder->reps[i] - 1;
-
- if (not_equal_16(buf, buf_back))
- continue;
-
- for (len = 2; len < limit
- && buf[len] == buf_back[len]; ++len) ;
+ const uint32_t limit = my_max(2, len_main - 1);
- if (len >= limit) {
+ for (uint32_t i = 0; i < REPS; ++i) {
+ if (memcmp(buf, buf - coder->reps[i] - 1, limit) == 0) {
*back_res = UINT32_MAX;
*len_res = 1;
return;
}
}
- *back_res = back_main + REP_DISTANCES;
+ *back_res = back_main + REPS;
*len_res = len_main;
mf_skip(mf, len_main - 2);
return;
diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c
index d3a6348..59f7734 100644
--- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c
+++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c
@@ -11,6 +11,7 @@
#include "lzma_encoder_private.h"
#include "fastpos.h"
+#include "memcmplen.h"
////////////
@@ -18,7 +19,7 @@
////////////
static uint32_t
-get_literal_price(const lzma_coder *const coder, const uint32_t pos,
+get_literal_price(const lzma_lzma1_encoder *const coder, const uint32_t pos,
const uint32_t prev_byte, const bool match_mode,
uint32_t match_byte, uint32_t symbol)
{
@@ -35,15 +36,12 @@ get_literal_price(const lzma_coder *const coder, const uint32_t pos,
symbol += UINT32_C(1) << 8;
do {
- uint32_t match_bit;
- uint32_t subcoder_index;
- uint32_t bit;
-
match_byte <<= 1;
- match_bit = match_byte & offset;
- subcoder_index = offset + match_bit + (symbol >> 8);
- bit = (symbol >> 7) & 1;
+ const uint32_t match_bit = match_byte & offset;
+ const uint32_t subcoder_index
+ = offset + match_bit + (symbol >> 8);
+ const uint32_t bit = (symbol >> 7) & 1;
price += rc_bit_price(subcoder[subcoder_index], bit);
symbol <<= 1;
@@ -67,7 +65,7 @@ get_len_price(const lzma_length_encoder *const lencoder,
static inline uint32_t
-get_short_rep_price(const lzma_coder *const coder,
+get_short_rep_price(const lzma_lzma1_encoder *const coder,
const lzma_lzma_state state, const uint32_t pos_state)
{
return rc_bit_0_price(coder->is_rep0[state])
@@ -76,7 +74,7 @@ get_short_rep_price(const lzma_coder *const coder,
static inline uint32_t
-get_pure_rep_price(const lzma_coder *const coder, const uint32_t rep_index,
+get_pure_rep_price(const lzma_lzma1_encoder *const coder, const uint32_t rep_index,
const lzma_lzma_state state, uint32_t pos_state)
{
uint32_t price;
@@ -101,7 +99,7 @@ get_pure_rep_price(const lzma_coder *const coder, const uint32_t rep_index,
static inline uint32_t
-get_rep_price(const lzma_coder *const coder, const uint32_t rep_index,
+get_rep_price(const lzma_lzma1_encoder *const coder, const uint32_t rep_index,
const uint32_t len, const lzma_lzma_state state,
const uint32_t pos_state)
{
@@ -111,18 +109,18 @@ get_rep_price(const lzma_coder *const coder, const uint32_t rep_index,
static inline uint32_t
-get_pos_len_price(const lzma_coder *const coder, const uint32_t pos,
+get_dist_len_price(const lzma_lzma1_encoder *const coder, const uint32_t dist,
const uint32_t len, const uint32_t pos_state)
{
- const uint32_t len_to_pos_state = get_len_to_pos_state(len);
+ const uint32_t dist_state = get_dist_state(len);
uint32_t price;
- if (pos < FULL_DISTANCES) {
- price = coder->distances_prices[len_to_pos_state][pos];
+ if (dist < FULL_DISTANCES) {
+ price = coder->dist_prices[dist_state][dist];
} else {
- const uint32_t pos_slot = get_pos_slot_2(pos);
- price = coder->pos_slot_prices[len_to_pos_state][pos_slot]
- + coder->align_prices[pos & ALIGN_MASK];
+ const uint32_t dist_slot = get_dist_slot_2(dist);
+ price = coder->dist_slot_prices[dist_state][dist_slot]
+ + coder->align_prices[dist & ALIGN_MASK];
}
price += get_len_price(&coder->match_len_encoder, len, pos_state);
@@ -132,59 +130,53 @@ get_pos_len_price(const lzma_coder *const coder, const uint32_t pos,
static void
-fill_distances_prices(lzma_coder *coder)
+fill_dist_prices(lzma_lzma1_encoder *coder)
{
- uint32_t len_to_pos_state;
- uint32_t pos_slot;
- uint32_t i;
-
- for (len_to_pos_state = 0;
- len_to_pos_state < LEN_TO_POS_STATES;
- ++len_to_pos_state) {
+ for (uint32_t dist_state = 0; dist_state < DIST_STATES; ++dist_state) {
- uint32_t *const pos_slot_prices
- = coder->pos_slot_prices[len_to_pos_state];
+ uint32_t *const dist_slot_prices
+ = coder->dist_slot_prices[dist_state];
- // Price to encode the pos_slot.
- for (pos_slot = 0;
- pos_slot < coder->dist_table_size; ++pos_slot)
- pos_slot_prices[pos_slot] = rc_bittree_price(
- coder->pos_slot[len_to_pos_state],
- POS_SLOT_BITS, pos_slot);
+ // Price to encode the dist_slot.
+ for (uint32_t dist_slot = 0;
+ dist_slot < coder->dist_table_size; ++dist_slot)
+ dist_slot_prices[dist_slot] = rc_bittree_price(
+ coder->dist_slot[dist_state],
+ DIST_SLOT_BITS, dist_slot);
// For matches with distance >= FULL_DISTANCES, add the price
// of the direct bits part of the match distance. (Align bits
// are handled by fill_align_prices()).
- for (pos_slot = END_POS_MODEL_INDEX;
- pos_slot < coder->dist_table_size; ++pos_slot)
- pos_slot_prices[pos_slot] += rc_direct_price(
- ((pos_slot >> 1) - 1) - ALIGN_BITS);
+ for (uint32_t dist_slot = DIST_MODEL_END;
+ dist_slot < coder->dist_table_size;
+ ++dist_slot)
+ dist_slot_prices[dist_slot] += rc_direct_price(
+ ((dist_slot >> 1) - 1) - ALIGN_BITS);
// Distances in the range [0, 3] are fully encoded with
- // pos_slot, so they are used for coder->distances_prices
+ // dist_slot, so they are used for coder->dist_prices
// as is.
- for (i = 0; i < START_POS_MODEL_INDEX; ++i)
- coder->distances_prices[len_to_pos_state][i]
- = pos_slot_prices[i];
+ for (uint32_t i = 0; i < DIST_MODEL_START; ++i)
+ coder->dist_prices[dist_state][i]
+ = dist_slot_prices[i];
}
- // Distances in the range [4, 127] depend on pos_slot and pos_special.
- // We do this in a loop separate from the above loop to avoid
- // redundant calls to get_pos_slot().
- for (i = START_POS_MODEL_INDEX; i < FULL_DISTANCES; ++i) {
- const uint32_t pos_slot = get_pos_slot(i);
- const uint32_t footer_bits = ((pos_slot >> 1) - 1);
- const uint32_t base = (2 | (pos_slot & 1)) << footer_bits;
+ // Distances in the range [4, 127] depend on dist_slot and
+ // dist_special. We do this in a loop separate from the above
+ // loop to avoid redundant calls to get_dist_slot().
+ for (uint32_t i = DIST_MODEL_START; i < FULL_DISTANCES; ++i) {
+ const uint32_t dist_slot = get_dist_slot(i);
+ const uint32_t footer_bits = ((dist_slot >> 1) - 1);
+ const uint32_t base = (2 | (dist_slot & 1)) << footer_bits;
const uint32_t price = rc_bittree_reverse_price(
- coder->pos_special + base - pos_slot - 1,
+ coder->dist_special + base - dist_slot - 1,
footer_bits, i - base);
- for (len_to_pos_state = 0;
- len_to_pos_state < LEN_TO_POS_STATES;
- ++len_to_pos_state)
- coder->distances_prices[len_to_pos_state][i]
- = price + coder->pos_slot_prices[
- len_to_pos_state][pos_slot];
+ for (uint32_t dist_state = 0; dist_state < DIST_STATES;
+ ++dist_state)
+ coder->dist_prices[dist_state][i]
+ = price + coder->dist_slot_prices[
+ dist_state][dist_slot];
}
coder->match_price_count = 0;
@@ -193,12 +185,11 @@ fill_distances_prices(lzma_coder *coder)
static void
-fill_align_prices(lzma_coder *coder)
+fill_align_prices(lzma_lzma1_encoder *coder)
{
- uint32_t i;
- for (i = 0; i < ALIGN_TABLE_SIZE; ++i)
+ for (uint32_t i = 0; i < ALIGN_SIZE; ++i)
coder->align_prices[i] = rc_bittree_reverse_price(
- coder->pos_align, ALIGN_BITS, i);
+ coder->dist_align, ALIGN_BITS, i);
coder->align_price_count = 0;
return;
@@ -230,18 +221,15 @@ make_short_rep(lzma_optimal *optimal)
static void
-backward(lzma_coder *LZMA_RESTRICT coder, uint32_t *LZMA_RESTRICT len_res,
- uint32_t *LZMA_RESTRICT back_res, uint32_t cur)
+backward(lzma_lzma1_encoder *restrict coder, uint32_t *restrict len_res,
+ uint32_t *restrict back_res, uint32_t cur)
{
+ coder->opts_end_index = cur;
+
uint32_t pos_mem = coder->opts[cur].pos_prev;
uint32_t back_mem = coder->opts[cur].back_prev;
- coder->opts_end_index = cur;
-
do {
- const uint32_t pos_prev = pos_mem;
- const uint32_t back_cur = back_mem;
-
if (coder->opts[cur].prev_1_is_literal) {
make_literal(&coder->opts[pos_mem]);
coder->opts[pos_mem].pos_prev = pos_mem - 1;
@@ -256,6 +244,9 @@ backward(lzma_coder *LZMA_RESTRICT coder, uint32_t *LZMA_RESTRICT len_res,
}
}
+ const uint32_t pos_prev = pos_mem;
+ const uint32_t back_cur = back_mem;
+
back_mem = coder->opts[pos_prev].back_prev;
pos_mem = coder->opts[pos_prev].pos_prev;
@@ -278,27 +269,10 @@ backward(lzma_coder *LZMA_RESTRICT coder, uint32_t *LZMA_RESTRICT len_res,
//////////
static inline uint32_t
-helper1(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
- uint32_t *LZMA_RESTRICT back_res, uint32_t *LZMA_RESTRICT len_res,
+helper1(lzma_lzma1_encoder *restrict coder, lzma_mf *restrict mf,
+ uint32_t *restrict back_res, uint32_t *restrict len_res,
uint32_t position)
{
- uint32_t buf_avail;
- const uint8_t *buf;
- uint32_t rep_lens[REP_DISTANCES];
- uint32_t rep_max_index = 0;
- uint32_t i;
-
- uint8_t current_byte;
- uint8_t match_byte;
-
- uint32_t pos_state;
- uint32_t match_price;
- uint32_t rep_match_price;
- uint32_t len_end;
- uint32_t len;
-
- uint32_t normal_match_price;
-
const uint32_t nice_len = mf->nice_len;
uint32_t len_main;
@@ -312,18 +286,19 @@ helper1(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
matches_count = coder->matches_count;
}
- buf_avail = my_min(mf_avail(mf) + 1, MATCH_LEN_MAX);
+ const uint32_t buf_avail = my_min(mf_avail(mf) + 1, MATCH_LEN_MAX);
if (buf_avail < 2) {
*back_res = UINT32_MAX;
*len_res = 1;
return UINT32_MAX;
}
- buf = mf_ptr(mf) - 1;
+ const uint8_t *const buf = mf_ptr(mf) - 1;
- for (i = 0; i < REP_DISTANCES; ++i) {
- uint32_t len_test;
+ uint32_t rep_lens[REPS];
+ uint32_t rep_max_index = 0;
+ for (uint32_t i = 0; i < REPS; ++i) {
const uint8_t *const buf_back = buf - coder->reps[i] - 1;
if (not_equal_16(buf, buf_back)) {
@@ -331,12 +306,9 @@ helper1(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
continue;
}
- for (len_test = 2; len_test < buf_avail
- && buf[len_test] == buf_back[len_test];
- ++len_test) ;
+ rep_lens[i] = lzma_memcmplen(buf, buf_back, 2, buf_avail);
- rep_lens[i] = len_test;
- if (len_test > rep_lens[rep_max_index])
+ if (rep_lens[i] > rep_lens[rep_max_index])
rep_max_index = i;
}
@@ -349,15 +321,14 @@ helper1(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
if (len_main >= nice_len) {
- *back_res = coder->matches[matches_count - 1].dist
- + REP_DISTANCES;
+ *back_res = coder->matches[matches_count - 1].dist + REPS;
*len_res = len_main;
mf_skip(mf, len_main - 1);
return UINT32_MAX;
}
- current_byte = *buf;
- match_byte = *(buf - coder->reps[0] - 1);
+ const uint8_t current_byte = *buf;
+ const uint8_t match_byte = *(buf - coder->reps[0] - 1);
if (len_main < 2 && current_byte != match_byte
&& rep_lens[rep_max_index] < 2) {
@@ -368,7 +339,7 @@ helper1(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
coder->opts[0].state = coder->state;
- pos_state = position & coder->pos_mask;
+ const uint32_t pos_state = position & coder->pos_mask;
coder->opts[1].price = rc_bit_0_price(
coder->is_match[coder->state][pos_state])
@@ -378,9 +349,9 @@ helper1(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
make_literal(&coder->opts[1]);
- match_price = rc_bit_1_price(
+ const uint32_t match_price = rc_bit_1_price(
coder->is_match[coder->state][pos_state]);
- rep_match_price = match_price
+ const uint32_t rep_match_price = match_price
+ rc_bit_1_price(coder->is_rep[coder->state]);
if (match_byte == current_byte) {
@@ -394,7 +365,7 @@ helper1(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
}
}
- len_end = my_max(len_main, rep_lens[rep_max_index]);
+ const uint32_t len_end = my_max(len_main, rep_lens[rep_max_index]);
if (len_end < 2) {
*back_res = coder->opts[1].back_prev;
@@ -404,23 +375,21 @@ helper1(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
coder->opts[1].pos_prev = 0;
- for (i = 0; i < REP_DISTANCES; ++i)
+ for (uint32_t i = 0; i < REPS; ++i)
coder->opts[0].backs[i] = coder->reps[i];
- len = len_end;
+ uint32_t len = len_end;
do {
coder->opts[len].price = RC_INFINITY_PRICE;
} while (--len >= 2);
- for (i = 0; i < REP_DISTANCES; ++i) {
- uint32_t price;
-
+ for (uint32_t i = 0; i < REPS; ++i) {
uint32_t rep_len = rep_lens[i];
if (rep_len < 2)
continue;
- price = rep_match_price + get_pure_rep_price(
+ const uint32_t price = rep_match_price + get_pure_rep_price(
coder, i, coder->state, pos_state);
do {
@@ -439,7 +408,7 @@ helper1(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
}
- normal_match_price = match_price
+ const uint32_t normal_match_price = match_price
+ rc_bit_0_price(coder->is_rep[coder->state]);
len = rep_lens[0] >= 2 ? rep_lens[0] + 1 : 2;
@@ -451,14 +420,13 @@ helper1(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
for(; ; ++len) {
const uint32_t dist = coder->matches[i].dist;
const uint32_t cur_and_len_price = normal_match_price
- + get_pos_len_price(coder,
+ + get_dist_len_price(coder,
dist, len, pos_state);
if (cur_and_len_price < coder->opts[len].price) {
coder->opts[len].price = cur_and_len_price;
coder->opts[len].pos_prev = 0;
- coder->opts[len].back_prev
- = dist + REP_DISTANCES;
+ coder->opts[len].back_prev = dist + REPS;
coder->opts[len].prev_1_is_literal = false;
}
@@ -473,7 +441,7 @@ helper1(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
static inline uint32_t
-helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
+helper2(lzma_lzma1_encoder *coder, uint32_t *reps, const uint8_t *buf,
uint32_t len_end, uint32_t position, const uint32_t cur,
const uint32_t nice_len, const uint32_t buf_avail_full)
{
@@ -481,19 +449,6 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
uint32_t new_len = coder->longest_match_length;
uint32_t pos_prev = coder->opts[cur].pos_prev;
lzma_lzma_state state;
- uint32_t buf_avail;
- uint32_t rep_index;
- uint32_t i;
-
- uint32_t cur_price;
- uint8_t current_byte;
- uint8_t match_byte;
- uint32_t pos_state;
- uint32_t cur_and_1_price;
- bool next_is_literal = false;
- uint32_t match_price;
- uint32_t rep_match_price;
- uint32_t start_len = 2;
if (coder->opts[cur].prev_1_is_literal) {
--pos_prev;
@@ -501,7 +456,7 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
if (coder->opts[cur].prev_2) {
state = coder->opts[coder->opts[cur].pos_prev_2].state;
- if (coder->opts[cur].back_prev_2 < REP_DISTANCES)
+ if (coder->opts[cur].back_prev_2 < REPS)
update_long_rep(state);
else
update_match(state);
@@ -530,48 +485,49 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
update_long_rep(state);
} else {
pos = coder->opts[cur].back_prev;
- if (pos < REP_DISTANCES)
+ if (pos < REPS)
update_long_rep(state);
else
update_match(state);
}
- if (pos < REP_DISTANCES) {
- uint32_t i;
-
+ if (pos < REPS) {
reps[0] = coder->opts[pos_prev].backs[pos];
+ uint32_t i;
for (i = 1; i <= pos; ++i)
reps[i] = coder->opts[pos_prev].backs[i - 1];
- for (; i < REP_DISTANCES; ++i)
+ for (; i < REPS; ++i)
reps[i] = coder->opts[pos_prev].backs[i];
} else {
- reps[0] = pos - REP_DISTANCES;
+ reps[0] = pos - REPS;
- for (i = 1; i < REP_DISTANCES; ++i)
+ for (uint32_t i = 1; i < REPS; ++i)
reps[i] = coder->opts[pos_prev].backs[i - 1];
}
}
coder->opts[cur].state = state;
- for (i = 0; i < REP_DISTANCES; ++i)
+ for (uint32_t i = 0; i < REPS; ++i)
coder->opts[cur].backs[i] = reps[i];
- cur_price = coder->opts[cur].price;
+ const uint32_t cur_price = coder->opts[cur].price;
- current_byte = *buf;
- match_byte = *(buf - reps[0] - 1);
+ const uint8_t current_byte = *buf;
+ const uint8_t match_byte = *(buf - reps[0] - 1);
- pos_state = position & coder->pos_mask;
+ const uint32_t pos_state = position & coder->pos_mask;
- cur_and_1_price = cur_price
+ const uint32_t cur_and_1_price = cur_price
+ rc_bit_0_price(coder->is_match[state][pos_state])
+ get_literal_price(coder, position, buf[-1],
!is_literal_state(state), match_byte, current_byte);
+ bool next_is_literal = false;
+
if (cur_and_1_price < coder->opts[cur + 1].price) {
coder->opts[cur + 1].price = cur_and_1_price;
coder->opts[cur + 1].pos_prev = cur;
@@ -579,9 +535,9 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
next_is_literal = true;
}
- match_price = cur_price
+ const uint32_t match_price = cur_price
+ rc_bit_1_price(coder->is_match[state][pos_state]);
- rep_match_price = match_price
+ const uint32_t rep_match_price = match_price
+ rc_bit_1_price(coder->is_rep[state]);
if (match_byte == current_byte
@@ -602,40 +558,31 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
if (buf_avail_full < 2)
return len_end;
- buf_avail = my_min(buf_avail_full, nice_len);
+ const uint32_t buf_avail = my_min(buf_avail_full, nice_len);
if (!next_is_literal && match_byte != current_byte) { // speed optimization
// try literal + rep0
const uint8_t *const buf_back = buf - reps[0] - 1;
const uint32_t limit = my_min(buf_avail_full, nice_len + 1);
- uint32_t len_test = 1;
- while (len_test < limit && buf[len_test] == buf_back[len_test])
- ++len_test;
-
- --len_test;
+ const uint32_t len_test = lzma_memcmplen(buf, buf_back, 1, limit) - 1;
if (len_test >= 2) {
- uint32_t pos_state_next;
- uint32_t next_rep_match_price;
- uint32_t offset;
- uint32_t cur_and_len_price;
-
lzma_lzma_state state_2 = state;
update_literal(state_2);
- pos_state_next = (position + 1) & coder->pos_mask;
- next_rep_match_price = cur_and_1_price
+ const uint32_t pos_state_next = (position + 1) & coder->pos_mask;
+ const uint32_t next_rep_match_price = cur_and_1_price
+ rc_bit_1_price(coder->is_match[state_2][pos_state_next])
+ rc_bit_1_price(coder->is_rep[state_2]);
//for (; len_test >= 2; --len_test) {
- offset = cur + 1 + len_test;
+ const uint32_t offset = cur + 1 + len_test;
while (len_end < offset)
coder->opts[++len_end].price = RC_INFINITY_PRICE;
- cur_and_len_price = next_rep_match_price
+ const uint32_t cur_and_len_price = next_rep_match_price
+ get_rep_price(coder, 0, len_test,
state_2, pos_state_next);
@@ -651,23 +598,20 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
}
- for (rep_index = 0; rep_index < REP_DISTANCES; ++rep_index) {
- uint32_t len_test, len_test_2, len_test_temp;
- uint32_t price, limit;
+ uint32_t start_len = 2; // speed optimization
+ for (uint32_t rep_index = 0; rep_index < REPS; ++rep_index) {
const uint8_t *const buf_back = buf - reps[rep_index] - 1;
if (not_equal_16(buf, buf_back))
continue;
- for (len_test = 2; len_test < buf_avail
- && buf[len_test] == buf_back[len_test];
- ++len_test) ;
+ uint32_t len_test = lzma_memcmplen(buf, buf_back, 2, buf_avail);
while (len_end < cur + len_test)
coder->opts[++len_end].price = RC_INFINITY_PRICE;
- len_test_temp = len_test;
- price = rep_match_price + get_pure_rep_price(
+ const uint32_t len_test_temp = len_test;
+ const uint32_t price = rep_match_price + get_pure_rep_price(
coder, rep_index, state, pos_state);
do {
@@ -689,8 +633,8 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
start_len = len_test + 1;
- len_test_2 = len_test + 1;
- limit = my_min(buf_avail_full,
+ uint32_t len_test_2 = len_test + 1;
+ const uint32_t limit = my_min(buf_avail_full,
len_test_2 + nice_len);
for (; len_test_2 < limit
&& buf[len_test_2] == buf_back[len_test_2];
@@ -699,18 +643,12 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
len_test_2 -= len_test + 1;
if (len_test_2 >= 2) {
- uint32_t pos_state_next;
- uint32_t cur_and_len_literal_price;
- uint32_t next_rep_match_price;
- uint32_t offset;
- uint32_t cur_and_len_price;
-
lzma_lzma_state state_2 = state;
update_long_rep(state_2);
- pos_state_next = (position + len_test) & coder->pos_mask;
+ uint32_t pos_state_next = (position + len_test) & coder->pos_mask;
- cur_and_len_literal_price = price
+ const uint32_t cur_and_len_literal_price = price
+ get_len_price(&coder->rep_len_encoder,
len_test, pos_state)
+ rc_bit_0_price(coder->is_match[state_2][pos_state_next])
@@ -722,17 +660,17 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
pos_state_next = (position + len_test + 1) & coder->pos_mask;
- next_rep_match_price = cur_and_len_literal_price
+ const uint32_t next_rep_match_price = cur_and_len_literal_price
+ rc_bit_1_price(coder->is_match[state_2][pos_state_next])
+ rc_bit_1_price(coder->is_rep[state_2]);
//for(; len_test_2 >= 2; len_test_2--) {
- offset = cur + len_test + 1 + len_test_2;
+ const uint32_t offset = cur + len_test + 1 + len_test_2;
while (len_end < offset)
coder->opts[++len_end].price = RC_INFINITY_PRICE;
- cur_and_len_price = next_rep_match_price
+ const uint32_t cur_and_len_price = next_rep_match_price
+ get_rep_price(coder, 0, len_test_2,
state_2, pos_state_next);
@@ -763,29 +701,27 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
if (new_len >= start_len) {
- uint32_t len_test;
- uint32_t i = 0;
-
const uint32_t normal_match_price = match_price
+ rc_bit_0_price(coder->is_rep[state]);
while (len_end < cur + new_len)
coder->opts[++len_end].price = RC_INFINITY_PRICE;
+ uint32_t i = 0;
while (start_len > coder->matches[i].len)
++i;
- for (len_test = start_len; ; ++len_test) {
+ for (uint32_t len_test = start_len; ; ++len_test) {
const uint32_t cur_back = coder->matches[i].dist;
uint32_t cur_and_len_price = normal_match_price
- + get_pos_len_price(coder,
+ + get_dist_len_price(coder,
cur_back, len_test, pos_state);
if (cur_and_len_price < coder->opts[cur + len_test].price) {
coder->opts[cur + len_test].price = cur_and_len_price;
coder->opts[cur + len_test].pos_prev = cur;
coder->opts[cur + len_test].back_prev
- = cur_back + REP_DISTANCES;
+ = cur_back + REPS;
coder->opts[cur + len_test].prev_1_is_literal = false;
}
@@ -803,16 +739,12 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
len_test_2 -= len_test + 1;
if (len_test_2 >= 2) {
- uint32_t pos_state_next;
- uint32_t cur_and_len_literal_price;
- uint32_t next_rep_match_price;
- uint32_t offset;
-
lzma_lzma_state state_2 = state;
update_match(state_2);
- pos_state_next = (position + len_test) & coder->pos_mask;
+ uint32_t pos_state_next
+ = (position + len_test) & coder->pos_mask;
- cur_and_len_literal_price = cur_and_len_price
+ const uint32_t cur_and_len_literal_price = cur_and_len_price
+ rc_bit_0_price(
coder->is_match[state_2][pos_state_next])
+ get_literal_price(coder,
@@ -825,14 +757,14 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
update_literal(state_2);
pos_state_next = (pos_state_next + 1) & coder->pos_mask;
- next_rep_match_price
+ const uint32_t next_rep_match_price
= cur_and_len_literal_price
+ rc_bit_1_price(
coder->is_match[state_2][pos_state_next])
+ rc_bit_1_price(coder->is_rep[state_2]);
// for(; len_test_2 >= 2; --len_test_2) {
- offset = cur + len_test + 1 + len_test_2;
+ const uint32_t offset = cur + len_test + 1 + len_test_2;
while (len_end < offset)
coder->opts[++len_end].price = RC_INFINITY_PRICE;
@@ -849,7 +781,7 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
coder->opts[offset].prev_2 = true;
coder->opts[offset].pos_prev_2 = cur;
coder->opts[offset].back_prev_2
- = cur_back + REP_DISTANCES;
+ = cur_back + REPS;
}
//}
}
@@ -865,14 +797,11 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
extern void
-lzma_lzma_optimum_normal(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
- uint32_t *LZMA_RESTRICT back_res, uint32_t *LZMA_RESTRICT len_res,
+lzma_lzma_optimum_normal(lzma_lzma1_encoder *restrict coder,
+ lzma_mf *restrict mf,
+ uint32_t *restrict back_res, uint32_t *restrict len_res,
uint32_t position)
{
- uint32_t reps[REP_DISTANCES];
- uint32_t len_end;
- uint32_t cur;
-
// If we have symbols pending, return the next pending symbol.
if (coder->opts_end_index != coder->opts_current_index) {
assert(mf->read_ahead > 0);
@@ -889,9 +818,9 @@ lzma_lzma_optimum_normal(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT
// In liblzma they were moved into this single place.
if (mf->read_ahead == 0) {
if (coder->match_price_count >= (1 << 7))
- fill_distances_prices(coder);
+ fill_dist_prices(coder);
- if (coder->align_price_count >= ALIGN_TABLE_SIZE)
+ if (coder->align_price_count >= ALIGN_SIZE)
fill_align_prices(coder);
}
@@ -899,13 +828,14 @@ lzma_lzma_optimum_normal(lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT
// the original function into two pieces makes it at least a little
// more readable, since those two parts don't share many variables.
- len_end = helper1(coder, mf, back_res, len_res, position);
+ uint32_t len_end = helper1(coder, mf, back_res, len_res, position);
if (len_end == UINT32_MAX)
return;
-
+ uint32_t reps[REPS];
memcpy(reps, coder->reps, sizeof(reps));
+ uint32_t cur;
for (cur = 1; cur < len_end; ++cur) {
assert(cur < OPTS);
diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c
index 9332abf..711df02 100644
--- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c
+++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c
@@ -2,6 +2,7 @@
//
/// \file lzma_encoder_presets.c
/// \brief Encoder presets
+/// \note xz needs this even when only decoding is enabled.
//
// Author: Lasse Collin
//
@@ -16,10 +17,6 @@
extern LZMA_API(lzma_bool)
lzma_lzma_preset(lzma_options_lzma *options, uint32_t preset)
{
- static const uint8_t dict_pow2[]
- = { 18, 20, 21, 22, 22, 23, 23, 24, 25, 26 };
- static const uint8_t depths[] = { 4, 8, 24, 48 };
-
const uint32_t level = preset & LZMA_PRESET_LEVEL_MASK;
const uint32_t flags = preset & ~LZMA_PRESET_LEVEL_MASK;
const uint32_t supported_flags = LZMA_PRESET_EXTREME;
@@ -34,12 +31,15 @@ lzma_lzma_preset(lzma_options_lzma *options, uint32_t preset)
options->lp = LZMA_LP_DEFAULT;
options->pb = LZMA_PB_DEFAULT;
+ static const uint8_t dict_pow2[]
+ = { 18, 20, 21, 22, 22, 23, 23, 24, 25, 26 };
options->dict_size = UINT32_C(1) << dict_pow2[level];
if (level <= 3) {
options->mode = LZMA_MODE_FAST;
options->mf = level == 0 ? LZMA_MF_HC3 : LZMA_MF_HC4;
options->nice_len = level <= 1 ? 128 : 273;
+ static const uint8_t depths[] = { 4, 8, 24, 48 };
options->depth = depths[level];
} else {
options->mode = LZMA_MODE_NORMAL;
diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_private.h b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_private.h
index 04fb29e..a2da969 100644
--- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_private.h
+++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_private.h
@@ -64,12 +64,12 @@ typedef struct {
uint32_t pos_prev; // pos_next;
uint32_t back_prev;
- uint32_t backs[REP_DISTANCES];
+ uint32_t backs[REPS];
} lzma_optimal;
-struct lzma_coder_s {
+struct lzma_lzma1_encoder_s {
/// Range encoder
lzma_range_encoder rc;
@@ -77,7 +77,7 @@ struct lzma_coder_s {
lzma_lzma_state state;
/// The four most recent match distances
- uint32_t reps[REP_DISTANCES];
+ uint32_t reps[REPS];
/// Array of match candidates
lzma_match matches[MATCH_LEN_MAX + 1];
@@ -112,9 +112,9 @@ struct lzma_coder_s {
probability is_rep1[STATES];
probability is_rep2[STATES];
probability is_rep0_long[STATES][POS_STATES_MAX];
- probability pos_slot[LEN_TO_POS_STATES][POS_SLOTS];
- probability pos_special[FULL_DISTANCES - END_POS_MODEL_INDEX];
- probability pos_align[ALIGN_TABLE_SIZE];
+ probability dist_slot[DIST_STATES][DIST_SLOTS];
+ probability dist_special[FULL_DISTANCES - DIST_MODEL_END];
+ probability dist_align[ALIGN_SIZE];
// These are the same as in lzma_decoder.c except that the encoders
// include also price tables.
@@ -122,12 +122,12 @@ struct lzma_coder_s {
lzma_length_encoder rep_len_encoder;
// Price tables
- uint32_t pos_slot_prices[LEN_TO_POS_STATES][POS_SLOTS];
- uint32_t distances_prices[LEN_TO_POS_STATES][FULL_DISTANCES];
+ uint32_t dist_slot_prices[DIST_STATES][DIST_SLOTS];
+ uint32_t dist_prices[DIST_STATES][FULL_DISTANCES];
uint32_t dist_table_size;
uint32_t match_price_count;
- uint32_t align_prices[ALIGN_TABLE_SIZE];
+ uint32_t align_prices[ALIGN_SIZE];
uint32_t align_price_count;
// Optimal
@@ -138,11 +138,11 @@ struct lzma_coder_s {
extern void lzma_lzma_optimum_fast(
- lzma_coder *LZMA_RESTRICT coder, lzma_mf *LZMA_RESTRICT mf,
- uint32_t *LZMA_RESTRICT back_res, uint32_t *LZMA_RESTRICT len_res);
+ lzma_lzma1_encoder *restrict coder, lzma_mf *restrict mf,
+ uint32_t *restrict back_res, uint32_t *restrict len_res);
-extern void lzma_lzma_optimum_normal(lzma_coder *LZMA_RESTRICT coder,
- lzma_mf *LZMA_RESTRICT mf, uint32_t *LZMA_RESTRICT back_res,
- uint32_t *LZMA_RESTRICT len_res, uint32_t position);
+extern void lzma_lzma_optimum_normal(lzma_lzma1_encoder *restrict coder,
+ lzma_mf *restrict mf, uint32_t *restrict back_res,
+ uint32_t *restrict len_res, uint32_t position);
#endif
diff --git a/Utilities/cmliblzma/liblzma/rangecoder/range_common.h b/Utilities/cmliblzma/liblzma/rangecoder/range_common.h
index f15623e..2c74dc1 100644
--- a/Utilities/cmliblzma/liblzma/rangecoder/range_common.h
+++ b/Utilities/cmliblzma/liblzma/rangecoder/range_common.h
@@ -40,11 +40,8 @@
// This does the same for a complete bit tree.
// (A tree represented as an array.)
#define bittree_reset(probs, bit_levels) \
- do { \
- uint32_t bt_i; \
- for (bt_i = 0; bt_i < (1 << (bit_levels)); ++bt_i) \
- bit_reset((probs)[bt_i]); \
- } while (0)
+ for (uint32_t bt_i = 0; bt_i < (1 << (bit_levels)); ++bt_i) \
+ bit_reset((probs)[bt_i])
//////////////////////
diff --git a/Utilities/cmliblzma/liblzma/rangecoder/range_decoder.h b/Utilities/cmliblzma/liblzma/rangecoder/range_decoder.h
index 199e7b5..e0b051f 100644
--- a/Utilities/cmliblzma/liblzma/rangecoder/range_decoder.h
+++ b/Utilities/cmliblzma/liblzma/rangecoder/range_decoder.h
@@ -25,20 +25,26 @@ typedef struct {
/// Reads the first five bytes to initialize the range decoder.
-static inline bool
-rc_read_init(lzma_range_decoder *rc, const uint8_t *LZMA_RESTRICT in,
- size_t *LZMA_RESTRICT in_pos, size_t in_size)
+static inline lzma_ret
+rc_read_init(lzma_range_decoder *rc, const uint8_t *restrict in,
+ size_t *restrict in_pos, size_t in_size)
{
while (rc->init_bytes_left > 0) {
if (*in_pos == in_size)
- return false;
+ return LZMA_OK;
+
+ // The first byte is always 0x00. It could have been omitted
+ // in LZMA2 but it wasn't, so one byte is wasted in every
+ // LZMA2 chunk.
+ if (rc->init_bytes_left == 5 && in[*in_pos] != 0x00)
+ return LZMA_DATA_ERROR;
rc->code = (rc->code << 8) | in[*in_pos];
++*in_pos;
--rc->init_bytes_left;
}
- return true;
+ return LZMA_STREAM_END;
}
diff --git a/Utilities/cmliblzma/liblzma/rangecoder/range_encoder.h b/Utilities/cmliblzma/liblzma/rangecoder/range_encoder.h
index e9614f2..1e1c369 100644
--- a/Utilities/cmliblzma/liblzma/rangecoder/range_encoder.h
+++ b/Utilities/cmliblzma/liblzma/rangecoder/range_encoder.h
@@ -115,8 +115,7 @@ rc_direct(lzma_range_encoder *rc,
static inline void
rc_flush(lzma_range_encoder *rc)
{
- size_t i;
- for (i = 0; i < 5; ++i)
+ for (size_t i = 0; i < 5; ++i)
rc->symbols[rc->count++] = RC_FLUSH;
}
diff --git a/Utilities/cmliblzma/liblzma/simple/arm.c b/Utilities/cmliblzma/liblzma/simple/arm.c
index 8dcba39..181d0e3 100644
--- a/Utilities/cmliblzma/liblzma/simple/arm.c
+++ b/Utilities/cmliblzma/liblzma/simple/arm.c
@@ -15,19 +15,19 @@
static size_t
-arm_code(lzma_simple *simple lzma_attribute((__unused__)),
+arm_code(void *simple lzma_attribute((__unused__)),
uint32_t now_pos, bool is_encoder,
uint8_t *buffer, size_t size)
{
size_t i;
for (i = 0; i + 4 <= size; i += 4) {
if (buffer[i + 3] == 0xEB) {
- uint32_t dest;
uint32_t src = (buffer[i + 2] << 16)
| (buffer[i + 1] << 8)
| (buffer[i + 0]);
src <<= 2;
+ uint32_t dest;
if (is_encoder)
dest = now_pos + (uint32_t)(i) + 8 + src;
else
@@ -45,7 +45,7 @@ arm_code(lzma_simple *simple lzma_attribute((__unused__)),
static lzma_ret
-arm_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
+arm_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters, bool is_encoder)
{
return lzma_simple_coder_init(next, allocator, filters,
@@ -54,7 +54,8 @@ arm_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern lzma_ret
-lzma_simple_arm_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_simple_arm_encoder_init(lzma_next_coder *next,
+ const lzma_allocator *allocator,
const lzma_filter_info *filters)
{
return arm_coder_init(next, allocator, filters, true);
@@ -62,7 +63,8 @@ lzma_simple_arm_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern lzma_ret
-lzma_simple_arm_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_simple_arm_decoder_init(lzma_next_coder *next,
+ const lzma_allocator *allocator,
const lzma_filter_info *filters)
{
return arm_coder_init(next, allocator, filters, false);
diff --git a/Utilities/cmliblzma/liblzma/simple/armthumb.c b/Utilities/cmliblzma/liblzma/simple/armthumb.c
index 4b890a3..eab4862 100644
--- a/Utilities/cmliblzma/liblzma/simple/armthumb.c
+++ b/Utilities/cmliblzma/liblzma/simple/armthumb.c
@@ -15,7 +15,7 @@
static size_t
-armthumb_code(lzma_simple *simple lzma_attribute((__unused__)),
+armthumb_code(void *simple lzma_attribute((__unused__)),
uint32_t now_pos, bool is_encoder,
uint8_t *buffer, size_t size)
{
@@ -23,7 +23,6 @@ armthumb_code(lzma_simple *simple lzma_attribute((__unused__)),
for (i = 0; i + 4 <= size; i += 2) {
if ((buffer[i + 1] & 0xF8) == 0xF0
&& (buffer[i + 3] & 0xF8) == 0xF8) {
- uint32_t dest;
uint32_t src = ((buffer[i + 1] & 0x7) << 19)
| (buffer[i + 0] << 11)
| ((buffer[i + 3] & 0x7) << 8)
@@ -31,6 +30,7 @@ armthumb_code(lzma_simple *simple lzma_attribute((__unused__)),
src <<= 1;
+ uint32_t dest;
if (is_encoder)
dest = now_pos + (uint32_t)(i) + 4 + src;
else
@@ -50,7 +50,7 @@ armthumb_code(lzma_simple *simple lzma_attribute((__unused__)),
static lzma_ret
-armthumb_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
+armthumb_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters, bool is_encoder)
{
return lzma_simple_coder_init(next, allocator, filters,
@@ -60,7 +60,8 @@ armthumb_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern lzma_ret
lzma_simple_armthumb_encoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters)
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters)
{
return armthumb_coder_init(next, allocator, filters, true);
}
@@ -68,7 +69,8 @@ lzma_simple_armthumb_encoder_init(lzma_next_coder *next,
extern lzma_ret
lzma_simple_armthumb_decoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters)
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters)
{
return armthumb_coder_init(next, allocator, filters, false);
}
diff --git a/Utilities/cmliblzma/liblzma/simple/ia64.c b/Utilities/cmliblzma/liblzma/simple/ia64.c
index c537cac..580529e 100644
--- a/Utilities/cmliblzma/liblzma/simple/ia64.c
+++ b/Utilities/cmliblzma/liblzma/simple/ia64.c
@@ -15,7 +15,7 @@
static size_t
-ia64_code(lzma_simple *simple lzma_attribute((__unused__)),
+ia64_code(void *simple lzma_attribute((__unused__)),
uint32_t now_pos, bool is_encoder,
uint8_t *buffer, size_t size)
{
@@ -28,42 +28,36 @@ ia64_code(lzma_simple *simple lzma_attribute((__unused__)),
size_t i;
for (i = 0; i + 16 <= size; i += 16) {
- size_t slot;
-
const uint32_t instr_template = buffer[i] & 0x1F;
const uint32_t mask = BRANCH_TABLE[instr_template];
uint32_t bit_pos = 5;
- for (slot = 0; slot < 3; ++slot, bit_pos += 41) {
+ for (size_t slot = 0; slot < 3; ++slot, bit_pos += 41) {
+ if (((mask >> slot) & 1) == 0)
+ continue;
+
const size_t byte_pos = (bit_pos >> 3);
const uint32_t bit_res = bit_pos & 0x7;
uint64_t instruction = 0;
- uint64_t inst_norm;
- size_t j;
-
- if (((mask >> slot) & 1) == 0)
- continue;
- for (j = 0; j < 6; ++j)
+ for (size_t j = 0; j < 6; ++j)
instruction += (uint64_t)(
buffer[i + j + byte_pos])
<< (8 * j);
- inst_norm = instruction >> bit_res;
+ uint64_t inst_norm = instruction >> bit_res;
if (((inst_norm >> 37) & 0xF) == 0x5
&& ((inst_norm >> 9) & 0x7) == 0
/* && (inst_norm & 0x3F)== 0 */
) {
- uint32_t dest;
- size_t j;
-
uint32_t src = (uint32_t)(
(inst_norm >> 13) & 0xFFFFF);
src |= ((inst_norm >> 36) & 1) << 20;
src <<= 4;
+ uint32_t dest;
if (is_encoder)
dest = now_pos + (uint32_t)(i) + src;
else
@@ -79,7 +73,7 @@ ia64_code(lzma_simple *simple lzma_attribute((__unused__)),
instruction &= (1 << bit_res) - 1;
instruction |= (inst_norm << bit_res);
- for (j = 0; j < 6; j++)
+ for (size_t j = 0; j < 6; j++)
buffer[i + j + byte_pos] = (uint8_t)(
instruction
>> (8 * j));
@@ -92,7 +86,7 @@ ia64_code(lzma_simple *simple lzma_attribute((__unused__)),
static lzma_ret
-ia64_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
+ia64_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters, bool is_encoder)
{
return lzma_simple_coder_init(next, allocator, filters,
@@ -102,7 +96,8 @@ ia64_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern lzma_ret
lzma_simple_ia64_encoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters)
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters)
{
return ia64_coder_init(next, allocator, filters, true);
}
@@ -110,7 +105,8 @@ lzma_simple_ia64_encoder_init(lzma_next_coder *next,
extern lzma_ret
lzma_simple_ia64_decoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters)
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters)
{
return ia64_coder_init(next, allocator, filters, false);
}
diff --git a/Utilities/cmliblzma/liblzma/simple/powerpc.c b/Utilities/cmliblzma/liblzma/simple/powerpc.c
index 6f83511..54dfbf1 100644
--- a/Utilities/cmliblzma/liblzma/simple/powerpc.c
+++ b/Utilities/cmliblzma/liblzma/simple/powerpc.c
@@ -15,7 +15,7 @@
static size_t
-powerpc_code(lzma_simple *simple lzma_attribute((__unused__)),
+powerpc_code(void *simple lzma_attribute((__unused__)),
uint32_t now_pos, bool is_encoder,
uint8_t *buffer, size_t size)
{
@@ -49,7 +49,7 @@ powerpc_code(lzma_simple *simple lzma_attribute((__unused__)),
static lzma_ret
-powerpc_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
+powerpc_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters, bool is_encoder)
{
return lzma_simple_coder_init(next, allocator, filters,
@@ -59,7 +59,8 @@ powerpc_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern lzma_ret
lzma_simple_powerpc_encoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters)
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters)
{
return powerpc_coder_init(next, allocator, filters, true);
}
@@ -67,7 +68,8 @@ lzma_simple_powerpc_encoder_init(lzma_next_coder *next,
extern lzma_ret
lzma_simple_powerpc_decoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters)
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters)
{
return powerpc_coder_init(next, allocator, filters, false);
}
diff --git a/Utilities/cmliblzma/liblzma/simple/simple_coder.c b/Utilities/cmliblzma/liblzma/simple/simple_coder.c
index f3bbdd7..13ebabc 100644
--- a/Utilities/cmliblzma/liblzma/simple/simple_coder.c
+++ b/Utilities/cmliblzma/liblzma/simple/simple_coder.c
@@ -18,10 +18,10 @@
/// Copied or encodes/decodes more data to out[].
static lzma_ret
-copy_or_code(lzma_coder *coder, lzma_allocator *allocator,
- const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
- size_t in_size, uint8_t *LZMA_RESTRICT out,
- size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action)
+copy_or_code(lzma_simple_coder *coder, const lzma_allocator *allocator,
+ const uint8_t *restrict in, size_t *restrict in_pos,
+ size_t in_size, uint8_t *restrict out,
+ size_t *restrict out_pos, size_t out_size, lzma_action action)
{
assert(!coder->end_was_reached);
@@ -55,7 +55,7 @@ copy_or_code(lzma_coder *coder, lzma_allocator *allocator,
static size_t
-call_filter(lzma_coder *coder, uint8_t *buffer, size_t size)
+call_filter(lzma_simple_coder *coder, uint8_t *buffer, size_t size)
{
const size_t filtered = coder->filter(coder->simple,
coder->now_pos, coder->is_encoder,
@@ -66,13 +66,12 @@ call_filter(lzma_coder *coder, uint8_t *buffer, size_t size)
static lzma_ret
-simple_code(lzma_coder *coder, lzma_allocator *allocator,
- const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
- size_t in_size, uint8_t *LZMA_RESTRICT out,
- size_t *LZMA_RESTRICT out_pos, size_t out_size, lzma_action action)
+simple_code(void *coder_ptr, const lzma_allocator *allocator,
+ const uint8_t *restrict in, size_t *restrict in_pos,
+ size_t in_size, uint8_t *restrict out,
+ size_t *restrict out_pos, size_t out_size, lzma_action action)
{
- size_t out_avail;
- size_t buf_avail;
+ lzma_simple_coder *coder = coder_ptr;
// TODO: Add partial support for LZMA_SYNC_FLUSH. We can support it
// in cases when the filter is able to filter everything. With most
@@ -108,13 +107,9 @@ simple_code(lzma_coder *coder, lzma_allocator *allocator,
// more data to out[] hopefully filling it completely. Then filter
// the data in out[]. This step is where most of the data gets
// filtered if the buffer sizes used by the application are reasonable.
- out_avail = out_size - *out_pos;
- buf_avail = coder->size - coder->pos;
+ const size_t out_avail = out_size - *out_pos;
+ const size_t buf_avail = coder->size - coder->pos;
if (out_avail > buf_avail || buf_avail == 0) {
- size_t size;
- size_t filtered;
- size_t unfiltered;
-
// Store the old position so that we know from which byte
// to start filtering.
const size_t out_start = *out_pos;
@@ -137,10 +132,11 @@ simple_code(lzma_coder *coder, lzma_allocator *allocator,
}
// Filter out[].
- size = *out_pos - out_start;
- filtered = call_filter(coder, out + out_start, size);
+ const size_t size = *out_pos - out_start;
+ const size_t filtered = call_filter(
+ coder, out + out_start, size);
- unfiltered = size - filtered;
+ const size_t unfiltered = size - filtered;
assert(unfiltered <= coder->allocated / 2);
// Now we can update coder->pos and coder->size, because
@@ -204,8 +200,9 @@ simple_code(lzma_coder *coder, lzma_allocator *allocator,
static void
-simple_coder_end(lzma_coder *coder, lzma_allocator *allocator)
+simple_coder_end(void *coder_ptr, const lzma_allocator *allocator)
{
+ lzma_simple_coder *coder = coder_ptr;
lzma_next_end(&coder->next, allocator);
lzma_free(coder->simple, allocator);
lzma_free(coder, allocator);
@@ -214,10 +211,12 @@ simple_coder_end(lzma_coder *coder, lzma_allocator *allocator)
static lzma_ret
-simple_coder_update(lzma_coder *coder, lzma_allocator *allocator,
+simple_coder_update(void *coder_ptr, const lzma_allocator *allocator,
const lzma_filter *filters_null lzma_attribute((__unused__)),
const lzma_filter *reversed_filters)
{
+ lzma_simple_coder *coder = coder_ptr;
+
// No update support, just call the next filter in the chain.
return lzma_next_filter_update(
&coder->next, allocator, reversed_filters + 1);
@@ -225,59 +224,59 @@ simple_coder_update(lzma_coder *coder, lzma_allocator *allocator,
extern lzma_ret
-lzma_simple_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_simple_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters,
- size_t (*filter)(lzma_simple *simple, uint32_t now_pos,
+ size_t (*filter)(void *simple, uint32_t now_pos,
bool is_encoder, uint8_t *buffer, size_t size),
size_t simple_size, size_t unfiltered_max,
uint32_t alignment, bool is_encoder)
{
- // Allocate memory for the lzma_coder structure if needed.
- if (next->coder == NULL) {
+ // Allocate memory for the lzma_simple_coder structure if needed.
+ lzma_simple_coder *coder = next->coder;
+ if (coder == NULL) {
// Here we allocate space also for the temporary buffer. We
// need twice the size of unfiltered_max, because then it
// is always possible to filter at least unfiltered_max bytes
// more data in coder->buffer[] if it can be filled completely.
- next->coder = lzma_alloc(sizeof(lzma_coder)
+ coder = lzma_alloc(sizeof(lzma_simple_coder)
+ 2 * unfiltered_max, allocator);
- if (next->coder == NULL)
+ if (coder == NULL)
return LZMA_MEM_ERROR;
+ next->coder = coder;
next->code = &simple_code;
next->end = &simple_coder_end;
next->update = &simple_coder_update;
- next->coder->next = LZMA_NEXT_CODER_INIT;
- next->coder->filter = filter;
- next->coder->allocated = 2 * unfiltered_max;
+ coder->next = LZMA_NEXT_CODER_INIT;
+ coder->filter = filter;
+ coder->allocated = 2 * unfiltered_max;
// Allocate memory for filter-specific data structure.
if (simple_size > 0) {
- next->coder->simple = lzma_alloc(
- simple_size, allocator);
- if (next->coder->simple == NULL)
+ coder->simple = lzma_alloc(simple_size, allocator);
+ if (coder->simple == NULL)
return LZMA_MEM_ERROR;
} else {
- next->coder->simple = NULL;
+ coder->simple = NULL;
}
}
if (filters[0].options != NULL) {
const lzma_options_bcj *simple = filters[0].options;
- next->coder->now_pos = simple->start_offset;
- if (next->coder->now_pos & (alignment - 1))
+ coder->now_pos = simple->start_offset;
+ if (coder->now_pos & (alignment - 1))
return LZMA_OPTIONS_ERROR;
} else {
- next->coder->now_pos = 0;
+ coder->now_pos = 0;
}
// Reset variables.
- next->coder->is_encoder = is_encoder;
- next->coder->end_was_reached = false;
- next->coder->pos = 0;
- next->coder->filtered = 0;
- next->coder->size = 0;
-
- return lzma_next_filter_init(
- &next->coder->next, allocator, filters + 1);
+ coder->is_encoder = is_encoder;
+ coder->end_was_reached = false;
+ coder->pos = 0;
+ coder->filtered = 0;
+ coder->size = 0;
+
+ return lzma_next_filter_init(&coder->next, allocator, filters + 1);
}
diff --git a/Utilities/cmliblzma/liblzma/simple/simple_coder.h b/Utilities/cmliblzma/liblzma/simple/simple_coder.h
index 0952fad..19c2ee0 100644
--- a/Utilities/cmliblzma/liblzma/simple/simple_coder.h
+++ b/Utilities/cmliblzma/liblzma/simple/simple_coder.h
@@ -17,44 +17,56 @@
extern lzma_ret lzma_simple_x86_encoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters);
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters);
extern lzma_ret lzma_simple_x86_decoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters);
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters);
extern lzma_ret lzma_simple_powerpc_encoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters);
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters);
extern lzma_ret lzma_simple_powerpc_decoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters);
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters);
extern lzma_ret lzma_simple_ia64_encoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters);
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters);
extern lzma_ret lzma_simple_ia64_decoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters);
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters);
extern lzma_ret lzma_simple_arm_encoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters);
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters);
extern lzma_ret lzma_simple_arm_decoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters);
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters);
extern lzma_ret lzma_simple_armthumb_encoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters);
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters);
extern lzma_ret lzma_simple_armthumb_decoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters);
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters);
extern lzma_ret lzma_simple_sparc_encoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters);
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters);
extern lzma_ret lzma_simple_sparc_decoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters);
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters);
#endif
diff --git a/Utilities/cmliblzma/liblzma/simple/simple_decoder.c b/Utilities/cmliblzma/liblzma/simple/simple_decoder.c
index 034e158..1d864f2 100644
--- a/Utilities/cmliblzma/liblzma/simple/simple_decoder.c
+++ b/Utilities/cmliblzma/liblzma/simple/simple_decoder.c
@@ -14,18 +14,17 @@
extern lzma_ret
-lzma_simple_props_decode(void **options, lzma_allocator *allocator,
+lzma_simple_props_decode(void **options, const lzma_allocator *allocator,
const uint8_t *props, size_t props_size)
{
- lzma_options_bcj *opt;
-
if (props_size == 0)
return LZMA_OK;
if (props_size != 4)
return LZMA_OPTIONS_ERROR;
- opt = lzma_alloc(sizeof(lzma_options_bcj), allocator);
+ lzma_options_bcj *opt = lzma_alloc(
+ sizeof(lzma_options_bcj), allocator);
if (opt == NULL)
return LZMA_MEM_ERROR;
diff --git a/Utilities/cmliblzma/liblzma/simple/simple_decoder.h b/Utilities/cmliblzma/liblzma/simple/simple_decoder.h
index b8bf590..bed8d37 100644
--- a/Utilities/cmliblzma/liblzma/simple/simple_decoder.h
+++ b/Utilities/cmliblzma/liblzma/simple/simple_decoder.h
@@ -16,7 +16,7 @@
#include "simple_coder.h"
extern lzma_ret lzma_simple_props_decode(
- void **options, lzma_allocator *allocator,
+ void **options, const lzma_allocator *allocator,
const uint8_t *props, size_t props_size);
#endif
diff --git a/Utilities/cmliblzma/liblzma/simple/simple_private.h b/Utilities/cmliblzma/liblzma/simple/simple_private.h
index fcf9f7c..9d2c0fd 100644
--- a/Utilities/cmliblzma/liblzma/simple/simple_private.h
+++ b/Utilities/cmliblzma/liblzma/simple/simple_private.h
@@ -16,9 +16,7 @@
#include "simple_coder.h"
-typedef struct lzma_simple_s lzma_simple;
-
-struct lzma_coder_s {
+typedef struct {
/// Next filter in the chain
lzma_next_coder next;
@@ -33,12 +31,12 @@ struct lzma_coder_s {
/// Pointer to filter-specific function, which does
/// the actual filtering.
- size_t (*filter)(lzma_simple *simple, uint32_t now_pos,
+ size_t (*filter)(void *simple, uint32_t now_pos,
bool is_encoder, uint8_t *buffer, size_t size);
/// Pointer to filter-specific data, or NULL if filter doesn't need
/// any extra data.
- lzma_simple *simple;
+ void *simple;
/// The lowest 32 bits of the current position in the data. Most
/// filters need this to do conversions between absolute and relative
@@ -62,12 +60,13 @@ struct lzma_coder_s {
/// Temporary buffer
uint8_t buffer[];
-};
+} lzma_simple_coder;
extern lzma_ret lzma_simple_coder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters,
- size_t (*filter)(lzma_simple *simple, uint32_t now_pos,
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters,
+ size_t (*filter)(void *simple, uint32_t now_pos,
bool is_encoder, uint8_t *buffer, size_t size),
size_t simple_size, size_t unfiltered_max,
uint32_t alignment, bool is_encoder);
diff --git a/Utilities/cmliblzma/liblzma/simple/sparc.c b/Utilities/cmliblzma/liblzma/simple/sparc.c
index 0ddd2ac..74b2655 100644
--- a/Utilities/cmliblzma/liblzma/simple/sparc.c
+++ b/Utilities/cmliblzma/liblzma/simple/sparc.c
@@ -15,7 +15,7 @@
static size_t
-sparc_code(lzma_simple *simple lzma_attribute((__unused__)),
+sparc_code(void *simple lzma_attribute((__unused__)),
uint32_t now_pos, bool is_encoder,
uint8_t *buffer, size_t size)
{
@@ -26,8 +26,6 @@ sparc_code(lzma_simple *simple lzma_attribute((__unused__)),
|| (buffer[i] == 0x7F
&& (buffer[i + 1] & 0xC0) == 0xC0)) {
- uint32_t dest;
-
uint32_t src = ((uint32_t)buffer[i + 0] << 24)
| ((uint32_t)buffer[i + 1] << 16)
| ((uint32_t)buffer[i + 2] << 8)
@@ -35,6 +33,7 @@ sparc_code(lzma_simple *simple lzma_attribute((__unused__)),
src <<= 2;
+ uint32_t dest;
if (is_encoder)
dest = now_pos + (uint32_t)(i) + src;
else
@@ -58,7 +57,7 @@ sparc_code(lzma_simple *simple lzma_attribute((__unused__)),
static lzma_ret
-sparc_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
+sparc_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters, bool is_encoder)
{
return lzma_simple_coder_init(next, allocator, filters,
@@ -68,7 +67,8 @@ sparc_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern lzma_ret
lzma_simple_sparc_encoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters)
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters)
{
return sparc_coder_init(next, allocator, filters, true);
}
@@ -76,7 +76,8 @@ lzma_simple_sparc_encoder_init(lzma_next_coder *next,
extern lzma_ret
lzma_simple_sparc_decoder_init(lzma_next_coder *next,
- lzma_allocator *allocator, const lzma_filter_info *filters)
+ const lzma_allocator *allocator,
+ const lzma_filter_info *filters)
{
return sparc_coder_init(next, allocator, filters, false);
}
diff --git a/Utilities/cmliblzma/liblzma/simple/x86.c b/Utilities/cmliblzma/liblzma/simple/x86.c
index 95858e5..23d0c42 100644
--- a/Utilities/cmliblzma/liblzma/simple/x86.c
+++ b/Utilities/cmliblzma/liblzma/simple/x86.c
@@ -17,14 +17,14 @@
#define Test86MSByte(b) ((b) == 0 || (b) == 0xFF)
-struct lzma_simple_s {
+typedef struct {
uint32_t prev_mask;
uint32_t prev_pos;
-};
+} lzma_simple_x86;
static size_t
-x86_code(lzma_simple *simple, uint32_t now_pos, bool is_encoder,
+x86_code(void *simple_ptr, uint32_t now_pos, bool is_encoder,
uint8_t *buffer, size_t size)
{
static const bool MASK_TO_ALLOWED_STATUS[8]
@@ -33,39 +33,34 @@ x86_code(lzma_simple *simple, uint32_t now_pos, bool is_encoder,
static const uint32_t MASK_TO_BIT_NUMBER[8]
= { 0, 1, 2, 2, 3, 3, 3, 3 };
+ lzma_simple_x86 *simple = simple_ptr;
uint32_t prev_mask = simple->prev_mask;
uint32_t prev_pos = simple->prev_pos;
- size_t limit;
- size_t buffer_pos;
-
if (size < 5)
return 0;
if (now_pos - prev_pos > 5)
prev_pos = now_pos - 5;
- limit = size - 5;
- buffer_pos = 0;
+ const size_t limit = size - 5;
+ size_t buffer_pos = 0;
while (buffer_pos <= limit) {
- uint32_t offset;
- uint32_t i;
-
uint8_t b = buffer[buffer_pos];
if (b != 0xE8 && b != 0xE9) {
++buffer_pos;
continue;
}
- offset = now_pos + (uint32_t)(buffer_pos)
+ const uint32_t offset = now_pos + (uint32_t)(buffer_pos)
- prev_pos;
prev_pos = now_pos + (uint32_t)(buffer_pos);
if (offset > 5) {
prev_mask = 0;
} else {
- for (i = 0; i < offset; ++i) {
+ for (uint32_t i = 0; i < offset; ++i) {
prev_mask &= 0x77;
prev_mask <<= 1;
}
@@ -84,8 +79,6 @@ x86_code(lzma_simple *simple, uint32_t now_pos, bool is_encoder,
uint32_t dest;
while (true) {
- uint32_t i;
-
if (is_encoder)
dest = src + (now_pos + (uint32_t)(
buffer_pos) + 5);
@@ -96,7 +89,8 @@ x86_code(lzma_simple *simple, uint32_t now_pos, bool is_encoder,
if (prev_mask == 0)
break;
- i = MASK_TO_BIT_NUMBER[prev_mask >> 1];
+ const uint32_t i = MASK_TO_BIT_NUMBER[
+ prev_mask >> 1];
b = (uint8_t)(dest >> (24 - i * 8));
@@ -130,15 +124,17 @@ x86_code(lzma_simple *simple, uint32_t now_pos, bool is_encoder,
static lzma_ret
-x86_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
+x86_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters, bool is_encoder)
{
const lzma_ret ret = lzma_simple_coder_init(next, allocator, filters,
- &x86_code, sizeof(lzma_simple), 5, 1, is_encoder);
+ &x86_code, sizeof(lzma_simple_x86), 5, 1, is_encoder);
if (ret == LZMA_OK) {
- next->coder->simple->prev_mask = 0;
- next->coder->simple->prev_pos = (uint32_t)(-5);
+ lzma_simple_coder *coder = next->coder;
+ lzma_simple_x86 *simple = coder->simple;
+ simple->prev_mask = 0;
+ simple->prev_pos = (uint32_t)(-5);
}
return ret;
@@ -146,7 +142,8 @@ x86_coder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern lzma_ret
-lzma_simple_x86_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_simple_x86_encoder_init(lzma_next_coder *next,
+ const lzma_allocator *allocator,
const lzma_filter_info *filters)
{
return x86_coder_init(next, allocator, filters, true);
@@ -154,7 +151,8 @@ lzma_simple_x86_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern lzma_ret
-lzma_simple_x86_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
+lzma_simple_x86_decoder_init(lzma_next_coder *next,
+ const lzma_allocator *allocator,
const lzma_filter_info *filters)
{
return x86_coder_init(next, allocator, filters, false);
diff --git a/Utilities/cmlibrhash/librhash/rhash.c b/Utilities/cmlibrhash/librhash/rhash.c
index ad6249b..34e1eb3 100644
--- a/Utilities/cmlibrhash/librhash/rhash.c
+++ b/Utilities/cmlibrhash/librhash/rhash.c
@@ -18,6 +18,8 @@
#define _LARGEFILE64_SOURCE
#define _FILE_OFFSET_BITS 64
+#include "ustd.h" /* Need this first within CMake. */
+
#include <string.h> /* memset() */
#include <stdlib.h> /* free() */
#include <stddef.h> /* ptrdiff_t */