summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitlab/artifacts.yml2
-rw-r--r--Auxiliary/vim/syntax/cmake.vim3
-rw-r--r--CMakeLists.txt2
-rw-r--r--Help/command/add_custom_command.rst5
-rw-r--r--Help/command/cmake_host_system_information.rst2
-rw-r--r--Help/command/export.rst84
-rw-r--r--Help/command/file.rst68
-rw-r--r--Help/command/if.rst41
-rw-r--r--Help/command/install.rst31
-rw-r--r--Help/command/try_compile.rst12
-rw-r--r--Help/command/try_run.rst1
-rw-r--r--Help/dev/try_compile-linker-language.rst6
-rw-r--r--Help/manual/cmake-generator-expressions.7.rst12
-rw-r--r--Help/manual/cmake-policies.7.rst8
-rw-r--r--Help/manual/cmake-properties.7.rst3
-rw-r--r--Help/manual/cmake-variables.7.rst10
-rw-r--r--Help/manual/cmake.1.rst5
-rw-r--r--Help/policy/CMP0156.rst47
-rw-r--r--Help/prop_test/WILL_FAIL.rst35
-rw-r--r--Help/prop_tgt/AUTOGEN_COMMAND_LINE_LENGTH_MAX.rst18
-rw-r--r--Help/prop_tgt/AUTOMOC.rst4
-rw-r--r--Help/prop_tgt/AUTOUIC.rst4
-rw-r--r--Help/prop_tgt/EXPORT_FIND_PACKAGE_NAME.rst12
-rw-r--r--Help/prop_tgt/IMPORTED_LOCATION.rst2
-rw-r--r--Help/prop_tgt/LINKER_TYPE.rst26
-rw-r--r--Help/prop_tgt/UNITY_BUILD.rst22
-rw-r--r--Help/release/3.22.rst2
-rw-r--r--Help/release/dev/0-sample-topic.rst7
-rw-r--r--Help/release/dev/Linker-user-selection.rst6
-rw-r--r--Help/release/dev/cmake-E-cat-stdin.rst5
-rw-r--r--Help/release/dev/compiler-linker.rst8
-rw-r--r--Help/release/dev/export-find_dependency-calls.rst16
-rw-r--r--Help/release/dev/if-check-file-permissions.rst5
-rw-r--r--Help/release/dev/install-export-xcframework.rst9
-rw-r--r--Help/release/dev/link-deduplicate-libs.rst5
-rw-r--r--Help/release/dev/make-test-depend-on-all.rst6
-rw-r--r--Help/release/dev/project-include-multiple.rst11
-rw-r--r--Help/release/dev/unity-build-objc.rst5
-rw-r--r--Help/release/index.rst2
-rw-r--r--Help/variable/CMAKE_AUTOGEN_COMMAND_LINE_LENGTH_MAX.rst10
-rw-r--r--Help/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.rst10
-rw-r--r--Help/variable/CMAKE_EXPORT_FIND_PACKAGE_NAME.rst6
-rw-r--r--Help/variable/CMAKE_LANG_COMPILER_LINKER.rst15
-rw-r--r--Help/variable/CMAKE_LANG_COMPILER_LINKER_FRONTEND_VARIANT.rst21
-rw-r--r--Help/variable/CMAKE_LANG_COMPILER_LINKER_ID.rst31
-rw-r--r--Help/variable/CMAKE_LANG_COMPILER_LINKER_VERSION.rst10
-rw-r--r--Help/variable/CMAKE_LANG_USING_LINKER_MODE.rst15
-rw-r--r--Help/variable/CMAKE_LANG_USING_LINKER_TYPE.rst30
-rw-r--r--Help/variable/CMAKE_LINKER_TYPE.rst18
-rw-r--r--Help/variable/CMAKE_PROJECT_INCLUDE.rst7
-rw-r--r--Help/variable/CMAKE_PROJECT_INCLUDE_BEFORE.rst7
-rw-r--r--Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst7
-rw-r--r--Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE_BEFORE.rst7
-rw-r--r--Help/variable/CMAKE_PROJECT_TOP_LEVEL_INCLUDES.rst4
-rw-r--r--Help/variable/CMAKE_REQUIRE_FIND_PACKAGE_PackageName.rst31
-rw-r--r--Help/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY.rst2
-rw-r--r--Help/variable/CMAKE_SKIP_TEST_ALL_DEPENDENCY.rst19
-rw-r--r--Help/variable/LINKER_PREDEFINED_TYPES.txt57
-rw-r--r--Modules/CMakeASMCompiler.cmake.in6
-rw-r--r--Modules/CMakeCCompiler.cmake.in6
-rw-r--r--Modules/CMakeCUDACompiler.cmake.in7
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in6
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake5
-rw-r--r--Modules/CMakeDetermineCompilerABI.cmake88
-rw-r--r--Modules/CMakeDetermineFortranCompiler.cmake2
-rw-r--r--Modules/CMakeFindBinUtils.cmake11
-rw-r--r--Modules/CMakeFindPackageMode.cmake7
-rw-r--r--Modules/CMakeFortranCompiler.cmake.in4
-rw-r--r--Modules/CMakeHIPCompiler.cmake.in6
-rw-r--r--Modules/CMakeOBJCCompiler.cmake.in6
-rw-r--r--Modules/CMakeOBJCXXCompiler.cmake.in6
-rw-r--r--Modules/CMakePackageConfigHelpers.cmake104
-rw-r--r--Modules/CMakeParseImplicitLinkInfo.cmake205
-rw-r--r--Modules/CheckIPOSupported/main.c2
-rw-r--r--Modules/Compiler/ADSP-ASM.cmake6
-rw-r--r--Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake7
-rw-r--r--Modules/Compiler/GNU.cmake32
-rw-r--r--Modules/ExternalProject.cmake20
-rw-r--r--Modules/FetchContent.cmake47
-rw-r--r--Modules/FindBLAS.cmake6
-rw-r--r--Modules/FindLAPACK.cmake6
-rw-r--r--Modules/FindOpenThreads.cmake30
-rw-r--r--Modules/FindwxWidgets.cmake82
-rw-r--r--Modules/Internal/CMakeDetermineLinkerId.cmake92
-rw-r--r--Modules/Platform/AIX-GNU.cmake2
-rw-r--r--Modules/Platform/AIX-XL.cmake1
-rw-r--r--Modules/Platform/Apple-Clang.cmake9
-rw-r--r--Modules/Platform/Apple-GNU.cmake3
-rw-r--r--Modules/Platform/CYGWIN-GNU.cmake2
-rw-r--r--Modules/Platform/Darwin.cmake8
-rw-r--r--Modules/Platform/Linux-Clang-CUDA.cmake2
-rw-r--r--Modules/Platform/Linux-GNU.cmake9
-rw-r--r--Modules/Platform/Linux-NVIDIA-CUDA.cmake9
-rw-r--r--Modules/Platform/Windows-Clang.cmake13
-rw-r--r--Modules/Platform/Windows-GNU.cmake7
-rw-r--r--Modules/Platform/Windows-MSVC.cmake8
-rw-r--r--Modules/Platform/Windows-NVIDIA-CUDA.cmake6
-rw-r--r--Modules/PlatformSelectionFile.cmake.in24
-rw-r--r--Modules/UseEcos.cmake40
-rw-r--r--Modules/UseSWIG.cmake2
-rw-r--r--Source/CMakeLists.txt2
-rw-r--r--Source/CMakeVersion.cmake4
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.cxx153
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.h6
-rw-r--r--Source/CPack/cmCPackInnoSetupGenerator.cxx8
-rw-r--r--Source/CPack/cmCPackLog.h2
-rw-r--r--Source/CTest/cmCTestBZR.cxx2
-rw-r--r--Source/CTest/cmCTestCVS.cxx4
-rw-r--r--Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx22
-rw-r--r--Source/CTest/cmCTestGIT.cxx2
-rw-r--r--Source/CTest/cmCTestHG.cxx6
-rw-r--r--Source/CTest/cmCTestP4.cxx26
-rw-r--r--Source/CTest/cmCTestSVN.cxx22
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx32
-rw-r--r--Source/CTest/cmCTestScriptHandler.h7
-rw-r--r--Source/Checks/Curses/CMakeLists.txt2
-rw-r--r--Source/Checks/Curses/CheckCurses.c2
-rw-r--r--Source/Modules/CMakeBuildUtilities.cmake2
-rw-r--r--Source/cmAddCustomCommandCommand.cxx4
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.cxx2
-rw-r--r--Source/cmComputeLinkDepends.cxx252
-rw-r--r--Source/cmConditionEvaluator.cxx21
-rw-r--r--Source/cmCoreTryCompile.cxx54
-rw-r--r--Source/cmCoreTryCompile.h1
-rw-r--r--Source/cmDebuggerStackFrame.h4
-rw-r--r--Source/cmDebuggerThread.cxx4
-rw-r--r--Source/cmDyndepCollation.cxx6
-rw-r--r--Source/cmExportBuildAndroidMKGenerator.cxx4
-rw-r--r--Source/cmExportBuildAndroidMKGenerator.h7
-rw-r--r--Source/cmExportBuildFileGenerator.cxx46
-rw-r--r--Source/cmExportBuildFileGenerator.h36
-rw-r--r--Source/cmExportCommand.cxx106
-rw-r--r--Source/cmExportFileGenerator.cxx214
-rw-r--r--Source/cmExportFileGenerator.h34
-rw-r--r--Source/cmExportInstallAndroidMKGenerator.cxx11
-rw-r--r--Source/cmExportInstallAndroidMKGenerator.h12
-rw-r--r--Source/cmExportInstallFileGenerator.cxx40
-rw-r--r--Source/cmExportInstallFileGenerator.h8
-rw-r--r--Source/cmExportSet.cxx25
-rw-r--r--Source/cmExportSet.h31
-rw-r--r--Source/cmFileCommand.cxx16
-rw-r--r--Source/cmFindPackageCommand.cxx2
-rw-r--r--Source/cmFindPackageStack.cxx7
-rw-r--r--Source/cmFindPackageStack.h33
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx5
-rw-r--r--Source/cmGeneratorTarget.cxx82
-rw-r--r--Source/cmGeneratorTarget.h7
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx13
-rw-r--r--Source/cmGlobalGenerator.cxx31
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx36
-rw-r--r--Source/cmGlobalNinjaGenerator.h5
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx3
-rw-r--r--Source/cmInstallCommand.cxx7
-rw-r--r--Source/cmInstallExportGenerator.cxx4
-rw-r--r--Source/cmInstallExportGenerator.h4
-rw-r--r--Source/cmJSONState.cxx6
-rw-r--r--Source/cmLinkItemGraphVisitor.cxx2
-rw-r--r--Source/cmLocalGenerator.cxx60
-rw-r--r--Source/cmLocalGenerator.h3
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx21
-rw-r--r--Source/cmMakefile.cxx56
-rw-r--r--Source/cmMakefile.h18
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx3
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx3
-rw-r--r--Source/cmMakefileTargetGenerator.cxx2
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx8
-rw-r--r--Source/cmNinjaTargetGenerator.cxx17
-rw-r--r--Source/cmNinjaTargetGenerator.h1
-rw-r--r--Source/cmPolicies.h9
-rw-r--r--Source/cmProjectCommand.cxx65
-rw-r--r--Source/cmQtAutoGen.cxx7
-rw-r--r--Source/cmQtAutoGen.h5
-rw-r--r--Source/cmQtAutoGenInitializer.cxx36
-rw-r--r--Source/cmQtAutoGenInitializer.h3
-rw-r--r--Source/cmQtAutoMocUic.cxx116
-rw-r--r--Source/cmRulePlaceholderExpander.cxx25
-rw-r--r--Source/cmRulePlaceholderExpander.h1
-rw-r--r--Source/cmTarget.cxx13
-rw-r--r--Source/cmTarget.h4
-rw-r--r--Source/cmTargetExport.h2
-rw-r--r--Source/cmTransformDepfile.cxx7
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx10
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx12
-rw-r--r--Source/cmcmd.cxx18
-rw-r--r--Tests/Architecture/bar.c2
-rw-r--r--Tests/BuildDepends/Project/link_depends_no_shared_exe.c2
-rw-r--r--Tests/CMakeCommands/target_compile_definitions/consumer.c2
-rw-r--r--Tests/CMakeCommands/target_compile_features/main.c2
-rw-r--r--Tests/CMakeCommands/target_compile_features/restrict_user.c2
-rw-r--r--Tests/CMakeCommands/target_compile_options/consumer.c2
-rw-r--r--Tests/CMakeCommands/target_include_directories/consumer.c2
-rw-r--r--Tests/CMakeLib/CMakeLists.txt1
-rw-r--r--Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeLists.txt2
-rw-r--r--Tests/CMakeLib/testDebuggerThread.cxx33
-rw-r--r--Tests/COnly/conly.c2
-rw-r--r--Tests/COnly/libc1.c2
-rw-r--r--Tests/COnly/libc2.c2
-rw-r--r--Tests/CPackInnoSetupGenerator/main.c2
-rw-r--r--Tests/CTestTestVerboseOutput/nop.c2
-rw-r--r--Tests/CommandLength/test.c2
-rw-r--r--Tests/CompileDefinitions/runtest.c2
-rw-r--r--Tests/CompileFeatures/c_variadic_macros.c2
-rw-r--r--Tests/CompileFeatures/default_dialect.c2
-rw-r--r--Tests/CompileFeatures/genex_test.c2
-rw-r--r--Tests/Complex/Executable/Sub1/NameConflictTest.c2
-rw-r--r--Tests/Complex/Executable/Sub2/NameConflictTest.c2
-rw-r--r--Tests/Complex/Library/TestLink.c2
-rw-r--r--Tests/Complex/Library/testConly.c2
-rw-r--r--Tests/ComplexOneConfig/Executable/Sub1/NameConflictTest.c2
-rw-r--r--Tests/ComplexOneConfig/Executable/Sub2/NameConflictTest.c2
-rw-r--r--Tests/ComplexOneConfig/Library/TestLink.c2
-rw-r--r--Tests/ComplexOneConfig/Library/testConly.c2
-rw-r--r--Tests/ConfigSources/CMakeLists.txt8
-rw-r--r--Tests/ConfigSources/main_one_config.cpp8
-rw-r--r--Tests/Cuda/WithC/main.c2
-rw-r--r--Tests/CudaOnly/CMakeLists.txt1
-rw-r--r--Tests/CudaOnly/TryCompileTargetStatic/CMakeLists.txt6
-rw-r--r--Tests/CudaOnly/TryCompileTargetStatic/main.cu5
-rw-r--r--Tests/CustomCommand/gen_redirect_in.c2
-rw-r--r--Tests/CustomCommandWorkingDirectory/customTarget.c2
-rw-r--r--Tests/Dependency/1/OneSrc.c2
-rw-r--r--Tests/Dependency/Case1/a.c2
-rw-r--r--Tests/Dependency/Case1/b.c4
-rw-r--r--Tests/Dependency/Case1/b2.c2
-rw-r--r--Tests/Dependency/Case1/c.c4
-rw-r--r--Tests/Dependency/Case1/c2.c4
-rw-r--r--Tests/Dependency/Case1/d.c4
-rw-r--r--Tests/Dependency/Case1/main.c2
-rw-r--r--Tests/Dependency/Case4/bar.c4
-rw-r--r--Tests/Dependency/Case4/foo.c2
-rw-r--r--Tests/Dependency/Eight/EightSrc.c4
-rw-r--r--Tests/Dependency/Exec/ExecMain.c2
-rw-r--r--Tests/Dependency/Exec2/ExecMain.c2
-rw-r--r--Tests/Dependency/Exec3/ExecMain.c2
-rw-r--r--Tests/Dependency/Exec4/ExecMain.c2
-rw-r--r--Tests/Dependency/Five/FiveSrc.c4
-rw-r--r--Tests/Dependency/Four/FourSrc.c8
-rw-r--r--Tests/Dependency/NoDepA/NoDepASrc.c2
-rw-r--r--Tests/Dependency/NoDepB/NoDepBSrc.c4
-rw-r--r--Tests/Dependency/NoDepC/NoDepCSrc.c4
-rw-r--r--Tests/Dependency/Seven/SevenSrc.c4
-rw-r--r--Tests/Dependency/Six/SixASrc.c6
-rw-r--r--Tests/Dependency/Six/SixBSrc.c8
-rw-r--r--Tests/Dependency/Three/ThreeSrc.c6
-rw-r--r--Tests/Dependency/Two/TwoCustomSrc.c4
-rw-r--r--Tests/Dependency/Two/TwoSrc.c2
-rw-r--r--Tests/DoubleProject/silly.c2
-rw-r--r--Tests/ExportImport/Export/CMakeLists.txt5
-rw-r--r--Tests/ExportImport/Export/testExe2.c2
-rw-r--r--Tests/ExportImport/External/FooConfig.cmake3
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt87
-rw-r--r--Tests/ExportImport/Import/A/deps_iface.c2
-rw-r--r--Tests/ExportImport/Import/A/imp_mod1.c2
-rw-r--r--Tests/ExportImport/Import/A/imp_testExe1.c2
-rw-r--r--Tests/ExportImport/Import/A/imp_testExeAbs1.c2
-rw-r--r--Tests/ExportImport/Import/A/imp_testLib8.c2
-rw-r--r--Tests/ExportImport/Import/A/imp_testLib9.c2
-rw-r--r--Tests/ExportImport/Import/CMakeLists.txt1
-rw-r--r--Tests/ExportImport/Import/imp_testTransExe1.c2
-rw-r--r--Tests/ExportImport/InitialCache.cmake.in1
-rw-r--r--Tests/ExportImport/main.c2
-rw-r--r--Tests/FindALSA/Test/main.c2
-rw-r--r--Tests/FindBLAS/Test/main.c2
-rw-r--r--Tests/FindBZip2/Test/main.c2
-rw-r--r--Tests/FindCURL/Test/main.c2
-rw-r--r--Tests/FindCups/Test/main.c2
-rw-r--r--Tests/FindDevIL/Test/main.c2
-rw-r--r--Tests/FindDevIL/Test/main_ilu.c2
-rw-r--r--Tests/FindEXPAT/Test/main.c2
-rw-r--r--Tests/FindFontconfig/Test/main.c2
-rw-r--r--Tests/FindFreetype/Test/main.c2
-rw-r--r--Tests/FindGDAL/Test/main.c2
-rw-r--r--Tests/FindGIF/Test/main.c2
-rw-r--r--Tests/FindGLUT/Test/main.c2
-rw-r--r--Tests/FindGnuTLS/Test/main.c2
-rw-r--r--Tests/FindImageMagick/Test/main_magick_wand.c2
-rw-r--r--Tests/FindJPEG/Test/main.c2
-rw-r--r--Tests/FindJasper/Test/main.c2
-rw-r--r--Tests/FindLAPACK/Test/main.c2
-rw-r--r--Tests/FindLibLZMA/Test/main.c2
-rw-r--r--Tests/FindLibRHash/Test/main.c2
-rw-r--r--Tests/FindLibUV/Test/main.c2
-rw-r--r--Tests/FindLibXml2/Test/main.c2
-rw-r--r--Tests/FindLibXslt/Test/libexslt.c2
-rw-r--r--Tests/FindLibXslt/Test/libxslt.c2
-rw-r--r--Tests/FindLibinput/Test/main.c2
-rw-r--r--Tests/FindODBC/Test/main.c2
-rw-r--r--Tests/FindOpenACC/CTest/main.c2
-rw-r--r--Tests/FindOpenCL/Test/main.c2
-rw-r--r--Tests/FindOpenGL/Test/main.c2
-rw-r--r--Tests/FindOpenGL/Test/main_gles2.c2
-rw-r--r--Tests/FindOpenGL/Test/main_gles3.c2
-rw-r--r--Tests/FindOpenMP/Test/main.c2
-rw-r--r--Tests/FindOpenMP/Test/scaltest.c2
-rw-r--r--Tests/FindPNG/Test/main.c2
-rw-r--r--Tests/FindPackageTest/Exporter/dummy.c2
-rw-r--r--Tests/FindPostgreSQL/Test/main.c2
-rw-r--r--Tests/FindPython/display_time.c2
-rw-r--r--Tests/FindPython/main.c2
-rw-r--r--Tests/FindSDL/Test/main.c2
-rw-r--r--Tests/FindSQLite3/Test/main.c2
-rw-r--r--Tests/FindTIFF/Test/main.c2
-rw-r--r--Tests/FindVulkan/Test/main-SPIRV-Tools.c2
-rw-r--r--Tests/FindVulkan/Test/main.c2
-rw-r--r--Tests/Fortran/mainc.c2
-rw-r--r--Tests/Fortran/maincxx.c2
-rw-r--r--Tests/FortranModules/Issue25252-iface-sources/lib.c2
-rw-r--r--Tests/GeneratorExpression/objlib1.c2
-rw-r--r--Tests/GeneratorExpression/objlib2.c2
-rw-r--r--Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/test.c2
-rw-r--r--Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/testcase.c2
-rw-r--r--Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test.c2
-rw-r--r--Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c2
-rw-r--r--Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/test.c2
-rw-r--r--Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/testCase.c2
-rw-r--r--Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/kernel.c2
-rw-r--r--Tests/IncludeDirectories/StandardIncludeDirectories/main.c2
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectoriesPerLang/main.c2
-rw-r--r--Tests/JavaExportImport/main.c2
-rw-r--r--Tests/LibName/bar.c2
-rw-r--r--Tests/LibName/foo.c4
-rw-r--r--Tests/LibName/foobar.c2
-rw-r--r--Tests/LinkLanguage/LinkLanguage.c2
-rw-r--r--Tests/LinkLine/Exec.c2
-rw-r--r--Tests/LinkLine/One.c4
-rw-r--r--Tests/LinkLine/Two.c4
-rw-r--r--Tests/LinkLineOrder/Exec1.c2
-rw-r--r--Tests/LinkLineOrder/Exec2.c2
-rw-r--r--Tests/LinkLineOrder/NoDepA.c4
-rw-r--r--Tests/LinkLineOrder/NoDepB.c2
-rw-r--r--Tests/LinkLineOrder/NoDepC.c4
-rw-r--r--Tests/LinkLineOrder/NoDepE.c4
-rw-r--r--Tests/LinkLineOrder/NoDepF.c4
-rw-r--r--Tests/LinkLineOrder/NoDepX.c4
-rw-r--r--Tests/LinkLineOrder/NoDepY.c2
-rw-r--r--Tests/LinkLineOrder/NoDepZ.c4
-rw-r--r--Tests/LinkLineOrder/One.c6
-rw-r--r--Tests/LinkLineOrder/Two.c6
-rw-r--r--Tests/Module/CheckIPOSupported-C/bar.c2
-rw-r--r--Tests/Module/CheckIPOSupported-C/foo.c2
-rw-r--r--Tests/Module/CheckIPOSupported-C/main.c2
-rw-r--r--Tests/Module/CheckTypeSize/CheckTypeSize.c2
-rw-r--r--Tests/Module/WriteCompilerDetectionHeader/c_undefined.c2
-rw-r--r--Tests/Module/WriteCompilerDetectionHeader/main.c2
-rw-r--r--Tests/Module/WriteCompilerDetectionHeader/main_multi.c2
-rw-r--r--Tests/OutOfBinary/outlib.c2
-rw-r--r--Tests/PDBDirectoryAndName/myexe.c10
-rw-r--r--Tests/PDBDirectoryAndName/myexe2.c6
-rw-r--r--Tests/PDBDirectoryAndName/mylibA.c2
-rw-r--r--Tests/PDBDirectoryAndName/mylibB.c2
-rw-r--r--Tests/PDBDirectoryAndName/mylibC.c2
-rw-r--r--Tests/PDBDirectoryAndName/mylibD.c2
-rw-r--r--Tests/PerConfig/perconfig.c2
-rw-r--r--Tests/PolicyScope/main.c2
-rw-r--r--Tests/PrecompiledHeader/foo1.c2
-rw-r--r--Tests/PrecompiledHeader/foo2.c2
-rw-r--r--Tests/RunCMake/AppleTextStubs/foo.c2
-rw-r--r--Tests/RunCMake/AppleTextStubs/main.c2
-rw-r--r--Tests/RunCMake/AutoExportDll/foo.c4
-rw-r--r--Tests/RunCMake/AutoExportDll/hello2.c2
-rw-r--r--Tests/RunCMake/AutoExportDll/objlib.c2
-rw-r--r--Tests/RunCMake/BuildDepends/MakeInProjectOnly.c2
-rw-r--r--Tests/RunCMake/BuiltinTargets/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/BuiltinTargets/RunCMakeTest.cmake19
-rw-r--r--Tests/RunCMake/BuiltinTargets/TestDependsAll-Default-build-check.cmake1
-rw-r--r--Tests/RunCMake/BuiltinTargets/TestDependsAll-Default.cmake1
-rw-r--r--Tests/RunCMake/BuiltinTargets/TestDependsAll-No-build-check.cmake3
-rw-r--r--Tests/RunCMake/BuiltinTargets/TestDependsAll-No.cmake2
-rw-r--r--Tests/RunCMake/BuiltinTargets/TestDependsAll-Yes-build-check.cmake3
-rw-r--r--Tests/RunCMake/BuiltinTargets/TestDependsAll-Yes.cmake2
-rw-r--r--Tests/RunCMake/BuiltinTargets/TestDependsAll-common.cmake3
-rw-r--r--Tests/RunCMake/CMP0126/CMP0126-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0126/CMP0126-OLD_CL-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0156/CMP0156-Common.cmake27
-rw-r--r--Tests/RunCMake/CMP0156/CMP0156-NEW-AppleClang.cmake5
-rw-r--r--Tests/RunCMake/CMP0156/CMP0156-NEW.cmake4
-rw-r--r--Tests/RunCMake/CMP0156/CMP0156-OLD-AppleClang-build-result.txt1
-rw-r--r--Tests/RunCMake/CMP0156/CMP0156-OLD-AppleClang-build-stdout.txt3
-rw-r--r--Tests/RunCMake/CMP0156/CMP0156-OLD-AppleClang.cmake5
-rw-r--r--Tests/RunCMake/CMP0156/CMP0156-OLD.cmake4
-rw-r--r--Tests/RunCMake/CMP0156/CMP0156-WARN-stderr.txt35
-rw-r--r--Tests/RunCMake/CMP0156/CMP0156-WARN.cmake4
-rw-r--r--Tests/RunCMake/CMP0156/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0156/RunCMakeTest.cmake26
-rw-r--r--Tests/RunCMake/CMP0156/lib1.c7
-rw-r--r--Tests/RunCMake/CMP0156/lib2.c7
-rw-r--r--Tests/RunCMake/CMP0156/lib3.c7
-rw-r--r--Tests/RunCMake/CMP0156/lib4.c9
-rw-r--r--Tests/RunCMake/CMP0156/main.c9
-rw-r--r--Tests/RunCMake/CMP0156/main2.c9
-rw-r--r--Tests/RunCMake/CMakeLists.txt26
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/CPack/tests/DUPLICATE_FILE/ExpectedFiles.cmake16
-rw-r--r--Tests/RunCMake/CPack/tests/DUPLICATE_FILE/conflict_file-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/tests/DUPLICATE_FILE/conflict_symlink-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/tests/DUPLICATE_FILE/test.cmake74
-rw-r--r--Tests/RunCMake/CXXModules/sources/c-anchor.c2
-rw-r--r--Tests/RunCMake/CommandLine/E_cat-stdin-stdout.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_cat-stdin.cmake10
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/CompileDefinitions/foo.c2
-rw-r--r--Tests/RunCMake/CompileWarningAsError/warn.c2
-rw-r--r--Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-JOM.txt3
-rw-r--r--Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-NMake.txt3
-rw-r--r--Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr.txt3
-rw-r--r--Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-JOM.txt3
-rw-r--r--Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-NMake.txt3
-rw-r--r--Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr.txt3
-rw-r--r--Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-JOM.txt6
-rw-r--r--Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-NMake.txt6
-rw-r--r--Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr.txt6
-rw-r--r--Tests/RunCMake/ExcludeFromAll/main.c2
-rw-r--r--Tests/RunCMake/FetchContent/CMake/FindFDE-S.cmake6
-rw-r--r--Tests/RunCMake/FetchContent/CMake/FindFDE-U.cmake6
-rw-r--r--Tests/RunCMake/FetchContent/FindDependencyExport.cmake78
-rw-r--r--Tests/RunCMake/FetchContent/FindDependencyExport/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/FetchContent/FindDependencyExportDP.cmake11
-rw-r--r--Tests/RunCMake/FetchContent/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/File_Generate/empty.c2
-rw-r--r--Tests/RunCMake/Framework/consumer.c2
-rw-r--r--Tests/RunCMake/Framework/foo.c2
-rw-r--r--Tests/RunCMake/Framework/foo.h2
-rw-r--r--Tests/RunCMake/Framework/main.c2
-rw-r--r--Tests/RunCMake/Framework/main2.c2
-rw-r--r--Tests/RunCMake/Graphviz/test_project/core_library.c2
-rw-r--r--Tests/RunCMake/Graphviz/test_project/graphic_library.c2
-rw-r--r--Tests/RunCMake/Graphviz/test_project/module.c2
-rw-r--r--Tests/RunCMake/Graphviz/test_project/system_library.c2
-rw-r--r--Tests/RunCMake/IAR/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/IAR/RunCMakeTest.cmake64
-rw-r--r--Tests/RunCMake/IAR/iar-asm.cmake5
-rw-r--r--Tests/RunCMake/IAR/iar-c.cmake5
-rw-r--r--Tests/RunCMake/IAR/iar-cxx.cmake5
-rw-r--r--Tests/RunCMake/IAR/iar-lib.cmake10
-rw-r--r--Tests/RunCMake/IAR/libmod.c4
-rw-r--r--Tests/RunCMake/IAR/module.asm41
-rw-r--r--Tests/RunCMake/IAR/module.c14
-rw-r--r--Tests/RunCMake/IAR/module.cxx7
-rw-r--r--Tests/RunCMake/IAR/module.h14
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration1-result.txt1
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration1-stderr.txt7
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration1.cmake9
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration2-result.txt1
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration2-stderr.txt7
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration2.cmake9
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration3-result.txt1
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration3-stderr.txt7
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration3.cmake9
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration4-result.txt1
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration4-stderr.txt8
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration4.cmake9
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/Invalid_ORDER-result.txt1
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/Invalid_ORDER-stderr.txt7
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/Invalid_ORDER.cmake9
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/Invalid_UNICITY-result.txt1
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/Invalid_UNICITY-stderr.txt7
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/Invalid_UNICITY.cmake9
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/lib.c4
-rw-r--r--Tests/RunCMake/LinkLibrariesProcessing/main.c5
-rw-r--r--Tests/RunCMake/LinkerSelection/AppleClassic.cmake7
-rw-r--r--Tests/RunCMake/LinkerSelection/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/LinkerSelection/CustomLinkerType-build-check.cmake2
-rw-r--r--Tests/RunCMake/LinkerSelection/CustomLinkerType.cmake36
-rw-r--r--Tests/RunCMake/LinkerSelection/InvalidLinkerType-result.txt1
-rw-r--r--Tests/RunCMake/LinkerSelection/InvalidLinkerType-stderr.txt3
-rw-r--r--Tests/RunCMake/LinkerSelection/InvalidLinkerType.cmake5
-rw-r--r--Tests/RunCMake/LinkerSelection/LinkerType-validation.cmake9
-rw-r--r--Tests/RunCMake/LinkerSelection/RunCMakeTest.cmake44
-rw-r--r--Tests/RunCMake/LinkerSelection/UnsupportedLinkerType-result.txt1
-rw-r--r--Tests/RunCMake/LinkerSelection/UnsupportedLinkerType-stderr.txt3
-rw-r--r--Tests/RunCMake/LinkerSelection/UnsupportedLinkerType.cmake5
-rw-r--r--Tests/RunCMake/LinkerSelection/ValidLinkerType-build-check.cmake2
-rw-r--r--Tests/RunCMake/LinkerSelection/ValidLinkerType.cmake32
-rw-r--r--Tests/RunCMake/LinkerSelection/main.c4
-rw-r--r--Tests/RunCMake/LinkerSelection/main.cu5
-rw-r--r--Tests/RunCMake/Ninja/CheckNoPrefixSubDirScript.cmake2
-rw-r--r--Tests/RunCMake/Ninja/CustomCommandDepfile-check.cmake35
-rw-r--r--Tests/RunCMake/Ninja/CustomCommandDepfileAsByproduct-check.cmake47
-rw-r--r--Tests/RunCMake/Ninja/CustomCommandDepfileAsByproduct.cmake24
-rw-r--r--Tests/RunCMake/Ninja/CustomCommandDepfileAsOutput-check.cmake47
-rw-r--r--Tests/RunCMake/Ninja/CustomCommandDepfileAsOutput.cmake24
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/Ninja/dep.c2
-rw-r--r--Tests/RunCMake/Ninja/top.c2
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile-check.cmake35
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfileAsByproduct-check.cmake47
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfileAsByproduct.cmake22
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfileAsOutput-check.cmake47
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfileAsOutput.cmake22
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/ObjectLibrary/exe.c2
-rw-r--r--Tests/RunCMake/PrecompileHeaders/foo.c4
-rw-r--r--Tests/RunCMake/PrecompileHeaders/foobar.c2
-rw-r--r--Tests/RunCMake/PrecompileHeaders/include/bar.h2
-rw-r--r--Tests/RunCMake/PrintHelpers/nothing.c2
-rw-r--r--Tests/RunCMake/PrintHelpers/something.c2
-rw-r--r--Tests/RunCMake/SourceProperties/empty.c2
-rw-r--r--Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt1
-rw-r--r--Tests/RunCMake/ToolchainFile/CMP0126-OLD-stderr.txt13
-rw-r--r--Tests/RunCMake/TransformDepfile/noexist-gcc-stderr.txt4
-rw-r--r--Tests/RunCMake/UnityBuild/RunCMakeTest.cmake7
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_and_objc_and_objcxx.cmake25
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_objc.cmake12
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_objc_group.cmake27
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_objcxx.cmake12
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_objcxx_group.cmake27
-rw-r--r--Tests/RunCMake/UseSWIG/CMP0122-NEW-check.cmake2
-rw-r--r--Tests/RunCMake/UseSWIG/CMP0122-OLD-check.cmake2
-rw-r--r--Tests/RunCMake/UseSWIG/CMP0122-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/VS10Project/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/VS10Project/VsCharacterSet-check.cmake49
-rw-r--r--Tests/RunCMake/VS10Project/VsCharacterSet.cmake17
-rw-r--r--Tests/RunCMake/XcFramework/RunCMakeTest.cmake125
-rw-r--r--Tests/RunCMake/XcFramework/export-macos.cmake44
-rw-r--r--Tests/RunCMake/XcFramework/import-common.cmake5
-rw-r--r--Tests/RunCMake/XcFramework/import-genex-common.cmake5
-rw-r--r--Tests/RunCMake/XcFramework/import-macos-build-general-build-stdout.txt2
-rw-r--r--Tests/RunCMake/XcFramework/import-macos-build-general.cmake1
-rw-r--r--Tests/RunCMake/XcFramework/import-macos-build-specific-build-stdout.txt2
-rw-r--r--Tests/RunCMake/XcFramework/import-macos-build-specific-genex-build-stdout.txt2
-rw-r--r--Tests/RunCMake/XcFramework/import-macos-build-specific-genex.cmake1
-rw-r--r--Tests/RunCMake/XcFramework/import-macos-build-specific.cmake1
-rw-r--r--Tests/RunCMake/XcFramework/import-macos-install-general-build-stdout.txt2
-rw-r--r--Tests/RunCMake/XcFramework/import-macos-install-general.cmake1
-rw-r--r--Tests/RunCMake/XcFramework/import-macos-install-specific-build-stdout.txt2
-rw-r--r--Tests/RunCMake/XcFramework/import-macos-install-specific-genex-build-stdout.txt2
-rw-r--r--Tests/RunCMake/XcFramework/import-macos-install-specific-genex.cmake1
-rw-r--r--Tests/RunCMake/XcFramework/import-macos-install-specific-no-xcframework-build-stdout.txt2
-rw-r--r--Tests/RunCMake/XcFramework/import-macos-install-specific-no-xcframework.cmake1
-rw-r--r--Tests/RunCMake/XcFramework/import-macos-install-specific.cmake1
-rw-r--r--Tests/RunCMake/XcFramework/mylib-config.cmake.in3
-rw-r--r--Tests/RunCMake/XcodeProject-Device/DeploymentTarget.c2
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeXCConfig.c2
-rw-r--r--Tests/RunCMake/add_compile_definitions/foo.c2
-rw-r--r--Tests/RunCMake/add_custom_command/a.c2
-rw-r--r--Tests/RunCMake/add_dependencies/a.c2
-rw-r--r--Tests/RunCMake/add_dependencies/b.c2
-rw-r--r--Tests/RunCMake/add_dependencies/c.c2
-rw-r--r--Tests/RunCMake/ctest_empty_binary_directory/CMakeLists.txt.in2
-rw-r--r--Tests/RunCMake/ctest_empty_binary_directory/NoCache-result.txt1
-rw-r--r--Tests/RunCMake/ctest_empty_binary_directory/NoCache-stderr.txt12
-rw-r--r--Tests/RunCMake/ctest_empty_binary_directory/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/ctest_empty_binary_directory/test.cmake.in5
-rw-r--r--Tests/RunCMake/ctest_labels_for_subprojects/MyThirdPartyDependency/src/thirdparty.c2
-rw-r--r--Tests/RunCMake/export/CMake/FindHasDeps.cmake17
-rw-r--r--Tests/RunCMake/export/CMake/FindP1.cmake2
-rw-r--r--Tests/RunCMake/export/CMake/FindP2.cmake2
-rw-r--r--Tests/RunCMake/export/CMake/FindP3.cmake2
-rw-r--r--Tests/RunCMake/export/CMake/FindP4.cmake2
-rw-r--r--Tests/RunCMake/export/CMake/FindP9.cmake2
-rw-r--r--Tests/RunCMake/export/FindDependencyExport-check.cmake35
-rw-r--r--Tests/RunCMake/export/FindDependencyExport.cmake30
-rw-r--r--Tests/RunCMake/export/FindDependencyExportFetchContent-check.cmake14
-rw-r--r--Tests/RunCMake/export/FindDependencyExportFetchContent.cmake37
-rw-r--r--Tests/RunCMake/export/FindDependencyExportShared-check.cmake4
-rw-r--r--Tests/RunCMake/export/FindDependencyExportShared.cmake14
-rw-r--r--Tests/RunCMake/export/FindDependencyExportStatic-check.cmake13
-rw-r--r--Tests/RunCMake/export/FindDependencyExportStatic.cmake14
-rw-r--r--Tests/RunCMake/export/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/find_file/NO_CACHE-stderr.txt10
-rw-r--r--Tests/RunCMake/find_library/NO_CACHE-stderr.txt10
-rw-r--r--Tests/RunCMake/find_path/NO_CACHE-stderr.txt10
-rw-r--r--Tests/RunCMake/find_program/NO_CACHE-stderr.txt10
-rw-r--r--Tests/RunCMake/foreach/foreach-var-scope-CMP0124-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/if/FilePermissions.cmake153
-rw-r--r--Tests/RunCMake/if/RunCMakeTest.cmake17
-rw-r--r--Tests/RunCMake/install/EXPORT-FindDependencyExport-all-check.cmake4
-rw-r--r--Tests/RunCMake/install/EXPORT-FindDependencyExport.cmake18
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/install/cmake/FindP1.cmake2
-rw-r--r--Tests/RunCMake/install/cmake/FindP2.cmake2
-rw-r--r--Tests/RunCMake/install/cmake/FindP3.cmake2
-rw-r--r--Tests/RunCMake/print_stdin.c2
-rw-r--r--Tests/RunCMake/project/CodeInjection-stdout.txt10
-rw-r--r--Tests/RunCMake/project/CodeInjection/cmake_project_include.cmake1
-rw-r--r--Tests/RunCMake/project/CodeInjection/cmake_project_include_before.cmake1
-rw-r--r--Tests/RunCMake/project/CodeInjection/cmake_project_includes_1.cmake1
-rw-r--r--Tests/RunCMake/project/CodeInjection/cmake_project_includes_2.cmake1
-rw-r--r--Tests/RunCMake/project/CodeInjection/cmake_project_includes_before_1.cmake1
-rw-r--r--Tests/RunCMake/project/CodeInjection/cmake_project_includes_before_2.cmake1
-rw-r--r--Tests/RunCMake/project/CodeInjection/cmake_project_subproj_include.cmake1
-rw-r--r--Tests/RunCMake/project/CodeInjection/cmake_project_subproj_include_before.cmake1
-rw-r--r--Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_1.cmake1
-rw-r--r--Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_2.cmake1
-rw-r--r--Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_before_1.cmake1
-rw-r--r--Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_before_2.cmake1
-rw-r--r--Tests/RunCMake/project/CodeInjection/initial_cache_1.cmake (renamed from Tests/RunCMake/project/CodeInjection/initial_cache.cmake)11
-rw-r--r--Tests/RunCMake/project/CodeInjection/initial_cache_2.cmake27
-rw-r--r--Tests/RunCMake/project/CodeInjection/initial_cache_3.cmake28
-rw-r--r--Tests/RunCMake/project/CodeInjection1-stdout.txt9
-rw-r--r--Tests/RunCMake/project/CodeInjection1.cmake (renamed from Tests/RunCMake/project/CodeInjection.cmake)0
-rw-r--r--Tests/RunCMake/project/CodeInjection2-stdout.txt16
-rw-r--r--Tests/RunCMake/project/CodeInjection2.cmake1
-rw-r--r--Tests/RunCMake/project/CodeInjection3-stdout.txt16
-rw-r--r--Tests/RunCMake/project/CodeInjection3.cmake1
-rw-r--r--Tests/RunCMake/project/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/showIncludes.c2
-rw-r--r--Tests/RunCMake/target_compile_definitions/foo.c2
-rw-r--r--Tests/RunCMake/target_compile_features/empty.c2
-rw-r--r--Tests/RunCMake/target_compile_options/CMP0101.c2
-rw-r--r--Tests/RunCMake/target_link_libraries-ALIAS/func.c2
-rw-r--r--Tests/RunCMake/target_link_libraries-ALIAS/lib.c4
-rw-r--r--Tests/RunCMake/target_link_libraries-ALIAS/main.c4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_GROUP/base.c2
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_GROUP/func1.c4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_GROUP/func2.c4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_GROUP/func3.c4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_GROUP/lib.c4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_GROUP/main.c4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/func.c2
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/lib.c4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/main.c6
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/func.c2
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/lib.c4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/main.c4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-group1-check.cmake (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-nested-feature1-check.cmake)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-group1-result.txt (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-simple2-result.txt)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-group2-check.cmake (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-nested-feature2-check.cmake)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-group2-result.txt (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-simple1-result.txt)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items1-check.cmake (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items1-check.cmake)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items1-result.txt (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-with-DEFAULT-result.txt)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items2-check.cmake (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items2-check.cmake)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items2-result.txt (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features4-result.txt)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items3-check.cmake (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items3-check.cmake)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items3-result.txt (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features3-result.txt)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items4-check.cmake (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items4-check.cmake)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items4-result.txt (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features2-result.txt)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features1-check.cmake12
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features1-result.txt (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features1-result.txt)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features2-check.cmake12
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features2-result.txt (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-nested-feature2-result.txt)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features3-check.cmake12
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features3-result.txt (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-nested-feature1-result.txt)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-nested-feature1-check.cmake (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-group1-check.cmake)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-nested-feature1-result.txt (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-mix-features3-result.txt)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-nested-feature2-check.cmake (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-group2-check.cmake)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-nested-feature2-result.txt (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-mix-features2-result.txt)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features1-check.cmake12
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features1-result.txt (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-mix-features1-result.txt)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features2-check.cmake12
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features2-result.txt (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items4-result.txt)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features3-check.cmake12
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features3-result.txt (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items3-result.txt)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features4-check.cmake12
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features4-result.txt (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items2-result.txt)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-with-DEFAULT-check.cmake12
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-with-DEFAULT-result.txt (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items1-result.txt)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-simple1-check.cmake (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-simple2-check.cmake)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-simple1-result.txt (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-group2-result.txt)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-simple2-check.cmake (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-simple1-check.cmake)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-simple2-result.txt (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-group1-result.txt)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-group1-check.cmake4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-group1-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-group2-check.cmake4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-group2-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items1-check.cmake4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items1-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items2-check.cmake4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items2-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items3-check.cmake4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items3-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items4-check.cmake4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items4-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features1-check.cmake (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-mix-features2-check.cmake)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features1-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features2-check.cmake (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-mix-features1-check.cmake)2
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features2-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features3-check.cmake (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-mix-features3-check.cmake)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features3-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-nested-feature1-check.cmake4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-nested-feature1-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-nested-feature2-check.cmake4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-nested-feature2-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features1-check.cmake (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features3-check.cmake)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features1-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features2-check.cmake (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features4-check.cmake)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features2-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features3-check.cmake (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features1-check.cmake)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features3-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features4-check.cmake (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features2-check.cmake)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features4-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-with-DEFAULT-check.cmake (renamed from Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-with-DEFAULT-check.cmake)0
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-with-DEFAULT-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-simple1-check.cmake4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-simple1-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-simple2-check.cmake4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-simple2-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY.cmake7
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake49
-rw-r--r--Tests/RunCMake/target_link_libraries/lib.c4
-rw-r--r--Tests/RunCMake/try_compile/LinkOptions.cmake3
-rw-r--r--Tests/RunCMake/try_compile/lib.c2
-rw-r--r--Tests/RunCMake/try_compile/main.c2
-rw-r--r--Tests/RunCMake/try_run/ConfigureLog-test.c2
-rw-r--r--Tests/RunCMake/try_run/LinkOptions.cmake3
-rw-r--r--Tests/RunCMake/try_run/LinkerLanguage.cmake29
-rw-r--r--Tests/RunCMake/try_run/RunCMakeTest.cmake10
-rw-r--r--Tests/RunCMake/try_run/lib.c2
-rw-r--r--Tests/RunCMake/try_run/lib.cxx4
-rw-r--r--Tests/RunCMake/try_run/main.c2
-rw-r--r--Tests/RunCMake/try_run/main.f9012
-rw-r--r--Tests/RuntimePath/bar1.c4
-rw-r--r--Tests/RuntimePath/bar2.c4
-rw-r--r--Tests/RuntimePath/foo1.c2
-rw-r--r--Tests/RuntimePath/foo2.c2
-rw-r--r--Tests/RuntimePath/main.c4
-rw-r--r--Tests/SetLang/bar.c2
-rw-r--r--Tests/Simple/simpleCLib.c2
-rw-r--r--Tests/SimpleCOnly/bar.c2
-rw-r--r--Tests/SimpleCOnly/foo.c2
-rw-r--r--Tests/SimpleCOnly/main.c2
-rw-r--r--Tests/SourceFileIncludeDirProperty/main.c2
-rw-r--r--Tests/SourceFileProperty/ICaseTest.c2
-rw-r--r--Tests/SourceGroups/main.c2
-rw-r--r--Tests/SourceGroups/sub2/main.c2
-rw-r--r--Tests/SubDir/AnotherSubdir/pair+int.int.c2
-rw-r--r--Tests/SubDir/AnotherSubdir/pair_int.int.c2
-rw-r--r--Tests/SubDir/AnotherSubdir/secondone.c2
-rw-r--r--Tests/SubDir/AnotherSubdir/testfromsubdir.c2
-rw-r--r--Tests/SubDir/ThirdSubDir/pair+int.int1.c2
-rw-r--r--Tests/SubDir/ThirdSubDir/pair_int.int1.c2
-rw-r--r--Tests/SubDir/ThirdSubDir/pair_p_int.int1.c2
-rw-r--r--Tests/SubDir/ThirdSubDir/testfromauxsubdir.c2
-rw-r--r--Tests/SubDir/ThirdSubDir/thirdone.c2
-rw-r--r--Tests/SubDir/vcl_algorithm+vcl_pair+double.foo.c2
-rw-r--r--Tests/SubDir/vcl_algorithm_vcl_pair_double.foo.c2
-rw-r--r--Tests/SubDirSpaces/Another Subdir/pair+int.int.c2
-rw-r--r--Tests/SubDirSpaces/Another Subdir/pair_int.int.c2
-rw-r--r--Tests/SubDirSpaces/Another Subdir/secondone.c2
-rw-r--r--Tests/SubDirSpaces/Another Subdir/testfromsubdir.c2
-rw-r--r--Tests/SubDirSpaces/Some(x86) Sources/test.c2
-rw-r--r--Tests/SubDirSpaces/ThirdSubDir/pair+int.int1.c2
-rw-r--r--Tests/SubDirSpaces/ThirdSubDir/pair_int.int1.c2
-rw-r--r--Tests/SubDirSpaces/ThirdSubDir/pair_p_int.int1.c2
-rw-r--r--Tests/SubDirSpaces/ThirdSubDir/testfromauxsubdir.c2
-rw-r--r--Tests/SubDirSpaces/ThirdSubDir/thirdone.c2
-rw-r--r--Tests/SubDirSpaces/vcl_algorithm+vcl_pair+double.foo.c2
-rw-r--r--Tests/SubDirSpaces/vcl_algorithm_vcl_pair_double.foo.c2
-rw-r--r--Tests/TryCompile/Inner/innerexe.c2
-rw-r--r--Tests/TryCompile/check_a_b.c2
-rw-r--r--Tests/TryCompile/exit_success.c2
-rw-r--r--Tests/TryCompile/exit_with_error.c2
-rw-r--r--Tests/TryCompile/pass.c2
-rw-r--r--Tests/TryCompile/pass2a.c2
-rw-r--r--Tests/TryCompile/stdout_and_stderr.c2
-rw-r--r--Tests/Unset/unset.c2
-rw-r--r--Tests/VSGNUFortran/c_code/main.c2
-rw-r--r--Tests/Visibility/bar.c2
-rw-r--r--Tests/X11/X11.c4
-rw-r--r--Tests/XCTest/FrameworkExample/FrameworkExample.c2
-rw-r--r--Utilities/Doxygen/CMakeLists.txt2
-rwxr-xr-xUtilities/Scripts/update-libarchive.bash2
-rw-r--r--Utilities/Sphinx/CMakeLists.txt2
-rw-r--r--Utilities/Sphinx/conf.py.in6
-rw-r--r--Utilities/cmThirdPartyChecks.cmake12
-rw-r--r--Utilities/cmlibarchive/CMakeLists.txt62
-rw-r--r--Utilities/cmlibarchive/build/cmake/FindMbedTLS.cmake2
-rw-r--r--Utilities/cmlibarchive/build/cmake/config.h.in69
-rw-r--r--Utilities/cmlibarchive/build/version2
-rw-r--r--Utilities/cmlibarchive/libarchive/CMakeLists.txt22
-rw-r--r--Utilities/cmlibarchive/libarchive/archive.h4
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_digest.c60
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_digest_private.h10
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_entry.h2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_getdate.c119
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_hmac.c15
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_hmac_private.h2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_openssl_evp_private.h3
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_random.c35
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_data_into_fd.c7
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c28
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_disk_windows.c72
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_open_file.c4
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_set_options.321
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_filter_bzip2.c4
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_filter_lz4.c2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_filter_uu.c50
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_filter_zstd.c14
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c280
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_cab.c8
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_cpio.c6
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c12
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_lha.c20
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_mtree.c8
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_rar.c21
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_rar5.c2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_warc.c6
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c8
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c6
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_string.c4
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_util.c57
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_windows.c35
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write.c31
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_add_filter_bzip2.c6
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_add_filter_compress.c2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_add_filter_lz4.c8
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_add_filter_zstd.c273
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c72
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c79
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_private.h1
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c43
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c32
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_set_format_pax.c62
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_set_format_warc.c25
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c14
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_set_format_zip.c19
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_set_options.39
-rw-r--r--Utilities/cmlibarchive/libarchive/config_freebsd.h7
-rw-r--r--Utilities/cmlibarchive/libarchive/filter_fork_windows.c9
-rw-r--r--Utilities/cmlibarchive/libarchive/xxhash.c4
-rwxr-xr-xbootstrap1
813 files changed, 7552 insertions, 1496 deletions
diff --git a/.gitlab/artifacts.yml b/.gitlab/artifacts.yml
index f4d413b..cc52971 100644
--- a/.gitlab/artifacts.yml
+++ b/.gitlab/artifacts.yml
@@ -120,6 +120,8 @@
# Take the sphinx logs.
- ${CMAKE_CI_BUILD_DIR}/build-*.log
- ${CMAKE_CI_BUILD_DIR}/linkcheck/output.*
+ # Take the HTML output.
+ - ${CMAKE_CI_BUILD_DIR}/html/
.cmake_test_artifacts:
artifacts:
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim
index 4bbdc65..9dad4ac 100644
--- a/Auxiliary/vim/syntax/cmake.vim
+++ b/Auxiliary/vim/syntax/cmake.vim
@@ -70,6 +70,7 @@ syn keyword cmakeProperty contained
\ ATTACHED_FILES
\ ATTACHED_FILES_ON_FAIL
\ AUTOGEN_BUILD_DIR
+ \ AUTOGEN_COMMAND_LINE_LENGTH_MAX
\ AUTOGEN_ORIGIN_DEPENDS
\ AUTOGEN_PARALLEL
\ AUTOGEN_SOURCE_GROUP
@@ -764,6 +765,7 @@ syn keyword cmakeVariable contained
\ CMAKE_ASM_STANDARD_REQUIRED
\ CMAKE_ASM_SUPPORTED
\ CMAKE_ASM_VISIBILITY_PRESET
+ \ CMAKE_AUTOGEN_COMMAND_LINE_LENGTH_MAX
\ CMAKE_AUTOGEN_ORIGIN_DEPENDS
\ CMAKE_AUTOGEN_PARALLEL
\ CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE
@@ -1656,6 +1658,7 @@ syn keyword cmakeVariable contained
\ CMAKE_SKIP_INSTALL_RPATH
\ CMAKE_SKIP_INSTALL_RULES
\ CMAKE_SKIP_RPATH
+ \ CMAKE_SKIP_TEST_ALL_DEPENDENCY
\ CMAKE_SOURCE_DIR
\ CMAKE_STAGING_PREFIX
\ CMAKE_STATIC_LIBRARY_PREFIX
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2823ca4..a99cf50 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-cmake_minimum_required(VERSION 3.13...3.26 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.13...3.27 FATAL_ERROR)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/Source/Modules/OverrideC.cmake)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/Source/Modules/OverrideCXX.cmake)
diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst
index 5fe4326..2bb1390 100644
--- a/Help/command/add_custom_command.rst
+++ b/Help/command/add_custom_command.rst
@@ -373,6 +373,11 @@ The options are:
:manual:`generator expressions <cmake-generator-expressions(7)>` was also
added.
+ .. versionadded:: 3.29
+ The :ref:`Ninja Generators` will now incorporate the dependencies into its
+ "deps log" database if the file is not listed in ``OUTPUTS`` or
+ ``BYPRODUCTS``.
+
Using ``DEPFILE`` with generators other than those listed above is an error.
If the ``DEPFILE`` argument is relative, it should be relative to
diff --git a/Help/command/cmake_host_system_information.rst b/Help/command/cmake_host_system_information.rst
index dad0833..0d2f75e 100644
--- a/Help/command/cmake_host_system_information.rst
+++ b/Help/command/cmake_host_system_information.rst
@@ -265,7 +265,7 @@ Example:
.. [#mebibytes] One MiB (mebibyte) is equal to 1024x1024 bytes.
-.. _man 5 os-release: https://www.freedesktop.org/software/systemd/man/os-release.html
+.. _man 5 os-release: https://www.freedesktop.org/software/systemd/man/latest/os-release.html
.. _various distribution-specific files: http://linuxmafia.com/faq/Admin/release-files.html
.. _Query Windows registry:
diff --git a/Help/command/export.rst b/Help/command/export.rst
index cc927bc..f190df7 100644
--- a/Help/command/export.rst
+++ b/Help/command/export.rst
@@ -15,12 +15,13 @@ Synopsis
export(`TARGETS`_ <target>... [...])
export(`EXPORT`_ <export-name> [...])
export(`PACKAGE`_ <PackageName>)
+ export(`SETUP`_ <export-name> [...])
Exporting Targets
^^^^^^^^^^^^^^^^^
-.. _`export(TARGETS)`:
-.. _TARGETS:
+.. signature::
+ export(TARGETS <target>... [...])
.. code-block:: cmake
@@ -62,7 +63,7 @@ The options are:
This signature requires all targets to be listed explicitly. If a library
target is included in the export, but a target to which it links is not
-included, the behavior is unspecified. See the `export(EXPORT)`_ signature
+included, the behavior is unspecified. See the :command:`export(EXPORT)` signature
to automatically export the same targets from the build tree as
:command:`install(EXPORT)` would from an install tree.
@@ -102,27 +103,33 @@ that policy is set to OLD for one of the targets.
Exporting Targets matching install(EXPORT)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-.. _`export(EXPORT)`:
-.. _EXPORT:
+.. signature::
+ export(EXPORT <export-name> [...])
.. code-block:: cmake
export(EXPORT <export-name> [NAMESPACE <namespace>] [FILE <filename>]
- [CXX_MODULES_DIRECTORY <directory>])
+ [CXX_MODULES_DIRECTORY <directory>] [EXPORT_PACKAGE_DEPENDENCIES])
Creates a file ``<filename>`` that may be included by outside projects to
import targets from the current project's build tree. This is the same
-as the `export(TARGETS)`_ signature, except that the targets are not
+as the :command:`export(TARGETS)` signature, except that the targets are not
explicitly listed. Instead, it exports the targets associated with
the installation export ``<export-name>``. Target installations may be
associated with the export ``<export-name>`` using the ``EXPORT`` option
of the :command:`install(TARGETS)` command.
+``EXPORT_PACKAGE_DEPENDENCIES``
+ .. versionadded:: 3.29
+
+ Specify that :command:`find_dependency` calls should be exported. See
+ :command:`install(EXPORT)` for details on how this works.
+
Exporting Packages
^^^^^^^^^^^^^^^^^^
-.. _`export(PACKAGE)`:
-.. _PACKAGE:
+.. signature::
+ export(PACKAGE <PackageName>)
.. code-block:: cmake
@@ -149,3 +156,62 @@ registry.
outside the source and build trees. Set the
:variable:`CMAKE_EXPORT_PACKAGE_REGISTRY` variable to add build directories
to the CMake user package registry.
+
+Configuring Exports
+^^^^^^^^^^^^^^^^^^^
+
+.. signature::
+ export(SETUP <export-name> [...])
+
+.. code-block:: cmake
+
+ export(SETUP <export-name>
+ [PACKAGE_DEPENDENCY <dep>
+ [ENABLED (<bool-true>|<bool-false>|AUTO)]
+ [EXTRA_ARGS <args>...]
+ ] [...]
+ [TARGET <target>
+ [XCFRAMEWORK_LOCATION <location>]
+ ] [...]
+ )
+
+.. versionadded:: 3.29
+
+Configure the parameters of an export. The arguments are as follows:
+
+``PACKAGE_DEPENDENCY <dep>``
+ Specify a package dependency to configure. This changes how
+ :command:`find_dependency` calls are written during
+ :command:`export(EXPORT)` and :command:`install(EXPORT)`. ``<dep>`` is the
+ name of a package to export. This argument accepts the following additional
+ arguments:
+
+ ``ENABLED``
+ Manually control whether or not the dependency is exported. This accepts
+ the following values:
+
+ ``<bool-true>``
+ Any value that CMake recognizes as "true". Always export the dependency,
+ even if no exported targets depend on it. This can be used to manually
+ add :command:`find_dependency` calls to the export.
+
+ ``<bool-false>``
+ Any value that CMake recognizes as "false". Never export the dependency,
+ even if an exported target depends on it.
+
+ ``AUTO``
+ Only export the dependency if an exported target depends on it.
+
+ ``EXTRA_ARGS <args>``
+ Specify additional arguments to pass to :command:`find_dependency` after
+ the ``REQUIRED`` argument.
+
+``TARGET <target>``
+ Specify a target to configure in this export. This argument accepts the
+ following additional arguments:
+
+ ``XCFRAMEWORK_LOCATION``
+ Specify the location of an ``.xcframework`` which contains the library from
+ this target. If specified, the generated code will check to see if the
+ ``.xcframework`` exists, and if it does, it will use the ``.xcframework``
+ as its imported location instead of the installed library.
diff --git a/Help/command/file.rst b/Help/command/file.rst
index f9d1a79..957b8b5 100644
--- a/Help/command/file.rst
+++ b/Help/command/file.rst
@@ -32,14 +32,14 @@ Synopsis
`Writing`_
file({`WRITE`_ | `APPEND`_} <filename> <content>...)
- file({`TOUCH`_ | `TOUCH_NOCREATE`_} [<file>...])
+ file({`TOUCH`_ | `TOUCH_NOCREATE`_} <file>...)
file(`GENERATE`_ OUTPUT <output-file> [...])
file(`CONFIGURE`_ OUTPUT <output-file> CONTENT <content> [...])
`Filesystem`_
- file({`GLOB`_ | `GLOB_RECURSE`_} <out-var> [...] [<globbing-expr>...])
- file(`MAKE_DIRECTORY`_ [<dir>...])
- file({`REMOVE`_ | `REMOVE_RECURSE`_ } [<files>...])
+ file({`GLOB`_ | `GLOB_RECURSE`_} <out-var> [...] <globbing-expr>...)
+ file(`MAKE_DIRECTORY`_ <directories>...)
+ file({`REMOVE`_ | `REMOVE_RECURSE`_ } <files>...)
file(`RENAME`_ <oldname> <newname> [...])
file(`COPY_FILE`_ <oldname> <newname> [...])
file({`COPY`_ | `INSTALL`_} <file>... DESTINATION <dir> [...])
@@ -80,7 +80,7 @@ Reading
(``a`` through ``f``) are in lowercase.
.. signature::
- file(STRINGS <filename> <variable> [<options>...])
+ file(STRINGS <filename> <variable> <options>...)
Parse a list of ASCII strings from ``<filename>`` and store it in
``<variable>``. Binary data in the file are ignored. Carriage return
@@ -165,17 +165,17 @@ Reading
[RESOLVED_DEPENDENCIES_VAR <deps_var>]
[UNRESOLVED_DEPENDENCIES_VAR <unresolved_deps_var>]
[CONFLICTING_DEPENDENCIES_PREFIX <conflicting_deps_prefix>]
- [EXECUTABLES [<executable_files>...]]
- [LIBRARIES [<library_files>...]]
- [MODULES [<module_files>...]]
- [DIRECTORIES [<directories>...]]
+ [EXECUTABLES <executable_files>...]
+ [LIBRARIES <library_files>...]
+ [MODULES <module_files>...]
+ [DIRECTORIES <directories>...]
[BUNDLE_EXECUTABLE <bundle_executable_file>]
- [PRE_INCLUDE_REGEXES [<regexes>...]]
- [PRE_EXCLUDE_REGEXES [<regexes>...]]
- [POST_INCLUDE_REGEXES [<regexes>...]]
- [POST_EXCLUDE_REGEXES [<regexes>...]]
- [POST_INCLUDE_FILES [<files>...]]
- [POST_EXCLUDE_FILES [<files>...]]
+ [PRE_INCLUDE_REGEXES <regexes>...]
+ [PRE_EXCLUDE_REGEXES <regexes>...]
+ [POST_INCLUDE_REGEXES <regexes>...]
+ [POST_EXCLUDE_REGEXES <regexes>...]
+ [POST_INCLUDE_FILES <files>...]
+ [POST_EXCLUDE_FILES <files>...]
)
Please note that this sub-command is not intended to be used in project mode.
@@ -210,7 +210,7 @@ Reading
of paths that were found for that filename are stored in
``<conflicting_deps_prefix>_<filename>``.
- ``EXECUTABLES <executable_files>``
+ ``EXECUTABLES <executable_files>...``
List of executable files to read for dependencies. These are executables
that are typically created with :command:`add_executable`, but they do
not have to be created by CMake. On Apple platforms, the paths to these
@@ -218,14 +218,14 @@ Reading
resolving the libraries. Specifying any kind of library (``STATIC``,
``MODULE``, or ``SHARED``) here will result in undefined behavior.
- ``LIBRARIES <library_files>``
+ ``LIBRARIES <library_files>...``
List of library files to read for dependencies. These are libraries that
are typically created with :command:`add_library(SHARED)`, but they do
not have to be created by CMake. Specifying ``STATIC`` libraries,
``MODULE`` libraries, or executables here will result in undefined
behavior.
- ``MODULES <module_files>``
+ ``MODULES <module_files>...``
List of loadable module files to read for dependencies. These are modules
that are typically created with :command:`add_library(MODULE)`, but they
do not have to be created by CMake. They are typically used by calling
@@ -233,7 +233,7 @@ Reading
Specifying ``STATIC`` libraries, ``SHARED`` libraries, or executables
here will result in undefined behavior.
- ``DIRECTORIES <directories>``
+ ``DIRECTORIES <directories>...``
List of additional directories to search for dependencies. On Linux
platforms, these directories are searched if the dependency is not found
in any of the other usual paths. If it is found in such a directory, a
@@ -256,30 +256,30 @@ Reading
The following arguments specify filters for including or excluding libraries
to be resolved. See below for a full description of how they work.
- ``PRE_INCLUDE_REGEXES <regexes>``
+ ``PRE_INCLUDE_REGEXES <regexes>...``
List of pre-include regexes through which to filter the names of
not-yet-resolved dependencies.
- ``PRE_EXCLUDE_REGEXES <regexes>``
+ ``PRE_EXCLUDE_REGEXES <regexes>...``
List of pre-exclude regexes through which to filter the names of
not-yet-resolved dependencies.
- ``POST_INCLUDE_REGEXES <regexes>``
+ ``POST_INCLUDE_REGEXES <regexes>...``
List of post-include regexes through which to filter the names of
resolved dependencies.
- ``POST_EXCLUDE_REGEXES <regexes>``
+ ``POST_EXCLUDE_REGEXES <regexes>...``
List of post-exclude regexes through which to filter the names of
resolved dependencies.
- ``POST_INCLUDE_FILES <files>``
+ ``POST_INCLUDE_FILES <files>...``
.. versionadded:: 3.21
List of post-include filenames through which to filter the names of
resolved dependencies. Symlinks are resolved when attempting to match
these filenames.
- ``POST_EXCLUDE_FILES <files>``
+ ``POST_EXCLUDE_FILES <files>...``
.. versionadded:: 3.21
List of post-exclude filenames through which to filter the names of
@@ -486,8 +486,8 @@ Writing
to update the file only when its content changes.
.. signature::
- file(TOUCH [<files>...])
- file(TOUCH_NOCREATE [<files>...])
+ file(TOUCH <files>...)
+ file(TOUCH_NOCREATE <files>...)
.. versionadded:: 3.12
@@ -638,10 +638,10 @@ Filesystem
.. signature::
file(GLOB <variable>
[LIST_DIRECTORIES true|false] [RELATIVE <path>] [CONFIGURE_DEPENDS]
- [<globbing-expressions>...])
+ <globbing-expressions>...)
file(GLOB_RECURSE <variable> [FOLLOW_SYMLINKS]
[LIST_DIRECTORIES true|false] [RELATIVE <path>] [CONFIGURE_DEPENDS]
- [<globbing-expressions>...])
+ <globbing-expressions>...)
Generate a list of files that match the ``<globbing-expressions>`` and
store it into the ``<variable>``. Globbing expressions are similar to
@@ -703,13 +703,13 @@ Filesystem
============== ======================================================
.. signature::
- file(MAKE_DIRECTORY [<directories>...])
+ file(MAKE_DIRECTORY <directories>...)
Create the given directories and their parents as needed.
.. signature::
- file(REMOVE [<files>...])
- file(REMOVE_RECURSE [<files>...])
+ file(REMOVE <files>...)
+ file(REMOVE_RECURSE <files>...)
Remove the given files. The ``REMOVE_RECURSE`` mode will remove the given
files and directories, including non-empty directories. No error is emitted
@@ -1012,8 +1012,8 @@ Transfer
^^^^^^^^
.. signature::
- file(DOWNLOAD <url> [<file>] [<options>...])
- file(UPLOAD <file> <url> [<options>...])
+ file(DOWNLOAD <url> [<file>] <options>...)
+ file(UPLOAD <file> <url> <options>...)
The ``DOWNLOAD`` subcommand downloads the given ``<url>`` to a local
``<file>``. The ``UPLOAD`` mode uploads a local ``<file>`` to a given
diff --git a/Help/command/if.rst b/Help/command/if.rst
index 5d85a1f..1afbe04 100644
--- a/Help/command/if.rst
+++ b/Help/command/if.rst
@@ -178,6 +178,47 @@ File Operations
False if the given path is an empty string.
+ .. warning::
+ To check the readability of a file, use preferably ``if(IS_READABLE)``
+ because this test will evolve to check file existence only in a future
+ release.
+
+.. signature:: if(IS_READABLE <path-to-file-or-directory>)
+
+ .. versionadded:: 3.29
+
+ True if the named file or directory is readable. Behavior
+ is well-defined only for explicit full paths (a leading ``~/`` is not
+ expanded as a home directory and is considered a relative path).
+ Resolves symbolic links, i.e. if the named file or directory is a
+ symbolic link, returns true if the target of the symbolic link is readable.
+
+ False if the given path is an empty string.
+
+.. signature:: if(IS_WRITABLE <path-to-file-or-directory>)
+
+ .. versionadded:: 3.29
+
+ True if the named file or directory is writable. Behavior
+ is well-defined only for explicit full paths (a leading ``~/`` is not
+ expanded as a home directory and is considered a relative path).
+ Resolves symbolic links, i.e. if the named file or directory is a
+ symbolic link, returns true if the target of the symbolic link is writable.
+
+ False if the given path is an empty string.
+
+.. signature:: if(IS_EXECUTABLE <path-to-file-or-directory>)
+
+ .. versionadded:: 3.29
+
+ True if the named file or directory is executable. Behavior
+ is well-defined only for explicit full paths (a leading ``~/`` is not
+ expanded as a home directory and is considered a relative path).
+ Resolves symbolic links, i.e. if the named file or directory is a
+ symbolic link, returns true if the target of the symbolic link is executable.
+
+ False if the given path is an empty string.
+
.. signature:: if(<file1> IS_NEWER_THAN <file2>)
:target: IS_NEWER_THAN
diff --git a/Help/command/install.rst b/Help/command/install.rst
index b0698dd..0c2a32a 100644
--- a/Help/command/install.rst
+++ b/Help/command/install.rst
@@ -784,7 +784,8 @@ Signatures
[CXX_MODULES_DIRECTORY <directory>]
[EXPORT_LINK_INTERFACE_LIBRARIES]
[COMPONENT <component>]
- [EXCLUDE_FROM_ALL])
+ [EXCLUDE_FROM_ALL]
+ [EXPORT_PACKAGE_DEPENDENCIES])
install(EXPORT_ANDROID_MK <export-name> DESTINATION <dir> [...])
The ``EXPORT`` form generates and installs a CMake file containing code to
@@ -848,6 +849,34 @@ Signatures
without this information, none of the C++ modules which are part of the
targets in the export set will support being imported in consuming targets.
+ ``EXPORT_PACKAGE_DEPENDENCIES``
+ .. versionadded:: 3.29
+
+ Specify that :command:`find_dependency` calls should be exported. If this
+ argument is specified, CMake examines all targets in the export set and
+ gathers their ``INTERFACE`` link targets. If any such targets either were
+ found with :command:`find_package` or have the
+ :prop_tgt:`EXPORT_FIND_PACKAGE_NAME` property set, and such package
+ dependency was not disabled by passing ``ENABLED OFF`` to
+ :command:`export(SETUP)`, then a :command:`find_dependency` call is
+ written with the target's corresponding package name, a ``REQUIRED``
+ argument, and any additional arguments specified by the ``EXTRA_ARGS``
+ argument of :command:`export(SETUP)`. Any package dependencies that were
+ manually specified by passing ``ENABLED ON`` to :command:`export(SETUP)`
+ are also added, even if the exported targets don't depend on any targets
+ from them.
+
+ The :command:`find_dependency` calls are written in the following order:
+
+ 1. Any package dependencies that were listed in :command:`export(SETUP)`
+ are written in the order they were first specified, regardless of
+ whether or not they contain ``INTERFACE`` dependencies of the
+ exported targets.
+ 2. Any package dependencies that contain ``INTERFACE`` link dependencies
+ of the exported targets and that were never specified in
+ :command:`export(SETUP)` are written in the order they were first
+ found.
+
The ``EXPORT`` form is useful to help outside projects use targets built
and installed by the current project. For example, the code
diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst
index 0255b4d..f44a4e8 100644
--- a/Help/command/try_compile.rst
+++ b/Help/command/try_compile.rst
@@ -77,6 +77,7 @@ Try Compiling Source Files
[COMPILE_DEFINITIONS <defs>...]
[LINK_OPTIONS <options>...]
[LINK_LIBRARIES <libs>...]
+ [LINKER_LANGUAGE <lang>]
[OUTPUT_VARIABLE <var>]
[COPY_FILE <fileName> [COPY_FILE_ERROR <var>]]
[<LANG>_STANDARD <std>]
@@ -177,6 +178,9 @@ The options for the above signatures are:
If this option is specified, any ``-DLINK_LIBRARIES=...`` value
given to the ``CMAKE_FLAGS`` option will be ignored.
+ .. versionadded:: 3.29
+ Alias targets to imported libraries are also supported.
+
``LINK_OPTIONS <options>...``
.. versionadded:: 3.14
@@ -184,6 +188,14 @@ The options for the above signatures are:
set the :prop_tgt:`STATIC_LIBRARY_OPTIONS` target property in the generated
project, depending on the :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` variable.
+``LINKER_LANGUAGE <lang>```
+ .. versionadded:: 3.29
+
+ Specify the :prop_tgt:`LINKER_LANGUAGE` target property of the generated
+ project. When using multiple source files with different languages, set
+ this to the language of the source file containing the program entry point,
+ e.g., ``main``.
+
``LOG_DESCRIPTION <text>``
.. versionadded:: 3.26
diff --git a/Help/command/try_run.rst b/Help/command/try_run.rst
index 1b5087d..c466a81 100644
--- a/Help/command/try_run.rst
+++ b/Help/command/try_run.rst
@@ -67,6 +67,7 @@ The signature above is recommended for clarity.
[COMPILE_DEFINITIONS <defs>...]
[LINK_OPTIONS <options>...]
[LINK_LIBRARIES <libs>...]
+ [LINKER_LANGUAGE <lang>]
[COMPILE_OUTPUT_VARIABLE <var>]
[COPY_FILE <fileName> [COPY_FILE_ERROR <var>]]
[<LANG>_STANDARD <std>]
diff --git a/Help/dev/try_compile-linker-language.rst b/Help/dev/try_compile-linker-language.rst
new file mode 100644
index 0000000..8482dee
--- /dev/null
+++ b/Help/dev/try_compile-linker-language.rst
@@ -0,0 +1,6 @@
+try_compile-linker-language
+---------------------------
+
+* The :command:`try_compile` and :command:`try_run` commands gained a
+ ``LINKER_LANGUAGE`` option to specify the :prop_tgt:`LINKER_LANGUAGE`
+ target property in the generated test project.
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index d4a43de..3e58b31 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -1053,6 +1053,10 @@ related to most of the expressions in this sub-section.
``1`` if CMake's compiler id of the C compiler matches any one
of the entries in ``compiler_ids``, otherwise ``0``.
+ .. versionchanged:: 3.15
+ Multiple ``compiler_ids`` can be specified.
+ CMake 3.14 and earlier only accepted a single compiler ID.
+
.. genex:: $<CXX_COMPILER_ID>
CMake's compiler id of the CXX compiler used.
@@ -1063,6 +1067,10 @@ related to most of the expressions in this sub-section.
``1`` if CMake's compiler id of the CXX compiler matches any one
of the entries in ``compiler_ids``, otherwise ``0``.
+ .. versionchanged:: 3.15
+ Multiple ``compiler_ids`` can be specified.
+ CMake 3.14 and earlier only accepted a single compiler ID.
+
.. genex:: $<CUDA_COMPILER_ID>
.. versionadded:: 3.15
@@ -1115,6 +1123,10 @@ related to most of the expressions in this sub-section.
``1`` if CMake's compiler id of the Fortran compiler matches any one
of the entries in ``compiler_ids``, otherwise ``0``.
+ .. versionchanged:: 3.15
+ Multiple ``compiler_ids`` can be specified.
+ CMake 3.14 and earlier only accepted a single compiler ID.
+
.. genex:: $<HIP_COMPILER_ID>
.. versionadded:: 3.21
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 46707ff..5b1939e 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -51,6 +51,14 @@ 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.29
+=================================
+
+.. toctree::
+ :maxdepth: 1
+
+ CMP0156: De-duplicate libraries on link lines based on linker capabilities. </policy/CMP0156>
+
Policies Introduced by CMake 3.28
=================================
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index fa1d297..28d61f7 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -130,6 +130,7 @@ Properties on Targets
/prop_tgt/ARCHIVE_OUTPUT_NAME
/prop_tgt/ARCHIVE_OUTPUT_NAME_CONFIG
/prop_tgt/AUTOGEN_BUILD_DIR
+ /prop_tgt/AUTOGEN_COMMAND_LINE_LENGTH_MAX
/prop_tgt/AUTOGEN_ORIGIN_DEPENDS
/prop_tgt/AUTOGEN_PARALLEL
/prop_tgt/AUTOGEN_TARGET_DEPENDS
@@ -211,6 +212,7 @@ Properties on Targets
/prop_tgt/EXCLUDE_FROM_DEFAULT_BUILD
/prop_tgt/EXCLUDE_FROM_DEFAULT_BUILD_CONFIG
/prop_tgt/EXPORT_COMPILE_COMMANDS
+ /prop_tgt/EXPORT_FIND_PACKAGE_NAME
/prop_tgt/EXPORT_NAME
/prop_tgt/EXPORT_NO_SYSTEM
/prop_tgt/EXPORT_PROPERTIES
@@ -336,6 +338,7 @@ Properties on Targets
/prop_tgt/LINK_SEARCH_START_STATIC
/prop_tgt/LINK_WHAT_YOU_USE
/prop_tgt/LINKER_LANGUAGE
+ /prop_tgt/LINKER_TYPE
/prop_tgt/LOCATION
/prop_tgt/LOCATION_CONFIG
/prop_tgt/MACHO_COMPATIBILITY_VERSION
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index d9df773..5f47c6e 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -74,6 +74,10 @@ Variables that Provide Information
/variable/CMAKE_JOB_POOLS
/variable/CMAKE_LANG_COMPILER_AR
/variable/CMAKE_LANG_COMPILER_FRONTEND_VARIANT
+ /variable/CMAKE_LANG_COMPILER_LINKER
+ /variable/CMAKE_LANG_COMPILER_LINKER_FRONTEND_VARIANT
+ /variable/CMAKE_LANG_COMPILER_LINKER_ID
+ /variable/CMAKE_LANG_COMPILER_LINKER_VERSION
/variable/CMAKE_LANG_COMPILER_RANLIB
/variable/CMAKE_LANG_LINK_LIBRARY_SUFFIX
/variable/CMAKE_LINK_LIBRARY_SUFFIX
@@ -251,6 +255,7 @@ Variables that Change Behavior
/variable/CMAKE_PROJECT_TOP_LEVEL_INCLUDES
/variable/CMAKE_REQUIRE_FIND_PACKAGE_PackageName
/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY
+ /variable/CMAKE_SKIP_TEST_ALL_DEPENDENCY
/variable/CMAKE_STAGING_PREFIX
/variable/CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS
/variable/CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE
@@ -395,6 +400,7 @@ Variables that Control the Build
/variable/CMAKE_APPLE_SILICON_PROCESSOR
/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY
/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CONFIG
+ /variable/CMAKE_AUTOGEN_COMMAND_LINE_LENGTH_MAX
/variable/CMAKE_AUTOGEN_ORIGIN_DEPENDS
/variable/CMAKE_AUTOGEN_PARALLEL
/variable/CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE
@@ -439,6 +445,7 @@ Variables that Control the Build
/variable/CMAKE_EXE_LINKER_FLAGS_CONFIG
/variable/CMAKE_EXE_LINKER_FLAGS_CONFIG_INIT
/variable/CMAKE_EXE_LINKER_FLAGS_INIT
+ /variable/CMAKE_EXPORT_FIND_PACKAGE_NAME
/variable/CMAKE_FOLDER
/variable/CMAKE_Fortran_FORMAT
/variable/CMAKE_Fortran_MODULE_DIRECTORY
@@ -474,6 +481,8 @@ Variables that Control the Build
/variable/CMAKE_LANG_LINK_LIBRARY_USING_FEATURE_SUPPORTED
/variable/CMAKE_LANG_LINK_WHAT_YOU_USE_FLAG
/variable/CMAKE_LANG_LINKER_LAUNCHER
+ /variable/CMAKE_LANG_USING_LINKER_MODE
+ /variable/CMAKE_LANG_USING_LINKER_TYPE
/variable/CMAKE_LANG_VISIBILITY_PRESET
/variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY
/variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY_CONFIG
@@ -490,6 +499,7 @@ Variables that Control the Build
/variable/CMAKE_LINK_LIBRARY_USING_FEATURE_SUPPORTED
/variable/CMAKE_LINK_WHAT_YOU_USE
/variable/CMAKE_LINK_WHAT_YOU_USE_CHECK
+ /variable/CMAKE_LINKER_TYPE
/variable/CMAKE_MACOSX_BUNDLE
/variable/CMAKE_MACOSX_RPATH
/variable/CMAKE_MAP_IMPORTED_CONFIG_CONFIG
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 5223acb..621c005 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -891,6 +891,10 @@ Available commands are:
``-`` will result in an error. Use ``--`` to indicate the end of options, in
case a file starts with ``-``.
+ .. versionadded:: 3.29
+
+ ``cat`` can now print the standard input by passing the ``-`` argument.
+
.. program:: cmake-E
.. option:: chdir <dir> <cmd> [<arg>...]
@@ -1311,6 +1315,7 @@ The following ``cmake -E`` commands are available only on Windows:
Write Windows registry value.
+.. _`Find-Package Tool Mode`:
Run the Find-Package Tool
=========================
diff --git a/Help/policy/CMP0156.rst b/Help/policy/CMP0156.rst
new file mode 100644
index 0000000..fa97519
--- /dev/null
+++ b/Help/policy/CMP0156.rst
@@ -0,0 +1,47 @@
+CMP0156
+-------
+
+.. versionadded:: 3.29
+
+De-duplicate libraries on link lines based on linker capabilities.
+
+Traditional linkers maintain a set of undefined symbols during linking. The
+linker processes each file in the order in which it appears on the command
+line, until the set of undefined symbols becomes empty. An object file is
+linked into the output object when it is encountered, with its undefined
+symbols added to the set. Upon encountering an archive file a traditional
+linker searches the objects contained therein, and processes those that satisfy
+symbols in the unresolved set.
+
+Handling mutually dependent archives may be awkward when using a traditional
+linker. Archive files may have to be specified multiple times.
+
+Some linkers (for instance Apple or Windows linkers, as well as``LLVM LLD``)
+records all symbols found in objects and archives as it iterates over command
+line arguments. When one of these linkers encounters an undefined symbol that
+can be resolved by an object file contained in a previously processed archive
+file, it immediately extracts and links it into the output object.
+
+CMake 3.28 and below may generate link lines that repeat static libraries as
+a traditional linker would need, even when using a linker does not need it.
+They may also de-duplicate shared libraries by keeping their last occurrence,
+which on Windows platforms can change DLL load order.
+
+CMake 3.29 and above prefer to apply different strategies based on linker
+capabilities. So, when targeting Apple and Windows platforms, all
+libraries are de-duplicated. Moreover, on Windows platforms, libraries
+are de-duplicated by keeping their fist occurrence, thus respecting the
+project-specified order. This policy provides compatibility with projects
+that have not been updated to expect the latter behavior.
+
+The ``OLD`` behavior for this policy is to always repeat static libraries
+as if using a traditional linker, and always de-duplicate shared libraries
+by keeping the last occurrence of each. The ``NEW`` behavior for this policy
+is to apply different strategies based on linker capabilities.
+
+This policy was introduced in CMake version 3.29. Use the
+:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
+Unlike many policies, CMake version |release| does *not* warn
+when this policy is not set and simply uses ``OLD`` behavior.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/prop_test/WILL_FAIL.rst b/Help/prop_test/WILL_FAIL.rst
index 4926f40..006b1c3 100644
--- a/Help/prop_test/WILL_FAIL.rst
+++ b/Help/prop_test/WILL_FAIL.rst
@@ -1,8 +1,35 @@
WILL_FAIL
---------
-If set to true, this will invert the pass/fail flag of the test.
+If ``true``, inverts the pass / fail test criteria. Tests for which
+``WILL_FAIL`` is ``true`` fail with return code 0 and pass with non-zero
+return code. Tests that exceed the timeout specified by :prop_test:`TIMEOUT`
+still fail regardless of ``WILL_FAIL``.
-This property can be used for tests that are expected to fail and return a
-non-zero return code. Note that system-level test failures such as segmentation
-faults or heap errors will still fail the test even if ``WILL_FALL`` is true.
+Caveat: system-level test failures including segmentation faults,
+signal abort, or heap errors may fail the test even if ``WILL_FAIL`` is true.
+
+Example of a test that would ordinarily pass, but fails because ``WILL_FAIL``
+is ``true``:
+
+.. code-block:: cmake
+
+ add_test(NAME failed COMMAND ${CMAKE_COMMAND} -E true)
+ set_property(TEST failed PROPERTY WILL_FAIL true)
+
+To run a test that may have a system-level failure, but still pass if
+``WILL_FAIL`` is set, use a CMake command to wrap the executable run like:
+
+.. code-block:: cmake
+
+ add_executable(main main.c)
+
+ add_test(NAME sigabrt COMMAND ${CMAKE_COMMAND} -E env $<TARGET_FILE:main>)
+
+ set_property(TEST sigabrt PROPERTY WILL_FAIL TRUE)
+
+.. code-block:: c
+
+ #include <signal.h>
+
+ int main(void){ raise(SIGABRT); return 0; }
diff --git a/Help/prop_tgt/AUTOGEN_COMMAND_LINE_LENGTH_MAX.rst b/Help/prop_tgt/AUTOGEN_COMMAND_LINE_LENGTH_MAX.rst
new file mode 100644
index 0000000..f1e51a7
--- /dev/null
+++ b/Help/prop_tgt/AUTOGEN_COMMAND_LINE_LENGTH_MAX.rst
@@ -0,0 +1,18 @@
+AUTOGEN_COMMAND_LINE_LENGTH_MAX
+-------------------------------
+
+.. versionadded:: 3.29
+
+Command line length limit for autogen targets, i.e. ``moc`` or ``uic``,
+that triggers the use of response files on Windows instead of passing all
+arguments to the command line.
+
+- An empty (or unset) value sets the limit to 32000
+- A positive non zero integer value sets the exact command line length
+ limit.
+
+By default ``AUTOGEN_COMMAND_LINE_LENGTH_MAX`` is initialized from
+:variable:`CMAKE_AUTOGEN_COMMAND_LINE_LENGTH_MAX`.
+
+See the :manual:`cmake-qt(7)` manual for more information on using CMake
+with Qt.
diff --git a/Help/prop_tgt/AUTOMOC.rst b/Help/prop_tgt/AUTOMOC.rst
index 0feb2e8..6f58afb 100644
--- a/Help/prop_tgt/AUTOMOC.rst
+++ b/Help/prop_tgt/AUTOMOC.rst
@@ -247,5 +247,9 @@ will be generated when this variable is ``ON``.
This target property controls the number of ``moc`` or ``uic`` processes to
start in parallel during builds.
+:prop_tgt:`AUTOGEN_COMMAND_LINE_LENGTH_MAX`:
+This target property controls the limit when to use response files for
+``moc`` or ``uic`` processes on Windows.
+
See the :manual:`cmake-qt(7)` manual for more information on using CMake
with Qt.
diff --git a/Help/prop_tgt/AUTOUIC.rst b/Help/prop_tgt/AUTOUIC.rst
index dc854b2..95366ee 100644
--- a/Help/prop_tgt/AUTOUIC.rst
+++ b/Help/prop_tgt/AUTOUIC.rst
@@ -81,5 +81,9 @@ will be generated when this variable is ``ON``.
This target property controls the number of ``moc`` or ``uic`` processes to
start in parallel during builds.
+:prop_tgt:`AUTOGEN_COMMAND_LINE_LENGTH_MAX`:
+This target property controls the limit when to use response files for
+``moc`` or ``uic`` processes on Windows.
+
See the :manual:`cmake-qt(7)` manual for more information on using CMake
with Qt.
diff --git a/Help/prop_tgt/EXPORT_FIND_PACKAGE_NAME.rst b/Help/prop_tgt/EXPORT_FIND_PACKAGE_NAME.rst
new file mode 100644
index 0000000..b49f005
--- /dev/null
+++ b/Help/prop_tgt/EXPORT_FIND_PACKAGE_NAME.rst
@@ -0,0 +1,12 @@
+EXPORT_FIND_PACKAGE_NAME
+------------------------
+
+.. versionadded:: 3.29
+
+Control the package name associated with a dependency target when exporting a
+:command:`find_dependency` call in :command:`install(EXPORT)` or
+:command:`export(EXPORT)`. This can be used to assign a package name to a
+package that is built by CMake and exported, or to override the package in the
+:command:`find_package` call that created the target.
+
+This property is initialized by :variable:`CMAKE_EXPORT_FIND_PACKAGE_NAME`.
diff --git a/Help/prop_tgt/IMPORTED_LOCATION.rst b/Help/prop_tgt/IMPORTED_LOCATION.rst
index 915085b..b7bb748 100644
--- a/Help/prop_tgt/IMPORTED_LOCATION.rst
+++ b/Help/prop_tgt/IMPORTED_LOCATION.rst
@@ -36,7 +36,7 @@ listed in the :prop_tgt:`IMPORTED_CONFIGURATIONS` target property may be
selected and its :prop_tgt:`IMPORTED_LOCATION_<CONFIG>` value used.
To get the location of an imported target read one of the :prop_tgt:`LOCATION`
-or ``LOCATION_<CONFIG>`` properties.
+or :prop_tgt:`LOCATION_<CONFIG>` properties.
For platforms with import libraries (e.g. Windows, AIX or macOS) see also
:prop_tgt:`IMPORTED_IMPLIB`.
diff --git a/Help/prop_tgt/LINKER_TYPE.rst b/Help/prop_tgt/LINKER_TYPE.rst
new file mode 100644
index 0000000..90a663d
--- /dev/null
+++ b/Help/prop_tgt/LINKER_TYPE.rst
@@ -0,0 +1,26 @@
+LINKER_TYPE
+-----------
+
+.. versionadded:: 3.29
+
+Specify which linker will be used for the link step. The property value may use
+:manual:`generator expressions <cmake-generator-expressions(7)>`.
+
+.. code-block:: cmake
+
+ add_library(lib1 SHARED ...)
+ set_property(TARGET lib1 PROPERTY LINKER_TYPE LLD)
+
+This specifies that ``lib1`` should use linker type ``LLD`` for the link step.
+The implementation details will be provided by the variable
+:variable:`CMAKE_<LANG>_USING_LINKER_<TYPE>` with ``<TYPE>`` having the value
+``LLD``.
+
+This property is not supported on :generator:`Green Hills MULTI` and
+:generator:`Visual Studio 9 2008` generators.
+
+.. note::
+ It is assumed that the linker specified is fully compatible with the standard
+ one. CMake will not do any options translation.
+
+.. include:: ../variable/LINKER_PREDEFINED_TYPES.txt
diff --git a/Help/prop_tgt/UNITY_BUILD.rst b/Help/prop_tgt/UNITY_BUILD.rst
index f827a20..52f4714 100644
--- a/Help/prop_tgt/UNITY_BUILD.rst
+++ b/Help/prop_tgt/UNITY_BUILD.rst
@@ -30,11 +30,23 @@ values:
If no explicit :prop_tgt:`UNITY_BUILD_MODE` has been specified, CMake will
default to ``BATCH``.
-Unity builds are not currently supported for all languages. CMake version
-|release| supports combining ``C`` and ``CXX`` source files. For targets that
-mix source files from more than one language, CMake will separate the languages
-such that each generated unity source file only contains sources for a single
-language.
+Unity builds are supported for the following languages:
+
+``C``
+ .. versionadded:: 3.16
+
+``CXX``
+ .. versionadded:: 3.16
+
+``OBJC``
+ .. versionadded:: 3.29
+
+``OBJCXX``
+ .. versionadded:: 3.29
+
+For targets that mix source files from more than one language, CMake
+separates the languages such that each generated unity source file only
+contains sources for a single language.
This property is initialized by the value of the :variable:`CMAKE_UNITY_BUILD`
variable when a target is created.
diff --git a/Help/release/3.22.rst b/Help/release/3.22.rst
index eba5d66..2d060ac 100644
--- a/Help/release/3.22.rst
+++ b/Help/release/3.22.rst
@@ -19,7 +19,7 @@ Commands
* The :command:`string(TIMESTAMP)` command now supports the ``%V``
specifier for ISO 8601 week numbers.
-.. _`OS identification variables`: https://www.freedesktop.org/software/systemd/man/os-release.html
+.. _`OS identification variables`: https://www.freedesktop.org/software/systemd/man/latest/os-release.html
Variables
---------
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/Linker-user-selection.rst b/Help/release/dev/Linker-user-selection.rst
new file mode 100644
index 0000000..ed78099
--- /dev/null
+++ b/Help/release/dev/Linker-user-selection.rst
@@ -0,0 +1,6 @@
+Linker-user-selection
+---------------------
+
+* The linker tool can now be specified for a selection of compilers/platforms
+ by setting :variable:`CMAKE_LINKER_TYPE` variable or :prop_tgt:`LINKER_TYPE`
+ target property.
diff --git a/Help/release/dev/cmake-E-cat-stdin.rst b/Help/release/dev/cmake-E-cat-stdin.rst
new file mode 100644
index 0000000..43a8aed
--- /dev/null
+++ b/Help/release/dev/cmake-E-cat-stdin.rst
@@ -0,0 +1,5 @@
+cmake-E-cat-stdin
+-----------------
+
+* :manual:`cmake(1)` :option:`-E cat <cmake-E cat>` can now print the standard
+ input by passing the ``-`` argument.
diff --git a/Help/release/dev/compiler-linker.rst b/Help/release/dev/compiler-linker.rst
new file mode 100644
index 0000000..4783656
--- /dev/null
+++ b/Help/release/dev/compiler-linker.rst
@@ -0,0 +1,8 @@
+compiler-linker
+---------------
+
+* The linker effectively used for the link step is now documented with the
+ :variable:`CMAKE_<LANG>_COMPILER_LINKER`,
+ :variable:`CMAKE_<LANG>_COMPILER_LINKER_ID`,
+ :variable:`CMAKE_<LANG>_COMPILER_LINKER_VERSION` and
+ :variable:`CMAKE_<LANG>_COMPILER_LINKER_FRONTEND_VARIANT` variables.
diff --git a/Help/release/dev/export-find_dependency-calls.rst b/Help/release/dev/export-find_dependency-calls.rst
new file mode 100644
index 0000000..58064b7
--- /dev/null
+++ b/Help/release/dev/export-find_dependency-calls.rst
@@ -0,0 +1,16 @@
+export-find_dependency-calls
+----------------------------
+
+* :command:`install(EXPORT)` and :command:`export(EXPORT)` learned a new
+ ``EXPORT_PACKAGE_DEPENDENCIES`` argument, which can be used to generate
+ :command:`find_dependency` calls based on what targets the exported targets
+ depend on.
+* A new :command:`export(SETUP)` signature was created to configure export
+ sets. This can be used to configure how :command:`find_dependency` calls are
+ exported.
+* A new :prop_tgt:`EXPORT_FIND_PACKAGE_NAME` target property was created to
+ allow targets to specify what package name to pass when exporting
+ :command:`find_dependency` calls. This property is initialized with a new
+ :variable:`CMAKE_EXPORT_FIND_PACKAGE_NAME` variable.
+* :command:`FetchContent_MakeAvailable` now sets the
+ :variable:`CMAKE_EXPORT_FIND_PACKAGE_NAME` variable for CMake projects.
diff --git a/Help/release/dev/if-check-file-permissions.rst b/Help/release/dev/if-check-file-permissions.rst
new file mode 100644
index 0000000..ec69b00
--- /dev/null
+++ b/Help/release/dev/if-check-file-permissions.rst
@@ -0,0 +1,5 @@
+if-check-file-permissions
+-------------------------
+
+* The :command:`if` command gained new tests ``IS_READABLE``, ``IS_WRITABLE``
+ and ``IS_EXECUTABLE`` to check file or directory permissions.
diff --git a/Help/release/dev/install-export-xcframework.rst b/Help/release/dev/install-export-xcframework.rst
new file mode 100644
index 0000000..513a552
--- /dev/null
+++ b/Help/release/dev/install-export-xcframework.rst
@@ -0,0 +1,9 @@
+install-export-xcframework
+--------------------------
+
+* The :command:`export(SETUP)` command gained a new ``XCFRAMEWORK_LOCATION``
+ argument, which can be used to specify the location of a ``.xcframework``
+ that can be substituted for the installed library.
+* The :module:`CMakePackageConfigHelpers` module gained a new
+ :command:`generate_apple_platform_selection_file` function, which can be
+ used to generate a file that includes another Apple-platform-specific file.
diff --git a/Help/release/dev/link-deduplicate-libs.rst b/Help/release/dev/link-deduplicate-libs.rst
new file mode 100644
index 0000000..4a03f2c
--- /dev/null
+++ b/Help/release/dev/link-deduplicate-libs.rst
@@ -0,0 +1,5 @@
+link-deduplicate-libs
+---------------------
+
+* CMake learned to de-duplicate libraries on link lines based on linker
+ capabilities. See policy :policy:`CMP0156`.
diff --git a/Help/release/dev/make-test-depend-on-all.rst b/Help/release/dev/make-test-depend-on-all.rst
new file mode 100644
index 0000000..ef43faf
--- /dev/null
+++ b/Help/release/dev/make-test-depend-on-all.rst
@@ -0,0 +1,6 @@
+make-test-depend-on-all
+-----------------------
+
+* The :variable:`CMAKE_SKIP_TEST_ALL_DEPENDENCY` variable was added
+ to control whether the ``test`` (or ``RUN_TESTS``) buildsystem
+ target depends on the ``all`` (or ``ALL_BUILD``) target.
diff --git a/Help/release/dev/project-include-multiple.rst b/Help/release/dev/project-include-multiple.rst
new file mode 100644
index 0000000..3f7b360
--- /dev/null
+++ b/Help/release/dev/project-include-multiple.rst
@@ -0,0 +1,11 @@
+project-include-multiple
+------------------------
+
+* The :variable:`CMAKE_PROJECT_INCLUDE`,
+ :variable:`CMAKE_PROJECT_INCLUDE_BEFORE`,
+ :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE`, and
+ :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE_BEFORE` variables learned
+ to support a :ref:`semicolon-separated list <CMake Language Lists>` of
+ CMake language files to be included sequentially. These variables can also
+ reference module names to be found in :variable:`CMAKE_MODULE_PATH` or
+ builtin to CMake.
diff --git a/Help/release/dev/unity-build-objc.rst b/Help/release/dev/unity-build-objc.rst
new file mode 100644
index 0000000..ce6460b
--- /dev/null
+++ b/Help/release/dev/unity-build-objc.rst
@@ -0,0 +1,5 @@
+unity-build-objc
+----------------
+
+* The :prop_tgt:`UNITY_BUILD` target property now supports the
+ Objective C (``OBJC``) and Objective C++ (``OBJCXX``) languages.
diff --git a/Help/release/index.rst b/Help/release/index.rst
index b84bdb4..ea13fdc 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/CMAKE_AUTOGEN_COMMAND_LINE_LENGTH_MAX.rst b/Help/variable/CMAKE_AUTOGEN_COMMAND_LINE_LENGTH_MAX.rst
new file mode 100644
index 0000000..eabda43
--- /dev/null
+++ b/Help/variable/CMAKE_AUTOGEN_COMMAND_LINE_LENGTH_MAX.rst
@@ -0,0 +1,10 @@
+CMAKE_AUTOGEN_COMMAND_LINE_LENGTH_MAX
+-------------------------------------
+
+.. versionadded:: 3.29
+
+Command line length limit for autogen targets, i.e. ``moc`` or ``uic``,
+that triggers the use of response files on Windows instead of passing all
+arguments to the command line.
+
+By default ``CMAKE_AUTOGEN_COMMAND_LINE_LENGTH_MAX`` is unset.
diff --git a/Help/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.rst b/Help/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.rst
index 58818f4..b375b77 100644
--- a/Help/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.rst
+++ b/Help/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.rst
@@ -15,4 +15,14 @@ variables which have been stored in the cache will still be there. In
that case it is recommended to remove the cache variables for this
package from the cache using the cache editor or :option:`cmake -U`.
+Note that this variable can lead to inconsistent results within the project.
+Consider the case where a dependency is requested via :command:`find_package`
+from two different places within the project. If the first call does not
+have the ``REQUIRED`` keyword, it will not find the dependency when
+``CMAKE_DISABLE_FIND_PACKAGE_<PackageName>`` is set to true for that
+dependency. The project will proceed under the assumption that the dependency
+isn't available. If the second call elsewhere in the project *does* have the
+``REQUIRED`` keyword, it can succeed. Two different parts of the same project
+have then seen opposite results for the same dependency.
+
See also the :variable:`CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>` variable.
diff --git a/Help/variable/CMAKE_EXPORT_FIND_PACKAGE_NAME.rst b/Help/variable/CMAKE_EXPORT_FIND_PACKAGE_NAME.rst
new file mode 100644
index 0000000..b6c8b76
--- /dev/null
+++ b/Help/variable/CMAKE_EXPORT_FIND_PACKAGE_NAME.rst
@@ -0,0 +1,6 @@
+CMAKE_EXPORT_FIND_PACKAGE_NAME
+------------------------------
+
+.. versionadded:: 3.29
+
+Initializes the value of :prop_tgt:`EXPORT_FIND_PACKAGE_NAME`.
diff --git a/Help/variable/CMAKE_LANG_COMPILER_LINKER.rst b/Help/variable/CMAKE_LANG_COMPILER_LINKER.rst
new file mode 100644
index 0000000..c0ae1cd
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_COMPILER_LINKER.rst
@@ -0,0 +1,15 @@
+CMAKE_<LANG>_COMPILER_LINKER
+----------------------------
+
+.. versionadded:: 3.29
+
+The full path to the linker for ``LANG``.
+
+This is the command that will be used as the ``<LANG>`` linker.
+
+This variable is not guaranteed to be defined for all linkers or languages.
+
+.. note::
+ This variable is read-only. It must not be set by the user. To select a
+ specific linker, use the :variable:`CMAKE_LINKER_TYPE` variable or the
+ :prop_tgt:`LINKER_TYPE` target property.
diff --git a/Help/variable/CMAKE_LANG_COMPILER_LINKER_FRONTEND_VARIANT.rst b/Help/variable/CMAKE_LANG_COMPILER_LINKER_FRONTEND_VARIANT.rst
new file mode 100644
index 0000000..d7d028a
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_COMPILER_LINKER_FRONTEND_VARIANT.rst
@@ -0,0 +1,21 @@
+CMAKE_<LANG>_COMPILER_LINKER_FRONTEND_VARIANT
+---------------------------------------------
+
+.. versionadded:: 3.29
+
+Identification string of the linker frontend variant.
+
+Some linkers have multiple, different frontends for accepting command
+line options. (For example ``LLCM LLD`` originally only had a frontend
+compatible with the ``GNU`` compiler but since its port to Windows
+(``lld-link``) it now also supports a frontend compatible with ``MSVC``.)
+When CMake detects such a linker it sets this variable to what would have been
+the :variable:`CMAKE_<LANG>_COMPILER_LINKER_ID` for the linker whose frontend
+it resembles.
+
+.. note::
+ In other words, this variable describes what command line options
+ and language extensions the linker frontend expects.
+
+ This variable is set for ``GNU``, ``MSVC``, ``MOLD`` and ``AppleClang``
+ linkers that have only one frontend variant.
diff --git a/Help/variable/CMAKE_LANG_COMPILER_LINKER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_LINKER_ID.rst
new file mode 100644
index 0000000..560f522
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_COMPILER_LINKER_ID.rst
@@ -0,0 +1,31 @@
+CMAKE_<LANG>_COMPILER_LINKER_ID
+-------------------------------
+
+.. versionadded:: 3.29
+
+Linker identification string.
+
+A short string unique to the linker vendor. Possible values
+include:
+
+=============================== ===============================================
+Value Name
+=============================== ===============================================
+``AppleClang`` Apple Clang
+``LLD`` `LLVM LLD`_
+``GNU`` `GNU Binutils - ld linker`_ (also known as
+ ``bfd``)
+``GNUgold`` `GNU Binutils - gold linker`_
+``MSVC`` `Microsoft Visual Studio`_
+``MOLD`` `mold: A Modern Linker`_ or, on Apple, `sold`_
+ linker
+=============================== ===============================================
+
+This variable is not guaranteed to be defined for all linkers or languages.
+
+.. _LLVM LLD: https://lld.llvm.org
+.. _GNU Binutils - ld linker: https://sourceware.org/binutils
+.. _GNU Binutils - gold linker: https://sourceware.org/binutils
+.. _Microsoft Visual Studio: https://visualstudio.microsoft.com
+.. _mold\: A Modern Linker: https://github.com/rui314/mold
+.. _sold: https://github.com/bluewhalesystems/sold
diff --git a/Help/variable/CMAKE_LANG_COMPILER_LINKER_VERSION.rst b/Help/variable/CMAKE_LANG_COMPILER_LINKER_VERSION.rst
new file mode 100644
index 0000000..72b0551
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_COMPILER_LINKER_VERSION.rst
@@ -0,0 +1,10 @@
+CMAKE_<LANG>_COMPILER_LINKER_VERSION
+------------------------------------
+
+.. versionadded:: 3.29
+
+Linker version string.
+
+Linker version in major[.minor[.patch[.tweak]]] format. This
+variable is not guaranteed to be defined for all linkers or
+languages.
diff --git a/Help/variable/CMAKE_LANG_USING_LINKER_MODE.rst b/Help/variable/CMAKE_LANG_USING_LINKER_MODE.rst
new file mode 100644
index 0000000..c9b6779
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_USING_LINKER_MODE.rst
@@ -0,0 +1,15 @@
+CMAKE_<LANG>_USING_LINKER_MODE
+------------------------------
+
+.. versionadded:: 3.29
+
+This variable specify what is the type of data stored in variable
+ :variable:`CMAKE_<LANG>_USING_LINKER_<TYPE>`. There are two possible values:
+
+``FLAG``
+ :variable:`CMAKE_<LANG>_USING_LINKER_<TYPE>` holds compiler flags. This is
+ the default.
+
+``TOOL``
+ :variable:`CMAKE_<LANG>_USING_LINKER_<TYPE>` holds the path to the linker
+ tool.
diff --git a/Help/variable/CMAKE_LANG_USING_LINKER_TYPE.rst b/Help/variable/CMAKE_LANG_USING_LINKER_TYPE.rst
new file mode 100644
index 0000000..e4d9fa6
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_USING_LINKER_TYPE.rst
@@ -0,0 +1,30 @@
+CMAKE_<LANG>_USING_LINKER_<TYPE>
+--------------------------------
+
+.. versionadded:: 3.29
+
+This variable defines how to specify the linker for the link step for the type
+as specified by the variable :variable:`CMAKE_LINKER_TYPE` or the target
+property :prop_tgt:`LINKER_TYPE`. It can hold compiler flags for the link step
+or directly the linker tool. The type of data is given by the variable
+:variable:`CMAKE_<LANG>_USING_LINKER_MODE`.
+
+For example, to specify the ``LLVM`` linker for ``GNU`` compilers, we have:
+
+.. code-block:: cmake
+
+ set(CMAKE_C_USING_LINKER_LLD "-fuse-ld=lld")
+
+Or on ``Windows`` platform, for ``Clang`` compilers simulating ``MSVC``, we
+have:
+
+.. code-block:: cmake
+
+ set(CMAKE_C_USING_LINKER_LLD "-fuse-ld=lld-link")
+
+And for the ``MSVC`` compiler, linker is directly used, so we have:
+
+.. code-block:: cmake
+
+ set(CMAKE_C_USING_LINKER_LLD "/path/to/lld-link.exe")
+ set(CMAKE_C_USING_LINKER_MODE TOOL)
diff --git a/Help/variable/CMAKE_LINKER_TYPE.rst b/Help/variable/CMAKE_LINKER_TYPE.rst
new file mode 100644
index 0000000..17ea947
--- /dev/null
+++ b/Help/variable/CMAKE_LINKER_TYPE.rst
@@ -0,0 +1,18 @@
+CMAKE_LINKER_TYPE
+-----------------
+
+.. versionadded:: 3.29
+
+Specify which linker will be used for the link step.
+
+.. note::
+ It is assumed that the linker specified is fully compatible with the standard
+ one. CMake will not do any options translation.
+
+This variable is used to initialize the :prop_tgt:`LINKER_TYPE` target
+property when they are created by calls to :command:`add_library` or
+:command:`add_executable` commands. It is meaningful only for targets having a
+link step. If set, its value is also used by the :command:`try_compile`
+command.
+
+.. include:: LINKER_PREDEFINED_TYPES.txt
diff --git a/Help/variable/CMAKE_PROJECT_INCLUDE.rst b/Help/variable/CMAKE_PROJECT_INCLUDE.rst
index 76b9d92..217604f 100644
--- a/Help/variable/CMAKE_PROJECT_INCLUDE.rst
+++ b/Help/variable/CMAKE_PROJECT_INCLUDE.rst
@@ -3,12 +3,17 @@ CMAKE_PROJECT_INCLUDE
.. versionadded:: 3.15
-A CMake language file or module to be included as the last step of all
+A CMake language file to be included as the last step of all
:command:`project` command calls. This is intended for injecting custom code
into project builds without modifying their source. See :ref:`Code Injection`
for a more detailed discussion of files potentially included during a
:command:`project` call.
+.. versionadded:: 3.29
+ This variable can be a :ref:`semicolon-separated list <CMake Language Lists>`
+ of CMake language files to be included sequentially. It can also now refer to
+ module names to be found in :variable:`CMAKE_MODULE_PATH` or builtin to CMake.
+
See also the :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE`,
:variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE_BEFORE`,
:variable:`CMAKE_PROJECT_INCLUDE_BEFORE`, and
diff --git a/Help/variable/CMAKE_PROJECT_INCLUDE_BEFORE.rst b/Help/variable/CMAKE_PROJECT_INCLUDE_BEFORE.rst
index 9a8c4b5..1dc0241 100644
--- a/Help/variable/CMAKE_PROJECT_INCLUDE_BEFORE.rst
+++ b/Help/variable/CMAKE_PROJECT_INCLUDE_BEFORE.rst
@@ -3,12 +3,17 @@ CMAKE_PROJECT_INCLUDE_BEFORE
.. versionadded:: 3.15
-A CMake language file or module to be included as the first step of all
+A CMake language file to be included as the first step of all
:command:`project` command calls. This is intended for injecting custom code
into project builds without modifying their source. See :ref:`Code Injection`
for a more detailed discussion of files potentially included during a
:command:`project` call.
+.. versionadded:: 3.29
+ This variable can be a :ref:`semicolon-separated list <CMake Language Lists>`
+ of CMake language files to be included sequentially. It can also now refer to
+ module names to be found in :variable:`CMAKE_MODULE_PATH` or builtin to CMake.
+
See also the :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE`,
:variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE_BEFORE`,
:variable:`CMAKE_PROJECT_INCLUDE`, and
diff --git a/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst b/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst
index 3bb5cd8..6d37c1a 100644
--- a/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst
+++ b/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst
@@ -1,12 +1,17 @@
CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE
------------------------------------
-A CMake language file or module to be included as the last step of any
+A CMake language file to be included as the last step of any
:command:`project` command calls that specify ``<PROJECT-NAME>`` as the project
name. This is intended for injecting custom code into project builds without
modifying their source. See :ref:`Code Injection` for a more detailed
discussion of files potentially included during a :command:`project` call.
+.. versionadded:: 3.29
+ This variable can be a :ref:`semicolon-separated list <CMake Language Lists>`
+ of CMake language files to be included sequentially. It can also now refer to
+ module names to be found in :variable:`CMAKE_MODULE_PATH` or builtin to CMake.
+
See also the :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE_BEFORE`,
:variable:`CMAKE_PROJECT_INCLUDE`, :variable:`CMAKE_PROJECT_INCLUDE_BEFORE`,
and :variable:`CMAKE_PROJECT_TOP_LEVEL_INCLUDES` variables.
diff --git a/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE_BEFORE.rst b/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE_BEFORE.rst
index ca584c1..96ddbf6 100644
--- a/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE_BEFORE.rst
+++ b/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE_BEFORE.rst
@@ -3,12 +3,17 @@ CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE_BEFORE
.. versionadded:: 3.17
-A CMake language file or module to be included as the first step of any
+A CMake language file to be included as the first step of any
:command:`project` command calls that specify ``<PROJECT-NAME>`` as the project
name. This is intended for injecting custom code into project builds without
modifying their source. See :ref:`Code Injection` for a more detailed
discussion of files potentially included during a :command:`project` call.
+.. versionadded:: 3.29
+ This variable can be a :ref:`semicolon-separated list <CMake Language Lists>`
+ of CMake language files to be included sequentially. It can also now refer to
+ module names to be found in :variable:`CMAKE_MODULE_PATH` or builtin to CMake.
+
See also the :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE`,
:variable:`CMAKE_PROJECT_INCLUDE`, :variable:`CMAKE_PROJECT_INCLUDE_BEFORE`,
and :variable:`CMAKE_PROJECT_TOP_LEVEL_INCLUDES` variables.
diff --git a/Help/variable/CMAKE_PROJECT_TOP_LEVEL_INCLUDES.rst b/Help/variable/CMAKE_PROJECT_TOP_LEVEL_INCLUDES.rst
index 2010b08..54f530e 100644
--- a/Help/variable/CMAKE_PROJECT_TOP_LEVEL_INCLUDES.rst
+++ b/Help/variable/CMAKE_PROJECT_TOP_LEVEL_INCLUDES.rst
@@ -12,6 +12,10 @@ including things like :variable:`CMAKE_<LANG>_COMPILER`, might not be set.
See :ref:`Code Injection` for a more detailed discussion of files potentially
included during a :command:`project` call.
+.. versionadded:: 3.29
+ This variable can also now refer to module names to be found in
+ :variable:`CMAKE_MODULE_PATH` or builtin to CMake.
+
This variable is intended for specifying files that perform one-time setup
for the build. It provides an injection point for things like configuring
package managers, adding logic the user shares between projects (e.g. defining
diff --git a/Help/variable/CMAKE_REQUIRE_FIND_PACKAGE_PackageName.rst b/Help/variable/CMAKE_REQUIRE_FIND_PACKAGE_PackageName.rst
index 893f1ae..52bf30a 100644
--- a/Help/variable/CMAKE_REQUIRE_FIND_PACKAGE_PackageName.rst
+++ b/Help/variable/CMAKE_REQUIRE_FIND_PACKAGE_PackageName.rst
@@ -11,4 +11,35 @@ turned into ``REQUIRED`` by setting the variable
This can be used to assert assumptions about build environment and to
ensure the build will fail early if they do not hold.
+Note that setting this variable to true breaks some commonly used patterns.
+Multiple calls to :command:`find_package` are sometimes used to obtain a
+different search order to the default.
+For example, projects can force checking a known path for a particular
+package first before searching any of the other default search paths:
+
+.. code:: cmake
+
+ find_package(something PATHS /some/local/path NO_DEFAULT_PATH)
+ find_package(something)
+
+In the above, the first call looks for the ``something`` package in a specific
+directory. If ``CMAKE_REQUIRE_FIND_PACKAGE_something`` is set to true, then
+this first call must succeed, otherwise a fatal error occurs. The second call
+never gets a chance to provide a fall-back to using the default search
+locations.
+
+A similar pattern is used even by some of CMake's own Find modules to search
+for a config package first:
+
+.. code:: cmake
+
+ find_package(something CONFIG QUIET)
+ if(NOT something_FOUND)
+ # Fall back to searching using typical Find module logic...
+ endif()
+
+Again, if ``CMAKE_REQUIRE_FIND_PACKAGE_something`` is true, the first call
+must succeed. It effectively means a config package must be found for the
+dependency, and the Find module logic is never used.
+
See also the :variable:`CMAKE_DISABLE_FIND_PACKAGE_<PackageName>` variable.
diff --git a/Help/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY.rst b/Help/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY.rst
index e88db36..69c762b 100644
--- a/Help/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY.rst
+++ b/Help/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY.rst
@@ -9,3 +9,5 @@ built, first the ``all`` target is built, then the installation starts.
If ``CMAKE_SKIP_INSTALL_ALL_DEPENDENCY`` is set to ``TRUE``, this
dependency is not created, so the installation process will start immediately,
independent from whether the project has been completely built or not.
+
+See also :variable:`CMAKE_SKIP_TEST_ALL_DEPENDENCY`.
diff --git a/Help/variable/CMAKE_SKIP_TEST_ALL_DEPENDENCY.rst b/Help/variable/CMAKE_SKIP_TEST_ALL_DEPENDENCY.rst
new file mode 100644
index 0000000..bae8e99
--- /dev/null
+++ b/Help/variable/CMAKE_SKIP_TEST_ALL_DEPENDENCY.rst
@@ -0,0 +1,19 @@
+CMAKE_SKIP_TEST_ALL_DEPENDENCY
+------------------------------
+
+.. versionadded:: 3.29
+
+Control whether the ``test`` target depends on the ``all`` target.
+
+If this variable is not defined, or is set to ``TRUE``, then the
+``test`` (or ``RUN_TESTS``) target does not depend on the
+``all`` (or ``ALL_BUILD``) target. When the ``test`` target is built,
+e.g., via ``make test``, the test process will start immediately,
+regardless of whether the project has been completely built or not.
+
+If ``CMAKE_SKIP_TEST_ALL_DEPENDENCY`` is explicitly set to ``FALSE``,
+then the ``test`` target will depend on the ``all`` target. When the
+``test`` target is built, e.g., via ``make test``, the ``all`` target
+will be built first, and then the tests will run.
+
+See also :variable:`CMAKE_SKIP_INSTALL_ALL_DEPENDENCY`.
diff --git a/Help/variable/LINKER_PREDEFINED_TYPES.txt b/Help/variable/LINKER_PREDEFINED_TYPES.txt
new file mode 100644
index 0000000..50dc3df
--- /dev/null
+++ b/Help/variable/LINKER_PREDEFINED_TYPES.txt
@@ -0,0 +1,57 @@
+Linker types are case-sensitive and may only contain letters, numbers and
+underscores. Linker types defined in all uppercase are reserved for CMake's own
+built-in types. The pre-defined linker types are:
+
+``DEFAULT``
+ This type corresponds to standard linking, essentially equivalent to
+ not specifying :prop_tgt:`LINKER_TYPE` target property.
+
+``SYSTEM``
+ Use the standard linker delivered by the platform or the standard toolkit
+ (for example, ``SYSTEM`` imply Microsoft linker for all ``MSVC`` compatible
+ compilers). This type is supported for the following platforms/compilers:
+
+ * Linux, for ``GNU``, ``Clang`` and ``NVIDIA`` compilers.
+ * All Apple variants for ``AppleClang``, ``Clang`` and ``GNU`` compilers.
+ * Windows, for ``MSVC``, ``GNU``, ``Clang`` and ``NVIDIA`` compilers.
+
+``LLD``
+ Use the ``LLVM`` linker. This type is supported for the following
+ platforms/compilers:
+
+ * Linux, for ``GNU``, ``Clang`` and ``NVIDIA`` compilers.
+ * All Apple variants for ``Clang`` and ``AppleClang`` compilers.
+ * Windows, for ``GNU``, ``Clang`` compilers with ``GNU`` front-end and
+ ``CLang``, ``MSVC`` and ``NVIDIA`` compilers with ``MSVC`` front-end.
+
+``BFD``
+ Use the ``GNU`` linker. This type is supported for the following
+ platforms/compilers:
+
+ * Linux, for ``GNU``, ``Clang`` and ``NVIDIA`` compilers.
+ * Windows, for ``GNU``, ``Clang`` compilers with ``GNU`` front-end.
+
+``GOLD``
+ Supported on Linux platform for ``GNU``, ``Clang`` and ``NVIDIA`` compilers.
+
+``MOLD``
+ Use the `mold linker <https://github.com/rui314/mold>`_. This type is
+ supported on the following platforms:
+
+ * Linux platform for ``GNU``, ``Clang`` and ``NVIDIA`` compilers.
+ * All Apple variants for ``Clang`` and ``AppleClang`` compilers as an
+ alias to ``SOLD``.
+
+``SOLD``
+ Use the `sold linker <https://github.com/bluewhalesystems/sold>`_. This type
+ is only supported on Apple platforms for ``Clang`` and ``AppleClang``
+ compilers.
+
+``APPLE_CLASSIC``
+ Use the Apple linker in the classic behavior (i.e. before ``Xcode 15.0``).
+ This type is only supported on Apple platforms for ``GNU``, ``Clang`` and
+ ``AppleClang`` compilers.
+
+``MSVC``
+ Use the Microsoft linker. This type is only supported on Windows
+ platform for ``MSVC`` and ``Clang`` compiler with ``MSVC`` front-end.
diff --git a/Modules/CMakeASMCompiler.cmake.in b/Modules/CMakeASMCompiler.cmake.in
index 1efd9f5..c7dbfae 100644
--- a/Modules/CMakeASMCompiler.cmake.in
+++ b/Modules/CMakeASMCompiler.cmake.in
@@ -5,6 +5,12 @@ set(CMAKE_ASM@ASM_DIALECT@_COMPILER_AR "@_CMAKE_ASM_COMPILER_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_RANLIB "@_CMAKE_ASM_COMPILER_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@")
+set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@")
+set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LINKER "@CMAKE_ASM_COMPILER_LINKER@")
+set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LINKER_ID "@CMAKE_ASM_COMPILER_LINKER_ID@")
+set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LINKER_VERSION @CMAKE_ASM_COMPILER_LINKER_VERSION@)
+set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_ASM_COMPILER_LINKER_FRONTEND_VARIANT@)
set(CMAKE_MT "@CMAKE_MT@")
set(CMAKE_TAPI "@CMAKE_TAPI@")
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LOADED 1)
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
index 2f0b774..df2a060 100644
--- a/Modules/CMakeCCompiler.cmake.in
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -26,6 +26,12 @@ set(CMAKE_C_COMPILER_AR "@CMAKE_C_COMPILER_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_C_COMPILER_RANLIB "@CMAKE_C_COMPILER_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@")
+set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@")
+set(CMAKE_C_COMPILER_LINKER "@CMAKE_C_COMPILER_LINKER@")
+set(CMAKE_C_COMPILER_LINKER_ID "@CMAKE_C_COMPILER_LINKER_ID@")
+set(CMAKE_C_COMPILER_LINKER_VERSION @CMAKE_C_COMPILER_LINKER_VERSION@)
+set(CMAKE_C_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_C_COMPILER_LINKER_FRONTEND_VARIANT@)
set(CMAKE_MT "@CMAKE_MT@")
set(CMAKE_TAPI "@CMAKE_TAPI@")
set(CMAKE_COMPILER_IS_GNUCC @CMAKE_COMPILER_IS_GNUCC@)
diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in
index 3c28c28..3af02a4 100644
--- a/Modules/CMakeCUDACompiler.cmake.in
+++ b/Modules/CMakeCUDACompiler.cmake.in
@@ -72,5 +72,12 @@ set(CMAKE_CUDA_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CUDA_IMPLICIT_LINK_FR
@_SET_CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT@
set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@")
+set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@")
+set(CMAKE_CUDA_COMPILER_LINKER "@CMAKE_CUDA_COMPILER_LINKER@")
+set(CMAKE_CUDA_COMPILER_LINKER_ID "@CMAKE_CUDA_COMPILER_LINKER_ID@")
+set(CMAKE_CUDA_COMPILER_LINKER_VERSION @CMAKE_CUDA_COMPILER_LINKER_VERSION@)
+set(CMAKE_CUDA_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_CUDA_COMPILER_LINKER_FRONTEND_VARIANT@)
set(CMAKE_AR "@CMAKE_AR@")
+set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_MT "@CMAKE_MT@")
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index 8b6f82b..0957d9b 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -27,6 +27,12 @@ set(CMAKE_CXX_COMPILER_AR "@CMAKE_CXX_COMPILER_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_CXX_COMPILER_RANLIB "@CMAKE_CXX_COMPILER_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@")
+set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@")
+set(CMAKE_CXX_COMPILER_LINKER "@CMAKE_CXX_COMPILER_LINKER@")
+set(CMAKE_CXX_COMPILER_LINKER_ID "@CMAKE_CXX_COMPILER_LINKER_ID@")
+set(CMAKE_CXX_COMPILER_LINKER_VERSION @CMAKE_CXX_COMPILER_LINKER_VERSION@)
+set(CMAKE_CXX_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_CXX_COMPILER_LINKER_FRONTEND_VARIANT@)
set(CMAKE_MT "@CMAKE_MT@")
set(CMAKE_TAPI "@CMAKE_TAPI@")
set(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@)
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index 7eb93e2..e4fa43f 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -42,11 +42,6 @@ function(compiler_id_detection outvar lang)
# Order is relevant here. For example, compilers which pretend to be
# GCC must appear before the actual GCC.
- if ("x${lang}" STREQUAL "xCXX")
- list(APPEND ordered_compilers
- Comeau
- )
- endif()
list(APPEND ordered_compilers
Intel
IntelLLVM
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
index efc18f9..012a87c 100644
--- a/Modules/CMakeDetermineCompilerABI.cmake
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -6,6 +6,7 @@
# This is used internally by CMake and should not be included by user
# code.
+include(${CMAKE_ROOT}/Modules/Internal/CMakeDetermineLinkerId.cmake)
include(${CMAKE_ROOT}/Modules/CMakeParseImplicitIncludeInfo.cmake)
include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
include(${CMAKE_ROOT}/Modules/CMakeParseLibraryArchitecture.cmake)
@@ -19,15 +20,19 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
set(BIN "${CMAKE_PLATFORM_INFO_DIR}/CMakeDetermineCompilerABI_${lang}.bin")
set(CMAKE_FLAGS )
set(COMPILE_DEFINITIONS )
+ set(LINK_OPTIONS )
if(DEFINED CMAKE_${lang}_VERBOSE_FLAG)
- set(CMAKE_FLAGS "-DEXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}")
+ set(LINK_OPTIONS "${CMAKE_${lang}_VERBOSE_FLAG}")
set(COMPILE_DEFINITIONS "${CMAKE_${lang}_VERBOSE_FLAG}")
endif()
if(DEFINED CMAKE_${lang}_VERBOSE_COMPILE_FLAG)
set(COMPILE_DEFINITIONS "${CMAKE_${lang}_VERBOSE_COMPILE_FLAG}")
endif()
+ if(DEFINED CMAKE_${lang}_VERBOSE_LINK_FLAG)
+ list(APPEND LINK_OPTIONS "${CMAKE_${lang}_VERBOSE_LINK_FLAG}")
+ endif()
if(lang MATCHES "^(CUDA|HIP)$")
- if(CMAKE_${lang}_ARCHITECTURES STREQUAL "native")
+ if(CMAKE_CUDA_ARCHITECTURES STREQUAL "native")
# We are about to detect the native architectures, so we do
# not yet know them. Use all architectures during detection.
set(CMAKE_${lang}_ARCHITECTURES "all")
@@ -39,6 +44,9 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
# from which we might detect implicit link libraries.
list(APPEND CMAKE_FLAGS "-DCMAKE_${lang}_STANDARD_LIBRARIES=")
endif()
+ list(JOIN LINK_OPTIONS " " LINK_OPTIONS)
+ list(APPEND CMAKE_FLAGS "-DEXE_LINKER_FLAGS=${LINK_OPTIONS}")
+
__TestCompiler_setTryCompileTargetType()
# Avoid failing ABI detection on warnings.
@@ -53,7 +61,6 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
set(ENV{LC_ALL} C)
set(ENV{LC_MESSAGES} C)
set(ENV{LANG} C)
-
try_compile(CMAKE_${lang}_ABI_COMPILED
SOURCES ${src}
CMAKE_FLAGS ${CMAKE_FLAGS}
@@ -146,39 +153,42 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
set(implicit_libs "${CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES}")
set(implicit_fwks "${CMAKE_${lang}_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES}")
else()
- # Parse implicit linker information for this language, if available.
- set(implicit_dirs "")
- set(implicit_objs "")
- set(implicit_libs "")
- set(implicit_fwks "")
- if(CMAKE_${lang}_VERBOSE_FLAG)
- CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs implicit_fwks log
- "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}"
- COMPUTE_IMPLICIT_OBJECTS implicit_objs
- LANGUAGE ${lang})
- message(CONFIGURE_LOG
- "Parsed ${lang} implicit link information:\n${log}\n\n")
- endif()
- # for VS IDE Intel Fortran we have to figure out the
- # implicit link path for the fortran run time using
- # a try-compile
- if("${lang}" MATCHES "Fortran"
- AND "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
- message(CHECK_START "Determine Intel Fortran Compiler Implicit Link Path")
- # Build a sample project which reports symbols.
- try_compile(IFORT_LIB_PATH_COMPILED
- PROJECT IntelFortranImplicit
- SOURCE_DIR ${CMAKE_ROOT}/Modules/IntelVSImplicitPath
- BINARY_DIR ${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath
- CMAKE_FLAGS
- "-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
- OUTPUT_VARIABLE _output)
- file(WRITE
- "${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.txt"
- "${_output}")
- include(${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.cmake OPTIONAL)
- message(CHECK_PASS "done")
- endif()
+ # Parse implicit linker information for this language, if available.
+ set(implicit_dirs "")
+ set(implicit_objs "")
+ set(implicit_libs "")
+ set(implicit_fwks "")
+ set(compute_artifacts COMPUTE_LINKER linker_tool)
+ if(CMAKE_${lang}_VERBOSE_FLAG)
+ list(APPEND compute_artifacts COMPUTE_IMPLICIT_LIBS implicit_libs
+ COMPUTE_IMPLICIT_DIRS implicit_dirs
+ COMPUTE_IMPLICIT_FWKS implicit_fwks
+ COMPUTE_IMPLICIT_OBJECTS implicit_objs)
+ endif()
+ cmake_parse_implicit_link_info2("${OUTPUT}" log "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}"
+ ${compute_artifacts} LANGUAGE ${lang})
+ message(CONFIGURE_LOG
+ "Parsed ${lang} implicit link information:\n${log}\n\n")
+ # for VS IDE Intel Fortran we have to figure out the
+ # implicit link path for the fortran run time using
+ # a try-compile
+ if("${lang}" MATCHES "Fortran"
+ AND "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
+ message(CHECK_START "Determine Intel Fortran Compiler Implicit Link Path")
+ # Build a sample project which reports symbols.
+ try_compile(IFORT_LIB_PATH_COMPILED
+ PROJECT IntelFortranImplicit
+ SOURCE_DIR ${CMAKE_ROOT}/Modules/IntelVSImplicitPath
+ BINARY_DIR ${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath
+ CMAKE_FLAGS
+ "-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
+ OUTPUT_VARIABLE _output)
+ file(WRITE
+ "${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.txt"
+ "${_output}")
+ include(${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.cmake OPTIONAL)
+ message(CHECK_PASS "done")
+ endif()
endif()
# Implicit link libraries cannot be used explicitly for multiple
@@ -193,6 +203,12 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
list(REMOVE_ITEM implicit_dirs $ENV{CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES_EXCLUDE})
endif()
+ set(CMAKE_${lang}_COMPILER_LINKER "${linker_tool}" PARENT_SCOPE)
+ cmake_determine_linker_id(${lang} "${linker_tool}")
+ set(CMAKE_${lang}_COMPILER_LINKER_ID "${CMAKE_${lang}_COMPILER_LINKER_ID}" PARENT_SCOPE)
+ set(CMAKE_${lang}_COMPILER_LINKER_VERSION ${CMAKE_${lang}_COMPILER_LINKER_VERSION} PARENT_SCOPE)
+ set(CMAKE_${lang}_COMPILER_LINKER_FRONTEND_VARIANT ${CMAKE_${lang}_COMPILER_LINKER_FRONTEND_VARIANT} PARENT_SCOPE)
+
set(CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES "${implicit_libs}" PARENT_SCOPE)
set(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" PARENT_SCOPE)
set(CMAKE_${lang}_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "${implicit_fwks}" PARENT_SCOPE)
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index 392f0f1..2c9b5b0 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -22,7 +22,7 @@ elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
_cmake_find_compiler_path(Fortran)
else()
if(NOT CMAKE_Fortran_COMPILER)
- # prefer the environment variable CC
+ # prefer the environment variable FC
if(NOT $ENV{FC} STREQUAL "")
get_filename_component(CMAKE_Fortran_COMPILER_INIT $ENV{FC} PROGRAM PROGRAM_ARGS CMAKE_Fortran_FLAGS_ENV_INIT)
if(CMAKE_Fortran_FLAGS_ENV_INIT)
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index e12b175..cf270c0 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -60,6 +60,13 @@ endfunction()
__resolve_tool_path(CMAKE_LINKER "${_CMAKE_TOOLCHAIN_LOCATION}" "Default Linker")
__resolve_tool_path(CMAKE_MT "${_CMAKE_TOOLCHAIN_LOCATION}" "Default Manifest Tool")
+macro(__resolve_linker_path __linker_type __name __search_path __doc)
+ if(NOT CMAKE_LINKER_${__linker_type})
+ set( CMAKE_LINKER_${__linker_type} "${__name}")
+ endif()
+ __resolve_tool_path(CMAKE_LINKER_${__linker_type} "${__search_path}" "${__doc}")
+endmacro()
+
set(_CMAKE_TOOL_VARS "")
# if it's the MS C/CXX compiler, search for link
@@ -93,6 +100,10 @@ if(("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC" AND
list(APPEND _CMAKE_TOOL_VARS LINKER MT AR)
+ # look-up for possible usable linker
+ __resolve_linker_path(LINK "link" "${_CMAKE_TOOLCHAIN_LOCATION}" "link Linker")
+ __resolve_linker_path(LLD "lld-link" "${_CMAKE_TOOLCHAIN_LOCATION}" "lld-link Linker")
+
elseif("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" MATCHES "^x(Open)?Watcom$")
set(_CMAKE_LINKER_NAMES "wlink")
set(_CMAKE_AR_NAMES "wlib")
diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake
index 726e2a2..a6bbcc4 100644
--- a/Modules/CMakeFindPackageMode.cmake
+++ b/Modules/CMakeFindPackageMode.cmake
@@ -5,10 +5,9 @@
CMakeFindPackageMode
--------------------
-
-
-This file is executed by cmake when invoked with --find-package. It
-expects that the following variables are set using -D:
+This file is executed by cmake when invoked with
+:ref:`--find-package <Find-Package Tool Mode>`.
+It expects that the following variables are set using ``-D``:
``NAME``
name of the package
diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in
index 89a00ab..90c2ad0 100644
--- a/Modules/CMakeFortranCompiler.cmake.in
+++ b/Modules/CMakeFortranCompiler.cmake.in
@@ -15,6 +15,10 @@ set(CMAKE_AR "@CMAKE_AR@")
set(CMAKE_Fortran_COMPILER_AR "@CMAKE_Fortran_COMPILER_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_Fortran_COMPILER_LINKER "@CMAKE_Fortran_COMPILER_LINKER@")
+set(CMAKE_Fortran_COMPILER_LINKER_ID "@CMAKE_Fortran_COMPILER_LINKER_ID@")
+set(CMAKE_Fortran_COMPILER_LINKER_VERSION @CMAKE_Fortran_COMPILER_LINKER_VERSION@)
+set(CMAKE_Fortran_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_Fortran_COMPILER_LINKER_FRONTEND_VARIANT@)
set(CMAKE_Fortran_COMPILER_RANLIB "@CMAKE_Fortran_COMPILER_RANLIB@")
set(CMAKE_TAPI "@CMAKE_TAPI@")
set(CMAKE_COMPILER_IS_GNUG77 @CMAKE_COMPILER_IS_GNUG77@)
diff --git a/Modules/CMakeHIPCompiler.cmake.in b/Modules/CMakeHIPCompiler.cmake.in
index 6d5e62a..9d70e03 100644
--- a/Modules/CMakeHIPCompiler.cmake.in
+++ b/Modules/CMakeHIPCompiler.cmake.in
@@ -74,5 +74,11 @@ set(CMAKE_HIP_COMPILER_AR "@CMAKE_HIP_COMPILER_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_HIP_COMPILER_RANLIB "@CMAKE_HIP_COMPILER_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@")
+set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@")
+set(CMAKE_HIP_COMPILER_LINKER "@CMAKE_HIP_COMPILER_LINKER@")
+set(CMAKE_HIP_COMPILER_LINKER_ID "@CMAKE_HIP_COMPILER_LINKER_ID@")
+set(CMAKE_HIP_COMPILER_LINKER_VERSION @CMAKE_HIP_COMPILER_LINKER_VERSION@)
+set(CMAKE_HIP_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_HIP_COMPILER_LINKER_FRONTEND_VARIANT@)
set(CMAKE_MT "@CMAKE_MT@")
set(CMAKE_TAPI "@CMAKE_TAPI@")
diff --git a/Modules/CMakeOBJCCompiler.cmake.in b/Modules/CMakeOBJCCompiler.cmake.in
index de73645..a8bb0d2 100644
--- a/Modules/CMakeOBJCCompiler.cmake.in
+++ b/Modules/CMakeOBJCCompiler.cmake.in
@@ -24,6 +24,12 @@ set(CMAKE_OBJC_COMPILER_AR "@CMAKE_OBJC_COMPILER_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_OBJC_COMPILER_RANLIB "@CMAKE_OBJC_COMPILER_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@")
+set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@")
+set(CMAKE_OBJC_COMPILER_LINKER "@CMAKE_OBJC_COMPILER_LINKER@")
+set(CMAKE_OBJC_COMPILER_LINKER_ID "@CMAKE_OBJC_COMPILER_LINKER_ID@")
+set(CMAKE_OBJC_COMPILER_LINKER_VERSION @CMAKE_OBJC_COMPILER_LINKER_VERSION@)
+set(CMAKE_OBJC_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_OBJC_COMPILER_LINKER_FRONTEND_VARIANT@)
set(CMAKE_MT "@CMAKE_MT@")
set(CMAKE_TAPI "@CMAKE_TAPI@")
set(CMAKE_COMPILER_IS_GNUOBJC @CMAKE_COMPILER_IS_GNUOBJC@)
diff --git a/Modules/CMakeOBJCXXCompiler.cmake.in b/Modules/CMakeOBJCXXCompiler.cmake.in
index 94d24ff..d8b6ef0 100644
--- a/Modules/CMakeOBJCXXCompiler.cmake.in
+++ b/Modules/CMakeOBJCXXCompiler.cmake.in
@@ -25,6 +25,12 @@ set(CMAKE_OBJCXX_COMPILER_AR "@CMAKE_OBJCXX_COMPILER_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_OBJCXX_COMPILER_RANLIB "@CMAKE_OBJCXX_COMPILER_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@")
+set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@")
+set(CMAKE_OBJCXX_COMPILER_LINKER "@CMAKE_OBJCXX_COMPILER_LINKER@")
+set(CMAKE_OBJCXX_COMPILER_LINKER_ID "@CMAKE_OBJCXX_COMPILER_LINKER_ID@")
+set(CMAKE_OBJCXX_COMPILER_LINKER_VERSION @CMAKE_OBJCXX_COMPILER_LINKER_VERSION@)
+set(CMAKE_OBJCXX_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_OBJCXX_COMPILER_LINKER_FRONTEND_VARIANT@)
set(CMAKE_MT "@CMAKE_MT@")
set(CMAKE_TAPI "@CMAKE_TAPI@")
set(CMAKE_COMPILER_IS_GNUOBJCXX @CMAKE_COMPILER_IS_GNUOBJCXX@)
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index 581e65c..dabb635 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -190,6 +190,68 @@ Please note that these files are internal to CMake and you should not call
:command:`configure_file()` on them yourself, but they can be used as starting
point to create more sophisticated custom ``ConfigVersion.cmake`` files.
+Generating an Apple Platform Selection File
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. versionadded:: 3.29
+
+.. command:: generate_apple_platform_selection_file
+
+ Create an Apple platform selection file:
+
+ generate_apple_platform_selection_file(<filename>
+ INSTALL_DESTINATION <path>
+ [MACOS_CONFIG_FILE <file>]
+ [IOS_CONFIG_FILE <file>]
+ [IOS_SIMULATOR_CONFIG_FILE <file>]
+ [TVOS_CONFIG_FILE <file>]
+ [TVOS_SIMULATOR_CONFIG_FILE <file>]
+ [WATCHOS_CONFIG_FILE <file>]
+ [WATCHOS_SIMULATOR_CONFIG_FILE <file>]
+ [VISIONOS_CONFIG_FILE <file>]
+ [VISIONOS_SIMULATOR_CONFIG_FILE <file>]
+ )
+
+Writes a file for use as ``<PackageName>Config.cmake`` which can include an
+Apple-platform-specific ``<PackageName>Config.cmake`` from a different
+directory. This can be used in conjunction with the ``XCFRAMEWORK_LOCATION``
+argument of :command:`export(SETUP)` to export packages in a way that a project
+built for any Apple platform can use them.
+
+``INSTALL_DESTINATION <path>``
+ Path that the file will be installed to.
+
+``MACOS_CONFIG_FILE <file>``
+ File to include if the platform is macOS.
+
+``IOS_CONFIG_FILE <file>``
+ File to include if the platform is iOS.
+
+``IOS_SIMULATOR_CONFIG_FILE <file>``
+ File to include if the platform is iOS Simulator.
+
+``TVOS_CONFIG_FILE <file>``
+ File to include if the platform is tvOS.
+
+``TVOS_SIMULATOR_CONFIG_FILE <file>``
+ File to include if the platform is tvOS Simulator.
+
+``WATCHOS_CONFIG_FILE <file>``
+ File to include if the platform is watchOS.
+
+``WATCHOS_SIMULATOR_CONFIG_FILE <file>``
+ File to include if the platform is watchOS Simulator.
+
+``VISIONOS_CONFIG_FILE <file>``
+ File to include if the platform is visionOS.
+
+``VISIONOS_SIMULATOR_CONFIG_FILE <file>``
+ File to include if the platform is visionOS Simulator.
+
+If any of the optional config files are not specified, and the consuming
+project is built for their corresponding platform, an error will be thrown
+when including the generated file.
+
Example Generating Package Files
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -344,3 +406,45 @@ endmacro()
configure_file("${_inputFile}" "${_outputFile}" @ONLY)
endfunction()
+
+function(generate_apple_platform_selection_file _output_file)
+ set(_config_file_options
+ MACOS_CONFIG_FILE
+ IOS_CONFIG_FILE
+ IOS_SIMULATOR_CONFIG_FILE
+ TVOS_CONFIG_FILE
+ TVOS_SIMULATOR_CONFIG_FILE
+ WATCHOS_CONFIG_FILE
+ WATCHOS_SIMULATOR_CONFIG_FILE
+ VISIONOS_CONFIG_FILE
+ VISIONOS_SIMULATOR_CONFIG_FILE
+ )
+
+ set(_options)
+ set(_single
+ INSTALL_DESTINATION
+ ${_config_file_options}
+ )
+ set(_multi)
+ cmake_parse_arguments(PARSE_ARGV 0 _gpsf "${_options}" "${_single}" "${_multi}")
+
+ set(_have_relative 0)
+ foreach(_opt IN LISTS _config_file_options)
+ if(_gpsf_${_opt})
+ set(_config_file "${_gpsf_${_opt}}")
+ if(NOT IS_ABSOLUTE "${_config_file}")
+ string(PREPEND _config_file [[${PACKAGE_PREFIX_DIR}/]])
+ set(_have_relative 1)
+ endif()
+ set(_branch_${_opt} "include(\"${_config_file}\")")
+ else()
+ set(_branch_${_opt} "message(FATAL_ERROR \"Platform not supported\")")
+ endif()
+ endforeach()
+
+ configure_package_config_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/PlatformSelectionFile.cmake.in" "${_output_file}"
+ INSTALL_DESTINATION "${_gpsf_INSTALL_DESTINATION}"
+ NO_SET_AND_CHECK_MACRO
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO
+ )
+endfunction()
diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake
index cbdb915..b48eb43 100644
--- a/Modules/CMakeParseImplicitLinkInfo.cmake
+++ b/Modules/CMakeParseImplicitLinkInfo.cmake
@@ -15,6 +15,26 @@ cmake_policy(SET CMP0054 NEW)
# compatibility don't break.
#
function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj_regex)
+ set(keywordArgs)
+ set(oneValueArgs LANGUAGE COMPUTE_IMPLICIT_OBJECTS)
+ set(multiValueArgs )
+ cmake_parse_arguments(EXTRA_PARSE "${keywordArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ cmake_parse_implicit_link_info2("${text}" "${log_var}" "${obj_regex}"
+ COMPUTE_IMPLICIT_LIBS "${lib_var}" COMPUTE_IMPLICIT_DIRS "${dir_var}"
+ COMPUTE_IMPLICIT_FWKS "${fwk_var}" ${ARGN})
+
+ set(${lib_var} "${${lib_var}}" PARENT_SCOPE)
+ set(${dir_var} "${${dir_var}}" PARENT_SCOPE)
+ set(${fwk_var} "${${fwk_var}}" PARENT_SCOPE)
+ set(${log_var} "${${log_var}}" PARENT_SCOPE)
+
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS)
+ set(${EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS} "${${EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS}}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+function(cmake_parse_implicit_link_info2 text log_var obj_regex)
set(implicit_libs_tmp "")
set(implicit_objs_tmp "")
set(implicit_dirs_tmp)
@@ -22,25 +42,29 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
set(log "")
set(keywordArgs)
- set(oneValueArgs COMPUTE_IMPLICIT_OBJECTS LANGUAGE)
+ set(oneValueArgs LANGUAGE
+ COMPUTE_IMPLICIT_LIBS COMPUTE_IMPLICIT_DIRS COMPUTE_IMPLICIT_FWKS
+ COMPUTE_IMPLICIT_OBJECTS COMPUTE_LINKER)
set(multiValueArgs )
cmake_parse_arguments(EXTRA_PARSE "${keywordArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(is_msvc 0)
if(EXTRA_PARSE_LANGUAGE AND
- ("x${CMAKE_${EXTRA_PARSE_LANGUAGE}_ID}" STREQUAL "xMSVC" OR
+ ("x${CMAKE_${EXTRA_PARSE_LANGUAGE}_COMPILER_ID}" STREQUAL "xMSVC" OR
"x${CMAKE_${EXTRA_PARSE_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC"))
set(is_msvc 1)
endif()
-
# Parse implicit linker arguments.
- set(linker "CMAKE_LINKER-NOTFOUND")
- if(CMAKE_LINKER)
- get_filename_component(linker ${CMAKE_LINKER} NAME)
- string(REGEX REPLACE "([][+.*?()^$])" "\\\\\\1" linker "${linker}")
- endif()
+ set(linker "ld[0-9]*(\\.[a-z]+)?")
if(is_msvc)
- string(APPEND linker "|link\\.exe|lld-link")
+ string(APPEND linker "|link\\.exe|lld-link(\\.exe)?")
+ endif()
+ if(CMAKE_LINKER)
+ get_filename_component(default_linker ${CMAKE_LINKER} NAME)
+ if (NOT default_linker MATCHES "(${linker})")
+ string(REGEX REPLACE "([][+.*?()^$])" "\\\\\\1" default_linker "${default_linker}")
+ list(PREPEND linker "${default_linker}|")
+ endif()
endif()
set(startfile "CMAKE_LINK_STARTFILE-NOTFOUND")
if(CMAKE_LINK_STARTFILE)
@@ -50,9 +74,35 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
# whole line and just the command (argv[0]).
set(linker_regex "^( *|.*[/\\])(${linker}|${startfile}|([^/\\]+-)?ld|collect2)[^/\\]*( |$)")
set(linker_exclude_regex "collect2 version |^[A-Za-z0-9_]+=|/ldfe ")
+ set(linker_tool_regex "^[ \t]*(->|exec:|\")?[ \t]*(.*[/\\](${linker}))(\"|,| |$)")
+ set(linker_tool_exclude_regex "cuda-fake-ld|-fuse-ld=")
+ set(linker_tool "NOTFOUND")
+ set(link_line_parsed 0)
string(APPEND log " link line regex: [${linker_regex}]\n")
+ if(EXTRA_PARSE_COMPUTE_LINKER)
+ string(APPEND log " linker tool regex: [${linker_tool_regex}]\n")
+ endif()
string(REGEX REPLACE "\r?\n" ";" output_lines "${text}")
foreach(line IN LISTS output_lines)
+ if(EXTRA_PARSE_COMPUTE_LINKER AND
+ NOT linker_tool AND NOT "${line}" MATCHES "${linker_tool_exclude_regex}"
+ AND "${line}" MATCHES "${linker_tool_regex}")
+ set(linker_tool "${CMAKE_MATCH_2}")
+ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
+ # pick-up last path
+ string(REGEX REPLACE "^.*([A-Za-z]:[/\\][^:]+)$" "\\1" linker_tool "${linker_tool}")
+ cmake_path(SET linker_tool "${linker_tool}")
+ endif()
+ string(APPEND log " linker tool for '${EXTRA_PARSE_LANGUAGE}': ${linker_tool}\n")
+ endif()
+ if(NOT (EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS OR EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS
+ OR EXTRA_PARSE_COMPUTE_IMPLICIT_FWKS OR EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS))
+ if(linker_tool)
+ break()
+ else()
+ continue()
+ endif()
+ endif()
set(cmd)
if("${line}" MATCHES "${linker_regex}" AND
NOT "${line}" MATCHES "${linker_exclude_regex}")
@@ -86,7 +136,8 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
endif()
endif()
set(search_static 0)
- if("${cmd}" MATCHES "${linker_regex}")
+ if(NOT link_line_parsed AND "${cmd}" MATCHES "${linker_regex}")
+ set(link_line_parsed 1)
string(APPEND log " link line: [${line}]\n")
string(REGEX REPLACE ";-([LYz]);" ";-\\1" args "${args}")
set(skip_value_of "")
@@ -95,60 +146,76 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
string(APPEND log " arg [${arg}] ==> skip value of ${skip_value_of}\n")
set(skip_value_of "")
elseif("${arg}" MATCHES "^-L(.:)?[/\\]")
- # Unix search path.
- string(REGEX REPLACE "^-L" "" dir "${arg}")
- list(APPEND implicit_dirs_tmp ${dir})
- string(APPEND log " arg [${arg}] ==> dir [${dir}]\n")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS)
+ # Unix search path.
+ string(REGEX REPLACE "^-L" "" dir "${arg}")
+ list(APPEND implicit_dirs_tmp ${dir})
+ string(APPEND log " arg [${arg}] ==> dir [${dir}]\n")
+ endif()
elseif("${arg}" MATCHES "^[-/](LIBPATH|libpath):(.+)")
- # MSVC search path.
- set(dir "${CMAKE_MATCH_2}")
- list(APPEND implicit_dirs_tmp ${dir})
- string(APPEND log " arg [${arg}] ==> dir [${dir}]\n")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS)
+ # MSVC search path.
+ set(dir "${CMAKE_MATCH_2}")
+ list(APPEND implicit_dirs_tmp ${dir})
+ string(APPEND log " arg [${arg}] ==> dir [${dir}]\n")
+ endif()
elseif(is_msvc AND "${arg}" STREQUAL "-link")
string(APPEND log " arg [${arg}] ==> ignore MSVC cl option\n")
elseif(is_msvc AND "${arg}" MATCHES "^[-/][Ii][Mm][Pp][Ll][Ii][Bb]:")
string(APPEND log " arg [${arg}] ==> ignore MSVC link option\n")
elseif(is_msvc AND "${arg}" MATCHES "^(.*\\.[Ll][Ii][Bb])$")
- set(lib "${CMAKE_MATCH_1}")
- list(APPEND implicit_libs_tmp ${lib})
- string(APPEND log " arg [${arg}] ==> lib [${lib}]\n")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS)
+ set(lib "${CMAKE_MATCH_1}")
+ list(APPEND implicit_libs_tmp ${lib})
+ string(APPEND log " arg [${arg}] ==> lib [${lib}]\n")
+ endif()
elseif("${arg}" STREQUAL "-lto_library")
# ld argument "-lto_library <path>"
set(skip_value_of "${arg}")
string(APPEND log " arg [${arg}] ==> ignore, skip following value\n")
elseif("${arg}" MATCHES "^-l([^:].*)$")
- # Unix library.
- set(lib "${CMAKE_MATCH_1}")
- if(search_static AND lib MATCHES "^(gfortran|stdc\\+\\+)$")
- # Search for the static library later, once all link dirs are known.
- set(lib "SEARCH_STATIC:${lib}")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS)
+ # Unix library.
+ set(lib "${CMAKE_MATCH_1}")
+ if(search_static AND lib MATCHES "^(gfortran|stdc\\+\\+)$")
+ # Search for the static library later, once all link dirs are known.
+ set(lib "SEARCH_STATIC:${lib}")
+ endif()
+ list(APPEND implicit_libs_tmp ${lib})
+ string(APPEND log " arg [${arg}] ==> lib [${lib}]\n")
endif()
- list(APPEND implicit_libs_tmp ${lib})
- string(APPEND log " arg [${arg}] ==> lib [${lib}]\n")
elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.a$")
- # Unix library full path.
- list(APPEND implicit_libs_tmp ${arg})
- string(APPEND log " arg [${arg}] ==> lib [${arg}]\n")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS)
+ # Unix library full path.
+ list(APPEND implicit_libs_tmp ${arg})
+ string(APPEND log " arg [${arg}] ==> lib [${arg}]\n")
+ endif()
elseif("${arg}" MATCHES "^[-/](DEFAULTLIB|defaultlib):(.+)")
- # Windows library.
- set(lib "${CMAKE_MATCH_2}")
- list(APPEND implicit_libs_tmp ${lib})
- string(APPEND log " arg [${arg}] ==> lib [${lib}]\n")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS)
+ # Windows library.
+ set(lib "${CMAKE_MATCH_2}")
+ list(APPEND implicit_libs_tmp ${lib})
+ string(APPEND log " arg [${arg}] ==> lib [${lib}]\n")
+ endif()
elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.o$")
if(EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS)
list(APPEND implicit_objs_tmp ${arg})
string(APPEND log " arg [${arg}] ==> obj [${arg}]\n")
endif()
- if(obj_regex AND "${arg}" MATCHES "${obj_regex}")
- # Object file full path.
- list(APPEND implicit_libs_tmp ${arg})
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS)
+ if(obj_regex AND "${arg}" MATCHES "${obj_regex}")
+ # Object file full path.
+ list(APPEND implicit_libs_tmp ${arg})
+ endif()
endif()
elseif("${arg}" MATCHES "^-Y(P,)?[^0-9]")
- # Sun search path ([^0-9] avoids conflict with Mac -Y<num>).
- string(REGEX REPLACE "^-Y(P,)?" "" dirs "${arg}")
- string(REPLACE ":" ";" dirs "${dirs}")
- list(APPEND implicit_dirs_tmp ${dirs})
- string(APPEND log " arg [${arg}] ==> dirs [${dirs}]\n")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS)
+ # Sun search path ([^0-9] avoids conflict with Mac -Y<num>).
+ string(REGEX REPLACE "^-Y(P,)?" "" dirs "${arg}")
+ string(REPLACE ":" ";" dirs "${dirs}")
+ list(APPEND implicit_dirs_tmp ${dirs})
+ string(APPEND log " arg [${arg}] ==> dirs [${dirs}]\n")
+ endif()
elseif("${arg}" STREQUAL "-Bstatic")
set(search_static 1)
string(APPEND log " arg [${arg}] ==> search static\n" )
@@ -156,13 +223,17 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
set(search_static 0)
string(APPEND log " arg [${arg}] ==> search dynamic\n" )
elseif("${arg}" MATCHES "^-l:")
- # HP named library.
- list(APPEND implicit_libs_tmp ${arg})
- string(APPEND log " arg [${arg}] ==> lib [${arg}]\n")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS)
+ # HP named library.
+ list(APPEND implicit_libs_tmp ${arg})
+ string(APPEND log " arg [${arg}] ==> lib [${arg}]\n")
+ endif()
elseif("${arg}" MATCHES "^-z(all|default|weak)extract")
- # Link editor option.
- list(APPEND implicit_libs_tmp ${arg})
- string(APPEND log " arg [${arg}] ==> opt [${arg}]\n")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS)
+ # Link editor option.
+ list(APPEND implicit_libs_tmp ${arg})
+ string(APPEND log " arg [${arg}] ==> opt [${arg}]\n")
+ endif()
elseif("${arg}" STREQUAL "cl.exe")
string(APPEND log " arg [${arg}] ==> recognize MSVC cl\n")
set(is_msvc 1)
@@ -170,25 +241,29 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
string(APPEND log " arg [${arg}] ==> ignore\n")
endif()
endforeach()
- break()
elseif("${line}" MATCHES "LPATH(=| is:? *)(.*)$")
- string(APPEND log " LPATH line: [${line}]\n")
- # HP search path.
- string(REPLACE ":" ";" paths "${CMAKE_MATCH_2}")
- list(APPEND implicit_dirs_tmp ${paths})
- string(APPEND log " dirs [${paths}]\n")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS)
+ string(APPEND log " LPATH line: [${line}]\n")
+ # HP search path.
+ string(REPLACE ":" ";" paths "${CMAKE_MATCH_2}")
+ list(APPEND implicit_dirs_tmp ${paths})
+ string(APPEND log " dirs [${paths}]\n")
+ endif()
else()
string(APPEND log " ignore line: [${line}]\n")
endif()
+ if((NOT EXTRA_PARSE_COMPUTE_LINKER OR linker_tool) AND link_line_parsed)
+ break()
+ endif()
endforeach()
# Look for library search paths reported by linker.
- if("${output_lines}" MATCHES ";Library search paths:((;\t[^;]+)+)")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS AND "${output_lines}" MATCHES ";Library search paths:((;\t[^;]+)+)")
string(REPLACE ";\t" ";" implicit_dirs_match "${CMAKE_MATCH_1}")
string(APPEND log " Library search paths: [${implicit_dirs_match}]\n")
list(APPEND implicit_dirs_tmp ${implicit_dirs_match})
endif()
- if("${output_lines}" MATCHES ";Framework search paths:((;\t[^;]+)+)")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_FWKS AND "${output_lines}" MATCHES ";Framework search paths:((;\t[^;]+)+)")
string(REPLACE ";\t" ";" implicit_fwks_match "${CMAKE_MATCH_1}")
string(APPEND log " Framework search paths: [${implicit_fwks_match}]\n")
list(APPEND implicit_fwks_tmp ${implicit_fwks_match})
@@ -273,11 +348,21 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
string(APPEND log " implicit fwks: [${implicit_fwks}]\n")
# Return results.
- set(${lib_var} "${implicit_libs}" PARENT_SCOPE)
- set(${dir_var} "${implicit_dirs}" PARENT_SCOPE)
- set(${fwk_var} "${implicit_fwks}" PARENT_SCOPE)
+ if(EXTRA_PARSE_COMPUTE_LINKER)
+ set(${EXTRA_PARSE_COMPUTE_LINKER} "${linker_tool}" PARENT_SCOPE)
+ endif()
+
set(${log_var} "${log}" PARENT_SCOPE)
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS)
+ set(${EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS} "${implicit_libs}" PARENT_SCOPE)
+ endif()
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS)
+ set(${EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS} "${implicit_dirs}" PARENT_SCOPE)
+ endif()
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_FWKS)
+ set(${EXTRA_PARSE_COMPUTE_IMPLICIT_FWKS} "${implicit_fwks}" PARENT_SCOPE)
+ endif()
if(EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS)
set(${EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS} "${implicit_objs}" PARENT_SCOPE)
endif()
diff --git a/Modules/CheckIPOSupported/main.c b/Modules/CheckIPOSupported/main.c
index 5be0864..8d2ab01 100644
--- a/Modules/CheckIPOSupported/main.c
+++ b/Modules/CheckIPOSupported/main.c
@@ -1,6 +1,6 @@
int foo();
-int main()
+int main(void)
{
return foo();
}
diff --git a/Modules/Compiler/ADSP-ASM.cmake b/Modules/Compiler/ADSP-ASM.cmake
new file mode 100644
index 0000000..9ef5142
--- /dev/null
+++ b/Modules/Compiler/ADSP-ASM.cmake
@@ -0,0 +1,6 @@
+include(Compiler/ADSP)
+__compiler_adsp(ASM)
+
+set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm)
+set(CMAKE_ASM_OUTPUT_EXTENSION ".o" )
+set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>")
diff --git a/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake b/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake
deleted file mode 100644
index 2265e5e..0000000
--- a/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-
-set(_compiler_id_pp_test "defined(__COMO__)")
-
-set(_compiler_id_version_compute "
- /* __COMO_VERSION__ = VRR */
-# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__COMO_VERSION__ / 100)
-# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__COMO_VERSION__ % 100)")
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake
index d01054b..bb367ea 100644
--- a/Modules/Compiler/GNU.cmake
+++ b/Modules/Compiler/GNU.cmake
@@ -74,28 +74,36 @@ macro(__compiler_gnu lang)
if (NOT DEFINED CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED)
## check if this feature is supported by the linker
- execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" -Wl,--help
- OUTPUT_VARIABLE _linker_capabilities
- ERROR_VARIABLE _linker_capabilities)
- if(_linker_capabilities MATCHES "--dependency-file")
- set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED TRUE)
+ if (CMAKE_${lang}_COMPILER_LINKER AND CMAKE_${lang}_COMPILER_LINKER_ID MATCHES "GNU|LLD")
+ execute_process(COMMAND "${CMAKE_${lang}_COMPILER_LINKER}" --help
+ OUTPUT_VARIABLE _linker_capabilities
+ ERROR_VARIABLE _linker_capabilities)
+ if(_linker_capabilities MATCHES "--dependency-file")
+ set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED TRUE)
+ else()
+ set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED FALSE)
+ endif()
+ unset(_linker_capabilities)
else()
set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED FALSE)
endif()
- unset(_linker_capabilities)
endif()
endif()
if (CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED)
set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER TRUE)
else()
- unset(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER)
+ set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER FALSE)
endif()
- # For now, due to GNU binutils ld bug when LTO is enabled (see GNU bug
- # `30568 <https://sourceware.org/bugzilla/show_bug.cgi?id=30568>`_),
- # deactivate this feature.
- if (NOT DEFINED CMAKE_LINK_DEPENDS_USE_LINKER)
- set(CMAKE_LINK_DEPENDS_USE_LINKER FALSE)
+ # Due to GNU binutils ld bug when LTO is enabled (see GNU bug
+ # `30568 <https://sourceware.org/bugzilla/show_bug.cgi?id=30568>`_),
+ # deactivate this feature if the version is less than 2.41.
+ # For now, all known versions of gold linker have also this bug.
+ if (CMAKE_${lang}_COMPILER_LINKER_ID
+ AND (CMAKE_${lang}_COMPILER_LINKER_ID STREQUAL "GNUgold"
+ OR (CMAKE_${lang}_COMPILER_LINKER_ID STREQUAL "GNU"
+ AND CMAKE_${lang}_COMPILER_LINKER_VERSION VERSION_LESS "2.41")))
+ set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER FALSE)
endif()
# Initial configuration flags.
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 3ec0557..b2816a5 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1934,8 +1934,10 @@ function(_ep_get_build_command
set(args)
_ep_get_configure_command_id(${name} cfg_cmd_id)
if(cfg_cmd_id STREQUAL "cmake")
- # CMake project. Select build command based on generator.
- get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR)
+ # Adding a CMake project as an External Project. Select command based on generator
+ get_property(cmake_generator TARGET ${name} PROPERTY _EP_CMAKE_GENERATOR)
+ # cmake_generator is the CMake generator of the ExternalProject target being added
+ # CMAKE_GENERATOR is the CMake generator of the Current Project
if("${CMAKE_GENERATOR}" MATCHES "Make" AND
("${cmake_generator}" MATCHES "Make" OR NOT cmake_generator))
# The project uses the same Makefile generator. Use recursive make.
@@ -1948,6 +1950,11 @@ function(_ep_get_build_command
endif()
else()
# Drive the project with "cmake --build".
+ if(NOT cmake_generator)
+ # If there is no CMake Generator defined on the ExternalProject,
+ # use the same Generator as the current project
+ set(cmake_generator "${CMAKE_GENERATOR}")
+ endif()
get_target_property(cmake_command ${name} _EP_CMAKE_COMMAND)
if(cmake_command)
set(cmd "${cmake_command}")
@@ -1977,7 +1984,11 @@ function(_ep_get_build_command
list(APPEND args --config ${config})
endif()
if(step STREQUAL "INSTALL")
- list(APPEND args --target install)
+ if("${cmake_generator}" MATCHES "Green Hills MULTI")
+ list(APPEND args --target INSTALL)
+ else()
+ list(APPEND args --target install)
+ endif()
endif()
# But for "TEST" drive the project with corresponding "ctest".
if("x${step}x" STREQUAL "xTESTx")
@@ -3767,6 +3778,9 @@ function(_ep_extract_configure_command var name)
list(APPEND cmd "-G${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}")
else()
list(APPEND cmd "-G${CMAKE_GENERATOR}")
+ # GreenHills needs to know about the compiler and toolset.
+ # Be sure to update the similar section in
+ # FetchContent.cmake:__FetchContent_directPopulate()
if("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
set(has_cmake_cache_default_args 1)
list(APPEND cmake_cache_default_args
diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake
index f10684c..8663631 100644
--- a/Modules/FetchContent.cmake
+++ b/Modules/FetchContent.cmake
@@ -195,6 +195,12 @@ Commands
still be called if :variable:`FETCHCONTENT_TRY_FIND_PACKAGE_MODE` is
set to ``OPT_IN`` or is not set.
+ It would not normally be appropriate to specify ``REQUIRED`` as one of
+ the additional arguments after ``FIND_PACKAGE_ARGS``. Doing so would
+ mean the :command:`find_package` call must succeed, so none of the other
+ details specified in the ``FetchContent_Declare()`` call would get a
+ chance to be used as a fall-back.
+
Everything after the ``FIND_PACKAGE_ARGS`` keyword is appended to the
:command:`find_package` call, so all other ``<contentOptions>`` must
come before the ``FIND_PACKAGE_ARGS`` keyword. If the
@@ -373,6 +379,10 @@ Commands
:command:`FetchContent_Declare`, the ``EXCLUDE_FROM_ALL`` keyword will
be added to the :command:`add_subdirectory` command as well.
+ .. versionadded:: 3.29
+ :variable:`CMAKE_EXPORT_FIND_PACKAGE_NAME` is set to the dependency name
+ before calling :command:`add_subdirectory`.
+
Projects should aim to declare the details of all dependencies they might
use before they call ``FetchContent_MakeAvailable()`` for any of them.
This ensures that if any of the dependencies are also sub-dependencies of
@@ -1194,10 +1204,10 @@ function(__FetchContent_declareDetails contentName)
set(propertyName "_FetchContent_${contentNameLower}_find_package_args")
define_property(GLOBAL PROPERTY ${propertyName})
if(NOT __sawQuietKeyword)
- list(INSERT __findPackageArgs 0 QUIET)
+ string(PREPEND __findPackageArgs "QUIET ")
endif()
if(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL AND NOT __sawGlobalKeyword)
- list(APPEND __findPackageArgs GLOBAL)
+ string(APPEND __findPackageArgs " GLOBAL")
endif()
cmake_language(EVAL CODE
"set_property(GLOBAL PROPERTY ${propertyName} ${__findPackageArgs})"
@@ -1596,6 +1606,20 @@ ExternalProject_Add_Step(${contentName}-populate copyfile
list(APPEND subCMakeOpts "-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM}")
endif()
+ # GreenHills needs to know about the compiler and toolset to run the
+ # subbuild commands. Be sure to update the similar section in
+ # ExternalProject.cmake:_ep_extract_configure_command()
+ if(CMAKE_GENERATOR MATCHES "Green Hills MULTI")
+ list(APPEND subCMakeOpts
+ "-DGHS_TARGET_PLATFORM:STRING=${GHS_TARGET_PLATFORM}"
+ "-DGHS_PRIMARY_TARGET:STRING=${GHS_PRIMARY_TARGET}"
+ "-DGHS_TOOLSET_ROOT:STRING=${GHS_TOOLSET_ROOT}"
+ "-DGHS_OS_ROOT:STRING=${GHS_OS_ROOT}"
+ "-DGHS_OS_DIR:STRING=${GHS_OS_DIR}"
+ "-DGHS_BSP_NAME:STRING=${GHS_BSP_NAME}"
+ )
+ endif()
+
# Override the sub-build's configuration types for multi-config generators.
# This ensures we are not affected by any custom setting from the project
# and can always request a known configuration further below.
@@ -1930,6 +1954,10 @@ macro(FetchContent_MakeAvailable)
"Trying FETCHCONTENT_MAKEAVAILABLE_SERIAL dependency provider for "
"${__cmake_contentName}"
)
+
+ list(APPEND __cmake_fcCurrentVarsStack "__fcprefix__${CMAKE_EXPORT_FIND_PACKAGE_NAME}")
+ set(CMAKE_EXPORT_FIND_PACKAGE_NAME "${__cmake_contentName}")
+
# It's still valid if there are no saved details. The project may have
# been written to assume a dependency provider is always set and will
# provide dependencies without having any declared details for them.
@@ -1984,6 +2012,12 @@ macro(FetchContent_MakeAvailable)
unset(__cmake_item)
unset(__cmake_contentDetails)
+ list(POP_BACK __cmake_fcCurrentVarsStack __cmake_original_export_find_package_name)
+ string(SUBSTRING "${__cmake_original_export_find_package_name}"
+ 12 -1 __cmake_original_export_find_package_name
+ )
+ set(CMAKE_EXPORT_FIND_PACKAGE_NAME ${__cmake_original_export_find_package_name})
+
FetchContent_GetProperties(${__cmake_contentName})
if(${__cmake_contentNameLower}_POPULATED)
continue()
@@ -2053,6 +2087,9 @@ macro(FetchContent_MakeAvailable)
endif()
if(EXISTS ${__cmake_srcdir}/CMakeLists.txt)
+ list(APPEND __cmake_fcCurrentVarsStack "__fcprefix__${CMAKE_EXPORT_FIND_PACKAGE_NAME}")
+ set(CMAKE_EXPORT_FIND_PACKAGE_NAME "${__cmake_contentName}")
+
set(__cmake_add_subdirectory_args ${__cmake_srcdir} ${${__cmake_contentNameLower}_BINARY_DIR})
if(__cmake_arg_EXCLUDE_FROM_ALL)
list(APPEND __cmake_add_subdirectory_args EXCLUDE_FROM_ALL)
@@ -2061,6 +2098,12 @@ macro(FetchContent_MakeAvailable)
list(APPEND __cmake_add_subdirectory_args SYSTEM)
endif()
add_subdirectory(${__cmake_add_subdirectory_args})
+
+ list(POP_BACK __cmake_fcCurrentVarsStack __cmake_original_export_find_package_name)
+ string(SUBSTRING "${__cmake_original_export_find_package_name}"
+ 12 -1 __cmake_original_export_find_package_name
+ )
+ set(CMAKE_EXPORT_FIND_PACKAGE_NAME ${__cmake_original_export_find_package_name})
endif()
unset(__cmake_srcdir)
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index 39a1163..e9b118f 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -746,7 +746,11 @@ if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All")
set(_blas_openblas_lib "openblas")
if(_blas_sizeof_integer EQUAL 8)
- string(APPEND _blas_openblas_lib "64")
+ if(MINGW)
+ string(APPEND _blas_openblas_lib "_64")
+ else()
+ string(APPEND _blas_openblas_lib "64")
+ endif()
endif()
if(NOT BLAS_LIBRARIES)
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index 4d3ab5a..e142516 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -487,7 +487,11 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE)
set(_lapack_openblas_lib "openblas")
if(_lapack_sizeof_integer EQUAL 8)
- string(APPEND _lapack_openblas_lib "64")
+ if(MINGW)
+ string(APPEND _lapack_openblas_lib "_64")
+ else()
+ string(APPEND _lapack_openblas_lib "64")
+ endif()
endif()
check_lapack_libraries(
diff --git a/Modules/FindOpenThreads.cmake b/Modules/FindOpenThreads.cmake
index bc45eea..6be3422 100644
--- a/Modules/FindOpenThreads.cmake
+++ b/Modules/FindOpenThreads.cmake
@@ -5,26 +5,32 @@
FindOpenThreads
---------------
-
-
OpenThreads is a C++ based threading library. Its largest userbase
seems to OpenSceneGraph so you might notice I accept OSGDIR as an
-environment path. I consider this part of the Findosg* suite used to
+environment path. I consider this part of the ``Findosg*`` suite used to
find OpenSceneGraph components. Each component is separate and you
must opt in to each module.
-Locate OpenThreads This module defines OPENTHREADS_LIBRARY
-OPENTHREADS_FOUND, if false, do not try to link to OpenThreads
-OPENTHREADS_INCLUDE_DIR, where to find the headers
+This module defines:
+
+``OPENTHREADS_LIBRARY``
+
+``OPENTHREADS_FOUND``
+ if false, do not try to link to OpenThreads
+``OPENTHREADS_INCLUDE_DIR``
+ where to find the headers
+
+``$OPENTHREADS_DIR`` is an environment variable that would correspond to the::
+
+ ./configure --prefix=$OPENTHREADS_DIR
-$OPENTHREADS_DIR is an environment variable that would correspond to
-the ./configure --prefix=$OPENTHREADS_DIR used in building osg.
+used in building osg.
-[CMake 2.8.10]: The CMake variables OPENTHREADS_DIR or OSG_DIR can now
-be used as well to influence detection, instead of needing to specify
-an environment variable.
+.. versionadded:: 2.8.10
-Created by Eric Wing.
+ The CMake variables ``OPENTHREADS_DIR`` or ``OSG_DIR`` can now
+ be used as well to influence detection, instead of needing to specify
+ an environment variable.
#]=======================================================================]
# Header files are presumed to be included like
diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake
index 78fa481..b42a85e 100644
--- a/Modules/FindwxWidgets.cmake
+++ b/Modules/FindwxWidgets.cmake
@@ -37,7 +37,7 @@ select a configuration):
wxWidgets_EXCLUDE_COMMON_LIBRARIES
- Set to TRUE to exclude linking of
commonly required libs (e.g., png tiff
- jpeg zlib regex expat).
+ jpeg zlib regex expat scintilla lexilla).
@@ -188,6 +188,9 @@ macro(DBG_MSG_V _MSG)
# "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}")
endmacro()
+cmake_policy(PUSH)
+cmake_policy(SET CMP0057 NEW) # if IN_LIST
+
# Clear return values in case the module is loaded more than once.
set(wxWidgets_FOUND FALSE)
set(wxWidgets_INCLUDE_DIRS "")
@@ -244,8 +247,14 @@ macro(wx_extract_version)
"\\2" wxWidgets_VERSION_MINOR "${_wx_version_h}" )
string(REGEX REPLACE "^(.*\n)?#define +wxRELEASE_NUMBER +([0-9]+).*"
"\\2" wxWidgets_VERSION_PATCH "${_wx_version_h}" )
+ string(REGEX REPLACE "^(.*\n)?#define +wxSUBRELEASE_NUMBER +([0-9]+).*"
+ "\\2" wxWidgets_VERSION_TWEAK "${_wx_version_h}" )
+
set(wxWidgets_VERSION_STRING
"${wxWidgets_VERSION_MAJOR}.${wxWidgets_VERSION_MINOR}.${wxWidgets_VERSION_PATCH}" )
+ if(${wxWidgets_VERSION_TWEAK} GREATER 0)
+ string(APPEND wxWidgets_VERSION_STRING ".${wxWidgets_VERSION_TWEAK}")
+ endif()
dbg_msg("wxWidgets_VERSION_STRING: ${wxWidgets_VERSION_STRING}")
endmacro()
@@ -265,6 +274,9 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# Useful common wx libs needed by almost all components.
set(wxWidgets_COMMON_LIBRARIES png tiff jpeg zlib regex expat)
+ # Libraries needed by stc component
+ set(wxWidgets_STC_LIBRARIES scintilla lexilla)
+
# DEPRECATED: Use find_package(wxWidgets COMPONENTS mono) instead.
if(NOT wxWidgets_FIND_COMPONENTS)
if(wxWidgets_USE_MONOLITHIC)
@@ -277,10 +289,15 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# Add the common (usually required libs) unless
# wxWidgets_EXCLUDE_COMMON_LIBRARIES has been set.
if(NOT wxWidgets_EXCLUDE_COMMON_LIBRARIES)
- list(APPEND wxWidgets_FIND_COMPONENTS
- ${wxWidgets_COMMON_LIBRARIES})
+ if(stc IN_LIST wxWidgets_FIND_COMPONENTS)
+ list(APPEND wxWidgets_FIND_COMPONENTS ${wxWidgets_STC_LIBRARIES})
+ endif()
+ list(APPEND wxWidgets_FIND_COMPONENTS ${wxWidgets_COMMON_LIBRARIES})
endif()
+ # Remove duplicates, for example when user has specified common libraries.
+ list(REMOVE_DUPLICATES wxWidgets_FIND_COMPONENTS)
+
#-------------------------------------------------------------------
# WIN32: Helper MACROS
#-------------------------------------------------------------------
@@ -312,7 +329,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# FIXME: What if both regex libs are available. regex should be
# found outside the loop and only wx${LIB}${_UCD}${_DBG}.
# Find wxWidgets common libraries.
- foreach(LIB ${wxWidgets_COMMON_LIBRARIES} scintilla)
+ foreach(LIB ${wxWidgets_COMMON_LIBRARIES} ${wxWidgets_STC_LIBRARIES})
find_library(WX_${LIB}${_DBG}
NAMES
wx${LIB}${_UCD}${_DBG} # for regex
@@ -371,7 +388,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# Clear all debug or release library paths (arguments are "d" or "").
macro(WX_CLEAR_ALL_LIBS _DBG)
# Clear wxWidgets common libraries.
- foreach(LIB ${wxWidgets_COMMON_LIBRARIES} scintilla)
+ foreach(LIB ${wxWidgets_COMMON_LIBRARIES} ${wxWidgets_STC_LIBRARIES})
WX_CLEAR_LIB(WX_${LIB}${_DBG})
endforeach()
@@ -441,12 +458,15 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
endif()
DBG_MSG_V("OpenGL")
- list(FIND ${_LIBS} gl WX_USE_GL)
- if(NOT WX_USE_GL EQUAL -1)
+ if(gl IN_LIST ${_LIBS})
DBG_MSG_V("- is required.")
list(APPEND wxWidgets_LIBRARIES opengl32 glu32)
endif()
+ if(stc IN_LIST ${_LIBS})
+ list(APPEND wxWidgets_LIBRARIES imm32)
+ endif()
+
list(APPEND wxWidgets_LIBRARIES winmm comctl32 uuid oleacc uxtheme rpcrt4 shlwapi version wsock32)
endmacro()
@@ -458,6 +478,9 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
foreach(version ${wx_versions})
foreach(patch RANGE 15 0 -1)
list(APPEND wx_paths "wxWidgets-${version}.${patch}")
+ foreach(tweak RANGE 3 1 -1)
+ list(APPEND wx_paths "wxWidgets-${version}.${patch}.${tweak}")
+ endforeach()
endforeach()
endforeach()
@@ -937,35 +960,38 @@ if(wxWidgets_FIND_STYLE STREQUAL "unix")
endif()
unset(_cygpath_exe CACHE)
endif()
-endif()
-# Check that all libraries are present, as wx-config does not check it
-set(_wx_lib_missing "")
-foreach(_wx_lib_ ${wxWidgets_LIBRARIES})
- if("${_wx_lib_}" MATCHES "^-l(.*)")
- set(_wx_lib_name "${CMAKE_MATCH_1}")
- unset(_wx_lib_found CACHE)
- find_library(_wx_lib_found NAMES ${_wx_lib_name} HINTS ${wxWidgets_LIBRARY_DIRS})
- if(_wx_lib_found STREQUAL _wx_lib_found-NOTFOUND)
- list(APPEND _wx_lib_missing ${_wx_lib_name})
- endif()
- unset(_wx_lib_found CACHE)
- endif()
-endforeach()
+ # Check that all libraries are present, as wx-config does not check it
+ set(_wx_lib_missing "")
+ foreach(_wx_lib_ ${wxWidgets_LIBRARIES})
+ if("${_wx_lib_}" MATCHES "^-l(.*)")
+ set(_wx_lib_name "${CMAKE_MATCH_1}")
+ unset(_wx_lib_found CACHE)
+ find_library(_wx_lib_found NAMES ${_wx_lib_name} HINTS ${wxWidgets_LIBRARY_DIRS})
+ if(_wx_lib_found STREQUAL _wx_lib_found-NOTFOUND)
+ list(APPEND _wx_lib_missing ${_wx_lib_name})
+ endif()
+ unset(_wx_lib_found CACHE)
+ endif()
+ endforeach()
-if (_wx_lib_missing)
- string(REPLACE ";" " " _wx_lib_missing "${_wx_lib_missing}")
- DBG_MSG_V("wxWidgets not found due to following missing libraries: ${_wx_lib_missing}")
- set(wxWidgets_FOUND FALSE)
- unset(wxWidgets_LIBRARIES)
+ if (_wx_lib_missing)
+ string(REPLACE ";" " " _wx_lib_missing "${_wx_lib_missing}")
+ DBG_MSG_V("wxWidgets not found due to following missing libraries: ${_wx_lib_missing}")
+ set(wxWidgets_FOUND FALSE)
+ unset(wxWidgets_LIBRARIES)
+ endif()
+ unset(_wx_lib_missing)
endif()
-unset(_wx_lib_missing)
# Check if a specific version was requested by find_package().
if(wxWidgets_FOUND)
wx_extract_version()
endif()
+file(TO_CMAKE_PATH "${wxWidgets_INCLUDE_DIRS}" wxWidgets_INCLUDE_DIRS)
+file(TO_CMAKE_PATH "${wxWidgets_LIBRARY_DIRS}" wxWidgets_LIBRARY_DIRS)
+
# Debug output:
DBG_MSG("wxWidgets_FOUND : ${wxWidgets_FOUND}")
DBG_MSG("wxWidgets_INCLUDE_DIRS : ${wxWidgets_INCLUDE_DIRS}")
@@ -1215,3 +1241,5 @@ function(WXWIDGETS_ADD_RESOURCES _outfiles)
set(${_outfiles} ${${_outfiles}} PARENT_SCOPE)
endfunction()
+
+cmake_policy(POP)
diff --git a/Modules/Internal/CMakeDetermineLinkerId.cmake b/Modules/Internal/CMakeDetermineLinkerId.cmake
new file mode 100644
index 0000000..ab851d7
--- /dev/null
+++ b/Modules/Internal/CMakeDetermineLinkerId.cmake
@@ -0,0 +1,92 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+# Function to identify the linker. This is used internally by CMake and should
+# not be included by user code.
+# If successful, sets CMAKE_<lang>_COMPILER_LINKER_ID and
+# CMAKE_<lang>_COMPILER_LINKER_VERSION
+
+cmake_policy(PUSH)
+cmake_policy(SET CMP0053 NEW)
+cmake_policy(SET CMP0054 NEW)
+
+function(cmake_determine_linker_id lang linker)
+ if (NOT linker)
+ # linker was not identified
+ unset(CMAKE_${lang}_COMPILER_LINKER_ID PARENT_SCOPE)
+ unset(CMAKE_${lang}_COMPILER_LINKER_VERSION PARENT_SCOPE)
+ unset(CMAKE_${lang}_COMPILER_LINKER_FRONTEND_VARIANT PARENT_SCOPE)
+ return()
+ endif()
+
+ if (CMAKE_SYSTEM_NAME STREQUAL "Windows" OR linker MATCHES "lld$")
+ set(flags "--version")
+ else()
+ set(flags "-v")
+ endif()
+ execute_process(COMMAND "${linker}" ${flags}
+ OUTPUT_VARIABLE linker_desc
+ ERROR_VARIABLE linker_desc
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_STRIP_TRAILING_WHITESPACE)
+
+ set(linker_frontend)
+ set(linker_version)
+
+ # Compute the linker ID
+ if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND linker_desc MATCHES "@\\(#\\)PROGRAM:ld")
+ set(linker_id "AppleClang")
+ set(linker_frontend "GNU")
+ elseif (linker_desc MATCHES "mold \\(sold\\)")
+ set(linker_id "MOLD")
+ set(linker_frontend "GNU")
+ elseif (linker_desc MATCHES "mold")
+ set(linker_id "MOLD")
+ set(linker_frontend "GNU")
+ elseif (linker_desc MATCHES "LLD")
+ set(linker_id "LLD")
+ set(linker_frontend "GNU")
+ if (WIN32 AND NOT linker_desc MATCHES "compatible with GNU")
+ set (linker_frontend "MSVC")
+ endif()
+ elseif (linker_desc MATCHES "GNU ld")
+ set(linker_id "GNU")
+ set(linker_frontend "GNU")
+ elseif (linker_desc MATCHES "GNU gold")
+ set(linker_id "GNUgold")
+ set(linker_frontend "GNU")
+ elseif (linker_desc MATCHES "Microsoft \\(R\\) Incremental Linker")
+ set(linker_id "MSVC")
+ set(linker_frontend "MSVC")
+ else()
+ # unknown linker
+ set(linker_id "UNKNOWN")
+ endif()
+
+ # Get linker version
+ if (linker_id STREQUAL "AppleClang")
+ string(REGEX REPLACE ".+PROJECT:[a-z0-9]+-([0-9.]+).+" "\\1" linker_version "${linker_desc}")
+ elseif (linker_id MATCHES "MOLD|SOLD")
+ string(REGEX REPLACE "^mold (\\(sold\\) )?([0-9.]+).+" "\\2" linker_version "${linker_desc}")
+ elseif (linker_id STREQUAL "LLD")
+ string(REGEX REPLACE ".*LLD ([0-9.]+).*" "\\1" linker_version "${linker_desc}")
+ elseif (linker_id MATCHES "(GNU|GOLD)")
+ string(REGEX REPLACE "^GNU [^ ]+ \\([^)]+\\) ([0-9.]+).*" "\\1" linker_version "${linker_desc}")
+ elseif (linker_id STREQUAL "MSVC")
+ string(REGEX REPLACE ".+Linker Version ([0-9.]+).+" "\\1" linker_version "${linker_desc}")
+ endif()
+
+ set(CMAKE_${lang}_COMPILER_LINKER_ID "${linker_id}" PARENT_SCOPE)
+ if (linker_frontend)
+ set(CMAKE_${lang}_COMPILER_LINKER_FRONTEND_VARIANT "${linker_frontend}" PARENT_SCOPE)
+ else()
+ unset(CMAKE_${lang}_COMPILER_LINKER_FRONTEND_VARIANT PARENT_SCOPE)
+ endif()
+ if (linker_version)
+ set(CMAKE_${lang}_COMPILER_LINKER_VERSION "${linker_version}" PARENT_SCOPE)
+ else()
+ unset(CMAKE_${lang}_COMPILER_LINKER_VERSION PARENT_SCOPE)
+ endif()
+endfunction()
+
+cmake_policy(POP)
diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake
index a9aa8e0..106eaec 100644
--- a/Modules/Platform/AIX-GNU.cmake
+++ b/Modules/Platform/AIX-GNU.cmake
@@ -16,6 +16,8 @@ macro(__aix_compiler_gnu lang)
set(CMAKE_${lang}_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH 1)
set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath")
+ set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE UNICITY=ALL)
+
if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 7 OR CMAKE_SYSTEM_VERSION VERSION_LESS 7.1)
unset(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY)
endif()
diff --git a/Modules/Platform/AIX-XL.cmake b/Modules/Platform/AIX-XL.cmake
index 902cbb3..c225de9 100644
--- a/Modules/Platform/AIX-XL.cmake
+++ b/Modules/Platform/AIX-XL.cmake
@@ -17,6 +17,7 @@ macro(__aix_compiler_xl lang)
set(CMAKE_SHARED_MODULE_${lang}_FLAGS " ")
set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath")
+ set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE UNICITY=ALL)
set(_OBJECTS " <OBJECTS>")
if(DEFINED CMAKE_XL_CreateExportList AND CMAKE_XL_CreateExportList STREQUAL "")
diff --git a/Modules/Platform/Apple-Clang.cmake b/Modules/Platform/Apple-Clang.cmake
index 57b3910..7986a37 100644
--- a/Modules/Platform/Apple-Clang.cmake
+++ b/Modules/Platform/Apple-Clang.cmake
@@ -15,9 +15,18 @@ macro(__apple_compiler_clang lang)
set(CMAKE_${lang}_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ")
endif()
+ set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE UNICITY=ALL)
+
set(CMAKE_${lang}_LINK_LIBRARY_USING_FRAMEWORK "-framework <LIBRARY>")
set(CMAKE_${lang}_LINK_LIBRARY_USING_FRAMEWORK_SUPPORTED TRUE)
+ # linker selection
+ set(CMAKE_${lang}_USING_LINKER_SYSTEM "-fuse-ld=ld")
+ set(CMAKE_${lang}_USING_LINKER_APPLE_CLASSIC "-fuse-ld=ld" "LINKER:-ld_classic")
+ set(CMAKE_${lang}_USING_LINKER_LLD "-fuse-ld=lld")
+ set(CMAKE_${lang}_USING_LINKER_MOLD "-fuse-ld=mold")
+ set(CMAKE_${lang}_USING_LINKER_SOLD "-fuse-ld=sold")
+
if(_CMAKE_OSX_SYSROOT_PATH MATCHES "/iPhoneOS")
set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-miphoneos-version-min=")
elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/iPhoneSimulator")
diff --git a/Modules/Platform/Apple-GNU.cmake b/Modules/Platform/Apple-GNU.cmake
index 823c790..15f6a71 100644
--- a/Modules/Platform/Apple-GNU.cmake
+++ b/Modules/Platform/Apple-GNU.cmake
@@ -17,6 +17,9 @@ macro(__apple_compiler_gnu lang)
set(CMAKE_${lang}_LINK_LIBRARY_USING_FRAMEWORK "-framework <LIBRARY>")
set(CMAKE_${lang}_LINK_LIBRARY_USING_FRAMEWORK_SUPPORTED TRUE)
+
+ set(CMAKE_${lang}_USING_LINKER_SYSTEM "")
+ set(CMAKE_${lang}_USING_LINKER_APPLE_CLASSIC "LINKER:-ld_classic")
endmacro()
macro(cmake_gnu_set_sysroot_flag lang)
diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake
index ef64012..070b24d 100644
--- a/Modules/Platform/CYGWIN-GNU.cmake
+++ b/Modules/Platform/CYGWIN-GNU.cmake
@@ -52,6 +52,8 @@ macro(__cygwin_compiler_gnu lang)
"<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>")
set(CMAKE_${lang}_CREATE_WIN32_EXE "-mwindows")
+ set(CMAKE_${lang}_VERBOSE_LINK_FLAG "-Wl,-v")
+
# No -fPIC on cygwin
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "")
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index d614182..533b9ce 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -125,17 +125,17 @@ set(CMAKE_LINK_LIBRARY_USING_WEAK_FRAMEWORK "LINKER:-weak_framework,<LIBRARY>")
set(CMAKE_LINK_LIBRARY_USING_WEAK_FRAMEWORK_SUPPORTED TRUE)
# Defines LINK_LIBRARY features for libraries
-set(CMAKE_LINK_LIBRARY_USING_NEEDED_LIBRARY "PATH{LINKER:-needed_library <LIBRARY>}NAME{LINKER:-needed-l<LIBRARY>}")
+set(CMAKE_LINK_LIBRARY_USING_NEEDED_LIBRARY "PATH{LINKER:-needed_library,<LIBRARY>}NAME{LINKER:-needed-l<LIBRARY>}")
set(CMAKE_LINK_LIBRARY_USING_NEEDED_LIBRARY_SUPPORTED TRUE)
-set(CMAKE_LINK_LIBRARY_USING_REEXPORT_LIBRARY "PATH{LINKER:-reexport_library <LIBRARY>}NAME{LINKER:-reexport-l<LIBRARY>}")
+set(CMAKE_LINK_LIBRARY_USING_REEXPORT_LIBRARY "PATH{LINKER:-reexport_library,<LIBRARY>}NAME{LINKER:-reexport-l<LIBRARY>}")
set(CMAKE_LINK_LIBRARY_USING_REEXPORT_LIBRARY_SUPPORTED TRUE)
-set(CMAKE_LINK_LIBRARY_USING_WEAK_LIBRARY "PATH{LINKER:-weak_library <LIBRARY>}NAME{LINKER:-weak-l<LIBRARY>}")
+set(CMAKE_LINK_LIBRARY_USING_WEAK_LIBRARY "PATH{LINKER:-weak_library,<LIBRARY>}NAME{LINKER:-weak-l<LIBRARY>}")
set(CMAKE_LINK_LIBRARY_USING_WEAK_LIBRARY_SUPPORTED TRUE)
# Defines LINK_LIBRARY feature to Force loading of all members of an archive
-set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:-force_load <LIB_ITEM>")
+set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:-force_load,<LIB_ITEM>")
set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE)
# default to searching for frameworks first
diff --git a/Modules/Platform/Linux-Clang-CUDA.cmake b/Modules/Platform/Linux-Clang-CUDA.cmake
new file mode 100644
index 0000000..4a9337e
--- /dev/null
+++ b/Modules/Platform/Linux-Clang-CUDA.cmake
@@ -0,0 +1,2 @@
+include(Platform/Linux-GNU)
+__linux_compiler_gnu(CUDA)
diff --git a/Modules/Platform/Linux-GNU.cmake b/Modules/Platform/Linux-GNU.cmake
index 6878254..c3878eb 100644
--- a/Modules/Platform/Linux-GNU.cmake
+++ b/Modules/Platform/Linux-GNU.cmake
@@ -12,4 +12,13 @@ macro(__linux_compiler_gnu lang)
# We pass this for historical reasons. Projects may have
# executables that use dlopen but do not set ENABLE_EXPORTS.
set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-rdynamic")
+
+ set(CMAKE_${lang}_VERBOSE_LINK_FLAG "-Wl,-v")
+
+ # linker selection
+ set(CMAKE_${lang}_USING_LINKER_SYSTEM "")
+ set(CMAKE_${lang}_USING_LINKER_LLD "-fuse-ld=lld")
+ set(CMAKE_${lang}_USING_LINKER_BFD "-fuse-ld=bfd")
+ set(CMAKE_${lang}_USING_LINKER_GOLD "-fuse-ld=gold")
+ set(CMAKE_${lang}_USING_LINKER_MOLD "-fuse-ld=mold")
endmacro()
diff --git a/Modules/Platform/Linux-NVIDIA-CUDA.cmake b/Modules/Platform/Linux-NVIDIA-CUDA.cmake
new file mode 100644
index 0000000..f383720
--- /dev/null
+++ b/Modules/Platform/Linux-NVIDIA-CUDA.cmake
@@ -0,0 +1,9 @@
+
+set(CMAKE_CUDA_VERBOSE_LINK_FLAG "-Wl,-v")
+
+# linker selection
+set(CMAKE_CUDA_USING_LINKER_SYSTEM "")
+set(CMAKE_CUDA_USING_LINKER_LLD "-fuse-ld=lld")
+set(CMAKE_CUDA_USING_LINKER_BFD "-fuse-ld=bfd")
+set(CMAKE_CUDA_USING_LINKER_GOLD "-fuse-ld=gold")
+set(CMAKE_CUDA_USING_LINKER_MOLD "-fuse-ld=mold")
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake
index 33d271d..f081f42 100644
--- a/Modules/Platform/Windows-Clang.cmake
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -45,6 +45,7 @@ macro(__windows_compiler_clang_gnu lang)
math(EXPR MSVC_VERSION "${CMAKE_MATCH_1}*100 + ${CMAKE_MATCH_2}")
endif()
+ set(CMAKE_${lang}_VERBOSE_LINK_FLAG "-v")
# No -fPIC on Windows
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "")
@@ -53,6 +54,14 @@ macro(__windows_compiler_clang_gnu lang)
set(CMAKE_${lang}_LINK_OPTIONS_NO_PIE "")
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "")
+ set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=FORWARD UNICITY=ALL)
+
+ # linker selection
+ set(CMAKE_${lang}_USING_LINKER_DEFAULT "-fuse-ld=lld-link")
+ set(CMAKE_${lang}_USING_LINKER_SYSTEM "-fuse-ld=link")
+ set(CMAKE_${lang}_USING_LINKER_LLD "-fuse-ld=lld-link")
+ set(CMAKE_${lang}_USING_LINKER_MSVC "-fuse-ld=link")
+
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1)
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES 1)
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1)
@@ -74,10 +83,10 @@ macro(__windows_compiler_clang_gnu lang)
set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
- "<CMAKE_${lang}_COMPILER> -fuse-ld=lld-link -nostartfiles -nostdlib <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} -Xlinker /MANIFEST:EMBED -Xlinker /implib:<TARGET_IMPLIB> -Xlinker /pdb:<TARGET_PDB> -Xlinker /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <OBJECTS> <LINK_LIBRARIES> <MANIFESTS>")
+ "<CMAKE_${lang}_COMPILER> -nostartfiles -nostdlib <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} -Xlinker /MANIFEST:EMBED -Xlinker /implib:<TARGET_IMPLIB> -Xlinker /pdb:<TARGET_PDB> -Xlinker /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <OBJECTS> <LINK_LIBRARIES> <MANIFESTS>")
set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY})
set(CMAKE_${lang}_LINK_EXECUTABLE
- "<CMAKE_${lang}_COMPILER> -fuse-ld=lld-link -nostartfiles -nostdlib <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Xlinker /MANIFEST:EMBED -Xlinker /implib:<TARGET_IMPLIB> -Xlinker /pdb:<TARGET_PDB> -Xlinker /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES> <MANIFESTS>")
+ "<CMAKE_${lang}_COMPILER> -nostartfiles -nostdlib <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Xlinker /MANIFEST:EMBED -Xlinker /implib:<TARGET_IMPLIB> -Xlinker /pdb:<TARGET_PDB> -Xlinker /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES> <MANIFESTS>")
set(CMAKE_${lang}_CREATE_WIN32_EXE "-Xlinker /subsystem:windows")
set(CMAKE_${lang}_CREATE_CONSOLE_EXE "-Xlinker /subsystem:console")
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index 412af6b..9f81882 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -112,6 +112,13 @@ macro(__windows_compiler_gnu lang)
set(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic")
endforeach()
+ set(CMAKE_${lang}_VERBOSE_LINK_FLAG "-Wl,-v")
+
+ # linker selection
+ set(CMAKE_${lang}_USING_LINKER_SYSTEM "")
+ set(CMAKE_${lang}_USING_LINKER_BFD "-fuse-ld=bfd")
+ set(CMAKE_${lang}_USING_LINKER_LLD "-fuse-ld=lld")
+
# No -fPIC on Windows
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "")
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 829ab9b..48e7c4e 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -512,6 +512,14 @@ macro(__windows_compiler_msvc lang)
set(CMAKE_DEPFILE_FLAGS_${lang} "/showIncludes")
set(CMAKE_${lang}_DEPFILE_FORMAT msvc)
endif()
+
+ set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=FORWARD UNICITY=ALL)
+
+ # linker selection
+ set(CMAKE_${lang}_USING_LINKER_SYSTEM "${CMAKE_LINKER_LINK}")
+ set(CMAKE_${lang}_USING_LINKER_LLD "${CMAKE_LINKER_LLD}")
+ set(CMAKE_${lang}_USING_LINKER_MSVC "${CMAKE_LINKER_LINK}")
+ set(CMAKE_${lang}_USING_LINKER_MODE TOOL)
endmacro()
macro(__windows_compiler_msvc_enable_rc flags)
diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
index 326e715..6489841 100644
--- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake
+++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
@@ -47,6 +47,12 @@ set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICIT_DLINK_FLAGS}")
unset(__IMPLICIT_DLINK_FLAGS)
+# linker selection
+set(CMAKE_CUDA_USING_LINKER_SYSTEM "${CMAKE_LINKER_LINK}")
+set(CMAKE_CUDA_USING_LINKER_LLD "${CMAKE_LINKER_LLD}")
+set(CMAKE_CUDA_USING_LINKER_MSVC "${CMAKE_LINKER_LINK}")
+set(CMAKE_CUDA_USING_LINKER_MODE TOOL)
+
string(REPLACE "/D" "-D" _PLATFORM_DEFINES_CUDA "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_CXX}")
if(CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT)
diff --git a/Modules/PlatformSelectionFile.cmake.in b/Modules/PlatformSelectionFile.cmake.in
new file mode 100644
index 0000000..3f80f4b
--- /dev/null
+++ b/Modules/PlatformSelectionFile.cmake.in
@@ -0,0 +1,24 @@
+@PACKAGE_INIT@
+
+string(TOLOWER "${CMAKE_OSX_SYSROOT}" _CMAKE_OSX_SYSROOT_LOWER)
+if(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)iphonesimulator")
+ @_branch_IOS_SIMULATOR_CONFIG_FILE@
+elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)iphoneos")
+ @_branch_IOS_CONFIG_FILE@
+elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)tvsimulator")
+ @_branch_TVOS_SIMULATOR_CONFIG_FILE@
+elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)tvos")
+ @_branch_TVOS_CONFIG_FILE@
+elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)watchsimulator")
+ @_branch_WATCHOS_SIMULATOR_CONFIG_FILE@
+elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)watchos")
+ @_branch_WATCHOS_CONFIG_FILE@
+elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)xrsimulator")
+ @_branch_VISIONOS_SIMULATOR_CONFIG_FILE@
+elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)xros")
+ @_branch_VISIONOS_CONFIG_FILE@
+elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ @_branch_MACOS_CONFIG_FILE@
+else()
+ message(FATAL_ERROR "Platform not supported")
+endif()
diff --git a/Modules/UseEcos.cmake b/Modules/UseEcos.cmake
index 83c9b20..5e6f606 100644
--- a/Modules/UseEcos.cmake
+++ b/Modules/UseEcos.cmake
@@ -8,21 +8,31 @@ UseEcos
This module defines variables and macros required to build eCos application.
This file contains the following macros:
-ECOS_ADD_INCLUDE_DIRECTORIES() - add the eCos include dirs
-ECOS_ADD_EXECUTABLE(name source1 ... sourceN ) - create an eCos
-executable ECOS_ADJUST_DIRECTORY(VAR source1 ... sourceN ) - adjusts
-the path of the source files and puts the result into VAR
-
-Macros for selecting the toolchain: ECOS_USE_ARM_ELF_TOOLS() - enable
-the ARM ELF toolchain for the directory where it is called
-ECOS_USE_I386_ELF_TOOLS() - enable the i386 ELF toolchain for the
-directory where it is called ECOS_USE_PPC_EABI_TOOLS() - enable the
-PowerPC toolchain for the directory where it is called
-
-It contains the following variables: ECOS_DEFINITIONS
-ECOSCONFIG_EXECUTABLE ECOS_CONFIG_FILE - defaults to ecos.ecc, if your
-eCos configuration file has a different name, adjust this variable for
-internal use only:
+
+``ECOS_ADD_INCLUDE_DIRECTORIES()``
+ add the eCos include dirs
+``ECOS_ADD_EXECUTABLE(name source1 ... sourceN )``
+ create an eCos executable
+``ECOS_ADJUST_DIRECTORY(VAR source1 ... sourceN )``
+ adjusts the path of the source files and puts the result into ``VAR``
+
+Macros for selecting the toolchain:
+
+``ECOS_USE_ARM_ELF_TOOLS()``
+ enable the ARM ELF toolchain for the directory where it is called
+``ECOS_USE_I386_ELF_TOOLS()``
+ enable the i386 ELF toolchain for the directory where it is called
+``ECOS_USE_PPC_EABI_TOOLS()``
+ enable the PowerPC toolchain for the directory where it is called
+
+It contains the following variables:
+
+``ECOS_DEFINITIONS``
+
+``ECOSCONFIG_EXECUTABLE``
+
+``ECOS_CONFIG_FILE``
+ defaults to ecos.ecc, if your eCos configuration file has a different name, adjust this variable for internal use only:
::
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index cece973..f264fb6 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -657,7 +657,7 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
if(NOT ("-dllimport" IN_LIST swig_source_file_flags OR "-dllimport" IN_LIST SWIG_MODULE_${name}_EXTRA_FLAGS))
# This makes sure that the name used in the generated DllImport
# matches the library name created by CMake
- list (APPEND SWIG_MODULE_${name}_EXTRA_FLAGS "-dllimport" "$<TARGET_FILE_PREFIX:${target_name}>$<TARGET_FILE_BASE_NAME:${target_name}>")
+ list (APPEND SWIG_MODULE_${name}_EXTRA_FLAGS "-dllimport" "$<TARGET_FILE_BASE_NAME:${target_name}>")
endif()
endif()
if (SWIG_MODULE_${name}_LANGUAGE STREQUAL "PYTHON" AND NOT SWIG_MODULE_${name}_NOPROXY)
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 1bc855e..13eade3 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -558,6 +558,8 @@ add_library(
cmFindLibraryCommand.h
cmFindPackageCommand.cxx
cmFindPackageCommand.h
+ cmFindPackageStack.cxx
+ cmFindPackageStack.h
cmFindPathCommand.cxx
cmFindPathCommand.h
cmFindProgramCommand.cxx
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 0fd54c6..aa65ea7 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,8 +1,8 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 28)
-set(CMake_VERSION_PATCH 0)
-set(CMake_VERSION_RC 5)
+set(CMake_VERSION_PATCH 20231117)
+#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
# Start with the full version number used in tags. It has no dev info.
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index c9c069c..b7b6785 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -5,6 +5,8 @@
#include <cstring>
#include <map>
#include <ostream>
+#include <unordered_map>
+#include <unordered_set>
#include <utility>
#include <vector>
@@ -17,6 +19,121 @@
#include "cmValue.h"
#include "cmWorkingDirectory.h"
+enum class DeduplicateStatus
+{
+ Skip,
+ Add,
+ Error
+};
+
+/**
+ * @class cmCPackArchiveGenerator::Deduplicator
+ * @brief A utility class for deduplicating files, folders, and symlinks.
+ *
+ * This class is responsible for identifying duplicate files, folders, and
+ * symlinks when generating an archive. It keeps track of the paths that have
+ * been processed and helps in deciding whether a new path should be added,
+ * skipped, or flagged as an error.
+ */
+class cmCPackArchiveGenerator::Deduplicator
+{
+private:
+ /**
+ * @brief Compares a file with already processed files.
+ *
+ * @param path The path of the file to compare.
+ * @param localTopLevel The top-level directory for the file.
+ * @return DeduplicateStatus indicating whether to add, skip, or flag an
+ * error for the file.
+ */
+ DeduplicateStatus CompareFile(const std::string& path,
+ const std::string& localTopLevel)
+ {
+ auto fileItr = this->Files.find(path);
+ if (fileItr != this->Files.end()) {
+ return cmSystemTools::FilesDiffer(path, fileItr->second)
+ ? DeduplicateStatus::Error
+ : DeduplicateStatus::Skip;
+ }
+
+ this->Files[path] = cmStrCat(localTopLevel, "/", path);
+ return DeduplicateStatus::Add;
+ }
+
+ /**
+ * @brief Compares a folder with already processed folders.
+ *
+ * @param path The path of the folder to compare.
+ * @return DeduplicateStatus indicating whether to add or skip the folder.
+ */
+ DeduplicateStatus CompareFolder(const std::string& path)
+ {
+ if (this->Folders.find(path) != this->Folders.end()) {
+ return DeduplicateStatus::Skip;
+ }
+
+ this->Folders.emplace(path);
+ return DeduplicateStatus::Add;
+ }
+
+ /**
+ * @brief Compares a symlink with already processed symlinks.
+ *
+ * @param path The path of the symlink to compare.
+ * @return DeduplicateStatus indicating whether to add, skip, or flag an
+ * error for the symlink.
+ */
+ DeduplicateStatus CompareSymlink(const std::string& path)
+ {
+ auto symlinkItr = this->Symlink.find(path);
+ std::string symlinkValue;
+ auto status = cmSystemTools::ReadSymlink(path, symlinkValue);
+ if (!status.IsSuccess()) {
+ return DeduplicateStatus::Error;
+ }
+
+ if (symlinkItr != this->Symlink.end()) {
+ return symlinkValue == symlinkItr->second ? DeduplicateStatus::Skip
+ : DeduplicateStatus::Error;
+ }
+
+ this->Symlink[path] = symlinkValue;
+ return DeduplicateStatus::Add;
+ }
+
+public:
+ /**
+ * @brief Determines the deduplication status of a given path.
+ *
+ * This method identifies whether the given path is a file, folder, or
+ * symlink and then delegates to the appropriate comparison method.
+ *
+ * @param path The path to check for deduplication.
+ * @param localTopLevel The top-level directory for the path.
+ * @return DeduplicateStatus indicating the action to take for the given
+ * path.
+ */
+ DeduplicateStatus IsDeduplicate(const std::string& path,
+ const std::string& localTopLevel)
+ {
+ DeduplicateStatus status;
+ if (cmSystemTools::FileIsDirectory(path)) {
+ status = this->CompareFolder(path);
+ } else if (cmSystemTools::FileIsSymlink(path)) {
+ status = this->CompareSymlink(path);
+ } else {
+ status = this->CompareFile(path, localTopLevel);
+ }
+
+ return status;
+ }
+
+private:
+ std::unordered_map<std::string, std::string> Symlink;
+ std::unordered_set<std::string> Folders;
+ std::unordered_map<std::string, std::string> Files;
+};
+
cmCPackGenerator* cmCPackArchiveGenerator::Create7ZGenerator()
{
return new cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, "7zip",
@@ -110,7 +227,8 @@ int cmCPackArchiveGenerator::InitializeInternal()
}
int cmCPackArchiveGenerator::addOneComponentToArchive(
- cmArchiveWrite& archive, cmCPackComponent* component)
+ cmArchiveWrite& archive, cmCPackComponent* component,
+ Deduplicator* deduplicator)
{
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
" - packaging component: " << component->Name << std::endl);
@@ -139,8 +257,25 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(
}
for (std::string const& file : component->Files) {
std::string rp = filePrefix + file;
- cmCPackLogger(cmCPackLog::LOG_DEBUG, "Adding file: " << rp << std::endl);
- archive.Add(rp, 0, nullptr, false);
+
+ DeduplicateStatus status = DeduplicateStatus::Add;
+ if (deduplicator != nullptr) {
+ status = deduplicator->IsDeduplicate(rp, localToplevel);
+ }
+
+ if (deduplicator == nullptr || status == DeduplicateStatus::Add) {
+ cmCPackLogger(cmCPackLog::LOG_DEBUG, "Adding file: " << rp << std::endl);
+ archive.Add(rp, 0, nullptr, false);
+ } else if (status == DeduplicateStatus::Error) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "ERROR The data in files with the "
+ "same filename is different.");
+ return 0;
+ } else {
+ cmCPackLogger(cmCPackLog::LOG_DEBUG,
+ "Passing file: " << rp << std::endl);
+ }
+
if (!archive) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"ERROR while packaging files: " << archive.GetError()
@@ -197,6 +332,8 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup)
std::string packageFileName = std::string(this->toplevel) + "/" +
this->GetArchiveComponentFileName(compG.first, true);
+ Deduplicator deduplicator;
+
// open a block in order to automatically close archive
// at the end of the block
{
@@ -204,7 +341,7 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup)
// now iterate over the component of this group
for (cmCPackComponent* comp : (compG.second).Components) {
// Add the files of this component to the archive
- this->addOneComponentToArchive(archive, comp);
+ this->addOneComponentToArchive(archive, comp, &deduplicator);
}
}
// add the generated package to package file names list
@@ -231,7 +368,7 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup)
{
DECLARE_AND_OPEN_ARCHIVE(packageFileName, archive);
// Add the files of this component to the archive
- this->addOneComponentToArchive(archive, &(comp.second));
+ this->addOneComponentToArchive(archive, &(comp.second), nullptr);
}
// add the generated package to package file names list
this->packageFileNames.push_back(std::move(packageFileName));
@@ -252,7 +389,7 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup)
{
DECLARE_AND_OPEN_ARCHIVE(packageFileName, archive);
// Add the files of this component to the archive
- this->addOneComponentToArchive(archive, &(comp.second));
+ this->addOneComponentToArchive(archive, &(comp.second), nullptr);
}
// add the generated package to package file names list
this->packageFileNames.push_back(std::move(packageFileName));
@@ -282,10 +419,12 @@ int cmCPackArchiveGenerator::PackageComponentsAllInOne()
<< std::endl);
DECLARE_AND_OPEN_ARCHIVE(packageFileNames[0], archive);
+ Deduplicator deduplicator;
+
// The ALL COMPONENTS in ONE package case
for (auto& comp : this->Components) {
// Add the files of this component to the archive
- this->addOneComponentToArchive(archive, &(comp.second));
+ this->addOneComponentToArchive(archive, &(comp.second), &deduplicator);
}
// archive goes out of scope so it will finalized and closed.
diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h
index 8a9bbc6..b8a1afa 100644
--- a/Source/CPack/cmCPackArchiveGenerator.h
+++ b/Source/CPack/cmCPackArchiveGenerator.h
@@ -47,6 +47,8 @@ private:
std::string GetArchiveComponentFileName(const std::string& component,
bool isGroupName);
+ class Deduplicator;
+
protected:
int InitializeInternal() override;
/**
@@ -54,9 +56,11 @@ protected:
* to the provided (already opened) archive.
* @param[in,out] archive the archive object
* @param[in] component the component whose file will be added to archive
+ * @param[in] deduplicator file deduplicator utility.
*/
int addOneComponentToArchive(cmArchiveWrite& archive,
- cmCPackComponent* component);
+ cmCPackComponent* component,
+ Deduplicator* deduplicator);
/**
* The main package file method.
diff --git a/Source/CPack/cmCPackInnoSetupGenerator.cxx b/Source/CPack/cmCPackInnoSetupGenerator.cxx
index b8bf070..bf90b06 100644
--- a/Source/CPack/cmCPackInnoSetupGenerator.cxx
+++ b/Source/CPack/cmCPackInnoSetupGenerator.cxx
@@ -579,8 +579,9 @@ bool cmCPackInnoSetupGenerator::ProcessFiles()
bool cmCPackInnoSetupGenerator::ProcessComponents()
{
- codeIncludes.push_back("{ The following lines are required by CPack because "
- "this script uses components }");
+ codeIncludes.emplace_back(
+ "{ The following lines are required by CPack because "
+ "this script uses components }");
// Installation types
std::vector<cmCPackInstallationType*> types(InstallationTypes.size());
@@ -607,7 +608,7 @@ bool cmCPackInnoSetupGenerator::ProcessComponents()
"\"{code:CPackGetCustomInstallationMessage}\"";
customTypeParams["Flags"] = "iscustom";
- allTypes.push_back("custom");
+ allTypes.emplace_back("custom");
typeInstructions.push_back(ISKeyValueLine(customTypeParams));
// Components
@@ -633,6 +634,7 @@ bool cmCPackInnoSetupGenerator::ProcessComponents()
} else if (!component->InstallationTypes.empty()) {
std::vector<std::string> installationTypes;
+ installationTypes.reserve(component->InstallationTypes.size());
for (cmCPackInstallationType* j : component->InstallationTypes) {
installationTypes.push_back(j->Name);
}
diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h
index 2ab2f8e..347b0f7 100644
--- a/Source/CPack/cmCPackLog.h
+++ b/Source/CPack/cmCPackLog.h
@@ -29,7 +29,7 @@ public:
cmCPackLog(const cmCPackLog&) = delete;
cmCPackLog& operator=(const cmCPackLog&) = delete;
- enum __log_tags
+ enum cm_log_tags
{
NOTAG = 0,
LOG_OUTPUT = 0x1,
diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx
index 36df344..87081f0 100644
--- a/Source/CTest/cmCTestBZR.cxx
+++ b/Source/CTest/cmCTestBZR.cxx
@@ -374,7 +374,7 @@ bool cmCTestBZR::UpdateImpl()
// Use "bzr pull" to update the working tree.
std::vector<std::string> bzr_update;
bzr_update.push_back(this->CommandLineTool);
- bzr_update.push_back("pull");
+ bzr_update.emplace_back("pull");
cm::append(bzr_update, args);
diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx
index ef95b25..badd43e 100644
--- a/Source/CTest/cmCTestCVS.cxx
+++ b/Source/CTest/cmCTestCVS.cxx
@@ -92,8 +92,8 @@ bool cmCTestCVS::UpdateImpl()
// Run "cvs update" to update the work tree.
std::vector<std::string> cvs_update;
cvs_update.push_back(this->CommandLineTool);
- cvs_update.push_back("-z3");
- cvs_update.push_back("update");
+ cvs_update.emplace_back("-z3");
+ cvs_update.emplace_back("update");
cm::append(cvs_update, args);
UpdateParser out(this, "up-out> ");
diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
index af495bb..2c92d77 100644
--- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
+++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
@@ -2,25 +2,27 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestEmptyBinaryDirectoryCommand.h"
-#include <sstream>
-
#include "cmCTestScriptHandler.h"
-
-class cmExecutionStatus;
+#include "cmExecutionStatus.h"
+#include "cmMakefile.h"
+#include "cmMessageType.h"
+#include "cmStringAlgorithms.h"
bool cmCTestEmptyBinaryDirectoryCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus& /*unused*/)
+ std::vector<std::string> const& args, cmExecutionStatus& status)
{
if (args.size() != 1) {
this->SetError("called with incorrect number of arguments");
return false;
}
- if (!cmCTestScriptHandler::EmptyBinaryDirectory(args[0])) {
- std::ostringstream ostr;
- ostr << "problem removing the binary directory: " << args[0];
- this->SetError(ostr.str());
- return false;
+ std::string err;
+ if (!cmCTestScriptHandler::EmptyBinaryDirectory(args[0], err)) {
+ status.GetMakefile().IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Did not remove the binary directory:\n ", args[0],
+ "\nbecause:\n ", err));
+ return true;
}
return true;
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index ca8659e..984c837 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -159,7 +159,7 @@ bool cmCTestGIT::UpdateByFetchAndReset()
// Use "git fetch" to get remote commits.
std::vector<std::string> git_fetch;
git_fetch.push_back(git);
- git_fetch.push_back("fetch");
+ git_fetch.emplace_back("fetch");
// Add user-specified update options.
std::string opts = this->CTest->GetCTestConfiguration("UpdateOptions");
diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx
index e1a945d..3d56be0 100644
--- a/Source/CTest/cmCTestHG.cxx
+++ b/Source/CTest/cmCTestHG.cxx
@@ -137,9 +137,9 @@ bool cmCTestHG::UpdateImpl()
// TODO: if(this->CTest->GetTestModel() == cmCTest::NIGHTLY)
std::vector<std::string> hg_update;
- hg_update.push_back(this->CommandLineTool.c_str());
- hg_update.push_back("update");
- hg_update.push_back("-v");
+ hg_update.emplace_back(this->CommandLineTool);
+ hg_update.emplace_back("update");
+ hg_update.emplace_back("-v");
// Add user-specified update options.
std::string opts = this->CTest->GetCTestConfiguration("UpdateOptions");
diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx
index 5d71b84..20bd0ec 100644
--- a/Source/CTest/cmCTestP4.cxx
+++ b/Source/CTest/cmCTestP4.cxx
@@ -151,9 +151,9 @@ cmCTestP4::User cmCTestP4::GetUserData(const std::string& username)
if (it == this->Users.end()) {
std::vector<std::string> p4_users;
this->SetP4Options(p4_users);
- p4_users.push_back("users");
- p4_users.push_back("-m");
- p4_users.push_back("1");
+ p4_users.emplace_back("users");
+ p4_users.emplace_back("-m");
+ p4_users.emplace_back("1");
p4_users.push_back(username);
UserParser out(this, "users-out> ");
@@ -335,10 +335,10 @@ std::string cmCTestP4::GetWorkingRevision()
std::vector<std::string> p4_identify;
this->SetP4Options(p4_identify);
- p4_identify.push_back("changes");
- p4_identify.push_back("-m");
- p4_identify.push_back("1");
- p4_identify.push_back("-t");
+ p4_identify.emplace_back("changes");
+ p4_identify.emplace_back("-m");
+ p4_identify.emplace_back("1");
+ p4_identify.emplace_back("-t");
std::string source = this->SourceDirectory + "/...#have";
p4_identify.push_back(source);
@@ -403,7 +403,7 @@ bool cmCTestP4::LoadRevisions()
.append(",")
.append(this->NewRevision);
- p4_changes.push_back("changes");
+ p4_changes.emplace_back("changes");
p4_changes.push_back(range);
ChangesParser out(this, "p4_changes-out> ");
@@ -420,8 +420,8 @@ bool cmCTestP4::LoadRevisions()
std::vector<std::string> p4_describe;
for (std::string const& i : cmReverseRange(this->ChangeLists)) {
this->SetP4Options(p4_describe);
- p4_describe.push_back("describe");
- p4_describe.push_back("-s");
+ p4_describe.emplace_back("describe");
+ p4_describe.emplace_back("-s");
p4_describe.push_back(i);
DescribeParser outDescribe(this, "p4_describe-out> ");
@@ -436,10 +436,10 @@ bool cmCTestP4::LoadModifications()
std::vector<std::string> p4_diff;
this->SetP4Options(p4_diff);
- p4_diff.push_back("diff");
+ p4_diff.emplace_back("diff");
// Ideally we would use -Od but not all clients support it
- p4_diff.push_back("-dn");
+ p4_diff.emplace_back("-dn");
std::string source = this->SourceDirectory + "/...";
p4_diff.push_back(source);
@@ -480,7 +480,7 @@ bool cmCTestP4::UpdateImpl()
std::vector<std::string> p4_sync;
this->SetP4Options(p4_sync);
- p4_sync.push_back("sync");
+ p4_sync.emplace_back("sync");
// Get user-specified update options.
std::string opts = this->CTest->GetCTestConfiguration("UpdateOptions");
diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx
index 14bc510..fc7051c 100644
--- a/Source/CTest/cmCTestSVN.cxx
+++ b/Source/CTest/cmCTestSVN.cxx
@@ -34,7 +34,7 @@ cmCTestSVN::~cmCTestSVN() = default;
void cmCTestSVN::CleanupImpl()
{
std::vector<std::string> svn_cleanup;
- svn_cleanup.push_back("cleanup");
+ svn_cleanup.emplace_back("cleanup");
OutputLogger out(this->Log, "cleanup-out> ");
OutputLogger err(this->Log, "cleanup-err> ");
this->RunSVNCommand(svn_cleanup, &out, &err);
@@ -89,7 +89,7 @@ std::string cmCTestSVN::LoadInfo(SVNInfo& svninfo)
{
// Run "svn info" to get the repository info from the work tree.
std::vector<std::string> svn_info;
- svn_info.push_back("info");
+ svn_info.emplace_back("info");
svn_info.push_back(svninfo.LocalPath);
std::string rev;
InfoParser out(this, "info-out> ", rev, svninfo);
@@ -252,7 +252,7 @@ bool cmCTestSVN::UpdateImpl()
}
std::vector<std::string> svn_update;
- svn_update.push_back("update");
+ svn_update.emplace_back("update");
cm::append(svn_update, args);
UpdateParser out(this, "up-out> ");
@@ -270,7 +270,7 @@ bool cmCTestSVN::RunSVNCommand(std::vector<std::string> const& parameters,
std::vector<std::string> args;
args.push_back(this->CommandLineTool);
cm::append(args, parameters);
- args.push_back("--non-interactive");
+ args.emplace_back("--non-interactive");
std::string userOptions = this->CTest->GetCTestConfiguration("SVNOptions");
@@ -388,11 +388,11 @@ bool cmCTestSVN::LoadRevisions(SVNInfo& svninfo)
// Run "svn log" to get all global revisions of interest.
std::vector<std::string> svn_log;
- svn_log.push_back("log");
- svn_log.push_back("--xml");
- svn_log.push_back("-v");
- svn_log.push_back(revs.c_str());
- svn_log.push_back(svninfo.LocalPath.c_str());
+ svn_log.emplace_back("log");
+ svn_log.emplace_back("--xml");
+ svn_log.emplace_back("-v");
+ svn_log.emplace_back(revs);
+ svn_log.emplace_back(svninfo.LocalPath);
LogParser out(this, "log-out> ", svninfo);
OutputLogger err(this->Log, "log-err> ");
return this->RunSVNCommand(svn_log, &out, &err);
@@ -467,7 +467,7 @@ bool cmCTestSVN::LoadModifications()
{
// Run "svn status" which reports local modifications.
std::vector<std::string> svn_status;
- svn_status.push_back("status");
+ svn_status.emplace_back("status");
StatusParser out(this, "status-out> ");
OutputLogger err(this->Log, "status-err> ");
this->RunSVNCommand(svn_status, &out, &err);
@@ -529,7 +529,7 @@ bool cmCTestSVN::LoadRepositories()
// Run "svn status" to get the list of external repositories
std::vector<std::string> svn_status;
- svn_status.push_back("status");
+ svn_status.emplace_back("status");
ExternalParser out(this, "external-out> ");
OutputLogger err(this->Log, "external-err> ");
return this->RunSVNCommand(svn_status, &out, &err);
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 48f8f6d..0beee67 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -672,9 +672,11 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
// clear the binary directory?
if (this->EmptyBinDir) {
- if (!cmCTestScriptHandler::EmptyBinaryDirectory(this->BinaryDir)) {
+ std::string err;
+ if (!cmCTestScriptHandler::EmptyBinaryDirectory(this->BinaryDir, err)) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Problem removing the binary directory" << std::endl);
+ "Problem removing the binary directory ("
+ << err << "): " << this->BinaryDir << std::endl);
}
}
@@ -860,10 +862,12 @@ bool cmCTestScriptHandler::RunScript(cmCTest* ctest, cmMakefile* mf,
return true;
}
-bool cmCTestScriptHandler::EmptyBinaryDirectory(const std::string& sname)
+bool cmCTestScriptHandler::EmptyBinaryDirectory(const std::string& sname,
+ std::string& err)
{
// try to avoid deleting root
if (sname.size() < 2) {
+ err = "path too short";
return false;
}
@@ -876,20 +880,24 @@ bool cmCTestScriptHandler::EmptyBinaryDirectory(const std::string& sname)
std::string check = cmStrCat(sname, "/CMakeCache.txt");
if (!cmSystemTools::FileExists(check)) {
+ err = "path does not contain an existing CMakeCache.txt file";
return false;
}
+ cmsys::Status status;
for (int i = 0; i < 5; ++i) {
- if (TryToRemoveBinaryDirectoryOnce(sname)) {
+ status = TryToRemoveBinaryDirectoryOnce(sname);
+ if (status) {
return true;
}
cmSystemTools::Delay(100);
}
+ err = status.GetString();
return false;
}
-bool cmCTestScriptHandler::TryToRemoveBinaryDirectoryOnce(
+cmsys::Status cmCTestScriptHandler::TryToRemoveBinaryDirectoryOnce(
const std::string& directoryPath)
{
cmsys::Directory directory;
@@ -907,18 +915,18 @@ bool cmCTestScriptHandler::TryToRemoveBinaryDirectoryOnce(
bool isDirectory = cmSystemTools::FileIsDirectory(fullPath) &&
!cmSystemTools::FileIsSymlink(fullPath);
+ cmsys::Status status;
if (isDirectory) {
- if (!cmSystemTools::RemoveADirectory(fullPath)) {
- return false;
- }
+ status = cmSystemTools::RemoveADirectory(fullPath);
} else {
- if (!cmSystemTools::RemoveFile(fullPath)) {
- return false;
- }
+ status = cmSystemTools::RemoveFile(fullPath);
+ }
+ if (!status) {
+ return status;
}
}
- return static_cast<bool>(cmSystemTools::RemoveADirectory(directoryPath));
+ return cmSystemTools::RemoveADirectory(directoryPath);
}
cmDuration cmCTestScriptHandler::GetRemainingTimeAllowed()
diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h
index b7764b2..8aa07e7 100644
--- a/Source/CTest/cmCTestScriptHandler.h
+++ b/Source/CTest/cmCTestScriptHandler.h
@@ -9,6 +9,8 @@
#include <string>
#include <vector>
+#include "cmsys/Status.hxx"
+
#include "cmCTestGenericHandler.h"
#include "cmDuration.h"
@@ -80,7 +82,7 @@ public:
/*
* Empty Binary Directory
*/
- static bool EmptyBinaryDirectory(const std::string& dir);
+ static bool EmptyBinaryDirectory(const std::string& dir, std::string& err);
/*
* Write an initial CMakeCache.txt from the given contents.
@@ -139,7 +141,8 @@ private:
std::unique_ptr<cmCTestCommand> command);
// Try to remove the binary directory once
- static bool TryToRemoveBinaryDirectoryOnce(const std::string& directoryPath);
+ static cmsys::Status TryToRemoveBinaryDirectoryOnce(
+ const std::string& directoryPath);
std::vector<std::string> ConfigurationScripts;
std::vector<bool> ScriptProcessScope;
diff --git a/Source/Checks/Curses/CMakeLists.txt b/Source/Checks/Curses/CMakeLists.txt
index bc6b906..6f5f145 100644
--- a/Source/Checks/Curses/CMakeLists.txt
+++ b/Source/Checks/Curses/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.13...3.26 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.13...3.27 FATAL_ERROR)
project(CheckCurses C)
set(CURSES_NEED_NCURSES TRUE)
diff --git a/Source/Checks/Curses/CheckCurses.c b/Source/Checks/Curses/CheckCurses.c
index 7d827e6..3264fa0 100644
--- a/Source/Checks/Curses/CheckCurses.c
+++ b/Source/Checks/Curses/CheckCurses.c
@@ -8,7 +8,7 @@
# include <curses.h>
#endif
-int main()
+int main(void)
{
curses_version();
return 0;
diff --git a/Source/Modules/CMakeBuildUtilities.cmake b/Source/Modules/CMakeBuildUtilities.cmake
index 21f04e6..4e7f0fe 100644
--- a/Source/Modules/CMakeBuildUtilities.cmake
+++ b/Source/Modules/CMakeBuildUtilities.cmake
@@ -287,6 +287,8 @@ else()
set(ENABLE_CPIO_SHARED OFF)
set(ENABLE_CAT OFF)
set(ENABLE_CAT_SHARED OFF)
+ set(ENABLE_UNZIP OFF)
+ set(ENABLE_UNZIP_SHARED OFF)
set(ENABLE_XATTR OFF)
set(ENABLE_ACL OFF)
set(ENABLE_ICONV OFF)
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index b1589ff..ea97287 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -189,8 +189,8 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
} else if (copy == keyDEPFILE) {
doing = doing_depfile;
if (!mf.GetGlobalGenerator()->SupportsCustomCommandDepfile()) {
- status.SetError("Option DEPFILE not supported by " +
- mf.GetGlobalGenerator()->GetName());
+ status.SetError(cmStrCat("Option DEPFILE not supported by ",
+ mf.GetGlobalGenerator()->GetName()));
return false;
}
} else if (copy == keyJOB_POOL) {
diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx
index 0efb9a4..699e23b 100644
--- a/Source/cmCMakeHostSystemInformationCommand.cxx
+++ b/Source/cmCMakeHostSystemInformationCommand.cxx
@@ -270,7 +270,7 @@ std::map<std::string, std::string> GetOSReleaseVariables(
std::map<std::string, std::string> data;
// Based on
- // https://www.freedesktop.org/software/systemd/man/os-release.html
+ // https://www.freedesktop.org/software/systemd/man/latest/os-release.html
for (auto name : { "/etc/os-release"_s, "/usr/lib/os-release"_s }) {
const auto& filename = cmStrCat(sysroot, name);
if (cmSystemTools::FileExists(filename)) {
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 1b1f640..8a8f8bd 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -16,6 +16,8 @@
#include <cm/string_view>
#include <cmext/string_view>
+#include "cmsys/RegularExpression.hxx"
+
#include "cmComputeComponentGraph.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorExpressionDAGChecker.h"
@@ -26,6 +28,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmPolicies.h"
#include "cmRange.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
@@ -231,6 +234,204 @@ bool IsGroupFeatureSupported(cmMakefile* makefile,
cmStrCat("CMAKE_LINK_GROUP_USING_", feature, "_SUPPORTED");
return makefile->GetDefinition(featureSupported).IsOn();
}
+
+class EntriesProcessing
+{
+public:
+ using LinkEntry = cmComputeLinkDepends::LinkEntry;
+ using EntryVector = cmComputeLinkDepends::EntryVector;
+
+ EntriesProcessing(const cmGeneratorTarget* target,
+ const std::string& linkLanguage, EntryVector& entries,
+ EntryVector& finalEntries)
+ : Entries(entries)
+ , FinalEntries(finalEntries)
+ {
+ const auto* makefile = target->Makefile;
+
+ switch (target->GetPolicyStatusCMP0156()) {
+ case cmPolicies::WARN:
+ if (!makefile->GetCMakeInstance()->GetIsInTryCompile() &&
+ makefile->PolicyOptionalWarningEnabled(
+ "CMAKE_POLICY_WARNING_CMP0156")) {
+ makefile->GetCMakeInstance()->IssueMessage(
+ MessageType::AUTHOR_WARNING,
+ cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0156),
+ "\nSince the policy is not set, legacy libraries "
+ "de-duplication strategy will be applied."),
+ target->GetBacktrace());
+ }
+ CM_FALLTHROUGH;
+ case cmPolicies::OLD:
+ // rely on default initialization of the class
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ makefile->GetCMakeInstance()->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0156),
+ target->GetBacktrace());
+ CM_FALLTHROUGH;
+ case cmPolicies::NEW: {
+ if (auto libProcessing = makefile->GetDefinition(cmStrCat(
+ "CMAKE_", linkLanguage, "_LINK_LIBRARIES_PROCESSING"))) {
+ cmsys::RegularExpression processingOption{
+ "^(ORDER|UNICITY)=(FORWARD|REVERSE|ALL|NONE|SHARED)$"
+ };
+ std::string errorMessage;
+ for (auto const& option : cmList{ libProcessing }) {
+ if (processingOption.find(option)) {
+ if (processingOption.match(1) == "ORDER") {
+ if (processingOption.match(2) == "FORWARD") {
+ this->Order = Forward;
+ } else if (processingOption.match(2) == "REVERSE") {
+ this->Order = Reverse;
+ } else {
+ errorMessage += cmStrCat(" ", option, '\n');
+ }
+ } else if (processingOption.match(1) == "UNICITY") {
+ if (processingOption.match(2) == "ALL") {
+ this->Unicity = All;
+ } else if (processingOption.match(2) == "NONE") {
+ this->Unicity = None;
+ } else if (processingOption.match(2) == "SHARED") {
+ this->Unicity = Shared;
+ } else {
+ errorMessage += cmStrCat(" ", option, '\n');
+ }
+ }
+ } else {
+ errorMessage += cmStrCat(" ", option, '\n');
+ }
+ }
+ if (!errorMessage.empty()) {
+ makefile->GetCMakeInstance()->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Erroneous option(s) for 'CMAKE_", linkLanguage,
+ "_LINK_LIBRARIES_PROCESSING':\n", errorMessage),
+ target->GetBacktrace());
+ }
+ }
+ }
+ }
+ }
+
+ void AddGroups(const std::map<size_t, std::vector<size_t>>& groups)
+ {
+ if (!groups.empty()) {
+ this->Groups = &groups;
+ // record all libraries as part of groups to ensure correct
+ // deduplication: libraries as part of groups are always kept.
+ for (const auto& group : groups) {
+ for (auto index : group.second) {
+ this->Emitted.insert(index);
+ }
+ }
+ }
+ }
+
+ void AddLibraries(const std::vector<size_t>& libEntries)
+ {
+ if (this->Order == Reverse) {
+ // Iterate in reverse order so we can keep only the last occurrence
+ // of a library.
+ this->AddLibraries(cmReverseRange(libEntries));
+ } else {
+ this->AddLibraries(cmMakeRange(libEntries));
+ }
+ }
+
+ void AddObjects(const std::vector<size_t>& objectEntries)
+ {
+ // Place explicitly linked object files in the front. The linker will
+ // always use them anyway, and they may depend on symbols from libraries.
+ if (this->Order == Reverse) {
+ // Append in reverse order at the end since we reverse the final order.
+ for (auto index : cmReverseRange(objectEntries)) {
+ this->FinalEntries.emplace_back(this->Entries[index]);
+ }
+ } else {
+ // Append in reverse order to ensure correct final order
+ for (auto index : cmReverseRange(objectEntries)) {
+ this->FinalEntries.emplace(this->FinalEntries.begin(),
+ this->Entries[index]);
+ }
+ }
+ }
+
+ void Finalize()
+ {
+ if (this->Order == Reverse) {
+ // Reverse the resulting order since we iterated in reverse.
+ std::reverse(this->FinalEntries.begin(), this->FinalEntries.end());
+ }
+
+ // expand groups
+ if (this->Groups != nullptr) {
+ for (const auto& group : *this->Groups) {
+ const LinkEntry& groupEntry = this->Entries[group.first];
+ auto it = this->FinalEntries.begin();
+ while (true) {
+ it = std::find_if(it, this->FinalEntries.end(),
+ [&groupEntry](const LinkEntry& entry) -> bool {
+ return groupEntry.Item == entry.Item;
+ });
+ if (it == this->FinalEntries.end()) {
+ break;
+ }
+ it->Item.Value = "</LINK_GROUP>";
+ for (auto index = group.second.rbegin();
+ index != group.second.rend(); ++index) {
+ it = this->FinalEntries.insert(it, this->Entries[*index]);
+ }
+ it = this->FinalEntries.insert(it, groupEntry);
+ it->Item.Value = "<LINK_GROUP>";
+ }
+ }
+ }
+ }
+
+private:
+ enum OrderKind
+ {
+ Forward,
+ Reverse
+ };
+
+ enum UnicityKind
+ {
+ None,
+ Shared,
+ All
+ };
+
+ bool IncludeEntry(LinkEntry const& entry) const
+ {
+ return this->Unicity == None ||
+ (this->Unicity == Shared &&
+ (entry.Target == nullptr ||
+ entry.Target->GetType() != cmStateEnums::SHARED_LIBRARY)) ||
+ (this->Unicity == All && entry.Kind != LinkEntry::Library);
+ }
+
+ template <typename Range>
+ void AddLibraries(const Range& libEntries)
+ {
+ for (auto index : libEntries) {
+ LinkEntry const& entry = this->Entries[index];
+ if (this->IncludeEntry(entry) || this->Emitted.insert(index).second) {
+ this->FinalEntries.emplace_back(entry);
+ }
+ }
+ }
+
+ OrderKind Order = Reverse;
+ UnicityKind Unicity = Shared;
+ EntryVector& Entries;
+ EntryVector& FinalEntries;
+ std::set<size_t> Emitted;
+ const std::map<size_t, std::vector<size_t>>* Groups = nullptr;
+};
}
const std::string cmComputeLinkDepends::LinkEntry::DEFAULT = "DEFAULT";
@@ -376,49 +577,14 @@ cmComputeLinkDepends::Compute()
this->OrderLinkEntries();
// Compute the final set of link entries.
- // Iterate in reverse order so we can keep only the last occurrence
- // of a shared library.
- std::set<size_t> emitted;
- for (size_t i : cmReverseRange(this->FinalLinkOrder)) {
- LinkEntry const& e = this->EntryList[i];
- cmGeneratorTarget const* t = e.Target;
- // Entries that we know the linker will reuse do not need to be repeated.
- bool uniquify = t && t->GetType() == cmStateEnums::SHARED_LIBRARY;
- if (!uniquify || emitted.insert(i).second) {
- this->FinalLinkEntries.push_back(e);
- }
- }
- // Place explicitly linked object files in the front. The linker will
- // always use them anyway, and they may depend on symbols from libraries.
- // Append in reverse order since we reverse the final order below.
- for (size_t i : cmReverseRange(this->ObjectEntries)) {
- this->FinalLinkEntries.emplace_back(this->EntryList[i]);
- }
- // Reverse the resulting order since we iterated in reverse.
- std::reverse(this->FinalLinkEntries.begin(), this->FinalLinkEntries.end());
-
- // Expand group items
- if (!this->GroupItems.empty()) {
- for (const auto& group : this->GroupItems) {
- const LinkEntry& groupEntry = this->EntryList[group.first];
- auto it = this->FinalLinkEntries.begin();
- while (true) {
- it = std::find_if(it, this->FinalLinkEntries.end(),
- [&groupEntry](const LinkEntry& entry) -> bool {
- return groupEntry.Item == entry.Item;
- });
- if (it == this->FinalLinkEntries.end()) {
- break;
- }
- it->Item.Value = "</LINK_GROUP>";
- for (auto i = group.second.rbegin(); i != group.second.rend(); ++i) {
- it = this->FinalLinkEntries.insert(it, this->EntryList[*i]);
- }
- it = this->FinalLinkEntries.insert(it, groupEntry);
- it->Item.Value = "<LINK_GROUP>";
- }
- }
- }
+ EntriesProcessing entriesProcessing{ this->Target, this->LinkLanguage,
+ this->EntryList,
+ this->FinalLinkEntries };
+ // Add groups first, to ensure that libraries of the groups are always kept.
+ entriesProcessing.AddGroups(this->GroupItems);
+ entriesProcessing.AddLibraries(this->FinalLinkOrder);
+ entriesProcessing.AddObjects(this->ObjectEntries);
+ entriesProcessing.Finalize();
// Display the final set.
if (this->DebugMode) {
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 6f9f541..eba4c57 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -33,6 +33,9 @@ auto const keyCOMMAND = "COMMAND"_s;
auto const keyDEFINED = "DEFINED"_s;
auto const keyEQUAL = "EQUAL"_s;
auto const keyEXISTS = "EXISTS"_s;
+auto const keyIS_READABLE = "IS_READABLE"_s;
+auto const keyIS_WRITABLE = "IS_WRITABLE"_s;
+auto const keyIS_EXECUTABLE = "IS_EXECUTABLE"_s;
auto const keyGREATER = "GREATER"_s;
auto const keyGREATER_EQUAL = "GREATER_EQUAL"_s;
auto const keyIN_LIST = "IN_LIST"_s;
@@ -568,6 +571,24 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
newArgs.ReduceOneArg(cmSystemTools::FileExists(args.next->GetValue()),
args);
}
+ // check if a file is readable
+ else if (this->IsKeyword(keyIS_READABLE, *args.current)) {
+ newArgs.ReduceOneArg(cmSystemTools::TestFileAccess(
+ args.next->GetValue(), cmsys::TEST_FILE_READ),
+ args);
+ }
+ // check if a file is writable
+ else if (this->IsKeyword(keyIS_WRITABLE, *args.current)) {
+ newArgs.ReduceOneArg(cmSystemTools::TestFileAccess(
+ args.next->GetValue(), cmsys::TEST_FILE_WRITE),
+ args);
+ }
+ // check if a file is executable
+ else if (this->IsKeyword(keyIS_EXECUTABLE, *args.current)) {
+ newArgs.ReduceOneArg(cmSystemTools::TestFileAccess(
+ args.next->GetValue(), cmsys::TEST_FILE_EXECUTE),
+ args);
+ }
// does a directory with this name exist
else if (this->IsKeyword(keyIS_DIRECTORY, *args.current)) {
newArgs.ReduceOneArg(
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 7e19812..7f7c747 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -14,6 +14,7 @@
#include "cmsys/Directory.hxx"
#include "cmsys/FStream.hxx"
+#include "cmsys/RegularExpression.hxx"
#include "cmArgumentParser.h"
#include "cmConfigureLog.h"
@@ -83,6 +84,7 @@ std::string const kCMAKE_HIP_PLATFORM = "CMAKE_HIP_PLATFORM";
std::string const kCMAKE_HIP_RUNTIME_LIBRARY = "CMAKE_HIP_RUNTIME_LIBRARY";
std::string const kCMAKE_ISPC_INSTRUCTION_SETS = "CMAKE_ISPC_INSTRUCTION_SETS";
std::string const kCMAKE_ISPC_HEADER_SUFFIX = "CMAKE_ISPC_HEADER_SUFFIX";
+std::string const kCMAKE_LINKER_TYPE = "CMAKE_LINKER_TYPE";
std::string const kCMAKE_LINK_SEARCH_END_STATIC =
"CMAKE_LINK_SEARCH_END_STATIC";
std::string const kCMAKE_LINK_SEARCH_START_STATIC =
@@ -176,6 +178,7 @@ auto const TryCompileBaseSourcesArgParser =
ArgumentParser::ExpectAtLeast{ 0 })
.Bind("LINK_LIBRARIES"_s, &Arguments::LinkLibraries)
.Bind("LINK_OPTIONS"_s, &Arguments::LinkOptions)
+ .Bind("LINKER_LANGUAGE"_s, &Arguments::LinkerLanguage)
.Bind("COPY_FILE"_s, &Arguments::CopyFileTo)
.Bind("COPY_FILE_ERROR"_s, &Arguments::CopyFileError)
.BIND_LANG_PROPS(C)
@@ -854,8 +857,30 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
fclose(fout);
return cm::nullopt;
}
- fprintf(fout, "\ninclude(\"${CMAKE_CURRENT_LIST_DIR}/%s\")\n\n",
+ fprintf(fout, "\ninclude(\"${CMAKE_CURRENT_LIST_DIR}/%s\")\n",
fname.c_str());
+ // Create all relevant alias targets
+ if (arguments.LinkLibraries) {
+ const auto& aliasTargets = this->Makefile->GetAliasTargets();
+ for (std::string const& i : *arguments.LinkLibraries) {
+ auto alias = aliasTargets.find(i);
+ if (alias != aliasTargets.end()) {
+ const auto& aliasTarget =
+ this->Makefile->FindTargetToUse(alias->second);
+ // Create equivalent library/executable alias
+ if (aliasTarget->GetType() == cmStateEnums::EXECUTABLE) {
+ fprintf(fout, "add_executable(\"%s\" ALIAS \"%s\")\n", i.c_str(),
+ alias->second.c_str());
+ } else {
+ // Other cases like UTILITY and GLOBAL_TARGET are excluded when
+ // arguments.LinkLibraries is initially parsed in this function.
+ fprintf(fout, "add_library(\"%s\" ALIAS \"%s\")\n", i.c_str(),
+ alias->second.c_str());
+ }
+ }
+ }
+ }
+ fprintf(fout, "\n");
}
/* Set the appropriate policy information for ENABLE_EXPORTS */
@@ -1043,6 +1068,19 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
}
}
+ if (arguments.LinkerLanguage) {
+ std::string LinkerLanguage = *arguments.LinkerLanguage;
+ if (testLangs.find(LinkerLanguage) == testLangs.end()) {
+ this->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ "Linker language '" + LinkerLanguage +
+ "' must be enabled in project(LANGUAGES).");
+ }
+
+ fprintf(fout, "set_property(TARGET %s PROPERTY LINKER_LANGUAGE %s)\n",
+ targetName.c_str(), LinkerLanguage.c_str());
+ }
+
if (arguments.LinkLibraries) {
std::string libsToLink = " ";
for (std::string const& i : *arguments.LinkLibraries) {
@@ -1114,6 +1152,20 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
vars.insert(varList.begin(), varList.end());
}
+ if (this->Makefile->GetDefinition(kCMAKE_LINKER_TYPE)) {
+ // propagate various variables to support linker selection
+ vars.insert(kCMAKE_LINKER_TYPE);
+ auto defs = this->Makefile->GetDefinitions();
+ cmsys::RegularExpression linkerTypeDef{
+ "^CMAKE_[A-Za-z]+_USING_LINKER_"
+ };
+ for (auto const& def : defs) {
+ if (linkerTypeDef.find(def)) {
+ vars.insert(def);
+ }
+ }
+ }
+
if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0083) ==
cmPolicies::NEW) {
// To ensure full support of PIE, propagate cache variables
diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h
index 3217a1b..6a26e88 100644
--- a/Source/cmCoreTryCompile.h
+++ b/Source/cmCoreTryCompile.h
@@ -91,6 +91,7 @@ public:
cm::optional<ArgumentParser::MaybeEmpty<std::vector<std::string>>>
LinkLibraries;
ArgumentParser::MaybeEmpty<std::vector<std::string>> LinkOptions;
+ cm::optional<std::string> LinkerLanguage;
std::map<std::string, std::string> LangProps;
std::string CMakeInternal;
cm::optional<std::string> OutputVariable;
diff --git a/Source/cmDebuggerStackFrame.h b/Source/cmDebuggerStackFrame.h
index dc3b2ab..f4e6612 100644
--- a/Source/cmDebuggerStackFrame.h
+++ b/Source/cmDebuggerStackFrame.h
@@ -28,6 +28,10 @@ public:
std::string const& GetFileName() const noexcept { return this->FileName; }
int64_t GetLine() const noexcept;
cmMakefile* GetMakefile() const noexcept { return this->Makefile; }
+ cmListFileFunction const& GetFunction() const noexcept
+ {
+ return this->Function;
+ }
};
} // namespace cmDebugger
diff --git a/Source/cmDebuggerThread.cxx b/Source/cmDebuggerThread.cxx
index fd52f5a..f7a1778 100644
--- a/Source/cmDebuggerThread.cxx
+++ b/Source/cmDebuggerThread.cxx
@@ -13,6 +13,7 @@
#include "cmDebuggerVariables.h"
#include "cmDebuggerVariablesHelper.h"
#include "cmDebuggerVariablesManager.h"
+#include "cmListFileCache.h"
namespace cmDebugger {
@@ -135,8 +136,7 @@ dap::StackTraceResponse GetStackTraceResponse(
#endif
stackFrame.line = thread->Frames[i]->GetLine();
stackFrame.column = 1;
- stackFrame.name = thread->Frames[i]->GetFileName() + " Line " +
- std::to_string(stackFrame.line);
+ stackFrame.name = thread->Frames[i]->GetFunction().OriginalName();
stackFrame.id = thread->Frames[i]->GetId();
stackFrame.source = source;
diff --git a/Source/cmDyndepCollation.cxx b/Source/cmDyndepCollation.cxx
index 75f88b2..e9f7be3 100644
--- a/Source/cmDyndepCollation.cxx
+++ b/Source/cmDyndepCollation.cxx
@@ -242,14 +242,16 @@ Json::Value CollationInformationExports(cmGeneratorTarget const* gt)
auto const& all_build_exports = gt->Makefile->GetExportBuildFileGenerators();
for (auto const& exp : all_build_exports) {
- std::vector<std::string> targets;
+ std::vector<cmExportBuildFileGenerator::TargetExport> targets;
exp->GetTargets(targets);
// Ignore exports sets which are not for this target.
auto const& name = gt->GetName();
bool has_current_target =
std::any_of(targets.begin(), targets.end(),
- [name](std::string const& tname) { return tname == name; });
+ [name](cmExportBuildFileGenerator::TargetExport const& te) {
+ return te.Name == name;
+ });
if (!has_current_target) {
continue;
}
diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx
index c54e6ac..34bda1b 100644
--- a/Source/cmExportBuildAndroidMKGenerator.cxx
+++ b/Source/cmExportBuildAndroidMKGenerator.cxx
@@ -57,8 +57,8 @@ void cmExportBuildAndroidMKGenerator::GenerateImportTargetCode(
}
void cmExportBuildAndroidMKGenerator::GenerateImportPropertyCode(
- std::ostream&, const std::string&, cmGeneratorTarget const*,
- ImportPropertyMap const&)
+ std::ostream&, const std::string&, const std::string&,
+ cmGeneratorTarget const*, ImportPropertyMap const&, const std::string&)
{
}
diff --git a/Source/cmExportBuildAndroidMKGenerator.h b/Source/cmExportBuildAndroidMKGenerator.h
index 7067488..9562cee 100644
--- a/Source/cmExportBuildAndroidMKGenerator.h
+++ b/Source/cmExportBuildAndroidMKGenerator.h
@@ -51,10 +51,11 @@ protected:
void GenerateExpectedTargetsCode(
std::ostream& os, const std::string& expectedTargets) override;
void GenerateImportPropertyCode(
- std::ostream& os, const std::string& config,
- cmGeneratorTarget const* target,
- ImportPropertyMap const& properties) override;
+ std::ostream& os, const std::string& config, const std::string& suffix,
+ cmGeneratorTarget const* target, ImportPropertyMap const& properties,
+ const std::string& importedXcFrameworkLocation) override;
void GenerateMissingTargetsCheckCode(std::ostream& os) override;
+ void GenerateFindDependencyCalls(std::ostream&) override {}
void GenerateInterfaceProperties(
cmGeneratorTarget const* target, std::ostream& os,
const ImportPropertyMap& properties) override;
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index bf3bb8b..8ba8d97 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -10,7 +10,6 @@
#include <utility>
#include <cm/string_view>
-#include <cmext/algorithm>
#include <cmext/string_view>
#include "cmExportSet.h"
@@ -54,15 +53,15 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
{
std::string expectedTargets;
std::string sep;
- std::vector<std::string> targets;
+ std::vector<TargetExport> targets;
bool generatedInterfaceRequired = false;
this->GetTargets(targets);
- for (std::string const& tei : targets) {
- cmGeneratorTarget* te = this->LG->FindGeneratorTargetToUse(tei);
+ for (auto const& tei : targets) {
+ cmGeneratorTarget* te = this->LG->FindGeneratorTargetToUse(tei.Name);
expectedTargets += sep + this->Namespace + te->GetExportName();
sep = " ";
if (this->ExportedTargets.insert(te).second) {
- this->Exports.push_back(te);
+ this->Exports.emplace_back(te, tei.XcFrameworkLocation);
} else {
std::ostringstream e;
e << "given target \"" << te->GetName() << "\" more than once.";
@@ -76,13 +75,14 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
}
if (generatedInterfaceRequired) {
- this->GenerateRequiredCMakeVersion(os, "3.0.0");
+ this->SetRequiredCMakeVersion(3, 0, 0);
}
this->GenerateExpectedTargetsCode(os, expectedTargets);
}
// Create all the imported targets.
- for (cmGeneratorTarget* gte : this->Exports) {
+ for (auto const& exp : this->Exports) {
+ cmGeneratorTarget* gte = exp.Target;
this->GenerateImportTargetCode(os, gte, this->GetExportTargetType(gte));
gte->Target->AppendBuildInterfaceIncludes();
@@ -176,7 +176,9 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
void cmExportBuildFileGenerator::GenerateImportTargetsConfig(
std::ostream& os, const std::string& config, std::string const& suffix)
{
- for (cmGeneratorTarget* target : this->Exports) {
+ for (auto const& exp : this->Exports) {
+ cmGeneratorTarget* target = exp.Target;
+
// Collect import properties for this target.
ImportPropertyMap properties;
@@ -200,7 +202,23 @@ void cmExportBuildFileGenerator::GenerateImportTargetsConfig(
// properties);
// Generate code in the export file.
- this->GenerateImportPropertyCode(os, config, target, properties);
+ std::string importedXcFrameworkLocation = exp.XcFrameworkLocation;
+ if (!importedXcFrameworkLocation.empty()) {
+ importedXcFrameworkLocation = cmGeneratorExpression::Preprocess(
+ importedXcFrameworkLocation,
+ cmGeneratorExpression::PreprocessContext::BuildInterface);
+ importedXcFrameworkLocation = cmGeneratorExpression::Evaluate(
+ importedXcFrameworkLocation, exp.Target->GetLocalGenerator(), config,
+ exp.Target, nullptr, exp.Target);
+ if (!importedXcFrameworkLocation.empty() &&
+ !cmSystemTools::FileIsFullPath(importedXcFrameworkLocation)) {
+ importedXcFrameworkLocation =
+ cmStrCat(this->LG->GetCurrentBinaryDirectory(), '/',
+ importedXcFrameworkLocation);
+ }
+ }
+ this->GenerateImportPropertyCode(os, config, suffix, target, properties,
+ importedXcFrameworkLocation);
}
}
}
@@ -308,7 +326,7 @@ void cmExportBuildFileGenerator::HandleMissingTarget(
}
void cmExportBuildFileGenerator::GetTargets(
- std::vector<std::string>& targets) const
+ std::vector<TargetExport>& targets) const
{
if (this->ExportSet) {
for (std::unique_ptr<cmTargetExport> const& te :
@@ -316,7 +334,7 @@ void cmExportBuildFileGenerator::GetTargets(
if (te->NamelinkOnly) {
continue;
}
- targets.push_back(te->TargetName);
+ targets.emplace_back(te->TargetName, te->XcFrameworkLocation);
}
return;
}
@@ -334,9 +352,11 @@ cmExportBuildFileGenerator::FindBuildExportInfo(cmGlobalGenerator* gg,
for (auto const& exp : exportSets) {
const auto& exportSet = exp.second;
- std::vector<std::string> targets;
+ std::vector<TargetExport> targets;
exportSet->GetTargets(targets);
- if (cm::contains(targets, name)) {
+ if (std::any_of(
+ targets.begin(), targets.end(),
+ [&name](const TargetExport& te) { return te.Name == name; })) {
exportFiles.push_back(exp.first);
ns = exportSet->GetNamespace();
}
diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h
index 4636196..9f11d13 100644
--- a/Source/cmExportBuildFileGenerator.h
+++ b/Source/cmExportBuildFileGenerator.h
@@ -33,15 +33,27 @@ class cmTargetExport;
class cmExportBuildFileGenerator : public cmExportFileGenerator
{
public:
+ struct TargetExport
+ {
+ TargetExport(std::string name, std::string xcFrameworkLocation)
+ : Name(std::move(name))
+ , XcFrameworkLocation(std::move(xcFrameworkLocation))
+ {
+ }
+
+ std::string Name;
+ std::string XcFrameworkLocation;
+ };
+
cmExportBuildFileGenerator();
/** Set the list of targets to export. */
- void SetTargets(std::vector<std::string> const& targets)
+ void SetTargets(std::vector<TargetExport> const& targets)
{
this->Targets = targets;
}
- void GetTargets(std::vector<std::string>& targets) const;
- void AppendTargets(std::vector<std::string> const& targets)
+ void GetTargets(std::vector<TargetExport>& targets) const;
+ void AppendTargets(std::vector<TargetExport> const& targets)
{
cm::append(this->Targets, targets);
}
@@ -90,6 +102,7 @@ protected:
cmTargetExport* te) override;
std::string GetFileSetFiles(cmGeneratorTarget* gte, cmFileSet* fileSet,
cmTargetExport* te) override;
+ cmExportSet* GetExportSet() const override { return this->ExportSet; }
std::string GetCxxModulesDirectory() const override;
void GenerateCxxModuleConfigInformation(std::ostream&) const override;
@@ -98,9 +111,22 @@ protected:
std::pair<std::vector<std::string>, std::string> FindBuildExportInfo(
cmGlobalGenerator* gg, const std::string& name);
- std::vector<std::string> Targets;
+ struct TargetExportPrivate
+ {
+ TargetExportPrivate(cmGeneratorTarget* target,
+ std::string xcFrameworkLocation)
+ : Target(target)
+ , XcFrameworkLocation(std::move(xcFrameworkLocation))
+ {
+ }
+
+ cmGeneratorTarget* Target;
+ std::string XcFrameworkLocation;
+ };
+
+ std::vector<TargetExport> Targets;
cmExportSet* ExportSet;
- std::vector<cmGeneratorTarget*> Exports;
+ std::vector<TargetExportPrivate> Exports;
cmLocalGenerator* LG;
// The directory for C++ module information.
std::string CxxModulesDirectory;
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index e78b869..9c3bc61 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -8,6 +8,7 @@
#include <cm/memory>
#include <cm/optional>
+#include <cmext/algorithm>
#include <cmext/string_view>
#include "cmsys/RegularExpression.hxx"
@@ -24,10 +25,12 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
+#include "cmRange.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
+#include "cmValue.h"
#if defined(__HAIKU__)
# include <FindDirectory.h>
@@ -66,6 +69,11 @@ bool cmExportCommand(std::vector<std::string> const& args,
std::string CxxModulesDirectory;
bool Append = false;
bool ExportOld = false;
+
+ std::vector<std::vector<std::string>> PackageDependencyArgs;
+ bool ExportPackageDependencies = false;
+
+ std::vector<std::vector<std::string>> TargetArgs;
};
auto parser =
@@ -75,7 +83,13 @@ bool cmExportCommand(std::vector<std::string> const& args,
.Bind("CXX_MODULES_DIRECTORY"_s, &Arguments::CxxModulesDirectory);
if (args[0] == "EXPORT") {
- parser.Bind("EXPORT"_s, &Arguments::ExportSetName);
+ parser.Bind("EXPORT"_s, &Arguments::ExportSetName)
+ .Bind("EXPORT_PACKAGE_DEPENDENCIES"_s,
+ &Arguments::ExportPackageDependencies);
+ } else if (args[0] == "SETUP") {
+ parser.Bind("SETUP"_s, &Arguments::ExportSetName);
+ parser.Bind("PACKAGE_DEPENDENCY"_s, &Arguments::PackageDependencyArgs);
+ parser.Bind("TARGET"_s, &Arguments::TargetArgs);
} else {
parser.Bind("TARGETS"_s, &Arguments::Targets);
parser.Bind("ANDROID_MK"_s, &Arguments::AndroidMKFile);
@@ -91,6 +105,91 @@ bool cmExportCommand(std::vector<std::string> const& args,
return false;
}
+ if (args[0] == "SETUP") {
+ cmMakefile& mf = status.GetMakefile();
+ cmGlobalGenerator* gg = mf.GetGlobalGenerator();
+
+ cmExportSetMap& setMap = gg->GetExportSets();
+ auto& exportSet = setMap[arguments.ExportSetName];
+
+ struct PackageDependencyArguments
+ {
+ std::string Enabled;
+ ArgumentParser::MaybeEmpty<std::vector<std::string>> ExtraArgs;
+ };
+
+ auto packageDependencyParser =
+ cmArgumentParser<PackageDependencyArguments>{}
+ .Bind("ENABLED"_s, &PackageDependencyArguments::Enabled)
+ .Bind("EXTRA_ARGS"_s, &PackageDependencyArguments::ExtraArgs);
+
+ for (auto const& packageDependencyArgs : arguments.PackageDependencyArgs) {
+ if (packageDependencyArgs.empty()) {
+ continue;
+ }
+
+ PackageDependencyArguments const packageDependencyArguments =
+ packageDependencyParser.Parse(
+ cmMakeRange(packageDependencyArgs).advance(1), &unknownArgs);
+
+ if (!unknownArgs.empty()) {
+ status.SetError("Unknown argument: \"" + unknownArgs.front() + "\".");
+ return false;
+ }
+
+ auto& packageDependency =
+ exportSet.GetPackageDependencyForSetup(packageDependencyArgs.front());
+
+ if (!packageDependencyArguments.Enabled.empty()) {
+ if (packageDependencyArguments.Enabled == "AUTO") {
+ packageDependency.Enabled =
+ cmExportSet::PackageDependencyExportEnabled::Auto;
+ } else if (cmIsOff(packageDependencyArguments.Enabled)) {
+ packageDependency.Enabled =
+ cmExportSet::PackageDependencyExportEnabled::Off;
+ } else if (cmIsOn(packageDependencyArguments.Enabled)) {
+ packageDependency.Enabled =
+ cmExportSet::PackageDependencyExportEnabled::On;
+ } else {
+ status.SetError(
+ cmStrCat("Invalid enable setting for package dependency: \"",
+ packageDependencyArguments.Enabled, "\""));
+ return false;
+ }
+ }
+
+ cm::append(packageDependency.ExtraArguments,
+ packageDependencyArguments.ExtraArgs);
+ }
+
+ struct TargetArguments
+ {
+ std::string XcFrameworkLocation;
+ };
+
+ auto targetParser = cmArgumentParser<TargetArguments>{}.Bind(
+ "XCFRAMEWORK_LOCATION"_s, &TargetArguments::XcFrameworkLocation);
+
+ for (auto const& targetArgs : arguments.TargetArgs) {
+ if (targetArgs.empty()) {
+ continue;
+ }
+
+ TargetArguments const targetArguments =
+ targetParser.Parse(cmMakeRange(targetArgs).advance(1), &unknownArgs);
+
+ if (!unknownArgs.empty()) {
+ status.SetError("Unknown argument: \"" + unknownArgs.front() + "\".");
+ return false;
+ }
+
+ exportSet.SetXcFrameworkLocation(targetArgs.front(),
+ targetArguments.XcFrameworkLocation);
+ }
+
+ return true;
+ }
+
std::string fname;
bool android = false;
if (!arguments.AndroidMKFile.empty()) {
@@ -133,7 +232,7 @@ bool cmExportCommand(std::vector<std::string> const& args,
fname = dir + "/" + fname;
}
- std::vector<std::string> targets;
+ std::vector<cmExportBuildFileGenerator::TargetExport> targets;
cmGlobalGenerator* gg = mf.GetGlobalGenerator();
@@ -171,7 +270,7 @@ bool cmExportCommand(std::vector<std::string> const& args,
status.SetError(e.str());
return false;
}
- targets.push_back(currentTarget);
+ targets.emplace_back(currentTarget, std::string{});
}
if (arguments.Append) {
if (cmExportBuildFileGenerator* ebfg =
@@ -224,6 +323,7 @@ bool cmExportCommand(std::vector<std::string> const& args,
ebfg->SetTargets(targets);
}
ebfg->SetExportOld(arguments.ExportOld);
+ ebfg->SetExportPackageDependencies(arguments.ExportPackageDependencies);
// Compute the set of configurations exported.
std::vector<std::string> configurationTypes =
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index d0e69fb..e2c3edd 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExportFileGenerator.h"
+#include <algorithm>
#include <array>
#include <cassert>
#include <cstring>
@@ -9,12 +10,15 @@
#include <utility>
#include <cm/memory>
+#include <cm/optional>
#include <cmext/string_view>
#include "cmsys/FStream.hxx"
#include "cmComputeLinkInformation.h"
+#include "cmExportSet.h"
#include "cmFileSet.h"
+#include "cmFindPackageStack.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmLinkItem.h"
@@ -30,6 +34,7 @@
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmValue.h"
+#include "cmVersion.h"
static std::string cmExportFileGeneratorEscape(std::string const& str)
{
@@ -93,17 +98,35 @@ bool cmExportFileGenerator::GenerateImportFile()
return false;
}
std::ostream& os = *foutPtr;
+ std::stringstream mainFileWithHeadersAndFootersBuffer;
// Start with the import file header.
- this->GeneratePolicyHeaderCode(os);
- this->GenerateImportHeaderCode(os);
+ this->GenerateImportHeaderCode(mainFileWithHeadersAndFootersBuffer);
// Create all the imported targets.
- bool result = this->GenerateMainFile(os);
+ std::stringstream mainFileBuffer;
+ bool result = this->GenerateMainFile(mainFileBuffer);
+
+ // Export find_dependency() calls. Must be done after GenerateMainFile(),
+ // because that's when target dependencies are gathered, which we need for
+ // the find_dependency() calls.
+ if (!this->AppendMode && this->GetExportSet() &&
+ this->ExportPackageDependencies) {
+ this->SetRequiredCMakeVersion(3, 9, 0);
+ this->GenerateFindDependencyCalls(mainFileWithHeadersAndFootersBuffer);
+ }
+
+ // Write cached import code.
+ mainFileWithHeadersAndFootersBuffer << mainFileBuffer.rdbuf();
// End with the import file footer.
- this->GenerateImportFooterCode(os);
- this->GeneratePolicyFooterCode(os);
+ this->GenerateImportFooterCode(mainFileWithHeadersAndFootersBuffer);
+ this->GeneratePolicyFooterCode(mainFileWithHeadersAndFootersBuffer);
+
+ // This has to be done last, after the minimum CMake version has been
+ // determined.
+ this->GeneratePolicyHeaderCode(os);
+ os << mainFileWithHeadersAndFootersBuffer.rdbuf();
return result;
}
@@ -156,17 +179,6 @@ void cmExportFileGenerator::PopulateInterfaceProperty(
}
}
-void cmExportFileGenerator::GenerateRequiredCMakeVersion(
- std::ostream& os, const char* versionString)
-{
- /* clang-format off */
- os << "if(CMAKE_VERSION VERSION_LESS " << versionString << ")\n"
- " message(FATAL_ERROR \"This file relies on consumers using "
- "CMake " << versionString << " or greater.\")\n"
- "endif()\n\n";
- /* clang-format on */
-}
-
bool cmExportFileGenerator::PopulateInterfaceLinkLibrariesProperty(
cmGeneratorTarget const* target,
cmGeneratorExpression::PreprocessContext preprocessRule,
@@ -620,6 +632,12 @@ bool cmExportFileGenerator::AddTargetNamespace(std::string& input,
return false;
}
+ cmFindPackageStack const& pkgStack = tgt->Target->GetFindPackageStack();
+ if (!pkgStack.Empty() ||
+ tgt->Target->GetProperty("EXPORT_FIND_PACKAGE_NAME")) {
+ this->ExternalTargets.emplace(tgt);
+ }
+
if (tgt->IsImported()) {
input = tgt->GetName();
return true;
@@ -867,12 +885,14 @@ void cmExportFileGenerator::SetImportDetailProperties(
// Export IMPORTED_LINK_DEPENDENT_LIBRARIES to help consuming linkers
// find private dependencies of shared libraries.
std::size_t oldMissingTargetsSize = this->MissingTargets.size();
+ auto oldExternalTargets = this->ExternalTargets;
this->SetImportLinkProperty(
suffix, target, "IMPORTED_LINK_DEPENDENT_LIBRARIES", iface->SharedDeps,
properties, ImportLinkPropertyTargetNames::Yes);
// Avoid enforcing shared library private dependencies as public package
// dependencies by ignoring missing targets added for them.
this->MissingTargets.resize(oldMissingTargetsSize);
+ this->ExternalTargets = std::move(oldExternalTargets);
if (iface->Multiplicity > 0) {
std::string prop =
@@ -953,20 +973,29 @@ void cmExportFileGenerator::GeneratePolicyHeaderCode(std::ostream& os)
os << "if(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.8)\n"
<< " message(FATAL_ERROR \"CMake >= 2.8.0 required\")\n"
<< "endif()\n"
- << "if(CMAKE_VERSION VERSION_LESS \"2.8.3\")\n"
- << " message(FATAL_ERROR \"CMake >= 2.8.3 required\")\n"
+ << "if(CMAKE_VERSION VERSION_LESS \""
+ << this->RequiredCMakeVersionMajor << '.'
+ << this->RequiredCMakeVersionMinor << '.'
+ << this->RequiredCMakeVersionPatch << "\")\n"
+ << " message(FATAL_ERROR \"CMake >= "
+ << this->RequiredCMakeVersionMajor << '.'
+ << this->RequiredCMakeVersionMinor << '.'
+ << this->RequiredCMakeVersionPatch << " required\")\n"
<< "endif()\n";
/* clang-format on */
// Isolate the file policy level.
// Support CMake versions as far back as 2.6 but also support using NEW
- // policy settings for up to CMake 3.26 (this upper limit may be reviewed
+ // policy settings for up to CMake 3.27 (this upper limit may be reviewed
// and increased from time to time). This reduces the opportunity for CMake
// warnings when an older export file is later used with newer CMake
// versions.
/* clang-format off */
os << "cmake_policy(PUSH)\n"
- << "cmake_policy(VERSION 2.8.3...3.26)\n";
+ << "cmake_policy(VERSION "
+ << this->RequiredCMakeVersionMajor << '.'
+ << this->RequiredCMakeVersionMinor << '.'
+ << this->RequiredCMakeVersionPatch << "...3.27)\n";
/* clang-format on */
}
@@ -1125,8 +1154,9 @@ void cmExportFileGenerator::GenerateImportTargetCode(
}
void cmExportFileGenerator::GenerateImportPropertyCode(
- std::ostream& os, const std::string& config, cmGeneratorTarget const* target,
- ImportPropertyMap const& properties)
+ std::ostream& os, const std::string& config, const std::string& suffix,
+ cmGeneratorTarget const* target, ImportPropertyMap const& properties,
+ const std::string& importedXcFrameworkLocation)
{
// Construct the imported target name.
std::string targetName = this->Namespace;
@@ -1145,12 +1175,98 @@ void cmExportFileGenerator::GenerateImportPropertyCode(
}
os << ")\n";
os << "set_target_properties(" << targetName << " PROPERTIES\n";
+ std::string importedLocationProp = cmStrCat("IMPORTED_LOCATION", suffix);
for (auto const& property : properties) {
- os << " " << property.first << " "
- << cmExportFileGeneratorEscape(property.second) << "\n";
+ if (importedXcFrameworkLocation.empty() ||
+ property.first != importedLocationProp) {
+ os << " " << property.first << " "
+ << cmExportFileGeneratorEscape(property.second) << "\n";
+ }
}
- os << " )\n"
- << "\n";
+ os << " )\n";
+ if (!importedXcFrameworkLocation.empty()) {
+ auto importedLocationIt = properties.find(importedLocationProp);
+ if (importedLocationIt != properties.end()) {
+ os << "if(NOT CMAKE_VERSION VERSION_LESS \"3.28\" AND IS_DIRECTORY "
+ << cmExportFileGeneratorEscape(importedXcFrameworkLocation)
+ << ")\n"
+ " set_property(TARGET "
+ << targetName << " PROPERTY " << importedLocationProp << " "
+ << cmExportFileGeneratorEscape(importedXcFrameworkLocation)
+ << ")\nelse()\n set_property(TARGET " << targetName << " PROPERTY "
+ << importedLocationProp << " "
+ << cmExportFileGeneratorEscape(importedLocationIt->second)
+ << ")\nendif()\n";
+ }
+ }
+ os << "\n";
+}
+
+void cmExportFileGenerator::GenerateFindDependencyCalls(std::ostream& os)
+{
+ os << "include(CMakeFindDependencyMacro)\n";
+ std::map<std::string, cmExportSet::PackageDependency> packageDependencies;
+ auto* exportSet = this->GetExportSet();
+ if (exportSet) {
+ packageDependencies = exportSet->GetPackageDependencies();
+ }
+
+ for (cmGeneratorTarget const* gt : this->ExternalTargets) {
+ std::string findPackageName;
+ auto exportFindPackageName = gt->GetProperty("EXPORT_FIND_PACKAGE_NAME");
+ cmFindPackageStack pkgStack = gt->Target->GetFindPackageStack();
+ if (!exportFindPackageName.IsEmpty()) {
+ findPackageName = *exportFindPackageName;
+ } else {
+ if (!pkgStack.Empty()) {
+ cmFindPackageCall const& fpc = pkgStack.Top();
+ findPackageName = fpc.Name;
+ }
+ }
+ if (!findPackageName.empty()) {
+ auto& dep = packageDependencies[findPackageName];
+ if (!pkgStack.Empty()) {
+ dep.FindPackageIndex = pkgStack.Top().Index;
+ }
+ if (dep.Enabled == cmExportSet::PackageDependencyExportEnabled::Auto) {
+ dep.Enabled = cmExportSet::PackageDependencyExportEnabled::On;
+ }
+ }
+ }
+
+ std::vector<std::pair<std::string, cmExportSet::PackageDependency>>
+ packageDependenciesSorted(packageDependencies.begin(),
+ packageDependencies.end());
+ std::sort(
+ packageDependenciesSorted.begin(), packageDependenciesSorted.end(),
+ [](const std::pair<std::string, cmExportSet::PackageDependency>& lhs,
+ const std::pair<std::string, cmExportSet::PackageDependency>& rhs)
+ -> bool {
+ if (lhs.second.SpecifiedIndex) {
+ if (rhs.second.SpecifiedIndex) {
+ return lhs.second.SpecifiedIndex < rhs.second.SpecifiedIndex;
+ }
+ assert(rhs.second.FindPackageIndex);
+ return true;
+ }
+ assert(lhs.second.FindPackageIndex);
+ if (rhs.second.SpecifiedIndex) {
+ return false;
+ }
+ assert(rhs.second.FindPackageIndex);
+ return lhs.second.FindPackageIndex < rhs.second.FindPackageIndex;
+ });
+
+ for (auto const& it : packageDependenciesSorted) {
+ if (it.second.Enabled == cmExportSet::PackageDependencyExportEnabled::On) {
+ os << "find_dependency(" << it.first << " REQUIRED";
+ for (auto const& arg : it.second.ExtraArguments) {
+ os << " " << cmOutputConverter::EscapeForCMake(arg);
+ }
+ os << ")\n";
+ }
+ }
+ os << "\n\n";
}
void cmExportFileGenerator::GenerateMissingTargetsCheckCode(std::ostream& os)
@@ -1214,10 +1330,16 @@ void cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os)
/* clang-format off */
os << "# Loop over all imported files and verify that they actually exist\n"
"foreach(_cmake_target IN LISTS _cmake_import_check_targets)\n"
- " foreach(_cmake_file IN LISTS \"_cmake_import_check_files_for_${_cmake_target}\")\n"
- " if(NOT EXISTS \"${_cmake_file}\")\n"
- " message(FATAL_ERROR \"The imported target \\\"${_cmake_target}\\\""
- " references the file\n"
+ " if(CMAKE_VERSION VERSION_LESS \"3.28\"\n"
+ " OR NOT DEFINED "
+ "_cmake_import_check_xcframework_for_${_cmake_target}\n"
+ " OR NOT IS_DIRECTORY "
+ "\"${_cmake_import_check_xcframework_for_${_cmake_target}}\")\n"
+ " foreach(_cmake_file IN LISTS "
+ "\"_cmake_import_check_files_for_${_cmake_target}\")\n"
+ " if(NOT EXISTS \"${_cmake_file}\")\n"
+ " message(FATAL_ERROR \"The imported target "
+ "\\\"${_cmake_target}\\\" references the file\n"
" \\\"${_cmake_file}\\\"\n"
"but this file does not exist. Possible reasons include:\n"
"* The file was deleted, renamed, or moved to another location.\n"
@@ -1226,8 +1348,9 @@ void cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os)
" \\\"${CMAKE_CURRENT_LIST_FILE}\\\"\n"
"but not all the files it references.\n"
"\")\n"
- " endif()\n"
- " endforeach()\n"
+ " endif()\n"
+ " endforeach()\n"
+ " endif()\n"
" unset(_cmake_file)\n"
" unset(\"_cmake_import_check_files_for_${_cmake_target}\")\n"
"endforeach()\n"
@@ -1240,15 +1363,18 @@ void cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os)
void cmExportFileGenerator::GenerateImportedFileChecksCode(
std::ostream& os, cmGeneratorTarget* target,
ImportPropertyMap const& properties,
- const std::set<std::string>& importedLocations)
+ const std::set<std::string>& importedLocations,
+ const std::string& importedXcFrameworkLocation)
{
// Construct the imported target name.
std::string targetName = cmStrCat(this->Namespace, target->GetExportName());
- os << "list(APPEND _cmake_import_check_targets " << targetName
- << " )\n"
- "list(APPEND _cmake_import_check_files_for_"
- << targetName << " ";
+ os << "list(APPEND _cmake_import_check_targets " << targetName << " )\n";
+ if (!importedXcFrameworkLocation.empty()) {
+ os << "set(_cmake_import_check_xcframework_for_" << targetName << ' '
+ << cmExportFileGeneratorEscape(importedXcFrameworkLocation) << ")\n";
+ }
+ os << "list(APPEND _cmake_import_check_files_for_" << targetName << " ";
for (std::string const& li : importedLocations) {
auto pi = properties.find(li);
@@ -1485,3 +1611,17 @@ void cmExportFileGenerator::GenerateCxxModuleInformation(std::ostream& os)
this->GenerateCxxModuleConfigInformation(ap);
}
+
+void cmExportFileGenerator::SetRequiredCMakeVersion(unsigned int major,
+ unsigned int minor,
+ unsigned int patch)
+{
+ if (CMake_VERSION_ENCODE(major, minor, patch) >
+ CMake_VERSION_ENCODE(this->RequiredCMakeVersionMajor,
+ this->RequiredCMakeVersionMinor,
+ this->RequiredCMakeVersionPatch)) {
+ this->RequiredCMakeVersionMajor = major;
+ this->RequiredCMakeVersionMinor = minor;
+ this->RequiredCMakeVersionPatch = patch;
+ }
+}
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index f396e0e..554dd4a 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -15,6 +15,7 @@
#include "cmVersion.h"
#include "cmVersionConfig.h"
+class cmExportSet;
class cmFileSet;
class cmGeneratorTarget;
class cmLocalGenerator;
@@ -61,6 +62,11 @@ public:
error. */
bool GenerateImportFile();
+ void SetExportPackageDependencies(bool exportPackageDependencies)
+ {
+ this->ExportPackageDependencies = exportPackageDependencies;
+ }
+
protected:
using ImportPropertyMap = std::map<std::string, std::string>;
@@ -78,16 +84,18 @@ protected:
virtual void GenerateImportTargetCode(std::ostream& os,
cmGeneratorTarget const* target,
cmStateEnums::TargetType targetType);
- virtual void GenerateImportPropertyCode(std::ostream& os,
- const std::string& config,
- cmGeneratorTarget const* target,
- ImportPropertyMap const& properties);
+ virtual void GenerateImportPropertyCode(
+ std::ostream& os, const std::string& config, const std::string& suffix,
+ cmGeneratorTarget const* target, ImportPropertyMap const& properties,
+ const std::string& importedXcFrameworkLocation);
virtual void GenerateImportedFileChecksCode(
std::ostream& os, cmGeneratorTarget* target,
ImportPropertyMap const& properties,
- const std::set<std::string>& importedLocations);
+ const std::set<std::string>& importedLocations,
+ const std::string& importedXcFrameworkLocation);
virtual void GenerateImportedFileCheckLoop(std::ostream& os);
virtual void GenerateMissingTargetsCheckCode(std::ostream& os);
+ virtual void GenerateFindDependencyCalls(std::ostream& os);
virtual void GenerateExpectedTargetsCode(std::ostream& os,
const std::string& expectedTargets);
@@ -173,9 +181,6 @@ protected:
std::string& input, cmGeneratorTarget const* target,
FreeTargetsReplace replace = NoReplaceFreeTargets);
- virtual void GenerateRequiredCMakeVersion(std::ostream& os,
- const char* versionString);
-
bool PopulateCxxModuleExportProperties(
cmGeneratorTarget const* gte, ImportPropertyMap& properties,
cmGeneratorExpression::PreprocessContext ctx,
@@ -196,6 +201,11 @@ protected:
cmFileSet* fileSet,
cmTargetExport* te) = 0;
+ virtual cmExportSet* GetExportSet() const { return nullptr; }
+
+ void SetRequiredCMakeVersion(unsigned int major, unsigned int minor,
+ unsigned int patch);
+
// The namespace in which the exports are placed in the generated file.
std::string Namespace;
@@ -216,6 +226,14 @@ protected:
std::vector<std::string> MissingTargets;
+ std::set<cmGeneratorTarget const*> ExternalTargets;
+
+ unsigned int RequiredCMakeVersionMajor = 2;
+ unsigned int RequiredCMakeVersionMinor = 8;
+ unsigned int RequiredCMakeVersionPatch = 3;
+
+ bool ExportPackageDependencies = false;
+
private:
void PopulateInterfaceProperty(const std::string&, const std::string&,
cmGeneratorTarget const* target,
diff --git a/Source/cmExportInstallAndroidMKGenerator.cxx b/Source/cmExportInstallAndroidMKGenerator.cxx
index d53254d..eaa85f3 100644
--- a/Source/cmExportInstallAndroidMKGenerator.cxx
+++ b/Source/cmExportInstallAndroidMKGenerator.cxx
@@ -80,8 +80,8 @@ void cmExportInstallAndroidMKGenerator::GenerateExpectedTargetsCode(
}
void cmExportInstallAndroidMKGenerator::GenerateImportPropertyCode(
- std::ostream&, const std::string&, cmGeneratorTarget const*,
- ImportPropertyMap const&)
+ std::ostream&, const std::string&, const std::string&,
+ cmGeneratorTarget const*, ImportPropertyMap const&, const std::string&)
{
}
@@ -110,11 +110,6 @@ void cmExportInstallAndroidMKGenerator::GenerateImportPrefix(std::ostream&)
{
}
-void cmExportInstallAndroidMKGenerator::GenerateRequiredCMakeVersion(
- std::ostream&, const char*)
-{
-}
-
void cmExportInstallAndroidMKGenerator::CleanupTemporaryVariables(
std::ostream&)
{
@@ -127,7 +122,7 @@ void cmExportInstallAndroidMKGenerator::GenerateImportedFileCheckLoop(
void cmExportInstallAndroidMKGenerator::GenerateImportedFileChecksCode(
std::ostream&, cmGeneratorTarget*, ImportPropertyMap const&,
- const std::set<std::string>&)
+ const std::set<std::string>&, const std::string&)
{
}
diff --git a/Source/cmExportInstallAndroidMKGenerator.h b/Source/cmExportInstallAndroidMKGenerator.h
index 061358d..b1778ef 100644
--- a/Source/cmExportInstallAndroidMKGenerator.h
+++ b/Source/cmExportInstallAndroidMKGenerator.h
@@ -45,22 +45,22 @@ protected:
void GenerateExpectedTargetsCode(
std::ostream& os, const std::string& expectedTargets) override;
void GenerateImportPropertyCode(
- std::ostream& os, const std::string& config,
- cmGeneratorTarget const* target,
- ImportPropertyMap const& properties) override;
+ std::ostream& os, const std::string& config, const std::string& suffix,
+ cmGeneratorTarget const* target, ImportPropertyMap const& properties,
+ const std::string& importedXcFrameworkLocation) override;
void GenerateMissingTargetsCheckCode(std::ostream& os) override;
+ void GenerateFindDependencyCalls(std::ostream&) override {}
void GenerateInterfaceProperties(
cmGeneratorTarget const* target, std::ostream& os,
const ImportPropertyMap& properties) override;
void GenerateImportPrefix(std::ostream& os) override;
void LoadConfigFiles(std::ostream&) override;
- void GenerateRequiredCMakeVersion(std::ostream& os,
- const char* versionString) override;
void CleanupTemporaryVariables(std::ostream&) override;
void GenerateImportedFileCheckLoop(std::ostream& os) override;
void GenerateImportedFileChecksCode(
std::ostream& os, cmGeneratorTarget* target,
ImportPropertyMap const& properties,
- const std::set<std::string>& importedLocations) override;
+ const std::set<std::string>& importedLocations,
+ const std::string& importedXcFrameworkLocation) override;
bool GenerateImportFileConfig(const std::string& config) override;
};
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index a264f5e..64e694c 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -76,9 +76,6 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
// Compute the relative import prefix for the file
this->GenerateImportPrefix(os);
- bool require2_8_12 = false;
- bool require3_0_0 = false;
- bool require3_1_0 = false;
bool requiresConfigFiles = false;
// Create all the imported targets.
for (cmTargetExport* te : allTargets) {
@@ -147,16 +144,16 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
if (this->PopulateInterfaceLinkLibrariesProperty(
gt, cmGeneratorExpression::InstallInterface, properties) &&
!this->ExportOld) {
- require2_8_12 = true;
+ this->SetRequiredCMakeVersion(2, 8, 12);
}
}
if (targetType == cmStateEnums::INTERFACE_LIBRARY) {
- require3_0_0 = true;
+ this->SetRequiredCMakeVersion(3, 0, 0);
}
if (gt->GetProperty("INTERFACE_SOURCES")) {
// We can only generate INTERFACE_SOURCES in CMake 3.3, but CMake 3.1
// can consume them.
- require3_1_0 = true;
+ this->SetRequiredCMakeVersion(3, 1, 0);
}
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", gt,
@@ -169,14 +166,6 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
this->GenerateTargetFileSets(gt, os, te);
}
- if (require3_1_0) {
- this->GenerateRequiredCMakeVersion(os, "3.1.0");
- } else if (require3_0_0) {
- this->GenerateRequiredCMakeVersion(os, "3.0.0");
- } else if (require2_8_12) {
- this->GenerateRequiredCMakeVersion(os, "2.8.12");
- }
-
this->LoadConfigFiles(os);
bool result = true;
@@ -386,9 +375,26 @@ void cmExportInstallFileGenerator::GenerateImportTargetsConfig(
// properties);
// Generate code in the export file.
- this->GenerateImportPropertyCode(os, config, gtgt, properties);
- this->GenerateImportedFileChecksCode(os, gtgt, properties,
- importedLocations);
+ std::string importedXcFrameworkLocation = te->XcFrameworkLocation;
+ if (!importedXcFrameworkLocation.empty()) {
+ importedXcFrameworkLocation = cmGeneratorExpression::Preprocess(
+ importedXcFrameworkLocation,
+ cmGeneratorExpression::PreprocessContext::InstallInterface, true);
+ importedXcFrameworkLocation = cmGeneratorExpression::Evaluate(
+ importedXcFrameworkLocation, te->Target->GetLocalGenerator(), config,
+ te->Target, nullptr, te->Target);
+ if (!importedXcFrameworkLocation.empty() &&
+ !cmSystemTools::FileIsFullPath(importedXcFrameworkLocation) &&
+ !cmHasLiteralPrefix(importedXcFrameworkLocation,
+ "${_IMPORT_PREFIX}/")) {
+ importedXcFrameworkLocation =
+ cmStrCat("${_IMPORT_PREFIX}/", importedXcFrameworkLocation);
+ }
+ }
+ this->GenerateImportPropertyCode(os, config, suffix, gtgt, properties,
+ importedXcFrameworkLocation);
+ this->GenerateImportedFileChecksCode(
+ os, gtgt, properties, importedLocations, importedXcFrameworkLocation);
}
}
}
diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h
index e073a31..9de0c8e 100644
--- a/Source/cmExportInstallFileGenerator.h
+++ b/Source/cmExportInstallFileGenerator.h
@@ -12,12 +12,13 @@
#include <vector>
#include "cmExportFileGenerator.h"
+#include "cmInstallExportGenerator.h"
#include "cmStateTypes.h"
+class cmExportSet;
class cmFileSet;
class cmGeneratorTarget;
class cmGlobalGenerator;
-class cmInstallExportGenerator;
class cmInstallTargetGenerator;
class cmTargetExport;
@@ -121,6 +122,11 @@ protected:
void GenerateCxxModuleConfigInformation(std::ostream&) const override;
bool GenerateImportCxxModuleConfigTargetInclusion(std::string const&);
+ cmExportSet* GetExportSet() const override
+ {
+ return this->IEGen->GetExportSet();
+ }
+
cmInstallExportGenerator* IEGen;
// The import file generated for each configuration.
diff --git a/Source/cmExportSet.cxx b/Source/cmExportSet.cxx
index 3d4ef0a..b32bb8d 100644
--- a/Source/cmExportSet.cxx
+++ b/Source/cmExportSet.cxx
@@ -1,6 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmExportSet.h"
+#include "cmExportSet.h" // IWYU pragma: associated
#include <algorithm>
#include <tuple>
@@ -11,7 +11,7 @@
#include "cmMessageType.h"
#include "cmStringAlgorithms.h"
#include "cmTarget.h"
-#include "cmTargetExport.h"
+#include "cmTargetExport.h" // IWYU pragma: associated
cmExportSet::cmExportSet(std::string name)
: Name(std::move(name))
@@ -20,6 +20,17 @@ cmExportSet::cmExportSet(std::string name)
cmExportSet::~cmExportSet() = default;
+cmExportSet::PackageDependency& cmExportSet::GetPackageDependencyForSetup(
+ const std::string& name)
+{
+ auto& dep = this->PackageDependencies[name];
+ if (!dep.SpecifiedIndex) {
+ dep.SpecifiedIndex = this->NextPackageDependencyIndex;
+ this->NextPackageDependencyIndex++;
+ }
+ return dep;
+}
+
bool cmExportSet::Compute(cmLocalGenerator* lg)
{
for (std::unique_ptr<cmTargetExport>& tgtExport : this->TargetExports) {
@@ -61,6 +72,16 @@ void cmExportSet::AddInstallation(cmInstallExportGenerator const* installation)
this->Installations.push_back(installation);
}
+void cmExportSet::SetXcFrameworkLocation(const std::string& name,
+ const std::string& location)
+{
+ for (auto& te : this->TargetExports) {
+ if (name == te->TargetName) {
+ te->XcFrameworkLocation = location;
+ }
+ }
+}
+
cmExportSet& cmExportSetMap::operator[](const std::string& name)
{
auto it = this->find(name);
diff --git a/Source/cmExportSet.h b/Source/cmExportSet.h
index b75a26d..f2fc4a7 100644
--- a/Source/cmExportSet.h
+++ b/Source/cmExportSet.h
@@ -9,6 +9,8 @@
#include <string>
#include <vector>
+#include <cm/optional>
+
class cmInstallExportGenerator;
class cmLocalGenerator;
class cmTargetExport;
@@ -31,6 +33,9 @@ public:
void AddInstallation(cmInstallExportGenerator const* installation);
+ void SetXcFrameworkLocation(const std::string& name,
+ const std::string& location);
+
std::string const& GetName() const { return this->Name; }
std::vector<std::unique_ptr<cmTargetExport>> const& GetTargetExports() const
@@ -43,10 +48,36 @@ public:
return &this->Installations;
}
+ enum class PackageDependencyExportEnabled
+ {
+ Auto,
+ Off,
+ On,
+ };
+
+ struct PackageDependency
+ {
+ PackageDependencyExportEnabled Enabled =
+ PackageDependencyExportEnabled::Auto;
+ std::vector<std::string> ExtraArguments;
+ cm::optional<unsigned int> SpecifiedIndex;
+ cm::optional<unsigned int> FindPackageIndex;
+ };
+
+ PackageDependency& GetPackageDependencyForSetup(const std::string& name);
+
+ const std::map<std::string, PackageDependency>& GetPackageDependencies()
+ const
+ {
+ return this->PackageDependencies;
+ }
+
private:
std::vector<std::unique_ptr<cmTargetExport>> TargetExports;
std::string Name;
std::vector<cmInstallExportGenerator const*> Installations;
+ std::map<std::string, PackageDependency> PackageDependencies;
+ unsigned int NextPackageDependencyIndex = 0;
};
/// A name -> cmExportSet map with overloaded operator[].
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 93bed9a..9cd3db1 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -1322,13 +1322,15 @@ bool HandleRealPathCommand(std::vector<std::string> const& args,
if (oldPolicyPath != realPath) {
status.GetMakefile().IssueMessage(
MessageType::AUTHOR_WARNING,
- cmStrCat(
- cmPolicies::GetPolicyWarning(cmPolicies::CMP0152), '\n',
- "From input path:\n ", input,
- "\nthe policy OLD behavior produces path:\n ", oldPolicyPath,
- "\nbut the policy NEW behavior produces path:\n ", realPath,
- "\nSince the policy is not set, CMake is using the OLD "
- "behavior for compatibility."));
+ cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0152),
+ "\n"
+ "From input path:\n ",
+ input, "\nthe policy OLD behavior produces path:\n ",
+ oldPolicyPath,
+ "\nbut the policy NEW behavior produces path:\n ",
+ realPath,
+ "\nSince the policy is not set, CMake is using the OLD "
+ "behavior for compatibility."));
}
}
realPath = oldPolicyPath;
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 30458cd..9b51b1a 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1044,6 +1044,8 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
PushPopRootPathStack pushPopRootPathStack(*this);
SetRestoreFindDefinitions setRestoreFindDefinitions(*this, components,
componentVarDefs);
+ cmMakefile::FindPackageStackRAII findPackageStackRAII(this->Makefile,
+ this->Name);
// See if we have been told to delegate to FetchContent or some other
// redirected config package first. We have to check all names that
diff --git a/Source/cmFindPackageStack.cxx b/Source/cmFindPackageStack.cxx
new file mode 100644
index 0000000..1aeb2a7
--- /dev/null
+++ b/Source/cmFindPackageStack.cxx
@@ -0,0 +1,7 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#define cmFindPackageStack_cxx
+#include "cmFindPackageStack.h"
+
+#include "cmConstStack.tcc" // IWYU pragma: keep
+template class cmConstStack<cmFindPackageCall, cmFindPackageStack>;
diff --git a/Source/cmFindPackageStack.h b/Source/cmFindPackageStack.h
new file mode 100644
index 0000000..2062fbc
--- /dev/null
+++ b/Source/cmFindPackageStack.h
@@ -0,0 +1,33 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#pragma once
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include <memory>
+#include <string>
+
+#include "cmConstStack.h"
+
+/**
+ * Represents one call to find_package.
+ */
+class cmFindPackageCall
+{
+public:
+ std::string Name;
+ unsigned int Index;
+};
+
+/**
+ * Represents a stack of find_package calls with efficient value semantics.
+ */
+class cmFindPackageStack
+ : public cmConstStack<cmFindPackageCall, cmFindPackageStack>
+{
+ using cmConstStack::cmConstStack;
+ friend class cmConstStack<cmFindPackageCall, cmFindPackageStack>;
+};
+#ifndef cmFindPackageStack_cxx
+extern template class cmConstStack<cmFindPackageCall, cmFindPackageStack>;
+#endif
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index d51dbd0..4e46df7 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -175,14 +175,15 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingLinkExpression() const
cm::string_view property(this->Top()->Property);
return property == "LINK_DIRECTORIES"_s || property == "LINK_OPTIONS"_s ||
- property == "LINK_DEPENDS"_s || property == "LINK_LIBRARY_OVERRIDE"_s;
+ property == "LINK_DEPENDS"_s || property == "LINK_LIBRARY_OVERRIDE"_s ||
+ property == "LINKER_TYPE"_s;
}
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkOptionsExpression() const
{
cm::string_view property(this->Top()->Property);
- return property == "LINK_OPTIONS"_s;
+ return property == "LINK_OPTIONS"_s || property == "LINKER_TYPE"_s;
}
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkerLauncher() const
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 930922c..8c46124 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -868,6 +868,31 @@ cmValue cmGeneratorTarget::GetFeature(const std::string& feature,
return this->LocalGenerator->GetFeature(feature, config);
}
+std::string cmGeneratorTarget::GetLinkerTypeProperty(
+ std::string const& lang, std::string const& config) const
+{
+ std::string propName{ "LINKER_TYPE" };
+ auto linkerType = this->GetProperty(propName);
+ if (!linkerType.IsEmpty()) {
+ cmGeneratorExpressionDAGChecker dagChecker(this, propName, nullptr,
+ nullptr);
+ auto ltype =
+ cmGeneratorExpression::Evaluate(*linkerType, this->GetLocalGenerator(),
+ config, this, &dagChecker, this, lang);
+ if (this->IsDeviceLink()) {
+ cmList list{ ltype };
+ const auto DL_BEGIN = "<DEVICE_LINK>"_s;
+ const auto DL_END = "</DEVICE_LINK>"_s;
+ cm::erase_if(list, [&](const std::string& item) {
+ return item == DL_BEGIN || item == DL_END;
+ });
+ return list.to_string();
+ }
+ return ltype;
+ }
+ return std::string{};
+}
+
const char* cmGeneratorTarget::GetLinkPIEProperty(
const std::string& config) const
{
@@ -1808,32 +1833,31 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
AddInterfaceEntries(this, config, "INTERFACE_SOURCES", std::string(),
&dagChecker, linkInterfaceSourcesEntries,
IncludeRuntimeInterface::No, LinkInterfaceFor::Usage);
- std::vector<std::string>::size_type numFilesBefore = files.size();
bool contextDependentInterfaceSources = processSources(
this, linkInterfaceSourcesEntries, files, uniqueSrcs, debugSources);
// Collect TARGET_OBJECTS of direct object link-dependencies.
bool contextDependentObjects = false;
- std::vector<std::string>::size_type numFilesBefore2 = files.size();
if (this->GetType() != cmStateEnums::OBJECT_LIBRARY) {
EvaluatedTargetPropertyEntries linkObjectsEntries;
AddObjectEntries(this, config, &dagChecker, linkObjectsEntries);
contextDependentObjects = processSources(this, linkObjectsEntries, files,
uniqueSrcs, debugSources);
+ // Note that for imported targets or multi-config generators supporting
+ // cross-config builds the paths to the object files must be per-config,
+ // so contextDependentObjects will be true here even if object libraries
+ // are specified without per-config generator expressions.
}
// Collect this target's file sets.
- std::vector<std::string>::size_type numFilesBefore3 = files.size();
EvaluatedTargetPropertyEntries fileSetEntries;
AddFileSetEntries(this, config, &dagChecker, fileSetEntries);
bool contextDependentFileSets =
processSources(this, fileSetEntries, files, uniqueSrcs, debugSources);
// Determine if sources are context-dependent or not.
- if (!contextDependentDirectSources &&
- !(contextDependentInterfaceSources && numFilesBefore < files.size()) &&
- !(contextDependentObjects && numFilesBefore2 < files.size()) &&
- !(contextDependentFileSets && numFilesBefore3 < files.size())) {
+ if (!contextDependentDirectSources && !contextDependentInterfaceSources &&
+ !contextDependentObjects && !contextDependentFileSets) {
this->SourcesAreContextDependent = Tribool::False;
} else {
this->SourcesAreContextDependent = Tribool::True;
@@ -5515,6 +5539,50 @@ std::string cmGeneratorTarget::GetLinkerLanguage(
return this->GetLinkClosure(config)->LinkerLanguage;
}
+std::string cmGeneratorTarget::GetLinkerTool(const std::string& config) const
+{
+ return this->GetLinkerTool(this->GetLinkerLanguage(config), config);
+}
+
+std::string cmGeneratorTarget::GetLinkerTool(const std::string& lang,
+ const std::string& config) const
+{
+ auto usingLinker =
+ cmStrCat("CMAKE_", lang, "_USING_", this->IsDeviceLink() ? "DEVICE_" : "",
+ "LINKER_");
+ auto format = this->Makefile->GetDefinition(cmStrCat(usingLinker, "MODE"));
+ if (!format || format != "TOOL"_s) {
+ return this->Makefile->GetDefinition("CMAKE_LINKER");
+ }
+
+ auto linkerType = this->GetLinkerTypeProperty(lang, config);
+ if (linkerType.empty()) {
+ linkerType = "DEFAULT";
+ }
+ usingLinker = cmStrCat(usingLinker, linkerType);
+ auto linkerTool = this->Makefile->GetDefinition(usingLinker);
+
+ if (!linkerTool) {
+ if (this->GetGlobalGenerator()->IsVisualStudio() &&
+ linkerType == "DEFAULT"_s) {
+ return std::string{};
+ }
+
+ // fall-back to generic definition
+ linkerTool = this->Makefile->GetDefinition("CMAKE_LINKER");
+
+ if (linkerType != "DEFAULT"_s) {
+ this->LocalGenerator->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("LINKER_TYPE '", linkerType,
+ "' is unknown. Did you forgot to define '", usingLinker,
+ "' variable?"));
+ }
+ }
+
+ return linkerTool;
+}
+
std::string cmGeneratorTarget::GetPDBOutputName(
const std::string& config) const
{
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index bf49914..a32c5d8 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -205,6 +205,9 @@ public:
cmValue GetFeature(const std::string& feature,
const std::string& config) const;
+ std::string GetLinkerTypeProperty(std::string const& lang,
+ std::string const& config) const;
+
const char* GetLinkPIEProperty(const std::string& config) const;
bool IsIPOEnabled(std::string const& lang, std::string const& config) const;
@@ -788,6 +791,10 @@ public:
//! Return the preferred linker language for this target
std::string GetLinkerLanguage(const std::string& config) const;
+ //! Return the preferred linker tool for this target
+ std::string GetLinkerTool(const std::string& config) const;
+ std::string GetLinkerTool(const std::string& lang,
+ const std::string& config) const;
/** Does this target have a GNU implib to convert to MS format? */
bool HasImplibGNUtoMS(std::string const& config) const;
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 95e2187..940f49d 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -116,6 +116,19 @@ void cmGhsMultiTargetGenerator::Generate()
void cmGhsMultiTargetGenerator::GenerateTarget()
{
+ if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE &&
+ !this->GeneratorTarget
+ ->GetLinkerTypeProperty(
+ this->GeneratorTarget->GetLinkerLanguage(this->ConfigName),
+ this->ConfigName)
+ .empty()) {
+ // Green Hill MULTI does not support this feature.
+ cmSystemTools::Message(
+ cmStrCat("'LINKER_TYPE' property, specified on target '",
+ this->GeneratorTarget->GetName(),
+ "', is not supported by this generator."));
+ }
+
// Open the target file in copy-if-different mode.
std::string fproj =
cmStrCat(this->LocalGenerator->GetCurrentBinaryDirectory(), '/',
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index bec389f..b659c9b 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -694,7 +694,22 @@ void cmGlobalGenerator::EnableLanguage(
std::string includes =
mf->GetSafeDefinition("CMAKE_PROJECT_TOP_LEVEL_INCLUDES");
cmList includesList{ includes };
- for (std::string const& setupFile : includesList) {
+ for (std::string setupFile : includesList) {
+ // Any relative path without a .cmake extension is checked for valid
+ // cmake modules. This logic should be consistent with CMake's include()
+ // command. Otherwise default to checking relative path w.r.t. source
+ // directory
+ if (!cmSystemTools::FileIsFullPath(setupFile) &&
+ !cmHasLiteralSuffix(setupFile, ".cmake")) {
+ std::string mfile = mf->GetModulesFile(cmStrCat(setupFile, ".cmake"));
+ if (mfile.empty()) {
+ cmSystemTools::Error(cmStrCat(
+ "CMAKE_PROJECT_TOP_LEVEL_INCLUDES module:\n ", setupFile));
+ mf->GetState()->SetInTopLevelIncludes(false);
+ return;
+ }
+ setupFile = mfile;
+ }
std::string absSetupFile = cmSystemTools::CollapseFullPath(
setupFile, mf->GetCurrentSourceDirectory());
if (!cmSystemTools::FileExists(absSetupFile)) {
@@ -859,7 +874,11 @@ void cmGlobalGenerator::EnableLanguage(
noCompiler <<
"The " << compilerName << ":\n"
" " << *compilerFile << "\n"
- "is not a full path and was not found in the PATH.\n"
+ "is not a full path and was not found in the PATH."
+#ifdef _WIN32
+ " Perhaps the extension is missing?"
+#endif
+ "\n"
;
/* clang-format on */
} else if (!cmSystemTools::FileExists(*compilerFile)) {
@@ -2846,6 +2865,14 @@ void cmGlobalGenerator::AddGlobalTarget_Test(
gti.Name = this->GetTestTargetName();
gti.Message = "Running tests...";
gti.UsesTerminal = true;
+ // Unlike the 'install' target, the 'test' target does not depend on 'all'
+ // by default. Enable it only if CMAKE_SKIP_TEST_ALL_DEPENDENCY is
+ // explicitly set to OFF.
+ if (cmValue noall = mf->GetDefinition("CMAKE_SKIP_TEST_ALL_DEPENDENCY")) {
+ if (cmIsOff(noall)) {
+ gti.Depends.emplace_back(this->GetAllTargetName());
+ }
+ }
cmCustomCommandLine singleLine;
singleLine.push_back(cmSystemTools::GetCTestCommand());
singleLine.push_back("--force-new-ctest-process");
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index d691d88..9fac513 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -378,6 +378,15 @@ void cmGlobalNinjaGenerator::WriteCustomCommandBuild(
}
{
+ std::string ninjaDepfilePath;
+ bool depfileIsOutput = false;
+ if (!depfile.empty()) {
+ ninjaDepfilePath = this->ConvertToNinjaPath(depfile);
+ depfileIsOutput =
+ std::find(outputs.ExplicitOuts.begin(), outputs.ExplicitOuts.end(),
+ ninjaDepfilePath) != outputs.ExplicitOuts.end();
+ }
+
cmNinjaBuild build("CUSTOM_COMMAND");
build.Comment = comment;
build.Outputs = std::move(outputs.ExplicitOuts);
@@ -405,7 +414,13 @@ void cmGlobalNinjaGenerator::WriteCustomCommandBuild(
vars["pool"] = job_pool;
}
if (!depfile.empty()) {
- vars["depfile"] = depfile;
+ vars["depfile"] = ninjaDepfilePath;
+ // Add the depfile to the `.ninja_deps` database. Since this (generally)
+ // removes the file, it cannot be declared as an output or byproduct of
+ // the command.
+ if (!depfileIsOutput) {
+ vars["deps"] = "gcc";
+ }
}
if (config.empty()) {
this->WriteBuild(*this->GetCommonFileStream(), build);
@@ -1358,10 +1373,10 @@ void cmGlobalNinjaGenerator::AppendTargetDepends(
} else {
cmNinjaDeps outs;
- auto computeISPCOuputs = [](cmGlobalNinjaGenerator* gg,
- cmGeneratorTarget const* depTarget,
- cmNinjaDeps& outputDeps,
- const std::string& targetConfig) {
+ auto computeISPCOutputs = [](cmGlobalNinjaGenerator* gg,
+ cmGeneratorTarget const* depTarget,
+ cmNinjaDeps& outputDeps,
+ const std::string& targetConfig) {
if (depTarget->CanCompileSources()) {
auto headers = depTarget->GetGeneratedISPCHeaders(targetConfig);
if (!headers.empty()) {
@@ -1385,10 +1400,10 @@ void cmGlobalNinjaGenerator::AppendTargetDepends(
}
if (targetDep.IsCross()) {
this->AppendTargetOutputs(targetDep, outs, fileConfig, depends);
- computeISPCOuputs(this, targetDep, outs, fileConfig);
+ computeISPCOutputs(this, targetDep, outs, fileConfig);
} else {
this->AppendTargetOutputs(targetDep, outs, config, depends);
- computeISPCOuputs(this, targetDep, outs, config);
+ computeISPCOutputs(this, targetDep, outs, config);
}
}
std::sort(outs.begin(), outs.end());
@@ -3184,10 +3199,3 @@ std::string cmGlobalNinjaMultiGenerator::OrderDependsTargetForTarget(
return cmStrCat("cmake_object_order_depends_target_", target->GetName(), '_',
cmSystemTools::UpperCase(config));
}
-
-std::string cmGlobalNinjaMultiGenerator::OrderDependsTargetForTargetPrivate(
- cmGeneratorTarget const* target, const std::string& config) const
-{
- return cmStrCat(this->OrderDependsTargetForTarget(target, config),
- "_private");
-}
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index c5d6901..8f6c808 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -349,7 +349,7 @@ public:
virtual std::string OrderDependsTargetForTarget(
cmGeneratorTarget const* target, const std::string& config) const;
- virtual std::string OrderDependsTargetForTargetPrivate(
+ std::string OrderDependsTargetForTargetPrivate(
cmGeneratorTarget const* target, const std::string& config) const;
void AppendTargetOutputs(cmGeneratorTarget const* target,
@@ -741,9 +741,6 @@ public:
std::string OrderDependsTargetForTarget(
cmGeneratorTarget const* target, const std::string& config) const override;
- std::string OrderDependsTargetForTargetPrivate(
- cmGeneratorTarget const* target, const std::string& config) const override;
-
protected:
bool OpenBuildFileStreams() override;
void CloseBuildFileStreams() override;
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index cce45a3..2e6ed37 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2500,6 +2500,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
this->CurrentLocalGenerator->GetStaticLibraryFlags(
extraLinkOptions, configName, llang, gtgt);
} else {
+ this->CurrentLocalGenerator->AppendLinkerTypeFlags(extraLinkOptions, gtgt,
+ configName, llang);
+
cmValue targetLinkFlags = gtgt->GetProperty("LINK_FLAGS");
if (targetLinkFlags) {
this->CurrentLocalGenerator->AppendFlags(extraLinkOptions,
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 0fc4011..e2755da 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -2030,7 +2030,7 @@ bool HandleExportAndroidMKMode(std::vector<std::string> const& args,
cm::make_unique<cmInstallExportGenerator>(
&exportSet, ica.GetDestination(), ica.GetPermissions(),
ica.GetConfigurations(), ica.GetComponent(), message,
- ica.GetExcludeFromAll(), fname, name_space, "", exportOld, true,
+ ica.GetExcludeFromAll(), fname, name_space, "", exportOld, true, false,
helper.Makefile->GetBacktrace()));
return true;
@@ -2054,12 +2054,14 @@ bool HandleExportMode(std::vector<std::string> const& args,
bool exportOld = false;
std::string filename;
std::string cxx_modules_directory;
+ bool exportPackageDependencies = false;
ica.Bind("EXPORT"_s, exp);
ica.Bind("NAMESPACE"_s, name_space);
ica.Bind("EXPORT_LINK_INTERFACE_LIBRARIES"_s, exportOld);
ica.Bind("FILE"_s, filename);
ica.Bind("CXX_MODULES_DIRECTORY"_s, cxx_modules_directory);
+ ica.Bind("EXPORT_PACKAGE_DEPENDENCIES"_s, exportPackageDependencies);
std::vector<std::string> unknownArgs;
ica.Parse(args, &unknownArgs);
@@ -2147,7 +2149,8 @@ bool HandleExportMode(std::vector<std::string> const& args,
&exportSet, ica.GetDestination(), ica.GetPermissions(),
ica.GetConfigurations(), ica.GetComponent(), message,
ica.GetExcludeFromAll(), fname, name_space, cxx_modules_directory,
- exportOld, false, helper.Makefile->GetBacktrace()));
+ exportOld, false, exportPackageDependencies,
+ helper.Makefile->GetBacktrace()));
return true;
}
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 71d5471..72f0ac7 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -27,7 +27,7 @@ cmInstallExportGenerator::cmInstallExportGenerator(
std::string const& component, MessageLevel message, bool exclude_from_all,
std::string filename, std::string name_space,
std::string cxx_modules_directory, bool exportOld, bool android,
- cmListFileBacktrace backtrace)
+ bool exportPackageDependencies, cmListFileBacktrace backtrace)
: cmInstallGenerator(destination, configurations, component, message,
exclude_from_all, false, std::move(backtrace))
, ExportSet(exportSet)
@@ -36,6 +36,7 @@ cmInstallExportGenerator::cmInstallExportGenerator(
, Namespace(std::move(name_space))
, CxxModulesDirectory(std::move(cxx_modules_directory))
, ExportOld(exportOld)
+ , ExportPackageDependencies(exportPackageDependencies)
{
if (android) {
#ifndef CMAKE_BOOTSTRAP
@@ -119,6 +120,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os)
this->EFGen->AddConfiguration(c);
}
}
+ this->EFGen->SetExportPackageDependencies(this->ExportPackageDependencies);
this->EFGen->GenerateImportFile();
// Perform the main install script generation.
diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h
index f2d4a05..5f92851 100644
--- a/Source/cmInstallExportGenerator.h
+++ b/Source/cmInstallExportGenerator.h
@@ -29,7 +29,8 @@ public:
bool exclude_from_all, std::string filename,
std::string name_space,
std::string cxx_modules_directory, bool exportOld,
- bool android, cmListFileBacktrace backtrace);
+ bool android, bool exportPackageDependencies,
+ cmListFileBacktrace backtrace);
cmInstallExportGenerator(const cmInstallExportGenerator&) = delete;
~cmInstallExportGenerator() override;
@@ -70,6 +71,7 @@ protected:
std::string const Namespace;
std::string const CxxModulesDirectory;
bool const ExportOld;
+ bool const ExportPackageDependencies;
cmLocalGenerator* LocalGenerator = nullptr;
std::string TempDir;
diff --git a/Source/cmJSONState.cxx b/Source/cmJSONState.cxx
index 1abdaa6..5c44fba 100644
--- a/Source/cmJSONState.cxx
+++ b/Source/cmJSONState.cxx
@@ -45,7 +45,7 @@ cmJSONState::cmJSONState(const std::string& filename, Json::Value* root)
void cmJSONState::AddError(std::string const& errMsg)
{
- this->errors.push_back(Error(errMsg));
+ this->errors.emplace_back(errMsg);
}
void cmJSONState::AddErrorAtValue(std::string const& errMsg,
@@ -65,7 +65,7 @@ void cmJSONState::AddErrorAtOffset(std::string const& errMsg,
this->AddError(errMsg);
} else {
Location loc = LocateInDocument(offset);
- this->errors.push_back(Error(loc, errMsg));
+ this->errors.emplace_back(loc, errMsg);
}
}
@@ -118,7 +118,7 @@ const Json::Value* cmJSONState::value_after(std::string const& k)
void cmJSONState::push_stack(std::string const& k, const Json::Value* value)
{
- this->parseStack.push_back(JsonPair(k, value));
+ this->parseStack.emplace_back(k, value);
}
void cmJSONState::pop_stack()
diff --git a/Source/cmLinkItemGraphVisitor.cxx b/Source/cmLinkItemGraphVisitor.cxx
index 0ad846b..a63b794 100644
--- a/Source/cmLinkItemGraphVisitor.cxx
+++ b/Source/cmLinkItemGraphVisitor.cxx
@@ -82,7 +82,7 @@ bool cmLinkItemGraphVisitor::ItemVisited(cmLinkItem const& item)
bool cmLinkItemGraphVisitor::LinkVisited(cmLinkItem const& depender,
cmLinkItem const& dependee)
{
- auto const link = std::make_pair<>(depender.AsStr(), dependee.AsStr());
+ auto const link = std::make_pair(depender.AsStr(), dependee.AsStr());
bool const linkVisited =
this->VisitedLinks.find(link) != this->VisitedLinks.cend();
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index fe8d502..be18c29 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -82,7 +82,6 @@ static auto ruleReplaceVars = { "CMAKE_${LANG}_COMPILER",
"CMAKE_CURRENT_SOURCE_DIR",
"CMAKE_CURRENT_BINARY_DIR",
"CMAKE_RANLIB",
- "CMAKE_LINKER",
"CMAKE_MT",
"CMAKE_TAPI",
"CMAKE_CUDA_HOST_COMPILER",
@@ -1604,6 +1603,7 @@ void cmLocalGenerator::GetTargetFlags(
}
std::string extraLinkFlags;
+ this->AppendLinkerTypeFlags(extraLinkFlags, target, config, linkLanguage);
this->AppendPositionIndependentLinkerFlags(extraLinkFlags, target, config,
linkLanguage);
this->AppendIPOLinkerFlags(extraLinkFlags, target, config, linkLanguage);
@@ -3063,8 +3063,17 @@ cmLocalGenerator::AddUnityFilesModeAuto(
chunk = std::min(itemsLeft, batchSize);
- std::string filename = cmStrCat(filename_base, "unity_", batch,
- (lang == "C") ? "_c.c" : "_cxx.cxx");
+ std::string extension;
+ if (lang == "C") {
+ extension = "_c.c";
+ } else if (lang == "CXX") {
+ extension = "_cxx.cxx";
+ } else if (lang == "OBJC") {
+ extension = "_m.m";
+ } else if (lang == "OBJCXX") {
+ extension = "_mm.mm";
+ }
+ std::string filename = cmStrCat(filename_base, "unity_", batch, extension);
auto const begin = filtered_sources.begin() + batch * batchSize;
auto const end = begin + chunk;
unity_files.emplace_back(this->WriteUnitySource(
@@ -3155,7 +3164,7 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
cmValue afterInclude = target->GetProperty("UNITY_BUILD_CODE_AFTER_INCLUDE");
cmValue unityMode = target->GetProperty("UNITY_BUILD_MODE");
- for (std::string lang : { "C", "CXX" }) {
+ for (std::string lang : { "C", "CXX", "OBJC", "OBJCXX" }) {
std::vector<UnityBatchedSource> filtered_sources;
std::copy_if(unitySources.begin(), unitySources.end(),
std::back_inserter(filtered_sources),
@@ -3200,6 +3209,49 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
}
}
+void cmLocalGenerator::AppendLinkerTypeFlags(std::string& flags,
+ cmGeneratorTarget* target,
+ const std::string& config,
+ const std::string& linkLanguage)
+{
+ switch (target->GetType()) {
+ case cmStateEnums::EXECUTABLE:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
+ break;
+ default:
+ return;
+ }
+
+ auto usingLinker =
+ cmStrCat("CMAKE_", linkLanguage, "_USING_",
+ target->IsDeviceLink() ? "DEVICE_" : "", "LINKER_");
+
+ auto format = this->Makefile->GetDefinition(cmStrCat(usingLinker, "MODE"));
+ if (format && format != "FLAG"_s) {
+ return;
+ }
+
+ auto linkerType = target->GetLinkerTypeProperty(linkLanguage, config);
+ if (linkerType.empty()) {
+ linkerType = "DEFAULT";
+ }
+ usingLinker = cmStrCat(usingLinker, linkerType);
+ auto linkerTypeFlags = this->Makefile->GetDefinition(usingLinker);
+ if (linkerTypeFlags) {
+ if (!linkerTypeFlags.IsEmpty()) {
+ auto linkerFlags = cmExpandListWithBacktrace(linkerTypeFlags);
+ target->ResolveLinkerWrapper(linkerFlags, linkLanguage);
+ this->AppendFlags(flags, linkerFlags);
+ }
+ } else if (linkerType != "DEFAULT"_s) {
+ this->IssueMessage(MessageType::FATAL_ERROR,
+ cmStrCat("LINKER_TYPE '", linkerType,
+ "' is unknown. Did you forgot to define '",
+ usingLinker, "' variable?"));
+ }
+}
+
void cmLocalGenerator::AppendIPOLinkerFlags(std::string& flags,
cmGeneratorTarget* target,
const std::string& config,
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index a920cfe..a61def9 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -177,6 +177,9 @@ public:
void AddPchDependencies(cmGeneratorTarget* target);
void AddUnityBuild(cmGeneratorTarget* target);
virtual void AddXCConfigSources(cmGeneratorTarget* /* target */) {}
+ void AppendLinkerTypeFlags(std::string& flags, cmGeneratorTarget* target,
+ const std::string& config,
+ const std::string& linkLanguage);
void AppendIPOLinkerFlags(std::string& flags, cmGeneratorTarget* target,
const std::string& config,
const std::string& lang);
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 7b02c56..3f3779a 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -32,6 +32,7 @@
#include "cmList.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
+#include "cmMessageType.h"
#include "cmOutputConverter.h"
#include "cmPolicies.h"
#include "cmSourceFile.h"
@@ -1085,6 +1086,16 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
cmComputeLinkInformation& cli = *pcli;
std::string linkLanguage = cli.GetLinkLanguage();
+ if (!target->GetLinkerTypeProperty(linkLanguage, configName).empty()) {
+ // Visual Studio 10 or upper is required for this feature
+ this->GetCMakeInstance()->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("'LINKER_TYPE' property, specified on target '",
+ target->GetName(),
+ "', is not supported by this generator."),
+ target->GetBacktrace());
+ }
+
// Compute the variable name to lookup standard libraries for this
// language.
std::string standardLibsVar =
@@ -1161,6 +1172,16 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
cmComputeLinkInformation& cli = *pcli;
std::string linkLanguage = cli.GetLinkLanguage();
+ if (!target->GetLinkerTypeProperty(linkLanguage, configName).empty()) {
+ // Visual Studio 10 or upper is required for this feature
+ this->GetCMakeInstance()->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("'LINKER_TYPE' property, specified on target '",
+ target->GetName(),
+ "', is not supported by this generator."),
+ target->GetBacktrace());
+ }
+
bool isWin32Executable = target->IsWin32Executable(configName);
// Compute the variable name to lookup standard libraries for this
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 4a190db..aafef44 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -302,6 +302,11 @@ cmListFileBacktrace cmMakefile::GetBacktrace() const
return this->Backtrace;
}
+cmFindPackageStack cmMakefile::GetFindPackageStack() const
+{
+ return this->FindPackageStack;
+}
+
void cmMakefile::PrintCommandTrace(cmListFileFunction const& lff,
cmListFileBacktrace const& bt,
CommandMissingFromStack missing) const
@@ -1215,8 +1220,8 @@ cmTarget* cmMakefile::AddCustomCommandToTarget(
// Dispatch command creation to allow generator expressions in outputs.
this->AddGeneratorAction(
std::move(cc),
- [=](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
- std::unique_ptr<cmCustomCommand> tcc) {
+ [this, t, type](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
+ std::unique_ptr<cmCustomCommand> tcc) {
BacktraceGuard guard(this->Backtrace, lfbt);
tcc->SetBacktrace(lfbt);
detail::AddCustomCommandToTarget(lg, cmCommandOrigin::Project, t, type,
@@ -1254,8 +1259,9 @@ void cmMakefile::AddCustomCommandToOutput(
// Dispatch command creation to allow generator expressions in outputs.
this->AddGeneratorAction(
std::move(cc),
- [=](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
- std::unique_ptr<cmCustomCommand> tcc) {
+ [this, replace, callback](cmLocalGenerator& lg,
+ const cmListFileBacktrace& lfbt,
+ std::unique_ptr<cmCustomCommand> tcc) {
BacktraceGuard guard(this->Backtrace, lfbt);
tcc->SetBacktrace(lfbt);
cmSourceFile* sf = detail::AddCustomCommandToOutput(
@@ -1341,7 +1347,8 @@ void cmMakefile::AppendCustomCommandToOutput(
if (this->ValidateCustomCommand(commandLines)) {
// Dispatch command creation to allow generator expressions in outputs.
this->AddGeneratorAction(
- [=](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt) {
+ [this, output, depends, implicit_depends,
+ commandLines](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt) {
BacktraceGuard guard(this->Backtrace, lfbt);
detail::AppendCustomCommandToOutput(lg, lfbt, output, depends,
implicit_depends, commandLines);
@@ -1372,8 +1379,8 @@ cmTarget* cmMakefile::AddUtilityCommand(const std::string& utilityName,
// Dispatch command creation to allow generator expressions in outputs.
this->AddGeneratorAction(
std::move(cc),
- [=](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
- std::unique_ptr<cmCustomCommand> tcc) {
+ [this, target](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
+ std::unique_ptr<cmCustomCommand> tcc) {
BacktraceGuard guard(this->Backtrace, lfbt);
tcc->SetBacktrace(lfbt);
detail::AddUtilityCommand(lg, cmCommandOrigin::Project, target,
@@ -4630,12 +4637,13 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
}
// Deprecate old policies.
- if (status == cmPolicies::OLD && id <= cmPolicies::CMP0120 &&
+ if (status == cmPolicies::OLD && id <= cmPolicies::CMP0126 &&
!(this->GetCMakeInstance()->GetIsInTryCompile() &&
(
// Policies set by cmCoreTryCompile::TryCompileCode.
id == cmPolicies::CMP0065 || id == cmPolicies::CMP0083 ||
- id == cmPolicies::CMP0091 || id == cmPolicies::CMP0104)) &&
+ id == cmPolicies::CMP0091 || id == cmPolicies::CMP0104 ||
+ id == cmPolicies::CMP0123 || id == cmPolicies::CMP0126)) &&
(!this->IsSet("CMAKE_WARN_DEPRECATED") ||
this->IsOn("CMAKE_WARN_DEPRECATED"))) {
this->IssueMessage(MessageType::DEPRECATION_WARNING,
@@ -4768,6 +4776,36 @@ cmMakefile::MacroPushPop::~MacroPushPop()
this->Makefile->PopMacroScope(this->ReportError);
}
+cmMakefile::FindPackageStackRAII::FindPackageStackRAII(cmMakefile* mf,
+ std::string const& name)
+ : Makefile(mf)
+{
+ this->Makefile->FindPackageStack =
+ this->Makefile->FindPackageStack.Push(cmFindPackageCall{
+ name,
+ this->Makefile->FindPackageStackNextIndex,
+ });
+ this->Makefile->FindPackageStackNextIndex++;
+}
+
+cmMakefile::FindPackageStackRAII::~FindPackageStackRAII()
+{
+ this->Makefile->FindPackageStackNextIndex =
+ this->Makefile->FindPackageStack.Top().Index + 1;
+ this->Makefile->FindPackageStack = this->Makefile->FindPackageStack.Pop();
+
+ if (!this->Makefile->FindPackageStack.Empty()) {
+ auto top = this->Makefile->FindPackageStack.Top();
+ this->Makefile->FindPackageStack = this->Makefile->FindPackageStack.Pop();
+
+ top.Index = this->Makefile->FindPackageStackNextIndex;
+ this->Makefile->FindPackageStackNextIndex++;
+
+ this->Makefile->FindPackageStack =
+ this->Makefile->FindPackageStack.Push(top);
+ }
+}
+
cmMakefile::DebugFindPkgRAII::DebugFindPkgRAII(cmMakefile* mf,
std::string const& pkg)
: Makefile(mf)
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 24daa72..e5edbae 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -25,6 +25,7 @@
#include "cmAlgorithms.h"
#include "cmCustomCommand.h"
+#include "cmFindPackageStack.h"
#include "cmFunctionBlocker.h"
#include "cmListFileCache.h"
#include "cmMessageType.h" // IWYU pragma: keep
@@ -660,6 +661,11 @@ public:
cmListFileBacktrace GetBacktrace() const;
/**
+ * Get the current stack of find_package calls.
+ */
+ cmFindPackageStack GetFindPackageStack() const;
+
+ /**
* Get the vector of files created by this makefile
*/
const std::vector<std::string>& GetOutputFiles() const
@@ -1020,6 +1026,15 @@ public:
// searches
std::deque<std::vector<std::string>> FindPackageRootPathStack;
+ class FindPackageStackRAII
+ {
+ cmMakefile* Makefile;
+
+ public:
+ FindPackageStackRAII(cmMakefile* mf, std::string const& pkg);
+ ~FindPackageStackRAII();
+ };
+
class DebugFindPkgRAII
{
cmMakefile* Makefile;
@@ -1210,6 +1225,9 @@ private:
std::vector<BT<GeneratorAction>> GeneratorActions;
bool GeneratorActionsInvoked = false;
+ cmFindPackageStack FindPackageStack;
+ unsigned int FindPackageStackNextIndex = 0;
+
bool DebugFindPkg = false;
bool CheckSystemVars;
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 4a2b9e8..96a0d5c 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -344,6 +344,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
return;
}
+ auto linker = this->GeneratorTarget->GetLinkerTool(this->GetConfigName());
+
// Build list of dependencies.
std::vector<std::string> depends;
this->AppendLinkDepends(depends, linkLanguage);
@@ -533,6 +535,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
vars.CMTargetType =
cmState::GetTargetTypeName(this->GeneratorTarget->GetType()).c_str();
vars.Language = linkLanguage.c_str();
+ vars.Linker = linker.c_str();
vars.AIXExports = aixExports.c_str();
vars.Objects = buildObjs.c_str();
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index fc3caa1..0429155 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -441,6 +441,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
return;
}
+ auto linker = this->GeneratorTarget->GetLinkerTool(this->GetConfigName());
+
// Build list of dependencies.
std::vector<std::string> depends;
this->AppendLinkDepends(depends, linkLanguage);
@@ -766,6 +768,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
vars.CMTargetType =
cmState::GetTargetTypeName(this->GeneratorTarget->GetType()).c_str();
vars.Language = linkLanguage.c_str();
+ vars.Linker = linker.c_str();
vars.AIXExports = aixExports.c_str();
vars.Objects = buildObjs.c_str();
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 0c2a719..343f6b8 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -153,6 +153,8 @@ void cmMakefileTargetGenerator::GetTargetLinkFlags(
this->LocalGenerator->AppendCompileOptions(flags, opts);
this->LocalGenerator->SetLinkScriptShell(false);
+ this->LocalGenerator->AppendLinkerTypeFlags(
+ flags, this->GeneratorTarget, this->GetConfigName(), linkLanguage);
this->LocalGenerator->AppendPositionIndependentLinkerFlags(
flags, this->GeneratorTarget, this->GetConfigName(), linkLanguage);
this->LocalGenerator->AppendDependencyInfoLinkerFlags(
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 48c30b6..5e7bb6e 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -294,6 +294,9 @@ void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkRule(
.c_str();
vars.Language = "CUDA";
+ std::string linker =
+ this->GetGeneratorTarget()->GetLinkerTool("CUDA", config);
+ vars.Linker = linker.c_str();
// build response file name
std::string responseFlag = this->GetMakefile()->GetSafeDefinition(
@@ -400,6 +403,9 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRules(
vars.Fatbinary = "$FATBIN";
vars.RegisterFile = "$REGISTER";
vars.LinkFlags = "$LINK_FLAGS";
+ std::string linker =
+ this->GetGeneratorTarget()->GetLinkerTool("CUDA", config);
+ vars.Linker = linker.c_str();
std::string flags = this->GetFlags("CUDA", config);
vars.Flags = flags.c_str();
@@ -441,6 +447,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile,
vars.CMTargetName = this->GetGeneratorTarget()->GetName().c_str();
vars.CMTargetType = cmState::GetTargetTypeName(targetType).c_str();
+ std::string linker = this->GetGeneratorTarget()->GetLinkerTool(config);
+ vars.Linker = linker.c_str();
std::string lang = this->TargetLinkLanguage(config);
vars.Language = lang.c_str();
vars.AIXExports = "$AIX_EXPORTS";
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index dabb078..5a674e7 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -1416,10 +1416,13 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
}
}
+ this->SetMsvcTargetPdbVariable(vars, config);
+
if (firstForConfig) {
this->ExportObjectCompileCommand(
language, sourceFilePath, objectDir, objectFileName, objectFileDir,
- vars["FLAGS"], vars["DEFINES"], vars["INCLUDES"], config);
+ vars["FLAGS"], vars["DEFINES"], vars["INCLUDES"],
+ vars["TARGET_COMPILE_PDB"], vars["TARGET_PDB"], config);
}
objBuild.Outputs.push_back(objectFileName);
@@ -1614,8 +1617,6 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
}
}
- this->SetMsvcTargetPdbVariable(vars, config);
-
objBuild.RspFile = cmStrCat(objectFileName, ".rsp");
if (language == "ISPC") {
@@ -1766,10 +1767,13 @@ void cmNinjaTargetGenerator::WriteCxxModuleBmiBuildStatement(
vars["CLANG_TIDY_EXPORT_FIXES"] = fixesFile;
}
+ this->SetMsvcTargetPdbVariable(vars, config);
+
if (firstForConfig) {
this->ExportObjectCompileCommand(
language, sourceFilePath, bmiDir, bmiFileName, bmiFileDir, vars["FLAGS"],
- vars["DEFINES"], vars["INCLUDES"], config);
+ vars["DEFINES"], vars["INCLUDES"], vars["TARGET_COMPILE_PDB"],
+ vars["TARGET_PDB"], config);
}
bmiBuild.Outputs.push_back(bmiFileName);
@@ -1840,8 +1844,6 @@ void cmNinjaTargetGenerator::WriteCxxModuleBmiBuildStatement(
this->addPoolNinjaVariable("JOB_POOL_COMPILE", this->GetGeneratorTarget(),
vars);
- this->SetMsvcTargetPdbVariable(vars, config);
-
bmiBuild.RspFile = cmStrCat(bmiFileName, ".rsp");
this->GetGlobalGenerator()->WriteBuild(this->GetImplFileStream(fileConfig),
@@ -1973,6 +1975,7 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
std::string const& objectDir, std::string const& objectFileName,
std::string const& objectFileDir, std::string const& flags,
std::string const& defines, std::string const& includes,
+ std::string const& targetCompilePdb, std::string const& targetPdb,
std::string const& outputConfig)
{
if (!this->GeneratorTarget->GetPropertyAsBool("EXPORT_COMPILE_COMMANDS")) {
@@ -2023,6 +2026,8 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
compileObjectVars.Flags = fullFlags.c_str();
compileObjectVars.Defines = defines.c_str();
compileObjectVars.Includes = includes.c_str();
+ compileObjectVars.TargetCompilePDB = targetCompilePdb.c_str();
+ compileObjectVars.TargetPDB = targetPdb.c_str();
// Rule for compiling object file.
std::string cudaCompileMode;
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 3f56113..2131f6d 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -189,6 +189,7 @@ protected:
std::string const& objectDir, std::string const& objectFileName,
std::string const& objectFileDir, std::string const& flags,
std::string const& defines, std::string const& includes,
+ std::string const& targetCompilePdb, std::string const& targetPdb,
std::string const& outputConfig);
void AdditionalCleanFiles(const std::string& config);
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 8838de4..8aace68 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -473,7 +473,11 @@ class cmMakefile;
SELECT(POLICY, CMP0155, \
"C++ sources in targets with at least C++20 are scanned for " \
"imports when supported.", \
- 3, 28, 0, cmPolicies::WARN)
+ 3, 28, 0, cmPolicies::WARN) \
+ SELECT( \
+ POLICY, CMP0156, \
+ "De-duplicate libraries on link lines based on linker capabilities.", 3, \
+ 29, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \
@@ -513,7 +517,8 @@ class cmMakefile;
F(CMP0131) \
F(CMP0142) \
F(CMP0154) \
- F(CMP0155)
+ F(CMP0155) \
+ F(CMP0156)
#define CM_FOR_EACH_CUSTOM_COMMAND_POLICY(F) \
F(CMP0116) \
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 3aef299..53166c1 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -11,6 +11,7 @@
#include "cmsys/RegularExpression.hxx"
#include "cmExecutionStatus.h"
+#include "cmList.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
@@ -371,29 +372,55 @@ static bool IncludeByVariable(cmExecutionStatus& status,
if (!include) {
return true;
}
+ cmList includeFiles{ *include };
+
+ bool failed = false;
+ for (auto filePath : includeFiles) {
+ // Any relative path without a .cmake extension is checked for valid cmake
+ // modules. This logic should be consistent with CMake's include() command.
+ // Otherwise default to checking relative path w.r.t. source directory
+ if (!cmSystemTools::FileIsFullPath(filePath) &&
+ !cmHasLiteralSuffix(filePath, ".cmake")) {
+ std::string mfile = mf.GetModulesFile(cmStrCat(filePath, ".cmake"));
+ if (mfile.empty()) {
+ status.SetError(
+ cmStrCat("could not find requested module:\n ", filePath));
+ failed = true;
+ continue;
+ }
+ filePath = mfile;
+ }
+ std::string includeFile = cmSystemTools::CollapseFullPath(
+ filePath, mf.GetCurrentSourceDirectory());
+ if (!cmSystemTools::FileExists(includeFile)) {
+ status.SetError(
+ cmStrCat("could not find requested file:\n ", filePath));
+ failed = true;
+ continue;
+ }
+ if (cmSystemTools::FileIsDirectory(includeFile)) {
+ status.SetError(
+ cmStrCat("requested file is a directory:\n ", filePath));
+ failed = true;
+ continue;
+ }
- std::string includeFile =
- cmSystemTools::CollapseFullPath(*include, mf.GetCurrentSourceDirectory());
- if (!cmSystemTools::FileExists(includeFile)) {
- status.SetError(cmStrCat("could not find requested file:\n ", *include));
- return false;
- }
- if (cmSystemTools::FileIsDirectory(includeFile)) {
- status.SetError(cmStrCat("requested file is a directory:\n ", *include));
- return false;
- }
+ const bool readit = mf.ReadDependentFile(filePath);
+ if (readit) {
+ // If the included file ran successfully, continue to the next file
+ continue;
+ }
- const bool readit = mf.ReadDependentFile(*include);
- if (readit) {
- return true;
- }
+ if (cmSystemTools::GetFatalErrorOccurred()) {
+ failed = true;
+ continue;
+ }
- if (cmSystemTools::GetFatalErrorOccurred()) {
- return true;
+ status.SetError(cmStrCat("could not load requested file:\n ", filePath));
+ failed = true;
}
-
- status.SetError(cmStrCat("could not load requested file:\n ", *include));
- return false;
+ // At this point all files were processed
+ return !failed;
}
static void TopLevelCMakeVarCondSet(cmMakefile& mf, std::string const& name,
diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx
index adbdba8..0a394b5 100644
--- a/Source/cmQtAutoGen.cxx
+++ b/Source/cmQtAutoGen.cxx
@@ -76,13 +76,6 @@ static void MergeOptions(std::vector<std::string>& baseOpts,
unsigned int const cmQtAutoGen::ParallelMax = 64;
-#ifdef _WIN32
-// Actually 32767 (see
-// https://devblogs.microsoft.com/oldnewthing/20031210-00/?p=41553) but we
-// allow for a small margin
-size_t const cmQtAutoGen::CommandLineLengthMax = 32000;
-#endif
-
cm::string_view cmQtAutoGen::GeneratorName(GenT genType)
{
switch (genType) {
diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h
index d111422..5a23ae9 100644
--- a/Source/cmQtAutoGen.h
+++ b/Source/cmQtAutoGen.h
@@ -64,11 +64,6 @@ public:
/// @brief Maximum number of parallel threads/processes in a generator
static unsigned int const ParallelMax;
-#ifdef _WIN32
- /// @brief Maximum number of characters on command line
- static size_t const CommandLineLengthMax;
-#endif
-
/// @brief Returns the generator name
static cm::string_view GeneratorName(GenT genType);
/// @brief Returns the generator name in upper case
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 81752a6..39ac1b4 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -485,6 +485,38 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
}
}
+#ifdef _WIN32
+ {
+ const auto& value =
+ this->GenTarget->GetProperty("AUTOGEN_COMMAND_LINE_LENGTH_MAX");
+ if (value.IsSet()) {
+ using maxCommandLineLengthType =
+ decltype(this->AutogenTarget.MaxCommandLineLength);
+ unsigned long propInt = 0;
+ if (cmStrToULong(value, &propInt) && propInt > 0 &&
+ propInt <= std::numeric_limits<maxCommandLineLengthType>::max()) {
+ this->AutogenTarget.MaxCommandLineLength =
+ static_cast<maxCommandLineLengthType>(propInt);
+ } else {
+ // Warn the project author that AUTOGEN_PARALLEL is not valid.
+ this->Makefile->IssueMessage(
+ MessageType::AUTHOR_WARNING,
+ cmStrCat("AUTOGEN_COMMAND_LINE_LENGTH_MAX=\"", *value,
+ "\" for target \"", this->GenTarget->GetName(),
+ "\" is not valid. Using no limit for "
+ "AUTOGEN_COMMAND_LINE_LENGTH_MAX"));
+ this->AutogenTarget.MaxCommandLineLength =
+ std::numeric_limits<maxCommandLineLengthType>::max();
+ }
+ } else {
+ // Actually 32767 (see
+ // https://devblogs.microsoft.com/oldnewthing/20031210-00/?p=41553) but
+ // we allow for a small margin
+ this->AutogenTarget.MaxCommandLineLength = 32000;
+ }
+ }
+#endif
+
// Autogen target info and settings files
{
// Info file
@@ -1692,6 +1724,10 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
// General
info.SetBool("MULTI_CONFIG", this->MultiConfig);
info.SetUInt("PARALLEL", this->AutogenTarget.Parallel);
+#ifdef _WIN32
+ info.SetUInt("AUTOGEN_COMMAND_LINE_LENGTH_MAX",
+ this->AutogenTarget.MaxCommandLineLength);
+#endif
info.SetUInt("VERBOSITY", this->Verbosity);
// Directories
diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h
index a44d33f..3f7ab9f 100644
--- a/Source/cmQtAutoGenInitializer.h
+++ b/Source/cmQtAutoGenInitializer.h
@@ -5,6 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <cstddef>
+#include <limits>
#include <memory>
#include <set>
#include <string>
@@ -194,6 +195,8 @@ private:
bool GlobalTarget = false;
// Settings
unsigned int Parallel = 1;
+ unsigned int MaxCommandLineLength =
+ std::numeric_limits<unsigned int>::max();
// Configuration files
std::string InfoFile;
ConfigString SettingsFile;
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index ece657d..a49125e 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -5,6 +5,7 @@
#include <algorithm>
#include <atomic>
#include <cstddef>
+#include <limits>
#include <map>
#include <mutex>
#include <set>
@@ -172,6 +173,8 @@ public:
bool MultiConfig = false;
IntegerVersion QtVersion = { 4, 0 };
unsigned int ThreadCount = 0;
+ unsigned int MaxCommandLineLength =
+ std::numeric_limits<unsigned int>::max();
// - Directories
std::string AutogenBuildDir;
std::string AutogenIncludeDir;
@@ -190,7 +193,7 @@ public:
{
public:
// -- Parse Cache
- std::atomic<bool> ParseCacheChanged = ATOMIC_VAR_INIT(false);
+ std::atomic<bool> ParseCacheChanged{ false };
cmFileTime ParseCacheTime;
ParseCacheT ParseCache;
@@ -333,6 +336,13 @@ public:
std::vector<std::string> const& command,
std::string const& output) const;
+ /*
+ * Check if command line exceeds maximum length supported by OS
+ * (if on Windows) and switch to using a response file instead.
+ */
+ void MaybeWriteResponseFile(std::string const& outputFile,
+ std::vector<std::string>& cmd) const;
+
/** @brief Run an external process. Use only during Process() call! */
bool RunProcess(GenT genType, cmWorkerPool::ProcessResultT& result,
std::vector<std::string> const& command,
@@ -498,10 +508,6 @@ public:
protected:
ParseCacheT::FileHandleT CacheEntry;
-
- private:
- void MaybeWriteMocResponseFile(std::string const& outputFile,
- std::vector<std::string>& cmd) const;
};
/** uic compiles a file. */
@@ -583,7 +589,7 @@ private:
std::string SettingsStringMoc_;
std::string SettingsStringUic_;
// -- Worker thread pool
- std::atomic<bool> JobError_ = ATOMIC_VAR_INIT(false);
+ std::atomic<bool> JobError_{ false };
cmWorkerPool WorkerPool_;
// -- Concurrent processing
mutable std::mutex CMakeLibMutex_;
@@ -795,6 +801,51 @@ void cmQtAutoMocUicT::JobT::LogCommandError(
this->Gen()->Log().ErrorCommand(genType, message, command, output);
}
+/*
+ * Check if command line exceeds maximum length supported by OS
+ * (if on Windows) and switch to using a response file instead.
+ */
+void cmQtAutoMocUicT::JobT::MaybeWriteResponseFile(
+ std::string const& outputFile, std::vector<std::string>& cmd) const
+{
+#ifdef _WIN32
+ // Ensure cmd is less than CommandLineLengthMax characters
+ size_t commandLineLength = cmd.size(); // account for separating spaces
+ for (std::string const& str : cmd) {
+ commandLineLength += str.length();
+ }
+ if (commandLineLength >= this->BaseConst().MaxCommandLineLength) {
+ // Command line exceeds maximum size allowed by OS
+ // => create response file
+ std::string const responseFile = cmStrCat(outputFile, ".rsp");
+
+ cmsys::ofstream fout(responseFile.c_str());
+ if (!fout) {
+ this->LogError(
+ GenT::MOC,
+ cmStrCat("AUTOMOC was unable to create a response file at\n ",
+ this->MessagePath(responseFile)));
+ return;
+ }
+
+ auto it = cmd.begin();
+ while (++it != cmd.end()) {
+ fout << *it << "\n";
+ }
+ fout.close();
+
+ // Keep all but executable
+ cmd.resize(1);
+
+ // Specify response file
+ cmd.emplace_back(cmStrCat('@', responseFile));
+ }
+#else
+ static_cast<void>(outputFile);
+ static_cast<void>(cmd);
+#endif
+}
+
bool cmQtAutoMocUicT::JobT::RunProcess(GenT genType,
cmWorkerPool::ProcessResultT& result,
std::vector<std::string> const& command,
@@ -836,6 +887,8 @@ void cmQtAutoMocUicT::JobMocPredefsT::Process()
cm::append(cmd, this->MocConst().OptionsDefinitions);
// Add includes
cm::append(cmd, this->MocConst().OptionsIncludes);
+ // Check if response file is necessary
+ MaybeWriteResponseFile(this->MocConst().PredefsFileAbs, cmd);
// Execute command
if (!this->RunProcess(GenT::MOC, result, cmd, reason.get())) {
this->LogCommandError(GenT::MOC,
@@ -2034,7 +2087,7 @@ void cmQtAutoMocUicT::JobCompileMocT::Process()
// Add source file
cmd.push_back(sourceFile);
- MaybeWriteMocResponseFile(outputFile, cmd);
+ MaybeWriteResponseFile(outputFile, cmd);
}
// Execute moc command
@@ -2080,51 +2133,6 @@ void cmQtAutoMocUicT::JobCompileMocT::Process()
}
}
-/*
- * Check if command line exceeds maximum length supported by OS
- * (if on Windows) and switch to using a response file instead.
- */
-void cmQtAutoMocUicT::JobCompileMocT::MaybeWriteMocResponseFile(
- std::string const& outputFile, std::vector<std::string>& cmd) const
-{
-#ifdef _WIN32
- // Ensure cmd is less than CommandLineLengthMax characters
- size_t commandLineLength = cmd.size(); // account for separating spaces
- for (std::string const& str : cmd) {
- commandLineLength += str.length();
- }
- if (commandLineLength >= CommandLineLengthMax) {
- // Command line exceeds maximum size allowed by OS
- // => create response file
- std::string const responseFile = cmStrCat(outputFile, ".rsp");
-
- cmsys::ofstream fout(responseFile.c_str());
- if (!fout) {
- this->LogError(
- GenT::MOC,
- cmStrCat("AUTOMOC was unable to create a response file at\n ",
- this->MessagePath(responseFile)));
- return;
- }
-
- auto it = cmd.begin();
- while (++it != cmd.end()) {
- fout << *it << "\n";
- }
- fout.close();
-
- // Keep all but executable
- cmd.resize(1);
-
- // Specify response file
- cmd.emplace_back(cmStrCat('@', responseFile));
- }
-#else
- static_cast<void>(outputFile);
- static_cast<void>(cmd);
-#endif
-}
-
void cmQtAutoMocUicT::JobCompileUicT::Process()
{
std::string const& sourceFile = this->Mapping->SourceFile->FileName;
@@ -2377,6 +2385,10 @@ bool cmQtAutoMocUicT::InitFromInfo(InfoT const& info)
!info.GetUInt("QT_VERSION_MINOR", this->BaseConst_.QtVersion.Minor,
true) ||
!info.GetUInt("PARALLEL", this->BaseConst_.ThreadCount, false) ||
+#ifdef _WIN32
+ !info.GetUInt("AUTOGEN_COMMAND_LINE_LENGTH_MAX",
+ this->BaseConst_.MaxCommandLineLength, false) ||
+#endif
!info.GetString("BUILD_DIR", this->BaseConst_.AutogenBuildDir, true) ||
!info.GetStringConfig("INCLUDE_DIR", this->BaseConst_.AutogenIncludeDir,
true) ||
diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx
index 638bb42..a8c81d0 100644
--- a/Source/cmRulePlaceholderExpander.cxx
+++ b/Source/cmRulePlaceholderExpander.cxx
@@ -27,6 +27,19 @@ std::string cmRulePlaceholderExpander::ExpandVariable(
return this->ReplaceValues->LinkFlags;
}
}
+ if (this->ReplaceValues->Linker) {
+ if (variable == "CMAKE_LINKER") {
+ auto result = this->OutputConverter->ConvertToOutputForExisting(
+ this->ReplaceValues->Linker);
+ if (this->ReplaceValues->Launcher) {
+ // Add launcher as part of expansion so that it always appears
+ // immediately before the command itself, regardless of whether the
+ // overall rule template contains other content at the front.
+ result = cmStrCat(this->ReplaceValues->Launcher, " ", result);
+ }
+ return result;
+ }
+ }
if (this->ReplaceValues->Manifests) {
if (variable == "MANIFESTS") {
return this->ReplaceValues->Manifests;
@@ -325,17 +338,7 @@ std::string cmRulePlaceholderExpander::ExpandVariable(
auto mapIt = this->VariableMappings.find(variable);
if (mapIt != this->VariableMappings.end()) {
if (variable.find("_FLAG") == std::string::npos) {
- std::string ret =
- this->OutputConverter->ConvertToOutputForExisting(mapIt->second);
-
- if (this->ReplaceValues->Launcher && variable == "CMAKE_LINKER") {
- // Add launcher as part of expansion so that it always appears
- // immediately before the command itself, regardless of whether the
- // overall rule template contains other content at the front.
- ret = cmStrCat(this->ReplaceValues->Launcher, " ", ret);
- }
-
- return ret;
+ return this->OutputConverter->ConvertToOutputForExisting(mapIt->second);
}
return mapIt->second;
}
diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h
index 5d1f199..225abd4 100644
--- a/Source/cmRulePlaceholderExpander.h
+++ b/Source/cmRulePlaceholderExpander.h
@@ -53,6 +53,7 @@ public:
const char* SONameFlag = nullptr;
const char* TargetSOName = nullptr;
const char* TargetInstallNameDir = nullptr;
+ const char* Linker = nullptr;
const char* LinkFlags = nullptr;
const char* Manifests = nullptr;
const char* LanguageCompileFlags = nullptr;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index abbf29e..663c9d4 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -20,6 +20,7 @@
#include "cmAlgorithms.h"
#include "cmCustomCommand.h"
#include "cmFileSet.h"
+#include "cmFindPackageStack.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
@@ -456,6 +457,7 @@ TargetProperty const StaticTargetProperties[] = {
{ "AUTORCC_EXECUTABLE"_s, IC::CanCompileSources },
// Linking properties
+ { "LINKER_TYPE"_s, IC::CanCompileSources },
{ "ENABLE_EXPORTS"_s, IC::TargetWithSymbolExports },
{ "LINK_LIBRARIES_ONLY_TARGETS"_s, IC::NormalNonImportedTarget },
{ "LINK_SEARCH_START_STATIC"_s, IC::CanCompileSources },
@@ -549,6 +551,7 @@ TargetProperty const StaticTargetProperties[] = {
{ "ANDROID_PROCESS_MAX"_s, IC::CanCompileSources },
{ "ANDROID_SKIP_ANT_STEP"_s, IC::CanCompileSources },
// -- Autogen
+ { "AUTOGEN_COMMAND_LINE_LENGTH_MAX"_s, IC::CanCompileSources },
{ "AUTOGEN_ORIGIN_DEPENDS"_s, IC::CanCompileSources },
{ "AUTOGEN_PARALLEL"_s, IC::CanCompileSources },
{ "AUTOGEN_USE_SYSTEM_INCLUDE"_s, IC::CanCompileSources },
@@ -584,6 +587,7 @@ TargetProperty const StaticTargetProperties[] = {
// Usage requirement properties
{ "LINK_INTERFACE_LIBRARIES"_s, IC::CanCompileSources },
{ "MAP_IMPORTED_CONFIG_"_s, IC::NormalTarget, R::PerConfig },
+ { "EXPORT_FIND_PACKAGE_NAME"_s, IC::NormalTarget },
// Metadata
{ "CROSSCOMPILING_EMULATOR"_s, IC::ExecutableTarget },
@@ -660,6 +664,7 @@ public:
TLLCommands;
std::map<std::string, cmFileSet> FileSets;
cmListFileBacktrace Backtrace;
+ cmFindPackageStack FindPackageStack;
UsageRequirementProperty IncludeDirectories;
UsageRequirementProperty CompileOptions;
@@ -960,6 +965,9 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
// Save the backtrace of target construction.
this->impl->Backtrace = this->impl->Makefile->GetBacktrace();
+ if (this->impl->IsImported()) {
+ this->impl->FindPackageStack = this->impl->Makefile->GetFindPackageStack();
+ }
if (this->IsNormal()) {
// Initialize the INCLUDE_DIRECTORIES property based on the current value
@@ -1247,6 +1255,11 @@ cmListFileBacktrace const& cmTarget::GetBacktrace() const
return this->impl->Backtrace;
}
+cmFindPackageStack const& cmTarget::GetFindPackageStack() const
+{
+ return this->impl->FindPackageStack;
+}
+
bool cmTarget::IsExecutableWithExports() const
{
return (this->GetType() == cmStateEnums::EXECUTABLE &&
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 584856a..385dfe7 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -24,6 +24,7 @@
class cmCustomCommand;
class cmFileSet;
+class cmFindPackageStack;
class cmGlobalGenerator;
class cmInstallTargetGenerator;
class cmMakefile;
@@ -239,6 +240,9 @@ public:
//! Get a backtrace from the creation of the target.
cmListFileBacktrace const& GetBacktrace() const;
+ //! Get a find_package call stack from the creation of the target.
+ cmFindPackageStack const& GetFindPackageStack() const;
+
void InsertInclude(BT<std::string> const& entry, bool before = false);
void InsertCompileOption(BT<std::string> const& entry, bool before = false);
void InsertCompileDefinition(BT<std::string> const& entry);
diff --git a/Source/cmTargetExport.h b/Source/cmTargetExport.h
index 1cef888..caeb54d 100644
--- a/Source/cmTargetExport.h
+++ b/Source/cmTargetExport.h
@@ -4,6 +4,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <map>
#include <string>
class cmFileSet;
@@ -37,4 +38,5 @@ public:
///@}
bool NamelinkOnly = false;
+ std::string XcFrameworkLocation;
};
diff --git a/Source/cmTransformDepfile.cxx b/Source/cmTransformDepfile.cxx
index 914172b..ffc4de9 100644
--- a/Source/cmTransformDepfile.cxx
+++ b/Source/cmTransformDepfile.cxx
@@ -16,6 +16,9 @@
#include "cmGccDepfileReaderTypes.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
+#include "cmMakefile.h"
+#include "cmMessageType.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
namespace {
@@ -121,6 +124,10 @@ bool cmTransformDepfile(cmDepfileFormat format, const cmLocalGenerator& lg,
return false;
}
content = *std::move(result);
+ } else {
+ lg.GetMakefile()->IssueMessage(
+ MessageType::WARNING,
+ cmStrCat("Expected depfile does not exist.\n ", infile));
}
cmSystemTools::MakeDirectory(cmSystemTools::GetFilenamePath(outfile));
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 4860d9a..1bbd934 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2996,6 +2996,16 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions(
e1.WritePlatformConfigTag(
"IntDir", cond, R"($(Platform)\$(Configuration)\$(ProjectName)\)");
} else {
+ if (ttype == cmStateEnums::SHARED_LIBRARY ||
+ ttype == cmStateEnums::MODULE_LIBRARY ||
+ ttype == cmStateEnums::EXECUTABLE) {
+ auto linker = this->GeneratorTarget->GetLinkerTool(config);
+ if (!linker.empty()) {
+ ConvertToWindowsSlash(linker);
+ e1.WritePlatformConfigTag("LinkToolExe", cond, linker);
+ }
+ }
+
std::string intermediateDir = cmStrCat(
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget), '/',
config, '/');
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 6188134..9dd2e6c 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -137,14 +137,18 @@ bool cmVisualStudioGeneratorOptions::IsManaged() const
bool cmVisualStudioGeneratorOptions::UsingUnicode() const
{
// Look for a _UNICODE definition.
- return std::any_of(this->Defines.begin(), this->Defines.end(),
- [](std::string const& di) { return di == "_UNICODE"_s; });
+ return std::any_of(
+ this->Defines.begin(), this->Defines.end(), [](std::string const& di) {
+ return di == "_UNICODE"_s || cmHasLiteralPrefix(di, "_UNICODE=");
+ });
}
bool cmVisualStudioGeneratorOptions::UsingSBCS() const
{
// Look for a _SBCS definition.
- return std::any_of(this->Defines.begin(), this->Defines.end(),
- [](std::string const& di) { return di == "_SBCS"_s; });
+ return std::any_of(
+ this->Defines.begin(), this->Defines.end(), [](std::string const& di) {
+ return di == "_SBCS"_s || cmHasLiteralPrefix(di, "_SBCS=");
+ });
}
void cmVisualStudioGeneratorOptions::FixCudaCodeGeneration()
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 43a945f..93b0086 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -203,11 +203,16 @@ bool cmTarFilesFrom(std::string const& file, std::vector<std::string>& files)
void cmCatFile(const std::string& fileToAppend)
{
#ifdef _WIN32
+ _setmode(fileno(stdin), _O_BINARY);
_setmode(fileno(stdout), _O_BINARY);
#endif
- cmsys::ifstream source(fileToAppend.c_str(),
- (std::ios::binary | std::ios::in));
- std::cout << source.rdbuf();
+ std::streambuf* buf = std::cin.rdbuf();
+ cmsys::ifstream source;
+ if (fileToAppend != "-") {
+ source.open(fileToAppend.c_str(), (std::ios::binary | std::ios::in));
+ buf = source.rdbuf();
+ }
+ std::cout << buf;
}
bool cmRemoveDirectory(const std::string& dir, bool recursive = true)
@@ -1147,7 +1152,12 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args,
int return_value = 0;
bool doing_options = true;
for (auto const& arg : cmMakeRange(args).advance(2)) {
- if (doing_options && cmHasLiteralPrefix(arg, "-")) {
+ if (arg == "-") {
+ doing_options = false;
+ // Destroy console buffers to drop cout/cerr encoding transform.
+ consoleBuf.reset();
+ cmCatFile(arg);
+ } else if (doing_options && cmHasLiteralPrefix(arg, "-")) {
if (arg == "--") {
doing_options = false;
} else {
diff --git a/Tests/Architecture/bar.c b/Tests/Architecture/bar.c
index 37946c7..18ddb78 100644
--- a/Tests/Architecture/bar.c
+++ b/Tests/Architecture/bar.c
@@ -1,5 +1,5 @@
extern int foo(void);
-int main()
+int main(void)
{
return foo();
}
diff --git a/Tests/BuildDepends/Project/link_depends_no_shared_exe.c b/Tests/BuildDepends/Project/link_depends_no_shared_exe.c
index cfaf051..8830776 100644
--- a/Tests/BuildDepends/Project/link_depends_no_shared_exe.c
+++ b/Tests/BuildDepends/Project/link_depends_no_shared_exe.c
@@ -3,7 +3,7 @@
__declspec(dllimport)
#endif
int link_depends_no_shared_lib(void);
-int main()
+int main(void)
{
return link_depends_no_shared_lib() + link_depends_no_shared_exe_value;
}
diff --git a/Tests/CMakeCommands/target_compile_definitions/consumer.c b/Tests/CMakeCommands/target_compile_definitions/consumer.c
index bb65e01..08554f4 100644
--- a/Tests/CMakeCommands/target_compile_definitions/consumer.c
+++ b/Tests/CMakeCommands/target_compile_definitions/consumer.c
@@ -39,6 +39,6 @@
# error Expected LANG_IS_C_OR_CXX
#endif
-void consumer_c()
+void consumer_c(void)
{
}
diff --git a/Tests/CMakeCommands/target_compile_features/main.c b/Tests/CMakeCommands/target_compile_features/main.c
index 76e98c4..60f0f9e 100644
--- a/Tests/CMakeCommands/target_compile_features/main.c
+++ b/Tests/CMakeCommands/target_compile_features/main.c
@@ -6,7 +6,7 @@ int foo(int* restrict a, int* restrict b)
return 0;
}
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/CMakeCommands/target_compile_features/restrict_user.c b/Tests/CMakeCommands/target_compile_features/restrict_user.c
index 76c956f..42e3efb 100644
--- a/Tests/CMakeCommands/target_compile_features/restrict_user.c
+++ b/Tests/CMakeCommands/target_compile_features/restrict_user.c
@@ -8,7 +8,7 @@ int bar(int* restrict a, int* restrict b)
return foo(a, b);
}
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/CMakeCommands/target_compile_options/consumer.c b/Tests/CMakeCommands/target_compile_options/consumer.c
index f9b6654..0984166 100644
--- a/Tests/CMakeCommands/target_compile_options/consumer.c
+++ b/Tests/CMakeCommands/target_compile_options/consumer.c
@@ -35,6 +35,6 @@
# endif
#endif
-void consumer_c()
+void consumer_c(void)
{
}
diff --git a/Tests/CMakeCommands/target_include_directories/consumer.c b/Tests/CMakeCommands/target_include_directories/consumer.c
index 7fd694b..1975050 100644
--- a/Tests/CMakeCommands/target_include_directories/consumer.c
+++ b/Tests/CMakeCommands/target_include_directories/consumer.c
@@ -15,7 +15,7 @@
# endif
#endif
-int consumer_c()
+int consumer_c(void)
{
return 0;
}
diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt
index b44c8dd..0e71cea 100644
--- a/Tests/CMakeLib/CMakeLists.txt
+++ b/Tests/CMakeLib/CMakeLists.txt
@@ -42,6 +42,7 @@ if(CMake_ENABLE_DEBUGGER)
testDebuggerVariables.cxx
testDebuggerVariablesHelper.cxx
testDebuggerVariablesManager.cxx
+ testDebuggerThread.cxx
)
endif()
if (CMake_TEST_FILESYSTEM_PATH OR NOT CMake_HAVE_CXX_FILESYSTEM)
diff --git a/Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeLists.txt b/Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeLists.txt
index e47b9db..f3de7e1 100644
--- a/Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeLists.txt
+++ b/Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeLists.txt
@@ -1,7 +1,7 @@
# A dummy checker implementation that does not write the requested output file
# so it triggers an error for every checker.
-file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ret0.c.in" "int main(){return 0;}\n")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ret0.c.in" "int main(void){return 0;}\n")
configure_file(
"${CMAKE_CURRENT_BINARY_DIR}/ret0.c.in"
diff --git a/Tests/CMakeLib/testDebuggerThread.cxx b/Tests/CMakeLib/testDebuggerThread.cxx
new file mode 100644
index 0000000..0ea95b6
--- /dev/null
+++ b/Tests/CMakeLib/testDebuggerThread.cxx
@@ -0,0 +1,33 @@
+#include <functional>
+#include <memory>
+#include <string>
+#include <vector>
+
+#include <cm3p/cppdap/protocol.h>
+#include <cm3p/cppdap/types.h>
+
+#include "cmDebuggerThread.h"
+#include "cmListFileCache.h"
+
+#include "testCommon.h"
+
+static bool testStackFrameFunctionName()
+{
+ auto thread = std::make_shared<cmDebugger::cmDebuggerThread>(0, "name");
+ const auto* functionName = "function_name";
+ auto arguments = std::vector<cmListFileArgument>{};
+ cmListFileFunction func(functionName, 10, 20, arguments);
+ thread->PushStackFrame(nullptr, "CMakeLists.txt", func);
+
+ auto stackTrace = GetStackTraceResponse(thread);
+
+ ASSERT_TRUE(stackTrace.stackFrames[0].name == functionName);
+ return true;
+}
+
+int testDebuggerThread(int, char*[])
+{
+ return runTests(std::vector<std::function<bool()>>{
+ testStackFrameFunctionName,
+ });
+}
diff --git a/Tests/COnly/conly.c b/Tests/COnly/conly.c
index 2ae8a1a..c5f18ad 100644
--- a/Tests/COnly/conly.c
+++ b/Tests/COnly/conly.c
@@ -4,7 +4,7 @@
#include "libc1.h"
#include "libc2.h"
-int main()
+int main(void)
{
int class = 0;
if (LibC1Func() != 2.0) {
diff --git a/Tests/COnly/libc1.c b/Tests/COnly/libc1.c
index b01e1e1..e1f7e27 100644
--- a/Tests/COnly/libc1.c
+++ b/Tests/COnly/libc1.c
@@ -1,4 +1,4 @@
-float LibC1Func()
+float LibC1Func(void)
{
return 2.0;
}
diff --git a/Tests/COnly/libc2.c b/Tests/COnly/libc2.c
index 0fd8956..28d46f3 100644
--- a/Tests/COnly/libc2.c
+++ b/Tests/COnly/libc2.c
@@ -1,6 +1,6 @@
#include "libc2.h"
-float LibC2Func()
+float LibC2Func(void)
{
return 1.0;
}
diff --git a/Tests/CPackInnoSetupGenerator/main.c b/Tests/CPackInnoSetupGenerator/main.c
index 413899c..9165c97 100644
--- a/Tests/CPackInnoSetupGenerator/main.c
+++ b/Tests/CPackInnoSetupGenerator/main.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-int main()
+int main(void)
{
printf("Hello, World!\n");
return 42;
diff --git a/Tests/CTestTestVerboseOutput/nop.c b/Tests/CTestTestVerboseOutput/nop.c
index f8b643a..8488f4e 100644
--- a/Tests/CTestTestVerboseOutput/nop.c
+++ b/Tests/CTestTestVerboseOutput/nop.c
@@ -1,4 +1,4 @@
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/CommandLength/test.c b/Tests/CommandLength/test.c
index f8b643a..8488f4e 100644
--- a/Tests/CommandLength/test.c
+++ b/Tests/CommandLength/test.c
@@ -1,4 +1,4 @@
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/CompileDefinitions/runtest.c b/Tests/CompileDefinitions/runtest.c
index c6dac4d..37317b8 100644
--- a/Tests/CompileDefinitions/runtest.c
+++ b/Tests/CompileDefinitions/runtest.c
@@ -6,7 +6,7 @@
# error "BUILD_CONFIG_NAME not defined!"
#endif
-int main()
+int main(void)
{
char build_config_name[] = BUILD_CONFIG_NAME;
char* c;
diff --git a/Tests/CompileFeatures/c_variadic_macros.c b/Tests/CompileFeatures/c_variadic_macros.c
index 4da111e..7a21902 100644
--- a/Tests/CompileFeatures/c_variadic_macros.c
+++ b/Tests/CompileFeatures/c_variadic_macros.c
@@ -9,7 +9,7 @@ int someFunc(int i1, char c, int i2)
#define FUNC_WRAPPER(...) someFunc(__VA_ARGS__)
-void otherFunc()
+void otherFunc(void)
{
FUNC_WRAPPER(42, 'a', 7);
}
diff --git a/Tests/CompileFeatures/default_dialect.c b/Tests/CompileFeatures/default_dialect.c
index c696c83..cae107b 100644
--- a/Tests/CompileFeatures/default_dialect.c
+++ b/Tests/CompileFeatures/default_dialect.c
@@ -26,7 +26,7 @@
# endif
#endif
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/CompileFeatures/genex_test.c b/Tests/CompileFeatures/genex_test.c
index de408ce..8ccad35 100644
--- a/Tests/CompileFeatures/genex_test.c
+++ b/Tests/CompileFeatures/genex_test.c
@@ -38,6 +38,6 @@
# endif
#endif
-int main()
+int main(void)
{
}
diff --git a/Tests/Complex/Executable/Sub1/NameConflictTest.c b/Tests/Complex/Executable/Sub1/NameConflictTest.c
index 8720386..740c236 100644
--- a/Tests/Complex/Executable/Sub1/NameConflictTest.c
+++ b/Tests/Complex/Executable/Sub1/NameConflictTest.c
@@ -1,4 +1,4 @@
-int NameConflictTest1()
+int NameConflictTest1(void)
{
return 0;
}
diff --git a/Tests/Complex/Executable/Sub2/NameConflictTest.c b/Tests/Complex/Executable/Sub2/NameConflictTest.c
index 4a32572..cee9f6f 100644
--- a/Tests/Complex/Executable/Sub2/NameConflictTest.c
+++ b/Tests/Complex/Executable/Sub2/NameConflictTest.c
@@ -1,4 +1,4 @@
-int NameConflictTest2()
+int NameConflictTest2(void)
{
return 0;
}
diff --git a/Tests/Complex/Library/TestLink.c b/Tests/Complex/Library/TestLink.c
index 25dee08..f4bc255 100644
--- a/Tests/Complex/Library/TestLink.c
+++ b/Tests/Complex/Library/TestLink.c
@@ -1,4 +1,4 @@
-int TestLinkGetType()
+int TestLinkGetType(void)
{
#ifdef CMakeTestLinkShared_EXPORTS
return 0;
diff --git a/Tests/Complex/Library/testConly.c b/Tests/Complex/Library/testConly.c
index eb933a2..05ecc18 100644
--- a/Tests/Complex/Library/testConly.c
+++ b/Tests/Complex/Library/testConly.c
@@ -2,7 +2,7 @@
#include <stdio.h>
-int CsharedFunction()
+int CsharedFunction(void)
{
#ifndef TEST_C_FLAGS
printf("TEST_C_FLAGS failed\n");
diff --git a/Tests/ComplexOneConfig/Executable/Sub1/NameConflictTest.c b/Tests/ComplexOneConfig/Executable/Sub1/NameConflictTest.c
index 8720386..740c236 100644
--- a/Tests/ComplexOneConfig/Executable/Sub1/NameConflictTest.c
+++ b/Tests/ComplexOneConfig/Executable/Sub1/NameConflictTest.c
@@ -1,4 +1,4 @@
-int NameConflictTest1()
+int NameConflictTest1(void)
{
return 0;
}
diff --git a/Tests/ComplexOneConfig/Executable/Sub2/NameConflictTest.c b/Tests/ComplexOneConfig/Executable/Sub2/NameConflictTest.c
index 4a32572..cee9f6f 100644
--- a/Tests/ComplexOneConfig/Executable/Sub2/NameConflictTest.c
+++ b/Tests/ComplexOneConfig/Executable/Sub2/NameConflictTest.c
@@ -1,4 +1,4 @@
-int NameConflictTest2()
+int NameConflictTest2(void)
{
return 0;
}
diff --git a/Tests/ComplexOneConfig/Library/TestLink.c b/Tests/ComplexOneConfig/Library/TestLink.c
index 25dee08..f4bc255 100644
--- a/Tests/ComplexOneConfig/Library/TestLink.c
+++ b/Tests/ComplexOneConfig/Library/TestLink.c
@@ -1,4 +1,4 @@
-int TestLinkGetType()
+int TestLinkGetType(void)
{
#ifdef CMakeTestLinkShared_EXPORTS
return 0;
diff --git a/Tests/ComplexOneConfig/Library/testConly.c b/Tests/ComplexOneConfig/Library/testConly.c
index eb933a2..05ecc18 100644
--- a/Tests/ComplexOneConfig/Library/testConly.c
+++ b/Tests/ComplexOneConfig/Library/testConly.c
@@ -2,7 +2,7 @@
#include <stdio.h>
-int CsharedFunction()
+int CsharedFunction(void)
{
#ifndef TEST_C_FLAGS
printf("TEST_C_FLAGS failed\n");
diff --git a/Tests/ConfigSources/CMakeLists.txt b/Tests/ConfigSources/CMakeLists.txt
index 38475f8..770afb3 100644
--- a/Tests/ConfigSources/CMakeLists.txt
+++ b/Tests/ConfigSources/CMakeLists.txt
@@ -154,7 +154,15 @@ else()
endif()
add_library(OneConfigOnly OBJECT "$<$<CONFIG:${one_config}>:${CMAKE_CURRENT_SOURCE_DIR}/iface_src.cpp>")
set_property(TARGET OneConfigOnly PROPERTY LINKER_LANGUAGE CXX)
+add_executable(ConfigSourcesUseOne main_one_config.cpp)
+target_compile_definitions(ConfigSourcesUseOne PRIVATE "$<$<CONFIG:${one_config}>:CFG_ONE>")
+target_link_libraries(ConfigSourcesUseOne PRIVATE "$<$<CONFIG:${one_config}>:OneConfigOnly>")
+add_library(OneConfigOnlyIface INTERFACE)
+target_sources(OneConfigOnlyIface INTERFACE "$<$<CONFIG:${one_config}>:${CMAKE_CURRENT_SOURCE_DIR}/iface_src.cpp>")
+add_executable(ConfigSourcesUseOneIface main_one_config.cpp)
+target_compile_definitions(ConfigSourcesUseOneIface PRIVATE "$<$<CONFIG:${one_config}>:CFG_ONE>")
+target_link_libraries(ConfigSourcesUseOneIface PRIVATE "$<$<CONFIG:${one_config}>:OneConfigOnlyIface>")
# ---------------------------------------------------------------------------
# Makes sure that each configuration uses the correct generated file.
diff --git a/Tests/ConfigSources/main_one_config.cpp b/Tests/ConfigSources/main_one_config.cpp
new file mode 100644
index 0000000..318944b
--- /dev/null
+++ b/Tests/ConfigSources/main_one_config.cpp
@@ -0,0 +1,8 @@
+#include "iface.h"
+int main()
+{
+#ifdef CFG_ONE
+ iface_src();
+#endif
+ return 0;
+}
diff --git a/Tests/Cuda/WithC/main.c b/Tests/Cuda/WithC/main.c
index 5f3c781..ed64427 100644
--- a/Tests/Cuda/WithC/main.c
+++ b/Tests/Cuda/WithC/main.c
@@ -4,7 +4,7 @@ extern int use_cuda(void);
# include <windows.h>
#endif
-int main()
+int main(void)
{
#ifdef _WIN32
/* Use an API that requires CMake's "standard" C libraries. */
diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt
index b7ce5a1..32940eb 100644
--- a/Tests/CudaOnly/CMakeLists.txt
+++ b/Tests/CudaOnly/CMakeLists.txt
@@ -15,6 +15,7 @@ add_cuda_test_macro(CudaOnly.Standard98 CudaOnlyStandard98)
add_cuda_test_macro(CudaOnly.Toolkit CudaOnlyToolkit)
add_cuda_test_macro(CudaOnly.ToolkitBeforeLang CudaOnlyToolkitBeforeLang)
add_cuda_test_macro(CudaOnly.ToolkitMultipleDirs CudaOnlyToolkitMultipleDirs)
+add_cuda_test_macro(CudaOnly.TryCompileTargetStatic CudaOnlyTryCompileTargetStatic)
add_cuda_test_macro(CudaOnly.WithDefs CudaOnlyWithDefs)
add_cuda_test_macro(CudaOnly.CircularLinkLine CudaOnlyCircularLinkLine)
add_cuda_test_macro(CudaOnly.ResolveDeviceSymbols CudaOnlyResolveDeviceSymbols)
diff --git a/Tests/CudaOnly/TryCompileTargetStatic/CMakeLists.txt b/Tests/CudaOnly/TryCompileTargetStatic/CMakeLists.txt
new file mode 100644
index 0000000..340c1c9
--- /dev/null
+++ b/Tests/CudaOnly/TryCompileTargetStatic/CMakeLists.txt
@@ -0,0 +1,6 @@
+cmake_minimum_required(VERSION 3.25)
+
+set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+project(TryCompileTargetStatic LANGUAGES CUDA)
+
+add_executable(CudaOnlyTryCompileTargetStatic main.cu)
diff --git a/Tests/CudaOnly/TryCompileTargetStatic/main.cu b/Tests/CudaOnly/TryCompileTargetStatic/main.cu
new file mode 100644
index 0000000..766b775
--- /dev/null
+++ b/Tests/CudaOnly/TryCompileTargetStatic/main.cu
@@ -0,0 +1,5 @@
+
+int main()
+{
+ return 0;
+}
diff --git a/Tests/CustomCommand/gen_redirect_in.c b/Tests/CustomCommand/gen_redirect_in.c
index 6af364b..c71123a 100644
--- a/Tests/CustomCommand/gen_redirect_in.c
+++ b/Tests/CustomCommand/gen_redirect_in.c
@@ -1,6 +1,6 @@
#if 1
-int gen_redirect()
+int gen_redirect(void)
{
return 3;
}
diff --git a/Tests/CustomCommandWorkingDirectory/customTarget.c b/Tests/CustomCommandWorkingDirectory/customTarget.c
index 8dbf0d4..9735287 100644
--- a/Tests/CustomCommandWorkingDirectory/customTarget.c
+++ b/Tests/CustomCommandWorkingDirectory/customTarget.c
@@ -1,4 +1,4 @@
-int customTarget()
+int customTarget(void)
{
return 0;
}
diff --git a/Tests/Dependency/1/OneSrc.c b/Tests/Dependency/1/OneSrc.c
index 9801c25..7f527f4 100644
--- a/Tests/Dependency/1/OneSrc.c
+++ b/Tests/Dependency/1/OneSrc.c
@@ -1,3 +1,3 @@
-void OneFunction()
+void OneFunction(void)
{
}
diff --git a/Tests/Dependency/Case1/a.c b/Tests/Dependency/Case1/a.c
index 262f523..bf1c773 100644
--- a/Tests/Dependency/Case1/a.c
+++ b/Tests/Dependency/Case1/a.c
@@ -1,4 +1,4 @@
-int a()
+int a(void)
{
return 5;
}
diff --git a/Tests/Dependency/Case1/b.c b/Tests/Dependency/Case1/b.c
index deda685..f4ef707 100644
--- a/Tests/Dependency/Case1/b.c
+++ b/Tests/Dependency/Case1/b.c
@@ -1,6 +1,6 @@
-extern int a();
+extern int a(void);
-int b()
+int b(void)
{
return a() + 17;
}
diff --git a/Tests/Dependency/Case1/b2.c b/Tests/Dependency/Case1/b2.c
index f341da7..108e76a 100644
--- a/Tests/Dependency/Case1/b2.c
+++ b/Tests/Dependency/Case1/b2.c
@@ -1,4 +1,4 @@
-int b2()
+int b2(void)
{
return 3;
}
diff --git a/Tests/Dependency/Case1/c.c b/Tests/Dependency/Case1/c.c
index a3ec162..ddda855 100644
--- a/Tests/Dependency/Case1/c.c
+++ b/Tests/Dependency/Case1/c.c
@@ -1,6 +1,6 @@
-extern int b();
+extern int b(void);
-int c()
+int c(void)
{
return b() + 42;
}
diff --git a/Tests/Dependency/Case1/c2.c b/Tests/Dependency/Case1/c2.c
index 317bb0f..826c746 100644
--- a/Tests/Dependency/Case1/c2.c
+++ b/Tests/Dependency/Case1/c2.c
@@ -1,6 +1,6 @@
-extern int b2();
+extern int b2(void);
-int c2()
+int c2(void)
{
return b2() + 1;
}
diff --git a/Tests/Dependency/Case1/d.c b/Tests/Dependency/Case1/d.c
index f67aef7..fdeb2bf 100644
--- a/Tests/Dependency/Case1/d.c
+++ b/Tests/Dependency/Case1/d.c
@@ -1,6 +1,6 @@
-extern int c2();
+extern int c2(void);
-int d()
+int d(void)
{
return c2() + 2;
}
diff --git a/Tests/Dependency/Case1/main.c b/Tests/Dependency/Case1/main.c
index 07191cc..6847f7d 100644
--- a/Tests/Dependency/Case1/main.c
+++ b/Tests/Dependency/Case1/main.c
@@ -2,7 +2,7 @@ extern int b();
extern int c();
extern int d();
-int main()
+int main(void)
{
c();
b();
diff --git a/Tests/Dependency/Case4/bar.c b/Tests/Dependency/Case4/bar.c
index 08092f9..18ddb78 100644
--- a/Tests/Dependency/Case4/bar.c
+++ b/Tests/Dependency/Case4/bar.c
@@ -1,5 +1,5 @@
-extern int foo();
-int main()
+extern int foo(void);
+int main(void)
{
return foo();
}
diff --git a/Tests/Dependency/Case4/foo.c b/Tests/Dependency/Case4/foo.c
index e05eb7e..c83d856 100644
--- a/Tests/Dependency/Case4/foo.c
+++ b/Tests/Dependency/Case4/foo.c
@@ -1,4 +1,4 @@
-int foo()
+int foo(void)
{
return 0;
}
diff --git a/Tests/Dependency/Eight/EightSrc.c b/Tests/Dependency/Eight/EightSrc.c
index 7bfa481..16605ce 100644
--- a/Tests/Dependency/Eight/EightSrc.c
+++ b/Tests/Dependency/Eight/EightSrc.c
@@ -1,6 +1,6 @@
-void SevenFunction();
+void SevenFunction(void);
-void EightFunction()
+void EightFunction(void)
{
SevenFunction();
}
diff --git a/Tests/Dependency/Exec/ExecMain.c b/Tests/Dependency/Exec/ExecMain.c
index 9572afd..793bc18 100644
--- a/Tests/Dependency/Exec/ExecMain.c
+++ b/Tests/Dependency/Exec/ExecMain.c
@@ -5,7 +5,7 @@ void NoDepCFunction();
void SixAFunction();
void SixBFunction();
-int main()
+int main(void)
{
SixAFunction();
SixBFunction();
diff --git a/Tests/Dependency/Exec2/ExecMain.c b/Tests/Dependency/Exec2/ExecMain.c
index 385cce1..085f30f 100644
--- a/Tests/Dependency/Exec2/ExecMain.c
+++ b/Tests/Dependency/Exec2/ExecMain.c
@@ -3,7 +3,7 @@
void FiveFunction();
void EightFunction();
-int main()
+int main(void)
{
FiveFunction();
EightFunction();
diff --git a/Tests/Dependency/Exec3/ExecMain.c b/Tests/Dependency/Exec3/ExecMain.c
index 385cce1..085f30f 100644
--- a/Tests/Dependency/Exec3/ExecMain.c
+++ b/Tests/Dependency/Exec3/ExecMain.c
@@ -3,7 +3,7 @@
void FiveFunction();
void EightFunction();
-int main()
+int main(void)
{
FiveFunction();
EightFunction();
diff --git a/Tests/Dependency/Exec4/ExecMain.c b/Tests/Dependency/Exec4/ExecMain.c
index 0cfcce9..48552d3 100644
--- a/Tests/Dependency/Exec4/ExecMain.c
+++ b/Tests/Dependency/Exec4/ExecMain.c
@@ -3,7 +3,7 @@
void FiveFunction();
void TwoFunction();
-int main()
+int main(void)
{
FiveFunction();
TwoFunction();
diff --git a/Tests/Dependency/Five/FiveSrc.c b/Tests/Dependency/Five/FiveSrc.c
index 33d8ad7..b35b05b 100644
--- a/Tests/Dependency/Five/FiveSrc.c
+++ b/Tests/Dependency/Five/FiveSrc.c
@@ -1,6 +1,6 @@
-void TwoFunction();
+void TwoFunction(void);
-void FiveFunction()
+void FiveFunction(void)
{
TwoFunction();
}
diff --git a/Tests/Dependency/Four/FourSrc.c b/Tests/Dependency/Four/FourSrc.c
index 4ea996d..b91c5fd 100644
--- a/Tests/Dependency/Four/FourSrc.c
+++ b/Tests/Dependency/Four/FourSrc.c
@@ -1,9 +1,9 @@
#include <two-test.h> /* Requires TwoCustom to be built first. */
-void NoDepAFunction();
-void OneFunction();
-void TwoFunction();
+void NoDepAFunction(void);
+void OneFunction(void);
+void TwoFunction(void);
-void FourFunction()
+void FourFunction(void)
{
static int count = 0;
if (count == 0) {
diff --git a/Tests/Dependency/NoDepA/NoDepASrc.c b/Tests/Dependency/NoDepA/NoDepASrc.c
index 8c4072b..e972df2 100644
--- a/Tests/Dependency/NoDepA/NoDepASrc.c
+++ b/Tests/Dependency/NoDepA/NoDepASrc.c
@@ -1,3 +1,3 @@
-void NoDepAFunction()
+void NoDepAFunction(void)
{
}
diff --git a/Tests/Dependency/NoDepB/NoDepBSrc.c b/Tests/Dependency/NoDepB/NoDepBSrc.c
index ddc71c5..81dc5ed 100644
--- a/Tests/Dependency/NoDepB/NoDepBSrc.c
+++ b/Tests/Dependency/NoDepB/NoDepBSrc.c
@@ -1,6 +1,6 @@
-void NoDepAFunction();
+void NoDepAFunction(void);
-void NoDepBFunction()
+void NoDepBFunction(void)
{
NoDepAFunction();
}
diff --git a/Tests/Dependency/NoDepC/NoDepCSrc.c b/Tests/Dependency/NoDepC/NoDepCSrc.c
index b478c59..d90007e 100644
--- a/Tests/Dependency/NoDepC/NoDepCSrc.c
+++ b/Tests/Dependency/NoDepC/NoDepCSrc.c
@@ -1,6 +1,6 @@
-void NoDepAFunction();
+void NoDepAFunction(void);
-void NoDepCFunction()
+void NoDepCFunction(void)
{
NoDepAFunction();
}
diff --git a/Tests/Dependency/Seven/SevenSrc.c b/Tests/Dependency/Seven/SevenSrc.c
index e1f3329..9c74ec8 100644
--- a/Tests/Dependency/Seven/SevenSrc.c
+++ b/Tests/Dependency/Seven/SevenSrc.c
@@ -1,6 +1,6 @@
-void TwoFunction();
+void TwoFunction(void);
-void SevenFunction()
+void SevenFunction(void)
{
TwoFunction();
}
diff --git a/Tests/Dependency/Six/SixASrc.c b/Tests/Dependency/Six/SixASrc.c
index 7ea3711..ddd2d7d 100644
--- a/Tests/Dependency/Six/SixASrc.c
+++ b/Tests/Dependency/Six/SixASrc.c
@@ -1,7 +1,7 @@
-void FiveFunction();
-void TwoFunction();
+void FiveFunction(void);
+void TwoFunction(void);
-void SixAFunction()
+void SixAFunction(void)
{
FiveFunction();
TwoFunction();
diff --git a/Tests/Dependency/Six/SixBSrc.c b/Tests/Dependency/Six/SixBSrc.c
index 92f9607..42f2de6 100644
--- a/Tests/Dependency/Six/SixBSrc.c
+++ b/Tests/Dependency/Six/SixBSrc.c
@@ -1,8 +1,8 @@
-void TwoFunction();
-void FiveFunction();
-void FourFunction();
+void TwoFunction(void);
+void FiveFunction(void);
+void FourFunction(void);
-void SixBFunction()
+void SixBFunction(void)
{
TwoFunction();
FiveFunction();
diff --git a/Tests/Dependency/Three/ThreeSrc.c b/Tests/Dependency/Three/ThreeSrc.c
index 3e814f3..85c51fc 100644
--- a/Tests/Dependency/Three/ThreeSrc.c
+++ b/Tests/Dependency/Three/ThreeSrc.c
@@ -1,7 +1,7 @@
-void OneFunction();
-void FourFunction();
+void OneFunction(void);
+void FourFunction(void);
-void ThreeFunction()
+void ThreeFunction(void)
{
static int count = 0;
if (count == 0) {
diff --git a/Tests/Dependency/Two/TwoCustomSrc.c b/Tests/Dependency/Two/TwoCustomSrc.c
index ac31dcf..432dca1 100644
--- a/Tests/Dependency/Two/TwoCustomSrc.c
+++ b/Tests/Dependency/Two/TwoCustomSrc.c
@@ -1,10 +1,10 @@
-extern void NoFunction();
+extern void NoFunction(void);
/* Provide a function that is supposed to be found in the Three
library. If Two links to TwoCustom then TwoCustom will come before
Three and this symbol will be used. Since NoFunction is not
defined, that will cause a link failure. */
-void ThreeFunction()
+void ThreeFunction(void)
{
NoFunction();
}
diff --git a/Tests/Dependency/Two/TwoSrc.c b/Tests/Dependency/Two/TwoSrc.c
index dbdf524..dadac22 100644
--- a/Tests/Dependency/Two/TwoSrc.c
+++ b/Tests/Dependency/Two/TwoSrc.c
@@ -1,6 +1,6 @@
#include <two-test.h>
-void TwoFunction()
+void TwoFunction(void)
{
static int count = 0;
if (count == 0) {
diff --git a/Tests/DoubleProject/silly.c b/Tests/DoubleProject/silly.c
index f8b643a..8488f4e 100644
--- a/Tests/DoubleProject/silly.c
+++ b/Tests/DoubleProject/silly.c
@@ -1,4 +1,4 @@
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index 67f2fcb..56b8aaa 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -4,6 +4,8 @@ if(POLICY CMP0129)
endif()
project(Export C CXX)
+find_package(Foo REQUIRED CONFIG NO_DEFAULT_PATH)
+
# Pretend that RelWithDebInfo should link to debug libraries to test
# the DEBUG_CONFIGURATIONS property.
set_property(GLOBAL PROPERTY DEBUG_CONFIGURATIONS Debug RelWithDebInfo)
@@ -110,6 +112,7 @@ add_library(testLib9ObjIface OBJECT testLib9ObjIface.c)
target_compile_definitions(testLib9ObjIface INTERFACE testLib9ObjIface_USED)
add_library(testLib9 STATIC testLib9.c)
target_link_libraries(testLib9 INTERFACE testLib9ObjIface PUBLIC testLib9ObjPub PRIVATE testLib9ObjPriv)
+target_link_libraries(testLib9 PUBLIC Foo::Foo)
cmake_policy(POP)
# Test using the target_link_libraries command to set the
@@ -624,7 +627,7 @@ install(
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
-install(EXPORT exp NAMESPACE exp_ DESTINATION lib/exp)
+install(EXPORT exp NAMESPACE exp_ DESTINATION lib/exp EXPORT_PACKAGE_DEPENDENCIES)
# Install testLib5.dll outside the export.
if(WIN32)
diff --git a/Tests/ExportImport/Export/testExe2.c b/Tests/ExportImport/Export/testExe2.c
index 958e4d2..8e6ee44 100644
--- a/Tests/ExportImport/Export/testExe2.c
+++ b/Tests/ExportImport/Export/testExe2.c
@@ -9,7 +9,7 @@ testExe2_EXPORT int testExe2Func(void)
return 123;
}
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/ExportImport/External/FooConfig.cmake b/Tests/ExportImport/External/FooConfig.cmake
new file mode 100644
index 0000000..48b6289
--- /dev/null
+++ b/Tests/ExportImport/External/FooConfig.cmake
@@ -0,0 +1,3 @@
+if(NOT TARGET Foo::Foo)
+ add_library(Foo::Foo INTERFACE IMPORTED)
+endif()
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 2c5662d..2a57633 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -500,7 +500,7 @@ if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREA
OUTPUT_VARIABLE OUTPUT
)
if(NOT BLD_ERROR_VARIABLE)
- message(SEND_ERROR "BLD_ERROR_VARIABLE try_compile failed, but it was expected to succeed.")
+ message(SEND_ERROR "BLD_ERROR_VARIABLE try_compile failed, but it was expected to succeed. ${OUTPUT}")
endif()
if(NOT CMAKE_CROSSCOMPILING)
@@ -518,6 +518,91 @@ if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREA
endif()
endif()
endif()
+
+ # Testing try_compile with ALIAS targets.
+ # These assume that previous test were successful, or at least the failures will be at the linking stage
+ # with symbol not found errors
+
+ # First make sure that if the test run without appropriate alias targets, they should error out
+ try_compile(FAILING_LIBRARY_ALIAS_ERROR_VARIABLE
+ "${CMAKE_CURRENT_BINARY_DIR}/test_failing_library_alias"
+ "${CMAKE_CURRENT_SOURCE_DIR}/test_system.cpp"
+ LINK_LIBRARIES not_existing_library
+ OUTPUT_VARIABLE OUTPUT
+ NO_CACHE
+ )
+ if(FAILING_LIBRARY_ALIAS_ERROR_VARIABLE)
+ message(SEND_ERROR "FAILING_LIBRARY_ALIAS_ERROR_VARIABLE try_compile succeeded, but it was expected to fail ${OUTPUT}.")
+ endif()
+
+ # FIXME: CMAKE_TRY_COMPILE_TARGET_TYPE=MODULE is needed to properly link and test targets linked to an executable
+# set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+# try_compile(FAILING_EXE_ALIAS_ERROR_VARIABLE
+# "${CMAKE_CURRENT_BINARY_DIR}/test_failing_exe_alias"
+# "${CMAKE_CURRENT_SOURCE_DIR}/imp_mod1.c"
+# LINK_LIBRARIES not_existing_executable
+# OUTPUT_VARIABLE OUTPUT
+# NO_CACHE
+# )
+# unset(CMAKE_TRY_COMPILE_TARGET_TYPE)
+# if(FAILING_EXE_ALIAS_ERROR_VARIABLE)
+# message(SEND_ERROR "FAILING_EXE_ALIAS_ERROR_VARIABLE try_compile succeeded, but it was expected to fail ${OUTPUT}.")
+# endif()
+
+ # Do the actual try_compile tests for ALIAS targets
+ add_library(exp_systemlib_alias ALIAS exp_systemlib)
+ try_compile(EXP_LIBRARY_ALIAS_ERROR_VARIABLE
+ "${CMAKE_CURRENT_BINARY_DIR}/test_library_alias"
+ "${CMAKE_CURRENT_SOURCE_DIR}/test_system.cpp"
+ LINK_LIBRARIES exp_systemlib_alias
+ OUTPUT_VARIABLE OUTPUT
+ NO_CACHE
+ )
+ if(NOT EXP_LIBRARY_ALIAS_ERROR_VARIABLE)
+ message(SEND_ERROR "EXP_LIBRARY_ALIAS_ERROR_VARIABLE try_compile failed with library aliased target, but it was expected to succeed ${OUTPUT}.")
+ endif()
+
+ # FIXME: CMAKE_TRY_COMPILE_TARGET_TYPE=MODULE is needed to properly link and test targets linked to an executable
+# set(CMAKE_TRY_COMPILE_TARGET_TYPE MODULE)
+# add_executable(exp_exe_alias ALIAS exp_testExe2)
+# try_compile(EXP_EXE_ALIAS_ERROR_VARIABLE
+# "${CMAKE_CURRENT_BINARY_DIR}/test_exe_alias"
+# "${CMAKE_CURRENT_SOURCE_DIR}/imp_mod1.c"
+# LINK_LIBRARIES exp_exe_alias
+# OUTPUT_VARIABLE OUTPUT
+# NO_CACHE
+# )
+# unset(CMAKE_TRY_COMPILE_TARGET_TYPE)
+# if(NOT EXP_EXE_ALIAS_ERROR_VARIABLE)
+# message(SEND_ERROR "EXP_EXE_ALIAS_ERROR_VARIABLE try_compile failed with executable aliased target, but it was expected to succeed ${OUTPUT}.")
+# endif()
+
+ add_library(bld_systemlib_alias ALIAS bld_systemlib)
+ try_compile(BLD_LIBRARY_ALIAS_ERROR_VARIABLE
+ "${CMAKE_CURRENT_BINARY_DIR}/test_library_alias"
+ "${CMAKE_CURRENT_SOURCE_DIR}/test_system.cpp"
+ LINK_LIBRARIES bld_systemlib_alias
+ OUTPUT_VARIABLE OUTPUT
+ NO_CACHE
+ )
+ if(NOT BLD_LIBRARY_ALIAS_ERROR_VARIABLE)
+ message(SEND_ERROR "BLD_LIBRARY_ALIAS_ERROR_VARIABLE try_compile failed with library aliased target, but it was expected to succeed. ${OUTPUT}")
+ endif()
+
+ # FIXME: CMAKE_TRY_COMPILE_TARGET_TYPE=MODULE is needed to properly link and test targets linked to an executable
+# set(CMAKE_TRY_COMPILE_TARGET_TYPE MODULE)
+# add_executable(bld_exe_alias ALIAS bld_testExe2)
+# try_compile(BLD_EXE_ALIAS_ERROR_VARIABLE
+# "${CMAKE_CURRENT_BINARY_DIR}/test_exe_alias"
+# "${CMAKE_CURRENT_SOURCE_DIR}/imp_mod1.c"
+# LINK_LIBRARIES bld_exe_alias
+# OUTPUT_VARIABLE OUTPUT
+# NO_CACHE
+# )
+# unset(CMAKE_TRY_COMPILE_TARGET_TYPE)
+# if(NOT BLD_EXE_ALIAS_ERROR_VARIABLE)
+# message(SEND_ERROR "BLD_EXE_ALIAS_ERROR_VARIABLE try_compile failed with executable aliased target, but it was expected to succeed. ${OUTPUT}")
+# endif()
endif()
#---------------------------------------------------------------------------------
diff --git a/Tests/ExportImport/Import/A/deps_iface.c b/Tests/ExportImport/Import/A/deps_iface.c
index afb1af0..fd2c47f 100644
--- a/Tests/ExportImport/Import/A/deps_iface.c
+++ b/Tests/ExportImport/Import/A/deps_iface.c
@@ -26,7 +26,7 @@
extern int testLibDepends(void);
-int main()
+int main(void)
{
return testLibDepends();
}
diff --git a/Tests/ExportImport/Import/A/imp_mod1.c b/Tests/ExportImport/Import/A/imp_mod1.c
index 9385d55..138962e 100644
--- a/Tests/ExportImport/Import/A/imp_mod1.c
+++ b/Tests/ExportImport/Import/A/imp_mod1.c
@@ -7,7 +7,7 @@
testExe2_IMPORT int testExe2Func(void);
testExe2_IMPORT int testExe2lib(void);
-int imp_mod1()
+int imp_mod1(void)
{
return testExe2Func() + testExe2lib();
}
diff --git a/Tests/ExportImport/Import/A/imp_testExe1.c b/Tests/ExportImport/Import/A/imp_testExe1.c
index d3b0e9e..e409b1c 100644
--- a/Tests/ExportImport/Import/A/imp_testExe1.c
+++ b/Tests/ExportImport/Import/A/imp_testExe1.c
@@ -21,7 +21,7 @@ extern int testStaticLibPlugin(void);
#endif
extern int testLib4libcfg(void);
-int main()
+int main(void)
{
return (testLib2() + generated_by_testExe1() + testLib3() + testLib4() +
testLib5() + testLib6() + testLib7() + testLibCycleA1() +
diff --git a/Tests/ExportImport/Import/A/imp_testExeAbs1.c b/Tests/ExportImport/Import/A/imp_testExeAbs1.c
index fd05242..07d33a5 100644
--- a/Tests/ExportImport/Import/A/imp_testExeAbs1.c
+++ b/Tests/ExportImport/Import/A/imp_testExeAbs1.c
@@ -7,7 +7,7 @@
#ifndef testLibAbs1b
# error "testLibAbs1b not defined"
#endif
-int main()
+int main(void)
{
return 0 + testLibAbs1();
}
diff --git a/Tests/ExportImport/Import/A/imp_testLib8.c b/Tests/ExportImport/Import/A/imp_testLib8.c
index 2749b17..ef97dbe 100644
--- a/Tests/ExportImport/Import/A/imp_testLib8.c
+++ b/Tests/ExportImport/Import/A/imp_testLib8.c
@@ -2,7 +2,7 @@
int testLib8A(void);
int testLib8B(void);
-int main()
+int main(void)
{
return (testLib8A() + testLib8B());
}
diff --git a/Tests/ExportImport/Import/A/imp_testLib9.c b/Tests/ExportImport/Import/A/imp_testLib9.c
index e014857..2a8d8d5 100644
--- a/Tests/ExportImport/Import/A/imp_testLib9.c
+++ b/Tests/ExportImport/Import/A/imp_testLib9.c
@@ -10,7 +10,7 @@
int testLib9(void);
-int main()
+int main(void)
{
return testLib9();
}
diff --git a/Tests/ExportImport/Import/CMakeLists.txt b/Tests/ExportImport/Import/CMakeLists.txt
index e6dcd65..83c87a8 100644
--- a/Tests/ExportImport/Import/CMakeLists.txt
+++ b/Tests/ExportImport/Import/CMakeLists.txt
@@ -1,5 +1,6 @@
cmake_minimum_required (VERSION 2.7.20090711)
cmake_policy(SET CMP0025 NEW)
+cmake_policy(SET CMP0028 NEW)
if(POLICY CMP0129)
cmake_policy(SET CMP0129 NEW)
endif()
diff --git a/Tests/ExportImport/Import/imp_testTransExe1.c b/Tests/ExportImport/Import/imp_testTransExe1.c
index 360a112..579c992 100644
--- a/Tests/ExportImport/Import/imp_testTransExe1.c
+++ b/Tests/ExportImport/Import/imp_testTransExe1.c
@@ -1,6 +1,6 @@
extern int imp_lib1(void);
-int main()
+int main(void)
{
return imp_lib1();
}
diff --git a/Tests/ExportImport/InitialCache.cmake.in b/Tests/ExportImport/InitialCache.cmake.in
index 44cd179..55aef86 100644
--- a/Tests/ExportImport/InitialCache.cmake.in
+++ b/Tests/ExportImport/InitialCache.cmake.in
@@ -15,3 +15,4 @@ set(CMAKE_INSTALL_PREFIX "@ExportImport_BINARY_DIR@/Root" CACHE STRING "Installa
set(CMAKE_SKIP_RPATH ON CACHE BOOL "No RPATH")
set(CMAKE_GNUtoMS "@ExportImport_GNUtoMS@" CACHE BOOL "CMAKE_GNUtoMS")
set(CMake_TEST_CUDA "@CMake_TEST_CUDA@" CACHE BOOL "CMake_TEST_CUDA")
+set(Foo_DIR "@CMAKE_CURRENT_SOURCE_DIR@/External" CACHE PATH "Foo cmake package directory")
diff --git a/Tests/ExportImport/main.c b/Tests/ExportImport/main.c
index f8b643a..8488f4e 100644
--- a/Tests/ExportImport/main.c
+++ b/Tests/ExportImport/main.c
@@ -1,4 +1,4 @@
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/FindALSA/Test/main.c b/Tests/FindALSA/Test/main.c
index d3303d0..53831a9 100644
--- a/Tests/FindALSA/Test/main.c
+++ b/Tests/FindALSA/Test/main.c
@@ -2,7 +2,7 @@
#include <stdio.h>
#include <string.h>
-int main()
+int main(void)
{
printf("Found ALSA version %s, expected version %s\n",
snd_asoundlib_version(), CMAKE_EXPECTED_ALSA_VERSION);
diff --git a/Tests/FindBLAS/Test/main.c b/Tests/FindBLAS/Test/main.c
index 4fc9fe4..4ce1efb 100644
--- a/Tests/FindBLAS/Test/main.c
+++ b/Tests/FindBLAS/Test/main.c
@@ -13,7 +13,7 @@ typedef int64_t blas_int;
// declare what parts of the blas C-API we need
void dswap_(blas_int* N, double* X, blas_int* incX, double* Y, blas_int* incY);
-int main()
+int main(void)
{
double x[4] = { 1, 2, 3, 4 };
double y[4] = { 8, 7, 7, 6 };
diff --git a/Tests/FindBZip2/Test/main.c b/Tests/FindBZip2/Test/main.c
index 8e24c94..b3cf34b 100644
--- a/Tests/FindBZip2/Test/main.c
+++ b/Tests/FindBZip2/Test/main.c
@@ -2,7 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
-int main()
+int main(void)
{
int chunksize = 1024;
FILE* file = fopen("test.bzip2", "wb");
diff --git a/Tests/FindCURL/Test/main.c b/Tests/FindCURL/Test/main.c
index 263775f..82075f1 100644
--- a/Tests/FindCURL/Test/main.c
+++ b/Tests/FindCURL/Test/main.c
@@ -2,7 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
-int main()
+int main(void)
{
struct curl_slist* slist;
diff --git a/Tests/FindCups/Test/main.c b/Tests/FindCups/Test/main.c
index b69d621..86952db 100644
--- a/Tests/FindCups/Test/main.c
+++ b/Tests/FindCups/Test/main.c
@@ -1,6 +1,6 @@
#include <cups/cups.h>
-int main()
+int main(void)
{
int num_options = 0;
cups_option_t* options = NULL;
diff --git a/Tests/FindDevIL/Test/main.c b/Tests/FindDevIL/Test/main.c
index 4a07087..dfb2f63 100644
--- a/Tests/FindDevIL/Test/main.c
+++ b/Tests/FindDevIL/Test/main.c
@@ -1,6 +1,6 @@
#include <IL/il.h>
-int main()
+int main(void)
{
// Test 1 requires to link to the library.
ilInit();
diff --git a/Tests/FindDevIL/Test/main_ilu.c b/Tests/FindDevIL/Test/main_ilu.c
index a9e7819..ac7237a 100644
--- a/Tests/FindDevIL/Test/main_ilu.c
+++ b/Tests/FindDevIL/Test/main_ilu.c
@@ -1,6 +1,6 @@
#include <IL/ilu.h>
-int main()
+int main(void)
{
// IL Utilities requires only initialization.
// Unlike main DevIL there are no shutdown function.
diff --git a/Tests/FindEXPAT/Test/main.c b/Tests/FindEXPAT/Test/main.c
index 94ee3ef..703aaf9 100644
--- a/Tests/FindEXPAT/Test/main.c
+++ b/Tests/FindEXPAT/Test/main.c
@@ -3,7 +3,7 @@
#include <stdlib.h>
#include <string.h>
-int main()
+int main(void)
{
XML_Expat_Version expat_version;
char expat_version_string[16];
diff --git a/Tests/FindFontconfig/Test/main.c b/Tests/FindFontconfig/Test/main.c
index c5b5963..96b0af1 100644
--- a/Tests/FindFontconfig/Test/main.c
+++ b/Tests/FindFontconfig/Test/main.c
@@ -3,7 +3,7 @@
#include <stdio.h>
#include <string.h>
-int main()
+int main(void)
{
FcInit();
printf("Found Fontconfig.\n");
diff --git a/Tests/FindFreetype/Test/main.c b/Tests/FindFreetype/Test/main.c
index bb838a5..315a6cb 100644
--- a/Tests/FindFreetype/Test/main.c
+++ b/Tests/FindFreetype/Test/main.c
@@ -3,7 +3,7 @@
#include FT_FREETYPE_H
#include <string.h>
-int main()
+int main(void)
{
FT_Library library;
FT_Error error;
diff --git a/Tests/FindGDAL/Test/main.c b/Tests/FindGDAL/Test/main.c
index 7b31a13..2e19843 100644
--- a/Tests/FindGDAL/Test/main.c
+++ b/Tests/FindGDAL/Test/main.c
@@ -2,7 +2,7 @@
#include <stdio.h>
#include <string.h>
-int main()
+int main(void)
{
printf("Found GDAL version %s, expected version %s\n", GDAL_RELEASE_NAME,
CMAKE_EXPECTED_GDAL_VERSION);
diff --git a/Tests/FindGIF/Test/main.c b/Tests/FindGIF/Test/main.c
index 656a99c..fa2c224 100644
--- a/Tests/FindGIF/Test/main.c
+++ b/Tests/FindGIF/Test/main.c
@@ -8,7 +8,7 @@
# define GIFLIB_MAJOR 4
#endif
-int main()
+int main(void)
{
// because of the API changes we have to test different functions depending
// on the version of GIFLIB
diff --git a/Tests/FindGLUT/Test/main.c b/Tests/FindGLUT/Test/main.c
index 1c8569c..02ac34f 100644
--- a/Tests/FindGLUT/Test/main.c
+++ b/Tests/FindGLUT/Test/main.c
@@ -1,7 +1,7 @@
#include <GL/glut.h>
#include <stdio.h>
-int main()
+int main(void)
{
/* The following should call exit(1) and print
freeglut ERROR: Function <glutCreateWindow> called
diff --git a/Tests/FindGnuTLS/Test/main.c b/Tests/FindGnuTLS/Test/main.c
index 1105358..c379cc2 100644
--- a/Tests/FindGnuTLS/Test/main.c
+++ b/Tests/FindGnuTLS/Test/main.c
@@ -3,7 +3,7 @@
#include <stdio.h>
#include <string.h>
-int main()
+int main(void)
{
// test the linker
gnutls_session_t session;
diff --git a/Tests/FindImageMagick/Test/main_magick_wand.c b/Tests/FindImageMagick/Test/main_magick_wand.c
index fa6d170..52d179d 100644
--- a/Tests/FindImageMagick/Test/main_magick_wand.c
+++ b/Tests/FindImageMagick/Test/main_magick_wand.c
@@ -1,6 +1,6 @@
#include <wand/MagickWand.h>
-int main()
+int main(void)
{
MagickWand* wand = NewMagickWand();
wand = DestroyMagickWand(wand);
diff --git a/Tests/FindJPEG/Test/main.c b/Tests/FindJPEG/Test/main.c
index 5a67faa..0116cb6 100644
--- a/Tests/FindJPEG/Test/main.c
+++ b/Tests/FindJPEG/Test/main.c
@@ -4,7 +4,7 @@
#include <jpeglib.h>
// clang-format on
-int main()
+int main(void)
{
/* Without any JPEG file to open, test that the call fails as
expected. This tests that linking worked. */
diff --git a/Tests/FindJasper/Test/main.c b/Tests/FindJasper/Test/main.c
index 771344d..242ff7d 100644
--- a/Tests/FindJasper/Test/main.c
+++ b/Tests/FindJasper/Test/main.c
@@ -4,7 +4,7 @@
#include <jasper/jasper.h>
// clang-format on
-int main()
+int main(void)
{
/* Without any JPEG file to open, test that the call fails as
expected. This tests that linking worked. */
diff --git a/Tests/FindLAPACK/Test/main.c b/Tests/FindLAPACK/Test/main.c
index dd33fb3..3c7ad9f 100644
--- a/Tests/FindLAPACK/Test/main.c
+++ b/Tests/FindLAPACK/Test/main.c
@@ -14,7 +14,7 @@ typedef int64_t blas_int;
void dgesv_(blas_int*, blas_int*, double*, blas_int*, blas_int*, double*,
blas_int*, blas_int*);
-int main()
+int main(void)
{
double A[8] = {
0, 1, 2, 3, 4, 5, 6, 7,
diff --git a/Tests/FindLibLZMA/Test/main.c b/Tests/FindLibLZMA/Test/main.c
index 06e8065..0b3de31 100644
--- a/Tests/FindLibLZMA/Test/main.c
+++ b/Tests/FindLibLZMA/Test/main.c
@@ -4,7 +4,7 @@
static const uint8_t test_string[9] = "123456789";
-int main()
+int main(void)
{
static const uint32_t test_vector = 0xCBF43926;
diff --git a/Tests/FindLibRHash/Test/main.c b/Tests/FindLibRHash/Test/main.c
index 201dced..4cc6394 100644
--- a/Tests/FindLibRHash/Test/main.c
+++ b/Tests/FindLibRHash/Test/main.c
@@ -1,6 +1,6 @@
#include <rhash.h>
-int main()
+int main(void)
{
rhash_library_init();
return 0;
diff --git a/Tests/FindLibUV/Test/main.c b/Tests/FindLibUV/Test/main.c
index cbd0db3..a14adbb 100644
--- a/Tests/FindLibUV/Test/main.c
+++ b/Tests/FindLibUV/Test/main.c
@@ -1,6 +1,6 @@
#include <uv.h>
-int main()
+int main(void)
{
uv_loop_close(uv_default_loop());
return 0;
diff --git a/Tests/FindLibXml2/Test/main.c b/Tests/FindLibXml2/Test/main.c
index 264f07d..4ded2f7 100644
--- a/Tests/FindLibXml2/Test/main.c
+++ b/Tests/FindLibXml2/Test/main.c
@@ -2,7 +2,7 @@
#include <libxml/tree.h>
#include <string.h>
-int main()
+int main(void)
{
xmlDoc* doc;
diff --git a/Tests/FindLibXslt/Test/libexslt.c b/Tests/FindLibXslt/Test/libexslt.c
index ea6eb3d..5916024 100644
--- a/Tests/FindLibXslt/Test/libexslt.c
+++ b/Tests/FindLibXslt/Test/libexslt.c
@@ -2,7 +2,7 @@
#include <libxslt/xslt.h>
#include <libxslt/xsltInternals.h>
-int main()
+int main(void)
{
xsltInit();
diff --git a/Tests/FindLibXslt/Test/libxslt.c b/Tests/FindLibXslt/Test/libxslt.c
index 5b3d766..4a149c1 100644
--- a/Tests/FindLibXslt/Test/libxslt.c
+++ b/Tests/FindLibXslt/Test/libxslt.c
@@ -4,7 +4,7 @@
#include <stdio.h>
#include <string.h>
-int main()
+int main(void)
{
xsltInit();
diff --git a/Tests/FindLibinput/Test/main.c b/Tests/FindLibinput/Test/main.c
index 3919962..a6b1aa4 100644
--- a/Tests/FindLibinput/Test/main.c
+++ b/Tests/FindLibinput/Test/main.c
@@ -1,7 +1,7 @@
#include <libinput.h>
#include <stdio.h>
-int main()
+int main(void)
{
struct libinput_interface interface;
interface.open_restricted = 0;
diff --git a/Tests/FindODBC/Test/main.c b/Tests/FindODBC/Test/main.c
index 34f279c..6c4318b 100644
--- a/Tests/FindODBC/Test/main.c
+++ b/Tests/FindODBC/Test/main.c
@@ -3,7 +3,7 @@
#endif
#include <sql.h>
-int main()
+int main(void)
{
SQLHENV env;
SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
diff --git a/Tests/FindOpenACC/CTest/main.c b/Tests/FindOpenACC/CTest/main.c
index 53b6cae..6c005c1 100644
--- a/Tests/FindOpenACC/CTest/main.c
+++ b/Tests/FindOpenACC/CTest/main.c
@@ -8,7 +8,7 @@ void vecaddgpu(float* r, float* a, float* b, int n)
r[i] = a[i] + b[i];
}
-int main()
+int main(void)
{
int n = 100000; /* vector length */
float* a; /* input vector 1 */
diff --git a/Tests/FindOpenCL/Test/main.c b/Tests/FindOpenCL/Test/main.c
index 2fe949b..d3d0cfb 100644
--- a/Tests/FindOpenCL/Test/main.c
+++ b/Tests/FindOpenCL/Test/main.c
@@ -4,7 +4,7 @@
# include <CL/cl.h>
#endif
-int main()
+int main(void)
{
cl_uint platformIdCount;
diff --git a/Tests/FindOpenGL/Test/main.c b/Tests/FindOpenGL/Test/main.c
index e1f25c6..88a4a8a 100644
--- a/Tests/FindOpenGL/Test/main.c
+++ b/Tests/FindOpenGL/Test/main.c
@@ -9,7 +9,7 @@
#include <stdio.h>
-int main()
+int main(void)
{
/* Reference a GL symbol without requiring a context at runtime. */
printf("&glGetString = %p\n", &glGetString);
diff --git a/Tests/FindOpenGL/Test/main_gles2.c b/Tests/FindOpenGL/Test/main_gles2.c
index 52f5936..355795b 100644
--- a/Tests/FindOpenGL/Test/main_gles2.c
+++ b/Tests/FindOpenGL/Test/main_gles2.c
@@ -9,7 +9,7 @@
#include <stdio.h>
-int main()
+int main(void)
{
/* Reference a GL symbol without requiring a context at runtime. */
printf("&glGetString = %p\n", &glGetString);
diff --git a/Tests/FindOpenGL/Test/main_gles3.c b/Tests/FindOpenGL/Test/main_gles3.c
index 875f73c..383954f7 100644
--- a/Tests/FindOpenGL/Test/main_gles3.c
+++ b/Tests/FindOpenGL/Test/main_gles3.c
@@ -9,7 +9,7 @@
#include <stdio.h>
-int main()
+int main(void)
{
/* Reference a GL symbol without requiring a context at runtime. */
printf("&glGetString = %p\n", &glGetString);
diff --git a/Tests/FindOpenMP/Test/main.c b/Tests/FindOpenMP/Test/main.c
index 4f0e874..9fb67e4 100644
--- a/Tests/FindOpenMP/Test/main.c
+++ b/Tests/FindOpenMP/Test/main.c
@@ -1,5 +1,5 @@
#include <omp.h>
-int main()
+int main(void)
{
#ifndef _OPENMP
breaks_on_purpose
diff --git a/Tests/FindOpenMP/Test/scaltest.c b/Tests/FindOpenMP/Test/scaltest.c
index 4678b87..be48827 100644
--- a/Tests/FindOpenMP/Test/scaltest.c
+++ b/Tests/FindOpenMP/Test/scaltest.c
@@ -6,7 +6,7 @@ extern "C"
#endif
int scalprod(int n, double* x, double* y, double* res);
-int main()
+int main(void)
{
double a[5] = { 1., 2., 3., 4., 5. };
double b[5] = { 2., 3., 4., 5., 6. };
diff --git a/Tests/FindPNG/Test/main.c b/Tests/FindPNG/Test/main.c
index b33b28e..05b55c0 100644
--- a/Tests/FindPNG/Test/main.c
+++ b/Tests/FindPNG/Test/main.c
@@ -2,7 +2,7 @@
#include <png.h>
#include <string.h>
-int main()
+int main(void)
{
png_uint_32 png_version;
char png_version_string[16];
diff --git a/Tests/FindPackageTest/Exporter/dummy.c b/Tests/FindPackageTest/Exporter/dummy.c
index f8b643a..8488f4e 100644
--- a/Tests/FindPackageTest/Exporter/dummy.c
+++ b/Tests/FindPackageTest/Exporter/dummy.c
@@ -1,4 +1,4 @@
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/FindPostgreSQL/Test/main.c b/Tests/FindPostgreSQL/Test/main.c
index a63377a..b5fcf64 100644
--- a/Tests/FindPostgreSQL/Test/main.c
+++ b/Tests/FindPostgreSQL/Test/main.c
@@ -2,7 +2,7 @@
#include <stdio.h>
#include <string.h>
-int main()
+int main(void)
{
int version = PQlibVersion();
char version_string[100];
diff --git a/Tests/FindPython/display_time.c b/Tests/FindPython/display_time.c
index 0e78434..568d510 100644
--- a/Tests/FindPython/display_time.c
+++ b/Tests/FindPython/display_time.c
@@ -6,7 +6,7 @@
#include "display_time.h"
-void display_time()
+void display_time(void)
{
#if defined(PYTHON3)
wchar_t* program = Py_DecodeLocale("display_time", NULL);
diff --git a/Tests/FindPython/main.c b/Tests/FindPython/main.c
index 0acba29..0119ce0 100644
--- a/Tests/FindPython/main.c
+++ b/Tests/FindPython/main.c
@@ -1,7 +1,7 @@
#include "display_time.h"
-int main()
+int main(void)
{
display_time();
}
diff --git a/Tests/FindSDL/Test/main.c b/Tests/FindSDL/Test/main.c
index 057289c..3b774f5 100644
--- a/Tests/FindSDL/Test/main.c
+++ b/Tests/FindSDL/Test/main.c
@@ -1,6 +1,6 @@
#include <SDL.h>
-int main()
+int main(void)
{
// Test 1 requires headers only.
SDL_version compiled;
diff --git a/Tests/FindSQLite3/Test/main.c b/Tests/FindSQLite3/Test/main.c
index fb17c67..f812034 100644
--- a/Tests/FindSQLite3/Test/main.c
+++ b/Tests/FindSQLite3/Test/main.c
@@ -1,7 +1,7 @@
#include <sqlite3.h>
#include <string.h>
-int main()
+int main(void)
{
char sqlite3_version[] = SQLITE_VERSION;
diff --git a/Tests/FindTIFF/Test/main.c b/Tests/FindTIFF/Test/main.c
index 9182652..bce4a3e 100644
--- a/Tests/FindTIFF/Test/main.c
+++ b/Tests/FindTIFF/Test/main.c
@@ -1,7 +1,7 @@
#include <assert.h>
#include <tiffio.h>
-int main()
+int main(void)
{
/* Without any TIFF file to open, test that the call fails as
expected. This tests that linking worked. */
diff --git a/Tests/FindVulkan/Test/main-SPIRV-Tools.c b/Tests/FindVulkan/Test/main-SPIRV-Tools.c
index 097198d..c38f38d 100644
--- a/Tests/FindVulkan/Test/main-SPIRV-Tools.c
+++ b/Tests/FindVulkan/Test/main-SPIRV-Tools.c
@@ -2,7 +2,7 @@
#include <spirv-tools/libspirv.h>
#include <stdio.h>
-int main()
+int main(void)
{
const char* spv_version = spvSoftwareVersionString();
const char* spv_details = spvSoftwareVersionDetailsString();
diff --git a/Tests/FindVulkan/Test/main.c b/Tests/FindVulkan/Test/main.c
index 1bff651..78eaa4d 100644
--- a/Tests/FindVulkan/Test/main.c
+++ b/Tests/FindVulkan/Test/main.c
@@ -1,6 +1,6 @@
#include <vulkan/vulkan.h>
-int main()
+int main(void)
{
VkInstanceCreateInfo instanceCreateInfo = { 0 };
instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
diff --git a/Tests/Fortran/mainc.c b/Tests/Fortran/mainc.c
index 9efafc5..607b9fd 100644
--- a/Tests/Fortran/mainc.c
+++ b/Tests/Fortran/mainc.c
@@ -1,5 +1,5 @@
extern int myc(void);
-int main()
+int main(void)
{
return myc();
}
diff --git a/Tests/Fortran/maincxx.c b/Tests/Fortran/maincxx.c
index d35ea7e..3056d96 100644
--- a/Tests/Fortran/maincxx.c
+++ b/Tests/Fortran/maincxx.c
@@ -1,6 +1,6 @@
extern int myc(void);
extern int mycxx(void);
-int main()
+int main(void)
{
return myc() + mycxx();
}
diff --git a/Tests/FortranModules/Issue25252-iface-sources/lib.c b/Tests/FortranModules/Issue25252-iface-sources/lib.c
index 6ccdb8d..894540c 100644
--- a/Tests/FortranModules/Issue25252-iface-sources/lib.c
+++ b/Tests/FortranModules/Issue25252-iface-sources/lib.c
@@ -1,4 +1,4 @@
-int f()
+int f(void)
{
return 0;
}
diff --git a/Tests/GeneratorExpression/objlib1.c b/Tests/GeneratorExpression/objlib1.c
index 98a95a4..b33aa48 100644
--- a/Tests/GeneratorExpression/objlib1.c
+++ b/Tests/GeneratorExpression/objlib1.c
@@ -1,4 +1,4 @@
-void objlib1()
+void objlib1(void)
{
}
diff --git a/Tests/GeneratorExpression/objlib2.c b/Tests/GeneratorExpression/objlib2.c
index b2c1050..5543f75 100644
--- a/Tests/GeneratorExpression/objlib2.c
+++ b/Tests/GeneratorExpression/objlib2.c
@@ -1,4 +1,4 @@
-void objlib2()
+void objlib2(void)
{
}
diff --git a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/test.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/test.c
index 5d857dd..ef922a3 100644
--- a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/test.c
+++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/test.c
@@ -1,4 +1,4 @@
-int test_b()
+int test_b(void)
{
return 2;
}
diff --git a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/testcase.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/testcase.c
index 66ee6f3..1df9613 100644
--- a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/testcase.c
+++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/testcase.c
@@ -1,4 +1,4 @@
-int test_f()
+int test_f(void)
{
return 1;
}
diff --git a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test.c
index 83589ba..8bcb13a 100644
--- a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test.c
+++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test.c
@@ -1,4 +1,4 @@
-int test_c()
+int test_c(void)
{
return 1;
}
diff --git a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c
index 82f9a52..24e2d75 100644
--- a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c
+++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c
@@ -1,4 +1,4 @@
-int test_d()
+int test_d(void)
{
return 1;
}
diff --git a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/test.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/test.c
index feba80e..5dd1214 100644
--- a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/test.c
+++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/test.c
@@ -1,4 +1,4 @@
-int test_a()
+int test_a(void)
{
return 1;
}
diff --git a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/testCase.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/testCase.c
index 943c19d..658f5ab 100644
--- a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/testCase.c
+++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/testCase.c
@@ -1,4 +1,4 @@
-int test_e()
+int test_e(void)
{
return 1;
}
diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/kernel.c b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/kernel.c
index d1bce33..9282163 100644
--- a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/kernel.c
+++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/kernel.c
@@ -1,7 +1,7 @@
#include "INTEGRITY.h"
#include "boottable.h"
-void main()
+void main(void)
{
Exit(0);
}
diff --git a/Tests/IncludeDirectories/StandardIncludeDirectories/main.c b/Tests/IncludeDirectories/StandardIncludeDirectories/main.c
index edfe9ce..29a2ee1 100644
--- a/Tests/IncludeDirectories/StandardIncludeDirectories/main.c
+++ b/Tests/IncludeDirectories/StandardIncludeDirectories/main.c
@@ -1,5 +1,5 @@
#include "StdIncDir.h"
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectoriesPerLang/main.c b/Tests/IncludeDirectories/SystemIncludeDirectoriesPerLang/main.c
index f8b643a..8488f4e 100644
--- a/Tests/IncludeDirectories/SystemIncludeDirectoriesPerLang/main.c
+++ b/Tests/IncludeDirectories/SystemIncludeDirectoriesPerLang/main.c
@@ -1,4 +1,4 @@
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/JavaExportImport/main.c b/Tests/JavaExportImport/main.c
index f8b643a..8488f4e 100644
--- a/Tests/JavaExportImport/main.c
+++ b/Tests/JavaExportImport/main.c
@@ -1,4 +1,4 @@
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/LibName/bar.c b/Tests/LibName/bar.c
index c6c1e66..b1c5cf2 100644
--- a/Tests/LibName/bar.c
+++ b/Tests/LibName/bar.c
@@ -2,6 +2,6 @@
__declspec(dllexport)
#endif
- extern void foo()
+ extern void foo(void)
{
}
diff --git a/Tests/LibName/foo.c b/Tests/LibName/foo.c
index 52e8d89..1bdb58b 100644
--- a/Tests/LibName/foo.c
+++ b/Tests/LibName/foo.c
@@ -1,11 +1,11 @@
#ifdef _WIN32
__declspec(dllimport)
#endif
- extern void foo();
+ extern void foo(void);
#ifdef _WIN32
__declspec(dllexport)
#endif
- void bar()
+ void bar(void)
{
foo();
}
diff --git a/Tests/LibName/foobar.c b/Tests/LibName/foobar.c
index 2f28d30..fa7d3e9 100644
--- a/Tests/LibName/foobar.c
+++ b/Tests/LibName/foobar.c
@@ -3,7 +3,7 @@ __declspec(dllimport)
#endif
extern void bar();
-int main()
+int main(void)
{
bar();
return 0;
diff --git a/Tests/LinkLanguage/LinkLanguage.c b/Tests/LinkLanguage/LinkLanguage.c
index 37946c7..18ddb78 100644
--- a/Tests/LinkLanguage/LinkLanguage.c
+++ b/Tests/LinkLanguage/LinkLanguage.c
@@ -1,5 +1,5 @@
extern int foo(void);
-int main()
+int main(void)
{
return foo();
}
diff --git a/Tests/LinkLine/Exec.c b/Tests/LinkLine/Exec.c
index 807a7a8..11b5650 100644
--- a/Tests/LinkLine/Exec.c
+++ b/Tests/LinkLine/Exec.c
@@ -1,7 +1,7 @@
void OneFunc();
void TwoFunc();
-int main()
+int main(void)
{
OneFunc();
TwoFunc();
diff --git a/Tests/LinkLine/One.c b/Tests/LinkLine/One.c
index 856d0d1..4f3ad63 100644
--- a/Tests/LinkLine/One.c
+++ b/Tests/LinkLine/One.c
@@ -1,6 +1,6 @@
-void TwoFunc();
+void TwoFunc(void);
-void OneFunc()
+void OneFunc(void)
{
static int i = 0;
++i;
diff --git a/Tests/LinkLine/Two.c b/Tests/LinkLine/Two.c
index 5fc212e..ac84367 100644
--- a/Tests/LinkLine/Two.c
+++ b/Tests/LinkLine/Two.c
@@ -1,6 +1,6 @@
-void OneFunc();
+void OneFunc(void);
-void TwoFunc()
+void TwoFunc(void)
{
static int i = 0;
++i;
diff --git a/Tests/LinkLineOrder/Exec1.c b/Tests/LinkLineOrder/Exec1.c
index 9bbf0f6..e47841d 100644
--- a/Tests/LinkLineOrder/Exec1.c
+++ b/Tests/LinkLineOrder/Exec1.c
@@ -1,7 +1,7 @@
/* Directly depends on One */
void OneFunc();
-int main()
+int main(void)
{
OneFunc();
return 0;
diff --git a/Tests/LinkLineOrder/Exec2.c b/Tests/LinkLineOrder/Exec2.c
index 91b8575..d60c94e 100644
--- a/Tests/LinkLineOrder/Exec2.c
+++ b/Tests/LinkLineOrder/Exec2.c
@@ -1,7 +1,7 @@
/* Directly depends on Two */
void TwoFunc();
-int main()
+int main(void)
{
TwoFunc();
return 0;
diff --git a/Tests/LinkLineOrder/NoDepA.c b/Tests/LinkLineOrder/NoDepA.c
index 76f97bc..72333bc 100644
--- a/Tests/LinkLineOrder/NoDepA.c
+++ b/Tests/LinkLineOrder/NoDepA.c
@@ -1,7 +1,7 @@
/* depends on NoDepB */
-void NoDepB_func();
+void NoDepB_func(void);
-void NoDepA_func()
+void NoDepA_func(void)
{
NoDepB_func();
}
diff --git a/Tests/LinkLineOrder/NoDepB.c b/Tests/LinkLineOrder/NoDepB.c
index fa89ae9..a5c30e5 100644
--- a/Tests/LinkLineOrder/NoDepB.c
+++ b/Tests/LinkLineOrder/NoDepB.c
@@ -1,4 +1,4 @@
/* No dependencies */
-void NoDepB_func()
+void NoDepB_func(void)
{
}
diff --git a/Tests/LinkLineOrder/NoDepC.c b/Tests/LinkLineOrder/NoDepC.c
index f05d962..cafb3fd 100644
--- a/Tests/LinkLineOrder/NoDepC.c
+++ b/Tests/LinkLineOrder/NoDepC.c
@@ -1,7 +1,7 @@
/* depends on NoDepA */
-void NoDepA_func();
+void NoDepA_func(void);
-void NoDepC_func()
+void NoDepC_func(void)
{
NoDepA_func();
}
diff --git a/Tests/LinkLineOrder/NoDepE.c b/Tests/LinkLineOrder/NoDepE.c
index c47bb85..6e33c7b 100644
--- a/Tests/LinkLineOrder/NoDepE.c
+++ b/Tests/LinkLineOrder/NoDepE.c
@@ -1,7 +1,7 @@
/* depends on NoDepF */
-void NoDepF_func();
+void NoDepF_func(void);
-void NoDepE_func()
+void NoDepE_func(void)
{
static int firstcall = 1;
if (firstcall) {
diff --git a/Tests/LinkLineOrder/NoDepF.c b/Tests/LinkLineOrder/NoDepF.c
index a814310..f4afcb5 100644
--- a/Tests/LinkLineOrder/NoDepF.c
+++ b/Tests/LinkLineOrder/NoDepF.c
@@ -1,7 +1,7 @@
/* depends on NoDepE */
-void NoDepE_func();
+void NoDepE_func(void);
-void NoDepF_func()
+void NoDepF_func(void)
{
static int firstcall = 1;
if (firstcall) {
diff --git a/Tests/LinkLineOrder/NoDepX.c b/Tests/LinkLineOrder/NoDepX.c
index c895dd1..c8de222 100644
--- a/Tests/LinkLineOrder/NoDepX.c
+++ b/Tests/LinkLineOrder/NoDepX.c
@@ -1,7 +1,7 @@
/* depends on NoDepY*/
-void NoDepY_func();
+void NoDepY_func(void);
-void NoDepX_func()
+void NoDepX_func(void)
{
NoDepY_func();
}
diff --git a/Tests/LinkLineOrder/NoDepY.c b/Tests/LinkLineOrder/NoDepY.c
index 1e6a4ae..dc492d5 100644
--- a/Tests/LinkLineOrder/NoDepY.c
+++ b/Tests/LinkLineOrder/NoDepY.c
@@ -1,4 +1,4 @@
/* No dependencies */
-void NoDepY_func()
+void NoDepY_func(void)
{
}
diff --git a/Tests/LinkLineOrder/NoDepZ.c b/Tests/LinkLineOrder/NoDepZ.c
index 045e570..c866667 100644
--- a/Tests/LinkLineOrder/NoDepZ.c
+++ b/Tests/LinkLineOrder/NoDepZ.c
@@ -1,7 +1,7 @@
/* depends on NoDepX */
-void NoDepX_func();
+void NoDepX_func(void);
-void NoDepZ_func()
+void NoDepZ_func(void)
{
NoDepX_func();
}
diff --git a/Tests/LinkLineOrder/One.c b/Tests/LinkLineOrder/One.c
index b23b1ec..b95fa6d 100644
--- a/Tests/LinkLineOrder/One.c
+++ b/Tests/LinkLineOrder/One.c
@@ -1,9 +1,9 @@
/* depends on NoDepC and NoDepE (and hence on NoDepA, NoDepB and */
/* NoDepF) */
-void NoDepC_func();
-void NoDepE_func();
+void NoDepC_func(void);
+void NoDepE_func(void);
-void OneFunc()
+void OneFunc(void)
{
NoDepC_func();
NoDepE_func();
diff --git a/Tests/LinkLineOrder/Two.c b/Tests/LinkLineOrder/Two.c
index 6bffaa8..9955d67 100644
--- a/Tests/LinkLineOrder/Two.c
+++ b/Tests/LinkLineOrder/Two.c
@@ -1,7 +1,7 @@
-void OneFunc();
-void NoDepZ_func();
+void OneFunc(void);
+void NoDepZ_func(void);
-void TwoFunc()
+void TwoFunc(void)
{
OneFunc();
NoDepZ_func();
diff --git a/Tests/Module/CheckIPOSupported-C/bar.c b/Tests/Module/CheckIPOSupported-C/bar.c
index 680f213..728d8fb 100644
--- a/Tests/Module/CheckIPOSupported-C/bar.c
+++ b/Tests/Module/CheckIPOSupported-C/bar.c
@@ -1,4 +1,4 @@
-int bar()
+int bar(void)
{
return 0x42;
}
diff --git a/Tests/Module/CheckIPOSupported-C/foo.c b/Tests/Module/CheckIPOSupported-C/foo.c
index 1e56597..6a64a99 100644
--- a/Tests/Module/CheckIPOSupported-C/foo.c
+++ b/Tests/Module/CheckIPOSupported-C/foo.c
@@ -1,4 +1,4 @@
-int foo()
+int foo(void)
{
return 0x42;
}
diff --git a/Tests/Module/CheckIPOSupported-C/main.c b/Tests/Module/CheckIPOSupported-C/main.c
index 28ab26f..7d8ad9a 100644
--- a/Tests/Module/CheckIPOSupported-C/main.c
+++ b/Tests/Module/CheckIPOSupported-C/main.c
@@ -1,7 +1,7 @@
int foo();
int bar();
-int main()
+int main(void)
{
if (foo() != bar()) {
return 1;
diff --git a/Tests/Module/CheckTypeSize/CheckTypeSize.c b/Tests/Module/CheckTypeSize/CheckTypeSize.c
index adfd2fc..eb1aa94 100644
--- a/Tests/Module/CheckTypeSize/CheckTypeSize.c
+++ b/Tests/Module/CheckTypeSize/CheckTypeSize.c
@@ -28,7 +28,7 @@
result = 1; \
} while (0)
-int main()
+int main(void)
{
int result = 0;
struct somestruct x;
diff --git a/Tests/Module/WriteCompilerDetectionHeader/c_undefined.c b/Tests/Module/WriteCompilerDetectionHeader/c_undefined.c
index 487e66d..34c373c 100644
--- a/Tests/Module/WriteCompilerDetectionHeader/c_undefined.c
+++ b/Tests/Module/WriteCompilerDetectionHeader/c_undefined.c
@@ -1,7 +1,7 @@
#include "test_compiler_detection.h"
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/Module/WriteCompilerDetectionHeader/main.c b/Tests/Module/WriteCompilerDetectionHeader/main.c
index 3420c67..1253563 100644
--- a/Tests/Module/WriteCompilerDetectionHeader/main.c
+++ b/Tests/Module/WriteCompilerDetectionHeader/main.c
@@ -24,7 +24,7 @@
# error Expect no CXX features defined
#endif
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/Module/WriteCompilerDetectionHeader/main_multi.c b/Tests/Module/WriteCompilerDetectionHeader/main_multi.c
index 28f9dae..3853671 100644
--- a/Tests/Module/WriteCompilerDetectionHeader/main_multi.c
+++ b/Tests/Module/WriteCompilerDetectionHeader/main_multi.c
@@ -24,7 +24,7 @@
# error Expect no CXX features defined
#endif
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/OutOfBinary/outlib.c b/Tests/OutOfBinary/outlib.c
index d309ebe..3eaedea 100644
--- a/Tests/OutOfBinary/outlib.c
+++ b/Tests/OutOfBinary/outlib.c
@@ -1,4 +1,4 @@
-int outlib()
+int outlib(void)
{
return 456;
}
diff --git a/Tests/PDBDirectoryAndName/myexe.c b/Tests/PDBDirectoryAndName/myexe.c
index fdb8b09..3d66794 100644
--- a/Tests/PDBDirectoryAndName/myexe.c
+++ b/Tests/PDBDirectoryAndName/myexe.c
@@ -1,8 +1,8 @@
-extern int mylibA();
-extern int mylibB();
-extern int mylibC();
-extern int mylibD();
-int main()
+extern int mylibA(void);
+extern int mylibB(void);
+extern int mylibC(void);
+extern int mylibD(void);
+int main(void)
{
return mylibA() + mylibB() + mylibC() + mylibD();
}
diff --git a/Tests/PDBDirectoryAndName/myexe2.c b/Tests/PDBDirectoryAndName/myexe2.c
index 250d651..b32e0b1 100644
--- a/Tests/PDBDirectoryAndName/myexe2.c
+++ b/Tests/PDBDirectoryAndName/myexe2.c
@@ -1,6 +1,6 @@
-extern int mylibA();
-extern int mylibD();
-int main()
+extern int mylibA(void);
+extern int mylibD(void);
+int main(void)
{
return mylibA() + mylibD();
}
diff --git a/Tests/PDBDirectoryAndName/mylibA.c b/Tests/PDBDirectoryAndName/mylibA.c
index 5bc279b..58ff123 100644
--- a/Tests/PDBDirectoryAndName/mylibA.c
+++ b/Tests/PDBDirectoryAndName/mylibA.c
@@ -1,4 +1,4 @@
-__declspec(dllexport) int mylibA()
+__declspec(dllexport) int mylibA(void)
{
return 1;
}
diff --git a/Tests/PDBDirectoryAndName/mylibB.c b/Tests/PDBDirectoryAndName/mylibB.c
index 3a95845..8be2aa0 100644
--- a/Tests/PDBDirectoryAndName/mylibB.c
+++ b/Tests/PDBDirectoryAndName/mylibB.c
@@ -1,4 +1,4 @@
-int mylibB()
+int mylibB(void)
{
return -1;
}
diff --git a/Tests/PDBDirectoryAndName/mylibC.c b/Tests/PDBDirectoryAndName/mylibC.c
index 8982849..64dde72 100644
--- a/Tests/PDBDirectoryAndName/mylibC.c
+++ b/Tests/PDBDirectoryAndName/mylibC.c
@@ -1,4 +1,4 @@
-__declspec(dllexport) int mylibC()
+__declspec(dllexport) int mylibC(void)
{
return 1;
}
diff --git a/Tests/PDBDirectoryAndName/mylibD.c b/Tests/PDBDirectoryAndName/mylibD.c
index a53b7a2..c9c04d8 100644
--- a/Tests/PDBDirectoryAndName/mylibD.c
+++ b/Tests/PDBDirectoryAndName/mylibD.c
@@ -1,4 +1,4 @@
-int mylibD()
+int mylibD(void)
{
return -1;
}
diff --git a/Tests/PerConfig/perconfig.c b/Tests/PerConfig/perconfig.c
index d942d45..5162ae0 100644
--- a/Tests/PerConfig/perconfig.c
+++ b/Tests/PerConfig/perconfig.c
@@ -1,6 +1,6 @@
#include "pcShared.h"
extern const char* pcStatic(void);
-int main()
+int main(void)
{
pcStatic();
pcShared();
diff --git a/Tests/PolicyScope/main.c b/Tests/PolicyScope/main.c
index f8b643a..8488f4e 100644
--- a/Tests/PolicyScope/main.c
+++ b/Tests/PolicyScope/main.c
@@ -1,4 +1,4 @@
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/PrecompiledHeader/foo1.c b/Tests/PrecompiledHeader/foo1.c
index fef2586..e743f8b 100644
--- a/Tests/PrecompiledHeader/foo1.c
+++ b/Tests/PrecompiledHeader/foo1.c
@@ -2,7 +2,7 @@
# error "Precompiled header foo_precompiled.h has not been loaded."
#endif
-int main()
+int main(void)
{
return foo();
}
diff --git a/Tests/PrecompiledHeader/foo2.c b/Tests/PrecompiledHeader/foo2.c
index 3ed04ed..5211f3e 100644
--- a/Tests/PrecompiledHeader/foo2.c
+++ b/Tests/PrecompiledHeader/foo2.c
@@ -3,7 +3,7 @@
# error "Precompiled header foo_precompiled.h has not been loaded."
#endif
-int foo()
+int foo(void)
{
return 0;
}
diff --git a/Tests/RunCMake/AppleTextStubs/foo.c b/Tests/RunCMake/AppleTextStubs/foo.c
index 7f39d71..f669327 100644
--- a/Tests/RunCMake/AppleTextStubs/foo.c
+++ b/Tests/RunCMake/AppleTextStubs/foo.c
@@ -1,5 +1,5 @@
-int foo()
+int foo(void)
{
return 0;
}
diff --git a/Tests/RunCMake/AppleTextStubs/main.c b/Tests/RunCMake/AppleTextStubs/main.c
index dc5ce3d..390f7d1 100644
--- a/Tests/RunCMake/AppleTextStubs/main.c
+++ b/Tests/RunCMake/AppleTextStubs/main.c
@@ -1,7 +1,7 @@
extern int foo(void);
-int main()
+int main(void)
{
return foo();
}
diff --git a/Tests/RunCMake/AutoExportDll/foo.c b/Tests/RunCMake/AutoExportDll/foo.c
index d13bc3e..b4f3ae0 100644
--- a/Tests/RunCMake/AutoExportDll/foo.c
+++ b/Tests/RunCMake/AutoExportDll/foo.c
@@ -4,12 +4,12 @@
# define WINAPI
#endif
-int WINAPI foo()
+int WINAPI foo(void)
{
return 10;
}
-int bar()
+int bar(void)
{
return 5;
}
diff --git a/Tests/RunCMake/AutoExportDll/hello2.c b/Tests/RunCMake/AutoExportDll/hello2.c
index d4d6b72..66e7caf 100644
--- a/Tests/RunCMake/AutoExportDll/hello2.c
+++ b/Tests/RunCMake/AutoExportDll/hello2.c
@@ -2,7 +2,7 @@
extern int own_auto_export_function(int i);
-void hello2()
+void hello2(void)
{
printf("hello exec:%i", own_auto_export_function(41));
}
diff --git a/Tests/RunCMake/AutoExportDll/objlib.c b/Tests/RunCMake/AutoExportDll/objlib.c
index 54a9658..4e580c3 100644
--- a/Tests/RunCMake/AutoExportDll/objlib.c
+++ b/Tests/RunCMake/AutoExportDll/objlib.c
@@ -1,4 +1,4 @@
-int objlib()
+int objlib(void)
{
return 7;
}
diff --git a/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c
index 0795aaa..bd54d76 100644
--- a/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c
+++ b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c
@@ -1,5 +1,5 @@
#include <MakeInProjectOnly.h>
-int main()
+int main(void)
{
return MakeInProjectOnly();
}
diff --git a/Tests/RunCMake/BuiltinTargets/CMakeLists.txt b/Tests/RunCMake/BuiltinTargets/CMakeLists.txt
new file mode 100644
index 0000000..6a9ce76
--- /dev/null
+++ b/Tests/RunCMake/BuiltinTargets/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.28)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/BuiltinTargets/RunCMakeTest.cmake b/Tests/RunCMake/BuiltinTargets/RunCMakeTest.cmake
new file mode 100644
index 0000000..6a74f57
--- /dev/null
+++ b/Tests/RunCMake/BuiltinTargets/RunCMakeTest.cmake
@@ -0,0 +1,19 @@
+include(RunCMake)
+
+if(RunCMake_GENERATOR MATCHES "Make|Ninja")
+ set(test_target "test")
+else()
+ set(test_target "RUN_TESTS")
+endif()
+
+function(run_BuiltinTarget case target)
+ # Use a single build tree for a few tests without cleaning.
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build)
+ run_cmake(${case})
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(${case}-build ${CMAKE_COMMAND} --build . --config Debug --target ${${target}_target})
+endfunction()
+
+run_BuiltinTarget(TestDependsAll-Default test)
+run_BuiltinTarget(TestDependsAll-No test)
+run_BuiltinTarget(TestDependsAll-Yes test)
diff --git a/Tests/RunCMake/BuiltinTargets/TestDependsAll-Default-build-check.cmake b/Tests/RunCMake/BuiltinTargets/TestDependsAll-Default-build-check.cmake
new file mode 100644
index 0000000..5ef321a
--- /dev/null
+++ b/Tests/RunCMake/BuiltinTargets/TestDependsAll-Default-build-check.cmake
@@ -0,0 +1 @@
+include(${CMAKE_CURRENT_LIST_DIR}/TestDependsAll-No-build-check.cmake)
diff --git a/Tests/RunCMake/BuiltinTargets/TestDependsAll-Default.cmake b/Tests/RunCMake/BuiltinTargets/TestDependsAll-Default.cmake
new file mode 100644
index 0000000..6abd56c
--- /dev/null
+++ b/Tests/RunCMake/BuiltinTargets/TestDependsAll-Default.cmake
@@ -0,0 +1 @@
+include(TestDependsAll-common.cmake)
diff --git a/Tests/RunCMake/BuiltinTargets/TestDependsAll-No-build-check.cmake b/Tests/RunCMake/BuiltinTargets/TestDependsAll-No-build-check.cmake
new file mode 100644
index 0000000..f42244e
--- /dev/null
+++ b/Tests/RunCMake/BuiltinTargets/TestDependsAll-No-build-check.cmake
@@ -0,0 +1,3 @@
+if(EXISTS ${RunCMake_TEST_BINARY_DIR}/custom-output.txt)
+ set(RunCMake_TEST_FAILED "Building 'test' target incorrectly built 'all' target.")
+endif()
diff --git a/Tests/RunCMake/BuiltinTargets/TestDependsAll-No.cmake b/Tests/RunCMake/BuiltinTargets/TestDependsAll-No.cmake
new file mode 100644
index 0000000..50ec3b9
--- /dev/null
+++ b/Tests/RunCMake/BuiltinTargets/TestDependsAll-No.cmake
@@ -0,0 +1,2 @@
+include(TestDependsAll-common.cmake)
+set(CMAKE_SKIP_TEST_ALL_DEPENDENCY ON)
diff --git a/Tests/RunCMake/BuiltinTargets/TestDependsAll-Yes-build-check.cmake b/Tests/RunCMake/BuiltinTargets/TestDependsAll-Yes-build-check.cmake
new file mode 100644
index 0000000..ed175d4
--- /dev/null
+++ b/Tests/RunCMake/BuiltinTargets/TestDependsAll-Yes-build-check.cmake
@@ -0,0 +1,3 @@
+if(NOT EXISTS ${RunCMake_TEST_BINARY_DIR}/custom-output.txt)
+ set(RunCMake_TEST_FAILED "Building 'test' target did not build 'all' target:\n ${RunCMake_TEST_BINARY_DIR}/custom-output.txt")
+endif()
diff --git a/Tests/RunCMake/BuiltinTargets/TestDependsAll-Yes.cmake b/Tests/RunCMake/BuiltinTargets/TestDependsAll-Yes.cmake
new file mode 100644
index 0000000..c35c98d
--- /dev/null
+++ b/Tests/RunCMake/BuiltinTargets/TestDependsAll-Yes.cmake
@@ -0,0 +1,2 @@
+include(TestDependsAll-common.cmake)
+set(CMAKE_SKIP_TEST_ALL_DEPENDENCY OFF)
diff --git a/Tests/RunCMake/BuiltinTargets/TestDependsAll-common.cmake b/Tests/RunCMake/BuiltinTargets/TestDependsAll-common.cmake
new file mode 100644
index 0000000..bbe7c75
--- /dev/null
+++ b/Tests/RunCMake/BuiltinTargets/TestDependsAll-common.cmake
@@ -0,0 +1,3 @@
+enable_testing()
+add_custom_target(custom ALL COMMAND ${CMAKE_COMMAND} -E touch custom-output.txt)
+add_test(NAME test COMMAND ${CMAKE_COMMAND} -E echo)
diff --git a/Tests/RunCMake/CMP0126/CMP0126-OLD-stderr.txt b/Tests/RunCMake/CMP0126/CMP0126-OLD-stderr.txt
new file mode 100644
index 0000000..7d2608b
--- /dev/null
+++ b/Tests/RunCMake/CMP0126/CMP0126-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0126-OLD\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0126 will be removed from a future version
+ of CMake\.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances\. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/CMP0126/CMP0126-OLD_CL-stderr.txt b/Tests/RunCMake/CMP0126/CMP0126-OLD_CL-stderr.txt
new file mode 100644
index 0000000..1f2179c
--- /dev/null
+++ b/Tests/RunCMake/CMP0126/CMP0126-OLD_CL-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0126-OLD_CL\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0126 will be removed from a future version
+ of CMake\.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances\. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/CMP0156/CMP0156-Common.cmake b/Tests/RunCMake/CMP0156/CMP0156-Common.cmake
new file mode 100644
index 0000000..a382c77
--- /dev/null
+++ b/Tests/RunCMake/CMP0156/CMP0156-Common.cmake
@@ -0,0 +1,27 @@
+
+enable_language(C)
+
+# ensure link is successful in case of circular dependency
+add_library(lib1 STATIC lib1.c)
+add_library(lib2 STATIC lib2.c)
+
+target_link_libraries(lib1 PRIVATE lib2)
+target_link_libraries(lib2 PRIVATE lib1)
+
+add_executable(main main.c)
+target_link_libraries(main PRIVATE lib1)
+if (APPLE_TEST)
+ target_link_options(main PRIVATE "LINKER:-fatal_warnings")
+else()
+ target_link_options(main PRIVATE "$<$<AND:$<NOT:$<TARGET_POLICY:CMP0156>>,$<C_COMPILER_ID:AppleClang>,$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,15.0>>:LINKER:-no_warn_duplicate_libraries>")
+endif()
+
+
+add_library(lib3 SHARED lib3.c)
+add_library(lib4 STATIC lib4.c)
+target_link_libraries(lib4 PRIVATE lib3)
+
+# link specifying a shared library not directly used by the target
+# on Windows, with CMP0156=NEW, lib3 is specified before lib4 on link step
+add_executable(main2 main2.c)
+target_link_libraries(main2 PRIVATE lib3 lib4)
diff --git a/Tests/RunCMake/CMP0156/CMP0156-NEW-AppleClang.cmake b/Tests/RunCMake/CMP0156/CMP0156-NEW-AppleClang.cmake
new file mode 100644
index 0000000..59f5ecd
--- /dev/null
+++ b/Tests/RunCMake/CMP0156/CMP0156-NEW-AppleClang.cmake
@@ -0,0 +1,5 @@
+
+cmake_policy(SET CMP0156 NEW)
+set(APPLE_TEST TRUE)
+
+include (CMP0156-Common.cmake)
diff --git a/Tests/RunCMake/CMP0156/CMP0156-NEW.cmake b/Tests/RunCMake/CMP0156/CMP0156-NEW.cmake
new file mode 100644
index 0000000..4387b37
--- /dev/null
+++ b/Tests/RunCMake/CMP0156/CMP0156-NEW.cmake
@@ -0,0 +1,4 @@
+
+cmake_policy(SET CMP0156 NEW)
+
+include (CMP0156-Common.cmake)
diff --git a/Tests/RunCMake/CMP0156/CMP0156-OLD-AppleClang-build-result.txt b/Tests/RunCMake/CMP0156/CMP0156-OLD-AppleClang-build-result.txt
new file mode 100644
index 0000000..b18168c
--- /dev/null
+++ b/Tests/RunCMake/CMP0156/CMP0156-OLD-AppleClang-build-result.txt
@@ -0,0 +1 @@
+.+
diff --git a/Tests/RunCMake/CMP0156/CMP0156-OLD-AppleClang-build-stdout.txt b/Tests/RunCMake/CMP0156/CMP0156-OLD-AppleClang-build-stdout.txt
new file mode 100644
index 0000000..b4afc27
--- /dev/null
+++ b/Tests/RunCMake/CMP0156/CMP0156-OLD-AppleClang-build-stdout.txt
@@ -0,0 +1,3 @@
+ld: warning: ignoring duplicate libraries: '.*liblib1.a', '.*liblib2.a'
+ld: fatal warning\(s\) induced error \(-fatal_warnings\)
+clang: error: linker command failed with exit code 1 \(use -v to see invocation\)
diff --git a/Tests/RunCMake/CMP0156/CMP0156-OLD-AppleClang.cmake b/Tests/RunCMake/CMP0156/CMP0156-OLD-AppleClang.cmake
new file mode 100644
index 0000000..33e1287
--- /dev/null
+++ b/Tests/RunCMake/CMP0156/CMP0156-OLD-AppleClang.cmake
@@ -0,0 +1,5 @@
+
+cmake_policy(SET CMP0156 OLD)
+set(APPLE_TEST TRUE)
+
+include (CMP0156-Common.cmake)
diff --git a/Tests/RunCMake/CMP0156/CMP0156-OLD.cmake b/Tests/RunCMake/CMP0156/CMP0156-OLD.cmake
new file mode 100644
index 0000000..b012a1a
--- /dev/null
+++ b/Tests/RunCMake/CMP0156/CMP0156-OLD.cmake
@@ -0,0 +1,4 @@
+
+cmake_policy(SET CMP0156 OLD)
+
+include (CMP0156-Common.cmake)
diff --git a/Tests/RunCMake/CMP0156/CMP0156-WARN-stderr.txt b/Tests/RunCMake/CMP0156/CMP0156-WARN-stderr.txt
new file mode 100644
index 0000000..f52d7d8
--- /dev/null
+++ b/Tests/RunCMake/CMP0156/CMP0156-WARN-stderr.txt
@@ -0,0 +1,35 @@
+CMake Warning \(dev\) at CMP0156-Common.cmake:[0-9]+ \(add_library\):
+ Policy CMP0156 is not set: De-duplicate libraries on link lines based on
+ linker capabilities. Run "cmake --help-policy CMP0156" for policy details.
+ Use the cmake_policy command to set the policy and suppress this warning.
+
+ Since the policy is not set, legacy libraries de-duplication strategy will
+ be applied.
+Call Stack \(most recent call first\):
+ CMP0156-WARN.cmake:[0-9]+ \(include\)
+ CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\) at CMP0156-Common.cmake:[0-9]+ \(add_library\):
+ Policy CMP0156 is not set: De-duplicate libraries on link lines based on
+ linker capabilities. Run "cmake --help-policy CMP0156" for policy details.
+ Use the cmake_policy command to set the policy and suppress this warning.
+
+ Since the policy is not set, legacy libraries de-duplication strategy will
+ be applied.
+Call Stack \(most recent call first\):
+ CMP0156-WARN.cmake:[0-9]+ \(include\)
+ CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\) at CMP0156-Common.cmake:[0-9]+ \(add_executable\):
+ Policy CMP0156 is not set: De-duplicate libraries on link lines based on
+ linker capabilities. Run "cmake --help-policy CMP0156" for policy details.
+ Use the cmake_policy command to set the policy and suppress this warning.
+
+ Since the policy is not set, legacy libraries de-duplication strategy will
+ be applied.
+Call Stack \(most recent call first\):
+ CMP0156-WARN.cmake:[0-9]+ \(include\)
+ CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0156/CMP0156-WARN.cmake b/Tests/RunCMake/CMP0156/CMP0156-WARN.cmake
new file mode 100644
index 0000000..5f469ef
--- /dev/null
+++ b/Tests/RunCMake/CMP0156/CMP0156-WARN.cmake
@@ -0,0 +1,4 @@
+
+set(CMAKE_POLICY_WARNING_CMP0156 TRUE)
+
+include (CMP0156-Common.cmake)
diff --git a/Tests/RunCMake/CMP0156/CMakeLists.txt b/Tests/RunCMake/CMP0156/CMakeLists.txt
new file mode 100644
index 0000000..922aad6
--- /dev/null
+++ b/Tests/RunCMake/CMP0156/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.27)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0156/RunCMakeTest.cmake b/Tests/RunCMake/CMP0156/RunCMakeTest.cmake
new file mode 100644
index 0000000..bd51830
--- /dev/null
+++ b/Tests/RunCMake/CMP0156/RunCMakeTest.cmake
@@ -0,0 +1,26 @@
+include(RunCMake)
+
+# CMP0156 control how libraries are specified for the link step
+# a sensible configuration is how circular dependency is handled
+
+macro(run_cmake_and_build test)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build)
+ set(RunCMake_TEST_OUTPUT_MERGE TRUE)
+ run_cmake(${test})
+ set(RunCMake_TEST_NO_CLEAN TRUE)
+ run_cmake_command(${test}-build ${CMAKE_COMMAND} --build . --config Release)
+ unset(RunCMake_TEST_NO_CLEAN)
+ unset(RunCMake_TEST_BINARY_DIR)
+ unset(RunCMake_TEST_OUTPUT_MERGE)
+endmacro()
+
+run_cmake(CMP0156-WARN)
+run_cmake_and_build(CMP0156-OLD)
+run_cmake_and_build(CMP0156-NEW)
+
+if (CMAKE_C_COMPILER_ID STREQUAL "AppleClang"
+ AND CMAKE_C_COMPILER_VERSION GREATER_EQUAL "15.0")
+ # special case for Apple: with CMP0156=OLD, linker will warning on duplicate libraries
+ run_cmake_and_build(CMP0156-OLD-AppleClang)
+ run_cmake_and_build(CMP0156-NEW-AppleClang)
+endif()
diff --git a/Tests/RunCMake/CMP0156/lib1.c b/Tests/RunCMake/CMP0156/lib1.c
new file mode 100644
index 0000000..faad375
--- /dev/null
+++ b/Tests/RunCMake/CMP0156/lib1.c
@@ -0,0 +1,7 @@
+
+extern void lib2(void);
+
+void lib1(void)
+{
+ lib2();
+}
diff --git a/Tests/RunCMake/CMP0156/lib2.c b/Tests/RunCMake/CMP0156/lib2.c
new file mode 100644
index 0000000..9db7914
--- /dev/null
+++ b/Tests/RunCMake/CMP0156/lib2.c
@@ -0,0 +1,7 @@
+
+extern void lib1(void);
+
+void lib2(void)
+{
+ lib1();
+}
diff --git a/Tests/RunCMake/CMP0156/lib3.c b/Tests/RunCMake/CMP0156/lib3.c
new file mode 100644
index 0000000..e63e456
--- /dev/null
+++ b/Tests/RunCMake/CMP0156/lib3.c
@@ -0,0 +1,7 @@
+
+#if defined(_WIN32)
+__declspec(dllexport)
+#endif
+ void lib3(void)
+{
+}
diff --git a/Tests/RunCMake/CMP0156/lib4.c b/Tests/RunCMake/CMP0156/lib4.c
new file mode 100644
index 0000000..a992168
--- /dev/null
+++ b/Tests/RunCMake/CMP0156/lib4.c
@@ -0,0 +1,9 @@
+
+#if defined(_WIN32)
+__declspec(dllimport)
+#endif
+ void lib3(void);
+
+void lib4(void)
+{
+}
diff --git a/Tests/RunCMake/CMP0156/main.c b/Tests/RunCMake/CMP0156/main.c
new file mode 100644
index 0000000..06edfd5
--- /dev/null
+++ b/Tests/RunCMake/CMP0156/main.c
@@ -0,0 +1,9 @@
+
+extern void lib1(void);
+
+int main(void)
+{
+ lib1();
+
+ return 0;
+}
diff --git a/Tests/RunCMake/CMP0156/main2.c b/Tests/RunCMake/CMP0156/main2.c
new file mode 100644
index 0000000..9fc2838
--- /dev/null
+++ b/Tests/RunCMake/CMP0156/main2.c
@@ -0,0 +1,9 @@
+
+extern void lib4(void);
+
+int main(void)
+{
+ lib4();
+
+ return 0;
+}
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 2b61fd1..9f8a459 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -170,6 +170,8 @@ if(NOT WIN32 OR CYGWIN)
endif()
add_RunCMake_test(CMP0153)
+add_RunCMake_test(CMP0156 -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
+ -DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION})
# The test for Policy 65 requires the use of the
# CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode
@@ -322,6 +324,7 @@ add_RunCMake_test(BuildDepends
-DCMAKE_C_LINK_DEPENDS_USE_COMPILER=${CMAKE_C_LINK_DEPENDS_USE_COMPILER}
-DCMake_TEST_BuildDepends_GNU_AS=${CMake_TEST_BuildDepends_GNU_AS}
)
+add_RunCMake_test(BuiltinTargets)
if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja")
add_RunCMake_test(Byproducts)
endif()
@@ -511,6 +514,7 @@ add_RunCMake_test(ctest_skipped_test)
add_RunCMake_test(ctest_update)
add_RunCMake_test(ctest_upload)
add_RunCMake_test(ctest_environment)
+add_RunCMake_test(ctest_empty_binary_directory)
add_RunCMake_test(ctest_fixtures)
add_RunCMake_test(define_property)
add_RunCMake_test(file -DCYGWIN=${CYGWIN} -DMSYS=${MSYS})
@@ -535,7 +539,7 @@ add_RunCMake_test(function)
add_RunCMake_test(block)
add_RunCMake_test(get_filename_component)
add_RunCMake_test(get_property)
-add_RunCMake_test(if)
+add_RunCMake_test(if -DMSYS=${MSYS})
add_RunCMake_test(include)
add_RunCMake_test(include_directories)
add_RunCMake_test(include_guard)
@@ -583,7 +587,9 @@ endfunction()
add_RunCMake_test_try_compile()
add_RunCMake_test(try_run -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
- -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID})
+ -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
+ -DCMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID}
+ -DCMAKE_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID})
add_RunCMake_test(set)
add_RunCMake_test(variable_watch)
add_RunCMake_test(while)
@@ -737,6 +743,15 @@ if((CMAKE_C_COMPILER_ID STREQUAL "AppleClang"
endif()
endif()
+if (CMAKE_SYSTEM_NAME MATCHES "(Linux|Darwin|Windows)"
+ AND CMAKE_C_COMPILER_ID MATCHES "^(AppleClang|Clang|GNU|MSVC|NVIDIA)$"
+ AND NOT CMAKE_GENERATOR STREQUAL "Green Hills MULTI")
+ add_RunCMake_test(LinkerSelection -DCMake_TEST_CUDA=${CMake_TEST_CUDA}
+ -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
+ -DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION})
+endif()
+
+add_RunCMake_test(LinkLibrariesProcessing)
add_RunCMake_test(File_Archive)
add_RunCMake_test(File_Configure)
add_RunCMake_test(File_Generate)
@@ -1055,7 +1070,7 @@ add_RunCMake_test(PrecompileHeaders -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
-DCMAKE_C_SIMULATE_ID=${CMAKE_C_SIMULATE_ID}
-DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION})
-add_RunCMake_test("UnityBuild")
+add_RunCMake_test(UnityBuild -DCMake_TEST_OBJC=${CMake_TEST_OBJC})
add_RunCMake_test(CMakePresets
-DPython_EXECUTABLE=${Python_EXECUTABLE}
-DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
@@ -1088,3 +1103,8 @@ endif()
if(WIN32)
add_RunCMake_test(Win32GenEx)
endif()
+
+if(CMake_TEST_IAR_TOOLCHAINS)
+ add_RunCMake_test(IAR -DCMake_TEST_IAR_TOOLCHAINS=${CMake_TEST_IAR_TOOLCHAINS})
+ set_property(TEST RunCMake.IAR APPEND PROPERTY LABELS "IAR")
+endif()
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index ca02b76..5086a3b 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -69,3 +69,4 @@ run_cpack_test_subtests(
)
run_cpack_test(PROJECT_META "RPM.PROJECT_META;DEB.PROJECT_META" false "MONOLITHIC;COMPONENT")
run_cpack_test_package_target(PRE_POST_SCRIPTS "ZIP" false "MONOLITHIC;COMPONENT")
+run_cpack_test_subtests(DUPLICATE_FILE "success;conflict_file;conflict_symlink" "TGZ" false "COMPONENT;GROUP")
diff --git a/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/ExpectedFiles.cmake
new file mode 100644
index 0000000..5341ecd
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/ExpectedFiles.cmake
@@ -0,0 +1,16 @@
+if(RunCMake_SUBTEST_SUFFIX STREQUAL "success")
+ if(PACKAGING_TYPE STREQUAL "COMPONENT")
+ set(EXPECTED_FILES_COUNT "1")
+ set(EXPECTED_FILE_CONTENT_1_LIST "/files;/files/1.txt;/files/2.txt;/files/3.txt;/files/4.txt;/files/5.txt;/files/6.txt;/files/7.txt;/files/8.txt;/files/symlink2")
+ elseif(PACKAGING_TYPE STREQUAL "GROUP")
+ set(EXPECTED_FILES_COUNT "3")
+ set(EXPECTED_FILE_1 "duplicate_file-0.1.1-*-g1.${cpack_archive_extension_}")
+ set(EXPECTED_FILE_CONTENT_1_LIST "/files;/files/1.txt;/files/2.txt;/files/3.txt;/files/4.txt;/files/5.txt;/files/6.txt;/files/symlink2")
+ set(EXPECTED_FILE_2 "duplicate_file-0.1.1-*-g2.${cpack_archive_extension_}")
+ set(EXPECTED_FILE_CONTENT_2_LIST "/files;/files/3.txt;/files/4.txt;/files/5.txt;/files/6.txt;/files/7.txt;/files/8.txt")
+ set(EXPECTED_FILE_3 "duplicate_file-0.1.1-*-c5.${cpack_archive_extension_}")
+ set(EXPECTED_FILE_CONTENT_3_LIST "/files;/files/5.txt;/files/6.txt;/files/7.txt;/files/8.txt;/files/9.txt")
+ endif ()
+else()
+ set(EXPECTED_FILES_COUNT "0")
+endif ()
diff --git a/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/conflict_file-stderr.txt b/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/conflict_file-stderr.txt
new file mode 100644
index 0000000..5544885
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/conflict_file-stderr.txt
@@ -0,0 +1 @@
+CPack Error: ERROR The data in files with the same filename is different.*
diff --git a/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/conflict_symlink-stderr.txt b/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/conflict_symlink-stderr.txt
new file mode 100644
index 0000000..5544885
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/conflict_symlink-stderr.txt
@@ -0,0 +1 @@
+CPack Error: ERROR The data in files with the same filename is different.*
diff --git a/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/test.cmake b/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/test.cmake
new file mode 100644
index 0000000..89d6784
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/test.cmake
@@ -0,0 +1,74 @@
+# Create files named 1 to 9
+foreach(i RANGE 1 9)
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${i}.txt" "This is file ${i}")
+endforeach()
+
+set(COMPONENT_NAMES c1 c2 c3 c4 c5)
+foreach(j RANGE 1 5)
+ # Select 4 file and install to the component
+ math(EXPR COMPONENT_IDX "${j} - 1")
+ list(GET COMPONENT_NAMES "${COMPONENT_IDX}" SELECTED_COMPONENT)
+ math(EXPR END_FILE "${j} + 4")
+ foreach(k RANGE ${j} ${END_FILE})
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${k}.txt" DESTINATION "files" COMPONENT ${SELECTED_COMPONENT})
+ endforeach()
+endforeach()
+
+if(RunCMake_SUBTEST_SUFFIX STREQUAL "conflict_file")
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conflict/1.txt" "This should create a conflict.")
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/conflict/1.txt" DESTINATION "files" COMPONENT c2)
+endif ()
+
+# You cannot create symlink in Windows test environment. Instead mock the symlink.
+if(NOT CMAKE_HOST_WIN32)
+ file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}/2.txt" "${CMAKE_CURRENT_BINARY_DIR}/symlink2" SYMBOLIC)
+else()
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/symlink2" "This is file 2")
+endif()
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/symlink2" DESTINATION "files" COMPONENT c1)
+
+if(RunCMake_SUBTEST_SUFFIX STREQUAL "conflict_symlink" AND NOT CMAKE_HOST_WIN32)
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/conflict)
+ file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}/1.txt" "${CMAKE_CURRENT_BINARY_DIR}/conflict/symlink2" SYMBOLIC)
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/conflict/symlink2" DESTINATION "files" COMPONENT c2)
+elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "conflict_symlink" AND CMAKE_HOST_WIN32)
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conflict/symlink2" "This should create a conflict.")
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/conflict/symlink2" DESTINATION "files" COMPONENT c2)
+else()
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/symlink2" DESTINATION "files" COMPONENT c2)
+endif ()
+
+
+if(PACKAGING_TYPE STREQUAL "COMPONENT")
+ set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON)
+ set(CPACK_COMPONENTS_ALL "c1;c2;c3;c4")
+elseif(PACKAGING_TYPE STREQUAL "GROUP")
+ set(CPACK_COMPONENTS_ONE_PACKAGE_PER_GROUP ON)
+ set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
+ include(CPackComponent)
+
+ cpack_add_component_group(g1 DISPLAY_NAME "Group 1")
+ cpack_add_component_group(g2 DISPLAY_NAME "Group 2")
+ cpack_add_component(c1
+ DISPLAY_NAME "Group 1"
+ DESCRIPTION "Component for Group 1"
+ GROUP g1
+ )
+ cpack_add_component(c2
+ DISPLAY_NAME "Group 1"
+ DESCRIPTION "Component for Group 1"
+ GROUP g1
+ )
+ cpack_add_component(c3
+ DISPLAY_NAME "Group 2"
+ DESCRIPTION "Component for Group 2"
+ GROUP g2
+ )
+ cpack_add_component(c4
+ DISPLAY_NAME "Group 2"
+ DESCRIPTION "Component for Group 2"
+ GROUP g2
+ )
+
+ set(CPACK_${GENERATOR_TYPE}_PACKAGE_GROUP g1 g2)
+endif ()
diff --git a/Tests/RunCMake/CXXModules/sources/c-anchor.c b/Tests/RunCMake/CXXModules/sources/c-anchor.c
index c782188..8adfcbb 100644
--- a/Tests/RunCMake/CXXModules/sources/c-anchor.c
+++ b/Tests/RunCMake/CXXModules/sources/c-anchor.c
@@ -1,4 +1,4 @@
-int c_anchor()
+int c_anchor(void)
{
return 0;
}
diff --git a/Tests/RunCMake/CommandLine/E_cat-stdin-stdout.txt b/Tests/RunCMake/CommandLine/E_cat-stdin-stdout.txt
new file mode 100644
index 0000000..8210d59
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_cat-stdin-stdout.txt
@@ -0,0 +1 @@
+^Hello world$
diff --git a/Tests/RunCMake/CommandLine/E_cat-stdin.cmake b/Tests/RunCMake/CommandLine/E_cat-stdin.cmake
new file mode 100644
index 0000000..e83e619
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_cat-stdin.cmake
@@ -0,0 +1,10 @@
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ell.txt" "ell")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/rld.txt" "rld")
+execute_process(
+ COMMAND ${CMAKE_COMMAND} -E echo_append "H"
+ COMMAND ${CMAKE_COMMAND} -E cat -
+ )
+execute_process(
+ COMMAND ${CMAKE_COMMAND} -E echo_append "o wo"
+ COMMAND ${CMAKE_COMMAND} -E cat "${CMAKE_CURRENT_BINARY_DIR}/ell.txt" - "${CMAKE_CURRENT_BINARY_DIR}/rld.txt"
+ )
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index b29e50a..03b9301 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -782,6 +782,8 @@ run_cmake_command(E_cat-without-double-dash ${CMAKE_COMMAND} -E cat "-file-start
unset(RunCMake_TEST_COMMAND_WORKING_DIRECTORY)
unset(out)
+run_cmake_command(E_cat-stdin ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_cat-stdin.cmake)
+
# Unset environment variables that are used for testing cmake -E
unset(ENV{TEST_ENV})
unset(ENV{TEST_ENV_EXPECTED})
diff --git a/Tests/RunCMake/CompileDefinitions/foo.c b/Tests/RunCMake/CompileDefinitions/foo.c
index 74a86e1..7d75e37 100644
--- a/Tests/RunCMake/CompileDefinitions/foo.c
+++ b/Tests/RunCMake/CompileDefinitions/foo.c
@@ -1,4 +1,4 @@
-void foo()
+void foo(void)
{
}
diff --git a/Tests/RunCMake/CompileWarningAsError/warn.c b/Tests/RunCMake/CompileWarningAsError/warn.c
index cd0c2ba..4041167 100644
--- a/Tests/RunCMake/CompileWarningAsError/warn.c
+++ b/Tests/RunCMake/CompileWarningAsError/warn.c
@@ -1,4 +1,4 @@
-static void unused_function();
+static void unused_function(void);
#ifdef __SUNPRO_C
KandR(x) int x;
diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-JOM.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-JOM.txt
index b7db7eb..bc5d9ea 100644
--- a/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-JOM.txt
+++ b/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-JOM.txt
@@ -3,7 +3,8 @@ CMake Error at BadCompilerC.cmake:2 \(enable_language\):
no-C-compiler
- is not a full path and was not found in the PATH.
+ is not a full path and was not found in the PATH.( Perhaps the extension is
+ missing\?)?
To use the JOM generator with Visual C\+\+, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-NMake.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-NMake.txt
index 03c5933..80d8a21 100644
--- a/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-NMake.txt
+++ b/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-NMake.txt
@@ -3,7 +3,8 @@ CMake Error at BadCompilerC.cmake:2 \(enable_language\):
no-C-compiler
- is not a full path and was not found in the PATH.
+ is not a full path and was not found in the PATH.( Perhaps the extension is
+ missing\?)?
To use the NMake generator with Visual C\+\+, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr.txt
index c98842d..96d02de 100644
--- a/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr.txt
+++ b/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr.txt
@@ -3,7 +3,8 @@ CMake Error at BadCompilerC.cmake:2 \(enable_language\):
no-C-compiler
- is not a full path and was not found in the PATH.
+ is not a full path and was not found in the PATH.( Perhaps the extension is
+ missing\?)?
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-JOM.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-JOM.txt
index 4b42ea6..d108787 100644
--- a/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-JOM.txt
+++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-JOM.txt
@@ -3,7 +3,8 @@ CMake Error at BadCompilerCXX.cmake:2 \(enable_language\):
no-CXX-compiler
- is not a full path and was not found in the PATH.
+ is not a full path and was not found in the PATH.( Perhaps the extension is
+ missing\?)?
To use the JOM generator with Visual C\+\+, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-NMake.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-NMake.txt
index 1bfcdcc..d3c0ccd 100644
--- a/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-NMake.txt
+++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-NMake.txt
@@ -3,7 +3,8 @@ CMake Error at BadCompilerCXX.cmake:2 \(enable_language\):
no-CXX-compiler
- is not a full path and was not found in the PATH.
+ is not a full path and was not found in the PATH.( Perhaps the extension is
+ missing\?)?
To use the NMake generator with Visual C\+\+, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr.txt
index 7ef4f5e..79db41d 100644
--- a/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr.txt
+++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr.txt
@@ -3,7 +3,8 @@ CMake Error at BadCompilerCXX.cmake:2 \(enable_language\):
no-CXX-compiler
- is not a full path and was not found in the PATH.
+ is not a full path and was not found in the PATH.( Perhaps the extension is
+ missing\?)?
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-JOM.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-JOM.txt
index f25a267..360a8c2 100644
--- a/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-JOM.txt
+++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-JOM.txt
@@ -3,7 +3,8 @@ CMake Error at BadCompilerCandCXX.cmake:3 \(project\):
no-C-compiler
- is not a full path and was not found in the PATH.
+ is not a full path and was not found in the PATH.( Perhaps the extension is
+ missing\?)?
To use the JOM generator with Visual C\+\+, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
@@ -21,7 +22,8 @@ CMake Error at BadCompilerCandCXX.cmake:3 \(project\):
no-CXX-compiler
- is not a full path and was not found in the PATH.
+ is not a full path and was not found in the PATH.( Perhaps the extension is
+ missing\?)?
To use the JOM generator with Visual C\+\+, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-NMake.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-NMake.txt
index ffcdce8..8438d0e 100644
--- a/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-NMake.txt
+++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-NMake.txt
@@ -3,7 +3,8 @@ CMake Error at BadCompilerCandCXX.cmake:3 \(project\):
no-C-compiler
- is not a full path and was not found in the PATH.
+ is not a full path and was not found in the PATH.( Perhaps the extension is
+ missing\?)?
To use the NMake generator with Visual C\+\+, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
@@ -21,7 +22,8 @@ CMake Error at BadCompilerCandCXX.cmake:3 \(project\):
no-CXX-compiler
- is not a full path and was not found in the PATH.
+ is not a full path and was not found in the PATH.( Perhaps the extension is
+ missing\?)?
To use the NMake generator with Visual C\+\+, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr.txt
index eecff54..cba0db2 100644
--- a/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr.txt
+++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr.txt
@@ -3,7 +3,8 @@ CMake Error at BadCompilerCandCXX.cmake:3 \(project\):
no-C-compiler
- is not a full path and was not found in the PATH.
+ is not a full path and was not found in the PATH.( Perhaps the extension is
+ missing\?)?
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
@@ -16,7 +17,8 @@ CMake Error at BadCompilerCandCXX.cmake:3 \(project\):
no-CXX-compiler
- is not a full path and was not found in the PATH.
+ is not a full path and was not found in the PATH.( Perhaps the extension is
+ missing\?)?
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
diff --git a/Tests/RunCMake/ExcludeFromAll/main.c b/Tests/RunCMake/ExcludeFromAll/main.c
index f8b643a..8488f4e 100644
--- a/Tests/RunCMake/ExcludeFromAll/main.c
+++ b/Tests/RunCMake/ExcludeFromAll/main.c
@@ -1,4 +1,4 @@
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/RunCMake/FetchContent/CMake/FindFDE-S.cmake b/Tests/RunCMake/FetchContent/CMake/FindFDE-S.cmake
new file mode 100644
index 0000000..e6f4e16
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/CMake/FindFDE-S.cmake
@@ -0,0 +1,6 @@
+if(NOT CMAKE_EXPORT_FIND_PACKAGE_NAME STREQUAL "SomeOtherValue")
+ message(FATAL_ERROR "Expected value of CMAKE_EXPORT_FIND_PACKAGE_NAME:\n SomeOtherValue\nActual value:\n ${CMAKE_EXPORT_FIND_PACKAGE_NAME}")
+endif()
+
+set(fp_called TRUE)
+set(FDE-S_FOUND TRUE)
diff --git a/Tests/RunCMake/FetchContent/CMake/FindFDE-U.cmake b/Tests/RunCMake/FetchContent/CMake/FindFDE-U.cmake
new file mode 100644
index 0000000..ef91cc3
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/CMake/FindFDE-U.cmake
@@ -0,0 +1,6 @@
+if(DEFINED CMAKE_EXPORT_FIND_PACKAGE_NAME)
+ message(FATAL_ERROR "CMAKE_EXPORT_FIND_PACKAGE_NAME should not be defined")
+endif()
+
+set(fp_called TRUE)
+set(FDE-U_FOUND TRUE)
diff --git a/Tests/RunCMake/FetchContent/FindDependencyExport.cmake b/Tests/RunCMake/FetchContent/FindDependencyExport.cmake
new file mode 100644
index 0000000..c79c357
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/FindDependencyExport.cmake
@@ -0,0 +1,78 @@
+include(FetchContent)
+
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
+
+unset(dp_called)
+unset(fp_called)
+set(_expected_export_find_package_name_dp FDE-U)
+FetchContent_Declare(
+ FDE-U
+ FIND_PACKAGE_ARGS
+ )
+FetchContent_MakeAvailable(FDE-U)
+
+if(NOT dp_called)
+ message(FATAL_ERROR "FetchContent_MakeAvailable did not call dependency provider")
+endif()
+if(NOT fp_called)
+ message(FATAL_ERROR "FetchContent_MakeAvailable did not call find_package()")
+endif()
+
+if(DEFINED CMAKE_EXPORT_FIND_PACKAGE_NAME)
+ message(FATAL_ERROR "CMAKE_EXPORT_FIND_PACKAGE_NAME should have been unset after FetchContent_MakeAvailable().\nActual value:\n ${CMAKE_EXPORT_FIND_PACKAGE_NAME}")
+endif()
+
+unset(sub_called)
+set(_expected_export_find_package_name_dp FDE-U-Sub)
+set(_expected_export_find_package_name_sub FDE-U-Sub)
+FetchContent_Declare(
+ FDE-U-Sub
+ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/FindDependencyExport
+ )
+FetchContent_MakeAvailable(FDE-U-Sub)
+
+if(NOT sub_called)
+ message(FATAL_ERROR "FetchContent_MakeAvailable did not call add_subdirectory()")
+endif()
+
+if(DEFINED CMAKE_EXPORT_FIND_PACKAGE_NAME)
+ message(FATAL_ERROR "CMAKE_EXPORT_FIND_PACKAGE_NAME should have been unset after FetchContent_MakeAvailable()")
+endif()
+
+unset(dp_called)
+unset(fp_called)
+set(CMAKE_EXPORT_FIND_PACKAGE_NAME SomeOtherValue)
+set(_expected_export_find_package_name_dp FDE-S)
+FetchContent_Declare(
+ FDE-S
+ FIND_PACKAGE_ARGS
+ )
+FetchContent_MakeAvailable(FDE-S)
+
+if(NOT dp_called)
+ message(FATAL_ERROR "FetchContent_MakeAvailable did not call dependency provider")
+endif()
+if(NOT fp_called)
+ message(FATAL_ERROR "FetchContent_MakeAvailable did not call find_package()")
+endif()
+
+if(NOT CMAKE_EXPORT_FIND_PACKAGE_NAME STREQUAL "SomeOtherValue")
+ message(FATAL_ERROR "Expected value of CMAKE_EXPORT_FIND_PACKAGE_NAME:\n SomeOtherValue\nActual value:\n ${CMAKE_EXPORT_FIND_PACKAGE_NAME}")
+endif()
+
+unset(sub_called)
+set(_expected_export_find_package_name_dp FDE-S-Sub)
+set(_expected_export_find_package_name_sub FDE-S-Sub)
+FetchContent_Declare(
+ FDE-S-Sub
+ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/FindDependencyExport
+ )
+FetchContent_MakeAvailable(FDE-S-Sub)
+
+if(NOT sub_called)
+ message(FATAL_ERROR "FetchContent_MakeAvailable did not call add_subdirectory()")
+endif()
+
+if(NOT CMAKE_EXPORT_FIND_PACKAGE_NAME STREQUAL "SomeOtherValue")
+ message(FATAL_ERROR "Expected value of CMAKE_EXPORT_FIND_PACKAGE_NAME:\n SomeOtherValue\nActual value:\n ${CMAKE_EXPORT_FIND_PACKAGE_NAME}")
+endif()
diff --git a/Tests/RunCMake/FetchContent/FindDependencyExport/CMakeLists.txt b/Tests/RunCMake/FetchContent/FindDependencyExport/CMakeLists.txt
new file mode 100644
index 0000000..8bd4036
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/FindDependencyExport/CMakeLists.txt
@@ -0,0 +1,5 @@
+if(NOT CMAKE_EXPORT_FIND_PACKAGE_NAME STREQUAL _expected_export_find_package_name_sub)
+ message(FATAL_ERROR "Expected value of CMAKE_EXPORT_FIND_PACKAGE_NAME:\n ${_expected_export_find_package_name_sub}\nActual value:\n ${CMAKE_EXPORT_FIND_PACKAGE_NAME}")
+endif()
+
+set(sub_called TRUE PARENT_SCOPE)
diff --git a/Tests/RunCMake/FetchContent/FindDependencyExportDP.cmake b/Tests/RunCMake/FetchContent/FindDependencyExportDP.cmake
new file mode 100644
index 0000000..7cabe51
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/FindDependencyExportDP.cmake
@@ -0,0 +1,11 @@
+function(fde_provide_dependency method name)
+ if(NOT CMAKE_EXPORT_FIND_PACKAGE_NAME STREQUAL _expected_export_find_package_name_dp)
+ message(FATAL_ERROR "Expected value of CMAKE_EXPORT_FIND_PACKAGE_NAME:\n ${_expected_export_find_package_name_dp}\nActual value:\n ${CMAKE_EXPORT_FIND_PACKAGE_NAME}")
+ endif()
+
+ set(dp_called TRUE PARENT_SCOPE)
+endfunction()
+
+cmake_language(SET_DEPENDENCY_PROVIDER fde_provide_dependency
+ SUPPORTED_METHODS FETCHCONTENT_MAKEAVAILABLE_SERIAL
+ )
diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
index d0790eb..0f443a7 100644
--- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
@@ -19,6 +19,10 @@ run_cmake(MakeAvailableTwice)
run_cmake(MakeAvailableUndeclared)
run_cmake(VerifyHeaderSet)
+run_cmake_with_options(FindDependencyExport
+ -D "CMAKE_PROJECT_TOP_LEVEL_INCLUDES=${CMAKE_CURRENT_LIST_DIR}/FindDependencyExportDP.cmake"
+)
+
run_cmake_with_options(ManualSourceDirectory
-D "FETCHCONTENT_SOURCE_DIR_WITHPROJECT=${CMAKE_CURRENT_LIST_DIR}/WithProject"
)
diff --git a/Tests/RunCMake/File_Generate/empty.c b/Tests/RunCMake/File_Generate/empty.c
index f097d0a..05ffe2d 100644
--- a/Tests/RunCMake/File_Generate/empty.c
+++ b/Tests/RunCMake/File_Generate/empty.c
@@ -2,7 +2,7 @@
#ifdef _WIN32
__declspec(dllexport)
#endif
- int empty_c()
+ int empty_c(void)
{
return 0;
}
diff --git a/Tests/RunCMake/Framework/consumer.c b/Tests/RunCMake/Framework/consumer.c
index a578976..4208a73 100644
--- a/Tests/RunCMake/Framework/consumer.c
+++ b/Tests/RunCMake/Framework/consumer.c
@@ -1,7 +1,7 @@
#include <Gui2/Gui.h>
-int consumer()
+int consumer(void)
{
foo();
diff --git a/Tests/RunCMake/Framework/foo.c b/Tests/RunCMake/Framework/foo.c
index b85b60d..6c1d727 100644
--- a/Tests/RunCMake/Framework/foo.c
+++ b/Tests/RunCMake/Framework/foo.c
@@ -1,4 +1,4 @@
-int foo()
+int foo(void)
{
return 42;
}
diff --git a/Tests/RunCMake/Framework/foo.h b/Tests/RunCMake/Framework/foo.h
index 5d5f8f0..5a2ca62 100644
--- a/Tests/RunCMake/Framework/foo.h
+++ b/Tests/RunCMake/Framework/foo.h
@@ -1 +1 @@
-int foo();
+int foo(void);
diff --git a/Tests/RunCMake/Framework/main.c b/Tests/RunCMake/Framework/main.c
index fc09922..74ae236 100644
--- a/Tests/RunCMake/Framework/main.c
+++ b/Tests/RunCMake/Framework/main.c
@@ -1,7 +1,7 @@
#include <Gui/Gui.h>
-int main()
+int main(void)
{
foo();
diff --git a/Tests/RunCMake/Framework/main2.c b/Tests/RunCMake/Framework/main2.c
index 11f4e4d..26908d7 100644
--- a/Tests/RunCMake/Framework/main2.c
+++ b/Tests/RunCMake/Framework/main2.c
@@ -1,7 +1,7 @@
#include <Gui2/Gui.h>
-int main()
+int main(void)
{
foo();
diff --git a/Tests/RunCMake/Graphviz/test_project/core_library.c b/Tests/RunCMake/Graphviz/test_project/core_library.c
index e8a8844..ce390ce 100644
--- a/Tests/RunCMake/Graphviz/test_project/core_library.c
+++ b/Tests/RunCMake/Graphviz/test_project/core_library.c
@@ -1,3 +1,3 @@
-void log_something()
+void log_something(void)
{
}
diff --git a/Tests/RunCMake/Graphviz/test_project/graphic_library.c b/Tests/RunCMake/Graphviz/test_project/graphic_library.c
index 958c8ab..7a31ad4 100644
--- a/Tests/RunCMake/Graphviz/test_project/graphic_library.c
+++ b/Tests/RunCMake/Graphviz/test_project/graphic_library.c
@@ -1,3 +1,3 @@
-void initialize_graphics()
+void initialize_graphics(void)
{
}
diff --git a/Tests/RunCMake/Graphviz/test_project/module.c b/Tests/RunCMake/Graphviz/test_project/module.c
index a508b09..56e833d 100644
--- a/Tests/RunCMake/Graphviz/test_project/module.c
+++ b/Tests/RunCMake/Graphviz/test_project/module.c
@@ -1,3 +1,3 @@
-static void some_function()
+static void some_function(void)
{
}
diff --git a/Tests/RunCMake/Graphviz/test_project/system_library.c b/Tests/RunCMake/Graphviz/test_project/system_library.c
index 5d67079..896bca4 100644
--- a/Tests/RunCMake/Graphviz/test_project/system_library.c
+++ b/Tests/RunCMake/Graphviz/test_project/system_library.c
@@ -1,3 +1,3 @@
-void initialize_system()
+void initialize_system(void)
{
}
diff --git a/Tests/RunCMake/IAR/CMakeLists.txt b/Tests/RunCMake/IAR/CMakeLists.txt
new file mode 100644
index 0000000..6a9ce76
--- /dev/null
+++ b/Tests/RunCMake/IAR/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.28)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/IAR/RunCMakeTest.cmake b/Tests/RunCMake/IAR/RunCMakeTest.cmake
new file mode 100644
index 0000000..2049740
--- /dev/null
+++ b/Tests/RunCMake/IAR/RunCMakeTest.cmake
@@ -0,0 +1,64 @@
+include(RunCMake)
+
+if(RunCMake_GENERATOR MATCHES "Makefile|Ninja")
+ file(GLOB _iar_toolchains
+ "${CMake_TEST_IAR_TOOLCHAINS}/bx*-*/*/bin/icc*" )
+ if(_iar_toolchains STREQUAL "")
+ message(FATAL_ERROR "Could not find any IAR toolchains at: ${CMake_TEST_IAR_TOOLCHAINS}.")
+ endif()
+endif()
+
+foreach(_iar_toolchain IN LISTS _iar_toolchains)
+ message(STATUS "Found IAR toolchain: ${_iar_toolchain}")
+ cmake_path(GET _iar_toolchain PARENT_PATH BIN_DIR)
+ cmake_path(GET BIN_DIR PARENT_PATH TOOLKIT_DIR)
+ cmake_path(GET TOOLKIT_DIR FILENAME ARCH)
+
+ # Sets the minimal requirements for linking each target architecture
+ if(ARCH STREQUAL rl78)
+ set(LINK_OPTS
+"--config_def _STACK_SIZE=256 \
+--config_def _NEAR_HEAP_SIZE=0x400 \
+--config_def _FAR_HEAP_SIZE=4096 \
+--config_def _HUGE_HEAP_SIZE=0 \
+--config_def _NEAR_CONST_LOCATION_START=0x2000 \
+--config_def _NEAR_CONST_LOCATION_SIZE=0x6F00 \
+--define_symbol _NEAR_CONST_LOCATION=0 \
+--config ${TOOLKIT_DIR}/config/lnkrl78_s3.icf" )
+ else()
+ set(LINK_OPTS "")
+ endif()
+
+ # Set IAR Assembler (ILINK || XLINK)
+ find_program(IAR_ASSEMBLER
+ NAMES iasm${ARCH} a${ARCH}
+ PATHS ${BIN_DIR}
+ REQUIRED )
+
+ set(RunCMake_TEST_OPTIONS
+ -DCMAKE_SYSTEM_NAME=Generic
+ -DCMAKE_C_COMPILER=${_iar_toolchain}
+ -DCMAKE_EXE_LINKER_FLAGS=${LINK_OPTS}
+ )
+ run_cmake(iar-c)
+
+ set(RunCMake_TEST_OPTIONS
+ -DCMAKE_SYSTEM_NAME=Generic
+ -DCMAKE_CXX_COMPILER=${_iar_toolchain}
+ -DCMAKE_EXE_LINKER_FLAGS=${LINK_OPTS}
+ )
+ run_cmake(iar-cxx)
+
+ set(RunCMake_TEST_OPTIONS
+ -DCMAKE_SYSTEM_NAME=Generic
+ -DCMAKE_ASM_COMPILER=${IAR_ASSEMBLER}
+ )
+ run_cmake(iar-asm)
+
+ set(RunCMake_TEST_OPTIONS
+ -DCMAKE_SYSTEM_NAME=Generic
+ -DCMAKE_C_COMPILER=${_iar_toolchain}
+ -DCMAKE_EXE_LINKER_FLAGS=${LINK_OPTS}
+ )
+ run_cmake(iar-lib)
+endforeach()
diff --git a/Tests/RunCMake/IAR/iar-asm.cmake b/Tests/RunCMake/IAR/iar-asm.cmake
new file mode 100644
index 0000000..7ff64f6
--- /dev/null
+++ b/Tests/RunCMake/IAR/iar-asm.cmake
@@ -0,0 +1,5 @@
+enable_language(ASM)
+
+add_executable(exec-asm)
+target_sources(exec-asm PRIVATE module.asm)
+target_link_options(exec-asm PRIVATE ${LINKER_OPTS})
diff --git a/Tests/RunCMake/IAR/iar-c.cmake b/Tests/RunCMake/IAR/iar-c.cmake
new file mode 100644
index 0000000..a36f096
--- /dev/null
+++ b/Tests/RunCMake/IAR/iar-c.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+
+add_executable(exec-c)
+target_sources(exec-c PRIVATE module.c)
+target_link_options(exec-c PRIVATE ${LINKER_OPTS})
diff --git a/Tests/RunCMake/IAR/iar-cxx.cmake b/Tests/RunCMake/IAR/iar-cxx.cmake
new file mode 100644
index 0000000..6b005b5
--- /dev/null
+++ b/Tests/RunCMake/IAR/iar-cxx.cmake
@@ -0,0 +1,5 @@
+enable_language(CXX)
+
+add_executable(exec-cxx)
+target_sources(exec-cxx PRIVATE module.cxx)
+target_link_options(exec-cxx PRIVATE ${LINKER_OPTS})
diff --git a/Tests/RunCMake/IAR/iar-lib.cmake b/Tests/RunCMake/IAR/iar-lib.cmake
new file mode 100644
index 0000000..78b3136
--- /dev/null
+++ b/Tests/RunCMake/IAR/iar-lib.cmake
@@ -0,0 +1,10 @@
+enable_language(C)
+
+add_library(iar-test-lib)
+target_sources(iar-test-lib PRIVATE libmod.c)
+
+add_executable(exec-lib-c)
+target_sources(exec-lib-c PRIVATE module.c)
+target_compile_definitions(exec-lib-c PRIVATE __USE_LIBFUN)
+target_link_libraries(exec-lib-c LINK_PUBLIC iar-test-lib)
+target_link_options(exec-lib-c PRIVATE ${LINKER_OPTS})
diff --git a/Tests/RunCMake/IAR/libmod.c b/Tests/RunCMake/IAR/libmod.c
new file mode 100644
index 0000000..d6c3b73
--- /dev/null
+++ b/Tests/RunCMake/IAR/libmod.c
@@ -0,0 +1,4 @@
+int iar_libfun()
+{
+ return 42;
+}
diff --git a/Tests/RunCMake/IAR/module.asm b/Tests/RunCMake/IAR/module.asm
new file mode 100644
index 0000000..1e08236
--- /dev/null
+++ b/Tests/RunCMake/IAR/module.asm
@@ -0,0 +1,41 @@
+#if defined(__IASM8051__) || defined(__IASM430__)
+ NAME main
+#else
+ MODULE main
+#endif
+
+ PUBLIC main
+ PUBLIC __iar_program_start
+ PUBLIC __program_start
+
+#if defined(__IASMSTM8__)
+ EXTERN CSTACK$$Limit
+ SECTION `.near_func.text`:CODE:NOROOT(0)
+#elif defined(__IASMAVR__)
+ ORG $0
+ RJMP main
+ RSEG CODE
+#elif defined(__IASM8051__)
+ ORG 0FFFEh
+ DC16 main
+ RSEG RCODE
+?cmain:
+#elif defined(__IASM430__)
+ ORG 0FFFEh
+ DC16 init
+ RSEG CSTACK
+ RSEG CODE
+init:
+ MOV #SFE(CSTACK), SP
+#else
+ EXTERN __iar_static_base$$GPREL
+ SECTION CSTACK:DATA:NOROOT(4)
+ SECTION `.cstartup`:CODE(2)
+ CODE
+#endif
+
+__program_start:
+__iar_program_start:
+main:
+ NOP
+ END
diff --git a/Tests/RunCMake/IAR/module.c b/Tests/RunCMake/IAR/module.c
new file mode 100644
index 0000000..2f72a42
--- /dev/null
+++ b/Tests/RunCMake/IAR/module.c
@@ -0,0 +1,14 @@
+#include "module.h"
+#if defined(__USE_LIBFUN)
+extern int iar_libfun();
+#endif
+__root int i;
+__root int main()
+{
+#if defined(__USE_LIBFUN)
+ i = iar_libfun();
+#else
+ i = INTERNAL;
+#endif
+ return i;
+}
diff --git a/Tests/RunCMake/IAR/module.cxx b/Tests/RunCMake/IAR/module.cxx
new file mode 100644
index 0000000..5604435
--- /dev/null
+++ b/Tests/RunCMake/IAR/module.cxx
@@ -0,0 +1,7 @@
+#include "module.h"
+__root int i;
+__root int main()
+{
+ i = INTERNAL;
+ return i;
+}
diff --git a/Tests/RunCMake/IAR/module.h b/Tests/RunCMake/IAR/module.h
new file mode 100644
index 0000000..5f9c87b
--- /dev/null
+++ b/Tests/RunCMake/IAR/module.h
@@ -0,0 +1,14 @@
+#ifndef __MODULE_H__
+#define __MODULE_H__
+
+#if defined(__cplusplus)
+# define INTERNAL 64
+#elif !defined(__cplusplus) && defined(__IAR_SYSTEMS_ICC__)
+# define INTERNAL 32
+#elif defined(__IAR_SYSTEMS_ASM__)
+# define INTERNAL 16
+#else
+# error "Unable to determine INTERNAL symbol."
+#endif /* __IAR_SYSTEMS_ICC */
+
+#endif /* __MODULE_H__ */
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/CMakeLists.txt b/Tests/RunCMake/LinkLibrariesProcessing/CMakeLists.txt
new file mode 100644
index 0000000..5773ae3
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.28...3.29)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration1-result.txt b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration1-stderr.txt b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration1-stderr.txt
new file mode 100644
index 0000000..2566d8f
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration1-stderr.txt
@@ -0,0 +1,7 @@
+CMake Error at InvalidConfiguration1.cmake:[0-9]+ \(add_executable\):
+ Erroneous option\(s\) for 'CMAKE_C_LINK_LIBRARIES_PROCESSING':
+
+ ORDER=
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration1.cmake b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration1.cmake
new file mode 100644
index 0000000..e79eb45
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration1.cmake
@@ -0,0 +1,9 @@
+
+enable_language(C)
+
+set(CMAKE_C_LINK_LIBRARIES_PROCESSING ORDER= UNICITY=ALL)
+
+add_library(lib STATIC lib.c)
+
+add_executable(main main.c)
+target_link_libraries(main PRIVATE lib)
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration2-result.txt b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration2-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration2-stderr.txt b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration2-stderr.txt
new file mode 100644
index 0000000..933031d
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration2-stderr.txt
@@ -0,0 +1,7 @@
+CMake Error at InvalidConfiguration2.cmake:[0-9]+ \(add_executable\):
+ Erroneous option\(s\) for 'CMAKE_C_LINK_LIBRARIES_PROCESSING':
+
+ ORDER
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration2.cmake b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration2.cmake
new file mode 100644
index 0000000..c9da734
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration2.cmake
@@ -0,0 +1,9 @@
+
+enable_language(C)
+
+set(CMAKE_C_LINK_LIBRARIES_PROCESSING UNICITY=ALL ORDER)
+
+add_library(lib STATIC lib.c)
+
+add_executable(main main.c)
+target_link_libraries(main PRIVATE lib)
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration3-result.txt b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration3-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration3-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration3-stderr.txt b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration3-stderr.txt
new file mode 100644
index 0000000..eba1eb2
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration3-stderr.txt
@@ -0,0 +1,7 @@
+CMake Error at InvalidConfiguration3.cmake:[0-9]+ \(add_executable\):
+ Erroneous option\(s\) for 'CMAKE_C_LINK_LIBRARIES_PROCESSING':
+
+ WRONG=REVERSE
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration3.cmake b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration3.cmake
new file mode 100644
index 0000000..a1311fe
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration3.cmake
@@ -0,0 +1,9 @@
+
+enable_language(C)
+
+set(CMAKE_C_LINK_LIBRARIES_PROCESSING WRONG=REVERSE UNICITY=ALL)
+
+add_library(lib STATIC lib.c)
+
+add_executable(main main.c)
+target_link_libraries(main PRIVATE lib)
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration4-result.txt b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration4-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration4-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration4-stderr.txt b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration4-stderr.txt
new file mode 100644
index 0000000..46d5513
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration4-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at InvalidConfiguration4.cmake:[0-9]+ \(add_executable\):
+ Erroneous option\(s\) for 'CMAKE_C_LINK_LIBRARIES_PROCESSING':
+
+ WRONG=REVERSE
+ UNICITY=WRONG
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration4.cmake b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration4.cmake
new file mode 100644
index 0000000..9d48f4f
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/InvalidConfiguration4.cmake
@@ -0,0 +1,9 @@
+
+enable_language(C)
+
+set(CMAKE_C_LINK_LIBRARIES_PROCESSING WRONG=REVERSE UNICITY=WRONG)
+
+add_library(lib STATIC lib.c)
+
+add_executable(main main.c)
+target_link_libraries(main PRIVATE lib)
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/Invalid_ORDER-result.txt b/Tests/RunCMake/LinkLibrariesProcessing/Invalid_ORDER-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/Invalid_ORDER-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/Invalid_ORDER-stderr.txt b/Tests/RunCMake/LinkLibrariesProcessing/Invalid_ORDER-stderr.txt
new file mode 100644
index 0000000..33a7552
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/Invalid_ORDER-stderr.txt
@@ -0,0 +1,7 @@
+CMake Error at Invalid_ORDER.cmake:[0-9]+ \(add_executable\):
+ Erroneous option\(s\) for 'CMAKE_C_LINK_LIBRARIES_PROCESSING':
+
+ ORDER=WRONG
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/Invalid_ORDER.cmake b/Tests/RunCMake/LinkLibrariesProcessing/Invalid_ORDER.cmake
new file mode 100644
index 0000000..72a7e02
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/Invalid_ORDER.cmake
@@ -0,0 +1,9 @@
+
+enable_language(C)
+
+set(CMAKE_C_LINK_LIBRARIES_PROCESSING ORDER=WRONG UNICITY=ALL)
+
+add_library(lib STATIC lib.c)
+
+add_executable(main main.c)
+target_link_libraries(main PRIVATE lib)
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/Invalid_UNICITY-result.txt b/Tests/RunCMake/LinkLibrariesProcessing/Invalid_UNICITY-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/Invalid_UNICITY-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/Invalid_UNICITY-stderr.txt b/Tests/RunCMake/LinkLibrariesProcessing/Invalid_UNICITY-stderr.txt
new file mode 100644
index 0000000..4d759b7
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/Invalid_UNICITY-stderr.txt
@@ -0,0 +1,7 @@
+CMake Error at Invalid_UNICITY.cmake:[0-9]+ \(add_executable\):
+ Erroneous option\(s\) for 'CMAKE_C_LINK_LIBRARIES_PROCESSING':
+
+ UNICITY=WRONG
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/Invalid_UNICITY.cmake b/Tests/RunCMake/LinkLibrariesProcessing/Invalid_UNICITY.cmake
new file mode 100644
index 0000000..f423eef
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/Invalid_UNICITY.cmake
@@ -0,0 +1,9 @@
+
+enable_language(C)
+
+set(CMAKE_C_LINK_LIBRARIES_PROCESSING ORDER=REVERSE UNICITY=WRONG)
+
+add_library(lib STATIC lib.c)
+
+add_executable(main main.c)
+target_link_libraries(main PRIVATE lib)
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/RunCMakeTest.cmake b/Tests/RunCMake/LinkLibrariesProcessing/RunCMakeTest.cmake
new file mode 100644
index 0000000..763f48b
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/RunCMakeTest.cmake
@@ -0,0 +1,8 @@
+include(RunCMake)
+
+run_cmake(Invalid_ORDER)
+run_cmake(Invalid_UNICITY)
+run_cmake(InvalidConfiguration1)
+run_cmake(InvalidConfiguration2)
+run_cmake(InvalidConfiguration3)
+run_cmake(InvalidConfiguration4)
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/lib.c b/Tests/RunCMake/LinkLibrariesProcessing/lib.c
new file mode 100644
index 0000000..17a4148
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/lib.c
@@ -0,0 +1,4 @@
+
+void lib(void)
+{
+}
diff --git a/Tests/RunCMake/LinkLibrariesProcessing/main.c b/Tests/RunCMake/LinkLibrariesProcessing/main.c
new file mode 100644
index 0000000..402eac3
--- /dev/null
+++ b/Tests/RunCMake/LinkLibrariesProcessing/main.c
@@ -0,0 +1,5 @@
+
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/LinkerSelection/AppleClassic.cmake b/Tests/RunCMake/LinkerSelection/AppleClassic.cmake
new file mode 100644
index 0000000..62a12ad
--- /dev/null
+++ b/Tests/RunCMake/LinkerSelection/AppleClassic.cmake
@@ -0,0 +1,7 @@
+
+enable_language(C)
+
+set(CMAKE_LINKER_TYPE APPLE_CLASSIC)
+
+add_executable(main main.c)
+target_link_libraries(main PRIVATE m m)
diff --git a/Tests/RunCMake/LinkerSelection/CMakeLists.txt b/Tests/RunCMake/LinkerSelection/CMakeLists.txt
new file mode 100644
index 0000000..6a9ce76
--- /dev/null
+++ b/Tests/RunCMake/LinkerSelection/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.28)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/LinkerSelection/CustomLinkerType-build-check.cmake b/Tests/RunCMake/LinkerSelection/CustomLinkerType-build-check.cmake
new file mode 100644
index 0000000..235c38e
--- /dev/null
+++ b/Tests/RunCMake/LinkerSelection/CustomLinkerType-build-check.cmake
@@ -0,0 +1,2 @@
+
+include("${CMAKE_CURRENT_LIST_DIR}/LinkerType-validation.cmake")
diff --git a/Tests/RunCMake/LinkerSelection/CustomLinkerType.cmake b/Tests/RunCMake/LinkerSelection/CustomLinkerType.cmake
new file mode 100644
index 0000000..4bf98b0
--- /dev/null
+++ b/Tests/RunCMake/LinkerSelection/CustomLinkerType.cmake
@@ -0,0 +1,36 @@
+
+enable_language(C)
+
+set(CMAKE_C_USING_LINKER_FOO_C "${CMAKE_C_USING_LINKER_LLD}")
+
+add_executable(main main.c)
+set_property(TARGET main PROPERTY LINKER_TYPE "$<$<LINK_LANGUAGE:C>:FOO_C>$<$<LINK_LANGUAGE:CUDA>:FOO_CUDA>")
+
+if(CMake_TEST_CUDA)
+ enable_language(CUDA)
+
+ set(CMAKE_CUDA_USING_LINKER_FOO_CUDA "${CMAKE_CUDA_USING_LINKER_LLD}")
+
+ add_executable(mainCU main.cu)
+ set_property(TARGET mainCU PROPERTY LINKER_TYPE "$<$<LINK_LANGUAGE:C>:FOO_C>$<$<LINK_LANGUAGE:CUDA>:FOO_CUDA>")
+endif()
+
+#
+# Generate file for validation
+#
+if (CMAKE_C_USING_LINKER_MODE STREQUAL "TOOL")
+ cmake_path(GET CMAKE_C_USING_LINKER_FOO_C FILENAME LINKER_TYPE_OPTION)
+else()
+ set(LINKER_TYPE_OPTION "${CMAKE_C_USING_LINKER_FOO_C}")
+endif()
+if(CMake_TEST_CUDA)
+ if (CMAKE_CUDA_USING_LINKER_MODE STREQUAL "TOOL")
+ cmake_path(GET CMAKE_CUDA_USING_LINKER_FOO_CUDA FILENAME CUDA_LINKER)
+ else()
+ set(CUDA_LINKER "${CMAKE_CUDA_USING_LINKER_FOO_CUDA}")
+ endif()
+ string(APPEND LINKER_TYPE_OPTION "|${CUDA_LINKER}")
+endif()
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LINKER_TYPE_OPTION.cmake"
+ "set(LINKER_TYPE_OPTION \"${LINKER_TYPE_OPTION}\")\n")
diff --git a/Tests/RunCMake/LinkerSelection/InvalidLinkerType-result.txt b/Tests/RunCMake/LinkerSelection/InvalidLinkerType-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/LinkerSelection/InvalidLinkerType-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/LinkerSelection/InvalidLinkerType-stderr.txt b/Tests/RunCMake/LinkerSelection/InvalidLinkerType-stderr.txt
new file mode 100644
index 0000000..11aea7a
--- /dev/null
+++ b/Tests/RunCMake/LinkerSelection/InvalidLinkerType-stderr.txt
@@ -0,0 +1,3 @@
+CMake Error in CMakeLists.txt:
+ LINKER_TYPE 'FOO' is unknown. Did you forgot to define
+ 'CMAKE_C_USING_LINKER_FOO' variable\?
diff --git a/Tests/RunCMake/LinkerSelection/InvalidLinkerType.cmake b/Tests/RunCMake/LinkerSelection/InvalidLinkerType.cmake
new file mode 100644
index 0000000..bbe398c
--- /dev/null
+++ b/Tests/RunCMake/LinkerSelection/InvalidLinkerType.cmake
@@ -0,0 +1,5 @@
+
+enable_language(C)
+
+set(CMAKE_LINKER_TYPE FOO)
+add_executable(main main.c)
diff --git a/Tests/RunCMake/LinkerSelection/LinkerType-validation.cmake b/Tests/RunCMake/LinkerSelection/LinkerType-validation.cmake
new file mode 100644
index 0000000..3f82479
--- /dev/null
+++ b/Tests/RunCMake/LinkerSelection/LinkerType-validation.cmake
@@ -0,0 +1,9 @@
+
+include ("${RunCMake_TEST_BINARY_DIR}/LINKER_TYPE_OPTION.cmake")
+
+# In some environment, `=` character is escaped
+string(REPLACE "=" "\\\\?=" LINKER_TYPE_OPTION "${LINKER_TYPE_OPTION}")
+
+if (NOT actual_stdout MATCHES "${LINKER_TYPE_OPTION}")
+ set (RunCMake_TEST_FAILED "Not found expected '${LINKER_TYPE_OPTION}'.")
+endif()
diff --git a/Tests/RunCMake/LinkerSelection/RunCMakeTest.cmake b/Tests/RunCMake/LinkerSelection/RunCMakeTest.cmake
new file mode 100644
index 0000000..cae4ca4
--- /dev/null
+++ b/Tests/RunCMake/LinkerSelection/RunCMakeTest.cmake
@@ -0,0 +1,44 @@
+include(RunCMake)
+
+if (RunCMake_GENERATOR MATCHES "Visual Studio 9 2008")
+ run_cmake(UnsupportedLinkerType)
+ return()
+endif()
+
+run_cmake(InvalidLinkerType)
+
+# look-up for LLVM linker
+if (WIN32)
+ set (LINKER_NAMES lld-link)
+else()
+ set(LINKER_NAMES ld.lld ld64.lld)
+endif()
+find_program(LLD_LINKER NAMES ${LINKER_NAMES})
+
+macro(run_cmake_and_build test)
+ run_cmake_with_options(${test} -DCMake_TEST_CUDA=${CMake_TEST_CUDA})
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ if(CMake_TEST_CUDA)
+ string(APPEND "|${CMAKE_CUDA_USING_LINKER_LLD}")
+ endif()
+ run_cmake_command(${test}-build ${CMAKE_COMMAND} --build . --config Release --verbose ${ARGN})
+
+ unset(RunCMake_TEST_BINARY_DIR)
+ unset(RunCMake_TEST_NO_CLEAN)
+endmacro()
+
+if(LLD_LINKER)
+ block(SCOPE_FOR VARIABLES)
+ set(CMAKE_VERBOSE_MAKEFILE TRUE)
+ set(CMAKE_C_USE_RESPONSE_FILE_FOR_LIBRARIES FALSE)
+ set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_LIBRARIES FALSE)
+
+ run_cmake_and_build(ValidLinkerType)
+ run_cmake_and_build(CustomLinkerType)
+ endblock()
+endif()
+
+if(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "15.0")
+ run_cmake_and_build(AppleClassic)
+endif()
diff --git a/Tests/RunCMake/LinkerSelection/UnsupportedLinkerType-result.txt b/Tests/RunCMake/LinkerSelection/UnsupportedLinkerType-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/LinkerSelection/UnsupportedLinkerType-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/LinkerSelection/UnsupportedLinkerType-stderr.txt b/Tests/RunCMake/LinkerSelection/UnsupportedLinkerType-stderr.txt
new file mode 100644
index 0000000..6473451
--- /dev/null
+++ b/Tests/RunCMake/LinkerSelection/UnsupportedLinkerType-stderr.txt
@@ -0,0 +1,3 @@
+CMake Error at UnsupportedLinkerType.cmake:[0-9]+ \(add_executable\):
+ 'LINKER_TYPE' property, specified on target 'main', is not supported by
+ this generator.
diff --git a/Tests/RunCMake/LinkerSelection/UnsupportedLinkerType.cmake b/Tests/RunCMake/LinkerSelection/UnsupportedLinkerType.cmake
new file mode 100644
index 0000000..1b0703c
--- /dev/null
+++ b/Tests/RunCMake/LinkerSelection/UnsupportedLinkerType.cmake
@@ -0,0 +1,5 @@
+
+enable_language(C)
+
+set(CMAKE_LINKER_TYPE LDD)
+add_executable(main main.c)
diff --git a/Tests/RunCMake/LinkerSelection/ValidLinkerType-build-check.cmake b/Tests/RunCMake/LinkerSelection/ValidLinkerType-build-check.cmake
new file mode 100644
index 0000000..235c38e
--- /dev/null
+++ b/Tests/RunCMake/LinkerSelection/ValidLinkerType-build-check.cmake
@@ -0,0 +1,2 @@
+
+include("${CMAKE_CURRENT_LIST_DIR}/LinkerType-validation.cmake")
diff --git a/Tests/RunCMake/LinkerSelection/ValidLinkerType.cmake b/Tests/RunCMake/LinkerSelection/ValidLinkerType.cmake
new file mode 100644
index 0000000..a685ac1
--- /dev/null
+++ b/Tests/RunCMake/LinkerSelection/ValidLinkerType.cmake
@@ -0,0 +1,32 @@
+
+enable_language(C)
+
+set(CMAKE_LINKER_TYPE LLD)
+
+add_executable(main main.c)
+
+if(CMake_TEST_CUDA)
+ enable_language(CUDA)
+
+ add_executable(mainCU main.cu)
+endif()
+
+#
+# Generate file for validation
+#
+if (CMAKE_C_USING_LINKER_MODE STREQUAL "TOOL")
+ cmake_path(GET CMAKE_C_USING_LINKER_LLD FILENAME LINKER_TYPE_OPTION)
+else()
+ set(LINKER_TYPE_OPTION "${CMAKE_C_USING_LINKER_LLD}")
+endif()
+if(CMake_TEST_CUDA)
+ if (CMAKE_CUDA_USING_LINKER_MODE STREQUAL "TOOL")
+ cmake_path(GET CMAKE_CUDA_USING_LINKER_LLD FILENAME CUDA_LINKER)
+ else()
+ set(CUDA_LINKER "${CMAKE_CUDA_USING_LINKER_LLD}")
+ endif()
+ string(APPEND LINKER_TYPE_OPTION "|${CUDA_LINKER}")
+endif()
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LINKER_TYPE_OPTION.cmake"
+ "set(LINKER_TYPE_OPTION \"${LINKER_TYPE_OPTION}\")\n")
diff --git a/Tests/RunCMake/LinkerSelection/main.c b/Tests/RunCMake/LinkerSelection/main.c
new file mode 100644
index 0000000..8488f4e
--- /dev/null
+++ b/Tests/RunCMake/LinkerSelection/main.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/LinkerSelection/main.cu b/Tests/RunCMake/LinkerSelection/main.cu
new file mode 100644
index 0000000..766b775
--- /dev/null
+++ b/Tests/RunCMake/LinkerSelection/main.cu
@@ -0,0 +1,5 @@
+
+int main()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/Ninja/CheckNoPrefixSubDirScript.cmake b/Tests/RunCMake/Ninja/CheckNoPrefixSubDirScript.cmake
index 5a03fcb..09fd7e9 100644
--- a/Tests/RunCMake/Ninja/CheckNoPrefixSubDirScript.cmake
+++ b/Tests/RunCMake/Ninja/CheckNoPrefixSubDirScript.cmake
@@ -1,6 +1,6 @@
# Check that the prefix sub-directory is not repeated.
-if(EXISTS "${CUR_BIN_DIR}/${NINJA_OUTPUT_PATH_PREFIX}")
+if(NINJA_OUTPUT_PATH_PREFIX AND EXISTS "${CUR_BIN_DIR}/${NINJA_OUTPUT_PATH_PREFIX}")
message(FATAL_ERROR
"no sub directory named after the CMAKE_NINJA_OUTPUT_PATH_PREFIX "
"should be in the binary directory."
diff --git a/Tests/RunCMake/Ninja/CustomCommandDepfile-check.cmake b/Tests/RunCMake/Ninja/CustomCommandDepfile-check.cmake
index edde0c0..3016816 100644
--- a/Tests/RunCMake/Ninja/CustomCommandDepfile-check.cmake
+++ b/Tests/RunCMake/Ninja/CustomCommandDepfile-check.cmake
@@ -10,3 +10,38 @@ if(NOT "${build_file}" MATCHES "depfile = test_Debug\\.d")
string(CONCAT no_test_Debug_d "\nLog file:\n ${log}\n" "does not have expected line: depfile = test_Debug.d")
list(APPEND RunCMake_TEST_FAILED "${no_test_Debug_d}")
endif()
+
+function(_run_ninja dir)
+ execute_process(
+ COMMAND "${RunCMake_MAKE_PROGRAM}" ${ARGN}
+ WORKING_DIRECTORY "${dir}"
+ OUTPUT_VARIABLE ninja_stdout
+ ERROR_VARIABLE ninja_stderr
+ RESULT_VARIABLE ninja_result
+ )
+ if(NOT ninja_result EQUAL 0)
+ message(STATUS "
+============ beginning of ninja's stdout ============
+${ninja_stdout}
+=============== end of ninja's stdout ===============
+")
+ message(STATUS "
+============ beginning of ninja's stderr ============
+${ninja_stderr}
+=============== end of ninja's stderr ===============
+")
+ message(FATAL_ERROR
+ "top ninja build failed exited with status ${ninja_result}")
+ endif()
+ set(ninja_stdout "${ninja_stdout}" PARENT_SCOPE)
+endfunction()
+
+_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfile-build")
+_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfile-build" -t deps hello.copy.c)
+if (ninja_stdout MATCHES "deps not found")
+ list(APPEND RunCMake_TEST_FAILED "Ninja did not track the deps of hello.copy.c in the database")
+endif ()
+_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfile-build" -t deps hello.copy2.c)
+if (ninja_stdout MATCHES "deps not found")
+ list(APPEND RunCMake_TEST_FAILED "Ninja did not track the deps of hello.copy2.c in the database")
+endif ()
diff --git a/Tests/RunCMake/Ninja/CustomCommandDepfileAsByproduct-check.cmake b/Tests/RunCMake/Ninja/CustomCommandDepfileAsByproduct-check.cmake
new file mode 100644
index 0000000..b2a553b
--- /dev/null
+++ b/Tests/RunCMake/Ninja/CustomCommandDepfileAsByproduct-check.cmake
@@ -0,0 +1,47 @@
+set(log "${RunCMake_BINARY_DIR}/CustomCommandDepfileAsByproduct-build/build.ninja")
+file(READ "${log}" build_file)
+
+set(RunCMake_TEST_FAILED)
+if(NOT "${build_file}" MATCHES "depfile = test\\.d")
+ string(CONCAT no_test_d "Log file:\n ${log}\n" "does not have expected line: depfile = test.d")
+ list(APPEND RunCMake_TEST_FAILED "${no_test_d}")
+endif()
+if(NOT "${build_file}" MATCHES "depfile = test_Debug\\.d")
+ string(CONCAT no_test_Debug_d "\nLog file:\n ${log}\n" "does not have expected line: depfile = test_Debug.d")
+ list(APPEND RunCMake_TEST_FAILED "${no_test_Debug_d}")
+endif()
+
+function(_run_ninja dir)
+ execute_process(
+ COMMAND "${RunCMake_MAKE_PROGRAM}" ${ARGN}
+ WORKING_DIRECTORY "${dir}"
+ OUTPUT_VARIABLE ninja_stdout
+ ERROR_VARIABLE ninja_stderr
+ RESULT_VARIABLE ninja_result
+ )
+ if(NOT ninja_result EQUAL 0)
+ message(STATUS "
+============ beginning of ninja's stdout ============
+${ninja_stdout}
+=============== end of ninja's stdout ===============
+")
+ message(STATUS "
+============ beginning of ninja's stderr ============
+${ninja_stderr}
+=============== end of ninja's stderr ===============
+")
+ message(FATAL_ERROR
+ "top ninja build failed exited with status ${ninja_result}")
+ endif()
+ set(ninja_stdout "${ninja_stdout}" PARENT_SCOPE)
+endfunction()
+
+_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsByproduct-build")
+_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsByproduct-build" -t deps hello.copy.c)
+if (NOT ninja_stdout MATCHES "deps not found")
+ list(APPEND RunCMake_TEST_FAILED "Ninja tracked the deps of hello.copy.c in the database")
+endif ()
+_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsByproduct-build" -t deps hello.copy2.c)
+if (NOT ninja_stdout MATCHES "deps not found")
+ list(APPEND RunCMake_TEST_FAILED "Ninja tracked the deps of hello.copy2.c in the database")
+endif ()
diff --git a/Tests/RunCMake/Ninja/CustomCommandDepfileAsByproduct.cmake b/Tests/RunCMake/Ninja/CustomCommandDepfileAsByproduct.cmake
new file mode 100644
index 0000000..cf3b35d
--- /dev/null
+++ b/Tests/RunCMake/Ninja/CustomCommandDepfileAsByproduct.cmake
@@ -0,0 +1,24 @@
+add_custom_command(
+ OUTPUT hello.copy.c
+ BYPRODUCTS "test.d"
+ COMMAND "${CMAKE_COMMAND}" -E copy
+ "${CMAKE_CURRENT_SOURCE_DIR}/hello.c"
+ hello.copy.c
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ DEPFILE "test.d"
+ )
+
+add_custom_command(
+ OUTPUT hello.copy2.c
+ BYPRODUCTS "test_$<CONFIG>.d"
+ COMMAND "${CMAKE_COMMAND}" -E copy
+ "${CMAKE_CURRENT_SOURCE_DIR}/hello.c"
+ hello.copy2.c
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ DEPFILE "test_$<CONFIG>.d"
+ )
+
+add_custom_target(copy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/hello.copy.c"
+ "${CMAKE_CURRENT_BINARY_DIR}/hello.copy2.c")
+
+include(CheckNoPrefixSubDir.cmake)
diff --git a/Tests/RunCMake/Ninja/CustomCommandDepfileAsOutput-check.cmake b/Tests/RunCMake/Ninja/CustomCommandDepfileAsOutput-check.cmake
new file mode 100644
index 0000000..4d738c8
--- /dev/null
+++ b/Tests/RunCMake/Ninja/CustomCommandDepfileAsOutput-check.cmake
@@ -0,0 +1,47 @@
+set(log "${RunCMake_BINARY_DIR}/CustomCommandDepfileAsOutput-build/build.ninja")
+file(READ "${log}" build_file)
+
+set(RunCMake_TEST_FAILED)
+if(NOT "${build_file}" MATCHES "depfile = test\\.d")
+ string(CONCAT no_test_d "Log file:\n ${log}\n" "does not have expected line: depfile = test.d")
+ list(APPEND RunCMake_TEST_FAILED "${no_test_d}")
+endif()
+if(NOT "${build_file}" MATCHES "depfile = test_Debug\\.d")
+ string(CONCAT no_test_Debug_d "\nLog file:\n ${log}\n" "does not have expected line: depfile = test_Debug.d")
+ list(APPEND RunCMake_TEST_FAILED "${no_test_Debug_d}")
+endif()
+
+function(_run_ninja dir)
+ execute_process(
+ COMMAND "${RunCMake_MAKE_PROGRAM}" ${ARGN}
+ WORKING_DIRECTORY "${dir}"
+ OUTPUT_VARIABLE ninja_stdout
+ ERROR_VARIABLE ninja_stderr
+ RESULT_VARIABLE ninja_result
+ )
+ if(NOT ninja_result EQUAL 0)
+ message(STATUS "
+============ beginning of ninja's stdout ============
+${ninja_stdout}
+=============== end of ninja's stdout ===============
+")
+ message(STATUS "
+============ beginning of ninja's stderr ============
+${ninja_stderr}
+=============== end of ninja's stderr ===============
+")
+ message(FATAL_ERROR
+ "top ninja build failed exited with status ${ninja_result}")
+ endif()
+ set(ninja_stdout "${ninja_stdout}" PARENT_SCOPE)
+endfunction()
+
+_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsOutput-build")
+_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsOutput-build" -t deps hello.copy.c)
+if (NOT ninja_stdout MATCHES "deps not found")
+ list(APPEND RunCMake_TEST_FAILED "Ninja tracked the deps of hello.copy.c in the database")
+endif ()
+_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsOutput-build" -t deps hello.copy2.c)
+if (NOT ninja_stdout MATCHES "deps not found")
+ list(APPEND RunCMake_TEST_FAILED "Ninja tracked the deps of hello.copy2.c in the database")
+endif ()
diff --git a/Tests/RunCMake/Ninja/CustomCommandDepfileAsOutput.cmake b/Tests/RunCMake/Ninja/CustomCommandDepfileAsOutput.cmake
new file mode 100644
index 0000000..07a12b7
--- /dev/null
+++ b/Tests/RunCMake/Ninja/CustomCommandDepfileAsOutput.cmake
@@ -0,0 +1,24 @@
+add_custom_command(
+ OUTPUT hello.copy.c
+ "test.d"
+ COMMAND "${CMAKE_COMMAND}" -E copy
+ "${CMAKE_CURRENT_SOURCE_DIR}/hello.c"
+ hello.copy.c
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ DEPFILE "test.d"
+ )
+
+add_custom_command(
+ OUTPUT hello.copy2.c
+ "test_$<CONFIG>.d"
+ COMMAND "${CMAKE_COMMAND}" -E copy
+ "${CMAKE_CURRENT_SOURCE_DIR}/hello.c"
+ hello.copy2.c
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ DEPFILE "test_$<CONFIG>.d"
+ )
+
+add_custom_target(copy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/hello.copy.c"
+ "${CMAKE_CURRENT_BINARY_DIR}/hello.copy2.c")
+
+include(CheckNoPrefixSubDir.cmake)
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 69f2587..9777d17 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -100,6 +100,8 @@ run_CMP0058(NEW-no)
run_CMP0058(NEW-by)
run_cmake_with_options(CustomCommandDepfile -DCMAKE_BUILD_TYPE=Debug)
+run_cmake_with_options(CustomCommandDepfileAsOutput -DCMAKE_BUILD_TYPE=Debug)
+run_cmake_with_options(CustomCommandDepfileAsByproduct -DCMAKE_BUILD_TYPE=Debug)
run_cmake(CustomCommandJobPool)
run_cmake(JobPoolUsesTerminal)
diff --git a/Tests/RunCMake/Ninja/dep.c b/Tests/RunCMake/Ninja/dep.c
index 728f031..a576b6e 100644
--- a/Tests/RunCMake/Ninja/dep.c
+++ b/Tests/RunCMake/Ninja/dep.c
@@ -1,4 +1,4 @@
-int dep()
+int dep(void)
{
return 0;
}
diff --git a/Tests/RunCMake/Ninja/top.c b/Tests/RunCMake/Ninja/top.c
index 4a88eb2..0358244 100644
--- a/Tests/RunCMake/Ninja/top.c
+++ b/Tests/RunCMake/Ninja/top.c
@@ -1,7 +1,7 @@
#include "command.h"
#include "target.h"
-int top()
+int top(void)
{
return 0;
}
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile-check.cmake
index 3674aba..673391c 100644
--- a/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile-check.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile-check.cmake
@@ -10,3 +10,38 @@ if(NOT "${build_file}" MATCHES "depfile = test_Debug\\.d")
string(CONCAT no_test_Debug_d "\nLog file:\n ${log}\n" "does not have expected line: depfile = test_Debug.d")
list(APPEND RunCMake_TEST_FAILED "${no_test_Debug_d}")
endif()
+
+function(_run_ninja dir)
+ execute_process(
+ COMMAND "${RunCMake_MAKE_PROGRAM}" ${ARGN}
+ WORKING_DIRECTORY "${dir}"
+ OUTPUT_VARIABLE ninja_stdout
+ ERROR_VARIABLE ninja_stderr
+ RESULT_VARIABLE ninja_result
+ )
+ if(NOT ninja_result EQUAL 0)
+ message(STATUS "
+============ beginning of ninja's stdout ============
+${ninja_stdout}
+=============== end of ninja's stdout ===============
+")
+ message(STATUS "
+============ beginning of ninja's stderr ============
+${ninja_stderr}
+=============== end of ninja's stderr ===============
+")
+ message(FATAL_ERROR
+ "top ninja build failed exited with status ${ninja_result}")
+ endif()
+ set(ninja_stdout "${ninja_stdout}" PARENT_SCOPE)
+endfunction()
+
+_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfile-build")
+_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfile-build" -t deps main.copy.c)
+if (ninja_stdout MATCHES "deps not found")
+ list(APPEND RunCMake_TEST_FAILED "Ninja did not track the deps of main.copy.c in the database")
+endif ()
+_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfile-build" -t deps main.copy2.c)
+if (ninja_stdout MATCHES "deps not found")
+ list(APPEND RunCMake_TEST_FAILED "Ninja did not track the deps of main.copy2.c in the database")
+endif ()
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfileAsByproduct-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfileAsByproduct-check.cmake
new file mode 100644
index 0000000..ced40ab
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfileAsByproduct-check.cmake
@@ -0,0 +1,47 @@
+set(log "${RunCMake_BINARY_DIR}/CustomCommandDepfileAsByproduct-build/CMakeFiles/impl-Debug.ninja")
+file(READ "${log}" build_file)
+
+set(RunCMake_TEST_FAILED)
+if(NOT "${build_file}" MATCHES "depfile = test\\.d")
+ string(CONCAT no_test_d "Log file:\n ${log}\n" "does not have expected line: depfile = test.d")
+ list(APPEND RunCMake_TEST_FAILED "${no_test_d}")
+endif()
+if(NOT "${build_file}" MATCHES "depfile = test_Debug\\.d")
+ string(CONCAT no_test_Debug_d "\nLog file:\n ${log}\n" "does not have expected line: depfile = test_Debug.d")
+ list(APPEND RunCMake_TEST_FAILED "${no_test_Debug_d}")
+endif()
+
+function(_run_ninja dir)
+ execute_process(
+ COMMAND "${RunCMake_MAKE_PROGRAM}" ${ARGN}
+ WORKING_DIRECTORY "${dir}"
+ OUTPUT_VARIABLE ninja_stdout
+ ERROR_VARIABLE ninja_stderr
+ RESULT_VARIABLE ninja_result
+ )
+ if(NOT ninja_result EQUAL 0)
+ message(STATUS "
+============ beginning of ninja's stdout ============
+${ninja_stdout}
+=============== end of ninja's stdout ===============
+")
+ message(STATUS "
+============ beginning of ninja's stderr ============
+${ninja_stderr}
+=============== end of ninja's stderr ===============
+")
+ message(FATAL_ERROR
+ "top ninja build failed exited with status ${ninja_result}")
+ endif()
+ set(ninja_stdout "${ninja_stdout}" PARENT_SCOPE)
+endfunction()
+
+_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsByproduct-build")
+_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsByproduct-build" -t deps main.copy.c)
+if (NOT ninja_stdout MATCHES "deps not found")
+ list(APPEND RunCMake_TEST_FAILED "Ninja tracked the deps of main.copy.c in the database")
+endif ()
+_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsByproduct-build" -t deps main.copy2.c)
+if (NOT ninja_stdout MATCHES "deps not found")
+ list(APPEND RunCMake_TEST_FAILED "Ninja tracked the deps of main.copy2.c in the database")
+endif ()
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfileAsByproduct.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfileAsByproduct.cmake
new file mode 100644
index 0000000..e1e49cb
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfileAsByproduct.cmake
@@ -0,0 +1,22 @@
+add_custom_command(
+ OUTPUT main.copy.c
+ BYPRODUCTS "test.d"
+ COMMAND "${CMAKE_COMMAND}" -E copy
+ "${CMAKE_CURRENT_SOURCE_DIR}/main.c"
+ main.copy.c
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ DEPFILE "test.d"
+ )
+
+add_custom_command(
+ OUTPUT main.copy2.c
+ BYPRODUCTS "test_$<CONFIG>.d"
+ COMMAND "${CMAKE_COMMAND}" -E copy
+ "${CMAKE_CURRENT_SOURCE_DIR}/main.c"
+ main.copy2.c
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ DEPFILE "test_$<CONFIG>.d"
+ )
+
+add_custom_target(copy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/main.copy.c"
+ "${CMAKE_CURRENT_BINARY_DIR}/main.copy2.c")
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfileAsOutput-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfileAsOutput-check.cmake
new file mode 100644
index 0000000..d4a87ba
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfileAsOutput-check.cmake
@@ -0,0 +1,47 @@
+set(log "${RunCMake_BINARY_DIR}/CustomCommandDepfileAsOutput-build/CMakeFiles/impl-Debug.ninja")
+file(READ "${log}" build_file)
+
+set(RunCMake_TEST_FAILED)
+if(NOT "${build_file}" MATCHES "depfile = test\\.d")
+ string(CONCAT no_test_d "Log file:\n ${log}\n" "does not have expected line: depfile = test.d")
+ list(APPEND RunCMake_TEST_FAILED "${no_test_d}")
+endif()
+if(NOT "${build_file}" MATCHES "depfile = test_Debug\\.d")
+ string(CONCAT no_test_Debug_d "\nLog file:\n ${log}\n" "does not have expected line: depfile = test_Debug.d")
+ list(APPEND RunCMake_TEST_FAILED "${no_test_Debug_d}")
+endif()
+
+function(_run_ninja dir)
+ execute_process(
+ COMMAND "${RunCMake_MAKE_PROGRAM}" ${ARGN}
+ WORKING_DIRECTORY "${dir}"
+ OUTPUT_VARIABLE ninja_stdout
+ ERROR_VARIABLE ninja_stderr
+ RESULT_VARIABLE ninja_result
+ )
+ if(NOT ninja_result EQUAL 0)
+ message(STATUS "
+============ beginning of ninja's stdout ============
+${ninja_stdout}
+=============== end of ninja's stdout ===============
+")
+ message(STATUS "
+============ beginning of ninja's stderr ============
+${ninja_stderr}
+=============== end of ninja's stderr ===============
+")
+ message(FATAL_ERROR
+ "top ninja build failed exited with status ${ninja_result}")
+ endif()
+ set(ninja_stdout "${ninja_stdout}" PARENT_SCOPE)
+endfunction()
+
+_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsOutput-build")
+_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsOutput-build" -t deps main.copy.c)
+if (NOT ninja_stdout MATCHES "deps not found")
+ list(APPEND RunCMake_TEST_FAILED "Ninja tracked the deps of main.copy.c in the database")
+endif ()
+_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsOutput-build" -t deps main.copy2.c)
+if (NOT ninja_stdout MATCHES "deps not found")
+ list(APPEND RunCMake_TEST_FAILED "Ninja tracked the deps of main.copy2.c in the database")
+endif ()
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfileAsOutput.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfileAsOutput.cmake
new file mode 100644
index 0000000..0617970
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfileAsOutput.cmake
@@ -0,0 +1,22 @@
+add_custom_command(
+ OUTPUT main.copy.c
+ "test.d"
+ COMMAND "${CMAKE_COMMAND}" -E copy
+ "${CMAKE_CURRENT_SOURCE_DIR}/main.c"
+ main.copy.c
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ DEPFILE "test.d"
+ )
+
+add_custom_command(
+ OUTPUT main.copy2.c
+ "test_$<CONFIG>.d"
+ COMMAND "${CMAKE_COMMAND}" -E copy
+ "${CMAKE_CURRENT_SOURCE_DIR}/main.c"
+ main.copy2.c
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ DEPFILE "test_$<CONFIG>.d"
+ )
+
+add_custom_target(copy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/main.copy.c"
+ "${CMAKE_CURRENT_BINARY_DIR}/main.copy2.c")
diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
index 0ccf8e8..5c6a22d 100644
--- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
@@ -388,6 +388,8 @@ unset(RunCMake_TEST_NO_CLEAN)
unset(RunCMake_TEST_BINARY_DIR)
run_cmake(CustomCommandDepfile)
+run_cmake(CustomCommandDepfileAsOutput)
+run_cmake(CustomCommandDepfileAsByproduct)
set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all")
run_cmake(PerConfigSources)
diff --git a/Tests/RunCMake/ObjectLibrary/exe.c b/Tests/RunCMake/ObjectLibrary/exe.c
index 2e08700..25d7784 100644
--- a/Tests/RunCMake/ObjectLibrary/exe.c
+++ b/Tests/RunCMake/ObjectLibrary/exe.c
@@ -5,7 +5,7 @@
#endif
extern IMPORT int b(void);
-int main()
+int main(void)
{
return b();
}
diff --git a/Tests/RunCMake/PrecompileHeaders/foo.c b/Tests/RunCMake/PrecompileHeaders/foo.c
index eb88726..a4710fd 100644
--- a/Tests/RunCMake/PrecompileHeaders/foo.c
+++ b/Tests/RunCMake/PrecompileHeaders/foo.c
@@ -2,12 +2,12 @@
#include "foo2.h"
-int foo()
+int foo(void)
{
return 0;
}
-int foo2()
+int foo2(void)
{
return 0;
}
diff --git a/Tests/RunCMake/PrecompileHeaders/foobar.c b/Tests/RunCMake/PrecompileHeaders/foobar.c
index 97d465c..71ebe37 100644
--- a/Tests/RunCMake/PrecompileHeaders/foobar.c
+++ b/Tests/RunCMake/PrecompileHeaders/foobar.c
@@ -2,7 +2,7 @@
#include "foo.h"
#include "foo2.h"
-int main()
+int main(void)
{
int zeroSize = 0;
diff --git a/Tests/RunCMake/PrecompileHeaders/include/bar.h b/Tests/RunCMake/PrecompileHeaders/include/bar.h
index 5feb983..89a156c 100644
--- a/Tests/RunCMake/PrecompileHeaders/include/bar.h
+++ b/Tests/RunCMake/PrecompileHeaders/include/bar.h
@@ -1,7 +1,7 @@
#ifndef bar_h
#define bar_h
-static int bar()
+static int bar(void)
{
return 0;
}
diff --git a/Tests/RunCMake/PrintHelpers/nothing.c b/Tests/RunCMake/PrintHelpers/nothing.c
index 32b7b39..1d11f33 100644
--- a/Tests/RunCMake/PrintHelpers/nothing.c
+++ b/Tests/RunCMake/PrintHelpers/nothing.c
@@ -1,6 +1,6 @@
#include "nothing.h"
-void nothing()
+void nothing(void)
{
(void*)0;
}
diff --git a/Tests/RunCMake/PrintHelpers/something.c b/Tests/RunCMake/PrintHelpers/something.c
index a2bc425..90482c9 100644
--- a/Tests/RunCMake/PrintHelpers/something.c
+++ b/Tests/RunCMake/PrintHelpers/something.c
@@ -1,6 +1,6 @@
#include "something.h"
-int main()
+int main(void)
{
nothing();
return 0;
diff --git a/Tests/RunCMake/SourceProperties/empty.c b/Tests/RunCMake/SourceProperties/empty.c
index a9ec102..768abc2 100644
--- a/Tests/RunCMake/SourceProperties/empty.c
+++ b/Tests/RunCMake/SourceProperties/empty.c
@@ -1,5 +1,5 @@
-int empty()
+int empty(void)
{
return 0;
}
diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
index c2187ae..389a63e 100644
--- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
+++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
@@ -39,6 +39,7 @@
\* CMP0142
\* CMP0154
\* CMP0155
+ \* CMP0156
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ToolchainFile/CMP0126-OLD-stderr.txt b/Tests/RunCMake/ToolchainFile/CMP0126-OLD-stderr.txt
index f3c068a..efa7b32 100644
--- a/Tests/RunCMake/ToolchainFile/CMP0126-OLD-stderr.txt
+++ b/Tests/RunCMake/ToolchainFile/CMP0126-OLD-stderr.txt
@@ -1 +1,12 @@
-^try_compile CMP0126='OLD' VAR='2'
+^CMake Deprecation Warning at CMP0126-OLD\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0126 will be removed from a future version
+ of CMake\.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances\. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+try_compile CMP0126='OLD' VAR='2'
diff --git a/Tests/RunCMake/TransformDepfile/noexist-gcc-stderr.txt b/Tests/RunCMake/TransformDepfile/noexist-gcc-stderr.txt
new file mode 100644
index 0000000..8956278
--- /dev/null
+++ b/Tests/RunCMake/TransformDepfile/noexist-gcc-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Warning:
+ Expected depfile does not exist.
+
+ .*/Tests/RunCMake/TransformDepfile/noexist.d$
diff --git a/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake b/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake
index e3643c0..0ec8c42 100644
--- a/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake
+++ b/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake
@@ -14,6 +14,13 @@ run_cmake(unitybuild_cxx)
run_cmake(unitybuild_cxx_group)
run_cmake(unitybuild_c_and_cxx)
run_cmake(unitybuild_c_and_cxx_group)
+if(CMake_TEST_OBJC)
+ run_cmake(unitybuild_objc)
+ run_cmake(unitybuild_objc_group)
+ run_cmake(unitybuild_objcxx)
+ run_cmake(unitybuild_objcxx_group)
+ run_cmake(unitybuild_c_and_cxx_and_objc_and_objcxx)
+endif()
run_cmake(unitybuild_batchsize)
run_cmake(unitybuild_default_batchsize)
run_cmake(unitybuild_skip)
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_and_objc_and_objcxx.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_and_objc_and_objcxx.cmake
new file mode 100644
index 0000000..096a86b
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_and_objc_and_objcxx.cmake
@@ -0,0 +1,25 @@
+project(unitybuild_c_and_cxx_and_objc_and_objcxx C CXX OBJC OBJCXX)
+
+set(srcs "")
+foreach(s RANGE 1 8)
+ set(src_c "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c")
+ file(WRITE "${src_c}" "int s${s}(void) { return 0; }\n")
+
+ set(src_cxx "${CMAKE_CURRENT_BINARY_DIR}/s${s}.cxx")
+ file(WRITE "${src_cxx}" "int s${s}(void) { return 0; }\n")
+
+ set(src_objc "${CMAKE_CURRENT_BINARY_DIR}/s${s}.m")
+ file(WRITE "${src_objc}" "int s${s}(void) { return 0; }\n")
+
+ set(src_objcxx "${CMAKE_CURRENT_BINARY_DIR}/s${s}.mm")
+ file(WRITE "${src_objcxx}" "int s${s}(void) { return 0; }\n")
+
+ list(APPEND srcs "${src_c}")
+ list(APPEND srcs "${src_cxx}")
+ list(APPEND srcs "${src_objc}")
+ list(APPEND srcs "${src_objcxx}")
+endforeach()
+
+add_library(tgt SHARED ${srcs})
+
+set_target_properties(tgt PROPERTIES UNITY_BUILD ON)
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_objc.cmake b/Tests/RunCMake/UnityBuild/unitybuild_objc.cmake
new file mode 100644
index 0000000..cc88d98
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_objc.cmake
@@ -0,0 +1,12 @@
+project(unitybuild_objc OBJC)
+
+set(srcs "")
+foreach(s RANGE 1 8)
+ set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.m")
+ file(WRITE "${src}" "int s${s}(void) { return 0; }\n")
+ list(APPEND srcs "${src}")
+endforeach()
+
+add_library(tgt SHARED ${srcs})
+
+set_target_properties(tgt PROPERTIES UNITY_BUILD ON)
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_objc_group.cmake b/Tests/RunCMake/UnityBuild/unitybuild_objc_group.cmake
new file mode 100644
index 0000000..384c98a
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_objc_group.cmake
@@ -0,0 +1,27 @@
+project(unitybuild_objc_group OBJC)
+
+set(srcs "")
+foreach(s RANGE 1 4)
+ set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.m")
+ file(WRITE "${src}" "int s${s}(void) { return 0; }\n")
+ list(APPEND srcs "${src}")
+endforeach()
+
+foreach(s RANGE 1 2)
+ set(src "${CMAKE_CURRENT_BINARY_DIR}/odr${s}.m")
+ file(WRITE "${src}" "namespace odr { int s${s}(void) { return 0; } }\n")
+ list(APPEND srcs "${src}")
+endforeach()
+
+add_library(tgt SHARED ${srcs})
+
+set_target_properties(tgt PROPERTIES UNITY_BUILD ON
+ UNITY_BUILD_MODE GROUP
+ )
+
+set_source_files_properties(s1.m s2.m odr1.m
+ PROPERTIES UNITY_GROUP "a"
+ )
+set_source_files_properties(s3.m s4.m odr2.m
+ PROPERTIES UNITY_GROUP "b"
+ )
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_objcxx.cmake b/Tests/RunCMake/UnityBuild/unitybuild_objcxx.cmake
new file mode 100644
index 0000000..fd0f743
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_objcxx.cmake
@@ -0,0 +1,12 @@
+project(unitybuild_objcxx OBJCXX)
+
+set(srcs "")
+foreach(s RANGE 1 8)
+ set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.mm")
+ file(WRITE "${src}" "int s${s}(void) { return 0; }\n")
+ list(APPEND srcs "${src}")
+endforeach()
+
+add_library(tgt SHARED ${srcs})
+
+set_target_properties(tgt PROPERTIES UNITY_BUILD ON)
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_objcxx_group.cmake b/Tests/RunCMake/UnityBuild/unitybuild_objcxx_group.cmake
new file mode 100644
index 0000000..517703e
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_objcxx_group.cmake
@@ -0,0 +1,27 @@
+project(unitybuild_objcxx_group OBJCXX)
+
+set(srcs "")
+foreach(s RANGE 1 4)
+ set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.mm")
+ file(WRITE "${src}" "int s${s}(void) { return 0; }\n")
+ list(APPEND srcs "${src}")
+endforeach()
+
+foreach(s RANGE 1 2)
+ set(src "${CMAKE_CURRENT_BINARY_DIR}/odr${s}.mm")
+ file(WRITE "${src}" "namespace odr { int s${s}(void) { return 0; } }\n")
+ list(APPEND srcs "${src}")
+endforeach()
+
+add_library(tgt SHARED ${srcs})
+
+set_target_properties(tgt PROPERTIES UNITY_BUILD ON
+ UNITY_BUILD_MODE GROUP
+ )
+
+set_source_files_properties(s1.mm s2.mm odr1.mm
+ PROPERTIES UNITY_GROUP "a"
+ )
+set_source_files_properties(s3.mm s4.mm odr2.mm
+ PROPERTIES UNITY_GROUP "b"
+ )
diff --git a/Tests/RunCMake/UseSWIG/CMP0122-NEW-check.cmake b/Tests/RunCMake/UseSWIG/CMP0122-NEW-check.cmake
index a26c278..df14d15 100644
--- a/Tests/RunCMake/UseSWIG/CMP0122-NEW-check.cmake
+++ b/Tests/RunCMake/UseSWIG/CMP0122-NEW-check.cmake
@@ -1,5 +1,5 @@
-cmake_policy(VERSION 3.1)
+cmake_policy(VERSION 3.5)
file(STRINGS "${RunCMake_TEST_BINARY_DIR}/CMP0122-library-name.txt" prefixes)
diff --git a/Tests/RunCMake/UseSWIG/CMP0122-OLD-check.cmake b/Tests/RunCMake/UseSWIG/CMP0122-OLD-check.cmake
index 01657d0..6eb5c20 100644
--- a/Tests/RunCMake/UseSWIG/CMP0122-OLD-check.cmake
+++ b/Tests/RunCMake/UseSWIG/CMP0122-OLD-check.cmake
@@ -1,5 +1,5 @@
-cmake_policy(VERSION 3.1)
+cmake_policy(VERSION 3.5)
file(STRINGS "${RunCMake_TEST_BINARY_DIR}/CMP0122-library-name.txt" prefixes)
diff --git a/Tests/RunCMake/UseSWIG/CMP0122-OLD-stderr.txt b/Tests/RunCMake/UseSWIG/CMP0122-OLD-stderr.txt
new file mode 100644
index 0000000..84f2ee7
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/CMP0122-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0122-OLD\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0122 will be removed from a future version
+ of CMake\.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances\. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index 669049a..e0d74cf 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -11,6 +11,9 @@ run_cmake(CustomCommandGenex)
if(NOT RunCMake_GENERATOR MATCHES "^Visual Studio 1[1-5] ")
run_cmake(CustomCommandParallel)
endif()
+run_cmake_with_options(VsCharacterSet -DSET_CHARSET=MultiByte)
+run_cmake_with_options(VsCharacterSet -DSET_CHARSET=Unicode)
+run_cmake_with_options(VsCharacterSet -DSET_CHARSET=NotSet)
run_cmake(VsCsharpSourceGroup)
run_cmake(VsCSharpCompilerOpts)
run_cmake(ExplicitCMakeLists)
diff --git a/Tests/RunCMake/VS10Project/VsCharacterSet-check.cmake b/Tests/RunCMake/VS10Project/VsCharacterSet-check.cmake
new file mode 100644
index 0000000..93770a1
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsCharacterSet-check.cmake
@@ -0,0 +1,49 @@
+macro(check_project_file projectFile outvar)
+ set(insideConfiguration FALSE)
+ set(characterSetFound FALSE)
+
+ if(NOT EXISTS "${projectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${projectFile} does not exist.")
+ return()
+ endif()
+
+ string(REPLACE "${RunCMake_TEST_BINARY_DIR}/" "" projectName ${projectFile})
+
+ file(STRINGS "${projectFile}" lines)
+ foreach(line IN LISTS lines)
+ if(line MATCHES "^ *<PropertyGroup Condition=\"'[$][(]Configuration[)]|[$][(]Platform[)]'=='([^\"])+\" Label=\"Configuration\">.*$")
+ set(insideConfiguration TRUE)
+ elseif(insideConfiguration)
+ if(line MATCHES "^ *</PropertyGroup>.*$")
+ set(insideConfiguration FALSE)
+ elseif(line MATCHES "^ *<CharacterSet>(.+)</CharacterSet>*$")
+ message(STATUS "Found CharacterSet = ${CMAKE_MATCH_1} in PropertyGroup 'Configuration' in ${projectName}")
+ set(characterSetFound TRUE)
+ set(${outvar} ${CMAKE_MATCH_1})
+ endif()
+ endif()
+ endforeach()
+ if(NOT characterSetFound)
+ set(RunCMake_TEST_FAILED "CharacterSet not found in \"Configuration\" propertygroup in ${projectName}")
+ return() # This should intentionally return from the caller, not the macro
+ endif()
+endmacro()
+
+check_project_file("${RunCMake_TEST_BINARY_DIR}/CMakeFiles/${CMAKE_VERSION}/CompilerIdCXX/CompilerIdCXX.vcxproj" MULTI_BYTE_CHARSET)
+check_project_file("${RunCMake_TEST_BINARY_DIR}/foo.vcxproj" OVERRIDDEN_CHARSET)
+
+if (NOT "${MULTI_BYTE_CHARSET}" STREQUAL "MultiByte")
+ set(RunCMake_TEST_FAILED "Default character-set (\"MultiByte\") was overridden (it shouldn't)")
+ return()
+endif()
+
+if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/set_charset.txt")
+ set(RunCMake_TEST_FAILED "File 'set_charset.txt' with set charset does not exist.")
+ return()
+endif()
+file(STRINGS "${RunCMake_TEST_BINARY_DIR}/set_charset.txt" SET_CHARSET)
+
+if (NOT "${OVERRIDDEN_CHARSET}" STREQUAL "${SET_CHARSET}")
+ set(RunCMake_TEST_FAILED "Failed to override the character-set with \"${SET_CHARSET}\"")
+ return()
+endif()
diff --git a/Tests/RunCMake/VS10Project/VsCharacterSet.cmake b/Tests/RunCMake/VS10Project/VsCharacterSet.cmake
new file mode 100644
index 0000000..c8c3e0e
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsCharacterSet.cmake
@@ -0,0 +1,17 @@
+enable_language(CXX)
+
+# Write value of `SET_CHARSET` for comparison later.
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/set_charset.txt" "${SET_CHARSET}")
+
+# Set macro which determines the character-set.
+if("${SET_CHARSET}" STREQUAL "MultiByte")
+ add_compile_definitions(_MBCS=1)
+endif()
+if("${SET_CHARSET}" STREQUAL "NotSet")
+ add_compile_definitions(_SBCS=1)
+endif()
+if("${SET_CHARSET}" STREQUAL "Unicode")
+ add_compile_definitions(_UNICODE=1)
+endif()
+
+add_library(foo foo.cpp)
diff --git a/Tests/RunCMake/XcFramework/RunCMakeTest.cmake b/Tests/RunCMake/XcFramework/RunCMakeTest.cmake
index 9a13892..1fef283 100644
--- a/Tests/RunCMake/XcFramework/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcFramework/RunCMakeTest.cmake
@@ -119,3 +119,128 @@ unset(RunCMake_TEST_BINARY_DIR)
run_cmake(find-library)
run_cmake_command(find-library-script ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/find-library.cmake)
+
+file(REMOVE_RECURSE ${RunCMake_BINARY_DIR}/export-install)
+set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/export-macos-build)
+run_cmake_with_options(export-macos -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/export-install)
+set(RunCMake_TEST_NO_CLEAN 1)
+set(_config_arg)
+if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(_config_arg --config Release)
+endif()
+run_cmake_command(export-macos-build ${CMAKE_COMMAND} --build . ${_config_arg})
+run_cmake_command(export-macos-install ${CMAKE_COMMAND} --install . ${_config_arg})
+unset(RunCMake_TEST_NO_CLEAN)
+unset(RunCMake_TEST_BINARY_DIR)
+
+set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/import-macos-install-specific-no-xcframework-build)
+run_cmake_with_options(import-macos-install-specific-no-xcframework -DCMAKE_SYSTEM_NAME=Darwin -Dmylib_DIR=${RunCMake_BINARY_DIR}/export-install/lib/macos/cmake/mylib)
+set(RunCMake_TEST_NO_CLEAN 1)
+set(_config_arg)
+set(_config_dir)
+if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(_config_arg --config Release)
+ set(_config_dir /Release)
+endif()
+run_cmake_command(import-macos-install-specific-no-xcframework-build ${CMAKE_COMMAND} --build . ${_config_arg})
+unset(RunCMake_TEST_NO_CLEAN)
+unset(RunCMake_TEST_BINARY_DIR)
+
+set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/export-macos-build)
+set(RunCMake_TEST_NO_CLEAN 1)
+if(CMake_TEST_XCODE_VERSION VERSION_GREATER_EQUAL 15)
+ # 'xcodebuild -create-xcframework' fails on symlinked paths.
+ file(REAL_PATH "${RunCMake_SOURCE_DIR}" src_dir)
+ file(REAL_PATH "${RunCMake_BINARY_DIR}" bld_dir)
+else()
+ set(src_dir "${RunCMake_SOURCE_DIR}")
+ set(bld_dir "${RunCMake_BINARY_DIR}")
+endif()
+run_cmake_command(export-install-xcframework xcodebuild -create-xcframework
+ -output ${bld_dir}/export-install/lib/mylib.xcframework
+ -library ${bld_dir}/export-install/lib/macos/libmylib.a
+ -headers ${src_dir}/mylib/include
+ )
+run_cmake_command(export-build-xcframework xcodebuild -create-xcframework
+ -output ${bld_dir}/export-macos-build/lib/mylib.xcframework
+ -library ${bld_dir}/export-macos-build/lib/macos${_config_dir}/libmylib.a
+ -headers ${src_dir}/mylib/include
+ )
+run_cmake_command(export-install-xcframework-genex xcodebuild -create-xcframework
+ -output ${bld_dir}/export-install/lib2/mylib-genex.xcframework
+ -library ${bld_dir}/export-install/lib/macos/libmylib-genex.a
+ -headers ${src_dir}/mylib/include
+ )
+run_cmake_command(export-build-xcframework-genex xcodebuild -create-xcframework
+ -output ${bld_dir}/export-macos-build/lib/mylib-genex.xcframework
+ -library ${bld_dir}/export-macos-build/lib/macos${_config_dir}/libmylib-genex.a
+ -headers ${src_dir}/mylib/include
+ )
+unset(RunCMake_TEST_NO_CLEAN)
+unset(RunCMake_TEST_BINARY_DIR)
+
+set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/import-macos-install-specific-build)
+run_cmake_with_options(import-macos-install-specific -DCMAKE_SYSTEM_NAME=Darwin -Dmylib_DIR=${RunCMake_BINARY_DIR}/export-install/lib/macos/cmake/mylib)
+set(RunCMake_TEST_NO_CLEAN 1)
+set(_config_arg)
+if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(_config_arg --config Release)
+endif()
+run_cmake_command(import-macos-install-specific-build ${CMAKE_COMMAND} --build . ${_config_arg})
+unset(RunCMake_TEST_NO_CLEAN)
+unset(RunCMake_TEST_BINARY_DIR)
+
+set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/import-macos-build-specific-build)
+run_cmake_with_options(import-macos-build-specific -DCMAKE_SYSTEM_NAME=Darwin -Dmylib_DIR=${RunCMake_BINARY_DIR}/export-macos-build/lib/macos/cmake/mylib)
+set(RunCMake_TEST_NO_CLEAN 1)
+set(_config_arg)
+if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(_config_arg --config Release)
+endif()
+run_cmake_command(import-macos-build-specific-build ${CMAKE_COMMAND} --build . ${_config_arg})
+unset(RunCMake_TEST_NO_CLEAN)
+unset(RunCMake_TEST_BINARY_DIR)
+
+set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/import-macos-install-specific-genex-build)
+run_cmake_with_options(import-macos-install-specific-genex -DCMAKE_SYSTEM_NAME=Darwin -Dmylib_DIR=${RunCMake_BINARY_DIR}/export-install/lib/macos/cmake/mylib)
+set(RunCMake_TEST_NO_CLEAN 1)
+set(_config_arg)
+if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(_config_arg --config Release)
+endif()
+run_cmake_command(import-macos-install-specific-genex-build ${CMAKE_COMMAND} --build . ${_config_arg})
+unset(RunCMake_TEST_NO_CLEAN)
+unset(RunCMake_TEST_BINARY_DIR)
+
+set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/import-macos-build-specific-genex-build)
+run_cmake_with_options(import-macos-build-specific-genex -DCMAKE_SYSTEM_NAME=Darwin -Dmylib_DIR=${RunCMake_BINARY_DIR}/export-macos-build/lib/macos/cmake/mylib)
+set(RunCMake_TEST_NO_CLEAN 1)
+set(_config_arg)
+if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(_config_arg --config Release)
+endif()
+run_cmake_command(import-macos-build-specific-genex-build ${CMAKE_COMMAND} --build . ${_config_arg})
+unset(RunCMake_TEST_NO_CLEAN)
+unset(RunCMake_TEST_BINARY_DIR)
+
+set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/import-macos-install-general-build)
+run_cmake_with_options(import-macos-install-general -DCMAKE_SYSTEM_NAME=Darwin -Dmylib_DIR=${RunCMake_BINARY_DIR}/export-install/lib/cmake/mylib)
+set(RunCMake_TEST_NO_CLEAN 1)
+set(_config_arg)
+if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(_config_arg --config Release)
+endif()
+run_cmake_command(import-macos-install-general-build ${CMAKE_COMMAND} --build . ${_config_arg})
+unset(RunCMake_TEST_NO_CLEAN)
+unset(RunCMake_TEST_BINARY_DIR)
+
+set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/import-macos-build-general-build)
+run_cmake_with_options(import-macos-build-general -DCMAKE_SYSTEM_NAME=Darwin -Dmylib_DIR=${RunCMake_BINARY_DIR}/export-macos-build/lib/cmake/mylib)
+set(RunCMake_TEST_NO_CLEAN 1)
+set(_config_arg)
+if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(_config_arg --config Release)
+endif()
+run_cmake_command(import-macos-build-general-build ${CMAKE_COMMAND} --build . ${_config_arg})
+unset(RunCMake_TEST_NO_CLEAN)
+unset(RunCMake_TEST_BINARY_DIR)
diff --git a/Tests/RunCMake/XcFramework/export-macos.cmake b/Tests/RunCMake/XcFramework/export-macos.cmake
new file mode 100644
index 0000000..2fac14f
--- /dev/null
+++ b/Tests/RunCMake/XcFramework/export-macos.cmake
@@ -0,0 +1,44 @@
+enable_language(C)
+
+include(CMakePackageConfigHelpers)
+
+if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
+ set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO")
+endif()
+
+if(CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS")
+ set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")
+endif()
+
+add_library(mylib STATIC mylib/mylib.c)
+target_include_directories(mylib INTERFACE $<INSTALL_INTERFACE:include>)
+set_property(TARGET mylib PROPERTY ARCHIVE_OUTPUT_DIRECTORY lib/macos)
+
+add_library(mylib-genex STATIC mylib/mylib.c)
+target_include_directories(mylib-genex INTERFACE $<INSTALL_INTERFACE:include>)
+set_property(TARGET mylib-genex PROPERTY ARCHIVE_OUTPUT_DIRECTORY lib/macos)
+
+install(TARGETS mylib mylib-genex DESTINATION lib/macos EXPORT mylib)
+install(FILES mylib/include/mylib/mylib.h DESTINATION include/mylib)
+export(SETUP mylib
+ TARGET mylib XCFRAMEWORK_LOCATION lib/mylib.xcframework
+ TARGET mylib-genex XCFRAMEWORK_LOCATION "$<BUILD_INTERFACE:lib/$<TARGET_PROPERTY:NAME>.xcframework>$<INSTALL_INTERFACE:lib2/$<TARGET_PROPERTY:NAME>.xcframework>"
+ )
+install(EXPORT mylib DESTINATION lib/macos/cmake/mylib FILE mylib-targets.cmake)
+export(EXPORT mylib FILE lib/macos/cmake/mylib/mylib-targets.cmake)
+
+configure_package_config_file(mylib-config.cmake.in mylib-config-sub.cmake INSTALL_DESTINATION lib/macos/cmake/mylib)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mylib-config-sub.cmake DESTINATION lib/macos/cmake/mylib RENAME mylib-config.cmake)
+
+configure_package_config_file(mylib-config.cmake.in lib/macos/cmake/mylib/mylib-config.cmake INSTALL_DESTINATION lib/macos/cmake/mylib)
+
+generate_apple_platform_selection_file(mylib-config-top.cmake
+ INSTALL_DESTINATION lib/cmake/mylib
+ MACOS_CONFIG_FILE lib/macos/cmake/mylib/mylib-config.cmake
+ )
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mylib-config-top.cmake DESTINATION lib/cmake/mylib RENAME mylib-config.cmake)
+
+generate_apple_platform_selection_file(lib/cmake/mylib/mylib-config.cmake
+ INSTALL_DESTINATION lib/cmake/mylib
+ MACOS_CONFIG_FILE lib/macos/cmake/mylib/mylib-config.cmake
+ )
diff --git a/Tests/RunCMake/XcFramework/import-common.cmake b/Tests/RunCMake/XcFramework/import-common.cmake
new file mode 100644
index 0000000..4def6a4
--- /dev/null
+++ b/Tests/RunCMake/XcFramework/import-common.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+
+find_package(mylib REQUIRED)
+
+add_custom_target(print_loc ALL COMMAND ${CMAKE_COMMAND} -E echo "mylib location: $<TARGET_FILE:mylib>")
diff --git a/Tests/RunCMake/XcFramework/import-genex-common.cmake b/Tests/RunCMake/XcFramework/import-genex-common.cmake
new file mode 100644
index 0000000..e46902b
--- /dev/null
+++ b/Tests/RunCMake/XcFramework/import-genex-common.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+
+find_package(mylib REQUIRED)
+
+add_custom_target(print_loc ALL COMMAND ${CMAKE_COMMAND} -E echo "mylib-genex location: $<TARGET_FILE:mylib-genex>")
diff --git a/Tests/RunCMake/XcFramework/import-macos-build-general-build-stdout.txt b/Tests/RunCMake/XcFramework/import-macos-build-general-build-stdout.txt
new file mode 100644
index 0000000..3ac467d
--- /dev/null
+++ b/Tests/RunCMake/XcFramework/import-macos-build-general-build-stdout.txt
@@ -0,0 +1,2 @@
+mylib location: [^
+]*/Tests/RunCMake/XcFramework/export-macos-build/lib/mylib\.xcframework/macos-(arm64|x86_64|arm64_x86_64)/libmylib\.a
diff --git a/Tests/RunCMake/XcFramework/import-macos-build-general.cmake b/Tests/RunCMake/XcFramework/import-macos-build-general.cmake
new file mode 100644
index 0000000..08ef6db
--- /dev/null
+++ b/Tests/RunCMake/XcFramework/import-macos-build-general.cmake
@@ -0,0 +1 @@
+include(import-common.cmake)
diff --git a/Tests/RunCMake/XcFramework/import-macos-build-specific-build-stdout.txt b/Tests/RunCMake/XcFramework/import-macos-build-specific-build-stdout.txt
new file mode 100644
index 0000000..3ac467d
--- /dev/null
+++ b/Tests/RunCMake/XcFramework/import-macos-build-specific-build-stdout.txt
@@ -0,0 +1,2 @@
+mylib location: [^
+]*/Tests/RunCMake/XcFramework/export-macos-build/lib/mylib\.xcframework/macos-(arm64|x86_64|arm64_x86_64)/libmylib\.a
diff --git a/Tests/RunCMake/XcFramework/import-macos-build-specific-genex-build-stdout.txt b/Tests/RunCMake/XcFramework/import-macos-build-specific-genex-build-stdout.txt
new file mode 100644
index 0000000..d3a20e8
--- /dev/null
+++ b/Tests/RunCMake/XcFramework/import-macos-build-specific-genex-build-stdout.txt
@@ -0,0 +1,2 @@
+mylib-genex location: [^
+]*/Tests/RunCMake/XcFramework/export-macos-build/lib/mylib-genex\.xcframework/macos-(arm64|x86_64|arm64_x86_64)/libmylib-genex\.a
diff --git a/Tests/RunCMake/XcFramework/import-macos-build-specific-genex.cmake b/Tests/RunCMake/XcFramework/import-macos-build-specific-genex.cmake
new file mode 100644
index 0000000..a061bd3
--- /dev/null
+++ b/Tests/RunCMake/XcFramework/import-macos-build-specific-genex.cmake
@@ -0,0 +1 @@
+include(import-genex-common.cmake)
diff --git a/Tests/RunCMake/XcFramework/import-macos-build-specific.cmake b/Tests/RunCMake/XcFramework/import-macos-build-specific.cmake
new file mode 100644
index 0000000..08ef6db
--- /dev/null
+++ b/Tests/RunCMake/XcFramework/import-macos-build-specific.cmake
@@ -0,0 +1 @@
+include(import-common.cmake)
diff --git a/Tests/RunCMake/XcFramework/import-macos-install-general-build-stdout.txt b/Tests/RunCMake/XcFramework/import-macos-install-general-build-stdout.txt
new file mode 100644
index 0000000..1421246
--- /dev/null
+++ b/Tests/RunCMake/XcFramework/import-macos-install-general-build-stdout.txt
@@ -0,0 +1,2 @@
+mylib location: [^
+]*/Tests/RunCMake/XcFramework/export-install/lib/mylib\.xcframework/macos-(arm64|x86_64|arm64_x86_64)/libmylib\.a
diff --git a/Tests/RunCMake/XcFramework/import-macos-install-general.cmake b/Tests/RunCMake/XcFramework/import-macos-install-general.cmake
new file mode 100644
index 0000000..08ef6db
--- /dev/null
+++ b/Tests/RunCMake/XcFramework/import-macos-install-general.cmake
@@ -0,0 +1 @@
+include(import-common.cmake)
diff --git a/Tests/RunCMake/XcFramework/import-macos-install-specific-build-stdout.txt b/Tests/RunCMake/XcFramework/import-macos-install-specific-build-stdout.txt
new file mode 100644
index 0000000..1421246
--- /dev/null
+++ b/Tests/RunCMake/XcFramework/import-macos-install-specific-build-stdout.txt
@@ -0,0 +1,2 @@
+mylib location: [^
+]*/Tests/RunCMake/XcFramework/export-install/lib/mylib\.xcframework/macos-(arm64|x86_64|arm64_x86_64)/libmylib\.a
diff --git a/Tests/RunCMake/XcFramework/import-macos-install-specific-genex-build-stdout.txt b/Tests/RunCMake/XcFramework/import-macos-install-specific-genex-build-stdout.txt
new file mode 100644
index 0000000..5c88758
--- /dev/null
+++ b/Tests/RunCMake/XcFramework/import-macos-install-specific-genex-build-stdout.txt
@@ -0,0 +1,2 @@
+mylib-genex location: [^
+]*/Tests/RunCMake/XcFramework/export-install/lib2/mylib-genex\.xcframework/macos-(arm64|x86_64|arm64_x86_64)/libmylib-genex\.a
diff --git a/Tests/RunCMake/XcFramework/import-macos-install-specific-genex.cmake b/Tests/RunCMake/XcFramework/import-macos-install-specific-genex.cmake
new file mode 100644
index 0000000..a061bd3
--- /dev/null
+++ b/Tests/RunCMake/XcFramework/import-macos-install-specific-genex.cmake
@@ -0,0 +1 @@
+include(import-genex-common.cmake)
diff --git a/Tests/RunCMake/XcFramework/import-macos-install-specific-no-xcframework-build-stdout.txt b/Tests/RunCMake/XcFramework/import-macos-install-specific-no-xcframework-build-stdout.txt
new file mode 100644
index 0000000..1c92972
--- /dev/null
+++ b/Tests/RunCMake/XcFramework/import-macos-install-specific-no-xcframework-build-stdout.txt
@@ -0,0 +1,2 @@
+mylib location: [^
+]*/Tests/RunCMake/XcFramework/export-install/lib/macos/libmylib\.a
diff --git a/Tests/RunCMake/XcFramework/import-macos-install-specific-no-xcframework.cmake b/Tests/RunCMake/XcFramework/import-macos-install-specific-no-xcframework.cmake
new file mode 100644
index 0000000..08ef6db
--- /dev/null
+++ b/Tests/RunCMake/XcFramework/import-macos-install-specific-no-xcframework.cmake
@@ -0,0 +1 @@
+include(import-common.cmake)
diff --git a/Tests/RunCMake/XcFramework/import-macos-install-specific.cmake b/Tests/RunCMake/XcFramework/import-macos-install-specific.cmake
new file mode 100644
index 0000000..08ef6db
--- /dev/null
+++ b/Tests/RunCMake/XcFramework/import-macos-install-specific.cmake
@@ -0,0 +1 @@
+include(import-common.cmake)
diff --git a/Tests/RunCMake/XcFramework/mylib-config.cmake.in b/Tests/RunCMake/XcFramework/mylib-config.cmake.in
new file mode 100644
index 0000000..878d6e8
--- /dev/null
+++ b/Tests/RunCMake/XcFramework/mylib-config.cmake.in
@@ -0,0 +1,3 @@
+@PACKAGE_INIT@
+
+include("${CMAKE_CURRENT_LIST_DIR}/mylib-targets.cmake")
diff --git a/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.c b/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.c
index c00fce7..76ca54e 100644
--- a/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.c
+++ b/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.c
@@ -25,6 +25,6 @@
# error unknown OS
#endif
-void foo()
+void foo(void)
{
}
diff --git a/Tests/RunCMake/XcodeProject/XcodeXCConfig.c b/Tests/RunCMake/XcodeProject/XcodeXCConfig.c
index ac59a6b..20aab00 100644
--- a/Tests/RunCMake/XcodeProject/XcodeXCConfig.c
+++ b/Tests/RunCMake/XcodeProject/XcodeXCConfig.c
@@ -15,6 +15,6 @@
# error TARGET_DEBUG does not match BUILD_DEBUG
#endif
-void some_symbol()
+void some_symbol(void)
{
}
diff --git a/Tests/RunCMake/add_compile_definitions/foo.c b/Tests/RunCMake/add_compile_definitions/foo.c
index 74a86e1..7d75e37 100644
--- a/Tests/RunCMake/add_compile_definitions/foo.c
+++ b/Tests/RunCMake/add_compile_definitions/foo.c
@@ -1,4 +1,4 @@
-void foo()
+void foo(void)
{
}
diff --git a/Tests/RunCMake/add_custom_command/a.c b/Tests/RunCMake/add_custom_command/a.c
index 707c1c3..4ef3698 100644
--- a/Tests/RunCMake/add_custom_command/a.c
+++ b/Tests/RunCMake/add_custom_command/a.c
@@ -1,3 +1,3 @@
-void a()
+void a(void)
{
}
diff --git a/Tests/RunCMake/add_dependencies/a.c b/Tests/RunCMake/add_dependencies/a.c
index 707c1c3..4ef3698 100644
--- a/Tests/RunCMake/add_dependencies/a.c
+++ b/Tests/RunCMake/add_dependencies/a.c
@@ -1,3 +1,3 @@
-void a()
+void a(void)
{
}
diff --git a/Tests/RunCMake/add_dependencies/b.c b/Tests/RunCMake/add_dependencies/b.c
index 57b2900..c7c7df4 100644
--- a/Tests/RunCMake/add_dependencies/b.c
+++ b/Tests/RunCMake/add_dependencies/b.c
@@ -1,3 +1,3 @@
-void b()
+void b(void)
{
}
diff --git a/Tests/RunCMake/add_dependencies/c.c b/Tests/RunCMake/add_dependencies/c.c
index cbf94ca..e2fa6de 100644
--- a/Tests/RunCMake/add_dependencies/c.c
+++ b/Tests/RunCMake/add_dependencies/c.c
@@ -1,3 +1,3 @@
-void c()
+void c(void)
{
}
diff --git a/Tests/RunCMake/ctest_empty_binary_directory/CMakeLists.txt.in b/Tests/RunCMake/ctest_empty_binary_directory/CMakeLists.txt.in
new file mode 100644
index 0000000..408b2f3
--- /dev/null
+++ b/Tests/RunCMake/ctest_empty_binary_directory/CMakeLists.txt.in
@@ -0,0 +1,2 @@
+cmake_minimum_required(VERSION 3.5)
+project(CTestTest@CASE_NAME@ NONE)
diff --git a/Tests/RunCMake/ctest_empty_binary_directory/NoCache-result.txt b/Tests/RunCMake/ctest_empty_binary_directory/NoCache-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/ctest_empty_binary_directory/NoCache-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/ctest_empty_binary_directory/NoCache-stderr.txt b/Tests/RunCMake/ctest_empty_binary_directory/NoCache-stderr.txt
new file mode 100644
index 0000000..338ac6d
--- /dev/null
+++ b/Tests/RunCMake/ctest_empty_binary_directory/NoCache-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Error at [^
+]*/Tests/RunCMake/ctest_empty_binary_directory/NoCache/test.cmake:[0-9]+ \(ctest_empty_binary_directory\):
+ Did not remove the binary directory:
+
+ [^
+]*/Tests/RunCMake/ctest_empty_binary_directory/NoCache-build
+
+ because:
+
+ path does not contain an existing CMakeCache\.txt file
++
+script continues after ctest_empty_binary_directory error$
diff --git a/Tests/RunCMake/ctest_empty_binary_directory/RunCMakeTest.cmake b/Tests/RunCMake/ctest_empty_binary_directory/RunCMakeTest.cmake
new file mode 100644
index 0000000..f1d4ca7
--- /dev/null
+++ b/Tests/RunCMake/ctest_empty_binary_directory/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCTest)
+
+run_ctest(NoCache)
diff --git a/Tests/RunCMake/ctest_empty_binary_directory/test.cmake.in b/Tests/RunCMake/ctest_empty_binary_directory/test.cmake.in
new file mode 100644
index 0000000..2e0cfe6
--- /dev/null
+++ b/Tests/RunCMake/ctest_empty_binary_directory/test.cmake.in
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.5)
+set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@")
+set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build")
+ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
+message("script continues after ctest_empty_binary_directory error")
diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/MyThirdPartyDependency/src/thirdparty.c b/Tests/RunCMake/ctest_labels_for_subprojects/MyThirdPartyDependency/src/thirdparty.c
index babe82d..009162d 100644
--- a/Tests/RunCMake/ctest_labels_for_subprojects/MyThirdPartyDependency/src/thirdparty.c
+++ b/Tests/RunCMake/ctest_labels_for_subprojects/MyThirdPartyDependency/src/thirdparty.c
@@ -7,7 +7,7 @@ int main(void)
return 0;
}
-int notcalled()
+int notcalled(void)
{
printf(This function doesn't get called.\n");
return 0;
diff --git a/Tests/RunCMake/export/CMake/FindHasDeps.cmake b/Tests/RunCMake/export/CMake/FindHasDeps.cmake
new file mode 100644
index 0000000..86b2abe
--- /dev/null
+++ b/Tests/RunCMake/export/CMake/FindHasDeps.cmake
@@ -0,0 +1,17 @@
+find_package(Threads REQUIRED)
+find_package(P4 REQUIRED)
+
+add_library(HasDeps::interface IMPORTED INTERFACE)
+target_link_libraries(HasDeps::interface INTERFACE Threads::Threads l4)
+
+add_library(HasDeps::A IMPORTED UNKNOWN)
+target_link_libraries(HasDeps::A INTERFACE HasDeps::interface)
+file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/a.so")
+set_property(TARGET HasDeps::A PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/a.so")
+
+add_library(HasDeps::B IMPORTED UNKNOWN)
+target_link_libraries(HasDeps::B INTERFACE HasDeps::interface)
+file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/b.so")
+set_property(TARGET HasDeps::B PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/b.so")
+
+set(HASDEPS_FOUND TRUE)
diff --git a/Tests/RunCMake/export/CMake/FindP1.cmake b/Tests/RunCMake/export/CMake/FindP1.cmake
new file mode 100644
index 0000000..e33c3d6
--- /dev/null
+++ b/Tests/RunCMake/export/CMake/FindP1.cmake
@@ -0,0 +1,2 @@
+add_library(l1 IMPORTED INTERFACE)
+set(P1_FOUND TRUE)
diff --git a/Tests/RunCMake/export/CMake/FindP2.cmake b/Tests/RunCMake/export/CMake/FindP2.cmake
new file mode 100644
index 0000000..6a360ce
--- /dev/null
+++ b/Tests/RunCMake/export/CMake/FindP2.cmake
@@ -0,0 +1,2 @@
+add_library(l2 IMPORTED INTERFACE)
+set(P2_FOUND TRUE)
diff --git a/Tests/RunCMake/export/CMake/FindP3.cmake b/Tests/RunCMake/export/CMake/FindP3.cmake
new file mode 100644
index 0000000..72bd829
--- /dev/null
+++ b/Tests/RunCMake/export/CMake/FindP3.cmake
@@ -0,0 +1,2 @@
+add_library(l3 IMPORTED INTERFACE)
+set(P3_FOUND TRUE)
diff --git a/Tests/RunCMake/export/CMake/FindP4.cmake b/Tests/RunCMake/export/CMake/FindP4.cmake
new file mode 100644
index 0000000..b62a040
--- /dev/null
+++ b/Tests/RunCMake/export/CMake/FindP4.cmake
@@ -0,0 +1,2 @@
+add_library(l4 IMPORTED INTERFACE)
+set(P4_FOUND TRUE)
diff --git a/Tests/RunCMake/export/CMake/FindP9.cmake b/Tests/RunCMake/export/CMake/FindP9.cmake
new file mode 100644
index 0000000..201b86a
--- /dev/null
+++ b/Tests/RunCMake/export/CMake/FindP9.cmake
@@ -0,0 +1,2 @@
+add_library(l9 IMPORTED INTERFACE)
+set(P9_FOUND TRUE)
diff --git a/Tests/RunCMake/export/FindDependencyExport-check.cmake b/Tests/RunCMake/export/FindDependencyExport-check.cmake
new file mode 100644
index 0000000..0cbb195
--- /dev/null
+++ b/Tests/RunCMake/export/FindDependencyExport-check.cmake
@@ -0,0 +1,35 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/mytargets.cmake" mytargets)
+if("${mytargets}" MATCHES "find_dependency\\(P1")
+ string(APPEND RunCMake_TEST_FAILED "P1 dependency should not be exported but it is\n")
+endif()
+if(NOT "${mytargets}" MATCHES "find_dependency\\(P2 REQUIRED \"VERSION\" \"1\\.0\"\\)")
+ string(APPEND RunCMake_TEST_FAILED "P2 dependency should be exported but it is not\n")
+endif()
+if(NOT "${mytargets}" MATCHES "find_dependency\\(P3 REQUIRED\\)")
+ string(APPEND RunCMake_TEST_FAILED "P3 dependency should be exported but it is not\n")
+endif()
+if(NOT "${mytargets}" MATCHES "find_dependency\\(P4 REQUIRED\\)")
+ string(APPEND RunCMake_TEST_FAILED "P4 dependency should be exported but it is not\n")
+endif()
+if("${mytargets}" MATCHES "find_dependency\\(P5")
+ string(APPEND RunCMake_TEST_FAILED "P5 dependency should not be exported but it is\n")
+endif()
+if(NOT "${mytargets}" MATCHES "find_dependency\\(P6 REQUIRED\\)")
+ string(APPEND RunCMake_TEST_FAILED "P6 dependency should be exported but it is not\n")
+endif()
+if("${mytargets}" MATCHES "find_dependency\\(P7")
+ string(APPEND RunCMake_TEST_FAILED "P7 dependency should not be exported but it is\n")
+endif()
+if(NOT "${mytargets}" MATCHES "find_dependency\\(P3[^
+]*\\)
+find_dependency\\(P2[^
+]*\\)
+find_dependency\\(P8[^
+]*\\)
+find_dependency\\(P6[^
+]*\\)
+find_dependency\\(P9[^
+]*\\)
+find_dependency\\(P4")
+ string(APPEND RunCMake_TEST_FAILED "Dependencies are not in the correct order\n")
+endif()
diff --git a/Tests/RunCMake/export/FindDependencyExport.cmake b/Tests/RunCMake/export/FindDependencyExport.cmake
new file mode 100644
index 0000000..59dd4cc
--- /dev/null
+++ b/Tests/RunCMake/export/FindDependencyExport.cmake
@@ -0,0 +1,30 @@
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
+
+find_package(P1)
+find_package(P2)
+find_package(P9)
+find_package(P4)
+find_package(P3)
+
+add_library(mylib INTERFACE)
+target_link_libraries(mylib INTERFACE l1 l2 l3 l4 l9)
+
+install(TARGETS mylib EXPORT mytargets)
+export(SETUP mytargets
+ PACKAGE_DEPENDENCY P1
+ ENABLED OFF
+ PACKAGE_DEPENDENCY P3
+ ENABLED AUTO
+ PACKAGE_DEPENDENCY P2
+ ENABLED ON
+ EXTRA_ARGS VERSION 1.0
+ PACKAGE_DEPENDENCY P5
+ ENABLED FALSE
+ PACKAGE_DEPENDENCY P8
+ ENABLED TRUE
+ PACKAGE_DEPENDENCY P6
+ ENABLED 1
+ PACKAGE_DEPENDENCY P7
+ ENABLED AUTO
+ )
+export(EXPORT mytargets EXPORT_PACKAGE_DEPENDENCIES FILE mytargets.cmake)
diff --git a/Tests/RunCMake/export/FindDependencyExportFetchContent-check.cmake b/Tests/RunCMake/export/FindDependencyExportFetchContent-check.cmake
new file mode 100644
index 0000000..353bb08
--- /dev/null
+++ b/Tests/RunCMake/export/FindDependencyExportFetchContent-check.cmake
@@ -0,0 +1,14 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/my_private_targets.cmake" my_private_targets)
+if(NOT "${my_private_targets}" MATCHES "find_dependency\\(HasDeps")
+ string(APPEND RunCMake_TEST_FAILED "HasDeps dependency should be exported but it is not\n")
+endif()
+
+file(READ "${RunCMake_TEST_BINARY_DIR}/my_static_targets.cmake" my_static_targets)
+if(NOT "${my_static_targets}" MATCHES "find_dependency\\(MyPrivate")
+ string(APPEND RunCMake_TEST_FAILED "HasDeps dependency should be exported but it is not\n")
+endif()
+
+file(READ "${RunCMake_TEST_BINARY_DIR}/my_shared_targets.cmake" my_shared_targets)
+if(NOT "${my_shared_targets}" MATCHES "find_dependency\\(MyPrivate")
+ string(APPEND RunCMake_TEST_FAILED "MyStatic dependency should be exported but it is not\n")
+endif()
diff --git a/Tests/RunCMake/export/FindDependencyExportFetchContent.cmake b/Tests/RunCMake/export/FindDependencyExportFetchContent.cmake
new file mode 100644
index 0000000..9e6c565
--- /dev/null
+++ b/Tests/RunCMake/export/FindDependencyExportFetchContent.cmake
@@ -0,0 +1,37 @@
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
+
+enable_language(CXX)
+
+find_package(HasDeps)
+
+# replicates FetchContent where a dependency is brought
+# in via source. In these cases we need to extend the `install`
+# `export` commands to allow markup on what `Find<Project>` will
+# map to the export set
+add_library(my_private_lib STATIC empty.cpp)
+target_link_libraries(my_private_lib PUBLIC HasDeps::A)
+set_target_properties(my_private_lib PROPERTIES EXPORT_FIND_PACKAGE_NAME "MyPrivate")
+
+install(TARGETS my_private_lib EXPORT my_private_targets)
+install(EXPORT my_private_targets
+ FILE my_private.cmake
+ DESTINATION lib)
+export(EXPORT my_private_targets EXPORT_PACKAGE_DEPENDENCIES FILE my_private_targets.cmake)
+
+add_library(my_static_lib STATIC empty.cpp)
+target_link_libraries(my_static_lib PRIVATE my_private_lib)
+
+install(TARGETS my_static_lib EXPORT my_static_targets)
+install(EXPORT my_static_targets
+ FILE my_static.cmake
+ DESTINATION lib)
+export(EXPORT my_static_targets EXPORT_PACKAGE_DEPENDENCIES FILE my_static_targets.cmake)
+
+add_library(my_shared_lib SHARED empty.cpp)
+target_link_libraries(my_shared_lib PUBLIC my_private_lib)
+
+install(TARGETS my_shared_lib EXPORT my_shared_targets)
+install(EXPORT my_shared_targets
+ FILE my_shared.cmake
+ DESTINATION lib)
+export(EXPORT my_shared_targets EXPORT_PACKAGE_DEPENDENCIES FILE my_shared_targets.cmake)
diff --git a/Tests/RunCMake/export/FindDependencyExportShared-check.cmake b/Tests/RunCMake/export/FindDependencyExportShared-check.cmake
new file mode 100644
index 0000000..d7a32d1
--- /dev/null
+++ b/Tests/RunCMake/export/FindDependencyExportShared-check.cmake
@@ -0,0 +1,4 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/mytargets.cmake" mytargets)
+if("${mytargets}" MATCHES "find_dependency")
+ string(APPEND RunCMake_TEST_FAILED "No dependencies should not be exported\n")
+endif()
diff --git a/Tests/RunCMake/export/FindDependencyExportShared.cmake b/Tests/RunCMake/export/FindDependencyExportShared.cmake
new file mode 100644
index 0000000..6e662a1
--- /dev/null
+++ b/Tests/RunCMake/export/FindDependencyExportShared.cmake
@@ -0,0 +1,14 @@
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
+
+enable_language(CXX)
+
+find_package(P1)
+find_package(P2)
+find_package(P3)
+find_package(P4)
+
+add_library(mylib SHARED empty.cpp)
+target_link_libraries(mylib PRIVATE l1 l2 l3 l4)
+
+install(TARGETS mylib EXPORT mytargets)
+export(EXPORT mytargets EXPORT_PACKAGE_DEPENDENCIES FILE mytargets.cmake)
diff --git a/Tests/RunCMake/export/FindDependencyExportStatic-check.cmake b/Tests/RunCMake/export/FindDependencyExportStatic-check.cmake
new file mode 100644
index 0000000..b78bccb
--- /dev/null
+++ b/Tests/RunCMake/export/FindDependencyExportStatic-check.cmake
@@ -0,0 +1,13 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/mytargets.cmake" mytargets)
+if(NOT "${mytargets}" MATCHES "find_dependency\\(P1")
+ string(APPEND RunCMake_TEST_FAILED "P1 dependency should be exported but it is not\n")
+endif()
+if(NOT "${mytargets}" MATCHES "find_dependency\\(P2")
+ string(APPEND RunCMake_TEST_FAILED "P2 dependency should be exported but it is not\n")
+endif()
+if(NOT "${mytargets}" MATCHES "find_dependency\\(P3")
+ string(APPEND RunCMake_TEST_FAILED "P3 dependency should be exported but it is not\n")
+endif()
+if(NOT "${mytargets}" MATCHES "find_dependency\\(P4")
+ string(APPEND RunCMake_TEST_FAILED "P4 dependency should be exported but it is not\n")
+endif()
diff --git a/Tests/RunCMake/export/FindDependencyExportStatic.cmake b/Tests/RunCMake/export/FindDependencyExportStatic.cmake
new file mode 100644
index 0000000..2d32eb2
--- /dev/null
+++ b/Tests/RunCMake/export/FindDependencyExportStatic.cmake
@@ -0,0 +1,14 @@
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
+
+enable_language(CXX)
+
+find_package(P1)
+find_package(P2)
+find_package(P3)
+find_package(P4)
+
+add_library(mylib STATIC empty.cpp)
+target_link_libraries(mylib PRIVATE l1 l2 l3 l4)
+
+install(TARGETS mylib EXPORT mytargets)
+export(EXPORT mytargets EXPORT_PACKAGE_DEPENDENCIES FILE mytargets.cmake)
diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake
index ee00b27..3e1b7d6 100644
--- a/Tests/RunCMake/export/RunCMakeTest.cmake
+++ b/Tests/RunCMake/export/RunCMakeTest.cmake
@@ -19,3 +19,7 @@ run_cmake(UnknownExport)
run_cmake(NamelinkOnlyExport)
run_cmake(SeparateNamelinkExport)
run_cmake(TryCompileExport)
+run_cmake(FindDependencyExport)
+run_cmake(FindDependencyExportStatic)
+run_cmake(FindDependencyExportShared)
+run_cmake(FindDependencyExportFetchContent)
diff --git a/Tests/RunCMake/find_file/NO_CACHE-stderr.txt b/Tests/RunCMake/find_file/NO_CACHE-stderr.txt
new file mode 100644
index 0000000..6da353b
--- /dev/null
+++ b/Tests/RunCMake/find_file/NO_CACHE-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at NO_CACHE\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0125 will be removed from a future version
+ of CMake\.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances\. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/find_library/NO_CACHE-stderr.txt b/Tests/RunCMake/find_library/NO_CACHE-stderr.txt
new file mode 100644
index 0000000..6da353b
--- /dev/null
+++ b/Tests/RunCMake/find_library/NO_CACHE-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at NO_CACHE\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0125 will be removed from a future version
+ of CMake\.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances\. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/find_path/NO_CACHE-stderr.txt b/Tests/RunCMake/find_path/NO_CACHE-stderr.txt
new file mode 100644
index 0000000..6da353b
--- /dev/null
+++ b/Tests/RunCMake/find_path/NO_CACHE-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at NO_CACHE\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0125 will be removed from a future version
+ of CMake\.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances\. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/find_program/NO_CACHE-stderr.txt b/Tests/RunCMake/find_program/NO_CACHE-stderr.txt
new file mode 100644
index 0000000..6da353b
--- /dev/null
+++ b/Tests/RunCMake/find_program/NO_CACHE-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at NO_CACHE\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0125 will be removed from a future version
+ of CMake\.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances\. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/foreach/foreach-var-scope-CMP0124-OLD-stderr.txt b/Tests/RunCMake/foreach/foreach-var-scope-CMP0124-OLD-stderr.txt
new file mode 100644
index 0000000..7a49647
--- /dev/null
+++ b/Tests/RunCMake/foreach/foreach-var-scope-CMP0124-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at foreach-var-scope-CMP0124-OLD\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0124 will be removed from a future version
+ of CMake\.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances\. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/if/FilePermissions.cmake b/Tests/RunCMake/if/FilePermissions.cmake
new file mode 100644
index 0000000..7881b5f
--- /dev/null
+++ b/Tests/RunCMake/if/FilePermissions.cmake
@@ -0,0 +1,153 @@
+
+file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/readable.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/writable.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/executable.txt")
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/readable.txt" "foo")
+file(CHMOD "${CMAKE_CURRENT_BINARY_DIR}/readable.txt" PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/writable.txt" "foo")
+file(CHMOD "${CMAKE_CURRENT_BINARY_DIR}/writable.txt" PERMISSIONS OWNER_WRITE GROUP_WRITE WORLD_WRITE)
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/executable.txt" "foo")
+file(CHMOD "${CMAKE_CURRENT_BINARY_DIR}/executable.txt" PERMISSIONS OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
+
+if(NOT WIN32)
+ file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/readable-dir"
+ "${CMAKE_CURRENT_BINARY_DIR}/writable-dir"
+ "${CMAKE_CURRENT_BINARY_DIR}/executable-dir")
+
+ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/readable-dir")
+ file(CHMOD "${CMAKE_CURRENT_BINARY_DIR}/readable-dir" PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
+
+ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/writable-dir")
+ file(CHMOD "${CMAKE_CURRENT_BINARY_DIR}/writable-dir" PERMISSIONS OWNER_WRITE GROUP_WRITE WORLD_WRITE)
+
+ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/executable-dir")
+ file(CHMOD "${CMAKE_CURRENT_BINARY_DIR}/executable-dir" PERMISSIONS OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
+endif()
+
+if(WIN32)
+ # files are always readable and executable
+ # directories are always, readable, writable and executable
+ if(NOT IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/readable.txt"
+ OR IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/readable.txt")
+ message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/readable.txt\" failed")
+ endif()
+
+ if(NOT IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/executable.txt"
+ OR IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/executable.txt")
+ message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/executable.txt\" failed")
+ endif()
+else()
+ if(NOT IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/readable.txt"
+ OR IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/readable.txt"
+ OR IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/readable.txt")
+ message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/readable.txt\" failed")
+ endif()
+
+ if(NOT IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/writable.txt"
+ OR IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/writable.txt"
+ OR IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/writable.txt")
+ message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/writable.txt\" failed")
+ endif()
+
+ if(NOT IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/executable.txt"
+ OR IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/executable.txt"
+ OR IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/executable.txt")
+ message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/executable.txt\" failed")
+ endif()
+
+
+ if(NOT IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/readable-dir"
+ OR IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/readable-dir"
+ OR IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/readable-dir")
+ message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/readable-dir\" failed")
+ endif()
+
+ if(NOT IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/writable-dir"
+ OR IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/writable-dir"
+ OR IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/writable-dir")
+ message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/writable-dir\" failed")
+ endif()
+
+ if(NOT IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/executable-dir"
+ OR IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/executable-dir"
+ OR IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/executable-dir")
+ message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/executable.txt\" failed")
+ endif()
+endif()
+
+if(UNIX)
+ #
+ # Check that file permissions are on the real file, not the symbolic link
+ #
+ file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/link-to-readable.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/link-to-writable.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/link-to-executable.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/link-to-readable-dir"
+ "${CMAKE_CURRENT_BINARY_DIR}/link-to-writable-dir"
+ "${CMAKE_CURRENT_BINARY_DIR}/link-to-executable-dir")
+
+ file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}/readable.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/link-to-readable.txt"
+ SYMBOLIC)
+
+ file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}/writable.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/link-to-writable.txt"
+ SYMBOLIC)
+
+ file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}/executable.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/link-to-executable.txt"
+ SYMBOLIC)
+
+
+ file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}/readable-dir"
+ "${CMAKE_CURRENT_BINARY_DIR}/link-to-readable-dir"
+ SYMBOLIC)
+
+ file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}/writable-dir"
+ "${CMAKE_CURRENT_BINARY_DIR}/link-to-writable-dir"
+ SYMBOLIC)
+
+ file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}/executable-dir"
+ "${CMAKE_CURRENT_BINARY_DIR}/link-to-executable-dir"
+ SYMBOLIC)
+
+ if(NOT IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-readable.txt"
+ OR IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-readable.txt"
+ OR IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-readable.txt")
+ message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/link-to-readable.txt\" failed")
+ endif()
+
+ if(NOT IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-writable.txt"
+ OR IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-writable.txt"
+ OR IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-writable.txt")
+ message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/link-to-writable.txt\" failed")
+ endif()
+
+ if(NOT IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-executable.txt"
+ OR IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-executable.txt"
+ OR IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-executable.txt")
+ message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/link-to-executable.txt\" failed")
+ endif()
+
+
+ if(NOT IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-readable-dir"
+ OR IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-readable-dir"
+ OR IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-readable-dir")
+ message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/link-to-readable-dir\" failed")
+ endif()
+
+ if(NOT IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-writable-dir"
+ OR IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-writable-dir"
+ OR IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-writable-dir")
+ message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/link-to-writable-dir\" failed")
+ endif()
+
+ if(NOT IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-executable-dir"
+ OR IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-executable-dir"
+ OR IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-executable-dir")
+ message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/link-to-executable-dir\" failed")
+ endif()
+endif()
diff --git a/Tests/RunCMake/if/RunCMakeTest.cmake b/Tests/RunCMake/if/RunCMakeTest.cmake
index efee116..0bfff90 100644
--- a/Tests/RunCMake/if/RunCMakeTest.cmake
+++ b/Tests/RunCMake/if/RunCMakeTest.cmake
@@ -2,6 +2,23 @@ include(RunCMake)
run_cmake(InvalidArgument1)
run_cmake(exists)
+if(NOT MSYS)
+ # permissions and symbolic links are broken on MSYS
+ unset(uid)
+ unset(status)
+ if(UNIX)
+ set(ID "id")
+ if (CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND EXISTS "/usr/xpg4/bin/id")
+ set (ID "/usr/xpg4/bin/id")
+ endif()
+ # if real user is root, tests are irrelevant
+ execute_process(COMMAND ${ID} -u $ENV{USER} OUTPUT_VARIABLE uid ERROR_QUIET
+ RESULT_VARIABLE status OUTPUT_STRIP_TRAILING_WHITESPACE)
+ endif()
+ if(NOT status AND NOT uid STREQUAL "0")
+ run_cmake(FilePermissions)
+ endif()
+endif()
run_cmake(IsDirectory)
run_cmake(IsDirectoryLong)
run_cmake(duplicate-deep-else)
diff --git a/Tests/RunCMake/install/EXPORT-FindDependencyExport-all-check.cmake b/Tests/RunCMake/install/EXPORT-FindDependencyExport-all-check.cmake
new file mode 100644
index 0000000..6a8b2e5
--- /dev/null
+++ b/Tests/RunCMake/install/EXPORT-FindDependencyExport-all-check.cmake
@@ -0,0 +1,4 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/root-all/lib/cmake/mylib/mylib-targets.cmake" contents)
+if(NOT contents MATCHES "include\\(CMakeFindDependencyMacro\\)\nfind_dependency\\(P2 REQUIRED\\)\nfind_dependency\\(P1 REQUIRED\\)\n")
+ set(RunCMake_TEST_FAILED "Dependencies were not properly exported")
+endif()
diff --git a/Tests/RunCMake/install/EXPORT-FindDependencyExport.cmake b/Tests/RunCMake/install/EXPORT-FindDependencyExport.cmake
new file mode 100644
index 0000000..071414b
--- /dev/null
+++ b/Tests/RunCMake/install/EXPORT-FindDependencyExport.cmake
@@ -0,0 +1,18 @@
+enable_language(C)
+
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+
+find_package(P1 REQUIRED)
+find_package(P2 REQUIRED)
+find_package(P3 REQUIRED)
+
+add_library(mylib INTERFACE)
+target_link_libraries(mylib INTERFACE lib1 lib2 lib3)
+install(TARGETS mylib EXPORT mylib-targets)
+export(SETUP mylib-targets
+ PACKAGE_DEPENDENCY P2
+ ENABLED AUTO
+ PACKAGE_DEPENDENCY P3
+ ENABLED OFF
+ )
+install(EXPORT mylib-targets EXPORT_PACKAGE_DEPENDENCIES FILE mylib-targets.cmake DESTINATION lib/cmake/mylib)
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index efafdd1..6f63550 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -176,6 +176,7 @@ run_install_test(TARGETS-Parts)
run_install_test(FILES-PERMISSIONS)
run_install_test(TARGETS-RPATH)
run_install_test(InstallRequiredSystemLibraries)
+run_install_test(EXPORT-FindDependencyExport)
set(RunCMake_TEST_OPTIONS "-DCMAKE_POLICY_DEFAULT_CMP0087:STRING=NEW")
run_install_test(SCRIPT)
diff --git a/Tests/RunCMake/install/cmake/FindP1.cmake b/Tests/RunCMake/install/cmake/FindP1.cmake
new file mode 100644
index 0000000..c772836
--- /dev/null
+++ b/Tests/RunCMake/install/cmake/FindP1.cmake
@@ -0,0 +1,2 @@
+add_library(lib1 IMPORTED INTERFACE)
+set(P1_FOUND TRUE)
diff --git a/Tests/RunCMake/install/cmake/FindP2.cmake b/Tests/RunCMake/install/cmake/FindP2.cmake
new file mode 100644
index 0000000..d81b35d
--- /dev/null
+++ b/Tests/RunCMake/install/cmake/FindP2.cmake
@@ -0,0 +1,2 @@
+add_library(lib2 IMPORTED INTERFACE)
+set(P2_FOUND TRUE)
diff --git a/Tests/RunCMake/install/cmake/FindP3.cmake b/Tests/RunCMake/install/cmake/FindP3.cmake
new file mode 100644
index 0000000..2818c3b
--- /dev/null
+++ b/Tests/RunCMake/install/cmake/FindP3.cmake
@@ -0,0 +1,2 @@
+add_library(lib3 IMPORTED INTERFACE)
+set(P3_FOUND TRUE)
diff --git a/Tests/RunCMake/print_stdin.c b/Tests/RunCMake/print_stdin.c
index e083e62..76b3a84 100644
--- a/Tests/RunCMake/print_stdin.c
+++ b/Tests/RunCMake/print_stdin.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-int main()
+int main(void)
{
char buf[1024];
size_t nIn = sizeof(buf);
diff --git a/Tests/RunCMake/project/CodeInjection-stdout.txt b/Tests/RunCMake/project/CodeInjection-stdout.txt
deleted file mode 100644
index 88ac966..0000000
--- a/Tests/RunCMake/project/CodeInjection-stdout.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-(-- )?Included CMAKE_PROJECT_INCLUDE_BEFORE
-(-- )?Included CMAKE_TOOLCHAIN_FILE
-.*Included CMAKE_PROJECT_TOP_LEVEL_INCLUDES first file
-(-- )?Included CMAKE_PROJECT_TOP_LEVEL_INCLUDES second file
-(-- )?Included CMAKE_PROJECT_INCLUDE
-(-- )?Calling sub-project
-(-- )?Included CMAKE_PROJECT_INCLUDE_BEFORE
-(-- )?Included CMAKE_PROJECT_SubProj_INCLUDE_BEFORE
-(-- )?Included CMAKE_PROJECT_INCLUDE
-(-- )?Included CMAKE_PROJECT_SubProj_INCLUDE
diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_include.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_include.cmake
deleted file mode 100644
index f3f0a7e..0000000
--- a/Tests/RunCMake/project/CodeInjection/cmake_project_include.cmake
+++ /dev/null
@@ -1 +0,0 @@
-message(STATUS "Included CMAKE_PROJECT_INCLUDE")
diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_include_before.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_include_before.cmake
deleted file mode 100644
index 01d53c9..0000000
--- a/Tests/RunCMake/project/CodeInjection/cmake_project_include_before.cmake
+++ /dev/null
@@ -1 +0,0 @@
-message(STATUS "Included CMAKE_PROJECT_INCLUDE_BEFORE")
diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_includes_1.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_includes_1.cmake
new file mode 100644
index 0000000..2bc65cf
--- /dev/null
+++ b/Tests/RunCMake/project/CodeInjection/cmake_project_includes_1.cmake
@@ -0,0 +1 @@
+message(STATUS "Included CMAKE_PROJECT_INCLUDE first file")
diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_includes_2.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_includes_2.cmake
new file mode 100644
index 0000000..df7240c
--- /dev/null
+++ b/Tests/RunCMake/project/CodeInjection/cmake_project_includes_2.cmake
@@ -0,0 +1 @@
+message(STATUS "Included CMAKE_PROJECT_INCLUDE second file")
diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_includes_before_1.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_includes_before_1.cmake
new file mode 100644
index 0000000..20bea78
--- /dev/null
+++ b/Tests/RunCMake/project/CodeInjection/cmake_project_includes_before_1.cmake
@@ -0,0 +1 @@
+message(STATUS "Included CMAKE_PROJECT_INCLUDE_BEFORE first file")
diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_includes_before_2.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_includes_before_2.cmake
new file mode 100644
index 0000000..91b59d1
--- /dev/null
+++ b/Tests/RunCMake/project/CodeInjection/cmake_project_includes_before_2.cmake
@@ -0,0 +1 @@
+message(STATUS "Included CMAKE_PROJECT_INCLUDE_BEFORE second file")
diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_include.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_include.cmake
deleted file mode 100644
index d68de6a..0000000
--- a/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_include.cmake
+++ /dev/null
@@ -1 +0,0 @@
-message(STATUS "Included CMAKE_PROJECT_SubProj_INCLUDE")
diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_include_before.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_include_before.cmake
deleted file mode 100644
index ef3bfc0..0000000
--- a/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_include_before.cmake
+++ /dev/null
@@ -1 +0,0 @@
-message(STATUS "Included CMAKE_PROJECT_SubProj_INCLUDE_BEFORE")
diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_1.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_1.cmake
new file mode 100644
index 0000000..fe0fe4a
--- /dev/null
+++ b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_1.cmake
@@ -0,0 +1 @@
+message(STATUS "Included CMAKE_PROJECT_SubProj_INCLUDE first file")
diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_2.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_2.cmake
new file mode 100644
index 0000000..c36fb52
--- /dev/null
+++ b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_2.cmake
@@ -0,0 +1 @@
+message(STATUS "Included CMAKE_PROJECT_SubProj_INCLUDE second file")
diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_before_1.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_before_1.cmake
new file mode 100644
index 0000000..23ae05a
--- /dev/null
+++ b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_before_1.cmake
@@ -0,0 +1 @@
+message(STATUS "Included CMAKE_PROJECT_SubProj_INCLUDE_BEFORE first file")
diff --git a/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_before_2.cmake b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_before_2.cmake
new file mode 100644
index 0000000..17f1d29
--- /dev/null
+++ b/Tests/RunCMake/project/CodeInjection/cmake_project_subproj_includes_before_2.cmake
@@ -0,0 +1 @@
+message(STATUS "Included CMAKE_PROJECT_SubProj_INCLUDE_BEFORE second file")
diff --git a/Tests/RunCMake/project/CodeInjection/initial_cache.cmake b/Tests/RunCMake/project/CodeInjection/initial_cache_1.cmake
index 6c8995b..43bb817 100644
--- a/Tests/RunCMake/project/CodeInjection/initial_cache.cmake
+++ b/Tests/RunCMake/project/CodeInjection/initial_cache_1.cmake
@@ -1,10 +1,9 @@
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/passthrough_toolchain_file.cmake" CACHE FILEPATH "")
-set(CMAKE_PROJECT_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/cmake_project_include.cmake" CACHE FILEPATH "")
-set(CMAKE_PROJECT_INCLUDE_BEFORE "${CMAKE_CURRENT_LIST_DIR}/cmake_project_include_before.cmake" CACHE FILEPATH "")
-set(CMAKE_PROJECT_SubProj_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/cmake_project_subproj_include.cmake" CACHE FILEPATH "")
-set(CMAKE_PROJECT_SubProj_INCLUDE_BEFORE "${CMAKE_CURRENT_LIST_DIR}/cmake_project_subproj_include_before.cmake" CACHE FILEPATH "")
+set(CMAKE_PROJECT_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/cmake_project_includes_1.cmake" CACHE FILEPATH "")
+set(CMAKE_PROJECT_INCLUDE_BEFORE "${CMAKE_CURRENT_LIST_DIR}/cmake_project_includes_before_1.cmake" CACHE FILEPATH "")
+set(CMAKE_PROJECT_SubProj_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/cmake_project_subproj_includes_1.cmake" CACHE FILEPATH "")
+set(CMAKE_PROJECT_SubProj_INCLUDE_BEFORE "${CMAKE_CURRENT_LIST_DIR}/cmake_project_subproj_includes_before_1.cmake" CACHE FILEPATH "")
set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES
"${CMAKE_CURRENT_LIST_DIR}/cmake_project_top_level_includes_1.cmake"
- "${CMAKE_CURRENT_LIST_DIR}/cmake_project_top_level_includes_2.cmake"
- CACHE STRING ""
+ CACHE FILEPATH ""
)
diff --git a/Tests/RunCMake/project/CodeInjection/initial_cache_2.cmake b/Tests/RunCMake/project/CodeInjection/initial_cache_2.cmake
new file mode 100644
index 0000000..09fcbfd
--- /dev/null
+++ b/Tests/RunCMake/project/CodeInjection/initial_cache_2.cmake
@@ -0,0 +1,27 @@
+set(CMAKE_TOOLCHAIN_FILE
+ "${CMAKE_CURRENT_LIST_DIR}/passthrough_toolchain_file.cmake" CACHE FILEPATH "")
+set(CMAKE_PROJECT_INCLUDE
+ "${CMAKE_CURRENT_LIST_DIR}/cmake_project_includes_1.cmake"
+ "${CMAKE_CURRENT_LIST_DIR}/cmake_project_includes_2.cmake"
+ CACHE STRING ""
+)
+set(CMAKE_PROJECT_INCLUDE_BEFORE
+ "${CMAKE_CURRENT_LIST_DIR}/cmake_project_includes_before_1.cmake"
+ "${CMAKE_CURRENT_LIST_DIR}/cmake_project_includes_before_2.cmake"
+ CACHE STRING ""
+)
+set(CMAKE_PROJECT_SubProj_INCLUDE
+ "${CMAKE_CURRENT_LIST_DIR}/cmake_project_subproj_includes_1.cmake"
+ "${CMAKE_CURRENT_LIST_DIR}/cmake_project_subproj_includes_2.cmake"
+ CACHE STRING ""
+)
+set(CMAKE_PROJECT_SubProj_INCLUDE_BEFORE
+ "${CMAKE_CURRENT_LIST_DIR}/cmake_project_subproj_includes_before_1.cmake"
+ "${CMAKE_CURRENT_LIST_DIR}/cmake_project_subproj_includes_before_2.cmake"
+ CACHE STRING ""
+)
+set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES
+ "${CMAKE_CURRENT_LIST_DIR}/cmake_project_top_level_includes_1.cmake"
+ "${CMAKE_CURRENT_LIST_DIR}/cmake_project_top_level_includes_2.cmake"
+ CACHE STRING ""
+)
diff --git a/Tests/RunCMake/project/CodeInjection/initial_cache_3.cmake b/Tests/RunCMake/project/CodeInjection/initial_cache_3.cmake
new file mode 100644
index 0000000..dd299bc
--- /dev/null
+++ b/Tests/RunCMake/project/CodeInjection/initial_cache_3.cmake
@@ -0,0 +1,28 @@
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}" CACHE STRING "")
+set(CMAKE_TOOLCHAIN_FILE
+ "${CMAKE_CURRENT_LIST_DIR}/passthrough_toolchain_file.cmake" CACHE FILEPATH "")
+set(CMAKE_PROJECT_INCLUDE
+ "${CMAKE_CURRENT_LIST_DIR}/cmake_project_includes_1.cmake"
+ "cmake_project_includes_2"
+ CACHE STRING ""
+)
+set(CMAKE_PROJECT_INCLUDE_BEFORE
+ "${CMAKE_CURRENT_LIST_DIR}/cmake_project_includes_before_1.cmake"
+ "cmake_project_includes_before_2"
+ CACHE STRING ""
+)
+set(CMAKE_PROJECT_SubProj_INCLUDE
+ "${CMAKE_CURRENT_LIST_DIR}/cmake_project_subproj_includes_1.cmake"
+ "cmake_project_subproj_includes_2"
+ CACHE STRING ""
+)
+set(CMAKE_PROJECT_SubProj_INCLUDE_BEFORE
+ "${CMAKE_CURRENT_LIST_DIR}/cmake_project_subproj_includes_before_1.cmake"
+ "cmake_project_subproj_includes_before_2"
+ CACHE STRING ""
+)
+set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES
+ "${CMAKE_CURRENT_LIST_DIR}/cmake_project_top_level_includes_1.cmake"
+ "cmake_project_top_level_includes_2"
+ CACHE STRING ""
+)
diff --git a/Tests/RunCMake/project/CodeInjection1-stdout.txt b/Tests/RunCMake/project/CodeInjection1-stdout.txt
new file mode 100644
index 0000000..7a780b7
--- /dev/null
+++ b/Tests/RunCMake/project/CodeInjection1-stdout.txt
@@ -0,0 +1,9 @@
+(-- )?Included CMAKE_PROJECT_INCLUDE_BEFORE first file
+(-- )?Included CMAKE_TOOLCHAIN_FILE
+.*Included CMAKE_PROJECT_TOP_LEVEL_INCLUDES first file
+(-- )?Included CMAKE_PROJECT_INCLUDE first file
+(-- )?Calling sub-project
+(-- )?Included CMAKE_PROJECT_INCLUDE_BEFORE first file
+(-- )?Included CMAKE_PROJECT_SubProj_INCLUDE_BEFORE first file
+(-- )?Included CMAKE_PROJECT_INCLUDE first file
+(-- )?Included CMAKE_PROJECT_SubProj_INCLUDE first file
diff --git a/Tests/RunCMake/project/CodeInjection.cmake b/Tests/RunCMake/project/CodeInjection1.cmake
index dcf56a1..dcf56a1 100644
--- a/Tests/RunCMake/project/CodeInjection.cmake
+++ b/Tests/RunCMake/project/CodeInjection1.cmake
diff --git a/Tests/RunCMake/project/CodeInjection2-stdout.txt b/Tests/RunCMake/project/CodeInjection2-stdout.txt
new file mode 100644
index 0000000..5c18cdf
--- /dev/null
+++ b/Tests/RunCMake/project/CodeInjection2-stdout.txt
@@ -0,0 +1,16 @@
+(-- )?Included CMAKE_PROJECT_INCLUDE_BEFORE first file
+(-- )?Included CMAKE_PROJECT_INCLUDE_BEFORE second file
+(-- )?Included CMAKE_TOOLCHAIN_FILE
+.*Included CMAKE_PROJECT_TOP_LEVEL_INCLUDES first file
+(-- )?Included CMAKE_PROJECT_TOP_LEVEL_INCLUDES second file
+(-- )?Included CMAKE_PROJECT_INCLUDE first file
+(-- )?Included CMAKE_PROJECT_INCLUDE second file
+(-- )?Calling sub-project
+(-- )?Included CMAKE_PROJECT_INCLUDE_BEFORE first file
+(-- )?Included CMAKE_PROJECT_INCLUDE_BEFORE second file
+(-- )?Included CMAKE_PROJECT_SubProj_INCLUDE_BEFORE first file
+(-- )?Included CMAKE_PROJECT_SubProj_INCLUDE_BEFORE second file
+(-- )?Included CMAKE_PROJECT_INCLUDE first file
+(-- )?Included CMAKE_PROJECT_INCLUDE second file
+(-- )?Included CMAKE_PROJECT_SubProj_INCLUDE first file
+(-- )?Included CMAKE_PROJECT_SubProj_INCLUDE second file
diff --git a/Tests/RunCMake/project/CodeInjection2.cmake b/Tests/RunCMake/project/CodeInjection2.cmake
new file mode 100644
index 0000000..dcf56a1
--- /dev/null
+++ b/Tests/RunCMake/project/CodeInjection2.cmake
@@ -0,0 +1 @@
+add_subdirectory(CodeInjection)
diff --git a/Tests/RunCMake/project/CodeInjection3-stdout.txt b/Tests/RunCMake/project/CodeInjection3-stdout.txt
new file mode 100644
index 0000000..5c18cdf
--- /dev/null
+++ b/Tests/RunCMake/project/CodeInjection3-stdout.txt
@@ -0,0 +1,16 @@
+(-- )?Included CMAKE_PROJECT_INCLUDE_BEFORE first file
+(-- )?Included CMAKE_PROJECT_INCLUDE_BEFORE second file
+(-- )?Included CMAKE_TOOLCHAIN_FILE
+.*Included CMAKE_PROJECT_TOP_LEVEL_INCLUDES first file
+(-- )?Included CMAKE_PROJECT_TOP_LEVEL_INCLUDES second file
+(-- )?Included CMAKE_PROJECT_INCLUDE first file
+(-- )?Included CMAKE_PROJECT_INCLUDE second file
+(-- )?Calling sub-project
+(-- )?Included CMAKE_PROJECT_INCLUDE_BEFORE first file
+(-- )?Included CMAKE_PROJECT_INCLUDE_BEFORE second file
+(-- )?Included CMAKE_PROJECT_SubProj_INCLUDE_BEFORE first file
+(-- )?Included CMAKE_PROJECT_SubProj_INCLUDE_BEFORE second file
+(-- )?Included CMAKE_PROJECT_INCLUDE first file
+(-- )?Included CMAKE_PROJECT_INCLUDE second file
+(-- )?Included CMAKE_PROJECT_SubProj_INCLUDE first file
+(-- )?Included CMAKE_PROJECT_SubProj_INCLUDE second file
diff --git a/Tests/RunCMake/project/CodeInjection3.cmake b/Tests/RunCMake/project/CodeInjection3.cmake
new file mode 100644
index 0000000..dcf56a1
--- /dev/null
+++ b/Tests/RunCMake/project/CodeInjection3.cmake
@@ -0,0 +1 @@
+add_subdirectory(CodeInjection)
diff --git a/Tests/RunCMake/project/RunCMakeTest.cmake b/Tests/RunCMake/project/RunCMakeTest.cmake
index 0f3716f..16f10be 100644
--- a/Tests/RunCMake/project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/project/RunCMakeTest.cmake
@@ -5,8 +5,16 @@ include(RunCMake)
# which tests some of the individual variables one at a time.
# Here, we are focused on testing that the variables are all injected
# at the expected points in the expected order.
-run_cmake_with_options(CodeInjection
- -C "${CMAKE_CURRENT_LIST_DIR}/CodeInjection/initial_cache.cmake"
+run_cmake_with_options(CodeInjection1
+ -C "${CMAKE_CURRENT_LIST_DIR}/CodeInjection/initial_cache_1.cmake"
+)
+# This checks that List variables are allowed.
+run_cmake_with_options(CodeInjection2
+ -C "${CMAKE_CURRENT_LIST_DIR}/CodeInjection/initial_cache_2.cmake"
+)
+# This checks that module names are also allowed.
+run_cmake_with_options(CodeInjection3
+ -C "${CMAKE_CURRENT_LIST_DIR}/CodeInjection/initial_cache_3.cmake"
)
if(CMake_TEST_RESOURCES)
diff --git a/Tests/RunCMake/showIncludes.c b/Tests/RunCMake/showIncludes.c
index 7d467cf..5114965 100644
--- a/Tests/RunCMake/showIncludes.c
+++ b/Tests/RunCMake/showIncludes.c
@@ -10,7 +10,7 @@
#include <stdio.h>
#include <stdlib.h>
-int main()
+int main(void)
{
/* 'cl /showIncludes' encodes output in the console output code page. */
unsigned int cp = GetConsoleOutputCP();
diff --git a/Tests/RunCMake/target_compile_definitions/foo.c b/Tests/RunCMake/target_compile_definitions/foo.c
index 74a86e1..7d75e37 100644
--- a/Tests/RunCMake/target_compile_definitions/foo.c
+++ b/Tests/RunCMake/target_compile_definitions/foo.c
@@ -1,4 +1,4 @@
-void foo()
+void foo(void)
{
}
diff --git a/Tests/RunCMake/target_compile_features/empty.c b/Tests/RunCMake/target_compile_features/empty.c
index 11ec041..8d91e77 100644
--- a/Tests/RunCMake/target_compile_features/empty.c
+++ b/Tests/RunCMake/target_compile_features/empty.c
@@ -1,7 +1,7 @@
#ifdef _WIN32
__declspec(dllexport)
#endif
- int empty()
+ int empty(void)
{
return 0;
}
diff --git a/Tests/RunCMake/target_compile_options/CMP0101.c b/Tests/RunCMake/target_compile_options/CMP0101.c
index 250869a..7ef6117 100644
--- a/Tests/RunCMake/target_compile_options/CMP0101.c
+++ b/Tests/RunCMake/target_compile_options/CMP0101.c
@@ -3,7 +3,7 @@
# error "BEFORE not honored"
#endif
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/RunCMake/target_link_libraries-ALIAS/func.c b/Tests/RunCMake/target_link_libraries-ALIAS/func.c
index 415a9bf..ebc6a5f 100644
--- a/Tests/RunCMake/target_link_libraries-ALIAS/func.c
+++ b/Tests/RunCMake/target_link_libraries-ALIAS/func.c
@@ -2,6 +2,6 @@
#if defined(_WIN32)
__declspec(dllexport)
#endif
- void func_c()
+ void func_c(void)
{
}
diff --git a/Tests/RunCMake/target_link_libraries-ALIAS/lib.c b/Tests/RunCMake/target_link_libraries-ALIAS/lib.c
index b2d1b66..95c0e91 100644
--- a/Tests/RunCMake/target_link_libraries-ALIAS/lib.c
+++ b/Tests/RunCMake/target_link_libraries-ALIAS/lib.c
@@ -2,9 +2,9 @@
#if defined(_WIN32)
__declspec(dllimport)
#endif
- void func_c();
+ void func_c(void);
-void lib()
+void lib(void)
{
func_c();
}
diff --git a/Tests/RunCMake/target_link_libraries-ALIAS/main.c b/Tests/RunCMake/target_link_libraries-ALIAS/main.c
index a908dea..72a3ddb 100644
--- a/Tests/RunCMake/target_link_libraries-ALIAS/main.c
+++ b/Tests/RunCMake/target_link_libraries-ALIAS/main.c
@@ -2,9 +2,9 @@
#if defined(_WIN32)
__declspec(dllimport)
#endif
- void func_c();
+ void func_c(void);
-int main()
+int main(void)
{
func_c();
diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/base.c b/Tests/RunCMake/target_link_libraries-LINK_GROUP/base.c
index a5075d4..ed769a0 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_GROUP/base.c
+++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/base.c
@@ -4,6 +4,6 @@
__declspec(dllexport)
# endif
#endif
- void base()
+ void base(void)
{
}
diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/func1.c b/Tests/RunCMake/target_link_libraries-LINK_GROUP/func1.c
index 3399e00..ef11bc2 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_GROUP/func1.c
+++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/func1.c
@@ -1,7 +1,7 @@
-extern void func2();
+extern void func2(void);
-void func1()
+void func1(void)
{
func2();
}
diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/func2.c b/Tests/RunCMake/target_link_libraries-LINK_GROUP/func2.c
index 0f9aa64..3eab38e 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_GROUP/func2.c
+++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/func2.c
@@ -1,7 +1,7 @@
-extern void func3();
+extern void func3(void);
-void func2()
+void func2(void)
{
func3();
}
diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/func3.c b/Tests/RunCMake/target_link_libraries-LINK_GROUP/func3.c
index 0b7df64..c109e09 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_GROUP/func3.c
+++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/func3.c
@@ -1,6 +1,6 @@
-extern void func3();
+extern void func3(void);
-void func3()
+void func3(void)
{
}
diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/lib.c b/Tests/RunCMake/target_link_libraries-LINK_GROUP/lib.c
index 35ab367..21f559c 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_GROUP/lib.c
+++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/lib.c
@@ -4,12 +4,12 @@
__declspec(dllimport)
# endif
#endif
- void base();
+ void base(void);
#if defined(_WIN32)
__declspec(dllexport)
#endif
- void lib()
+ void lib(void)
{
base();
}
diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/main.c b/Tests/RunCMake/target_link_libraries-LINK_GROUP/main.c
index 403583d..d78b0f6 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_GROUP/main.c
+++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/main.c
@@ -1,7 +1,7 @@
-extern void func1();
+extern void func1(void);
-int main()
+int main(void)
{
func1();
}
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/func.c b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/func.c
index 415a9bf..ebc6a5f 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/func.c
+++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/func.c
@@ -2,6 +2,6 @@
#if defined(_WIN32)
__declspec(dllexport)
#endif
- void func_c()
+ void func_c(void)
{
}
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/lib.c b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/lib.c
index b2d1b66..95c0e91 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/lib.c
+++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/lib.c
@@ -2,9 +2,9 @@
#if defined(_WIN32)
__declspec(dllimport)
#endif
- void func_c();
+ void func_c(void);
-void lib()
+void lib(void)
{
func_c();
}
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/main.c b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/main.c
index 689dbd7..891c4ad 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/main.c
+++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/main.c
@@ -1,14 +1,14 @@
#if defined(C_USE_CXX)
-void func_c_cxx();
+void func_c_cxx(void);
#else
# if defined(_WIN32)
__declspec(dllimport)
# endif
- void func_c();
+ void func_c(void);
#endif
-int main()
+int main(void)
{
#if defined(C_USE_CXX)
func_c_cxx();
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/func.c b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/func.c
index 415a9bf..ebc6a5f 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/func.c
+++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/func.c
@@ -2,6 +2,6 @@
#if defined(_WIN32)
__declspec(dllexport)
#endif
- void func_c()
+ void func_c(void)
{
}
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/lib.c b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/lib.c
index b2d1b66..95c0e91 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/lib.c
+++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/lib.c
@@ -2,9 +2,9 @@
#if defined(_WIN32)
__declspec(dllimport)
#endif
- void func_c();
+ void func_c(void);
-void lib()
+void lib(void)
{
func_c();
}
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/main.c b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/main.c
index a908dea..72a3ddb 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/main.c
+++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/main.c
@@ -2,9 +2,9 @@
#if defined(_WIN32)
__declspec(dllimport)
#endif
- void func_c();
+ void func_c(void);
-int main()
+int main(void)
{
func_c();
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-nested-feature1-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-group1-check.cmake
index 255c9a6..255c9a6 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-nested-feature1-check.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-group1-check.cmake
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-simple2-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-group1-result.txt
index 8d98f9d..8d98f9d 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-simple2-result.txt
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-group1-result.txt
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-nested-feature2-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-group2-check.cmake
index a8e0da7..a8e0da7 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-nested-feature2-check.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-group2-check.cmake
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-simple1-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-group2-result.txt
index 8d98f9d..8d98f9d 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-simple1-result.txt
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-group2-result.txt
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items1-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items1-check.cmake
index 54cef2c..54cef2c 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items1-check.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items1-check.cmake
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-with-DEFAULT-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items1-result.txt
index 8d98f9d..8d98f9d 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-with-DEFAULT-result.txt
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items1-result.txt
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items2-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items2-check.cmake
index 7c38134..7c38134 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items2-check.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items2-check.cmake
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features4-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items2-result.txt
index 8d98f9d..8d98f9d 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features4-result.txt
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items2-result.txt
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items3-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items3-check.cmake
index 88b5cf6..88b5cf6 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items3-check.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items3-check.cmake
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features3-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items3-result.txt
index 8d98f9d..8d98f9d 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features3-result.txt
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items3-result.txt
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items4-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items4-check.cmake
index c473637..c473637 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items4-check.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items4-check.cmake
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features2-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items4-result.txt
index 8d98f9d..8d98f9d 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features2-result.txt
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-link-items4-result.txt
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features1-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features1-check.cmake
new file mode 100644
index 0000000..eb1f755
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features1-check.cmake
@@ -0,0 +1,12 @@
+
+include("${RunCMake_BINARY_DIR}/LINK_LIBRARY-CMP0156-NEW-build/LIBRARIES_PROCESSING.cmake")
+
+if (CMAKE_C_LINK_LIBRARIES_PROCESSING MATCHES "ORDER=FORWARD")
+ if (NOT actual_stdout MATCHES "(/|-)-PREFIXGROUP\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base3${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIXGROUP")
+ set (RunCMake_TEST_FAILED "Not found expected '--PREFIXGROUP --LIBGROUP<base1> --LIBGROUP<base3> --SUFFIXGROUP'.")
+ endif()
+else()
+ if (NOT actual_stdout MATCHES "(/|-)-PREFIXGROUP\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base3${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIXGROUP")
+ set (RunCMake_TEST_FAILED "Not found expected '--PREFIXGROUP --LIBGROUP<base3> --LIBGROUP<base1> --SUFFIXGROUP'.")
+ endif()
+endif()
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features1-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features1-result.txt
index 8d98f9d..8d98f9d 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features1-result.txt
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features1-result.txt
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features2-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features2-check.cmake
new file mode 100644
index 0000000..eb1f755
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features2-check.cmake
@@ -0,0 +1,12 @@
+
+include("${RunCMake_BINARY_DIR}/LINK_LIBRARY-CMP0156-NEW-build/LIBRARIES_PROCESSING.cmake")
+
+if (CMAKE_C_LINK_LIBRARIES_PROCESSING MATCHES "ORDER=FORWARD")
+ if (NOT actual_stdout MATCHES "(/|-)-PREFIXGROUP\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base3${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIXGROUP")
+ set (RunCMake_TEST_FAILED "Not found expected '--PREFIXGROUP --LIBGROUP<base1> --LIBGROUP<base3> --SUFFIXGROUP'.")
+ endif()
+else()
+ if (NOT actual_stdout MATCHES "(/|-)-PREFIXGROUP\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base3${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIXGROUP")
+ set (RunCMake_TEST_FAILED "Not found expected '--PREFIXGROUP --LIBGROUP<base3> --LIBGROUP<base1> --SUFFIXGROUP'.")
+ endif()
+endif()
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-nested-feature2-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features2-result.txt
index 8d98f9d..8d98f9d 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-nested-feature2-result.txt
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features2-result.txt
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features3-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features3-check.cmake
new file mode 100644
index 0000000..783bad9
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features3-check.cmake
@@ -0,0 +1,12 @@
+
+include("${RunCMake_BINARY_DIR}/LINK_LIBRARY-CMP0156-NEW-build/LIBRARIES_PROCESSING.cmake")
+
+if (CMAKE_C_LINK_LIBRARIES_PROCESSING MATCHES "ORDER=FORWARD")
+ if (NOT actual_stdout MATCHES "${LINK_SHARED_LIBRARY_PREFIX}base2${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-PREFIXGROUP\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base3${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIXGROUP\"? +\"?${CMAKE_LINK_LIBRARY_FLAG}other2${LINK_EXTERN_LIBRARY_SUFFIX}\"? +\"?${CMAKE_LINK_LIBRARY_FLAG}other1${LINK_EXTERN_LIBRARY_SUFFIX}")
+ set (RunCMake_TEST_FAILED "Not found expected '<base2> --PREFIXGROUP --LIBGROUP<base1> --LIBGROUP<base3> --SUFFIXGROUP <other2> <other1>'.")
+ endif()
+else()
+ if (NOT actual_stdout MATCHES "${LINK_SHARED_LIBRARY_PREFIX}base2${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-PREFIXGROUP\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base3${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIXGROUP\"? +\"?${CMAKE_LINK_LIBRARY_FLAG}other2${LINK_EXTERN_LIBRARY_SUFFIX}\"? +\"?(/|-)-PREFIXGROUP\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIXGROUP\"? +\"?${CMAKE_LINK_LIBRARY_FLAG}other1${LINK_EXTERN_LIBRARY_SUFFIX}")
+ set (RunCMake_TEST_FAILED "Not found expected '<base2> --PREFIXGROUP --LIBGROUP<base3> --SUFFIXGROUP <other2> --PREFIXGROUP --LIBGROUP<base1> --SUFFIXGROUP <other1>'.")
+ endif()
+endif()
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-nested-feature1-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features3-result.txt
index 8d98f9d..8d98f9d 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-nested-feature1-result.txt
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-mix-features3-result.txt
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-group1-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-nested-feature1-check.cmake
index 255c9a6..255c9a6 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-group1-check.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-nested-feature1-check.cmake
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-mix-features3-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-nested-feature1-result.txt
index 8d98f9d..8d98f9d 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-mix-features3-result.txt
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-nested-feature1-result.txt
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-group2-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-nested-feature2-check.cmake
index a8e0da7..a8e0da7 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-group2-check.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-nested-feature2-check.cmake
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-mix-features2-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-nested-feature2-result.txt
index 8d98f9d..8d98f9d 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-mix-features2-result.txt
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-nested-feature2-result.txt
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features1-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features1-check.cmake
new file mode 100644
index 0000000..ce72570
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features1-check.cmake
@@ -0,0 +1,12 @@
+
+include("${RunCMake_BINARY_DIR}/LINK_LIBRARY-CMP0156-NEW-build/LIBRARIES_PROCESSING.cmake")
+
+if (CMAKE_C_LINK_LIBRARIES_PROCESSING MATCHES "ORDER=FORWARD")
+ if (NOT actual_stdout MATCHES "(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base3${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?${CMAKE_LINK_LIBRARY_FLAG}other1")
+ set (RunCMake_TEST_FAILED "Not found expected '--LIBFLAG<base1> --LIBFLAG<base3> <other1>'.")
+ endif()
+else()
+ if (NOT actual_stdout MATCHES "(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base3${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?${CMAKE_LINK_LIBRARY_FLAG}other1")
+ set (RunCMake_TEST_FAILED "Not found expected '--LIBFLAG<base3> --LIBFLAG<base1> <other1>'.")
+ endif()
+endif()
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-mix-features1-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features1-result.txt
index 8d98f9d..8d98f9d 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-mix-features1-result.txt
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features1-result.txt
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features2-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features2-check.cmake
new file mode 100644
index 0000000..817b6e2
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features2-check.cmake
@@ -0,0 +1,12 @@
+
+include("${RunCMake_BINARY_DIR}/LINK_LIBRARY-CMP0156-NEW-build/LIBRARIES_PROCESSING.cmake")
+
+if (CMAKE_C_LINK_LIBRARIES_PROCESSING MATCHES "ORDER=FORWARD")
+ if (NOT actual_stdout MATCHES "(/|-)-PREFIXGROUP\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIXGROUP\"? +\"?(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base3${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-PREFIXGROUP\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}other1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIXGROUP")
+ set (RunCMake_TEST_FAILED "Not found expected '--PREFIXGROUP --LIBGROUP<base1> --SUFFIXGROUP --LIBFLAG<base3> --PREFIXGROUP --LIBGROUP<other1> --SUFFIXGROUP'.")
+ endif()
+else()
+ if (NOT actual_stdout MATCHES "(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base3${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-PREFIXGROUP\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBGROUPother1${LINK_EXTERN_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIXGROUP")
+ set (RunCMake_TEST_FAILED "Not found expected '--LIBFLAG<base3> --PREFIXGROUP --LIBGROUP<base1> --LIBGROUP<other1> --SUFFIXGROUP'.")
+ endif()
+endif()
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items4-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features2-result.txt
index 8d98f9d..8d98f9d 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items4-result.txt
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features2-result.txt
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features3-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features3-check.cmake
new file mode 100644
index 0000000..ce72570
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features3-check.cmake
@@ -0,0 +1,12 @@
+
+include("${RunCMake_BINARY_DIR}/LINK_LIBRARY-CMP0156-NEW-build/LIBRARIES_PROCESSING.cmake")
+
+if (CMAKE_C_LINK_LIBRARIES_PROCESSING MATCHES "ORDER=FORWARD")
+ if (NOT actual_stdout MATCHES "(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base3${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?${CMAKE_LINK_LIBRARY_FLAG}other1")
+ set (RunCMake_TEST_FAILED "Not found expected '--LIBFLAG<base1> --LIBFLAG<base3> <other1>'.")
+ endif()
+else()
+ if (NOT actual_stdout MATCHES "(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base3${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?${CMAKE_LINK_LIBRARY_FLAG}other1")
+ set (RunCMake_TEST_FAILED "Not found expected '--LIBFLAG<base3> --LIBFLAG<base1> <other1>'.")
+ endif()
+endif()
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items3-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features3-result.txt
index 8d98f9d..8d98f9d 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items3-result.txt
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features3-result.txt
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features4-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features4-check.cmake
new file mode 100644
index 0000000..700bcf2
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features4-check.cmake
@@ -0,0 +1,12 @@
+
+include("${RunCMake_BINARY_DIR}/LINK_LIBRARY-CMP0156-NEW-build/LIBRARIES_PROCESSING.cmake")
+
+if (CMAKE_C_LINK_LIBRARIES_PROCESSING MATCHES "ORDER=FORWARD")
+ if (NOT actual_stdout MATCHES "(/|-)-PREFIXGROUP\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIXGROUP\"? +\"?(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base3${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-PREFIXGROUP\"? +\"?(/|-)-LIBGROUPother1${LINK_EXTERN_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIXGROUP\"?")
+ set (RunCMake_TEST_FAILED "Not found expected '--PREFIXGROUP --LIBGROUP<base1> --SUFFIXGROUP --LIBFLAG<base3> --PREFIXGROUP --LIBGROUP<other1> --SUFFIXGROUP'.")
+ endif()
+else()
+ if (NOT actual_stdout MATCHES "(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base3${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-PREFIXGROUP\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBGROUPother1${LINK_EXTERN_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIXGROUP")
+ set (RunCMake_TEST_FAILED "Not found expected '--LIBFLAG<base3> --PREFIXGROUP --LIBGROUP<base1> --LIBGROUP<other1> --SUFFIXGROUP'.")
+ endif()
+endif()
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items2-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features4-result.txt
index 8d98f9d..8d98f9d 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items2-result.txt
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-features4-result.txt
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-with-DEFAULT-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-with-DEFAULT-check.cmake
new file mode 100644
index 0000000..3a44bc0
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-with-DEFAULT-check.cmake
@@ -0,0 +1,12 @@
+
+include("${RunCMake_BINARY_DIR}/LINK_LIBRARY-CMP0156-NEW-build/LIBRARIES_PROCESSING.cmake")
+
+if (CMAKE_C_LINK_LIBRARIES_PROCESSING MATCHES "ORDER=FORWARD")
+ if (NOT actual_stdout MATCHES "${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base3${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?${CMAKE_LINK_LIBRARY_FLAG}other1${LINK_EXTERN_LIBRARY_SUFFIX}\"?")
+ set (RunCMake_TEST_FAILED "Not found expected '<base1> --LIBFLAG<base3> <other1>'.")
+ endif()
+else()
+ if (NOT actual_stdout MATCHES "(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base3${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?${CMAKE_LINK_LIBRARY_FLAG}other1${LINK_EXTERN_LIBRARY_SUFFIX}\"?")
+ set (RunCMake_TEST_FAILED "Not found expected '--LIBFLAG<base3> <base1> <other1>'.")
+ endif()
+endif()
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items1-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-with-DEFAULT-result.txt
index 8d98f9d..8d98f9d 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-link-items1-result.txt
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-override-with-DEFAULT-result.txt
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-simple2-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-simple1-check.cmake
index 32b58fe..32b58fe 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-simple2-check.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-simple1-check.cmake
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-group2-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-simple1-result.txt
index 8d98f9d..8d98f9d 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-group2-result.txt
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-simple1-result.txt
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-simple1-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-simple2-check.cmake
index 32b58fe..32b58fe 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-simple1-check.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-simple2-check.cmake
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-group1-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-simple2-result.txt
index 8d98f9d..8d98f9d 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-group1-result.txt
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-NEW-simple2-result.txt
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-group1-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-group1-check.cmake
new file mode 100644
index 0000000..255c9a6
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-group1-check.cmake
@@ -0,0 +1,4 @@
+
+if (NOT actual_stdout MATCHES "(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base2${LINK_SHARED_LIBRARY_SUFFIX}")
+ set (RunCMake_TEST_FAILED "Not found expected '--LIBFLAG<base1> --LIBFLAG<base2>'.")
+endif()
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-group1-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-group1-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-group1-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-group2-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-group2-check.cmake
new file mode 100644
index 0000000..a8e0da7
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-group2-check.cmake
@@ -0,0 +1,4 @@
+
+if (NOT actual_stdout MATCHES "(/|-)-PREFIXGROUP\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base2${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIXGROUP")
+ set (RunCMake_TEST_FAILED "Not found expected '--PREFIXGROUP --LIBGROUP<base1> --LIBGROUP<base2> --SUFFIXGROUP'.")
+endif()
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-group2-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-group2-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-group2-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items1-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items1-check.cmake
new file mode 100644
index 0000000..54cef2c
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items1-check.cmake
@@ -0,0 +1,4 @@
+
+if (NOT actual_stdout MATCHES "(/|-)-PREFIXGROUP\"? +\"?.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?${CMAKE_LINK_LIBRARY_FLAG}other${LINK_EXTERN_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIXGROUP")
+ set (RunCMake_TEST_FAILED "Not found expected '--PREFIXGROUP <base1> <other> --SUFFIXGROUP'.")
+endif()
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items1-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items1-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items1-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items2-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items2-check.cmake
new file mode 100644
index 0000000..7c38134
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items2-check.cmake
@@ -0,0 +1,4 @@
+
+if (NOT actual_stdout MATCHES "(/|-)-PREFIXGROUP\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBGROUPother${LINK_EXTERN_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIXGROUP")
+ set (RunCMake_TEST_FAILED "Not found expected '--PREFIXGROUP --LIBGROUP<base1> --LIBGROUP<other> --SUFFIXGROUP'.")
+endif()
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items2-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items2-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items2-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items3-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items3-check.cmake
new file mode 100644
index 0000000..88b5cf6
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items3-check.cmake
@@ -0,0 +1,4 @@
+
+if (NOT actual_stdout MATCHES "(/|-)-PREFIXGROUP\"? +\"?(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-ITEMFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBFLAGother${LINK_EXTERN_LIBRARY_SUFFIX}\"? +\"?(/|-)-ITEMFLAGother\"? +\"?(/|-)-SUFFIXGROUP")
+ set (RunCMake_TEST_FAILED "Not found expected '--PREFIXGROUP --LIBFLAG<base1> --ITEMFLAG<base1> --LIBFLAG<other> --ITEMFLAG<other> --SUFFIXGROUP'.")
+endif()
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items3-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items3-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items3-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items4-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items4-check.cmake
new file mode 100644
index 0000000..c473637
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items4-check.cmake
@@ -0,0 +1,4 @@
+
+if (NOT actual_stdout MATCHES "(/|-)-PREFIXGROUP\"? +\"?(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-ITEMFLAGother\"? +\"?(/|-)-SUFFIXGROUP")
+ set (RunCMake_TEST_FAILED "Not found expected '--PREFIXGROUP --LIBFLAG<base1> --ITEMFLAG<other> --SUFFIXGROUP'.")
+endif()
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items4-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items4-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-link-items4-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-mix-features2-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features1-check.cmake
index ab06726..ab06726 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-mix-features2-check.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features1-check.cmake
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features1-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features1-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features1-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-mix-features1-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features2-check.cmake
index 858dcfe..ab06726 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-mix-features1-check.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features2-check.cmake
@@ -1,4 +1,4 @@
if (NOT actual_stdout MATCHES "(/|-)-PREFIXGROUP\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base3${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIXGROUP")
- set (RunCMake_TEST_FAILED "Not found expected '--PREFIXGROUP --LIBGROUP<base1> --LIBGROUP<base3> --SUFFIXGROUP'.")
+ set (RunCMake_TEST_FAILED "Not found expected '--PREFIXGROUP --LIBGROUP<base3> --LIBGROUP<base1> --SUFFIXGROUP'.")
endif()
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features2-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features2-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features2-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-mix-features3-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features3-check.cmake
index 62aa17c..62aa17c 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-mix-features3-check.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features3-check.cmake
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features3-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features3-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-mix-features3-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-nested-feature1-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-nested-feature1-check.cmake
new file mode 100644
index 0000000..255c9a6
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-nested-feature1-check.cmake
@@ -0,0 +1,4 @@
+
+if (NOT actual_stdout MATCHES "(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base2${LINK_SHARED_LIBRARY_SUFFIX}")
+ set (RunCMake_TEST_FAILED "Not found expected '--LIBFLAG<base1> --LIBFLAG<base2>'.")
+endif()
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-nested-feature1-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-nested-feature1-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-nested-feature1-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-nested-feature2-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-nested-feature2-check.cmake
new file mode 100644
index 0000000..a8e0da7
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-nested-feature2-check.cmake
@@ -0,0 +1,4 @@
+
+if (NOT actual_stdout MATCHES "(/|-)-PREFIXGROUP\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBGROUP.*${LINK_SHARED_LIBRARY_PREFIX}base2${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIXGROUP")
+ set (RunCMake_TEST_FAILED "Not found expected '--PREFIXGROUP --LIBGROUP<base1> --LIBGROUP<base2> --SUFFIXGROUP'.")
+endif()
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-nested-feature2-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-nested-feature2-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-nested-feature2-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features3-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features1-check.cmake
index a9fba20..a9fba20 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features3-check.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features1-check.cmake
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features1-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features1-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features1-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features4-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features2-check.cmake
index 58c117e..58c117e 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features4-check.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features2-check.cmake
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features2-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features2-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features2-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features1-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features3-check.cmake
index a9fba20..a9fba20 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features1-check.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features3-check.cmake
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features3-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features3-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features3-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features2-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features4-check.cmake
index 58c117e..58c117e 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-features2-check.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features4-check.cmake
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features4-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features4-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-features4-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-with-DEFAULT-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-with-DEFAULT-check.cmake
index d022f7e..d022f7e 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-override-with-DEFAULT-check.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-with-DEFAULT-check.cmake
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-with-DEFAULT-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-with-DEFAULT-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-override-with-DEFAULT-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-simple1-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-simple1-check.cmake
new file mode 100644
index 0000000..32b58fe
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-simple1-check.cmake
@@ -0,0 +1,4 @@
+
+if (NOT actual_stdout MATCHES "(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base1")
+ set (RunCMake_TEST_FAILED "Not found expected '--LIBFLAG<base1>'.")
+endif()
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-simple1-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-simple1-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-simple1-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-simple2-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-simple2-check.cmake
new file mode 100644
index 0000000..32b58fe
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-simple2-check.cmake
@@ -0,0 +1,4 @@
+
+if (NOT actual_stdout MATCHES "(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base1")
+ set (RunCMake_TEST_FAILED "Not found expected '--LIBFLAG<base1>'.")
+endif()
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-simple2-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-simple2-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY-CMP0156-OLD-simple2-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY.cmake
index f19112a..e8f9425 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/LINK_LIBRARY.cmake
@@ -1,5 +1,12 @@
enable_language(C)
+if(CMP0156 STREQUAL "NEW")
+ cmake_policy(SET CMP0156 NEW)
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LIBRARIES_PROCESSING.cmake" "set(CMAKE_C_LINK_LIBRARIES_PROCESSING \"${CMAKE_C_LINK_LIBRARIES_PROCESSING}\")\n")
+else()
+ cmake_policy(SET CMP0156 OLD)
+endif()
+
# ensure command line is always displayed and do not use any response file
set(CMAKE_VERBOSE_MAKEFILE TRUE)
set(CMAKE_C_USE_RESPONSE_FILE_FOR_LIBRARIES FALSE)
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake
index 0f3a6b7..9ef7f34 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake
@@ -37,29 +37,32 @@ if ((RunCMake_GENERATOR MATCHES "Makefiles|Ninja|Xcode"
set(LINK_EXTERN_LIBRARY_SUFFIX "${CMAKE_IMPORT_LIBRARY_SUFFIX}")
endif()
- run_cmake(LINK_LIBRARY)
-
- run_cmake_target(LINK_LIBRARY simple1 LinkLibrary_simple1)
- run_cmake_target(LINK_LIBRARY simple2 LinkLibrary_simple2)
- run_cmake_target(LINK_LIBRARY group1 LinkLibrary_group1)
- run_cmake_target(LINK_LIBRARY group2 LinkLibrary_group2)
- run_cmake_target(LINK_LIBRARY nested-feature1 LinkLibrary_nested_feature1)
- run_cmake_target(LINK_LIBRARY nested-feature2 LinkLibrary_nested_feature2)
- run_cmake_target(LINK_LIBRARY link-items1 LinkLibrary_link_items1)
- run_cmake_target(LINK_LIBRARY link-items2 LinkLibrary_link_items2)
- run_cmake_target(LINK_LIBRARY link-items3 LinkLibrary_link_items3)
- run_cmake_target(LINK_LIBRARY link-items4 LinkLibrary_link_items4)
- run_cmake_target(LINK_LIBRARY mix-features1 LinkLibrary_mix_features1)
- run_cmake_target(LINK_LIBRARY mix-features2 LinkLibrary_mix_features2)
- run_cmake_target(LINK_LIBRARY mix-features3 LinkLibrary_mix_features3)
-
- # testing target property LINK_LIBRARY_OVERRIDE
- run_cmake_target(LINK_LIBRARY override-features1 LinkLibrary_override_features1)
- run_cmake_target(LINK_LIBRARY override-features2 LinkLibrary_override_features2)
- run_cmake_target(LINK_LIBRARY override-with-DEFAULT LinkLibrary_override_with_default)
- # testing target property LINK_LIBRARY_OVERRIDE_<LIBRARY>
- run_cmake_target(LINK_LIBRARY override-features3 LinkLibrary_override_features3)
- run_cmake_target(LINK_LIBRARY override-features4 LinkLibrary_override_features4)
+ foreach(policy IN ITEMS OLD NEW)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/LINK_LIBRARY-CMP0156-${policy}-build)
+ run_cmake_with_options(LINK_LIBRARY -DCMP0156=${policy})
+
+ run_cmake_target(LINK_LIBRARY-CMP0156-${policy} simple1 LinkLibrary_simple1)
+ run_cmake_target(LINK_LIBRARY-CMP0156-${policy} simple2 LinkLibrary_simple2)
+ run_cmake_target(LINK_LIBRARY-CMP0156-${policy} group1 LinkLibrary_group1)
+ run_cmake_target(LINK_LIBRARY-CMP0156-${policy} group2 LinkLibrary_group2)
+ run_cmake_target(LINK_LIBRARY-CMP0156-${policy} nested-feature1 LinkLibrary_nested_feature1)
+ run_cmake_target(LINK_LIBRARY-CMP0156-${policy} nested-feature2 LinkLibrary_nested_feature2)
+ run_cmake_target(LINK_LIBRARY-CMP0156-${policy} link-items1 LinkLibrary_link_items1)
+ run_cmake_target(LINK_LIBRARY-CMP0156-${policy} link-items2 LinkLibrary_link_items2)
+ run_cmake_target(LINK_LIBRARY-CMP0156-${policy} link-items3 LinkLibrary_link_items3)
+ run_cmake_target(LINK_LIBRARY-CMP0156-${policy} link-items4 LinkLibrary_link_items4)
+ run_cmake_target(LINK_LIBRARY-CMP0156-${policy} mix-features1 LinkLibrary_mix_features1)
+ run_cmake_target(LINK_LIBRARY-CMP0156-${policy} mix-features2 LinkLibrary_mix_features2)
+ run_cmake_target(LINK_LIBRARY-CMP0156-${policy} mix-features3 LinkLibrary_mix_features3)
+
+ # testing target property LINK_LIBRARY_OVERRIDE
+ run_cmake_target(LINK_LIBRARY-CMP0156-${policy} override-features1 LinkLibrary_override_features1)
+ run_cmake_target(LINK_LIBRARY-CMP0156-${policy} override-features2 LinkLibrary_override_features2)
+ run_cmake_target(LINK_LIBRARY-CMP0156-${policy} override-with-DEFAULT LinkLibrary_override_with_default)
+ # testing target property LINK_LIBRARY_OVERRIDE_<LIBRARY>
+ run_cmake_target(LINK_LIBRARY-CMP0156-${policy} override-features3 LinkLibrary_override_features3)
+ run_cmake_target(LINK_LIBRARY-CMP0156-${policy} override-features4 LinkLibrary_override_features4)
+ endforeach()
run_cmake(imported-target)
diff --git a/Tests/RunCMake/target_link_libraries/lib.c b/Tests/RunCMake/target_link_libraries/lib.c
index b2d1b66..95c0e91 100644
--- a/Tests/RunCMake/target_link_libraries/lib.c
+++ b/Tests/RunCMake/target_link_libraries/lib.c
@@ -2,9 +2,9 @@
#if defined(_WIN32)
__declspec(dllimport)
#endif
- void func_c();
+ void func_c(void);
-void lib()
+void lib(void)
{
func_c();
}
diff --git a/Tests/RunCMake/try_compile/LinkOptions.cmake b/Tests/RunCMake/try_compile/LinkOptions.cmake
index 7fae35c..45cbedf 100644
--- a/Tests/RunCMake/try_compile/LinkOptions.cmake
+++ b/Tests/RunCMake/try_compile/LinkOptions.cmake
@@ -1,8 +1,5 @@
-
enable_language(C)
-cmake_policy(SET CMP0054 NEW)
-
set (lib_name "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}lib${CMAKE_STATIC_LIBRARY_SUFFIX}")
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
if (RunCMake_C_COMPILER_ID STREQUAL "MSVC"
diff --git a/Tests/RunCMake/try_compile/lib.c b/Tests/RunCMake/try_compile/lib.c
index b00c576..ce64a13 100644
--- a/Tests/RunCMake/try_compile/lib.c
+++ b/Tests/RunCMake/try_compile/lib.c
@@ -1,4 +1,4 @@
-void func()
+void func(void)
{
}
diff --git a/Tests/RunCMake/try_compile/main.c b/Tests/RunCMake/try_compile/main.c
index 2128ead..6b1e682 100644
--- a/Tests/RunCMake/try_compile/main.c
+++ b/Tests/RunCMake/try_compile/main.c
@@ -1,4 +1,4 @@
-extern void func();
+extern void func(void);
int main(void)
{
diff --git a/Tests/RunCMake/try_run/ConfigureLog-test.c b/Tests/RunCMake/try_run/ConfigureLog-test.c
index 6a8f125..465069d 100644
--- a/Tests/RunCMake/try_run/ConfigureLog-test.c
+++ b/Tests/RunCMake/try_run/ConfigureLog-test.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-int main()
+int main(void)
{
fprintf(stderr, "Output, with backslash '\\', on stderr!\n");
fflush(stderr); /* make output deterministic even if stderr is buffered */
diff --git a/Tests/RunCMake/try_run/LinkOptions.cmake b/Tests/RunCMake/try_run/LinkOptions.cmake
index b9a87f3..b19141c 100644
--- a/Tests/RunCMake/try_run/LinkOptions.cmake
+++ b/Tests/RunCMake/try_run/LinkOptions.cmake
@@ -1,8 +1,5 @@
-
enable_language(C)
-cmake_policy(SET CMP0054 NEW)
-
set (lib_name "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}lib${CMAKE_STATIC_LIBRARY_SUFFIX}")
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
if (RunCMake_C_COMPILER_ID STREQUAL "MSVC"
diff --git a/Tests/RunCMake/try_run/LinkerLanguage.cmake b/Tests/RunCMake/try_run/LinkerLanguage.cmake
new file mode 100644
index 0000000..137e198
--- /dev/null
+++ b/Tests/RunCMake/try_run/LinkerLanguage.cmake
@@ -0,0 +1,29 @@
+enable_language(CXX)
+enable_language(Fortran)
+
+set (lib_name "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}lib${CMAKE_STATIC_LIBRARY_SUFFIX}")
+if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ if (CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set (undef_flag -u _func)
+ else()
+ set (undef_flag -u func)
+ endif()
+elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ set (undef_flag -u _func)
+else()
+ set (undef_flag -u func)
+endif()
+
+set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE)
+try_run(run_result compile_result
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/lib.cxx ${CMAKE_CURRENT_SOURCE_DIR}/main.f90
+ COMPILE_OUTPUT_VARIABLE compile_out
+ RUN_OUTPUT_VARIABLE run_out
+ LINKER_LANGUAGE Fortran)
+
+if(NOT compile_result)
+ message(FATAL_ERROR "try_run(... LINKER_LANGUAGE Fortran) compilation failed:\n${compile_out}")
+endif()
+if(run_result STREQUAL "FAILED_TO_RUN")
+ message(FATAL_ERROR "try_run(... LINKER_LANGUAGE Fortran) execution failed:\n${run_out}")
+endif()
diff --git a/Tests/RunCMake/try_run/RunCMakeTest.cmake b/Tests/RunCMake/try_run/RunCMakeTest.cmake
index 62e3caf..bd7cd9b 100644
--- a/Tests/RunCMake/try_run/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_run/RunCMakeTest.cmake
@@ -19,3 +19,13 @@ if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND
run_cmake(LinkOptions)
unset (RunCMake_TEST_OPTIONS)
endif()
+
+if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND
+ CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$" AND
+ CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
+ set (RunCMake_TEST_OPTIONS
+ -DRunCMake_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID}
+ -DRunCMake_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID})
+ run_cmake(LinkerLanguage)
+ unset (RunCMake_TEST_OPTIONS)
+endif()
diff --git a/Tests/RunCMake/try_run/lib.c b/Tests/RunCMake/try_run/lib.c
index b00c576..ce64a13 100644
--- a/Tests/RunCMake/try_run/lib.c
+++ b/Tests/RunCMake/try_run/lib.c
@@ -1,4 +1,4 @@
-void func()
+void func(void)
{
}
diff --git a/Tests/RunCMake/try_run/lib.cxx b/Tests/RunCMake/try_run/lib.cxx
new file mode 100644
index 0000000..b01a075
--- /dev/null
+++ b/Tests/RunCMake/try_run/lib.cxx
@@ -0,0 +1,4 @@
+
+extern "C" void func()
+{
+}
diff --git a/Tests/RunCMake/try_run/main.c b/Tests/RunCMake/try_run/main.c
index 2128ead..6b1e682 100644
--- a/Tests/RunCMake/try_run/main.c
+++ b/Tests/RunCMake/try_run/main.c
@@ -1,4 +1,4 @@
-extern void func();
+extern void func(void);
int main(void)
{
diff --git a/Tests/RunCMake/try_run/main.f90 b/Tests/RunCMake/try_run/main.f90
new file mode 100644
index 0000000..29b933e
--- /dev/null
+++ b/Tests/RunCMake/try_run/main.f90
@@ -0,0 +1,12 @@
+program main
+
+implicit none
+
+interface
+subroutine func() bind(C)
+end subroutine
+end interface
+
+call func()
+
+end program
diff --git a/Tests/RuntimePath/bar1.c b/Tests/RuntimePath/bar1.c
index 5dc5ec9..11b3a74 100644
--- a/Tests/RuntimePath/bar1.c
+++ b/Tests/RuntimePath/bar1.c
@@ -1,5 +1,5 @@
-extern int foo1();
-int bar1()
+extern int foo1(void);
+int bar1(void)
{
return foo1();
}
diff --git a/Tests/RuntimePath/bar2.c b/Tests/RuntimePath/bar2.c
index 9035489..a117f6f 100644
--- a/Tests/RuntimePath/bar2.c
+++ b/Tests/RuntimePath/bar2.c
@@ -1,5 +1,5 @@
-extern int foo2();
-int bar2()
+extern int foo2(void);
+int bar2(void)
{
return foo2();
}
diff --git a/Tests/RuntimePath/foo1.c b/Tests/RuntimePath/foo1.c
index dfcb0b7..14370ac 100644
--- a/Tests/RuntimePath/foo1.c
+++ b/Tests/RuntimePath/foo1.c
@@ -1,4 +1,4 @@
-int foo1()
+int foo1(void)
{
return 0;
}
diff --git a/Tests/RuntimePath/foo2.c b/Tests/RuntimePath/foo2.c
index 12a3e77..a105df9 100644
--- a/Tests/RuntimePath/foo2.c
+++ b/Tests/RuntimePath/foo2.c
@@ -1,4 +1,4 @@
-int foo2()
+int foo2(void)
{
return 0;
}
diff --git a/Tests/RuntimePath/main.c b/Tests/RuntimePath/main.c
index c71ee06..f25b493 100644
--- a/Tests/RuntimePath/main.c
+++ b/Tests/RuntimePath/main.c
@@ -1,5 +1,5 @@
-extern int bar1();
-int main()
+extern int bar1(void);
+int main(void)
{
return bar1();
}
diff --git a/Tests/SetLang/bar.c b/Tests/SetLang/bar.c
index 515e8c2..3a299dc 100644
--- a/Tests/SetLang/bar.c
+++ b/Tests/SetLang/bar.c
@@ -20,7 +20,7 @@ public:
int i;
};
-int main()
+int main(void)
{
A a;
if (a.i == 21) {
diff --git a/Tests/Simple/simpleCLib.c b/Tests/Simple/simpleCLib.c
index 6509865..90c4440 100644
--- a/Tests/Simple/simpleCLib.c
+++ b/Tests/Simple/simpleCLib.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-int FooBar()
+int FooBar(void)
{
int class;
int private = 10;
diff --git a/Tests/SimpleCOnly/bar.c b/Tests/SimpleCOnly/bar.c
index 570fee9..6c7605a 100644
--- a/Tests/SimpleCOnly/bar.c
+++ b/Tests/SimpleCOnly/bar.c
@@ -1,4 +1,4 @@
-int bar()
+int bar(void)
{
return 5;
}
diff --git a/Tests/SimpleCOnly/foo.c b/Tests/SimpleCOnly/foo.c
index c61d212..c12b865 100644
--- a/Tests/SimpleCOnly/foo.c
+++ b/Tests/SimpleCOnly/foo.c
@@ -1,4 +1,4 @@
-int foo()
+int foo(void)
{
return 12;
}
diff --git a/Tests/SimpleCOnly/main.c b/Tests/SimpleCOnly/main.c
index 54a7312..ad4c75c 100644
--- a/Tests/SimpleCOnly/main.c
+++ b/Tests/SimpleCOnly/main.c
@@ -3,7 +3,7 @@
extern int foo();
extern int bar();
-int main()
+int main(void)
{
int i = foo();
int k = bar();
diff --git a/Tests/SourceFileIncludeDirProperty/main.c b/Tests/SourceFileIncludeDirProperty/main.c
index 36144ca..d32e2ad 100644
--- a/Tests/SourceFileIncludeDirProperty/main.c
+++ b/Tests/SourceFileIncludeDirProperty/main.c
@@ -1,7 +1,7 @@
#include "header.h"
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/SourceFileProperty/ICaseTest.c b/Tests/SourceFileProperty/ICaseTest.c
index 454c721..70ae53e 100644
--- a/Tests/SourceFileProperty/ICaseTest.c
+++ b/Tests/SourceFileProperty/ICaseTest.c
@@ -1,6 +1,6 @@
#ifdef NEEDED_TO_WORK
-int icasetest()
+int icasetest(void)
{
return 0;
}
diff --git a/Tests/SourceGroups/main.c b/Tests/SourceGroups/main.c
index f646b49..85a6c8b 100644
--- a/Tests/SourceGroups/main.c
+++ b/Tests/SourceGroups/main.c
@@ -14,7 +14,7 @@ extern int tree_foobar(void);
extern int tree_baz(void);
extern int nested(void);
-int main()
+int main(void)
{
printf("foo: %d bar: %d foobar: %d barbar: %d baz: %d\n", foo(), bar(),
foobar(), barbar(), baz());
diff --git a/Tests/SourceGroups/sub2/main.c b/Tests/SourceGroups/sub2/main.c
index 4cd8ae0..6a195bc 100644
--- a/Tests/SourceGroups/sub2/main.c
+++ b/Tests/SourceGroups/sub2/main.c
@@ -3,7 +3,7 @@
extern int qax(void);
extern int qux(void);
-int main()
+int main(void)
{
printf("qux: %d qax: %d\n", qux(), qax());
diff --git a/Tests/SubDir/AnotherSubdir/pair+int.int.c b/Tests/SubDir/AnotherSubdir/pair+int.int.c
index b7a6237..6e719fe 100644
--- a/Tests/SubDir/AnotherSubdir/pair+int.int.c
+++ b/Tests/SubDir/AnotherSubdir/pair+int.int.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-void pair_stuff()
+void pair_stuff(void)
{
printf("Placeholder for a strange file in subdirectory\n");
}
diff --git a/Tests/SubDir/AnotherSubdir/pair_int.int.c b/Tests/SubDir/AnotherSubdir/pair_int.int.c
index b7a6237..6e719fe 100644
--- a/Tests/SubDir/AnotherSubdir/pair_int.int.c
+++ b/Tests/SubDir/AnotherSubdir/pair_int.int.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-void pair_stuff()
+void pair_stuff(void)
{
printf("Placeholder for a strange file in subdirectory\n");
}
diff --git a/Tests/SubDir/AnotherSubdir/secondone.c b/Tests/SubDir/AnotherSubdir/secondone.c
index 3e9e5af..0dd9c6b 100644
--- a/Tests/SubDir/AnotherSubdir/secondone.c
+++ b/Tests/SubDir/AnotherSubdir/secondone.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-void secondone()
+void secondone(void)
{
printf("Hello again\n");
}
diff --git a/Tests/SubDir/AnotherSubdir/testfromsubdir.c b/Tests/SubDir/AnotherSubdir/testfromsubdir.c
index 34b6e7a..5e72140 100644
--- a/Tests/SubDir/AnotherSubdir/testfromsubdir.c
+++ b/Tests/SubDir/AnotherSubdir/testfromsubdir.c
@@ -4,7 +4,7 @@ void secondone();
void pair_stuff();
void vcl_stuff();
-int main()
+int main(void)
{
printf("Hello from subdirectory\n");
secondone();
diff --git a/Tests/SubDir/ThirdSubDir/pair+int.int1.c b/Tests/SubDir/ThirdSubDir/pair+int.int1.c
index b7a6237..6e719fe 100644
--- a/Tests/SubDir/ThirdSubDir/pair+int.int1.c
+++ b/Tests/SubDir/ThirdSubDir/pair+int.int1.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-void pair_stuff()
+void pair_stuff(void)
{
printf("Placeholder for a strange file in subdirectory\n");
}
diff --git a/Tests/SubDir/ThirdSubDir/pair_int.int1.c b/Tests/SubDir/ThirdSubDir/pair_int.int1.c
index b7a6237..6e719fe 100644
--- a/Tests/SubDir/ThirdSubDir/pair_int.int1.c
+++ b/Tests/SubDir/ThirdSubDir/pair_int.int1.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-void pair_stuff()
+void pair_stuff(void)
{
printf("Placeholder for a strange file in subdirectory\n");
}
diff --git a/Tests/SubDir/ThirdSubDir/pair_p_int.int1.c b/Tests/SubDir/ThirdSubDir/pair_p_int.int1.c
index 95a66ee..3cf9442 100644
--- a/Tests/SubDir/ThirdSubDir/pair_p_int.int1.c
+++ b/Tests/SubDir/ThirdSubDir/pair_p_int.int1.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-void pair_p_stuff()
+void pair_p_stuff(void)
{
printf("Placeholder for another strange file in subdirectory\n");
}
diff --git a/Tests/SubDir/ThirdSubDir/testfromauxsubdir.c b/Tests/SubDir/ThirdSubDir/testfromauxsubdir.c
index d162084..448ef52 100644
--- a/Tests/SubDir/ThirdSubDir/testfromauxsubdir.c
+++ b/Tests/SubDir/ThirdSubDir/testfromauxsubdir.c
@@ -5,7 +5,7 @@ void pair_stuff();
void pair_p_stuff();
void vcl_stuff();
-int main()
+int main(void)
{
printf("Hello from subdirectory\n");
secondone();
diff --git a/Tests/SubDir/ThirdSubDir/thirdone.c b/Tests/SubDir/ThirdSubDir/thirdone.c
index 3e9e5af..0dd9c6b 100644
--- a/Tests/SubDir/ThirdSubDir/thirdone.c
+++ b/Tests/SubDir/ThirdSubDir/thirdone.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-void secondone()
+void secondone(void)
{
printf("Hello again\n");
}
diff --git a/Tests/SubDir/vcl_algorithm+vcl_pair+double.foo.c b/Tests/SubDir/vcl_algorithm+vcl_pair+double.foo.c
index a0c60f7..689c827 100644
--- a/Tests/SubDir/vcl_algorithm+vcl_pair+double.foo.c
+++ b/Tests/SubDir/vcl_algorithm+vcl_pair+double.foo.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-void vcl_stuff()
+void vcl_stuff(void)
{
printf("Placeholder for a file with strange name\n");
}
diff --git a/Tests/SubDir/vcl_algorithm_vcl_pair_double.foo.c b/Tests/SubDir/vcl_algorithm_vcl_pair_double.foo.c
index a0c60f7..689c827 100644
--- a/Tests/SubDir/vcl_algorithm_vcl_pair_double.foo.c
+++ b/Tests/SubDir/vcl_algorithm_vcl_pair_double.foo.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-void vcl_stuff()
+void vcl_stuff(void)
{
printf("Placeholder for a file with strange name\n");
}
diff --git a/Tests/SubDirSpaces/Another Subdir/pair+int.int.c b/Tests/SubDirSpaces/Another Subdir/pair+int.int.c
index b7a6237..6e719fe 100644
--- a/Tests/SubDirSpaces/Another Subdir/pair+int.int.c
+++ b/Tests/SubDirSpaces/Another Subdir/pair+int.int.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-void pair_stuff()
+void pair_stuff(void)
{
printf("Placeholder for a strange file in subdirectory\n");
}
diff --git a/Tests/SubDirSpaces/Another Subdir/pair_int.int.c b/Tests/SubDirSpaces/Another Subdir/pair_int.int.c
index b7a6237..6e719fe 100644
--- a/Tests/SubDirSpaces/Another Subdir/pair_int.int.c
+++ b/Tests/SubDirSpaces/Another Subdir/pair_int.int.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-void pair_stuff()
+void pair_stuff(void)
{
printf("Placeholder for a strange file in subdirectory\n");
}
diff --git a/Tests/SubDirSpaces/Another Subdir/secondone.c b/Tests/SubDirSpaces/Another Subdir/secondone.c
index 3e9e5af..0dd9c6b 100644
--- a/Tests/SubDirSpaces/Another Subdir/secondone.c
+++ b/Tests/SubDirSpaces/Another Subdir/secondone.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-void secondone()
+void secondone(void)
{
printf("Hello again\n");
}
diff --git a/Tests/SubDirSpaces/Another Subdir/testfromsubdir.c b/Tests/SubDirSpaces/Another Subdir/testfromsubdir.c
index 34b6e7a..5e72140 100644
--- a/Tests/SubDirSpaces/Another Subdir/testfromsubdir.c
+++ b/Tests/SubDirSpaces/Another Subdir/testfromsubdir.c
@@ -4,7 +4,7 @@ void secondone();
void pair_stuff();
void vcl_stuff();
-int main()
+int main(void)
{
printf("Hello from subdirectory\n");
secondone();
diff --git a/Tests/SubDirSpaces/Some(x86) Sources/test.c b/Tests/SubDirSpaces/Some(x86) Sources/test.c
index 66568d4..5baf240 100644
--- a/Tests/SubDirSpaces/Some(x86) Sources/test.c
+++ b/Tests/SubDirSpaces/Some(x86) Sources/test.c
@@ -1,3 +1,3 @@
-void testOdd()
+void testOdd(void)
{
}
diff --git a/Tests/SubDirSpaces/ThirdSubDir/pair+int.int1.c b/Tests/SubDirSpaces/ThirdSubDir/pair+int.int1.c
index b7a6237..6e719fe 100644
--- a/Tests/SubDirSpaces/ThirdSubDir/pair+int.int1.c
+++ b/Tests/SubDirSpaces/ThirdSubDir/pair+int.int1.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-void pair_stuff()
+void pair_stuff(void)
{
printf("Placeholder for a strange file in subdirectory\n");
}
diff --git a/Tests/SubDirSpaces/ThirdSubDir/pair_int.int1.c b/Tests/SubDirSpaces/ThirdSubDir/pair_int.int1.c
index b7a6237..6e719fe 100644
--- a/Tests/SubDirSpaces/ThirdSubDir/pair_int.int1.c
+++ b/Tests/SubDirSpaces/ThirdSubDir/pair_int.int1.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-void pair_stuff()
+void pair_stuff(void)
{
printf("Placeholder for a strange file in subdirectory\n");
}
diff --git a/Tests/SubDirSpaces/ThirdSubDir/pair_p_int.int1.c b/Tests/SubDirSpaces/ThirdSubDir/pair_p_int.int1.c
index 95a66ee..3cf9442 100644
--- a/Tests/SubDirSpaces/ThirdSubDir/pair_p_int.int1.c
+++ b/Tests/SubDirSpaces/ThirdSubDir/pair_p_int.int1.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-void pair_p_stuff()
+void pair_p_stuff(void)
{
printf("Placeholder for another strange file in subdirectory\n");
}
diff --git a/Tests/SubDirSpaces/ThirdSubDir/testfromauxsubdir.c b/Tests/SubDirSpaces/ThirdSubDir/testfromauxsubdir.c
index fa6c33c..2bff654 100644
--- a/Tests/SubDirSpaces/ThirdSubDir/testfromauxsubdir.c
+++ b/Tests/SubDirSpaces/ThirdSubDir/testfromauxsubdir.c
@@ -7,7 +7,7 @@ void vcl_stuff();
#ifdef CMAKE_PAREN
void testOdd();
#endif
-int main()
+int main(void)
{
printf("Hello from subdirectory\n");
secondone();
diff --git a/Tests/SubDirSpaces/ThirdSubDir/thirdone.c b/Tests/SubDirSpaces/ThirdSubDir/thirdone.c
index 3e9e5af..0dd9c6b 100644
--- a/Tests/SubDirSpaces/ThirdSubDir/thirdone.c
+++ b/Tests/SubDirSpaces/ThirdSubDir/thirdone.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-void secondone()
+void secondone(void)
{
printf("Hello again\n");
}
diff --git a/Tests/SubDirSpaces/vcl_algorithm+vcl_pair+double.foo.c b/Tests/SubDirSpaces/vcl_algorithm+vcl_pair+double.foo.c
index a0c60f7..689c827 100644
--- a/Tests/SubDirSpaces/vcl_algorithm+vcl_pair+double.foo.c
+++ b/Tests/SubDirSpaces/vcl_algorithm+vcl_pair+double.foo.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-void vcl_stuff()
+void vcl_stuff(void)
{
printf("Placeholder for a file with strange name\n");
}
diff --git a/Tests/SubDirSpaces/vcl_algorithm_vcl_pair_double.foo.c b/Tests/SubDirSpaces/vcl_algorithm_vcl_pair_double.foo.c
index a0c60f7..689c827 100644
--- a/Tests/SubDirSpaces/vcl_algorithm_vcl_pair_double.foo.c
+++ b/Tests/SubDirSpaces/vcl_algorithm_vcl_pair_double.foo.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-void vcl_stuff()
+void vcl_stuff(void)
{
printf("Placeholder for a file with strange name\n");
}
diff --git a/Tests/TryCompile/Inner/innerexe.c b/Tests/TryCompile/Inner/innerexe.c
index e329c5f..6d1e3da 100644
--- a/Tests/TryCompile/Inner/innerexe.c
+++ b/Tests/TryCompile/Inner/innerexe.c
@@ -1,5 +1,5 @@
extern int innerlib(void);
-int main()
+int main(void)
{
return innerlib();
}
diff --git a/Tests/TryCompile/check_a_b.c b/Tests/TryCompile/check_a_b.c
index 05fba0f..65535ac 100644
--- a/Tests/TryCompile/check_a_b.c
+++ b/Tests/TryCompile/check_a_b.c
@@ -4,7 +4,7 @@
#ifndef DEF_B
# error DEF_B not defined
#endif
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/TryCompile/exit_success.c b/Tests/TryCompile/exit_success.c
index 82f5b5f..302d926 100644
--- a/Tests/TryCompile/exit_success.c
+++ b/Tests/TryCompile/exit_success.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-int main()
+int main(void)
{
printf("hello world\n");
return 0;
diff --git a/Tests/TryCompile/exit_with_error.c b/Tests/TryCompile/exit_with_error.c
index dbddcf5..dfa36fc 100644
--- a/Tests/TryCompile/exit_with_error.c
+++ b/Tests/TryCompile/exit_with_error.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-int main()
+int main(void)
{
printf("hello world\n");
return 1;
diff --git a/Tests/TryCompile/pass.c b/Tests/TryCompile/pass.c
index f8b643a..8488f4e 100644
--- a/Tests/TryCompile/pass.c
+++ b/Tests/TryCompile/pass.c
@@ -1,4 +1,4 @@
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/TryCompile/pass2a.c b/Tests/TryCompile/pass2a.c
index 27c377b..8375a8e 100644
--- a/Tests/TryCompile/pass2a.c
+++ b/Tests/TryCompile/pass2a.c
@@ -1,5 +1,5 @@
extern int pass2b(void);
-int main()
+int main(void)
{
return pass2b();
}
diff --git a/Tests/TryCompile/stdout_and_stderr.c b/Tests/TryCompile/stdout_and_stderr.c
index 84ded1f..c25b7d9 100644
--- a/Tests/TryCompile/stdout_and_stderr.c
+++ b/Tests/TryCompile/stdout_and_stderr.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-int main()
+int main(void)
{
fputs("error\n", stderr);
puts("hello world\n");
diff --git a/Tests/Unset/unset.c b/Tests/Unset/unset.c
index f8b643a..8488f4e 100644
--- a/Tests/Unset/unset.c
+++ b/Tests/Unset/unset.c
@@ -1,4 +1,4 @@
-int main()
+int main(void)
{
return 0;
}
diff --git a/Tests/VSGNUFortran/c_code/main.c b/Tests/VSGNUFortran/c_code/main.c
index 60c1120..be868c3 100644
--- a/Tests/VSGNUFortran/c_code/main.c
+++ b/Tests/VSGNUFortran/c_code/main.c
@@ -1,6 +1,6 @@
#include <HelloWorldFCMangle.h> /* created by FortranCInterface */
extern void FC_hello(void);
-int main()
+int main(void)
{
FC_hello();
return 0;
diff --git a/Tests/Visibility/bar.c b/Tests/Visibility/bar.c
index b72a1a5..e1f4df6 100644
--- a/Tests/Visibility/bar.c
+++ b/Tests/Visibility/bar.c
@@ -1,3 +1,3 @@
-void bar()
+void bar(void)
{
}
diff --git a/Tests/X11/X11.c b/Tests/X11/X11.c
index 3a6f9f0..9f002f6 100644
--- a/Tests/X11/X11.c
+++ b/Tests/X11/X11.c
@@ -4,7 +4,7 @@
# include <X11/Xlib.h>
# include <X11/Xutil.h>
-int main()
+int main(void)
{
printf("There is X on this computer\n");
return 0;
@@ -12,7 +12,7 @@ int main()
#else
-int main()
+int main(void)
{
printf("No X on this computer\n");
return 0;
diff --git a/Tests/XCTest/FrameworkExample/FrameworkExample.c b/Tests/XCTest/FrameworkExample/FrameworkExample.c
index 77361c8..9da1bf2 100644
--- a/Tests/XCTest/FrameworkExample/FrameworkExample.c
+++ b/Tests/XCTest/FrameworkExample/FrameworkExample.c
@@ -1,6 +1,6 @@
#include "FrameworkExample.h"
-int FourtyTwo()
+int FourtyTwo(void)
{
return 42;
}
diff --git a/Utilities/Doxygen/CMakeLists.txt b/Utilities/Doxygen/CMakeLists.txt
index 12b5407..52a31eb 100644
--- a/Utilities/Doxygen/CMakeLists.txt
+++ b/Utilities/Doxygen/CMakeLists.txt
@@ -3,7 +3,7 @@
if(NOT CMake_SOURCE_DIR)
set(CMakeDeveloperReference_STANDALONE 1)
- cmake_minimum_required(VERSION 3.13...3.26 FATAL_ERROR)
+ cmake_minimum_required(VERSION 3.13...3.27 FATAL_ERROR)
get_filename_component(tmp "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
get_filename_component(CMake_SOURCE_DIR "${tmp}" PATH)
include(${CMake_SOURCE_DIR}/Modules/CTestUseLaunchers.cmake)
diff --git a/Utilities/Scripts/update-libarchive.bash b/Utilities/Scripts/update-libarchive.bash
index 5a4f11a..724303e 100755
--- a/Utilities/Scripts/update-libarchive.bash
+++ b/Utilities/Scripts/update-libarchive.bash
@@ -8,7 +8,7 @@ readonly name="LibArchive"
readonly ownership="LibArchive Upstream <libarchive-discuss@googlegroups.com>"
readonly subtree="Utilities/cmlibarchive"
readonly repo="https://github.com/libarchive/libarchive.git"
-readonly tag="v3.6.2"
+readonly tag="v3.7.2"
readonly shortlog=false
readonly paths="
CMakeLists.txt
diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt
index 694ba3c..4ffcdd7 100644
--- a/Utilities/Sphinx/CMakeLists.txt
+++ b/Utilities/Sphinx/CMakeLists.txt
@@ -3,7 +3,7 @@
if(NOT CMake_SOURCE_DIR)
set(CMakeHelp_STANDALONE 1)
- cmake_minimum_required(VERSION 3.13...3.26 FATAL_ERROR)
+ cmake_minimum_required(VERSION 3.13...3.27 FATAL_ERROR)
get_filename_component(tmp "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
get_filename_component(CMake_SOURCE_DIR "${tmp}" PATH)
include(${CMake_SOURCE_DIR}/Modules/CTestUseLaunchers.cmake)
diff --git a/Utilities/Sphinx/conf.py.in b/Utilities/Sphinx/conf.py.in
index f8651e1..20e1340 100644
--- a/Utilities/Sphinx/conf.py.in
+++ b/Utilities/Sphinx/conf.py.in
@@ -88,7 +88,11 @@ html_favicon = '@conf_path@/static/cmake-favicon.ico'
# qthelp_namespace = "org.cmake"
# qthelp_qch_name = "CMake.qch"
-linkcheck_ignore = [r'about:|https://gitlab.kitware.com/cmake/community/-/wikis/doc/cpack']
+linkcheck_ignore = [
+ r'about:',
+ r'https://gitlab\.kitware\.com/cmake/community/-/wikis/doc/cpack',
+ r'https://www.intel.com/',
+]
linkcheck_allowed_redirects = {
r'https://cdash\.org': r'https://www\.cdash\.org/',
diff --git a/Utilities/cmThirdPartyChecks.cmake b/Utilities/cmThirdPartyChecks.cmake
index 8f68777..311d58e 100644
--- a/Utilities/cmThirdPartyChecks.cmake
+++ b/Utilities/cmThirdPartyChecks.cmake
@@ -43,8 +43,8 @@ if(WIN32)
set(HAVE_CHROOT 0)
set(HAVE_COPYFILE_H 0)
set(HAVE_CRYPTO_H 0)
- set(HAVE__CTIME64_S 1)
set(HAVE_CTIME_R 0)
+ set(HAVE_CTIME_S 1)
set(HAVE_CYGWIN_CONV_PATH 0)
set(HAVE_DES_H 0)
set(HAVE_DIRECT_H 1)
@@ -64,6 +64,8 @@ if(WIN32)
set(HAVE_FCNTL_H 1)
set(HAVE_FCNTL_O_NONBLOCK 0)
set(HAVE_FDOPENDIR 0)
+ set(HAVE_FNMATCH 0)
+ set(HAVE_FNMATCH_H 0)
set(HAVE_FORK 0)
set(HAVE_FREEADDRINFO 1)
set(HAVE_FREEIFADDRS 0)
@@ -82,6 +84,7 @@ if(WIN32)
set(HAVE_GETGRGID_R 0)
set(HAVE_GETGRNAM_R 0)
set(HAVE_GETHOSTBYNAME 1)
+ set(HAVE_GETLINE 0)
set(HAVE_GETPAGESIZE 0)
set(HAVE_GETPEERNAME 1)
set(HAVE_GETPID 1)
@@ -94,8 +97,8 @@ if(WIN32)
set(HAVE_GETSOCKNAME 1)
set(HAVE_GETVFSBYNAME 0)
set(HAVE_GLIBC_STRERROR_R 0)
- set(HAVE__GMTIME64_S 1)
set(HAVE_GMTIME_R 0)
+ set(HAVE_GMTIME_S 1)
set(HAVE_GRP_H 0)
set(HAVE_IDN2_H 0)
set(HAVE_IFADDRS_H 0)
@@ -126,8 +129,8 @@ if(WIN32)
set(HAVE_LINUX_FS_H 0)
set(HAVE_LINUX_MAGIC_H 0)
set(HAVE_LINUX_TYPES_H 0)
- set(HAVE__LOCALTIME64_S 1)
set(HAVE_LOCALTIME_R 0)
+ set(HAVE_LOCALTIME_S 0)
set(HAVE_LSTAT 0)
set(HAVE_LUTIMES 0)
set(HAVE_MACH_ABSOLUTE_TIME 0)
@@ -136,7 +139,7 @@ if(WIN32)
set(HAVE_MEMORY_H 1)
set(HAVE_MKDIR 1)
set(HAVE_MKFIFO 0)
- set(HAVE__MKGMTIME64 1)
+ set(HAVE__MKGMTIME 1)
set(HAVE_MKNOD 0)
set(HAVE_MMAP 0)
set(HAVE_MSG_NOSIGNAL 0)
@@ -216,6 +219,7 @@ if(WIN32)
set(HAVE_SYS_MKDEV_H 0)
set(HAVE_SYS_MOUNT_H 0)
set(HAVE_SYS_POLL_H 0)
+ set(HAVE_SYS_QUEUE_H 0)
set(HAVE_SYS_RESOURCE_H 0)
set(HAVE_SYS_RICHACL_H 0)
set(HAVE_SYS_SELECT_H 0)
diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt
index 027de5c..1237608 100644
--- a/Utilities/cmlibarchive/CMakeLists.txt
+++ b/Utilities/cmlibarchive/CMakeLists.txt
@@ -69,6 +69,7 @@ SET(VERSION "${_major}.${_trimmed_minor}.${_trimmed_revision}
SET(BSDCPIO_VERSION_STRING "${VERSION}")
SET(BSDTAR_VERSION_STRING "${VERSION}")
SET(BSDCAT_VERSION_STRING "${VERSION}")
+SET(BSDUNZIP_VERSION_STRING "${VERSION}")
SET(LIBARCHIVE_VERSION_NUMBER "${_version_number}")
SET(LIBARCHIVE_VERSION_STRING "${VERSION}")
@@ -224,6 +225,8 @@ ENDIF()
# Enable CTest/CDash support
include(CTest)
+option(BUILD_SHARED_LIBS "Build shared libraries" ON)
+
OPTION(ENABLE_MBEDTLS "Enable use of mbed TLS" OFF)
OPTION(ENABLE_NETTLE "Enable use of Nettle" OFF)
OPTION(ENABLE_OPENSSL "Enable use of OpenSSL" ON)
@@ -248,6 +251,13 @@ OPTION(ENABLE_CPIO "Enable cpio building" ON)
OPTION(ENABLE_CPIO_SHARED "Enable dynamic build of cpio" FALSE)
OPTION(ENABLE_CAT "Enable cat building" ON)
OPTION(ENABLE_CAT_SHARED "Enable dynamic build of cat" FALSE)
+IF(WIN32 AND NOT CYGWIN)
+ SET(ENABLE_UNZIP FALSE)
+ SET(ENABLE_UNZIP_SHARED FALSE)
+ELSE()
+ OPTION(ENABLE_UNZIP "Enable unzip building" ON)
+ OPTION(ENABLE_UNZIP_SHARED "Enable dynamic build of unzip" FALSE)
+ENDIF()
OPTION(ENABLE_XATTR "Enable extended attribute support" ON)
OPTION(ENABLE_ACL "Enable ACL support" ON)
OPTION(ENABLE_ICONV "Enable iconv support" ON)
@@ -324,6 +334,7 @@ ENDIF()
IF(MINGW)
ADD_DEFINITIONS(-D__USE_MINGW_ANSI_STDIO)
+ ADD_DEFINITIONS(-D__MINGW_USE_VC2005_COMPAT)
ENDIF()
#
@@ -394,7 +405,11 @@ MACRO (TRY_MACRO_FOR_LIBRARY INCLUDES LIBRARIES
IF("${TRY_TYPE}" MATCHES "COMPILES")
CHECK_C_SOURCE_COMPILES("${SAMPLE_SOURCE}" ${VAR})
ELSEIF("${TRY_TYPE}" MATCHES "RUNS")
- CHECK_C_SOURCE_RUNS("${SAMPLE_SOURCE}" ${VAR})
+ IF(CMAKE_CROSSCOMPILING)
+ MESSAGE(WARNING "Cannot test run \"${VAR}\" when cross-compiling")
+ ELSE(CMAKE_CROSSCOMPILING)
+ CHECK_C_SOURCE_RUNS("${SAMPLE_SOURCE}" ${VAR})
+ ENDIF(CMAKE_CROSSCOMPILING)
ELSE("${TRY_TYPE}" MATCHES "COMPILES")
MESSAGE(FATAL_ERROR "UNKNOWN KEYWORD \"${TRY_TYPE}\" FOR TRY_TYPE")
ENDIF("${TRY_TYPE}" MATCHES "COMPILES")
@@ -533,15 +548,19 @@ IF(LIBLZMA_FOUND)
COMPILES
"#include <lzma.h>\nint main() {return (int)lzma_version_number(); }"
"WITHOUT_LZMA_API_STATIC;LZMA_API_STATIC")
+ CHECK_C_SOURCE_COMPILES(
+ "#include <lzma.h>\n#if LZMA_VERSION < 50020000\n#error unsupported\n#endif\nint main(void){lzma_stream_encoder_mt(0, 0); return 0;}"
+ HAVE_LZMA_STREAM_ENCODER_MT)
IF(NOT WITHOUT_LZMA_API_STATIC AND LZMA_API_STATIC)
ADD_DEFINITIONS(-DLZMA_API_STATIC)
- ENDIF(NOT WITHOUT_LZMA_API_STATIC AND LZMA_API_STATIC)
+ ENDIF()
ELSE()
ADD_DEFINITIONS(-DLZMA_API_STATIC)
ENDIF()
CMAKE_POP_CHECK_STATE()
ELSE(LIBLZMA_FOUND)
# LZMA not found and will not be used.
+ SET(HAVE_LZMA_STREAM_ENCODER_MT 0)
ENDIF(LIBLZMA_FOUND)
#
# Find LZO2
@@ -590,6 +609,7 @@ IF(LIBB2_FOUND)
SET(HAVE_BLAKE2_H 1)
SET(ARCHIVE_BLAKE2 FALSE)
LIST(APPEND ADDITIONAL_LIBS ${LIBB2_LIBRARY})
+ INCLUDE_DIRECTORIES(${LIBB2_INCLUDE_DIR})
CMAKE_PUSH_CHECK_STATE()
SET(CMAKE_REQUIRED_LIBRARIES ${LIBB2_LIBRARY})
SET(CMAKE_REQUIRED_INCLUDES ${LIBB2_INCLUDE_DIR})
@@ -708,6 +728,7 @@ CHECK_C_SOURCE_COMPILES("#include <sys/ioctl.h>
int main(void) { return EXT2_IOC_GETFLAGS; }" HAVE_WORKING_EXT2_IOC_GETFLAGS)
LA_CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H)
+LA_CHECK_INCLUDE_FILE("fnmatch.h" HAVE_FNMATCH_H)
LA_CHECK_INCLUDE_FILE("grp.h" HAVE_GRP_H)
LA_CHECK_INCLUDE_FILE("io.h" HAVE_IO_H)
LA_CHECK_INCLUDE_FILE("langinfo.h" HAVE_LANGINFO_H)
@@ -745,6 +766,7 @@ LA_CHECK_INCLUDE_FILE("sys/mkdev.h" HAVE_SYS_MKDEV_H)
LA_CHECK_INCLUDE_FILE("sys/mount.h" HAVE_SYS_MOUNT_H)
LA_CHECK_INCLUDE_FILE("sys/param.h" HAVE_SYS_PARAM_H)
LA_CHECK_INCLUDE_FILE("sys/poll.h" HAVE_SYS_POLL_H)
+LA_CHECK_INCLUDE_FILE("sys/queue.h" HAVE_SYS_QUEUE_H)
LA_CHECK_INCLUDE_FILE("sys/richacl.h" HAVE_SYS_RICHACL_H)
LA_CHECK_INCLUDE_FILE("sys/select.h" HAVE_SYS_SELECT_H)
LA_CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
@@ -764,9 +786,9 @@ LA_CHECK_INCLUDE_FILE("wchar.h" HAVE_WCHAR_H)
LA_CHECK_INCLUDE_FILE("wctype.h" HAVE_WCTYPE_H)
LA_CHECK_INCLUDE_FILE("windows.h" HAVE_WINDOWS_H)
IF(ENABLE_CNG)
- LA_CHECK_INCLUDE_FILE("Bcrypt.h" HAVE_BCRYPT_H)
+ LA_CHECK_INCLUDE_FILE("bcrypt.h" HAVE_BCRYPT_H)
IF(HAVE_BCRYPT_H)
- LIST(APPEND ADDITIONAL_LIBS "Bcrypt")
+ LIST(APPEND ADDITIONAL_LIBS "bcrypt")
ENDIF(HAVE_BCRYPT_H)
ELSE(ENABLE_CNG)
UNSET(HAVE_BCRYPT_H CACHE)
@@ -842,6 +864,10 @@ IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
IF(OPENSSL_FOUND)
SET(HAVE_LIBCRYPTO 1)
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
+ SET(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
+ SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
+ LA_CHECK_INCLUDE_FILE("openssl/evp.h" HAVE_OPENSSL_EVP_H)
+ CHECK_FUNCTION_EXISTS(PKCS5_PBKDF2_HMAC_SHA1 HAVE_PKCS5_PBKDF2_HMAC_SHA1)
ENDIF(OPENSSL_FOUND)
ELSE()
SET(OPENSSL_FOUND FALSE) # Override cached value
@@ -1379,6 +1405,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(fchmod HAVE_FCHMOD)
CHECK_FUNCTION_EXISTS_GLIBC(fchown HAVE_FCHOWN)
CHECK_FUNCTION_EXISTS_GLIBC(fcntl HAVE_FCNTL)
CHECK_FUNCTION_EXISTS_GLIBC(fdopendir HAVE_FDOPENDIR)
+CHECK_FUNCTION_EXISTS_GLIBC(fnmatch HAVE_FNMATCH)
CHECK_FUNCTION_EXISTS_GLIBC(fork HAVE_FORK)
CHECK_FUNCTION_EXISTS_GLIBC(fstat HAVE_FSTAT)
CHECK_FUNCTION_EXISTS_GLIBC(fstatat HAVE_FSTATAT)
@@ -1391,6 +1418,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(futimesat HAVE_FUTIMESAT)
CHECK_FUNCTION_EXISTS_GLIBC(geteuid HAVE_GETEUID)
CHECK_FUNCTION_EXISTS_GLIBC(getgrgid_r HAVE_GETGRGID_R)
CHECK_FUNCTION_EXISTS_GLIBC(getgrnam_r HAVE_GETGRNAM_R)
+CHECK_FUNCTION_EXISTS_GLIBC(getline HAVE_GETLINE)
CHECK_FUNCTION_EXISTS_GLIBC(getpwnam_r HAVE_GETPWNAM_R)
CHECK_FUNCTION_EXISTS_GLIBC(getpwuid_r HAVE_GETPWUID_R)
CHECK_FUNCTION_EXISTS_GLIBC(getpid HAVE_GETPID)
@@ -1443,12 +1471,12 @@ CHECK_FUNCTION_EXISTS_GLIBC(wcscmp HAVE_WCSCMP)
CHECK_FUNCTION_EXISTS_GLIBC(wcscpy HAVE_WCSCPY)
CHECK_FUNCTION_EXISTS_GLIBC(wcslen HAVE_WCSLEN)
CHECK_FUNCTION_EXISTS_GLIBC(wctomb HAVE_WCTOMB)
-CHECK_FUNCTION_EXISTS_GLIBC(_ctime64_s HAVE__CTIME64_S)
CHECK_FUNCTION_EXISTS_GLIBC(_fseeki64 HAVE__FSEEKI64)
CHECK_FUNCTION_EXISTS_GLIBC(_get_timezone HAVE__GET_TIMEZONE)
-CHECK_FUNCTION_EXISTS_GLIBC(_gmtime64_s HAVE__GMTIME64_S)
-CHECK_FUNCTION_EXISTS_GLIBC(_localtime64_s HAVE__LOCALTIME64_S)
-CHECK_FUNCTION_EXISTS_GLIBC(_mkgmtime64 HAVE__MKGMTIME64)
+CHECK_SYMBOL_EXISTS(ctime_s "time.h" HAVE_CTIME_S)
+CHECK_SYMBOL_EXISTS(gmtime_s "time.h" HAVE_GMTIME_S)
+CHECK_SYMBOL_EXISTS(localtime_s "time.h" HAVE_LOCALTIME_S)
+CHECK_SYMBOL_EXISTS(_mkgmtime "time.h" HAVE__MKGMTIME)
SET(CMAKE_REQUIRED_LIBRARIES "")
CHECK_FUNCTION_EXISTS(cygwin_conv_path HAVE_CYGWIN_CONV_PATH)
@@ -1491,7 +1519,6 @@ CHECK_C_SOURCE_COMPILES(
"#include <fcntl.h>\n#include <unistd.h>\nint main() {char buf[10]; return readlinkat(AT_FDCWD, \"\", buf, 0);}"
HAVE_READLINKAT)
-
# To verify major(), we need to both include the header
# of interest and verify that the result can be linked.
# CHECK_FUNCTION_EXISTS doesn't accept a header argument,
@@ -1503,20 +1530,6 @@ CHECK_C_SOURCE_COMPILES(
"#include <sys/sysmacros.h>\nint main() { return major(256); }"
MAJOR_IN_SYSMACROS)
-IF(ENABLE_LZMA)
-CMAKE_PUSH_CHECK_STATE()
-SET(CMAKE_REQUIRED_LIBRARIES ${LIBLZMA_LIBRARIES})
-SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIR})
-
-CHECK_C_SOURCE_COMPILES(
- "#include <lzma.h>\n#if LZMA_VERSION < 50020000\n#error unsupported\n#endif\nint main(void){lzma_stream_encoder_mt(0, 0); return 0;}"
- HAVE_LZMA_STREAM_ENCODER_MT)
-
-CMAKE_POP_CHECK_STATE()
-ELSE()
- SET(HAVE_LZMA_STREAM_ENCODER_MT 0)
-ENDIF(ENABLE_LZMA)
-
IF(HAVE_STRERROR_R)
SET(HAVE_DECL_STRERROR_R 1)
ENDIF(HAVE_STRERROR_R)
@@ -1578,7 +1591,7 @@ ENDIF()
#
#
CHECK_STRUCT_HAS_MEMBER("struct tm" tm_sec
- "sys/types.h;sys/time.h;time.h" TIME_WITH_SYS_TIME)
+ "sys/types.h;sys/time.h;time.h" HAVE_SYS_TIME_H)
CHECK_TYPE_SIZE(dev_t DEV_T)
IF(NOT HAVE_DEV_T)
@@ -2076,6 +2089,7 @@ IF(0) # CMake does not build libarchive's command-line tools.
add_subdirectory(cat)
add_subdirectory(tar)
add_subdirectory(cpio)
+add_subdirectory(unzip)
ENDIF()
install(FILES COPYING DESTINATION ${CMAKE_DOC_DIR}/cmlibarchive)
diff --git a/Utilities/cmlibarchive/build/cmake/FindMbedTLS.cmake b/Utilities/cmlibarchive/build/cmake/FindMbedTLS.cmake
index a916395..aa40485 100644
--- a/Utilities/cmlibarchive/build/cmake/FindMbedTLS.cmake
+++ b/Utilities/cmlibarchive/build/cmake/FindMbedTLS.cmake
@@ -7,7 +7,7 @@ find_library(MBEDCRYPTO_LIBRARY mbedcrypto)
set(MBEDTLS_LIBRARIES "${MBEDTLS_LIBRARY}" "${MBEDX509_LIBRARY}" "${MBEDCRYPTO_LIBRARY}")
include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(MBEDTLS DEFAULT_MSG
+find_package_handle_standard_args(MbedTLS DEFAULT_MSG
MBEDTLS_INCLUDE_DIRS MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)
mark_as_advanced(MBEDTLS_INCLUDE_DIRS MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)
diff --git a/Utilities/cmlibarchive/build/cmake/config.h.in b/Utilities/cmlibarchive/build/cmake/config.h.in
index e44a514..493c388 100644
--- a/Utilities/cmlibarchive/build/cmake/config.h.in
+++ b/Utilities/cmlibarchive/build/cmake/config.h.in
@@ -38,6 +38,9 @@
/* MD5 via ARCHIVE_CRYPTO_MD5_LIBSYSTEM supported. */
#cmakedefine ARCHIVE_CRYPTO_MD5_LIBSYSTEM 1
+/* MD5 via ARCHIVE_CRYPTO_MD5_MBEDTLS supported. */
+#cmakedefine ARCHIVE_CRYPTO_MD5_MBEDTLS 1
+
/* MD5 via ARCHIVE_CRYPTO_MD5_NETTLE supported. */
#cmakedefine ARCHIVE_CRYPTO_MD5_NETTLE 1
@@ -53,6 +56,9 @@
/* RMD160 via ARCHIVE_CRYPTO_RMD160_NETTLE supported. */
#cmakedefine ARCHIVE_CRYPTO_RMD160_NETTLE 1
+/* RMD160 via ARCHIVE_CRYPTO_RMD160_MBEDTLS supported. */
+#cmakedefine ARCHIVE_CRYPTO_RMD160_MBEDTLS 1
+
/* RMD160 via ARCHIVE_CRYPTO_RMD160_OPENSSL supported. */
#cmakedefine ARCHIVE_CRYPTO_RMD160_OPENSSL 1
@@ -62,6 +68,9 @@
/* SHA1 via ARCHIVE_CRYPTO_SHA1_LIBSYSTEM supported. */
#cmakedefine ARCHIVE_CRYPTO_SHA1_LIBSYSTEM 1
+/* SHA1 via ARCHIVE_CRYPTO_SHA1_MBEDTLS supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA1_MBEDTLS 1
+
/* SHA1 via ARCHIVE_CRYPTO_SHA1_NETTLE supported. */
#cmakedefine ARCHIVE_CRYPTO_SHA1_NETTLE 1
@@ -83,6 +92,9 @@
/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBSYSTEM supported. */
#cmakedefine ARCHIVE_CRYPTO_SHA256_LIBSYSTEM 1
+/* SHA256 via ARCHIVE_CRYPTO_SHA256_MBEDTLS supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA256_MBEDTLS 1
+
/* SHA256 via ARCHIVE_CRYPTO_SHA256_NETTLE supported. */
#cmakedefine ARCHIVE_CRYPTO_SHA256_NETTLE 1
@@ -104,6 +116,9 @@
/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBSYSTEM supported. */
#cmakedefine ARCHIVE_CRYPTO_SHA384_LIBSYSTEM 1
+/* SHA384 via ARCHIVE_CRYPTO_SHA384_MBEDTLS supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA384_MBEDTLS 1
+
/* SHA384 via ARCHIVE_CRYPTO_SHA384_NETTLE supported. */
#cmakedefine ARCHIVE_CRYPTO_SHA384_NETTLE 1
@@ -125,6 +140,9 @@
/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBSYSTEM supported. */
#cmakedefine ARCHIVE_CRYPTO_SHA512_LIBSYSTEM 1
+/* SHA512 via ARCHIVE_CRYPTO_SHA512_MBEDTLS supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA512_MBEDTLS 1
+
/* SHA512 via ARCHIVE_CRYPTO_SHA512_NETTLE supported. */
#cmakedefine ARCHIVE_CRYPTO_SHA512_NETTLE 1
@@ -155,6 +173,9 @@
/* Version number of bsdcat */
#cmakedefine BSDCAT_VERSION_STRING "@BSDCAT_VERSION_STRING@"
+/* Version number of bsdunzip */
+#cmakedefine BSDUNZIP_VERSION_STRING "@BSDUNZIP_VERSION_STRING@"
+
/* Define to 1 if you have the `acl_create_entry' function. */
#cmakedefine HAVE_ACL_CREATE_ENTRY 1
@@ -197,7 +218,7 @@
/* Define to 1 if you have the <attr/xattr.h> header file. */
#cmakedefine HAVE_ATTR_XATTR_H 1
-/* Define to 1 if you have the <Bcrypt.h> header file. */
+/* Define to 1 if you have the <bcrypt.h> header file. */
#cmakedefine HAVE_BCRYPT_H 1
/* Define to 1 if you have the <bsdxml.h> header file. */
@@ -357,6 +378,12 @@
/* Define to 1 if you have the `flistxattr' function. */
#cmakedefine HAVE_FLISTXATTR 1
+/* Define to 1 if you have the `fnmatch' function. */
+#cmakedefine HAVE_FNMATCH 1
+
+/* Define to 1 if you have the <fnmatch.h> header file. */
+#cmakedefine HAVE_FNMATCH_H 1
+
/* Define to 1 if you have the `fork' function. */
#cmakedefine HAVE_FORK 1
@@ -405,6 +432,9 @@
/* Define to 1 if you have the `getgrnam_r' function. */
#cmakedefine HAVE_GETGRNAM_R 1
+/* Define to 1 if you have the `getline' function. */
+#cmakedefine HAVE_GETLINE 1
+
/* Define to 1 if you have the `getpid' function. */
#cmakedefine HAVE_GETPID 1
@@ -611,6 +641,15 @@
/* Define to 1 if you have the <lzo/lzoconf.h> header file. */
#cmakedefine HAVE_LZO_LZOCONF_H 1
+/* Define to 1 if you have the <mbedtls/aes.h> header file. */
+#cmakedefine HAVE_MBEDTLS_AES_H 1
+
+/* Define to 1 if you have the <mbedtls/md.h> header file. */
+#cmakedefine HAVE_MBEDTLS_MD_H 1
+
+/* Define to 1 if you have the <mbedtls/pkcs5.h> header file. */
+#cmakedefine HAVE_MBEDTLS_PKCS5_H 1
+
/* Define to 1 if you have the `mbrtowc' function. */
#cmakedefine HAVE_MBRTOWC 1
@@ -662,6 +701,9 @@
/* Define to 1 if you have the `openat' function. */
#cmakedefine HAVE_OPENAT 1
+/* Define to 1 if you have the <openssl/evp.h> header file. */
+#cmakedefine HAVE_OPENSSL_EVP_H 1
+
/* Define to 1 if you have the <paths.h> header file. */
#cmakedefine HAVE_PATHS_H 1
@@ -771,6 +813,12 @@
/* Define to 1 if you have the `strrchr' function. */
#cmakedefine HAVE_STRRCHR 1
+/* Define to 1 if the system has the type `struct statfs'. */
+#cmakedefine HAVE_STRUCT_STATFS 1
+
+/* Define to 1 if `f_iosize' is a member of `struct statfs'. */
+#cmakedefine HAVE_STRUCT_STATFS_F_IOSIZE 1
+
/* Define to 1 if `f_namemax' is a member of `struct statfs'. */
#cmakedefine HAVE_STRUCT_STATFS_F_NAMEMAX 1
@@ -854,6 +902,9 @@
/* Define to 1 if you have the <sys/poll.h> header file. */
#cmakedefine HAVE_SYS_POLL_H 1
+/* Define to 1 if you have the <sys/queue.h> header file. */
+#cmakedefine HAVE_SYS_QUEUE_H 1
+
/* Define to 1 if you have the <sys/richacl.h> header file. */
#cmakedefine HAVE_SYS_RICHACL_H 1
@@ -993,8 +1044,8 @@
/* Define to 1 if you have the <zstd.h> header file. */
#cmakedefine HAVE_ZSTD_H 1
-/* Define to 1 if you have the `_ctime64_s' function. */
-#cmakedefine HAVE__CTIME64_S 1
+/* Define to 1 if you have the `ctime_s' function. */
+#cmakedefine HAVE_CTIME_S 1
/* Define to 1 if you have the `_fseeki64' function. */
#cmakedefine HAVE__FSEEKI64 1
@@ -1002,14 +1053,14 @@
/* Define to 1 if you have the `_get_timezone' function. */
#cmakedefine HAVE__GET_TIMEZONE 1
-/* Define to 1 if you have the `_gmtime64_s' function. */
-#cmakedefine HAVE__GMTIME64_S 1
+/* Define to 1 if you have the `gmtime_s' function. */
+#cmakedefine HAVE_GMTIME_S 1
-/* Define to 1 if you have the `_localtime64_s' function. */
-#cmakedefine HAVE__LOCALTIME64_S 1
+/* Define to 1 if you have the `localtime_s' function. */
+#cmakedefine HAVE_LOCALTIME_S 1
-/* Define to 1 if you have the `_mkgmtime64' function. */
-#cmakedefine HAVE__MKGMTIME64 1
+/* Define to 1 if you have the `_mkgmtime' function. */
+#cmakedefine HAVE__MKGMTIME 1
/* Define as const if the declaration of iconv() needs const. */
#define ICONV_CONST @ICONV_CONST@
diff --git a/Utilities/cmlibarchive/build/version b/Utilities/cmlibarchive/build/version
index 1af1bec..414ae6d 100644
--- a/Utilities/cmlibarchive/build/version
+++ b/Utilities/cmlibarchive/build/version
@@ -1 +1 @@
-3006002
+3007002
diff --git a/Utilities/cmlibarchive/libarchive/CMakeLists.txt b/Utilities/cmlibarchive/libarchive/CMakeLists.txt
index e820853..ac0bd2c 100644
--- a/Utilities/cmlibarchive/libarchive/CMakeLists.txt
+++ b/Utilities/cmlibarchive/libarchive/CMakeLists.txt
@@ -252,10 +252,12 @@ endif()
IF(0) # CMake does not build libarchive's full package.
# Libarchive is a shared library
-ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS})
-TARGET_INCLUDE_DIRECTORIES(archive PUBLIC .)
-TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS})
-SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION})
+IF(BUILD_SHARED_LIBS)
+ ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS})
+ TARGET_INCLUDE_DIRECTORIES(archive PUBLIC .)
+ TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS})
+ SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION})
+ENDIF(BUILD_SHARED_LIBS)
# archive_static is a static library
ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS})
@@ -263,13 +265,19 @@ TARGET_LINK_LIBRARIES(archive_static ${ADDITIONAL_LIBS})
SET_TARGET_PROPERTIES(archive_static PROPERTIES COMPILE_DEFINITIONS
LIBARCHIVE_STATIC)
# On Posix systems, libarchive.so and libarchive.a can co-exist.
-IF(NOT WIN32 OR CYGWIN)
+IF(NOT WIN32 OR CYGWIN OR NOT BUILD_SHARED_LIBS)
SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive)
-ENDIF(NOT WIN32 OR CYGWIN)
+ENDIF(NOT WIN32 OR CYGWIN OR NOT BUILD_SHARED_LIBS)
IF(ENABLE_INSTALL)
# How to install the libraries
- INSTALL(TARGETS archive archive_static
+ IF(BUILD_SHARED_LIBS)
+ INSTALL(TARGETS archive
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
+ ENDIF(BUILD_SHARED_LIBS)
+ INSTALL(TARGETS archive_static
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
diff --git a/Utilities/cmlibarchive/libarchive/archive.h b/Utilities/cmlibarchive/libarchive/archive.h
index 180f3e4..a89f33b 100644
--- a/Utilities/cmlibarchive/libarchive/archive.h
+++ b/Utilities/cmlibarchive/libarchive/archive.h
@@ -36,7 +36,7 @@
* assert that ARCHIVE_VERSION_NUMBER >= 2012108.
*/
/* Note: Compiler will complain if this does not match archive_entry.h! */
-#define ARCHIVE_VERSION_NUMBER 3006002
+#define ARCHIVE_VERSION_NUMBER 3007002
#include <sys/stat.h>
#include <stddef.h> /* for wchar_t */
@@ -154,7 +154,7 @@ __LA_DECL int archive_version_number(void);
/*
* Textual name/version of the library, useful for version displays.
*/
-#define ARCHIVE_VERSION_ONLY_STRING "3.6.2"
+#define ARCHIVE_VERSION_ONLY_STRING "3.7.2"
#define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
__LA_DECL const char * archive_version_string(void);
diff --git a/Utilities/cmlibarchive/libarchive/archive_digest.c b/Utilities/cmlibarchive/libarchive/archive_digest.c
index 3361b19..3776831 100644
--- a/Utilities/cmlibarchive/libarchive/archive_digest.c
+++ b/Utilities/cmlibarchive/libarchive/archive_digest.c
@@ -36,6 +36,11 @@
#error Cannot use both OpenSSL and libmd.
#endif
+/* Common in other bcrypt implementations, but missing from VS2008. */
+#ifndef BCRYPT_SUCCESS
+#define BCRYPT_SUCCESS(r) ((NTSTATUS)(r) == STATUS_SUCCESS)
+#endif
+
/*
* Message digest functions for Windows platform.
*/
@@ -48,6 +53,26 @@
/*
* Initialize a Message digest.
*/
+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+static int
+win_crypto_init(Digest_CTX *ctx, const WCHAR *algo)
+{
+ NTSTATUS status;
+ ctx->valid = 0;
+
+ status = BCryptOpenAlgorithmProvider(&ctx->hAlg, algo, NULL, 0);
+ if (!BCRYPT_SUCCESS(status))
+ return (ARCHIVE_FAILED);
+ status = BCryptCreateHash(ctx->hAlg, &ctx->hHash, NULL, 0, NULL, 0, 0);
+ if (!BCRYPT_SUCCESS(status)) {
+ BCryptCloseAlgorithmProvider(ctx->hAlg, 0);
+ return (ARCHIVE_FAILED);
+ }
+
+ ctx->valid = 1;
+ return (ARCHIVE_OK);
+}
+#else
static int
win_crypto_init(Digest_CTX *ctx, DWORD prov, ALG_ID algId)
{
@@ -70,6 +95,7 @@ win_crypto_init(Digest_CTX *ctx, DWORD prov, ALG_ID algId)
ctx->valid = 1;
return (ARCHIVE_OK);
}
+#endif
/*
* Update a Message digest.
@@ -81,23 +107,37 @@ win_crypto_Update(Digest_CTX *ctx, const unsigned char *buf, size_t len)
if (!ctx->valid)
return (ARCHIVE_FAILED);
+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+ BCryptHashData(ctx->hHash,
+ (PUCHAR)(uintptr_t)buf,
+ (ULONG)len, 0);
+#else
CryptHashData(ctx->hash,
(unsigned char *)(uintptr_t)buf,
(DWORD)len, 0);
+#endif
return (ARCHIVE_OK);
}
static int
win_crypto_Final(unsigned char *buf, size_t bufsize, Digest_CTX *ctx)
{
+#if !(defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA)
DWORD siglen = (DWORD)bufsize;
+#endif
if (!ctx->valid)
return (ARCHIVE_FAILED);
+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+ BCryptFinishHash(ctx->hHash, buf, (ULONG)bufsize, 0);
+ BCryptDestroyHash(ctx->hHash);
+ BCryptCloseAlgorithmProvider(ctx->hAlg, 0);
+#else
CryptGetHashParam(ctx->hash, HP_HASHVAL, buf, &siglen, 0);
CryptDestroyHash(ctx->hash);
CryptReleaseContext(ctx->cryptProv, 0);
+#endif
ctx->valid = 0;
return (ARCHIVE_OK);
}
@@ -276,7 +316,11 @@ __archive_md5final(archive_md5_ctx *ctx, void *md)
static int
__archive_md5init(archive_md5_ctx *ctx)
{
+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+ return (win_crypto_init(ctx, BCRYPT_MD5_ALGORITHM));
+#else
return (win_crypto_init(ctx, PROV_RSA_FULL, CALG_MD5));
+#endif
}
static int
@@ -659,7 +703,11 @@ __archive_sha1final(archive_sha1_ctx *ctx, void *md)
static int
__archive_sha1init(archive_sha1_ctx *ctx)
{
+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+ return (win_crypto_init(ctx, BCRYPT_SHA1_ALGORITHM));
+#else
return (win_crypto_init(ctx, PROV_RSA_FULL, CALG_SHA1));
+#endif
}
static int
@@ -919,7 +967,11 @@ __archive_sha256final(archive_sha256_ctx *ctx, void *md)
static int
__archive_sha256init(archive_sha256_ctx *ctx)
{
+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+ return (win_crypto_init(ctx, BCRYPT_SHA256_ALGORITHM));
+#else
return (win_crypto_init(ctx, PROV_RSA_AES, CALG_SHA_256));
+#endif
}
static int
@@ -1155,7 +1207,11 @@ __archive_sha384final(archive_sha384_ctx *ctx, void *md)
static int
__archive_sha384init(archive_sha384_ctx *ctx)
{
+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+ return (win_crypto_init(ctx, BCRYPT_SHA384_ALGORITHM));
+#else
return (win_crypto_init(ctx, PROV_RSA_AES, CALG_SHA_384));
+#endif
}
static int
@@ -1415,7 +1471,11 @@ __archive_sha512final(archive_sha512_ctx *ctx, void *md)
static int
__archive_sha512init(archive_sha512_ctx *ctx)
{
+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+ return (win_crypto_init(ctx, BCRYPT_SHA512_ALGORITHM));
+#else
return (win_crypto_init(ctx, PROV_RSA_AES, CALG_SHA_512));
+#endif
}
static int
diff --git a/Utilities/cmlibarchive/libarchive/archive_digest_private.h b/Utilities/cmlibarchive/libarchive/archive_digest_private.h
index 9b3bd66..339b4ed 100644
--- a/Utilities/cmlibarchive/libarchive/archive_digest_private.h
+++ b/Utilities/cmlibarchive/libarchive/archive_digest_private.h
@@ -164,6 +164,15 @@
defined(ARCHIVE_CRYPTO_SHA256_WIN) ||\
defined(ARCHIVE_CRYPTO_SHA384_WIN) ||\
defined(ARCHIVE_CRYPTO_SHA512_WIN)
+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+/* don't use bcrypt when XP needs to be supported */
+#include <bcrypt.h>
+typedef struct {
+ int valid;
+ BCRYPT_ALG_HANDLE hAlg;
+ BCRYPT_HASH_HANDLE hHash;
+} Digest_CTX;
+#else
#include <windows.h>
#include <wincrypt.h>
typedef struct {
@@ -172,6 +181,7 @@ typedef struct {
HCRYPTHASH hash;
} Digest_CTX;
#endif
+#endif
/* typedefs */
#if defined(ARCHIVE_CRYPTO_MD5_LIBC)
diff --git a/Utilities/cmlibarchive/libarchive/archive_entry.h b/Utilities/cmlibarchive/libarchive/archive_entry.h
index 91ef0c9..0e4ccbb 100644
--- a/Utilities/cmlibarchive/libarchive/archive_entry.h
+++ b/Utilities/cmlibarchive/libarchive/archive_entry.h
@@ -30,7 +30,7 @@
#define ARCHIVE_ENTRY_H_INCLUDED
/* Note: Compiler will complain if this does not match archive.h! */
-#define ARCHIVE_VERSION_NUMBER 3006002
+#define ARCHIVE_VERSION_NUMBER 3007002
/*
* Note: archive_entry.h is for use outside of libarchive; the
diff --git a/Utilities/cmlibarchive/libarchive/archive_getdate.c b/Utilities/cmlibarchive/libarchive/archive_getdate.c
index 5b0b775..fc9516e 100644
--- a/Utilities/cmlibarchive/libarchive/archive_getdate.c
+++ b/Utilities/cmlibarchive/libarchive/archive_getdate.c
@@ -700,13 +700,9 @@ Convert(time_t Month, time_t Day, time_t Year,
time_t Julian;
int i;
struct tm *ltime;
-#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
struct tm tmbuf;
#endif
-#if defined(HAVE__LOCALTIME64_S)
- errno_t terr;
- __time64_t tmptime;
-#endif
if (Year < 69)
Year += 2000;
@@ -733,15 +729,10 @@ Convert(time_t Month, time_t Day, time_t Year,
Julian *= DAY;
Julian += Timezone;
Julian += Hours * HOUR + Minutes * MINUTE + Seconds;
-#if defined(HAVE_LOCALTIME_R)
+#if defined(HAVE_LOCALTIME_S)
+ ltime = localtime_s(&tmbuf, &Julian) ? NULL : &tmbuf;
+#elif defined(HAVE_LOCALTIME_R)
ltime = localtime_r(&Julian, &tmbuf);
-#elif defined(HAVE__LOCALTIME64_S)
- tmptime = Julian;
- terr = _localtime64_s(&tmbuf, &tmptime);
- if (terr)
- ltime = NULL;
- else
- ltime = &tmbuf;
#else
ltime = localtime(&Julian);
#endif
@@ -757,36 +748,21 @@ DSTcorrect(time_t Start, time_t Future)
time_t StartDay;
time_t FutureDay;
struct tm *ltime;
-#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
struct tm tmbuf;
#endif
-#if defined(HAVE__LOCALTIME64_S)
- errno_t terr;
- __time64_t tmptime;
-#endif
-
-#if defined(HAVE_LOCALTIME_R)
+#if defined(HAVE_LOCALTIME_S)
+ ltime = localtime_s(&tmbuf, &Start) ? NULL : &tmbuf;
+#elif defined(HAVE_LOCALTIME_R)
ltime = localtime_r(&Start, &tmbuf);
-#elif defined(HAVE__LOCALTIME64_S)
- tmptime = Start;
- terr = _localtime64_s(&tmbuf, &tmptime);
- if (terr)
- ltime = NULL;
- else
- ltime = &tmbuf;
#else
ltime = localtime(&Start);
#endif
StartDay = (ltime->tm_hour + 1) % 24;
-#if defined(HAVE_LOCALTIME_R)
+#if defined(HAVE_LOCALTIME_S)
+ ltime = localtime_s(&tmbuf, &Future) ? NULL : &tmbuf;
+#elif defined(HAVE_LOCALTIME_R)
ltime = localtime_r(&Future, &tmbuf);
-#elif defined(HAVE__LOCALTIME64_S)
- tmptime = Future;
- terr = _localtime64_s(&tmbuf, &tmptime);
- if (terr)
- ltime = NULL;
- else
- ltime = &tmbuf;
#else
ltime = localtime(&Future);
#endif
@@ -801,24 +777,15 @@ RelativeDate(time_t Start, time_t zone, int dstmode,
{
struct tm *tm;
time_t t, now;
-#if defined(HAVE_GMTIME_R) || defined(HAVE__GMTIME64_S)
+#if defined(HAVE_GMTIME_R) || defined(HAVE_GMTIME_S)
struct tm tmbuf;
#endif
-#if defined(HAVE__GMTIME64_S)
- errno_t terr;
- __time64_t tmptime;
-#endif
t = Start - zone;
-#if defined(HAVE_GMTIME_R)
+#if defined(HAVE_GMTIME_S)
+ tm = gmtime_s(&tmbuf, &t) ? NULL : &tmbuf;
+#elif defined(HAVE_GMTIME_R)
tm = gmtime_r(&t, &tmbuf);
-#elif defined(HAVE__GMTIME64_S)
- tmptime = t;
- terr = _gmtime64_s(&tmbuf, &tmptime);
- if (terr)
- tm = NULL;
- else
- tm = &tmbuf;
#else
tm = gmtime(&t);
#endif
@@ -837,25 +804,16 @@ RelativeMonth(time_t Start, time_t Timezone, time_t RelMonth)
struct tm *tm;
time_t Month;
time_t Year;
-#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
struct tm tmbuf;
#endif
-#if defined(HAVE__LOCALTIME64_S)
- errno_t terr;
- __time64_t tmptime;
-#endif
if (RelMonth == 0)
return 0;
-#if defined(HAVE_LOCALTIME_R)
+#if defined(HAVE_LOCALTIME_S)
+ tm = localtime_s(&tmbuf, &Start) ? NULL : &tmbuf;
+#elif defined(HAVE_LOCALTIME_R)
tm = localtime_r(&Start, &tmbuf);
-#elif defined(HAVE__LOCALTIME64_S)
- tmptime = Start;
- terr = _localtime64_s(&tmbuf, &tmptime);
- if (terr)
- tm = NULL;
- else
- tm = &tmbuf;
#else
tm = localtime(&Start);
#endif
@@ -995,10 +953,6 @@ __archive_get_date(time_t now, const char *p)
time_t Start;
time_t tod;
long tzone;
-#if defined(HAVE__LOCALTIME64_S) || defined(HAVE__GMTIME64_S)
- errno_t terr;
- __time64_t tmptime;
-#endif
/* Clear out the parsed token array. */
memset(tokens, 0, sizeof(tokens));
@@ -1007,36 +961,26 @@ __archive_get_date(time_t now, const char *p)
gds = &_gds;
/* Look up the current time. */
-#if defined(HAVE_LOCALTIME_R)
+#if defined(HAVE_LOCALTIME_S)
+ tm = localtime_s(&local, &now) ? NULL : &local;
+#elif defined(HAVE_LOCALTIME_R)
tm = localtime_r(&now, &local);
-#elif defined(HAVE__LOCALTIME64_S)
- tmptime = now;
- terr = _localtime64_s(&local, &tmptime);
- if (terr)
- tm = NULL;
- else
- tm = &local;
#else
memset(&local, 0, sizeof(local));
tm = localtime(&now);
#endif
if (tm == NULL)
return -1;
-#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE__LOCALTIME64_S)
+#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S)
local = *tm;
#endif
/* Look up UTC if we can and use that to determine the current
* timezone offset. */
-#if defined(HAVE_GMTIME_R)
+#if defined(HAVE_GMTIME_S)
+ gmt_ptr = gmtime_s(&gmt, &now) ? NULL : &gmt;
+#elif defined(HAVE_GMTIME_R)
gmt_ptr = gmtime_r(&now, &gmt);
-#elif defined(HAVE__GMTIME64_S)
- tmptime = now;
- terr = _gmtime64_s(&gmt, &tmptime);
- if (terr)
- gmt_ptr = NULL;
- else
- gmt_ptr = &gmt;
#else
memset(&gmt, 0, sizeof(gmt));
gmt_ptr = gmtime(&now);
@@ -1078,15 +1022,10 @@ __archive_get_date(time_t now, const char *p)
* time components instead of the local timezone. */
if (gds->HaveZone && gmt_ptr != NULL) {
now -= gds->Timezone;
-#if defined(HAVE_GMTIME_R)
+#if defined(HAVE_GMTIME_S)
+ gmt_ptr = gmtime_s(&gmt, &now) ? NULL : &gmt;
+#elif defined(HAVE_GMTIME_R)
gmt_ptr = gmtime_r(&now, &gmt);
-#elif defined(HAVE__GMTIME64_S)
- tmptime = now;
- terr = _gmtime64_s(&gmt, &tmptime);
- if (terr)
- gmt_ptr = NULL;
- else
- gmt_ptr = &gmt;
#else
gmt_ptr = gmtime(&now);
#endif
diff --git a/Utilities/cmlibarchive/libarchive/archive_hmac.c b/Utilities/cmlibarchive/libarchive/archive_hmac.c
index 012fe15..edb3bf5 100644
--- a/Utilities/cmlibarchive/libarchive/archive_hmac.c
+++ b/Utilities/cmlibarchive/libarchive/archive_hmac.c
@@ -231,15 +231,20 @@ static int
__hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len)
{
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
- OSSL_PARAM params[2];
+ EVP_MAC *mac;
- EVP_MAC *mac = EVP_MAC_fetch(NULL, "HMAC", NULL);
+ char sha1[] = "SHA1";
+ OSSL_PARAM params[] = {
+ OSSL_PARAM_utf8_string("digest", sha1, sizeof(sha1) - 1),
+ OSSL_PARAM_END
+ };
+
+ mac = EVP_MAC_fetch(NULL, "HMAC", NULL);
*ctx = EVP_MAC_CTX_new(mac);
+ EVP_MAC_free(mac);
if (*ctx == NULL)
return -1;
- EVP_MAC_free(mac);
- params[0] = OSSL_PARAM_construct_utf8_string("digest", "SHA1", 0);
- params[1] = OSSL_PARAM_construct_end();
+
EVP_MAC_init(*ctx, key, key_len, params);
#else
*ctx = HMAC_CTX_new();
diff --git a/Utilities/cmlibarchive/libarchive/archive_hmac_private.h b/Utilities/cmlibarchive/libarchive/archive_hmac_private.h
index 50044a0..d0fda7f 100644
--- a/Utilities/cmlibarchive/libarchive/archive_hmac_private.h
+++ b/Utilities/cmlibarchive/libarchive/archive_hmac_private.h
@@ -77,6 +77,8 @@ typedef struct hmac_sha1_ctx archive_hmac_sha1_ctx;
#include <openssl/opensslv.h>
#include <openssl/hmac.h>
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+#include <openssl/params.h>
+
typedef EVP_MAC_CTX *archive_hmac_sha1_ctx;
#else
diff --git a/Utilities/cmlibarchive/libarchive/archive_openssl_evp_private.h b/Utilities/cmlibarchive/libarchive/archive_openssl_evp_private.h
index ebb0670..8ac4772 100644
--- a/Utilities/cmlibarchive/libarchive/archive_openssl_evp_private.h
+++ b/Utilities/cmlibarchive/libarchive/archive_openssl_evp_private.h
@@ -33,7 +33,8 @@
#include <openssl/evp.h>
#include <openssl/opensslv.h>
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
+ (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL)
#include <stdlib.h> /* malloc, free */
#include <string.h> /* memset */
static inline EVP_MD_CTX *EVP_MD_CTX_new(void)
diff --git a/Utilities/cmlibarchive/libarchive/archive_random.c b/Utilities/cmlibarchive/libarchive/archive_random.c
index 9d1aa49..a410dc0 100644
--- a/Utilities/cmlibarchive/libarchive/archive_random.c
+++ b/Utilities/cmlibarchive/libarchive/archive_random.c
@@ -51,16 +51,27 @@ __FBSDID("$FreeBSD$");
#include <pthread.h>
#endif
-static void arc4random_buf(void *, size_t);
+static void la_arc4random_buf(void *, size_t);
#endif /* HAVE_ARC4RANDOM_BUF */
#include "archive.h"
#include "archive_random_private.h"
-#if defined(HAVE_WINCRYPT_H) && !defined(__CYGWIN__)
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+/* don't use bcrypt when XP needs to be supported */
+#include <bcrypt.h>
+
+/* Common in other bcrypt implementations, but missing from VS2008. */
+#ifndef BCRYPT_SUCCESS
+#define BCRYPT_SUCCESS(r) ((NTSTATUS)(r) == STATUS_SUCCESS)
+#endif
+
+#elif defined(HAVE_WINCRYPT_H)
#include <wincrypt.h>
#endif
+#endif
#ifndef O_CLOEXEC
#define O_CLOEXEC 0
@@ -75,6 +86,20 @@ int
archive_random(void *buf, size_t nbytes)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
+# if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+ NTSTATUS status;
+ BCRYPT_ALG_HANDLE hAlg;
+
+ status = BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_RNG_ALGORITHM, NULL, 0);
+ if (!BCRYPT_SUCCESS(status))
+ return ARCHIVE_FAILED;
+ status = BCryptGenRandom(hAlg, buf, (ULONG)nbytes, 0);
+ BCryptCloseAlgorithmProvider(hAlg, 0);
+ if (!BCRYPT_SUCCESS(status))
+ return ARCHIVE_FAILED;
+
+ return ARCHIVE_OK;
+# else
HCRYPTPROV hProv;
BOOL success;
@@ -92,6 +117,10 @@ archive_random(void *buf, size_t nbytes)
}
/* TODO: Does this case really happen? */
return ARCHIVE_FAILED;
+# endif
+#elif !defined(HAVE_ARC4RANDOM_BUF) && (!defined(_WIN32) || defined(__CYGWIN__))
+ la_arc4random_buf(buf, nbytes);
+ return ARCHIVE_OK;
#else
arc4random_buf(buf, nbytes);
return ARCHIVE_OK;
@@ -256,7 +285,7 @@ arc4_getbyte(void)
}
static void
-arc4random_buf(void *_buf, size_t n)
+la_arc4random_buf(void *_buf, size_t n)
{
uint8_t *buf = (uint8_t *)_buf;
_ARC4_LOCK();
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_data_into_fd.c b/Utilities/cmlibarchive/libarchive/archive_read_data_into_fd.c
index b4398f1..f16ca5c 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_data_into_fd.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_data_into_fd.c
@@ -95,8 +95,13 @@ archive_read_data_into_fd(struct archive *a, int fd)
"archive_read_data_into_fd");
can_lseek = (fstat(fd, &st) == 0) && S_ISREG(st.st_mode);
- if (!can_lseek)
+ if (!can_lseek) {
nulls = calloc(1, nulls_size);
+ if (!nulls) {
+ r = ARCHIVE_FATAL;
+ goto cleanup;
+ }
+ }
while ((r = archive_read_data_block(a, &buff, &size, &target_offset)) ==
ARCHIVE_OK) {
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c b/Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c
index c964d3f..ab5306d 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c
@@ -1678,6 +1678,11 @@ setup_current_filesystem(struct archive_read_disk *a)
else
t->current_filesystem->name_max = nm;
#endif
+ if (t->current_filesystem->name_max == 0) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Cannot determine name_max");
+ return (ARCHIVE_FAILED);
+ }
#endif /* USE_READDIR_R */
return (ARCHIVE_OK);
}
@@ -1868,8 +1873,17 @@ setup_current_filesystem(struct archive_read_disk *a)
#if defined(USE_READDIR_R)
/* Set maximum filename length. */
+#if defined(HAVE_STATVFS)
+ t->current_filesystem->name_max = svfs.f_namemax;
+#else
t->current_filesystem->name_max = sfs.f_namelen;
#endif
+ if (t->current_filesystem->name_max == 0) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Cannot determine name_max");
+ return (ARCHIVE_FAILED);
+ }
+#endif
return (ARCHIVE_OK);
}
@@ -1950,6 +1964,11 @@ setup_current_filesystem(struct archive_read_disk *a)
#if defined(USE_READDIR_R)
/* Set maximum filename length. */
t->current_filesystem->name_max = svfs.f_namemax;
+ if (t->current_filesystem->name_max == 0) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Cannot determine name_max");
+ return (ARCHIVE_FAILED);
+ }
#endif
return (ARCHIVE_OK);
}
@@ -2004,6 +2023,11 @@ setup_current_filesystem(struct archive_read_disk *a)
else
t->current_filesystem->name_max = nm;
# endif /* _PC_NAME_MAX */
+ if (t->current_filesystem->name_max == 0) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Cannot determine name_max");
+ return (ARCHIVE_FAILED);
+ }
#endif /* USE_READDIR_R */
return (ARCHIVE_OK);
}
@@ -2554,7 +2578,11 @@ tree_current_lstat(struct tree *t)
#else
if (tree_enter_working_dir(t) != 0)
return NULL;
+#ifdef HAVE_LSTAT
if (lstat(tree_current_access_path(t), &t->lst) != 0)
+#else
+ if (la_stat(tree_current_access_path(t), &t->lst) != 0)
+#endif
#endif
return NULL;
t->flags |= hasLstat;
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_disk_windows.c b/Utilities/cmlibarchive/libarchive/archive_read_disk_windows.c
index f9d1395..f92a78a 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_disk_windows.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_disk_windows.c
@@ -418,9 +418,19 @@ la_linkname_from_pathw(const wchar_t *path, wchar_t **outbuf, int *linktype)
FILE_FLAG_OPEN_REPARSE_POINT;
int ret;
+# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ CREATEFILE2_EXTENDED_PARAMETERS createExParams;
+ ZeroMemory(&createExParams, sizeof(createExParams));
+ createExParams.dwSize = sizeof(createExParams);
+ createExParams.dwFileFlags = flag;
+ h = CreateFile2(path, 0,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+ OPEN_EXISTING, &createExParams);
+#else
h = CreateFileW(path, 0,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
OPEN_EXISTING, flag, NULL);
+#endif
if (h == INVALID_HANDLE_VALUE) {
la_dosmaperr(GetLastError());
return (-1);
@@ -1067,16 +1077,29 @@ next_entry(struct archive_read_disk *a, struct tree *t,
if (archive_entry_filetype(entry) == AE_IFREG &&
archive_entry_size(entry) > 0) {
DWORD flags = FILE_FLAG_BACKUP_SEMANTICS;
+#if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ CREATEFILE2_EXTENDED_PARAMETERS createExParams;
+#endif
if (t->async_io)
flags |= FILE_FLAG_OVERLAPPED;
if (t->direct_io)
flags |= FILE_FLAG_NO_BUFFERING;
else
flags |= FILE_FLAG_SEQUENTIAL_SCAN;
+#if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ ZeroMemory(&createExParams, sizeof(createExParams));
+ createExParams.dwSize = sizeof(createExParams);
+ createExParams.dwFileFlags = flags;
+ t->entry_fh = CreateFile2(tree_current_access_path(t),
+ GENERIC_READ,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+ OPEN_EXISTING, &createExParams);
+#else
t->entry_fh = CreateFileW(tree_current_access_path(t),
GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
NULL, OPEN_EXISTING, flags, NULL);
+#endif
if (t->entry_fh == INVALID_HANDLE_VALUE) {
la_dosmaperr(GetLastError());
archive_set_error(&a->archive, errno,
@@ -1547,6 +1570,9 @@ close_and_restore_time(HANDLE h, struct tree *t, struct restore_time *rt)
{
HANDLE handle;
int r = 0;
+#if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ CREATEFILE2_EXTENDED_PARAMETERS createExParams;
+#endif
if (h == INVALID_HANDLE_VALUE && AE_IFLNK == rt->filetype)
return (0);
@@ -1560,8 +1586,16 @@ close_and_restore_time(HANDLE h, struct tree *t, struct restore_time *rt)
if ((t->flags & needsRestoreTimes) == 0)
return (r);
+#if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ ZeroMemory(&createExParams, sizeof(createExParams));
+ createExParams.dwSize = sizeof(createExParams);
+ createExParams.dwFileFlags = FILE_FLAG_BACKUP_SEMANTICS;
+ handle = CreateFile2(rt->full_path, FILE_WRITE_ATTRIBUTES,
+ 0, OPEN_EXISTING, &createExParams);
+#else
handle = CreateFileW(rt->full_path, FILE_WRITE_ATTRIBUTES,
0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
+#endif
if (handle == INVALID_HANDLE_VALUE) {
errno = EINVAL;
return (-1);
@@ -2046,12 +2080,24 @@ tree_current_file_information(struct tree *t, BY_HANDLE_FILE_INFORMATION *st,
HANDLE h;
int r;
DWORD flag = FILE_FLAG_BACKUP_SEMANTICS;
-
+# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ CREATEFILE2_EXTENDED_PARAMETERS createExParams;
+#endif
+
if (sim_lstat && tree_current_is_physical_link(t))
flag |= FILE_FLAG_OPEN_REPARSE_POINT;
+# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ ZeroMemory(&createExParams, sizeof(createExParams));
+ createExParams.dwSize = sizeof(createExParams);
+ createExParams.dwFileFlags = flag;
+ h = CreateFile2(tree_current_access_path(t), 0,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+ OPEN_EXISTING, &createExParams);
+#else
h = CreateFileW(tree_current_access_path(t), 0,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
OPEN_EXISTING, flag, NULL);
+#endif
if (h == INVALID_HANDLE_VALUE) {
la_dosmaperr(GetLastError());
t->tree_errno = errno;
@@ -2257,7 +2303,10 @@ archive_read_disk_entry_from_file(struct archive *_a,
} else {
WIN32_FIND_DATAW findData;
DWORD flag, desiredAccess;
-
+# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ CREATEFILE2_EXTENDED_PARAMETERS createExParams;
+#endif
+
h = FindFirstFileW(path, &findData);
if (h == INVALID_HANDLE_VALUE) {
la_dosmaperr(GetLastError());
@@ -2279,9 +2328,18 @@ archive_read_disk_entry_from_file(struct archive *_a,
} else
desiredAccess = GENERIC_READ;
+# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ ZeroMemory(&createExParams, sizeof(createExParams));
+ createExParams.dwSize = sizeof(createExParams);
+ createExParams.dwFileFlags = flag;
+ h = CreateFile2(path, desiredAccess,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+ OPEN_EXISTING, &createExParams);
+#else
h = CreateFileW(path, desiredAccess,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
OPEN_EXISTING, flag, NULL);
+#endif
if (h == INVALID_HANDLE_VALUE) {
la_dosmaperr(GetLastError());
archive_set_error(&a->archive, errno,
@@ -2342,9 +2400,19 @@ archive_read_disk_entry_from_file(struct archive *_a,
if (fd >= 0) {
h = (HANDLE)_get_osfhandle(fd);
} else {
+# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ CREATEFILE2_EXTENDED_PARAMETERS createExParams;
+ ZeroMemory(&createExParams, sizeof(createExParams));
+ createExParams.dwSize = sizeof(createExParams);
+ createExParams.dwFileFlags = FILE_FLAG_BACKUP_SEMANTICS;
+ h = CreateFile2(path, GENERIC_READ,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+ OPEN_EXISTING, &createExParams);
+#else
h = CreateFileW(path, GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
+#endif
if (h == INVALID_HANDLE_VALUE) {
la_dosmaperr(GetLastError());
archive_set_error(&a->archive, errno,
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_open_file.c b/Utilities/cmlibarchive/libarchive/archive_read_open_file.c
index 101dae6..03719e8 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_open_file.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_open_file.c
@@ -154,10 +154,10 @@ file_skip(struct archive *a, void *client_data, int64_t request)
#ifdef __ANDROID__
/* fileno() isn't safe on all platforms ... see above. */
if (lseek(fileno(mine->f), skip, SEEK_CUR) < 0)
-#elif HAVE_FSEEKO
- if (fseeko(mine->f, skip, SEEK_CUR) != 0)
#elif HAVE__FSEEKI64
if (_fseeki64(mine->f, skip, SEEK_CUR) != 0)
+#elif HAVE_FSEEKO
+ if (fseeko(mine->f, skip, SEEK_CUR) != 0)
#else
if (fseek(mine->f, skip, SEEK_CUR) != 0)
#endif
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_set_options.3 b/Utilities/cmlibarchive/libarchive/archive_read_set_options.3
index b2db4cb..162b79d 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_set_options.3
+++ b/Utilities/cmlibarchive/libarchive/archive_read_set_options.3
@@ -255,6 +255,27 @@ have been concatenated together.
Without this option, only the contents of
the first concatenated archive would be read.
.El
+.It Format zip
+.Bl -tag -compact -width indent
+.It Cm compat-2x
+Libarchive 2.x incorrectly encoded Unicode filenames on
+some platforms.
+This option mimics the libarchive 2.x filename handling
+so that such archives can be read correctly.
+.It Cm hdrcharset
+The value is used as a character set name that will be
+used when translating file names.
+.It Cm ignorecrc32
+Skip the CRC32 check.
+Mostly used for testing.
+.It Cm mac-ext
+Support Mac OS metadata extension that records data in special
+files beginning with a period and underscore.
+Defaults to enabled on Mac OS, disabled on other platforms.
+Use
+.Cm !mac-ext
+to disable.
+.El
.El
.\"
.Sh ERRORS
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_bzip2.c b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_bzip2.c
index a5243af..9e5f6d9 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_bzip2.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_bzip2.c
@@ -230,7 +230,7 @@ bzip2_filter_read(struct archive_read_filter *self, const void **p)
/* Empty our output buffer. */
state->stream.next_out = state->out_block;
- state->stream.avail_out = state->out_block_size;
+ state->stream.avail_out = (uint32_t)state->out_block_size;
/* Try to fill the output buffer. */
for (;;) {
@@ -288,7 +288,7 @@ bzip2_filter_read(struct archive_read_filter *self, const void **p)
return (ARCHIVE_FATAL);
}
state->stream.next_in = (char *)(uintptr_t)read_buf;
- state->stream.avail_in = ret;
+ state->stream.avail_in = (uint32_t)ret;
/* There is no more data, return whatever we have. */
if (ret == 0) {
state->eof = 1;
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_lz4.c b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_lz4.c
index 1e99542..d0fc1a8 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_lz4.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_lz4.c
@@ -584,7 +584,7 @@ lz4_filter_read_data_block(struct archive_read_filter *self, const void **p)
state->out_block + prefix64k, (int)compressed_size,
state->flags.block_maximum_size,
state->out_block,
- prefix64k);
+ (int)prefix64k);
#else
uncompressed_size = LZ4_decompress_safe_withPrefix64k(
read_buf + 4,
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_uu.c b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_uu.c
index c66c247..802165c 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_uu.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_uu.c
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#endif
#include "archive.h"
+#include "archive_entry.h"
#include "archive_private.h"
#include "archive_read_private.h"
@@ -61,12 +62,17 @@ struct uudecode {
#define ST_UUEND 2
#define ST_READ_BASE64 3
#define ST_IGNORE 4
+ mode_t mode;
+ int mode_set;
+ char *name;
};
static int uudecode_bidder_bid(struct archive_read_filter_bidder *,
struct archive_read_filter *filter);
static int uudecode_bidder_init(struct archive_read_filter *);
+static int uudecode_read_header(struct archive_read_filter *,
+ struct archive_entry *entry);
static ssize_t uudecode_filter_read(struct archive_read_filter *,
const void **);
static int uudecode_filter_close(struct archive_read_filter *);
@@ -359,6 +365,7 @@ static const struct archive_read_filter_vtable
uudecode_reader_vtable = {
.read = uudecode_filter_read,
.close = uudecode_filter_close,
+ .read_header = uudecode_read_header
};
static int
@@ -389,6 +396,8 @@ uudecode_bidder_init(struct archive_read_filter *self)
uudecode->in_allocated = IN_BUFF_SIZE;
uudecode->out_buff = out_buff;
uudecode->state = ST_FIND_HEAD;
+ uudecode->mode_set = 0;
+ uudecode->name = NULL;
self->vtable = &uudecode_reader_vtable;
return (ARCHIVE_OK);
@@ -434,6 +443,22 @@ ensure_in_buff_size(struct archive_read_filter *self,
return (ARCHIVE_OK);
}
+static int
+uudecode_read_header(struct archive_read_filter *self, struct archive_entry *entry)
+{
+
+ struct uudecode *uudecode;
+ uudecode = (struct uudecode *)self->data;
+
+ if (uudecode->mode_set != 0)
+ archive_entry_set_mode(entry, S_IFREG | uudecode->mode);
+
+ if (uudecode->name != NULL)
+ archive_entry_set_pathname(entry, uudecode->name);
+
+ return (ARCHIVE_OK);
+}
+
static ssize_t
uudecode_filter_read(struct archive_read_filter *self, const void **buff)
{
@@ -443,7 +468,7 @@ uudecode_filter_read(struct archive_read_filter *self, const void **buff)
ssize_t avail_in, ravail;
ssize_t used;
ssize_t total;
- ssize_t len, llen, nl;
+ ssize_t len, llen, nl, namelen;
uudecode = (struct uudecode *)self->data;
@@ -551,6 +576,28 @@ read_more:
uudecode->state = ST_READ_UU;
else
uudecode->state = ST_READ_BASE64;
+ uudecode->mode = (mode_t)(
+ ((int)(b[l] - '0') * 64) +
+ ((int)(b[l+1] - '0') * 8) +
+ (int)(b[l+2] - '0'));
+ uudecode->mode_set = 1;
+ namelen = len - nl - 4 - l;
+ if (namelen > 1) {
+ if (uudecode->name != NULL)
+ free(uudecode->name);
+ uudecode->name = malloc(namelen + 1);
+ if (uudecode->name == NULL) {
+ archive_set_error(
+ &self->archive->archive,
+ ENOMEM,
+ "Can't allocate data for uudecode");
+ return (ARCHIVE_FATAL);
+ }
+ strncpy(uudecode->name,
+ (const char *)(b + l + 4),
+ namelen);
+ uudecode->name[namelen] = '\0';
+ }
}
break;
case ST_READ_UU:
@@ -683,6 +730,7 @@ uudecode_filter_close(struct archive_read_filter *self)
uudecode = (struct uudecode *)self->data;
free(uudecode->in_buff);
free(uudecode->out_buff);
+ free(uudecode->name);
free(uudecode);
return (ARCHIVE_OK);
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_zstd.c b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_zstd.c
index 29d4d62..8d20d7c 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_zstd.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_zstd.c
@@ -115,9 +115,9 @@ zstd_bidder_bid(struct archive_read_filter_bidder *self,
unsigned prefix;
/* Zstd frame magic values */
- const unsigned zstd_magic = 0xFD2FB528U;
- const unsigned zstd_magic_skippable_start = 0x184D2A50U;
- const unsigned zstd_magic_skippable_mask = 0xFFFFFFF0;
+ unsigned zstd_magic = 0xFD2FB528U;
+ unsigned zstd_magic_skippable_start = 0x184D2A50U;
+ unsigned zstd_magic_skippable_mask = 0xFFFFFFF0;
(void) self; /* UNUSED */
@@ -170,7 +170,7 @@ static int
zstd_bidder_init(struct archive_read_filter *self)
{
struct private_data *state;
- const size_t out_block_size = ZSTD_DStreamOutSize();
+ size_t out_block_size = ZSTD_DStreamOutSize();
void *out_block;
ZSTD_DStream *dstream;
@@ -211,6 +211,7 @@ zstd_filter_read(struct archive_read_filter *self, const void **p)
ssize_t avail_in;
ZSTD_outBuffer out;
ZSTD_inBuffer in;
+ size_t ret;
state = (struct private_data *)self->data;
@@ -219,7 +220,7 @@ zstd_filter_read(struct archive_read_filter *self, const void **p)
/* Try to fill the output buffer. */
while (out.pos < out.size && !state->eof) {
if (!state->in_frame) {
- const size_t ret = ZSTD_initDStream(state->dstream);
+ ret = ZSTD_initDStream(state->dstream);
if (ZSTD_isError(ret)) {
archive_set_error(&self->archive->archive,
ARCHIVE_ERRNO_MISC,
@@ -249,8 +250,7 @@ zstd_filter_read(struct archive_read_filter *self, const void **p)
in.pos = 0;
{
- const size_t ret =
- ZSTD_decompressStream(state->dstream, &out, &in);
+ ret = ZSTD_decompressStream(state->dstream, &out, &in);
if (ZSTD_isError(ret)) {
archive_set_error(&self->archive->archive,
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c
index a4d9dcf..0bfbf1f 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c
@@ -41,6 +41,9 @@ __FBSDID("$FreeBSD$");
#ifdef HAVE_ZLIB_H
#include <cm3p/zlib.h>
#endif
+#ifdef HAVE_ZSTD_H
+#include <cm3p/zstd.h>
+#endif
#ifdef __clang_analyzer__
#include <assert.h>
@@ -84,8 +87,11 @@ __FBSDID("$FreeBSD$");
#define _7Z_IA64 0x03030401
#define _7Z_ARM 0x03030501
#define _7Z_ARMTHUMB 0x03030701
+#define _7Z_ARM64 0xa
#define _7Z_SPARC 0x03030805
+#define _7Z_ZSTD 0x4F71101 /* Copied from https://github.com/mcmilk/7-Zip-zstd.git */
+
/*
* 7-Zip header property IDs.
*/
@@ -114,6 +120,30 @@ __FBSDID("$FreeBSD$");
#define kEncodedHeader 0x17
#define kDummy 0x19
+// Check that some windows file attribute constants are defined.
+// Reference: https://learn.microsoft.com/en-us/windows/win32/fileio/file-attribute-constants
+#ifndef FILE_ATTRIBUTE_READONLY
+#define FILE_ATTRIBUTE_READONLY 0x00000001
+#endif
+
+#ifndef FILE_ATTRIBUTE_HIDDEN
+#define FILE_ATTRIBUTE_HIDDEN 0x00000002
+#endif
+
+#ifndef FILE_ATTRIBUTE_SYSTEM
+#define FILE_ATTRIBUTE_SYSTEM 0x00000004
+#endif
+
+#ifndef FILE_ATTRIBUTE_DIRECTORY
+#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
+#endif
+
+// This value is defined in 7zip with the comment "trick for Unix".
+//
+// 7z archives created on unix have this bit set in the high 16 bits of
+// the attr field along with the unix permissions.
+#define FILE_ATTRIBUTE_UNIX_EXTENSION 0x8000
+
struct _7z_digests {
unsigned char *defineds;
uint32_t *digests;
@@ -282,6 +312,11 @@ struct _7zip {
z_stream stream;
int stream_valid;
#endif
+ /* Decoding Zstandard data. */
+#if HAVE_ZSTD_H
+ ZSTD_DStream *zstd_dstream;
+ int zstdstream_valid;
+#endif
/* Decoding PPMd data. */
int ppmd7_stat;
CPpmd7 ppmd7_context;
@@ -401,6 +436,9 @@ static int setup_decode_folder(struct archive_read *, struct _7z_folder *,
int);
static void x86_Init(struct _7zip *);
static size_t x86_Convert(struct _7zip *, uint8_t *, size_t);
+static void arm_Init(struct _7zip *);
+static size_t arm_Convert(struct _7zip *, uint8_t *, size_t);
+static size_t arm64_Convert(struct _7zip *, uint8_t *, size_t);
static ssize_t Bcj2_Decode(struct _7zip *, uint8_t *, size_t);
@@ -729,6 +767,37 @@ archive_read_format_7zip_read_header(struct archive_read *a,
archive_entry_set_size(entry, 0);
}
+ // These attributes are supported by the windows implementation of archive_write_disk.
+ const int supported_attrs = FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM;
+
+ if (zip_entry->attr & supported_attrs) {
+ char *fflags_text, *ptr;
+ /* allocate for "rdonly,hidden,system," */
+ fflags_text = malloc(22 * sizeof(char));
+ if (fflags_text != NULL) {
+ ptr = fflags_text;
+ if (zip_entry->attr & FILE_ATTRIBUTE_READONLY) {
+ strcpy(ptr, "rdonly,");
+ ptr = ptr + 7;
+ }
+ if (zip_entry->attr & FILE_ATTRIBUTE_HIDDEN) {
+ strcpy(ptr, "hidden,");
+ ptr = ptr + 7;
+ }
+ if (zip_entry->attr & FILE_ATTRIBUTE_SYSTEM) {
+ strcpy(ptr, "system,");
+ ptr = ptr + 7;
+ }
+ if (ptr > fflags_text) {
+ /* Delete trailing comma */
+ *(ptr - 1) = '\0';
+ archive_entry_copy_fflags_text(entry,
+ fflags_text);
+ }
+ free(fflags_text);
+ }
+ }
+
/* If there's no body, force read_data() to return EOF immediately. */
if (zip->entry_bytes_remaining < 1)
zip->end_of_entry = 1;
@@ -1034,10 +1103,13 @@ init_decompression(struct archive_read *a, struct _7zip *zip,
case _7Z_COPY:
case _7Z_BZ2:
case _7Z_DEFLATE:
+ case _7Z_ZSTD:
case _7Z_PPMD:
if (coder2 != NULL) {
if (coder2->codec != _7Z_X86 &&
- coder2->codec != _7Z_X86_BCJ2) {
+ coder2->codec != _7Z_X86_BCJ2 &&
+ coder2->codec != _7Z_ARM &&
+ coder2->codec != _7Z_ARM64) {
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
"Unsupported filter %lx for %lx",
@@ -1048,6 +1120,8 @@ init_decompression(struct archive_read *a, struct _7zip *zip,
zip->bcj_state = 0;
if (coder2->codec == _7Z_X86)
x86_Init(zip);
+ else if (coder2->codec == _7Z_ARM)
+ arm_Init(zip);
}
break;
default:
@@ -1144,6 +1218,12 @@ init_decompression(struct archive_read *a, struct _7zip *zip,
filters[fi].id = LZMA_FILTER_ARMTHUMB;
fi++;
break;
+#ifdef LZMA_FILTER_ARM64
+ case _7Z_ARM64:
+ filters[fi].id = LZMA_FILTER_ARM64;
+ fi++;
+ break;
+#endif
case _7Z_SPARC:
filters[fi].id = LZMA_FILTER_SPARC;
fi++;
@@ -1229,6 +1309,22 @@ init_decompression(struct archive_read *a, struct _7zip *zip,
"BZ2 codec is unsupported");
return (ARCHIVE_FAILED);
#endif
+ case _7Z_ZSTD:
+ {
+#if defined(HAVE_ZSTD_H)
+ if (zip->zstdstream_valid) {
+ ZSTD_freeDStream(zip->zstd_dstream);
+ zip->zstdstream_valid = 0;
+ }
+ zip->zstd_dstream = ZSTD_createDStream();
+ zip->zstdstream_valid = 1;
+ break;
+#else
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "ZSTD codec is unsupported");
+ return (ARCHIVE_FAILED);
+#endif
+ }
case _7Z_DEFLATE:
#ifdef HAVE_ZLIB_H
if (zip->stream_valid)
@@ -1299,6 +1395,7 @@ init_decompression(struct archive_read *a, struct _7zip *zip,
case _7Z_IA64:
case _7Z_ARM:
case _7Z_ARMTHUMB:
+ case _7Z_ARM64:
case _7Z_SPARC:
case _7Z_DELTA:
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
@@ -1443,9 +1540,9 @@ decompress(struct archive_read *a, struct _7zip *zip,
#if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
case _7Z_BZ2:
zip->bzstream.next_in = (char *)(uintptr_t)t_next_in;
- zip->bzstream.avail_in = t_avail_in;
+ zip->bzstream.avail_in = (uint32_t)t_avail_in;
zip->bzstream.next_out = (char *)(uintptr_t)t_next_out;
- zip->bzstream.avail_out = t_avail_out;
+ zip->bzstream.avail_out = (uint32_t)t_avail_out;
r = BZ2_bzDecompress(&(zip->bzstream));
switch (r) {
case BZ_STREAM_END: /* Found end of stream. */
@@ -1495,6 +1592,22 @@ decompress(struct archive_read *a, struct _7zip *zip,
t_avail_out = zip->stream.avail_out;
break;
#endif
+#ifdef HAVE_ZSTD_H
+ case _7Z_ZSTD:
+ {
+ ZSTD_inBuffer input = { t_next_in, t_avail_in, 0 }; // src, size, pos
+ ZSTD_outBuffer output = { t_next_out, t_avail_out, 0 }; // dst, size, pos
+
+ size_t const zret = ZSTD_decompressStream(zip->zstd_dstream, &output, &input);
+ if (ZSTD_isError(zret)) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Zstd decompression failed: %s", ZSTD_getErrorName(zret));
+ return ARCHIVE_FAILED;
+ }
+ t_avail_in -= input.pos;
+ t_avail_out -= output.pos;
+ break;
+ }
+#endif
case _7Z_PPMD:
{
uint64_t flush_bytes;
@@ -1579,16 +1692,23 @@ decompress(struct archive_read *a, struct _7zip *zip,
/*
* Decord BCJ.
*/
- if (zip->codec != _7Z_LZMA2 && zip->codec2 == _7Z_X86) {
- size_t l = x86_Convert(zip, buff, *outbytes);
- zip->odd_bcj_size = *outbytes - l;
- if (zip->odd_bcj_size > 0 && zip->odd_bcj_size <= 4 &&
- o_avail_in && ret != ARCHIVE_EOF) {
- memcpy(zip->odd_bcj, ((unsigned char *)buff) + l,
- zip->odd_bcj_size);
- *outbytes = l;
- } else
- zip->odd_bcj_size = 0;
+ if (zip->codec != _7Z_LZMA2) {
+ if (zip->codec2 == _7Z_X86) {
+ size_t l = x86_Convert(zip, buff, *outbytes);
+
+ zip->odd_bcj_size = *outbytes - l;
+ if (zip->odd_bcj_size > 0 && zip->odd_bcj_size <= 4 &&
+ o_avail_in && ret != ARCHIVE_EOF) {
+ memcpy(zip->odd_bcj, ((unsigned char *)buff) + l,
+ zip->odd_bcj_size);
+ *outbytes = l;
+ } else
+ zip->odd_bcj_size = 0;
+ } else if (zip->codec2 == _7Z_ARM) {
+ *outbytes = arm_Convert(zip, buff, *outbytes);
+ } else if (zip->codec2 == _7Z_ARM64) {
+ *outbytes = arm64_Convert(zip, buff, *outbytes);
+ }
}
/*
@@ -2612,6 +2732,28 @@ read_Header(struct archive_read *a, struct _7z_header_info *h,
entries[i].flg |= HAS_STREAM;
/* The high 16 bits of attributes is a posix file mode. */
entries[i].mode = entries[i].attr >> 16;
+
+ if (!(entries[i].attr & FILE_ATTRIBUTE_UNIX_EXTENSION)) {
+ // Only windows permissions specified for this entry. Translate to
+ // reasonable corresponding unix permissions.
+
+ if (entries[i].attr & FILE_ATTRIBUTE_DIRECTORY) {
+ if (entries[i].attr & FILE_ATTRIBUTE_READONLY) {
+ // Read-only directory.
+ entries[i].mode = AE_IFDIR | 0555;
+ } else {
+ // Read-write directory.
+ entries[i].mode = AE_IFDIR | 0755;
+ }
+ } else if (entries[i].attr & FILE_ATTRIBUTE_READONLY) {
+ // Readonly file.
+ entries[i].mode = AE_IFREG | 0444;
+ } else {
+ // Assume read-write file.
+ entries[i].mode = AE_IFREG | 0644;
+ }
+ }
+
if (entries[i].flg & HAS_STREAM) {
if ((size_t)sindex >= si->ss.unpack_streams)
return (-1);
@@ -2652,7 +2794,7 @@ read_Header(struct archive_read *a, struct _7z_header_info *h,
}
entries[i].ssIndex = -1;
}
- if (entries[i].attr & 0x01)
+ if (entries[i].attr & FILE_ATTRIBUTE_READONLY)
entries[i].mode &= ~0222;/* Read only. */
if ((entries[i].flg & HAS_STREAM) == 0 && indexInFolder == 0) {
@@ -3737,6 +3879,116 @@ x86_Convert(struct _7zip *zip, uint8_t *data, size_t size)
return (bufferPos);
}
+static void
+arm_Init(struct _7zip *zip)
+{
+ zip->bcj_ip = 8;
+}
+
+static size_t
+arm_Convert(struct _7zip *zip, uint8_t *buf, size_t size)
+{
+ // This function was adapted from
+ // static size_t bcj_arm(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
+ // in https://git.tukaani.org/xz-embedded.git
+
+ /*
+ * Branch/Call/Jump (BCJ) filter decoders
+ *
+ * Authors: Lasse Collin <lasse.collin@tukaani.org>
+ * Igor Pavlov <https://7-zip.org/>
+ *
+ * This file has been put into the public domain.
+ * You can do whatever you want with this file.
+ */
+
+ size_t i;
+ uint32_t addr;
+
+ for (i = 0; i + 4 <= size; i += 4) {
+ if (buf[i + 3] == 0xEB) {
+ // Calculate the transformed addr.
+ addr = (uint32_t)buf[i] | ((uint32_t)buf[i + 1] << 8)
+ | ((uint32_t)buf[i + 2] << 16);
+ addr <<= 2;
+ addr -= zip->bcj_ip + (uint32_t)i;
+ addr >>= 2;
+
+ // Store the transformed addr in buf.
+ buf[i] = (uint8_t)addr;
+ buf[i + 1] = (uint8_t)(addr >> 8);
+ buf[i + 2] = (uint8_t)(addr >> 16);
+ }
+ }
+
+ zip->bcj_ip += (uint32_t)i;
+
+ return i;
+}
+
+static size_t
+arm64_Convert(struct _7zip *zip, uint8_t *buf, size_t size)
+{
+ // This function was adapted from
+ // static size_t bcj_arm64(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
+ // in https://git.tukaani.org/xz-embedded.git
+
+ /*
+ * Branch/Call/Jump (BCJ) filter decoders
+ *
+ * Authors: Lasse Collin <lasse.collin@tukaani.org>
+ * Igor Pavlov <https://7-zip.org/>
+ *
+ * This file has been put into the public domain.
+ * You can do whatever you want with this file.
+ */
+
+ size_t i;
+ uint32_t instr;
+ uint32_t addr;
+
+ for (i = 0; i + 4 <= size; i += 4) {
+ instr = (uint32_t)buf[i]
+ | ((uint32_t)buf[i+1] << 8)
+ | ((uint32_t)buf[i+2] << 16)
+ | ((uint32_t)buf[i+3] << 24);
+
+ if ((instr >> 26) == 0x25) {
+ /* BL instruction */
+ addr = instr - ((zip->bcj_ip + (uint32_t)i) >> 2);
+ instr = 0x94000000 | (addr & 0x03FFFFFF);
+
+ buf[i] = (uint8_t)instr;
+ buf[i+1] = (uint8_t)(instr >> 8);
+ buf[i+2] = (uint8_t)(instr >> 16);
+ buf[i+3] = (uint8_t)(instr >> 24);
+ } else if ((instr & 0x9F000000) == 0x90000000) {
+ /* ADRP instruction */
+ addr = ((instr >> 29) & 3) | ((instr >> 3) & 0x1FFFFC);
+
+ /* Only convert values in the range +/-512 MiB. */
+ if ((addr + 0x020000) & 0x1C0000)
+ continue;
+
+ addr -= (zip->bcj_ip + (uint32_t)i) >> 12;
+
+ instr &= 0x9000001F;
+ instr |= (addr & 3) << 29;
+ instr |= (addr & 0x03FFFC) << 3;
+ instr |= (0U - (addr & 0x020000)) & 0xE00000;
+
+ buf[i] = (uint8_t)instr;
+ buf[i+1] = (uint8_t)(instr >> 8);
+ buf[i+2] = (uint8_t)(instr >> 16);
+ buf[i+3] = (uint8_t)(instr >> 24);
+ }
+ }
+
+ zip->bcj_ip += (uint32_t)i;
+
+ return i;
+}
+
/*
* Brought from LZMA SDK.
*
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_cab.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_cab.c
index 6fcfbfc..e57b8c3 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_cab.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_cab.c
@@ -2294,10 +2294,10 @@ lzx_br_fillup(struct lzx_stream *strm, struct lzx_br *br)
(br->cache_buffer << 48) |
((uint64_t)strm->next_in[1]) << 40 |
((uint64_t)strm->next_in[0]) << 32 |
- ((uint32_t)strm->next_in[3]) << 24 |
- ((uint32_t)strm->next_in[2]) << 16 |
- ((uint32_t)strm->next_in[5]) << 8 |
- (uint32_t)strm->next_in[4];
+ ((uint64_t)strm->next_in[3]) << 24 |
+ ((uint64_t)strm->next_in[2]) << 16 |
+ ((uint64_t)strm->next_in[5]) << 8 |
+ (uint64_t)strm->next_in[4];
strm->next_in += 6;
strm->avail_in -= 6;
br->cache_avail += 6 * 8;
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_cpio.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_cpio.c
index 6b8ae33..9adcfd3 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_cpio.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_cpio.c
@@ -441,7 +441,7 @@ archive_read_format_cpio_read_header(struct archive_read *a,
/* Compare name to "TRAILER!!!" to test for end-of-archive. */
if (namelength == 11 && strncmp((const char *)h, "TRAILER!!!",
- 11) == 0) {
+ 10) == 0) {
/* TODO: Store file location of start of block. */
archive_clear_error(&a->archive);
return (ARCHIVE_EOF);
@@ -985,14 +985,14 @@ archive_read_format_cpio_cleanup(struct archive_read *a)
static int64_t
le4(const unsigned char *p)
{
- return ((p[0] << 16) + (((int64_t)p[1]) << 24) + (p[2] << 0) + (p[3] << 8));
+ return ((p[0] << 16) | (((int64_t)p[1]) << 24) | (p[2] << 0) | (p[3] << 8));
}
static int64_t
be4(const unsigned char *p)
{
- return ((((int64_t)p[0]) << 24) + (p[1] << 16) + (p[2] << 8) + (p[3]));
+ return ((((int64_t)p[0]) << 24) | (p[1] << 16) | (p[2] << 8) | (p[3]));
}
/*
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c
index 91b9187..a6219fa 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c
@@ -1901,7 +1901,7 @@ parse_file_info(struct archive_read *a, struct file_info *parent,
* NUMBER of RRIP "PX" extension.
* Note: Old mkisofs did not record that FILE SERIAL NUMBER
* in ISO images.
- * Note2: xorriso set 0 to the location of a symlink file.
+ * Note2: xorriso set 0 to the location of a symlink file.
*/
if (file->size == 0 && location >= 0) {
/* If file->size is zero, its location points wrong place,
@@ -1955,7 +1955,7 @@ parse_file_info(struct archive_read *a, struct file_info *parent,
* made by makefs is not zero and its location is
* the same as those of next regular file. That is
* the same as hard like file and it causes unexpected
- * error.
+ * error.
*/
if (file->size > 0 &&
(file->mode & AE_IFMT) == AE_IFLNK) {
@@ -2747,7 +2747,7 @@ next_cache_entry(struct archive_read *a, struct iso9660 *iso9660,
* If directory entries all which are descendant of
* rr_moved are still remaining, expose their.
*/
- if (iso9660->re_files.first != NULL &&
+ if (iso9660->re_files.first != NULL &&
iso9660->rr_moved != NULL &&
iso9660->rr_moved->rr_moved_has_re_only)
/* Expose "rr_moved" entry. */
@@ -3182,11 +3182,11 @@ isodate17(const unsigned char *v)
static time_t
time_from_tm(struct tm *t)
{
-#if HAVE_TIMEGM
+#if HAVE__MKGMTIME
+ return _mkgmtime(t);
+#elif HAVE_TIMEGM
/* Use platform timegm() if available. */
return (timegm(t));
-#elif HAVE__MKGMTIME64
- return (_mkgmtime64(t));
#else
/* Else use direct calculation using POSIX assumptions. */
/* First, fix up tm_yday based on the year/month/day. */
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_lha.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_lha.c
index 8b7bf66..1c64b29 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_lha.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_lha.c
@@ -1819,7 +1819,7 @@ lha_crc16(uint16_t crc, const void *pp, size_t len)
* remove the statement which will not be executed. */
#undef bswap16
#ifndef __has_builtin
-# define __has_builtin(x) 0
+#define __has_builtin(x) 0
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1400 /* Visual Studio */
# define bswap16(x) _byteswap_ushort(x)
@@ -1827,7 +1827,7 @@ lha_crc16(uint16_t crc, const void *pp, size_t len)
/* GCC 4.8 and later has __builtin_bswap16() */
# define bswap16(x) __builtin_bswap16(x)
#elif defined(__clang__) && __has_builtin(__builtin_bswap16)
-/* All clang versions have __builtin_bswap16() */
+/* Newer clang versions have __builtin_bswap16() */
# define bswap16(x) __builtin_bswap16(x)
#else
# define bswap16(x) ((((x) >> 8) & 0xff) | ((x) << 8))
@@ -2012,10 +2012,10 @@ lzh_br_fillup(struct lzh_stream *strm, struct lzh_br *br)
((uint64_t)strm->next_in[0]) << 48 |
((uint64_t)strm->next_in[1]) << 40 |
((uint64_t)strm->next_in[2]) << 32 |
- ((uint32_t)strm->next_in[3]) << 24 |
- ((uint32_t)strm->next_in[4]) << 16 |
- ((uint32_t)strm->next_in[5]) << 8 |
- (uint32_t)strm->next_in[6];
+ ((uint64_t)strm->next_in[3]) << 24 |
+ ((uint64_t)strm->next_in[4]) << 16 |
+ ((uint64_t)strm->next_in[5]) << 8 |
+ (uint64_t)strm->next_in[6];
strm->next_in += 7;
strm->avail_in -= 7;
br->cache_avail += 7 * 8;
@@ -2025,10 +2025,10 @@ lzh_br_fillup(struct lzh_stream *strm, struct lzh_br *br)
(br->cache_buffer << 48) |
((uint64_t)strm->next_in[0]) << 40 |
((uint64_t)strm->next_in[1]) << 32 |
- ((uint32_t)strm->next_in[2]) << 24 |
- ((uint32_t)strm->next_in[3]) << 16 |
- ((uint32_t)strm->next_in[4]) << 8 |
- (uint32_t)strm->next_in[5];
+ ((uint64_t)strm->next_in[2]) << 24 |
+ ((uint64_t)strm->next_in[3]) << 16 |
+ ((uint64_t)strm->next_in[4]) << 8 |
+ (uint64_t)strm->next_in[5];
strm->next_in += 6;
strm->avail_in -= 6;
br->cache_avail += 6 * 8;
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_mtree.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_mtree.c
index 2bc3ba0..a5fa30e 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_mtree.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_mtree.c
@@ -1280,7 +1280,13 @@ parse_file(struct archive_read *a, struct archive_entry *entry,
mtree->fd = -1;
st = NULL;
}
- } else if (lstat(path, st) == -1) {
+ }
+#ifdef HAVE_LSTAT
+ else if (lstat(path, st) == -1)
+#else
+ else if (la_stat(path, st) == -1)
+#endif
+ {
st = NULL;
}
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar.c
index 41d6cb2..a1c5495 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar.c
@@ -1064,7 +1064,7 @@ archive_read_format_rar_read_header(struct archive_read *a,
return (ARCHIVE_FATAL);
}
p = h;
- crc32_val = crc32(crc32_val, (const unsigned char *)p, to_read);
+ crc32_val = crc32(crc32_val, (const unsigned char *)p, (unsigned int)to_read);
__archive_read_consume(a, to_read);
skip -= to_read;
}
@@ -1832,13 +1832,9 @@ read_exttime(const char *p, struct rar *rar, const char *endp)
struct tm *tm;
time_t t;
long nsec;
-#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
struct tm tmbuf;
#endif
-#if defined(HAVE__LOCALTIME64_S)
- errno_t terr;
- __time64_t tmptime;
-#endif
if (p + 2 > endp)
return (-1);
@@ -1870,15 +1866,10 @@ read_exttime(const char *p, struct rar *rar, const char *endp)
rem = (((unsigned)(unsigned char)*p) << 16) | (rem >> 8);
p++;
}
-#if defined(HAVE_LOCALTIME_R)
+#if defined(HAVE_LOCALTIME_S)
+ tm = localtime_s(&tmbuf, &t) ? NULL : &tmbuf;
+#elif defined(HAVE_LOCALTIME_R)
tm = localtime_r(&t, &tmbuf);
-#elif defined(HAVE__LOCALTIME64_S)
- tmptime = t;
- terr = _localtime64_s(&tmbuf, &tmptime);
- if (terr)
- tm = NULL;
- else
- tm = &tmbuf;
#else
tm = localtime(&t);
#endif
@@ -3451,7 +3442,7 @@ compile_program(const uint8_t *bytes, size_t length)
prog = calloc(1, sizeof(*prog));
if (!prog)
return NULL;
- prog->fingerprint = crc32(0, bytes, length) | ((uint64_t)length << 32);
+ prog->fingerprint = crc32(0, bytes, (unsigned int)length) | ((uint64_t)length << 32);
if (membr_bits(&br, 1))
{
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar5.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar5.c
index aa7b861..7f1efb8 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar5.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar5.c
@@ -2475,7 +2475,7 @@ static void update_crc(struct rar5* rar, const uint8_t* p, size_t to_read) {
* `stored_crc32` info filled in. */
if(rar->file.stored_crc32 > 0) {
rar->file.calculated_crc32 =
- crc32(rar->file.calculated_crc32, p, to_read);
+ crc32(rar->file.calculated_crc32, p, (unsigned int)to_read);
}
/* Check if the file uses an optional BLAKE2sp checksum
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_warc.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_warc.c
index 2732996..61ab29e 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_warc.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_warc.c
@@ -530,11 +530,11 @@ strtoi_lim(const char *str, const char **ep, int llim, int ulim)
static time_t
time_from_tm(struct tm *t)
{
-#if HAVE_TIMEGM
+#if HAVE__MKGMTIME
+ return _mkgmtime(t);
+#elif HAVE_TIMEGM
/* Use platform timegm() if available. */
return (timegm(t));
-#elif HAVE__MKGMTIME64
- return (_mkgmtime64(t));
#else
/* Else use direct calculation using POSIX assumptions. */
/* First, fix up tm_yday based on the year/month/day. */
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c
index 330df58..efed86d 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c
@@ -1127,7 +1127,7 @@ atohex(unsigned char *b, size_t bsize, const char *p, size_t psize)
x |= p[1] - '0';
else
return (-1);
-
+
*b++ = x;
bsize--;
p += 2;
@@ -1139,11 +1139,11 @@ atohex(unsigned char *b, size_t bsize, const char *p, size_t psize)
static time_t
time_from_tm(struct tm *t)
{
-#if HAVE_TIMEGM
+#if HAVE__MKGMTIME
+ return _mkgmtime(t);
+#elif HAVE_TIMEGM
/* Use platform timegm() if available. */
return (timegm(t));
-#elif HAVE__MKGMTIME64
- return (_mkgmtime64(t));
#else
/* Else use direct calculation using POSIX assumptions. */
/* First, fix up tm_yday based on the year/month/day. */
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c
index e126ae3..e8b20f5 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c
@@ -2186,11 +2186,11 @@ zip_read_data_zipx_bzip2(struct archive_read *a, const void **buff,
/* Setup buffer boundaries. */
zip->bzstream.next_in = (char*)(uintptr_t) compressed_buff;
- zip->bzstream.avail_in = in_bytes;
+ zip->bzstream.avail_in = (uint32_t)in_bytes;
zip->bzstream.total_in_hi32 = 0;
zip->bzstream.total_in_lo32 = 0;
zip->bzstream.next_out = (char*) zip->uncompressed_buffer;
- zip->bzstream.avail_out = zip->uncompressed_buffer_size;
+ zip->bzstream.avail_out = (uint32_t)zip->uncompressed_buffer_size;
zip->bzstream.total_out_hi32 = 0;
zip->bzstream.total_out_lo32 = 0;
@@ -2227,7 +2227,7 @@ zip_read_data_zipx_bzip2(struct archive_read *a, const void **buff,
to_consume = zip->bzstream.total_in_lo32;
__archive_read_consume(a, to_consume);
- total_out = ((uint64_t) zip->bzstream.total_out_hi32 << 32) +
+ total_out = ((uint64_t) zip->bzstream.total_out_hi32 << 32) |
zip->bzstream.total_out_lo32;
zip->entry_bytes_remaining -= to_consume;
diff --git a/Utilities/cmlibarchive/libarchive/archive_string.c b/Utilities/cmlibarchive/libarchive/archive_string.c
index 69458e1..accf526 100644
--- a/Utilities/cmlibarchive/libarchive/archive_string.c
+++ b/Utilities/cmlibarchive/libarchive/archive_string.c
@@ -1324,6 +1324,10 @@ free_sconv_object(struct archive_string_conv *sc)
}
#if defined(_WIN32) && !defined(__CYGWIN__)
+# if defined(WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+# define GetOEMCP() CP_OEMCP
+# endif
+
static unsigned
my_atoi(const char *p)
{
diff --git a/Utilities/cmlibarchive/libarchive/archive_util.c b/Utilities/cmlibarchive/libarchive/archive_util.c
index 83586b5..0680711 100644
--- a/Utilities/cmlibarchive/libarchive/archive_util.c
+++ b/Utilities/cmlibarchive/libarchive/archive_util.c
@@ -42,9 +42,20 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_util.c 201098 2009-12-28 02:58:1
#ifdef HAVE_STRING_H
#include <string.h>
#endif
-#if defined(HAVE_WINCRYPT_H) && !defined(__CYGWIN__)
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+/* don't use bcrypt when XP needs to be supported */
+#include <bcrypt.h>
+
+/* Common in other bcrypt implementations, but missing from VS2008. */
+#ifndef BCRYPT_SUCCESS
+#define BCRYPT_SUCCESS(r) ((NTSTATUS)(r) == STATUS_SUCCESS)
+#endif
+
+#elif defined(HAVE_WINCRYPT_H)
#include <wincrypt.h>
#endif
+#endif
#ifdef HAVE_ZLIB_H
#include <cm3p/zlib.h>
#endif
@@ -233,14 +244,16 @@ __archive_mktempx(const char *tmpdir, wchar_t *template)
L'm', L'n', L'o', L'p', L'q', L'r', L's', L't',
L'u', L'v', L'w', L'x', L'y', L'z'
};
- HCRYPTPROV hProv;
struct archive_wstring temp_name;
wchar_t *ws;
DWORD attr;
wchar_t *xp, *ep;
int fd;
-
- hProv = (HCRYPTPROV)NULL;
+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+ BCRYPT_ALG_HANDLE hAlg = NULL;
+#else
+ HCRYPTPROV hProv = (HCRYPTPROV)NULL;
+#endif
fd = -1;
ws = NULL;
@@ -314,23 +327,42 @@ __archive_mktempx(const char *tmpdir, wchar_t *template)
abort();
}
+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+ if (!BCRYPT_SUCCESS(BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_RNG_ALGORITHM,
+ NULL, 0))) {
+ la_dosmaperr(GetLastError());
+ goto exit_tmpfile;
+ }
+#else
if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT)) {
la_dosmaperr(GetLastError());
goto exit_tmpfile;
}
+#endif
for (;;) {
wchar_t *p;
HANDLE h;
+# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ CREATEFILE2_EXTENDED_PARAMETERS createExParams;
+#endif
/* Generate a random file name through CryptGenRandom(). */
p = xp;
+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+ if (!BCRYPT_SUCCESS(BCryptGenRandom(hAlg, (PUCHAR)p,
+ (DWORD)(ep - p)*sizeof(wchar_t), 0))) {
+ la_dosmaperr(GetLastError());
+ goto exit_tmpfile;
+ }
+#else
if (!CryptGenRandom(hProv, (DWORD)(ep - p)*sizeof(wchar_t),
(BYTE*)p)) {
la_dosmaperr(GetLastError());
goto exit_tmpfile;
}
+#endif
for (; p < ep; p++)
*p = num[((DWORD)*p) % (sizeof(num)/sizeof(num[0]))];
@@ -347,6 +379,17 @@ __archive_mktempx(const char *tmpdir, wchar_t *template)
/* mkstemp */
attr = FILE_ATTRIBUTE_NORMAL;
}
+# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ ZeroMemory(&createExParams, sizeof(createExParams));
+ createExParams.dwSize = sizeof(createExParams);
+ createExParams.dwFileAttributes = attr & 0xFFFF;
+ createExParams.dwFileFlags = attr & 0xFFF00000;
+ h = CreateFile2(ws,
+ GENERIC_READ | GENERIC_WRITE | DELETE,
+ 0,/* Not share */
+ CREATE_NEW,
+ &createExParams);
+#else
h = CreateFileW(ws,
GENERIC_READ | GENERIC_WRITE | DELETE,
0,/* Not share */
@@ -354,6 +397,7 @@ __archive_mktempx(const char *tmpdir, wchar_t *template)
CREATE_NEW,/* Create a new file only */
attr,
NULL);
+#endif
if (h == INVALID_HANDLE_VALUE) {
/* The same file already exists. retry with
* a new filename. */
@@ -372,8 +416,13 @@ __archive_mktempx(const char *tmpdir, wchar_t *template)
break;/* success! */
}
exit_tmpfile:
+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+ if (hAlg != NULL)
+ BCryptCloseAlgorithmProvider(hAlg, 0);
+#else
if (hProv != (HCRYPTPROV)NULL)
CryptReleaseContext(hProv, 0);
+#endif
free(ws);
if (template == temp_name.s)
archive_wstring_free(&temp_name);
diff --git a/Utilities/cmlibarchive/libarchive/archive_windows.c b/Utilities/cmlibarchive/libarchive/archive_windows.c
index 624e270..ebc5eef 100644
--- a/Utilities/cmlibarchive/libarchive/archive_windows.c
+++ b/Utilities/cmlibarchive/libarchive/archive_windows.c
@@ -234,7 +234,11 @@ la_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode,
{
wchar_t *wpath;
HANDLE handle;
+# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ CREATEFILE2_EXTENDED_PARAMETERS createExParams;
+#endif
+#if !defined(WINAPI_FAMILY_PARTITION) || WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
handle = CreateFileA(path, dwDesiredAccess, dwShareMode,
lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes,
hTemplateFile);
@@ -242,12 +246,25 @@ la_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode,
return (handle);
if (GetLastError() != ERROR_PATH_NOT_FOUND)
return (handle);
+#endif
wpath = __la_win_permissive_name(path);
if (wpath == NULL)
- return (handle);
+ return INVALID_HANDLE_VALUE;
+# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ ZeroMemory(&createExParams, sizeof(createExParams));
+ createExParams.dwSize = sizeof(createExParams);
+ createExParams.dwFileAttributes = dwFlagsAndAttributes & 0xFFFF;
+ createExParams.dwFileFlags = dwFlagsAndAttributes & 0xFFF00000;
+ createExParams.dwSecurityQosFlags = dwFlagsAndAttributes & 0x000F00000;
+ createExParams.lpSecurityAttributes = lpSecurityAttributes;
+ createExParams.hTemplateFile = hTemplateFile;
+ handle = CreateFile2(wpath, dwDesiredAccess, dwShareMode,
+ dwCreationDisposition, &createExParams);
+#else /* !WINAPI_PARTITION_DESKTOP */
handle = CreateFileW(wpath, dwDesiredAccess, dwShareMode,
lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes,
hTemplateFile);
+#endif /* !WINAPI_PARTITION_DESKTOP */
free(wpath);
return (handle);
}
@@ -305,7 +322,10 @@ __la_open(const char *path, int flags, ...)
* "Permission denied" error.
*/
attr = GetFileAttributesA(path);
- if (attr == (DWORD)-1 && GetLastError() == ERROR_PATH_NOT_FOUND) {
+#if !defined(WINAPI_FAMILY_PARTITION) || WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+ if (attr == (DWORD)-1 && GetLastError() == ERROR_PATH_NOT_FOUND)
+#endif
+ {
ws = __la_win_permissive_name(path);
if (ws == NULL) {
errno = EINVAL;
@@ -320,7 +340,7 @@ __la_open(const char *path, int flags, ...)
}
if (attr & FILE_ATTRIBUTE_DIRECTORY) {
HANDLE handle;
-
+#if !defined(WINAPI_FAMILY_PARTITION) || WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
if (ws != NULL)
handle = CreateFileW(ws, 0, 0, NULL,
OPEN_EXISTING,
@@ -333,6 +353,15 @@ __la_open(const char *path, int flags, ...)
FILE_FLAG_BACKUP_SEMANTICS |
FILE_ATTRIBUTE_READONLY,
NULL);
+#else /* !WINAPI_PARTITION_DESKTOP */
+ CREATEFILE2_EXTENDED_PARAMETERS createExParams;
+ ZeroMemory(&createExParams, sizeof(createExParams));
+ createExParams.dwSize = sizeof(createExParams);
+ createExParams.dwFileAttributes = FILE_ATTRIBUTE_READONLY;
+ createExParams.dwFileFlags = FILE_FLAG_BACKUP_SEMANTICS;
+ handle = CreateFile2(ws, 0, 0,
+ OPEN_EXISTING, &createExParams);
+#endif /* !WINAPI_PARTITION_DESKTOP */
free(ws);
if (handle == INVALID_HANDLE_VALUE) {
la_dosmaperr(GetLastError());
diff --git a/Utilities/cmlibarchive/libarchive/archive_write.c b/Utilities/cmlibarchive/libarchive/archive_write.c
index 27626b5..ec3c95c 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write.c
@@ -310,6 +310,25 @@ __archive_write_output(struct archive_write *a, const void *buff, size_t length)
return (__archive_write_filter(a->filter_first, buff, length));
}
+static int
+__archive_write_filters_flush(struct archive_write *a)
+{
+ struct archive_write_filter *f;
+ int ret, ret1;
+
+ ret = ARCHIVE_OK;
+ for (f = a->filter_first; f != NULL; f = f->next_filter) {
+ if (f->flush != NULL && f->bytes_written > 0) {
+ ret1 = (f->flush)(f);
+ if (ret1 < ret)
+ ret = ret1;
+ if (ret1 < ARCHIVE_WARN)
+ f->state = ARCHIVE_WRITE_FILTER_STATE_FATAL;
+ }
+ }
+ return (ret);
+}
+
int
__archive_write_nulls(struct archive_write *a, size_t length)
{
@@ -740,6 +759,18 @@ _archive_write_header(struct archive *_a, struct archive_entry *entry)
return (ARCHIVE_FAILED);
}
+ /* Flush filters at boundary. */
+ r2 = __archive_write_filters_flush(a);
+ if (r2 == ARCHIVE_FAILED) {
+ return (ARCHIVE_FAILED);
+ }
+ if (r2 == ARCHIVE_FATAL) {
+ a->archive.state = ARCHIVE_STATE_FATAL;
+ return (ARCHIVE_FATAL);
+ }
+ if (r2 < ret)
+ ret = r2;
+
/* Format and write header. */
r2 = ((a->format_write_header)(a, entry));
if (r2 == ARCHIVE_FAILED) {
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_bzip2.c b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_bzip2.c
index 0637e96..9c2144a 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_bzip2.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_bzip2.c
@@ -190,7 +190,7 @@ archive_compressor_bzip2_open(struct archive_write_filter *f)
memset(&data->stream, 0, sizeof(data->stream));
data->stream.next_out = data->compressed;
- data->stream.avail_out = data->compressed_buffer_size;
+ data->stream.avail_out = (uint32_t)data->compressed_buffer_size;
f->write = archive_compressor_bzip2_write;
/* Initialize compression library */
@@ -244,7 +244,7 @@ archive_compressor_bzip2_write(struct archive_write_filter *f,
/* Compress input data to output buffer */
SET_NEXT_IN(data, buff);
- data->stream.avail_in = length;
+ data->stream.avail_in = (uint32_t)length;
if (drive_compressor(f, data, 0))
return (ARCHIVE_FATAL);
return (ARCHIVE_OK);
@@ -313,7 +313,7 @@ drive_compressor(struct archive_write_filter *f,
return (ARCHIVE_FATAL);
}
data->stream.next_out = data->compressed;
- data->stream.avail_out = data->compressed_buffer_size;
+ data->stream.avail_out = (uint32_t)data->compressed_buffer_size;
}
/* If there's nothing to do, we're done. */
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_compress.c b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_compress.c
index d404fae..3ed269f 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_compress.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_compress.c
@@ -352,7 +352,7 @@ archive_compressor_compress_write(struct archive_write_filter *f,
while (length--) {
c = *bp++;
state->in_count++;
- state->cur_fcode = (c << 16) + state->cur_code;
+ state->cur_fcode = (c << 16) | state->cur_code;
i = ((c << HSHIFT) ^ state->cur_code); /* Xor hashing. */
if (state->hashtab[i] == state->cur_fcode) {
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_lz4.c b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_lz4.c
index cf19fad..6ac4503 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_lz4.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_lz4.c
@@ -518,10 +518,10 @@ drive_compressor_independence(struct archive_write_filter *f, const char *p,
} else {
/* The buffer is not compressed. The compressed size was
* bigger than its uncompressed size. */
- archive_le32enc(data->out, length | 0x80000000);
+ archive_le32enc(data->out, (uint32_t)(length | 0x80000000));
data->out += 4;
memcpy(data->out, p, length);
- outsize = length;
+ outsize = (uint32_t)length;
}
data->out += outsize;
if (data->block_checksum) {
@@ -603,10 +603,10 @@ drive_compressor_dependence(struct archive_write_filter *f, const char *p,
} else {
/* The buffer is not compressed. The compressed size was
* bigger than its uncompressed size. */
- archive_le32enc(data->out, length | 0x80000000);
+ archive_le32enc(data->out, (uint32_t)(length | 0x80000000));
data->out += 4;
memcpy(data->out, p, length);
- outsize = length;
+ outsize = (uint32_t)length;
}
data->out += outsize;
if (data->block_checksum) {
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_zstd.c b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_zstd.c
index 7d36d58..3d6b3d1 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_zstd.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_zstd.c
@@ -31,6 +31,9 @@ __FBSDID("$FreeBSD$");
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
@@ -50,10 +53,22 @@ __FBSDID("$FreeBSD$");
struct private_data {
int compression_level;
- int threads;
+ int threads;
+ int long_distance;
#if HAVE_ZSTD_H && HAVE_LIBZSTD_COMPRESSOR
+ enum {
+ running,
+ finishing,
+ resetting,
+ } state;
+ int frame_per_file;
+ size_t min_frame_size;
+ size_t max_frame_size;
+ size_t cur_frame;
+ size_t cur_frame_in;
+ size_t cur_frame_out;
+ size_t total_in;
ZSTD_CStream *cstream;
- int64_t total_in;
ZSTD_outBuffer out;
#else
struct archive_write_program_data *pdata;
@@ -67,14 +82,18 @@ struct private_data {
#define CLEVEL_STD_MAX 19 /* without using --ultra */
#define CLEVEL_MAX 22
+#define LONG_STD 27
+
#define MINVER_NEGCLEVEL 10304
#define MINVER_MINCLEVEL 10306
+#define MINVER_LONG 10302
static int archive_compressor_zstd_options(struct archive_write_filter *,
const char *, const char *);
static int archive_compressor_zstd_open(struct archive_write_filter *);
static int archive_compressor_zstd_write(struct archive_write_filter *,
const void *, size_t);
+static int archive_compressor_zstd_flush(struct archive_write_filter *);
static int archive_compressor_zstd_close(struct archive_write_filter *);
static int archive_compressor_zstd_free(struct archive_write_filter *);
#if HAVE_ZSTD_H && HAVE_LIBZSTD_COMPRESSOR
@@ -103,13 +122,20 @@ archive_write_add_filter_zstd(struct archive *_a)
f->data = data;
f->open = &archive_compressor_zstd_open;
f->options = &archive_compressor_zstd_options;
+ f->flush = &archive_compressor_zstd_flush;
f->close = &archive_compressor_zstd_close;
f->free = &archive_compressor_zstd_free;
f->code = ARCHIVE_FILTER_ZSTD;
f->name = "zstd";
data->compression_level = CLEVEL_DEFAULT;
data->threads = 0;
+ data->long_distance = 0;
#if HAVE_ZSTD_H && HAVE_LIBZSTD_COMPRESSOR
+ data->frame_per_file = 0;
+ data->min_frame_size = 0;
+ data->max_frame_size = SIZE_MAX;
+ data->cur_frame_in = 0;
+ data->cur_frame_out = 0;
data->cstream = ZSTD_createCStream();
if (data->cstream == NULL) {
free(data);
@@ -147,29 +173,18 @@ archive_compressor_zstd_free(struct archive_write_filter *f)
return (ARCHIVE_OK);
}
-static int string_is_numeric (const char* value)
+static int string_to_number(const char *string, intmax_t *numberp)
{
- size_t len = strlen(value);
- size_t i;
-
- if (len == 0) {
- return (ARCHIVE_WARN);
- }
- else if (len == 1 && !(value[0] >= '0' && value[0] <= '9')) {
- return (ARCHIVE_WARN);
- }
- else if (!(value[0] >= '0' && value[0] <= '9') &&
- value[0] != '-' && value[0] != '+') {
- return (ARCHIVE_WARN);
- }
-
- for (i = 1; i < len; i++) {
- if (!(value[i] >= '0' && value[i] <= '9')) {
- return (ARCHIVE_WARN);
- }
- }
-
- return (ARCHIVE_OK);
+ char *end;
+
+ if (string == NULL || *string == '\0')
+ return (ARCHIVE_WARN);
+ *numberp = strtoimax(string, &end, 10);
+ if (end == string || *end != '\0' || errno == EOVERFLOW) {
+ *numberp = 0;
+ return (ARCHIVE_WARN);
+ }
+ return (ARCHIVE_OK);
}
/*
@@ -182,13 +197,13 @@ archive_compressor_zstd_options(struct archive_write_filter *f, const char *key,
struct private_data *data = (struct private_data *)f->data;
if (strcmp(key, "compression-level") == 0) {
- int level = atoi(value);
+ intmax_t level;
+ if (string_to_number(value, &level) != ARCHIVE_OK) {
+ return (ARCHIVE_WARN);
+ }
/* If we don't have the library, hard-code the max level */
int minimum = CLEVEL_MIN;
int maximum = CLEVEL_MAX;
- if (string_is_numeric(value) != ARCHIVE_OK) {
- return (ARCHIVE_WARN);
- }
#if HAVE_ZSTD_H && HAVE_LIBZSTD_COMPRESSOR
maximum = ZSTD_maxCLevel();
#if ZSTD_VERSION_NUMBER >= MINVER_MINCLEVEL
@@ -204,21 +219,65 @@ archive_compressor_zstd_options(struct archive_write_filter *f, const char *key,
if (level < minimum || level > maximum) {
return (ARCHIVE_WARN);
}
- data->compression_level = level;
+ data->compression_level = (int)level;
return (ARCHIVE_OK);
} else if (strcmp(key, "threads") == 0) {
- int threads = atoi(value);
- if (string_is_numeric(value) != ARCHIVE_OK) {
+ intmax_t threads;
+ if (string_to_number(value, &threads) != ARCHIVE_OK) {
return (ARCHIVE_WARN);
}
-
- int minimum = 0;
-
- if (threads < minimum) {
+ if (threads < 0) {
return (ARCHIVE_WARN);
}
-
- data->threads = threads;
+ data->threads = (int)threads;
+ return (ARCHIVE_OK);
+#if HAVE_ZSTD_H && HAVE_LIBZSTD_COMPRESSOR
+ } else if (strcmp(key, "frame-per-file") == 0) {
+ data->frame_per_file = 1;
+ return (ARCHIVE_OK);
+ } else if (strcmp(key, "min-frame-size") == 0) {
+ intmax_t min_frame_size;
+ if (string_to_number(value, &min_frame_size) != ARCHIVE_OK) {
+ return (ARCHIVE_WARN);
+ }
+ if (min_frame_size < 0) {
+ return (ARCHIVE_WARN);
+ }
+ data->min_frame_size = min_frame_size;
+ return (ARCHIVE_OK);
+ } else if (strcmp(key, "max-frame-size") == 0) {
+ intmax_t max_frame_size;
+ if (string_to_number(value, &max_frame_size) != ARCHIVE_OK) {
+ return (ARCHIVE_WARN);
+ }
+ if (max_frame_size < 1024) {
+ return (ARCHIVE_WARN);
+ }
+ data->max_frame_size = max_frame_size;
+ return (ARCHIVE_OK);
+#endif
+ }
+ else if (strcmp(key, "long") == 0) {
+ intmax_t long_distance;
+ if (string_to_number(value, &long_distance) != ARCHIVE_OK) {
+ return (ARCHIVE_WARN);
+ }
+#if HAVE_ZSTD_H && HAVE_LIBZSTD_COMPRESSOR && ZSTD_VERSION_NUMBER >= MINVER_LONG
+ ZSTD_bounds bounds = ZSTD_cParam_getBounds(ZSTD_c_windowLog);
+ if (ZSTD_isError(bounds.error)) {
+ int max_distance = ((int)(sizeof(size_t) == 4 ? 30 : 31));
+ if (((int)long_distance) < 10 || (int)long_distance > max_distance)
+ return (ARCHIVE_WARN);
+ } else {
+ if ((int)long_distance < bounds.lowerBound || (int)long_distance > bounds.upperBound)
+ return (ARCHIVE_WARN);
+ }
+#else
+ int max_distance = ((int)(sizeof(size_t) == 4 ? 30 : 31));
+ if (((int)long_distance) < 10 || (int)long_distance > max_distance)
+ return (ARCHIVE_WARN);
+#endif
+ data->long_distance = (int)long_distance;
return (ARCHIVE_OK);
}
@@ -270,6 +329,10 @@ archive_compressor_zstd_open(struct archive_write_filter *f)
ZSTD_CCtx_setParameter(data->cstream, ZSTD_c_nbWorkers, data->threads);
+#if ZSTD_VERSION_NUMBER >= MINVER_LONG
+ ZSTD_CCtx_setParameter(data->cstream, ZSTD_c_windowLog, data->long_distance);
+#endif
+
return (ARCHIVE_OK);
}
@@ -281,15 +344,22 @@ archive_compressor_zstd_write(struct archive_write_filter *f, const void *buff,
size_t length)
{
struct private_data *data = (struct private_data *)f->data;
- int ret;
- /* Update statistics */
- data->total_in += length;
+ return (drive_compressor(f, data, 0, buff, length));
+}
- if ((ret = drive_compressor(f, data, 0, buff, length)) != ARCHIVE_OK)
- return (ret);
+/*
+ * Flush the compressed stream.
+ */
+static int
+archive_compressor_zstd_flush(struct archive_write_filter *f)
+{
+ struct private_data *data = (struct private_data *)f->data;
- return (ARCHIVE_OK);
+ if (data->frame_per_file && data->state == running &&
+ data->cur_frame_out > data->min_frame_size)
+ data->state = finishing;
+ return (drive_compressor(f, data, 1, NULL, 0));
}
/*
@@ -300,57 +370,72 @@ archive_compressor_zstd_close(struct archive_write_filter *f)
{
struct private_data *data = (struct private_data *)f->data;
- /* Finish zstd frame */
- return drive_compressor(f, data, 1, NULL, 0);
+ if (data->state == running)
+ data->state = finishing;
+ return (drive_compressor(f, data, 1, NULL, 0));
}
/*
* Utility function to push input data through compressor,
* writing full output blocks as necessary.
- *
- * Note that this handles both the regular write case (finishing ==
- * false) and the end-of-archive case (finishing == true).
*/
static int
drive_compressor(struct archive_write_filter *f,
- struct private_data *data, int finishing, const void *src, size_t length)
+ struct private_data *data, int flush, const void *src, size_t length)
{
- ZSTD_inBuffer in = (ZSTD_inBuffer) { src, length, 0 };
+ ZSTD_inBuffer in = { .src = src, .size = length, .pos = 0 };
+ size_t ipos, opos, zstdret = 0;
+ int ret;
for (;;) {
- if (data->out.pos == data->out.size) {
- const int ret = __archive_write_filter(f->next_filter,
- data->out.dst, data->out.size);
+ ipos = in.pos;
+ opos = data->out.pos;
+ switch (data->state) {
+ case running:
+ if (in.pos == in.size)
+ return (ARCHIVE_OK);
+ zstdret = ZSTD_compressStream(data->cstream,
+ &data->out, &in);
+ if (ZSTD_isError(zstdret))
+ goto zstd_fatal;
+ break;
+ case finishing:
+ zstdret = ZSTD_endStream(data->cstream, &data->out);
+ if (ZSTD_isError(zstdret))
+ goto zstd_fatal;
+ if (zstdret == 0)
+ data->state = resetting;
+ break;
+ case resetting:
+ ZSTD_CCtx_reset(data->cstream, ZSTD_reset_session_only);
+ data->cur_frame++;
+ data->cur_frame_in = 0;
+ data->cur_frame_out = 0;
+ data->state = running;
+ break;
+ }
+ data->total_in += in.pos - ipos;
+ data->cur_frame_in += in.pos - ipos;
+ data->cur_frame_out += data->out.pos - opos;
+ if (data->state == running &&
+ data->cur_frame_in >= data->max_frame_size) {
+ data->state = finishing;
+ }
+ if (data->out.pos == data->out.size ||
+ (flush && data->out.pos > 0)) {
+ ret = __archive_write_filter(f->next_filter,
+ data->out.dst, data->out.pos);
if (ret != ARCHIVE_OK)
- return (ARCHIVE_FATAL);
+ goto fatal;
data->out.pos = 0;
}
-
- /* If there's nothing to do, we're done. */
- if (!finishing && in.pos == in.size)
- return (ARCHIVE_OK);
-
- {
- const size_t zstdret = !finishing ?
- ZSTD_compressStream(data->cstream, &data->out, &in)
- : ZSTD_endStream(data->cstream, &data->out);
-
- if (ZSTD_isError(zstdret)) {
- archive_set_error(f->archive,
- ARCHIVE_ERRNO_MISC,
- "Zstd compression failed: %s",
- ZSTD_getErrorName(zstdret));
- return (ARCHIVE_FATAL);
- }
-
- /* If we're finishing, 0 means nothing left to flush */
- if (finishing && zstdret == 0) {
- const int ret = __archive_write_filter(f->next_filter,
- data->out.dst, data->out.pos);
- return (ret);
- }
- }
}
+zstd_fatal:
+ archive_set_error(f->archive, ARCHIVE_ERRNO_MISC,
+ "Zstd compression failed: %s",
+ ZSTD_getErrorName(zstdret));
+fatal:
+ return (ARCHIVE_FATAL);
}
#else /* HAVE_ZSTD_H && HAVE_LIBZSTD_COMPRESSOR */
@@ -367,17 +452,9 @@ archive_compressor_zstd_open(struct archive_write_filter *f)
archive_strcpy(&as, "zstd --no-check");
if (data->compression_level < CLEVEL_STD_MIN) {
- struct archive_string as2;
- archive_string_init(&as2);
- archive_string_sprintf(&as2, " --fast=%d", -data->compression_level);
- archive_string_concat(&as, &as2);
- archive_string_free(&as2);
+ archive_string_sprintf(&as, " --fast=%d", -data->compression_level);
} else {
- struct archive_string as2;
- archive_string_init(&as2);
- archive_string_sprintf(&as2, " -%d", data->compression_level);
- archive_string_concat(&as, &as2);
- archive_string_free(&as2);
+ archive_string_sprintf(&as, " -%d", data->compression_level);
}
if (data->compression_level > CLEVEL_STD_MAX) {
@@ -385,11 +462,11 @@ archive_compressor_zstd_open(struct archive_write_filter *f)
}
if (data->threads != 0) {
- struct archive_string as2;
- archive_string_init(&as2);
- archive_string_sprintf(&as2, " --threads=%d", data->threads);
- archive_string_concat(&as, &as2);
- archive_string_free(&as2);
+ archive_string_sprintf(&as, " --threads=%d", data->threads);
+ }
+
+ if (data->long_distance != 0) {
+ archive_string_sprintf(&as, " --long=%d", data->long_distance);
}
f->write = archive_compressor_zstd_write;
@@ -408,6 +485,14 @@ archive_compressor_zstd_write(struct archive_write_filter *f, const void *buff,
}
static int
+archive_compressor_zstd_flush(struct archive_write_filter *f)
+{
+ (void)f; /* UNUSED */
+
+ return (ARCHIVE_OK);
+}
+
+static int
archive_compressor_zstd_close(struct archive_write_filter *f)
{
struct private_data *data = (struct private_data *)f->data;
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c b/Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c
index bd5180e..d676ed6 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c
@@ -397,6 +397,7 @@ static int set_times_from_entry(struct archive_write_disk *);
static struct fixup_entry *sort_dir_list(struct fixup_entry *p);
static ssize_t write_data_block(struct archive_write_disk *,
const char *, size_t);
+static void close_file_descriptor(struct archive_write_disk *);
static int _archive_write_disk_close(struct archive *);
static int _archive_write_disk_free(struct archive *);
@@ -514,7 +515,12 @@ lazy_stat(struct archive_write_disk *a)
* XXX At this point, symlinks should not be hit, otherwise
* XXX a race occurred. Do we want to check explicitly for that?
*/
- if (lstat(a->name, &a->st) == 0) {
+#ifdef HAVE_LSTAT
+ if (lstat(a->name, &a->st) == 0)
+#else
+ if (la_stat(a->name, &a->st) == 0)
+#endif
+ {
a->pst = &a->st;
return (ARCHIVE_OK);
}
@@ -1605,12 +1611,12 @@ hfs_write_data_block(struct archive_write_disk *a, const char *buff,
"Seek failed");
return (ARCHIVE_FATAL);
} else if (a->offset > a->fd_offset) {
- int64_t skip = a->offset - a->fd_offset;
+ uint64_t skip = a->offset - a->fd_offset;
char nullblock[1024];
memset(nullblock, 0, sizeof(nullblock));
while (skip > 0) {
- if (skip > (int64_t)sizeof(nullblock))
+ if (skip > sizeof(nullblock))
bytes_written = hfs_write_decmpfs_block(
a, nullblock, sizeof(nullblock));
else
@@ -1725,8 +1731,10 @@ _archive_write_disk_finish_entry(struct archive *_a)
else
r = hfs_write_data_block(
a, null_d, a->file_remaining_bytes);
- if (r < 0)
+ if (r < 0) {
+ close_file_descriptor(a);
return ((int)r);
+ }
}
#endif
} else {
@@ -1735,6 +1743,7 @@ _archive_write_disk_finish_entry(struct archive *_a)
a->filesize == 0) {
archive_set_error(&a->archive, errno,
"File size could not be restored");
+ close_file_descriptor(a);
return (ARCHIVE_FAILED);
}
#endif
@@ -1744,8 +1753,10 @@ _archive_write_disk_finish_entry(struct archive *_a)
* to see what happened.
*/
a->pst = NULL;
- if ((ret = lazy_stat(a)) != ARCHIVE_OK)
- return (ret);
+ if ((ret = lazy_stat(a)) != ARCHIVE_OK) {
+ close_file_descriptor(a);
+ return (ret);
+ }
/* We can use lseek()/write() to extend the file if
* ftruncate didn't work or isn't available. */
if (a->st.st_size < a->filesize) {
@@ -1753,11 +1764,13 @@ _archive_write_disk_finish_entry(struct archive *_a)
if (lseek(a->fd, a->filesize - 1, SEEK_SET) < 0) {
archive_set_error(&a->archive, errno,
"Seek failed");
+ close_file_descriptor(a);
return (ARCHIVE_FATAL);
}
if (write(a->fd, &nul, 1) < 0) {
archive_set_error(&a->archive, errno,
"Write to restore size failed");
+ close_file_descriptor(a);
return (ARCHIVE_FATAL);
}
a->pst = NULL;
@@ -2154,7 +2167,11 @@ restore_entry(struct archive_write_disk *a)
* then don't follow it.
*/
if (r != 0 || !S_ISDIR(a->mode))
+#ifdef HAVE_LSTAT
r = lstat(a->name, &a->st);
+#else
+ r = la_stat(a->name, &a->st);
+#endif
if (r != 0) {
archive_set_error(&a->archive, errno,
"Can't stat existing object");
@@ -2550,7 +2567,12 @@ _archive_write_disk_close(struct archive *_a)
goto skip_fixup_entry;
} else
#endif
- if (lstat(p->name, &st) != 0 ||
+ if (
+#ifdef HAVE_LSTAT
+ lstat(p->name, &st) != 0 ||
+#else
+ la_stat(p->name, &st) != 0 ||
+#endif
la_verify_filetype(st.st_mode,
p->filetype) == 0) {
goto skip_fixup_entry;
@@ -2565,7 +2587,12 @@ _archive_write_disk_close(struct archive *_a)
goto skip_fixup_entry;
} else
#endif
- if (lstat(p->name, &st) != 0 ||
+ if (
+#ifdef HAVE_LSTAT
+ lstat(p->name, &st) != 0 ||
+#else
+ la_stat(p->name, &st) != 0 ||
+#endif
la_verify_filetype(st.st_mode,
p->filetype) == 0) {
goto skip_fixup_entry;
@@ -2785,8 +2812,8 @@ check_symlinks_fsobj(char *path, int *a_eno, struct archive_string *a_estr,
!(defined(HAVE_OPENAT) && defined(HAVE_FSTATAT) && defined(HAVE_UNLINKAT))
/* Platform doesn't have lstat, so we can't look for symlinks. */
(void)path; /* UNUSED */
- (void)error_number; /* UNUSED */
- (void)error_string; /* UNUSED */
+ (void)a_eno; /* UNUSED */
+ (void)a_estr; /* UNUSED */
(void)flags; /* UNUSED */
(void)checking_linkname; /* UNUSED */
return (ARCHIVE_OK);
@@ -2859,8 +2886,10 @@ check_symlinks_fsobj(char *path, int *a_eno, struct archive_string *a_estr,
/* Check that we haven't hit a symlink. */
#if defined(HAVE_OPENAT) && defined(HAVE_FSTATAT) && defined(HAVE_UNLINKAT)
r = fstatat(chdir_fd, head, &st, AT_SYMLINK_NOFOLLOW);
-#else
+#elif defined(HAVE_LSTAT)
r = lstat(head, &st);
+#else
+ r = la_stat(head, &st);
#endif
if (r != 0) {
tail[0] = c;
@@ -3558,7 +3587,9 @@ set_time(int fd, int mode, const char *name,
(void)fd; /* UNUSED */
(void)mode; /* UNUSED */
(void)name; /* UNUSED */
+ (void)atime; /* UNUSED */
(void)atime_nsec; /* UNUSED */
+ (void)mtime; /* UNUSED */
(void)mtime_nsec; /* UNUSED */
return (ARCHIVE_WARN);
#endif
@@ -4391,7 +4422,12 @@ fixup_appledouble(struct archive_write_disk *a, const char *pathname)
*/
archive_strncpy(&datafork, pathname, p - pathname);
archive_strcat(&datafork, p + 2);
- if (lstat(datafork.s, &st) == -1 ||
+ if (
+#ifdef HAVE_LSTAT
+ lstat(datafork.s, &st) == -1 ||
+#else
+ la_stat(datafork.s, &st) == -1 ||
+#endif
(st.st_mode & AE_IFMT) != AE_IFREG)
goto skip_appledouble;
@@ -4707,5 +4743,17 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
}
#endif
+/*
+ * Close the file descriptor if one is open.
+ */
+static void close_file_descriptor(struct archive_write_disk* a)
+{
+ if (a->fd >= 0) {
+ close(a->fd);
+ a->fd = -1;
+ }
+}
+
+
#endif /* !_WIN32 || __CYGWIN__ */
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c b/Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c
index 88df3ce..7b9ea74 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c
@@ -254,9 +254,9 @@ static ssize_t _archive_write_disk_data_block(struct archive *, const void *,
* which is high-16-bits of nFileIndexHigh. */
#define bhfi_ino(bhfi) \
((((int64_t)((bhfi)->nFileIndexHigh & 0x0000FFFFUL)) << 32) \
- + (bhfi)->nFileIndexLow)
+ | (bhfi)->nFileIndexLow)
#define bhfi_size(bhfi) \
- ((((int64_t)(bhfi)->nFileSizeHigh) << 32) + (bhfi)->nFileSizeLow)
+ ((((int64_t)(bhfi)->nFileSizeHigh) << 32) | (bhfi)->nFileSizeLow)
static int
file_information(struct archive_write_disk *a, wchar_t *path,
@@ -266,6 +266,9 @@ file_information(struct archive_write_disk *a, wchar_t *path,
int r;
DWORD flag = FILE_FLAG_BACKUP_SEMANTICS;
WIN32_FIND_DATAW findData;
+# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ CREATEFILE2_EXTENDED_PARAMETERS createExParams;
+#endif
if (sim_lstat || mode != NULL) {
h = FindFirstFileW(path, &findData);
@@ -290,14 +293,27 @@ file_information(struct archive_write_disk *a, wchar_t *path,
(findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK)))
flag |= FILE_FLAG_OPEN_REPARSE_POINT;
+# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ ZeroMemory(&createExParams, sizeof(createExParams));
+ createExParams.dwSize = sizeof(createExParams);
+ createExParams.dwFileFlags = flag;
+ h = CreateFile2(a->name, 0, 0,
+ OPEN_EXISTING, &createExParams);
+#else
h = CreateFileW(a->name, 0, 0, NULL,
OPEN_EXISTING, flag, NULL);
+#endif
if (h == INVALID_HANDLE_VALUE &&
GetLastError() == ERROR_INVALID_NAME) {
wchar_t *full;
full = __la_win_permissive_name_w(path);
+# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ h = CreateFile2(full, 0, 0,
+ OPEN_EXISTING, &createExParams);
+#else
h = CreateFileW(full, 0, 0, NULL,
OPEN_EXISTING, flag, NULL);
+#endif
free(full);
}
if (h == INVALID_HANDLE_VALUE) {
@@ -559,6 +575,7 @@ la_mktemp(struct archive_write_disk *a)
return (fd);
}
+#if _WIN32_WINNT < _WIN32_WINNT_VISTA
static void *
la_GetFunctionKernel32(const char *name)
{
@@ -574,18 +591,24 @@ la_GetFunctionKernel32(const char *name)
}
return (void *)GetProcAddress(lib, name);
}
+#endif
static int
la_CreateHardLinkW(wchar_t *linkname, wchar_t *target)
{
- static BOOLEAN (WINAPI *f)(LPWSTR, LPWSTR, LPSECURITY_ATTRIBUTES);
- static int set;
+ static BOOL (WINAPI *f)(LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES);
BOOL ret;
+#if _WIN32_WINNT < _WIN32_WINNT_XP
+ static int set;
+/* CreateHardLinkW is available since XP and always loaded */
if (!set) {
set = 1;
f = la_GetFunctionKernel32("CreateHardLinkW");
}
+#else
+ f = CreateHardLinkW;
+#endif
if (!f) {
errno = ENOTSUP;
return (0);
@@ -624,7 +647,6 @@ static int
la_CreateSymbolicLinkW(const wchar_t *linkname, const wchar_t *target,
int linktype) {
static BOOLEAN (WINAPI *f)(LPCWSTR, LPCWSTR, DWORD);
- static int set;
wchar_t *ttarget, *p;
size_t len;
DWORD attrs = 0;
@@ -632,10 +654,20 @@ la_CreateSymbolicLinkW(const wchar_t *linkname, const wchar_t *target,
DWORD newflags = 0;
BOOL ret = 0;
+#if _WIN32_WINNT < _WIN32_WINNT_VISTA
+/* CreateSymbolicLinkW is available since Vista and always loaded */
+ static int set;
if (!set) {
set = 1;
f = la_GetFunctionKernel32("CreateSymbolicLinkW");
}
+#else
+# if !defined(WINAPI_FAMILY_PARTITION) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+ f = CreateSymbolicLinkW;
+# else
+ f = NULL;
+# endif
+#endif
if (!f)
return (0);
@@ -1185,6 +1217,8 @@ _archive_write_disk_finish_entry(struct archive *_a)
if (la_ftruncate(a->fh, a->filesize) == -1) {
archive_set_error(&a->archive, errno,
"File size could not be restored");
+ CloseHandle(a->fh);
+ a->fh = INVALID_HANDLE_VALUE;
return (ARCHIVE_FAILED);
}
}
@@ -1656,6 +1690,9 @@ create_filesystem_object(struct archive_write_disk *a)
mode_t final_mode, mode;
int r;
DWORD attrs = 0;
+# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ CREATEFILE2_EXTENDED_PARAMETERS createExParams;
+#endif
/* We identify hard/symlinks according to the link names. */
/* Since link(2) and symlink(2) don't handle modes, we're done here. */
@@ -1719,8 +1756,16 @@ create_filesystem_object(struct archive_write_disk *a)
a->todo = 0;
a->deferred = 0;
} else if (r == 0 && a->filesize > 0) {
+# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ ZeroMemory(&createExParams, sizeof(createExParams));
+ createExParams.dwSize = sizeof(createExParams);
+ createExParams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
+ a->fh = CreateFile2(namefull, GENERIC_WRITE, 0,
+ TRUNCATE_EXISTING, &createExParams);
+#else
a->fh = CreateFileW(namefull, GENERIC_WRITE, 0, NULL,
TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+#endif
if (a->fh == INVALID_HANDLE_VALUE) {
la_dosmaperr(GetLastError());
r = errno;
@@ -1783,14 +1828,27 @@ create_filesystem_object(struct archive_write_disk *a)
a->tmpname = NULL;
fullname = a->name;
/* O_WRONLY | O_CREAT | O_EXCL */
+# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ ZeroMemory(&createExParams, sizeof(createExParams));
+ createExParams.dwSize = sizeof(createExParams);
+ createExParams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
+ a->fh = CreateFile2(fullname, GENERIC_WRITE, 0,
+ CREATE_NEW, &createExParams);
+#else
a->fh = CreateFileW(fullname, GENERIC_WRITE, 0, NULL,
CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
+#endif
if (a->fh == INVALID_HANDLE_VALUE &&
GetLastError() == ERROR_INVALID_NAME &&
fullname == a->name) {
fullname = __la_win_permissive_name_w(a->name);
+# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ a->fh = CreateFile2(fullname, GENERIC_WRITE, 0,
+ CREATE_NEW, &createExParams);
+#else
a->fh = CreateFileW(fullname, GENERIC_WRITE, 0, NULL,
CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
+#endif
}
if (a->fh == INVALID_HANDLE_VALUE) {
if (GetLastError() == ERROR_ACCESS_DENIED) {
@@ -2551,14 +2609,25 @@ set_times(struct archive_write_disk *a,
hw = NULL;
} else {
wchar_t *ws;
+# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ CREATEFILE2_EXTENDED_PARAMETERS createExParams;
+#endif
if (S_ISLNK(mode))
return (ARCHIVE_OK);
ws = __la_win_permissive_name_w(name);
if (ws == NULL)
goto settimes_failed;
+# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
+ ZeroMemory(&createExParams, sizeof(createExParams));
+ createExParams.dwSize = sizeof(createExParams);
+ createExParams.dwFileFlags = FILE_FLAG_BACKUP_SEMANTICS;
+ hw = CreateFile2(ws, FILE_WRITE_ATTRIBUTES, 0,
+ OPEN_EXISTING, &createExParams);
+#else
hw = CreateFileW(ws, FILE_WRITE_ATTRIBUTES,
0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
+#endif
free(ws);
if (hw == INVALID_HANDLE_VALUE)
goto settimes_failed;
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_private.h b/Utilities/cmlibarchive/libarchive/archive_write_private.h
index 155fdd7..6522e65 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_private.h
+++ b/Utilities/cmlibarchive/libarchive/archive_write_private.h
@@ -53,6 +53,7 @@ struct archive_write_filter {
const char *key, const char *value);
int (*open)(struct archive_write_filter *);
int (*write)(struct archive_write_filter *, const void *, size_t);
+ int (*flush)(struct archive_write_filter *);
int (*close)(struct archive_write_filter *);
int (*free)(struct archive_write_filter *);
void *data;
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c
index 87b3586..1d7249f 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c
@@ -91,6 +91,26 @@ __FBSDID("$FreeBSD$");
#define kAttributes 0x15
#define kEncodedHeader 0x17
+// Check that some windows file attribute constants are defined.
+// Reference: https://learn.microsoft.com/en-us/windows/win32/fileio/file-attribute-constants
+#ifndef FILE_ATTRIBUTE_READONLY
+#define FILE_ATTRIBUTE_READONLY 0x00000001
+#endif
+
+#ifndef FILE_ATTRIBUTE_DIRECTORY
+#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
+#endif
+
+#ifndef FILE_ATTRIBUTE_ARCHIVE
+#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
+#endif
+
+// This value is defined in 7zip with the comment "trick for Unix".
+//
+// 7z archives created on unix have this bit set in the high 16 bits of
+// the attr field along with the unix permissions.
+#define FILE_ATTRIBUTE_UNIX_EXTENSION 0x8000
+
enum la_zaction {
ARCHIVE_Z_FINISH,
ARCHIVE_Z_RUN
@@ -165,7 +185,7 @@ struct file {
mode_t mode;
uint32_t crc32;
- signed int dir:1;
+ unsigned dir:1;
};
struct _7zip {
@@ -1424,14 +1444,19 @@ make_header(struct archive_write *a, uint64_t offset, uint64_t pack_size,
* High 16bits is unix mode.
* Low 16bits is Windows attributes.
*/
- uint32_t encattr, attr;
+ uint32_t encattr, attr = 0;
+
if (file->dir)
- attr = 0x8010;
+ attr |= FILE_ATTRIBUTE_DIRECTORY;
else
- attr = 0x8020;
+ attr |= FILE_ATTRIBUTE_ARCHIVE;
+
if ((file->mode & 0222) == 0)
- attr |= 1;/* Read Only. */
+ attr |= FILE_ATTRIBUTE_READONLY;
+
+ attr |= FILE_ATTRIBUTE_UNIX_EXTENSION;
attr |= ((uint32_t)file->mode) << 16;
+
archive_le32enc(&encattr, attr);
r = (int)compress_out(a, &encattr, 4, ARCHIVE_Z_RUN);
if (r < 0)
@@ -1809,11 +1834,11 @@ compression_init_encoder_bzip2(struct archive *a,
* of ugly hackery to convert a const * pointer to
* a non-const pointer. */
strm->next_in = (char *)(uintptr_t)(const void *)lastrm->next_in;
- strm->avail_in = lastrm->avail_in;
+ strm->avail_in = (uint32_t)lastrm->avail_in;
strm->total_in_lo32 = (uint32_t)(lastrm->total_in & 0xffffffff);
strm->total_in_hi32 = (uint32_t)(lastrm->total_in >> 32);
strm->next_out = (char *)lastrm->next_out;
- strm->avail_out = lastrm->avail_out;
+ strm->avail_out = (uint32_t)lastrm->avail_out;
strm->total_out_lo32 = (uint32_t)(lastrm->total_out & 0xffffffff);
strm->total_out_hi32 = (uint32_t)(lastrm->total_out >> 32);
if (BZ2_bzCompressInit(strm, level, 0, 30) != BZ_OK) {
@@ -1842,11 +1867,11 @@ compression_code_bzip2(struct archive *a,
* of ugly hackery to convert a const * pointer to
* a non-const pointer. */
strm->next_in = (char *)(uintptr_t)(const void *)lastrm->next_in;
- strm->avail_in = lastrm->avail_in;
+ strm->avail_in = (uint32_t)lastrm->avail_in;
strm->total_in_lo32 = (uint32_t)(lastrm->total_in & 0xffffffff);
strm->total_in_hi32 = (uint32_t)(lastrm->total_in >> 32);
strm->next_out = (char *)lastrm->next_out;
- strm->avail_out = lastrm->avail_out;
+ strm->avail_out = (uint32_t)lastrm->avail_out;
strm->total_out_lo32 = (uint32_t)(lastrm->total_out & 0xffffffff);
strm->total_out_hi32 = (uint32_t)(lastrm->total_out >> 32);
r = BZ2_bzCompress(strm,
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c
index ebd33c5..1b03170 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c
@@ -293,12 +293,12 @@ struct isoent {
struct extr_rec *current;
} extr_rec_list;
- signed int virtual:1;
+ unsigned int virtual:1;
/* If set to one, this file type is a directory.
* A convenience flag to be used as
* "archive_entry_filetype(isoent->file->entry) == AE_IFDIR".
*/
- signed int dir:1;
+ unsigned int dir:1;
};
struct hardlink {
@@ -656,7 +656,7 @@ struct iso_option {
#define VOLUME_IDENTIFIER_SIZE 32
/*
- * Usage : !zisofs [DEFAULT]
+ * Usage : !zisofs [DEFAULT]
* : Disable to generate RRIP 'ZF' extension.
* : zisofs
* : Make files zisofs file and generate RRIP 'ZF'
@@ -693,7 +693,7 @@ struct iso9660 {
uint64_t bytes_remaining;
int need_multi_extent;
- /* Temporary string buffer for Joliet extension. */
+ /* Temporary string buffer for Joliet extension. */
struct archive_string utf16be;
struct archive_string mbs;
@@ -759,9 +759,9 @@ struct iso9660 {
/* Used for making zisofs. */
struct {
- signed int detect_magic:1;
- signed int making:1;
- signed int allzero:1;
+ unsigned int detect_magic:1;
+ unsigned int making:1;
+ unsigned int allzero:1;
unsigned char magic_buffer[64];
int magic_cnt;
@@ -2525,12 +2525,11 @@ get_gmoffset(struct tm *tm)
static void
get_tmfromtime(struct tm *tm, time_t *t)
{
-#if HAVE_LOCALTIME_R
+#if HAVE_LOCALTIME_S
+ localtime_s(tm, t);
+#elif HAVE_LOCALTIME_R
tzset();
localtime_r(t, tm);
-#elif HAVE__LOCALTIME64_S
- __time64_t tmp_t = (__time64_t) *t; //time_t may be shorter than 64 bits
- _localtime64_s(tm, &tmp_t);
#else
memcpy(tm, localtime(t), sizeof(*tm));
#endif
@@ -4078,11 +4077,8 @@ write_information_block(struct archive_write *a)
}
memset(info.s, 0, info_size);
opt = 0;
-#if defined(HAVE__CTIME64_S)
- {
- __time64_t iso9660_birth_time_tmp = (__time64_t) iso9660->birth_time; //time_t may be shorter than 64 bits
- _ctime64_s(buf, sizeof(buf), &(iso9660_birth_time_tmp));
- }
+#if defined(HAVE_CTIME_S)
+ ctime_s(buf, sizeof(buf), &(iso9660->birth_time));
#elif defined(HAVE_CTIME_R)
ctime_r(&(iso9660->birth_time), buf);
#else
@@ -7811,8 +7807,8 @@ struct zisofs_extract {
uint64_t pz_uncompressed_size;
size_t uncompressed_buffer_size;
- signed int initialized:1;
- signed int header_passed:1;
+ unsigned int initialized:1;
+ unsigned int header_passed:1;
uint32_t pz_offset;
unsigned char *block_pointers;
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_pax.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_pax.c
index cf1f477..1eb9a9a 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_pax.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_pax.c
@@ -100,6 +100,7 @@ static int has_non_ASCII(const char *);
static void sparse_list_clear(struct pax *);
static int sparse_list_add(struct pax *, int64_t, int64_t);
static char *url_encode(const char *in);
+static time_t get_ustar_max_mtime(void);
/*
* Set output format to 'restricted pax' format.
@@ -367,10 +368,12 @@ archive_write_pax_header_xattr(struct pax *pax, const char *encoded_name,
struct archive_string s;
char *encoded_value;
+ if (encoded_name == NULL)
+ return;
+
if (pax->flags & WRITE_LIBARCHIVE_XATTR) {
encoded_value = base64_encode((const char *)value, value_len);
-
- if (encoded_name != NULL && encoded_value != NULL) {
+ if (encoded_value != NULL) {
archive_string_init(&s);
archive_strcpy(&s, "LIBARCHIVE.xattr.");
archive_strcat(&s, encoded_name);
@@ -403,17 +406,22 @@ archive_write_pax_header_xattrs(struct archive_write *a,
archive_entry_xattr_next(entry, &name, &value, &size);
url_encoded_name = url_encode(name);
- if (url_encoded_name != NULL) {
+ if (url_encoded_name == NULL)
+ goto malloc_error;
+ else {
/* Convert narrow-character to UTF-8. */
r = archive_strcpy_l(&(pax->l_url_encoded_name),
url_encoded_name, pax->sconv_utf8);
free(url_encoded_name); /* Done with this. */
if (r == 0)
encoded_name = pax->l_url_encoded_name.s;
- else if (errno == ENOMEM) {
- archive_set_error(&a->archive, ENOMEM,
- "Can't allocate memory for Linkname");
- return (ARCHIVE_FATAL);
+ else if (r == -1)
+ goto malloc_error;
+ else {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_MISC,
+ "Error encoding pax extended attribute");
+ return (ARCHIVE_FAILED);
}
}
@@ -422,6 +430,9 @@ archive_write_pax_header_xattrs(struct archive_write *a,
}
return (ARCHIVE_OK);
+malloc_error:
+ archive_set_error(&a->archive, ENOMEM, "Can't allocate memory");
+ return (ARCHIVE_FATAL);
}
static int
@@ -595,6 +606,8 @@ archive_write_pax_header(struct archive_write *a,
need_extension = 0;
pax = (struct pax *)a->format_data;
+ const time_t ustar_max_mtime = get_ustar_max_mtime();
+
/* Sanity check. */
if (archive_entry_pathname(entry_original) == NULL) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
@@ -1116,16 +1129,13 @@ archive_write_pax_header(struct archive_write *a,
}
/*
- * Technically, the mtime field in the ustar header can
- * support 33 bits, but many platforms use signed 32-bit time
- * values. The cutoff of 0x7fffffff here is a compromise.
* Yes, this check is duplicated just below; this helps to
* avoid writing an mtime attribute just to handle a
* high-resolution timestamp in "restricted pax" mode.
*/
if (!need_extension &&
((archive_entry_mtime(entry_main) < 0)
- || (archive_entry_mtime(entry_main) >= 0x7fffffff)))
+ || (archive_entry_mtime(entry_main) >= ustar_max_mtime)))
need_extension = 1;
/* I use a star-compatible file flag attribute. */
@@ -1190,7 +1200,7 @@ archive_write_pax_header(struct archive_write *a,
if (a->archive.archive_format != ARCHIVE_FORMAT_TAR_PAX_RESTRICTED ||
need_extension) {
if (archive_entry_mtime(entry_main) < 0 ||
- archive_entry_mtime(entry_main) >= 0x7fffffff ||
+ archive_entry_mtime(entry_main) >= ustar_max_mtime ||
archive_entry_mtime_nsec(entry_main) != 0)
add_pax_attr_time(&(pax->pax_header), "mtime",
archive_entry_mtime(entry_main),
@@ -1428,7 +1438,7 @@ archive_write_pax_header(struct archive_write *a,
/* Copy mtime, but clip to ustar limits. */
s = archive_entry_mtime(entry_main);
if (s < 0) { s = 0; }
- if (s >= 0x7fffffff) { s = 0x7fffffff; }
+ if (s > ustar_max_mtime) { s = ustar_max_mtime; }
archive_entry_set_mtime(pax_attr_entry, s, 0);
/* Standard ustar doesn't support atime. */
@@ -1904,14 +1914,19 @@ url_encode(const char *in)
{
const char *s;
char *d;
- int out_len = 0;
+ size_t out_len = 0;
char *out;
for (s = in; *s != '\0'; s++) {
- if (*s < 33 || *s > 126 || *s == '%' || *s == '=')
+ if (*s < 33 || *s > 126 || *s == '%' || *s == '=') {
+ if (SIZE_MAX - out_len < 4)
+ return (NULL);
out_len += 3;
- else
+ } else {
+ if (SIZE_MAX - out_len < 2)
+ return (NULL);
out_len++;
+ }
}
out = (char *)malloc(out_len + 1);
@@ -2046,3 +2061,18 @@ sparse_list_add(struct pax *pax, int64_t offset, int64_t length)
return (_sparse_list_add_block(pax, offset, length, 0));
}
+static time_t
+get_ustar_max_mtime(void)
+{
+ /*
+ * Technically, the mtime field in the ustar header can
+ * support 33 bits. We are using all of them to keep
+ * tar/test/test_option_C_mtree.c simple and passing after 2038.
+ * For platforms that use signed 32-bit time values we
+ * use the 32-bit maximum.
+ */
+ if (sizeof(time_t) > sizeof(int32_t))
+ return (time_t)0x1ffffffff;
+ else
+ return (time_t)0x7fffffff;
+}
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_warc.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_warc.c
index 46b0573..0ef003e 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_warc.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_warc.c
@@ -329,30 +329,21 @@ xstrftime(struct archive_string *as, const char *fmt, time_t t)
{
/** like strftime(3) but for time_t objects */
struct tm *rt;
-#if defined(HAVE_GMTIME_R) || defined(HAVE__GMTIME64_S)
+#if defined(HAVE_GMTIME_R) || defined(HAVE_GMTIME_S)
struct tm timeHere;
#endif
-#if defined(HAVE__GMTIME64_S)
- errno_t terr;
- __time64_t tmptime;
-#endif
char strtime[100];
size_t len;
-#ifdef HAVE_GMTIME_R
- if ((rt = gmtime_r(&t, &timeHere)) == NULL)
- return;
-#elif defined(HAVE__GMTIME64_S)
- tmptime = t;
- terr = _gmtime64_s(&timeHere, &tmptime);
- if (terr)
- rt = NULL;
- else
- rt = &timeHere;
+#if defined(HAVE_GMTIME_S)
+ rt = gmtime_s(&timeHere, &t) ? NULL : &timeHere;
+#elif defined(HAVE_GMTIME_R)
+ rt = gmtime_r(&t, &timeHere);
#else
- if ((rt = gmtime(&t)) == NULL)
- return;
+ rt = gmtime(&t);
#endif
+ if (!rt)
+ return;
/* leave the hard yacker to our role model strftime() */
len = strftime(strtime, sizeof(strtime)-1, fmt, rt);
archive_strncat(as, strtime, len);
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c
index 1e35375..1e82aa2 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c
@@ -212,8 +212,8 @@ struct file {
struct heap_data data;
struct archive_string script;
- signed int virtual:1;
- signed int dir:1;
+ unsigned int virtual:1;
+ unsigned int dir:1;
};
struct hardlink {
@@ -906,15 +906,11 @@ xmlwrite_time(struct archive_write *a, xmlTextWriterPtr writer,
{
char timestr[100];
struct tm tm;
-#if defined(HAVE__GMTIME64_S)
- __time64_t tmptime;
-#endif
-#if defined(HAVE_GMTIME_R)
+#if defined(HAVE_GMTIME_S)
+ gmtime_s(&tm, &t);
+#elif defined(HAVE_GMTIME_R)
gmtime_r(&t, &tm);
-#elif defined(HAVE__GMTIME64_S)
- tmptime = t;
- _gmtime64_s(&tm, &tmptime);
#else
memcpy(&tm, gmtime(&t), sizeof(tm));
#endif
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_zip.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_zip.c
index 530e1e8..d610300 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_zip.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_zip.c
@@ -1382,25 +1382,14 @@ dos_time(const time_t unix_time)
{
struct tm *t;
unsigned int dt;
-#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
struct tm tmbuf;
#endif
-#if defined(HAVE__LOCALTIME64_S)
- errno_t terr;
- __time64_t tmptime;
-#endif
- /* This will not preserve time when creating/extracting the archive
- * on two systems with different time zones. */
-#if defined(HAVE_LOCALTIME_R)
+#if defined(HAVE_LOCALTIME_S)
+ t = localtime_s(&tmbuf, &unix_time) ? NULL : &tmbuf;
+#elif defined(HAVE_LOCALTIME_R)
t = localtime_r(&unix_time, &tmbuf);
-#elif defined(HAVE__LOCALTIME64_S)
- tmptime = unix_time;
- terr = _localtime64_s(&tmbuf, &tmptime);
- if (terr)
- t = NULL;
- else
- t = &tmbuf;
#else
t = localtime(&unix_time);
#endif
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_options.3 b/Utilities/cmlibarchive/libarchive/archive_write_set_options.3
index dd57358..f4b5081 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_set_options.3
+++ b/Utilities/cmlibarchive/libarchive/archive_write_set_options.3
@@ -257,6 +257,15 @@ If supported, the default value is read from
The value is interpreted as a decimal integer specifying the
compression level. Supported values depend on the library version,
common values are from 1 to 22.
+.It Cm long
+Enables long distance matching. The value is interpreted as a
+decimal integer specifying log2 window size in bytes. Values from
+10 to 30 for 32 bit, or 31 for 64 bit, are supported.
+.It Cm threads
+The value is interpreted as a decimal integer specifying the
+number of threads for multi-threaded zstd compression.
+If set to 0, zstd will attempt to detect and use the number
+of physical CPU cores.
.El
.It Format 7zip
.Bl -tag -compact -width indent
diff --git a/Utilities/cmlibarchive/libarchive/config_freebsd.h b/Utilities/cmlibarchive/libarchive/config_freebsd.h
index 758621c..669f272 100644
--- a/Utilities/cmlibarchive/libarchive/config_freebsd.h
+++ b/Utilities/cmlibarchive/libarchive/config_freebsd.h
@@ -111,6 +111,8 @@
#define HAVE_FCNTL 1
#define HAVE_FCNTL_H 1
#define HAVE_FDOPENDIR 1
+#define HAVE_FNMATCH 1
+#define HAVE_FNMATCH_H 1
#define HAVE_FORK 1
#define HAVE_FSEEKO 1
#define HAVE_FSTAT 1
@@ -123,6 +125,8 @@
#define HAVE_GETEUID 1
#define HAVE_GETGRGID_R 1
#define HAVE_GETGRNAM_R 1
+#define HAVE_GETLINE 1
+#define HAVE_GETOPT_OPTRESET 1
#define HAVE_GETPID 1
#define HAVE_GETPWNAM_R 1
#define HAVE_GETPWUID_R 1
@@ -201,6 +205,7 @@
#define HAVE_SYS_MOUNT_H 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_POLL_H 1
+#define HAVE_SYS_QUEUE_H 1
#define HAVE_SYS_SELECT_H 1
#define HAVE_SYS_STATVFS_H 1
#define HAVE_SYS_STAT_H 1
@@ -234,7 +239,7 @@
#define HAVE_WMEMCPY 1
#define HAVE_WMEMMOVE 1
#define HAVE_ZLIB_H 1
-#define TIME_WITH_SYS_TIME 1
+#define HAVE_SYS_TIME_H 1
#if __FreeBSD_version >= 800505
#define HAVE_LIBLZMA 1
diff --git a/Utilities/cmlibarchive/libarchive/filter_fork_windows.c b/Utilities/cmlibarchive/libarchive/filter_fork_windows.c
index 0b96397..9e49c56 100644
--- a/Utilities/cmlibarchive/libarchive/filter_fork_windows.c
+++ b/Utilities/cmlibarchive/libarchive/filter_fork_windows.c
@@ -31,6 +31,7 @@
#include "filter_fork.h"
+#if !defined(WINAPI_FAMILY_PARTITION) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
/* There are some editions of Windows ("nano server," for example) that
* do not host user32.dll. If we want to keep running on those editions,
* we need to delay-load WaitForInputIdle. */
@@ -224,6 +225,14 @@ fail:
__archive_cmdline_free(acmd);
return ARCHIVE_FAILED;
}
+#else /* !WINAPI_PARTITION_DESKTOP */
+int
+__archive_create_child(const char *cmd, int *child_stdin, int *child_stdout, HANDLE *out_child)
+{
+ (void)cmd; (void)child_stdin; (void) child_stdout; (void) out_child;
+ return ARCHIVE_FAILED;
+}
+#endif /* !WINAPI_PARTITION_DESKTOP */
void
__archive_check_child(int in, int out)
diff --git a/Utilities/cmlibarchive/libarchive/xxhash.c b/Utilities/cmlibarchive/libarchive/xxhash.c
index f96e9d9..beacd23 100644
--- a/Utilities/cmlibarchive/libarchive/xxhash.c
+++ b/Utilities/cmlibarchive/libarchive/xxhash.c
@@ -149,6 +149,10 @@ typedef struct _U32_S { U32 v; } _PACKED U32_S;
#if GCC_VERSION >= 409
__attribute__((__no_sanitize_undefined__))
+#else
+# if defined(__clang__)
+__attribute__((no_sanitize("undefined")))
+# endif
#endif
#if defined(_MSC_VER)
static __inline U32 A32(const void * x)
diff --git a/bootstrap b/bootstrap
index 115c354..9664567 100755
--- a/bootstrap
+++ b/bootstrap
@@ -364,6 +364,7 @@ CMAKE_CXX_SOURCES="\
cmFindFileCommand \
cmFindLibraryCommand \
cmFindPackageCommand \
+ cmFindPackageStack \
cmFindPathCommand \
cmFindProgramCommand \
cmForEachCommand \