summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml114
-rwxr-xr-x.gitlab/ci/borland.ps137
-rw-r--r--.gitlab/ci/configure_windows_borland5.5.cmake1
-rw-r--r--.gitlab/ci/configure_windows_borland5.8.cmake1
-rw-r--r--.gitlab/ci/configure_windows_borland_common.cmake2
-rw-r--r--.gitlab/ci/configure_windows_msvc_common.cmake2
-rw-r--r--.gitlab/ci/configure_windows_msvc_v71_nmake.cmake1
-rw-r--r--.gitlab/ci/configure_windows_openwatcom1.9.cmake1
-rw-r--r--.gitlab/ci/configure_windows_openwatcom_common.cmake2
-rw-r--r--.gitlab/ci/configure_windows_vs2019_x64.cmake1
-rw-r--r--.gitlab/ci/configure_windows_vs2019_x64_ninja.cmake1
-rw-r--r--.gitlab/ci/configure_windows_vs2022_x64.cmake4
-rw-r--r--.gitlab/ci/configure_windows_vs2022_x64_jom.cmake1
-rw-r--r--.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake8
-rw-r--r--.gitlab/ci/configure_windows_vs2022_x64_nmake.cmake1
-rw-r--r--.gitlab/ci/configure_windows_vs_common.cmake8
-rw-r--r--.gitlab/ci/configure_windows_vs_common_ninja.cmake12
-rwxr-xr-x.gitlab/ci/jom.ps115
-rwxr-xr-x.gitlab/ci/msvc.ps131
-rwxr-xr-x.gitlab/ci/ninja-nightly.ps19
-rwxr-xr-x.gitlab/ci/ninja.ps15
-rwxr-xr-x.gitlab/ci/openwatcom.ps125
-rwxr-xr-x.gitlab/ci/vcvarsall.ps12
-rw-r--r--.gitlab/os-windows.yml179
-rw-r--r--Auxiliary/cmake.m42
-rw-r--r--Auxiliary/vim/syntax/cmake.vim5
-rw-r--r--CMakeLists.txt12
-rw-r--r--Copyright.txt1
-rw-r--r--Help/command/install.rst35
-rw-r--r--Help/command/target_sources.rst156
-rw-r--r--Help/cpack_gen/ifw.rst91
-rw-r--r--Help/cpack_gen/productbuild.rst8
-rw-r--r--Help/cpack_gen/wix.rst8
-rw-r--r--Help/generator/Green Hills MULTI.rst124
-rw-r--r--Help/generator/Visual Studio 15 2017.rst14
-rw-r--r--Help/generator/Visual Studio 16 2019.rst14
-rw-r--r--Help/generator/Visual Studio 17 2022.rst14
-rw-r--r--Help/guide/tutorial/Complete/CMakeLists.txt3
-rw-r--r--Help/guide/tutorial/Complete/MathFunctions/CMakeLists.txt4
-rw-r--r--Help/guide/tutorial/Packaging an Installer.rst9
-rw-r--r--Help/guide/tutorial/Step10/CMakeLists.txt1
-rw-r--r--Help/guide/tutorial/Step11/CMakeLists.txt3
-rw-r--r--Help/guide/tutorial/Step12/CMakeLists.txt2
-rw-r--r--Help/guide/tutorial/Step12/MathFunctions/CMakeLists.txt4
-rw-r--r--Help/guide/tutorial/Step8/CMakeLists.txt1
-rw-r--r--Help/guide/tutorial/Step9/CMakeLists.txt1
-rw-r--r--Help/manual/cmake-file-api.7.rst46
-rw-r--r--Help/manual/cmake-policies.7.rst9
-rw-r--r--Help/manual/cmake-properties.7.rst8
-rw-r--r--Help/manual/cmake-variables.7.rst4
-rw-r--r--Help/manual/ctest.1.rst7
-rw-r--r--Help/policy/CMP0129.rst34
-rw-r--r--Help/prop_tgt/CUDA_ARCHITECTURES.rst12
-rw-r--r--Help/prop_tgt/HEADER_DIRS.rst8
-rw-r--r--Help/prop_tgt/HEADER_DIRS_NAME.rst8
-rw-r--r--Help/prop_tgt/HEADER_SET.rst10
-rw-r--r--Help/prop_tgt/HEADER_SETS.rst8
-rw-r--r--Help/prop_tgt/HEADER_SET_NAME.rst10
-rw-r--r--Help/prop_tgt/IMPORTED_NO_SYSTEM.rst17
-rw-r--r--Help/prop_tgt/INTERFACE_HEADER_SETS.rst9
-rw-r--r--Help/prop_tgt/NO_SYSTEM_FROM_IMPORTED.rst3
-rw-r--r--Help/prop_tgt/SOURCES.rst36
-rw-r--r--Help/prop_tgt/XCODE_EMBED_type.rst6
-rw-r--r--Help/prop_tgt/XCODE_EMBED_type_CODE_SIGN_ON_COPY.rst3
-rw-r--r--Help/prop_tgt/XCODE_EMBED_type_PATH.rst3
-rw-r--r--Help/prop_tgt/XCODE_EMBED_type_REMOVE_HEADERS_ON_COPY.rst3
-rw-r--r--Help/prop_tgt/XCODE_GENERATE_SCHEME.rst1
-rw-r--r--Help/prop_tgt/XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE.rst15
-rw-r--r--Help/release/dev/0-sample-topic.rst7
-rw-r--r--Help/release/dev/FindGTest-target-for-gmock.rst4
-rw-r--r--Help/release/dev/FindVulkan-version.rst5
-rw-r--r--Help/release/dev/cpack-drop-osxx11.rst4
-rw-r--r--Help/release/dev/cpack-productbuild-identifier.rst6
-rw-r--r--Help/release/dev/cpack-wix-skip-ui-ext.rst5
-rw-r--r--Help/release/dev/cpackifw-archive-format.rst9
-rw-r--r--Help/release/dev/cpackifw-package-disable-command-line-interface.rst8
-rw-r--r--Help/release/dev/cpackifw-package-product-images.rst8
-rw-r--r--Help/release/dev/cpackifw-package-run-program.rst10
-rw-r--r--Help/release/dev/cpackifw-signing-identity.rst7
-rw-r--r--Help/release/dev/ctest_submit-inactivity-timeout.rst5
-rw-r--r--Help/release/dev/cuda-clang-device-link-flags.rst7
-rw-r--r--Help/release/dev/cuda-new-arch-modes.rst10
-rw-r--r--Help/release/dev/cuda-ptx-separable-compilation.rst5
-rw-r--r--Help/release/dev/imported-no-system.rst7
-rw-r--r--Help/release/dev/lcc-compiler.rst5
-rw-r--r--Help/release/dev/target-sources-file-set.rst18
-rw-r--r--Help/release/dev/vs-instance.rst6
-rw-r--r--Help/release/dev/xcode-embed-plugins.rst6
-rw-r--r--Help/release/dev/xcode-scheme-enable-gpu-frame-capture-mode.rst4
-rw-r--r--Help/release/index.rst2
-rw-r--r--Help/variable/CMAKE_GENERATOR_INSTANCE.rst43
-rw-r--r--Help/variable/CMAKE_LANG_COMPILER_ID.rst1
-rw-r--r--Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst2
-rw-r--r--Help/variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE.rst15
-rw-r--r--Help/variable/CTEST_CUSTOM_TESTS_IGNORE.rst2
-rw-r--r--Help/variable/CTEST_SUBMIT_INACTIVITY_TIMEOUT.rst5
-rw-r--r--Help/variable/GHS-MULTI.rst6
-rw-r--r--Help/variable/GHSMULTI.rst9
-rw-r--r--Modules/CMakeCUDAInformation.cmake21
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake1
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake38
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake31
-rw-r--r--Modules/CMakeDetermineFortranCompiler.cmake3
-rw-r--r--Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake4
-rw-r--r--Modules/CMakeFortranCompilerId.F.in7
-rw-r--r--Modules/CMakeParseImplicitLinkInfo.cmake4
-rw-r--r--Modules/CPack.cmake5
-rw-r--r--Modules/CheckSymbolExists.cmake15
-rw-r--r--Modules/Compiler/Clang-CUDA.cmake7
-rw-r--r--Modules/Compiler/LCC-C-DetermineCompiler.cmake19
-rw-r--r--Modules/Compiler/LCC-C-FeatureTests.cmake17
-rw-r--r--Modules/Compiler/LCC-C.cmake29
-rw-r--r--Modules/Compiler/LCC-CXX-DetermineCompiler.cmake19
-rw-r--r--Modules/Compiler/LCC-CXX-FeatureTests.cmake109
-rw-r--r--Modules/Compiler/LCC-CXX.cmake31
-rw-r--r--Modules/Compiler/LCC-FindBinUtils.cmake37
-rw-r--r--Modules/Compiler/LCC-Fortran.cmake26
-rw-r--r--Modules/Compiler/LCC.cmake95
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake3
-rw-r--r--Modules/DartConfiguration.tcl.in1
-rw-r--r--Modules/FindBLAS.cmake2
-rw-r--r--Modules/FindBoost.cmake4
-rw-r--r--Modules/FindCUDAToolkit.cmake17
-rw-r--r--Modules/FindGTest.cmake56
-rw-r--r--Modules/FindHDF5.cmake4
-rw-r--r--Modules/FindOpenMP.cmake1
-rw-r--r--Modules/FindOpenSSL.cmake6
-rw-r--r--Modules/FindThreads.cmake19
-rw-r--r--Modules/FindVulkan.cmake62
-rw-r--r--Modules/GNUInstallDirs.cmake12
-rw-r--r--Modules/Internal/CPack/CPack.OSXScriptLauncher.inbin29592 -> 0 bytes
-rw-r--r--Modules/Internal/CPack/CPack.OSXScriptLauncher.rsrc.inbin362 -> 0 bytes
-rw-r--r--Modules/Internal/CPack/CPackDeb.cmake8
-rw-r--r--Modules/Platform/GHS-MULTI-Determine.cmake127
-rw-r--r--Modules/Platform/Generic-ELF.cmake7
-rw-r--r--Modules/Platform/Linux-LCC-C.cmake2
-rw-r--r--Modules/Platform/Linux-LCC-CXX.cmake2
-rw-r--r--Modules/Platform/Linux-LCC-Fortran.cmake3
-rw-r--r--Modules/Platform/Linux-LCC.cmake15
-rw-r--r--Modules/Platform/Windows-Clang.cmake7
-rw-r--r--Modules/Platform/Windows-NVIDIA-CUDA.cmake8
-rw-r--r--Source/CMakeLists.txt12
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/IFW/cmCPackIFWCommon.cxx9
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx400
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.h18
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx244
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.h22
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.h2
-rw-r--r--Source/CPack/OSXScriptLauncher.cxx122
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackComponentGroup.h13
-rw-r--r--Source/CPack/cmCPackCygwinBinaryGenerator.cxx6
-rw-r--r--Source/CPack/cmCPackCygwinBinaryGenerator.h6
-rw-r--r--Source/CPack/cmCPackCygwinSourceGenerator.cxx6
-rw-r--r--Source/CPack/cmCPackCygwinSourceGenerator.h8
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackDebGenerator.h6
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.h5
-rw-r--r--Source/CPack/cmCPackFreeBSDGenerator.cxx2
-rw-r--r--Source/CPack/cmCPackGenerator.cxx2
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.cxx5
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.h2
-rw-r--r--Source/CPack/cmCPackLog.h5
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx6
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.cxx272
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.h39
-rw-r--r--Source/CPack/cmCPackPKGGenerator.cxx11
-rw-r--r--Source/CPack/cmCPackPKGGenerator.h3
-rw-r--r--Source/CPack/cmCPackProductBuildGenerator.cxx14
-rw-r--r--Source/CPack/cmCPackRPMGenerator.cxx5
-rw-r--r--Source/CPack/cmCPackRPMGenerator.h6
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.cxx2
-rw-r--r--Source/CPack/cpack.cxx2
-rw-r--r--Source/CTest/cmCTestBZR.cxx6
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.h3
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx5
-rw-r--r--Source/CTest/cmCTestBuildHandler.h3
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx13
-rw-r--r--Source/CTest/cmCTestGIT.cxx11
-rw-r--r--Source/CTest/cmCTestGenericHandler.h3
-rw-r--r--Source/CTest/cmCTestLaunch.cxx3
-rw-r--r--Source/CTest/cmCTestLaunch.h6
-rw-r--r--Source/CTest/cmCTestLaunchReporter.cxx3
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.h2
-rw-r--r--Source/CTest/cmCTestP4.h8
-rw-r--r--Source/CTest/cmCTestRunTest.cxx10
-rw-r--r--Source/CTest/cmCTestRunTest.h3
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx4
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx3
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx33
-rw-r--r--Source/CTest/cmCTestSubmitHandler.h1
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx6
-rw-r--r--Source/CTest/cmCTestTestHandler.h3
-rw-r--r--Source/CTest/cmCTestVC.cxx7
-rw-r--r--Source/CTest/cmCTestVC.h13
-rw-r--r--Source/CTest/cmProcess.cxx2
-rw-r--r--Source/CTest/cmProcess.h18
-rw-r--r--Source/Checks/cm_c11_thread_local.cmake2
-rw-r--r--Source/Checks/cm_cxx14_check.cmake2
-rw-r--r--Source/Checks/cm_cxx17_check.cmake2
-rw-r--r--Source/CursesDialog/ccmake.cxx2
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.cxx8
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx26
-rw-r--r--Source/CursesDialog/cmCursesStringWidget.cxx3
-rw-r--r--Source/CursesDialog/form/CMakeLists.txt2
-rw-r--r--Source/CursesDialog/form/fty_enum.c4
-rw-r--r--Source/bindexplib.cxx12
-rw-r--r--Source/bindexplib.h3
-rw-r--r--Source/cmAddCustomCommandCommand.cxx32
-rw-r--r--Source/cmAddCustomTargetCommand.cxx21
-rw-r--r--Source/cmAffinity.cxx2
-rw-r--r--Source/cmBase32.cxx2
-rw-r--r--Source/cmCMakePresetsFile.cxx46
-rw-r--r--Source/cmCMakePresetsFile.h66
-rw-r--r--Source/cmCMakePresetsFileInternal.h4
-rw-r--r--Source/cmCPluginAPI.cxx211
-rw-r--r--Source/cmCTest.cxx15
-rw-r--r--Source/cmComputeLinkInformation.cxx17
-rw-r--r--Source/cmComputeLinkInformation.h2
-rw-r--r--Source/cmCoreTryCompile.cxx3
-rw-r--r--Source/cmCustomCommand.cxx53
-rw-r--r--Source/cmCustomCommand.h24
-rw-r--r--Source/cmCustomCommandGenerator.cxx2
-rw-r--r--Source/cmELF.cxx9
-rw-r--r--Source/cmExecProgramCommand.cxx2
-rw-r--r--Source/cmExecuteProcessCommand.cxx4
-rw-r--r--Source/cmExportBuildFileGenerator.cxx19
-rw-r--r--Source/cmExportBuildFileGenerator.h7
-rw-r--r--Source/cmExportFileGenerator.cxx58
-rw-r--r--Source/cmExportFileGenerator.h12
-rw-r--r--Source/cmExportInstallFileGenerator.cxx105
-rw-r--r--Source/cmExportInstallFileGenerator.h6
-rw-r--r--Source/cmExportTryCompileFileGenerator.cxx19
-rw-r--r--Source/cmExportTryCompileFileGenerator.h9
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx6
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx3
-rw-r--r--Source/cmFLTKWrapUICommand.cxx24
-rw-r--r--Source/cmFileAPI.cxx3
-rw-r--r--Source/cmFileAPICodemodel.cxx49
-rw-r--r--Source/cmFileCommand.cxx7
-rw-r--r--Source/cmFileLockResult.cxx2
-rw-r--r--Source/cmFileSet.cxx151
-rw-r--r--Source/cmFileSet.h64
-rw-r--r--Source/cmFileTime.h2
-rw-r--r--Source/cmFindCommon.cxx12
-rw-r--r--Source/cmFindPackageCommand.cxx2
-rw-r--r--Source/cmFindProgramCommand.cxx20
-rw-r--r--Source/cmGeneratedFileStream.cxx3
-rw-r--r--Source/cmGeneratorExpressionNode.cxx11
-rw-r--r--Source/cmGeneratorTarget.cxx214
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.cxx4
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.h10
-rw-r--r--Source/cmGlobalGenerator.cxx67
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx197
-rw-r--r--Source/cmGlobalGhsMultiGenerator.h2
-rw-r--r--Source/cmGlobalJOMMakefileGenerator.cxx6
-rw-r--r--Source/cmGlobalJOMMakefileGenerator.h8
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.cxx4
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.h7
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.cxx2
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.h7
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.cxx9
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.h10
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx13
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h11
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx11
-rw-r--r--Source/cmGlobalVisualStudio11Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio12Generator.cxx12
-rw-r--r--Source/cmGlobalVisualStudio12Generator.h1
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx11
-rw-r--r--Source/cmGlobalVisualStudio14Generator.h1
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx14
-rw-r--r--Source/cmGlobalVisualStudio71Generator.h13
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx14
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h16
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx62
-rw-r--r--Source/cmGlobalVisualStudio8Generator.h10
-rw-r--r--Source/cmGlobalVisualStudio9Generator.cxx11
-rw-r--r--Source/cmGlobalVisualStudio9Generator.h4
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx36
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h3
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx162
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.h12
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx70
-rw-r--r--Source/cmGlobalXCodeGenerator.h3
-rw-r--r--Source/cmIDEOptions.cxx6
-rw-r--r--Source/cmInstallCommand.cxx172
-rw-r--r--Source/cmInstallCommandArguments.cxx19
-rw-r--r--Source/cmInstallCommandArguments.h16
-rw-r--r--Source/cmInstallExportGenerator.cxx2
-rw-r--r--Source/cmInstallFileSetGenerator.cxx88
-rw-r--r--Source/cmInstallFileSetGenerator.h52
-rw-r--r--Source/cmListCommand.cxx2
-rw-r--r--Source/cmLoadCommandCommand.cxx1
-rw-r--r--Source/cmLocalGenerator.cxx444
-rw-r--r--Source/cmLocalGenerator.h176
-rw-r--r--Source/cmLocalNinjaGenerator.cxx5
-rw-r--r--Source/cmLocalNinjaGenerator.h4
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx6
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx11
-rw-r--r--Source/cmLocalVisualStudio10Generator.h1
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx46
-rw-r--r--Source/cmLocalVisualStudio7Generator.h2
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx16
-rw-r--r--Source/cmLocalXCodeGenerator.cxx8
-rw-r--r--Source/cmLocalXCodeGenerator.h1
-rw-r--r--Source/cmMachO.cxx8
-rw-r--r--Source/cmMacroCommand.cxx2
-rw-r--r--Source/cmMakefile.cxx170
-rw-r--r--Source/cmMakefile.h90
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx12
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx13
-rw-r--r--Source/cmMakefileTargetGenerator.cxx65
-rw-r--r--Source/cmMathCommand.cxx2
-rw-r--r--Source/cmMessenger.cxx21
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx56
-rw-r--r--Source/cmNinjaTargetGenerator.cxx45
-rw-r--r--Source/cmOutputConverter.cxx29
-rw-r--r--Source/cmOutputConverter.h13
-rw-r--r--Source/cmPolicies.cxx2
-rw-r--r--Source/cmPolicies.h5
-rw-r--r--Source/cmProjectCommand.cxx7
-rw-r--r--Source/cmQTWrapCPPCommand.cxx16
-rw-r--r--Source/cmQTWrapUICommand.cxx32
-rw-r--r--Source/cmQtAutoGen.cxx8
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.cxx15
-rw-r--r--Source/cmQtAutoGenInitializer.cxx111
-rw-r--r--Source/cmRulePlaceholderExpander.cxx5
-rw-r--r--Source/cmRulePlaceholderExpander.h1
-rw-r--r--Source/cmSearchPath.h3
-rw-r--r--Source/cmStringCommand.cxx2
-rw-r--r--Source/cmSystemTools.cxx54
-rw-r--r--Source/cmSystemTools.h4
-rw-r--r--Source/cmTarget.cxx322
-rw-r--r--Source/cmTarget.h15
-rw-r--r--Source/cmTargetExport.h3
-rw-r--r--Source/cmTargetPropCommandBase.cxx4
-rw-r--r--Source/cmTargetPropCommandBase.h6
-rw-r--r--Source/cmTargetSourcesCommand.cxx238
-rw-r--r--Source/cmTryRunCommand.cxx2
-rw-r--r--Source/cmVSSetupHelper.cxx130
-rw-r--r--Source/cmVSSetupHelper.h11
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx213
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h7
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx10
-rw-r--r--Source/cmVisualStudioGeneratorOptions.h1
-rw-r--r--Source/cmVisualStudioSlnData.cxx3
-rw-r--r--Source/cmVisualStudioSlnParser.cxx4
-rw-r--r--Source/cmVisualStudioSlnParser.h3
-rw-r--r--Source/cmVisualStudioWCEPlatformParser.cxx6
-rw-r--r--Source/cmVisualStudioWCEPlatformParser.h3
-rw-r--r--Source/cmXCOFF.cxx20
-rw-r--r--Source/cmXCOFF.h4
-rw-r--r--Source/cmXCode21Object.h1
-rw-r--r--Source/cmXCodeObject.cxx2
-rw-r--r--Source/cmXCodeObject.h1
-rw-r--r--Source/cmXCodeScheme.cxx22
-rw-r--r--Source/cmXCodeScheme.h9
-rw-r--r--Source/cmXMLParser.h1
-rw-r--r--Source/cmXMLSafe.cxx4
-rw-r--r--Source/cm_codecvt.cxx17
-rw-r--r--Source/cm_codecvt.hxx6
-rw-r--r--Source/cm_utf8.h2
-rw-r--r--Source/cmake.cxx2
-rw-r--r--Source/cmcldeps.cxx3
-rw-r--r--Source/cmcmd.cxx21
-rw-r--r--Source/kwsys/CTestConfig.cmake4
-rw-r--r--Source/kwsys/Configure.hxx.in14
-rw-r--r--Source/kwsys/Directory.cxx20
-rw-r--r--Source/kwsys/DynamicLoader.cxx25
-rw-r--r--Source/kwsys/DynamicLoader.hxx.in7
-rw-r--r--Source/kwsys/MD5.c3
-rw-r--r--Source/kwsys/ProcessUNIX.c5
-rw-r--r--Source/kwsys/ProcessWin32.c22
-rw-r--r--Source/kwsys/SharedForward.h.in6
-rw-r--r--Source/kwsys/Status.cxx2
-rw-r--r--Source/kwsys/SystemInformation.cxx59
-rw-r--r--Source/kwsys/SystemTools.cxx132
-rw-r--r--Source/kwsys/SystemTools.hxx.in7
-rw-r--r--Source/kwsys/testDirectory.cxx6
-rw-r--r--Source/kwsys/testDynamicLoader.cxx20
-rw-r--r--Source/kwsys/testDynload.c2
-rw-r--r--Source/kwsys/testDynload.h9
-rw-r--r--Source/kwsys/testEncoding.cxx10
-rw-r--r--Source/kwsys/testSystemTools.cxx10
-rw-r--r--Templates/TestDriver.cxx.in2
-rw-r--r--Tests/Assembler/CMakeLists.txt5
-rw-r--r--Tests/BundleTest/BundleLib.cxx5
-rw-r--r--Tests/CMakeCommands/add_compile_options/CMakeLists.txt6
-rw-r--r--Tests/CMakeCommands/target_compile_options/CMakeLists.txt20
-rw-r--r--Tests/CMakeCommands/target_link_directories/CMakeLists.txt10
-rw-r--r--Tests/CMakeCommands/target_link_libraries/CMakeLists.txt4
-rw-r--r--Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt2
-rw-r--r--Tests/CMakeLib/testCTestBinPacker.cxx2
-rw-r--r--Tests/CMakeLib/testCTestResourceAllocator.cxx8
-rw-r--r--Tests/CMakeLib/testCTestResourceGroups.cxx2
-rw-r--r--Tests/CMakeLib/testOptional.cxx14
-rw-r--r--Tests/CMakeLib/testRST.cxx3
-rw-r--r--Tests/CMakeLib/testUVProcessChain.cxx18
-rw-r--r--Tests/CMakeLib/testUVProcessChainHelper.cxx2
-rw-r--r--Tests/CMakeLib/testUVRAII.cxx13
-rw-r--r--Tests/CMakeLib/testUVStreambuf.cxx17
-rw-r--r--Tests/CMakeLists.txt16
-rw-r--r--Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt5
-rw-r--r--Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt11
-rw-r--r--Tests/CTestTestCrash/crash.cxx2
-rw-r--r--Tests/CompileFeatures/cxx_generalized_initializers.cpp7
-rw-r--r--Tests/CompileOptions/CMakeLists.txt15
-rw-r--r--Tests/CudaOnly/All/CMakeLists.txt44
-rw-r--r--Tests/CudaOnly/All/main.cu3
-rw-r--r--Tests/CudaOnly/CMakeLists.txt3
-rw-r--r--Tests/CudaOnly/ExportPTX/CMakeLists.txt2
-rw-r--r--Tests/CudaOnly/SeparateCompilationPTX/CMakeLists.txt51
-rw-r--r--Tests/CudaOnly/SeparateCompilationPTX/kernels.cu14
-rw-r--r--Tests/CudaOnly/SeparateCompilationPTX/main.cu30
-rw-r--r--Tests/CudaOnly/utils/bin2c_wrapper.cmake (renamed from Tests/CudaOnly/ExportPTX/bin2c_wrapper.cmake)0
-rw-r--r--Tests/ExportImport/Export/CMakeLists.txt19
-rw-r--r--Tests/ExportImport/Export/include/testInterfaceIncludeUser/testInterfaceInclude.h1
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt15
-rw-r--r--Tests/ExportImport/Import/A/imp_testInterfaceInclude1.c6
-rw-r--r--Tests/ExportImport/Import/A/testInterfaceIncludeSystem/testInterfaceInclude.h1
-rw-r--r--Tests/ExportImport/Import/CMakeLists.txt3
-rw-r--r--Tests/FindGTest/Test/CMakeLists.txt4
-rw-r--r--Tests/Fortran/CMakeLists.txt7
-rw-r--r--Tests/IncludeDirectories/CMakeLists.txt14
-rw-r--r--Tests/LinkStatic/CMakeLists.txt7
-rw-r--r--Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt7
-rw-r--r--Tests/RunCMake/BuildDepends/MakeDependencies.step1.cmake7
-rw-r--r--Tests/RunCMake/BuildDepends/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/CMP0119/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/CMP0129/C.cmake8
-rw-r--r--Tests/RunCMake/CMP0129/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0129/CXX.cmake8
-rw-r--r--Tests/RunCMake/CMP0129/CompareCompilerVersion.cmake41
-rw-r--r--Tests/RunCMake/CMP0129/Fortran.cmake15
-rw-r--r--Tests/RunCMake/CMP0129/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/CMakeLists.txt11
-rw-r--r--Tests/RunCMake/CPack/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake27
-rw-r--r--Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/DEPENDENCIES/DEB-stderr.txt3
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake4
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake2
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake2
-rw-r--r--Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/CommandLine/E_capabilities-stdout.txt2
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-check.py33
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json203
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json29
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json7
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json8
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json231
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json105
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json6
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json2
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json6
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2.cmake1
-rw-r--r--Tests/RunCMake/FileAPI/fileset/CMakeLists.txt25
-rw-r--r--Tests/RunCMake/FileAPI/fileset/dir/h2.h0
-rw-r--r--Tests/RunCMake/FileAPI/fileset/empty.c0
-rw-r--r--Tests/RunCMake/FileAPI/fileset/error.c1
-rw-r--r--Tests/RunCMake/FileAPI/fileset/h1.h0
-rw-r--r--Tests/RunCMake/FileAPI/fileset/h3.h0
-rw-r--r--Tests/RunCMake/FileAPI/fileset/other.c0
-rw-r--r--Tests/RunCMake/FindBoost/CMP0093-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/GNUInstallDirs/Opt-FreeBSD-stderr.txt4
-rw-r--r--Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt4
-rw-r--r--Tests/RunCMake/GNUInstallDirs/Root-FreeBSD-stderr.txt4
-rw-r--r--Tests/RunCMake/GNUInstallDirs/Usr-FreeBSD-stderr.txt4
-rw-r--r--Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt4
-rw-r--r--Tests/RunCMake/GNUInstallDirs/UsrLocal-FreeBSD-stderr.txt4
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-result.txt (renamed from Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-result.txt)0
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-stderr.txt11
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadFieldDuplicate.cmake1
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadFieldNoComma-result.txt (renamed from Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-result.txt)0
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadFieldNoComma-stderr.txt11
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadFieldNoComma.cmake1
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadFieldUnknown-result.txt (renamed from Tests/RunCMake/TargetSources/AddCustomTargetSources-result.txt)0
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadFieldUnknown-stderr.txt11
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadFieldUnknown.cmake1
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadVersionFormat1-result.txt (renamed from Tests/RunCMake/TargetSources/CMP0076-OLD-result.txt)0
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadVersionFormat1-stderr.txt11
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadVersionFormat1.cmake1
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadVersionFormat2-result.txt (renamed from Tests/RunCMake/TargetSources/CMP0076-WARN-result.txt)0
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadVersionFormat2-stderr.txt11
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadVersionFormat2.cmake1
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadVersionNumber-result.txt (renamed from Tests/RunCMake/TargetSources/ConfigNotAllowed-result.txt)0
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadVersionNumber-stderr.txt9
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadVersionNumber.cmake1
-rw-r--r--Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake1
-rw-r--r--Tests/RunCMake/GeneratorInstance/PortableNoVersion-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorInstance/PortableNoVersion-stderr.txt13
-rw-r--r--Tests/RunCMake/GeneratorInstance/PortableNoVersion.cmake1
-rw-r--r--Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake28
-rw-r--r--Tests/RunCMake/GeneratorInstance/WrongVersion-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorInstance/WrongVersion-stderr.txt10
-rw-r--r--Tests/RunCMake/GeneratorInstance/WrongVersion.cmake1
-rw-r--r--Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/MSVCWarningFlags/CMP0092-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchWarnInvalid-check.cmake2
-rw-r--r--Tests/RunCMake/RunCMake.cmake3
-rw-r--r--Tests/RunCMake/Swift/RunCMakeTest.cmake13
-rw-r--r--Tests/RunCMake/Swift/Win32ExecutableIgnored.cmake4
-rw-r--r--Tests/RunCMake/TargetSources/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt1
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt1
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt1
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt1
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt1
-rw-r--r--Tests/RunCMake/TargetSources/RunCMakeTest.cmake22
-rw-r--r--Tests/RunCMake/UnityBuild/RunCMakeTest.cmake24
-rw-r--r--Tests/RunCMake/UnityBuild/per_config_c.c16
-rw-r--r--Tests/RunCMake/UnityBuild/per_config_c.cmake12
-rw-r--r--Tests/RunCMake/UnityBuild/per_config_c_debug.c9
-rw-r--r--Tests/RunCMake/UnityBuild/per_config_c_other.c9
-rw-r--r--Tests/RunCMake/VS10Project/RunCMakeTest.cmake15
-rw-r--r--Tests/RunCMake/VS10Project/UnityBuildPCH-build-check.cmake10
-rw-r--r--Tests/RunCMake/VS10Project/UnityBuildPCH.c4
-rw-r--r--Tests/RunCMake/VS10Project/UnityBuildPCH.cmake4
-rw-r--r--Tests/RunCMake/VS10Project/UnityBuildPCH.h1
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS-check.cmake4
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns.cmake20
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake6
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake20
-rw-r--r--Tests/RunCMake/find_package/FindRootPathAndPrefixPathAreEqual.cmake16
-rw-r--r--Tests/RunCMake/find_package/FindRootPathAndPrefixPathAreEqual/lib/cmake/Foo/FooConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt13
-rw-r--r--Tests/RunCMake/install/TARGETS-Defaults-stderr.txt13
-rw-r--r--Tests/RunCMake/target_compile_options/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/target_link_options/RunCMakeTest.cmake17
-rw-r--r--Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-check.cmake9
-rw-r--r--Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake39
-rw-r--r--Tests/RunCMake/target_sources/AddCustomTargetCheckProperty.cmake (renamed from Tests/RunCMake/TargetSources/AddCustomTargetCheckProperty.cmake)0
-rw-r--r--Tests/RunCMake/target_sources/AddCustomTargetGenx.cmake (renamed from Tests/RunCMake/TargetSources/AddCustomTargetGenx.cmake)0
-rw-r--r--Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources-stderr.txt (renamed from Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-stderr.txt)0
-rw-r--r--Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources.cmake (renamed from Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources.cmake)0
-rw-r--r--Tests/RunCMake/target_sources/AddCustomTargetPrivateSources.cmake (renamed from Tests/RunCMake/TargetSources/AddCustomTargetPrivateSources.cmake)0
-rw-r--r--Tests/RunCMake/target_sources/AddCustomTargetPublicSources-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/AddCustomTargetPublicSources-stderr.txt (renamed from Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-stderr.txt)0
-rw-r--r--Tests/RunCMake/target_sources/AddCustomTargetPublicSources.cmake (renamed from Tests/RunCMake/TargetSources/AddCustomTargetPublicSources.cmake)0
-rw-r--r--Tests/RunCMake/target_sources/AddCustomTargetSources-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/AddCustomTargetSources-stderr.txt (renamed from Tests/RunCMake/TargetSources/AddCustomTargetSources-stderr.txt)0
-rw-r--r--Tests/RunCMake/target_sources/AddCustomTargetSources.cmake (renamed from Tests/RunCMake/TargetSources/AddCustomTargetSources.cmake)0
-rw-r--r--Tests/RunCMake/target_sources/CMP0026-LOCATION-result.txt (renamed from Tests/RunCMake/TargetSources/CMP0026-LOCATION-result.txt)0
-rw-r--r--Tests/RunCMake/target_sources/CMP0026-LOCATION-stderr.txt (renamed from Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt)0
-rw-r--r--Tests/RunCMake/target_sources/CMP0026-LOCATION.cmake (renamed from Tests/RunCMake/TargetSources/CMP0026-LOCATION.cmake)1
-rw-r--r--Tests/RunCMake/target_sources/CMP0076-OLD-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/CMP0076-OLD-stderr.txt (renamed from Tests/RunCMake/TargetSources/CMP0076-OLD-stderr.txt)0
-rw-r--r--Tests/RunCMake/target_sources/CMP0076-OLD.cmake (renamed from Tests/RunCMake/TargetSources/CMP0076-OLD.cmake)0
-rw-r--r--Tests/RunCMake/target_sources/CMP0076-WARN-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/CMP0076-WARN-stderr.txt (renamed from Tests/RunCMake/TargetSources/CMP0076-WARN-stderr.txt)0
-rw-r--r--Tests/RunCMake/target_sources/CMP0076-WARN.cmake (renamed from Tests/RunCMake/TargetSources/CMP0076-WARN.cmake)0
-rw-r--r--Tests/RunCMake/target_sources/CMP0076-WARN/CMakeLists.txt (renamed from Tests/RunCMake/TargetSources/CMP0076-WARN/CMakeLists.txt)0
-rw-r--r--Tests/RunCMake/target_sources/CMP0076-WARN/subdir_empty_1.cpp (renamed from Tests/RunCMake/TargetSources/CMP0076-WARN/subdir_empty_1.cpp)0
-rw-r--r--Tests/RunCMake/target_sources/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/target_sources/ConfigNotAllowed-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/ConfigNotAllowed-stderr.txt (renamed from Tests/RunCMake/TargetSources/ConfigNotAllowed-stderr.txt)6
-rw-r--r--Tests/RunCMake/target_sources/ConfigNotAllowed.cmake (renamed from Tests/RunCMake/TargetSources/ConfigNotAllowed.cmake)0
-rw-r--r--Tests/RunCMake/target_sources/EmptyKeywordArgs.cmake (renamed from Tests/RunCMake/target_sources/empty_keyword_args.cmake)0
-rw-r--r--Tests/RunCMake/target_sources/ExportBuild-result.txt (renamed from Tests/RunCMake/TargetSources/ExportBuild-result.txt)0
-rw-r--r--Tests/RunCMake/target_sources/ExportBuild.cmake (renamed from Tests/RunCMake/TargetSources/ExportBuild.cmake)0
-rw-r--r--Tests/RunCMake/target_sources/FileSetChangeScope-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/FileSetChangeScope-stderr.txt5
-rw-r--r--Tests/RunCMake/target_sources/FileSetChangeScope.cmake5
-rw-r--r--Tests/RunCMake/target_sources/FileSetChangeType-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/FileSetChangeType-stderr.txt5
-rw-r--r--Tests/RunCMake/target_sources/FileSetChangeType.cmake5
-rw-r--r--Tests/RunCMake/target_sources/FileSetDefaultWrongType-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/FileSetDefaultWrongType-stderr.txt4
-rw-r--r--Tests/RunCMake/target_sources/FileSetDefaultWrongType.cmake4
-rw-r--r--Tests/RunCMake/target_sources/FileSetDirectories.cmake4
-rw-r--r--Tests/RunCMake/target_sources/FileSetExport.cmake21
-rw-r--r--Tests/RunCMake/target_sources/FileSetFileNoExist-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/FileSetFileNoExist-stderr.txt10
-rw-r--r--Tests/RunCMake/target_sources/FileSetFileNoExist.cmake4
-rw-r--r--Tests/RunCMake/target_sources/FileSetImport.cmake97
-rw-r--r--Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface-stderr.txt5
-rw-r--r--Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface.cmake5
-rw-r--r--Tests/RunCMake/target_sources/FileSetInstallMissingSetsPrivate.cmake9
-rw-r--r--Tests/RunCMake/target_sources/FileSetNoExistInterface-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/FileSetNoExistInterface-stderr.txt4
-rw-r--r--Tests/RunCMake/target_sources/FileSetNoExistInterface.cmake7
-rw-r--r--Tests/RunCMake/target_sources/FileSetNoExistPrivate-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/FileSetNoExistPrivate-stderr.txt4
-rw-r--r--Tests/RunCMake/target_sources/FileSetNoExistPrivate.cmake7
-rw-r--r--Tests/RunCMake/target_sources/FileSetNoScope-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/FileSetNoScope-stderr.txt4
-rw-r--r--Tests/RunCMake/target_sources/FileSetNoScope.cmake6
-rw-r--r--Tests/RunCMake/target_sources/FileSetNoType-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/FileSetNoType-stderr.txt4
-rw-r--r--Tests/RunCMake/target_sources/FileSetNoType.cmake4
-rw-r--r--Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs-stderr.txt9
-rw-r--r--Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs.cmake4
-rw-r--r--Tests/RunCMake/target_sources/FileSetProperties.cmake67
-rw-r--r--Tests/RunCMake/target_sources/FileSetWrongBaseDirs-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/FileSetWrongBaseDirs-stderr.txt12
-rw-r--r--Tests/RunCMake/target_sources/FileSetWrongBaseDirs.cmake4
-rw-r--r--Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative-stderr.txt10
-rw-r--r--Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative.cmake3
-rw-r--r--Tests/RunCMake/target_sources/FileSetWrongType-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/FileSetWrongType-stderr.txt4
-rw-r--r--Tests/RunCMake/target_sources/FileSetWrongType.cmake4
-rw-r--r--Tests/RunCMake/target_sources/OriginDebug-result.txt (renamed from Tests/RunCMake/TargetSources/OriginDebug-result.txt)0
-rw-r--r--Tests/RunCMake/target_sources/OriginDebug-stderr.txt (renamed from Tests/RunCMake/TargetSources/OriginDebug-stderr.txt)8
-rw-r--r--Tests/RunCMake/target_sources/OriginDebug.cmake (renamed from Tests/RunCMake/TargetSources/OriginDebug.cmake)0
-rw-r--r--Tests/RunCMake/target_sources/RelativePathInInterface-stdout.txt1
-rw-r--r--Tests/RunCMake/target_sources/RelativePathInInterface.cmake (renamed from Tests/RunCMake/TargetSources/RelativePathInInterface.cmake)1
-rw-r--r--Tests/RunCMake/target_sources/RelativePathInSubdirGenEx-stdout.txt1
-rw-r--r--Tests/RunCMake/target_sources/RelativePathInSubdirGenEx.cmake (renamed from Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx.cmake)1
-rw-r--r--Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/CMakeLists.txt (renamed from Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/CMakeLists.txt)0
-rw-r--r--Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/subdir_empty_1.cpp (renamed from Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp)0
-rw-r--r--Tests/RunCMake/target_sources/RelativePathInSubdirInclude-stdout.txt1
-rw-r--r--Tests/RunCMake/target_sources/RelativePathInSubdirInclude.cmake (renamed from Tests/RunCMake/TargetSources/RelativePathInSubdirInclude.cmake)1
-rw-r--r--Tests/RunCMake/target_sources/RelativePathInSubdirInclude/CMakeLists.txt (renamed from Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/CMakeLists.txt)0
-rw-r--r--Tests/RunCMake/target_sources/RelativePathInSubdirInclude/subdir_empty_1.cpp (renamed from Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp)0
-rw-r--r--Tests/RunCMake/target_sources/RelativePathInSubdirInterface-stdout.txt1
-rw-r--r--Tests/RunCMake/target_sources/RelativePathInSubdirInterface.cmake (renamed from Tests/RunCMake/TargetSources/RelativePathInSubdirInterface.cmake)1
-rw-r--r--Tests/RunCMake/target_sources/RelativePathInSubdirInterface/CMakeLists.txt (renamed from Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/CMakeLists.txt)0
-rw-r--r--Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_1.cpp (renamed from Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp)0
-rw-r--r--Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_2.cpp (renamed from Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp)0
-rw-r--r--Tests/RunCMake/target_sources/RelativePathInSubdirPrivate-stdout.txt1
-rw-r--r--Tests/RunCMake/target_sources/RelativePathInSubdirPrivate.cmake (renamed from Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate.cmake)1
-rw-r--r--Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/CMakeLists.txt (renamed from Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/CMakeLists.txt)0
-rw-r--r--Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_1.cpp (renamed from Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp)0
-rw-r--r--Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_2.cpp (renamed from Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp)0
-rw-r--r--Tests/RunCMake/target_sources/RunCMakeTest.cmake79
-rw-r--r--Tests/RunCMake/target_sources/debug/empty.h0
-rw-r--r--Tests/RunCMake/target_sources/debug/empty2.h0
-rw-r--r--Tests/RunCMake/target_sources/dir/dir.h0
-rw-r--r--Tests/RunCMake/target_sources/dir1/file1.h0
-rw-r--r--Tests/RunCMake/target_sources/dir2/file2.h0
-rw-r--r--Tests/RunCMake/target_sources/dir3/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/target_sources/dir3/dir3.h4
-rw-r--r--Tests/RunCMake/target_sources/dir4/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/target_sources/dir4/dir4.h0
-rw-r--r--Tests/RunCMake/target_sources/empty.c0
-rw-r--r--Tests/RunCMake/target_sources/empty3.h0
-rw-r--r--Tests/RunCMake/target_sources/empty_1.cpp (renamed from Tests/RunCMake/TargetSources/empty_1.cpp)0
-rw-r--r--Tests/RunCMake/target_sources/empty_2.cpp (renamed from Tests/RunCMake/TargetSources/empty_2.cpp)0
-rw-r--r--Tests/RunCMake/target_sources/empty_3.cpp (renamed from Tests/RunCMake/TargetSources/empty_3.cpp)0
-rw-r--r--Tests/RunCMake/target_sources/empty_4.cpp (renamed from Tests/RunCMake/TargetSources/empty_4.cpp)0
-rw-r--r--Tests/RunCMake/target_sources/error.c1
-rw-r--r--Tests/RunCMake/target_sources/h1.h0
-rw-r--r--Tests/RunCMake/target_sources/h2.h0
-rw-r--r--Tests/RunCMake/target_sources/h3.h0
-rw-r--r--Tests/RunCMake/target_sources/lib1.c6
-rw-r--r--Tests/RunCMake/target_sources/lib2.c8
-rw-r--r--Tests/RunCMake/target_sources/main.cpp (renamed from Tests/RunCMake/TargetSources/main.cpp)0
-rw-r--r--Tests/RunCMake/target_sources/reldir/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/target_sources/release/empty.h0
-rw-r--r--Tests/RunCMake/target_sources/release/empty2.h0
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/try_run/RunCMakeTest.cmake2
-rw-r--r--Tests/SetLang/CMakeLists.txt5
-rw-r--r--Tests/TryCompile/CMakeLists.txt5
-rw-r--r--Tests/X11/CMakeLists.txt1
-rw-r--r--Utilities/Doxygen/CMakeLists.txt2
-rw-r--r--Utilities/Sphinx/CMakeLists.txt2
-rw-r--r--Utilities/cmbzip2/CMakeLists.txt2
-rw-r--r--Utilities/cmcurl/CMakeLists.txt4
-rw-r--r--Utilities/cmexpat/CMakeLists.txt2
-rw-r--r--Utilities/cmjsoncpp/CMakeLists.txt2
-rw-r--r--Utilities/cmlibarchive/CMakeLists.txt14
-rw-r--r--Utilities/cmliblzma/CMakeLists.txt4
-rw-r--r--Utilities/cmlibrhash/CMakeLists.txt2
-rw-r--r--Utilities/cmlibuv/CMakeLists.txt3
-rw-r--r--Utilities/cmlibuv/include/uv.h30
-rw-r--r--Utilities/cmlibuv/include/uv/errno.h14
-rw-r--r--Utilities/cmlibuv/include/uv/tree.h2
-rw-r--r--Utilities/cmlibuv/include/uv/unix.h6
-rw-r--r--Utilities/cmlibuv/include/uv/version.h2
-rw-r--r--Utilities/cmlibuv/src/idna.c49
-rw-r--r--Utilities/cmlibuv/src/inet.c3
-rw-r--r--Utilities/cmlibuv/src/threadpool.c2
-rw-r--r--Utilities/cmlibuv/src/timer.c1
-rw-r--r--Utilities/cmlibuv/src/unix/async.c2
-rw-r--r--Utilities/cmlibuv/src/unix/atomic-ops.h6
-rw-r--r--Utilities/cmlibuv/src/unix/bsd-ifaddrs.c6
-rw-r--r--Utilities/cmlibuv/src/unix/bsd-proctitle.c4
-rw-r--r--Utilities/cmlibuv/src/unix/cmake-bootstrap.c21
-rw-r--r--Utilities/cmlibuv/src/unix/core.c28
-rw-r--r--Utilities/cmlibuv/src/unix/darwin.c12
-rw-r--r--Utilities/cmlibuv/src/unix/epoll.c422
-rw-r--r--Utilities/cmlibuv/src/unix/freebsd.c15
-rw-r--r--Utilities/cmlibuv/src/unix/fs.c194
-rw-r--r--Utilities/cmlibuv/src/unix/fsevents.c23
-rw-r--r--Utilities/cmlibuv/src/unix/getaddrinfo.c3
-rw-r--r--Utilities/cmlibuv/src/unix/ibmi.c47
-rw-r--r--Utilities/cmlibuv/src/unix/internal.h30
-rw-r--r--Utilities/cmlibuv/src/unix/linux-core.c567
-rw-r--r--Utilities/cmlibuv/src/unix/linux-inotify.c2
-rw-r--r--Utilities/cmlibuv/src/unix/linux-syscalls.c37
-rw-r--r--Utilities/cmlibuv/src/unix/linux-syscalls.h7
-rw-r--r--Utilities/cmlibuv/src/unix/os390-proctitle.c136
-rw-r--r--Utilities/cmlibuv/src/unix/os390-syscalls.c57
-rw-r--r--Utilities/cmlibuv/src/unix/os390-syscalls.h2
-rw-r--r--Utilities/cmlibuv/src/unix/os390.c136
-rw-r--r--Utilities/cmlibuv/src/unix/pipe.c54
-rw-r--r--Utilities/cmlibuv/src/unix/poll.c14
-rw-r--r--Utilities/cmlibuv/src/unix/process.c210
-rw-r--r--Utilities/cmlibuv/src/unix/proctitle.c4
-rw-r--r--Utilities/cmlibuv/src/unix/signal.c2
-rw-r--r--Utilities/cmlibuv/src/unix/stream.c219
-rw-r--r--Utilities/cmlibuv/src/unix/sunos.c11
-rw-r--r--Utilities/cmlibuv/src/unix/tcp.c53
-rw-r--r--Utilities/cmlibuv/src/unix/thread.c12
-rw-r--r--Utilities/cmlibuv/src/unix/tty.c18
-rw-r--r--Utilities/cmlibuv/src/unix/udp.c39
-rw-r--r--Utilities/cmlibuv/src/uv-common.c25
-rw-r--r--Utilities/cmlibuv/src/uv-common.h9
-rw-r--r--Utilities/cmlibuv/src/win/error.c2
-rw-r--r--Utilities/cmlibuv/src/win/fs-event.c6
-rw-r--r--Utilities/cmlibuv/src/win/fs.c67
-rw-r--r--Utilities/cmlibuv/src/win/internal.h4
-rw-r--r--Utilities/cmlibuv/src/win/pipe.c229
-rw-r--r--Utilities/cmlibuv/src/win/poll.c3
-rw-r--r--Utilities/cmlibuv/src/win/process-stdio.c96
-rw-r--r--Utilities/cmlibuv/src/win/process.c9
-rw-r--r--Utilities/cmlibuv/src/win/stream.c23
-rw-r--r--Utilities/cmlibuv/src/win/tcp.c260
-rw-r--r--Utilities/cmlibuv/src/win/udp.c4
-rw-r--r--Utilities/cmlibuv/src/win/util.c20
-rw-r--r--Utilities/cmlibuv/src/win/winapi.c10
-rw-r--r--Utilities/cmlibuv/src/win/winapi.h7
-rw-r--r--Utilities/cmnghttp2/CMakeLists.txt2
-rw-r--r--Utilities/cmzlib/CMakeLists.txt2
-rw-r--r--Utilities/cmzstd/CMakeLists.txt2
-rwxr-xr-xbootstrap3
743 files changed, 10612 insertions, 4300 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 06570d91be..2cb4716554 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -59,7 +59,7 @@ p:doc-package:
- .cmake_doc_artifacts
- .run_only_for_package
-.u:source-package:
+u:source-package:
extends:
- .rsync_upload_binary
- .run_only_for_package
@@ -77,7 +77,7 @@ b:help:master:
- .cmake_org_help
- .run_only_for_continuous_master
-.u:help:master:
+u:help:master:
extends:
- .rsync_upload_help
- .run_only_for_continuous_master
@@ -93,7 +93,7 @@ b:help:stage:
- .cmake_org_help
- .run_only_for_continuous_stage
-.u:help:stage:
+u:help:stage:
extends:
- .rsync_upload_help
- .run_only_for_continuous_stage
@@ -529,7 +529,7 @@ b:linux-x86_64-package:
needs:
- p:doc-package
-.u:linux-x86_64-package:
+u:linux-x86_64-package:
extends:
- .rsync_upload_binary
- .run_only_for_package
@@ -553,7 +553,7 @@ b:linux-aarch64-package:
needs:
- p:doc-package
-.u:linux-aarch64-package:
+u:linux-aarch64-package:
extends:
- .rsync_upload_binary
- .run_only_for_package
@@ -694,7 +694,7 @@ b:macos-package:
needs:
- p:doc-package
-.u:macos-package:
+u:macos-package:
extends:
- .rsync_upload_binary
- .run_only_for_package
@@ -717,7 +717,7 @@ b:macos10.10-package:
needs:
- p:doc-package
-.u:macos10.10-package:
+u:macos10.10-package:
extends:
- .rsync_upload_binary
- .run_only_for_package
@@ -749,6 +749,8 @@ t:windows-vs2022-x64-ninja:
- b:windows-vs2022-x64-ninja
needs:
- b:windows-vs2022-x64-ninja
+ variables:
+ CMAKE_CI_JOB_NIGHTLY_NINJA: "true"
t:windows-vs2022-x64:
extends:
@@ -761,3 +763,101 @@ t:windows-vs2022-x64:
- t:windows-vs2022-x64-ninja
needs:
- t:windows-vs2022-x64-ninja
+
+t:windows-vs2019-x64:
+ extends:
+ - .windows_vs2019_x64
+ - .cmake_test_windows_external
+ - .windows_tags_concurrent_vs2019
+ - .cmake_junit_artifacts
+ - .run_dependent
+ dependencies:
+ - t:windows-vs2022-x64-ninja
+ needs:
+ - t:windows-vs2022-x64-ninja
+ variables:
+ CMAKE_CI_JOB_NIGHTLY: "true"
+
+t:windows-vs2022-x64-nmake:
+ extends:
+ - .windows_vs2022_x64_nmake
+ - .cmake_test_windows_nmake
+ - .windows_tags_concurrent_vs2022
+ - .cmake_junit_artifacts
+ - .run_dependent
+ dependencies:
+ - t:windows-vs2022-x64-ninja
+ needs:
+ - t:windows-vs2022-x64-ninja
+ variables:
+ CMAKE_CI_JOB_NIGHTLY: "true"
+
+t:windows-vs2022-x64-jom:
+ extends:
+ - .windows_vs2022_x64_jom
+ - .cmake_test_windows_jom
+ - .windows_tags_concurrent_vs2022
+ - .cmake_junit_artifacts
+ - .run_dependent
+ dependencies:
+ - t:windows-vs2022-x64-ninja
+ needs:
+ - t:windows-vs2022-x64-ninja
+ variables:
+ CMAKE_CI_JOB_NIGHTLY: "true"
+
+t:windows-borland5.5:
+ extends:
+ - .windows_borland5.5
+ - .cmake_test_windows_borland
+ - .windows_tags_concurrent
+ - .cmake_junit_artifacts
+ - .run_dependent
+ dependencies:
+ - t:windows-vs2022-x64-ninja
+ needs:
+ - t:windows-vs2022-x64-ninja
+ variables:
+ CMAKE_CI_JOB_NIGHTLY: "true"
+
+t:windows-borland5.8:
+ extends:
+ - .windows_borland5.8
+ - .cmake_test_windows_borland
+ - .windows_tags_concurrent
+ - .cmake_junit_artifacts
+ - .run_dependent
+ dependencies:
+ - t:windows-vs2022-x64-ninja
+ needs:
+ - t:windows-vs2022-x64-ninja
+ variables:
+ CMAKE_CI_JOB_NIGHTLY: "true"
+
+t:windows-msvc-v71-nmake:
+ extends:
+ - .windows_msvc_v71_nmake
+ - .cmake_test_windows_msvc
+ - .windows_tags_concurrent
+ - .cmake_junit_artifacts
+ - .run_dependent
+ dependencies:
+ - t:windows-vs2022-x64-ninja
+ needs:
+ - t:windows-vs2022-x64-ninja
+ variables:
+ CMAKE_CI_JOB_NIGHTLY: "true"
+
+t:windows-openwatcom1.9:
+ extends:
+ - .windows_openwatcom1.9
+ - .cmake_test_windows_openwatcom
+ - .windows_tags_concurrent
+ - .cmake_junit_artifacts
+ - .run_dependent
+ dependencies:
+ - t:windows-vs2022-x64-ninja
+ needs:
+ - t:windows-vs2022-x64-ninja
+ variables:
+ CMAKE_CI_JOB_NIGHTLY: "true"
diff --git a/.gitlab/ci/borland.ps1 b/.gitlab/ci/borland.ps1
new file mode 100755
index 0000000000..146a0471f3
--- /dev/null
+++ b/.gitlab/ci/borland.ps1
@@ -0,0 +1,37 @@
+$erroractionpreference = "stop"
+
+if ("$env:CMAKE_CONFIGURATION".Contains("borland5.5")) {
+ # Borland C++ 5.5 Free Command-line Tools
+ # https://web.archive.org/web/20110402064356/https://www.embarcadero.com/products/cbuilder/free-compiler
+ $filename = "bcc5.5-1"
+ $sha256sum = "895B76F8F1AD8030F31ACE239EBC623DC7379C121A540F55F611B93F3CB9AF52"
+} elseif ("$env:CMAKE_CONFIGURATION".Contains("borland5.8")) {
+ # Borland C++ Builder 2006
+ # https://web.archive.org/web/20060303030019/https://www.borland.com/us/products/cbuilder/index.html
+ $filename = "bcc5.8-1"
+ $sha256sum = "C30981BFD540C933E76D82D873DEE05E7482F34F68E309065DE0D181C95F77E3"
+} else {
+ throw ('unknown CMAKE_CONFIGURATION: ' + "$env:CMAKE_CONFIGURATION")
+}
+$tarball = "$filename.zip"
+
+$outdir = $pwd.Path
+$outdir = "$outdir\.gitlab"
+$ProgressPreference = 'SilentlyContinue'
+# This URL is only visible inside of Kitware's network. See above filename table.
+Invoke-WebRequest -Uri "https://cmake.org/files/dependencies/internal/$tarball" -OutFile "$outdir\$tarball"
+$hash = Get-FileHash "$outdir\$tarball" -Algorithm SHA256
+if ($hash.Hash -ne $sha256sum) {
+ exit 1
+}
+
+Add-Type -AssemblyName System.IO.Compression.FileSystem
+[System.IO.Compression.ZipFile]::ExtractToDirectory("$outdir\$tarball", "$outdir")
+Move-Item -Path "$outdir\$filename" -Destination "$outdir\bcc"
+
+$tools = "bcc32", "ilink32"
+foreach ($tool in $tools) {
+ $cfg = Get-Content -path "$outdir\bcc\bin\$tool.cfg.in" -Raw
+ $cfg = $cfg -replace "@BCC_ROOT@","$outdir\bcc"
+ $cfg | Set-Content -path "$outdir\bcc\bin\$tool.cfg"
+}
diff --git a/.gitlab/ci/configure_windows_borland5.5.cmake b/.gitlab/ci/configure_windows_borland5.5.cmake
new file mode 100644
index 0000000000..82c4178aea
--- /dev/null
+++ b/.gitlab/ci/configure_windows_borland5.5.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_borland_common.cmake")
diff --git a/.gitlab/ci/configure_windows_borland5.8.cmake b/.gitlab/ci/configure_windows_borland5.8.cmake
new file mode 100644
index 0000000000..82c4178aea
--- /dev/null
+++ b/.gitlab/ci/configure_windows_borland5.8.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_borland_common.cmake")
diff --git a/.gitlab/ci/configure_windows_borland_common.cmake b/.gitlab/ci/configure_windows_borland_common.cmake
new file mode 100644
index 0000000000..6d66a05024
--- /dev/null
+++ b/.gitlab/ci/configure_windows_borland_common.cmake
@@ -0,0 +1,2 @@
+set(configure_no_sccache 1)
+include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_windows_msvc_common.cmake b/.gitlab/ci/configure_windows_msvc_common.cmake
new file mode 100644
index 0000000000..6d66a05024
--- /dev/null
+++ b/.gitlab/ci/configure_windows_msvc_common.cmake
@@ -0,0 +1,2 @@
+set(configure_no_sccache 1)
+include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_windows_msvc_v71_nmake.cmake b/.gitlab/ci/configure_windows_msvc_v71_nmake.cmake
new file mode 100644
index 0000000000..166690abe0
--- /dev/null
+++ b/.gitlab/ci/configure_windows_msvc_v71_nmake.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_msvc_common.cmake")
diff --git a/.gitlab/ci/configure_windows_openwatcom1.9.cmake b/.gitlab/ci/configure_windows_openwatcom1.9.cmake
new file mode 100644
index 0000000000..f29c3f486a
--- /dev/null
+++ b/.gitlab/ci/configure_windows_openwatcom1.9.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_openwatcom_common.cmake")
diff --git a/.gitlab/ci/configure_windows_openwatcom_common.cmake b/.gitlab/ci/configure_windows_openwatcom_common.cmake
new file mode 100644
index 0000000000..6d66a05024
--- /dev/null
+++ b/.gitlab/ci/configure_windows_openwatcom_common.cmake
@@ -0,0 +1,2 @@
+set(configure_no_sccache 1)
+include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_windows_vs2019_x64.cmake b/.gitlab/ci/configure_windows_vs2019_x64.cmake
new file mode 100644
index 0000000000..c7d41ea1d4
--- /dev/null
+++ b/.gitlab/ci/configure_windows_vs2019_x64.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_vs_common.cmake")
diff --git a/.gitlab/ci/configure_windows_vs2019_x64_ninja.cmake b/.gitlab/ci/configure_windows_vs2019_x64_ninja.cmake
new file mode 100644
index 0000000000..c078f9049e
--- /dev/null
+++ b/.gitlab/ci/configure_windows_vs2019_x64_ninja.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_vs_common_ninja.cmake")
diff --git a/.gitlab/ci/configure_windows_vs2022_x64.cmake b/.gitlab/ci/configure_windows_vs2022_x64.cmake
index f6ece57c88..c7d41ea1d4 100644
--- a/.gitlab/ci/configure_windows_vs2022_x64.cmake
+++ b/.gitlab/ci/configure_windows_vs2022_x64.cmake
@@ -1,3 +1 @@
-set(CMake_TEST_WIX_NO_VERIFY "ON" CACHE BOOL "")
-
-include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_vs_common.cmake")
diff --git a/.gitlab/ci/configure_windows_vs2022_x64_jom.cmake b/.gitlab/ci/configure_windows_vs2022_x64_jom.cmake
new file mode 100644
index 0000000000..166690abe0
--- /dev/null
+++ b/.gitlab/ci/configure_windows_vs2022_x64_jom.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_msvc_common.cmake")
diff --git a/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake b/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake
index e1ae81e3d3..c078f9049e 100644
--- a/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake
+++ b/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake
@@ -1,7 +1 @@
-set(CMake_TEST_WIX_NO_VERIFY "ON" CACHE BOOL "")
-set(CMake_TEST_GUI "ON" CACHE BOOL "")
-set(CMake_TEST_FindOpenGL "ON" CACHE BOOL "")
-set(CMake_TEST_IPO_WORKS_C "ON" CACHE BOOL "")
-set(CMake_TEST_IPO_WORKS_CXX "ON" CACHE BOOL "")
-
-include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_common.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_vs_common_ninja.cmake")
diff --git a/.gitlab/ci/configure_windows_vs2022_x64_nmake.cmake b/.gitlab/ci/configure_windows_vs2022_x64_nmake.cmake
new file mode 100644
index 0000000000..166690abe0
--- /dev/null
+++ b/.gitlab/ci/configure_windows_vs2022_x64_nmake.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_msvc_common.cmake")
diff --git a/.gitlab/ci/configure_windows_vs_common.cmake b/.gitlab/ci/configure_windows_vs_common.cmake
new file mode 100644
index 0000000000..a0a474242e
--- /dev/null
+++ b/.gitlab/ci/configure_windows_vs_common.cmake
@@ -0,0 +1,8 @@
+set(CMake_TEST_WIX_NO_VERIFY "ON" CACHE BOOL "")
+set(CMake_TEST_FindODBC "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenMP "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenMP_C "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenMP_CXX "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenMP_Fortran "OFF" CACHE BOOL "")
+
+include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_windows_vs_common_ninja.cmake b/.gitlab/ci/configure_windows_vs_common_ninja.cmake
new file mode 100644
index 0000000000..ae73f8352c
--- /dev/null
+++ b/.gitlab/ci/configure_windows_vs_common_ninja.cmake
@@ -0,0 +1,12 @@
+set(CMake_TEST_WIX_NO_VERIFY "ON" CACHE BOOL "")
+set(CMake_TEST_GUI "ON" CACHE BOOL "")
+set(CMake_TEST_FindODBC "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenGL "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenMP "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenMP_C "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenMP_CXX "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenMP_Fortran "OFF" CACHE BOOL "")
+set(CMake_TEST_IPO_WORKS_C "ON" CACHE BOOL "")
+set(CMake_TEST_IPO_WORKS_CXX "ON" CACHE BOOL "")
+
+include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_common.cmake")
diff --git a/.gitlab/ci/jom.ps1 b/.gitlab/ci/jom.ps1
new file mode 100755
index 0000000000..6c28005f66
--- /dev/null
+++ b/.gitlab/ci/jom.ps1
@@ -0,0 +1,15 @@
+$erroractionpreference = "stop"
+
+$sha256sum = "128FDD846FE24F8594EED37D1D8929A0EA78DF563537C0C1B1861A635013FFF8"
+$tarball = "unstable-jom-2018-12-12.zip"
+
+$outdir = $pwd.Path
+$outdir = "$outdir\.gitlab"
+$ProgressPreference = 'SilentlyContinue'
+Invoke-WebRequest -Uri "https://cmake.org/files/dependencies/$tarball" -OutFile "$outdir\$tarball"
+$hash = Get-FileHash "$outdir\$tarball" -Algorithm SHA256
+if ($hash.Hash -ne $sha256sum) {
+ exit 1
+}
+
+Expand-Archive -Path "$outdir\$tarball" -DestinationPath "$outdir\jom"
diff --git a/.gitlab/ci/msvc.ps1 b/.gitlab/ci/msvc.ps1
new file mode 100755
index 0000000000..e8388a4796
--- /dev/null
+++ b/.gitlab/ci/msvc.ps1
@@ -0,0 +1,31 @@
+$erroractionpreference = "stop"
+
+if ("$env:CMAKE_CONFIGURATION".Contains("msvc_v71")) {
+ # MSVC v71 Toolset from Visual Studio 7 .NET 2003
+ $filename = "msvc-v71-1"
+ $sha256sum = "01637CDC670EA5D631E169E286ACDD1913A124E3C5AF4C3DFB37657ADE8BBA9F"
+ $vcvars = "Vc7\bin\vcvars32.bat"
+} else {
+ throw ('unknown CMAKE_CONFIGURATION: ' + "$env:CMAKE_CONFIGURATION")
+}
+$tarball = "$filename.zip"
+
+$outdir = $pwd.Path
+$outdir = "$outdir\.gitlab"
+$ProgressPreference = 'SilentlyContinue'
+# This URL is only visible inside of Kitware's network. See above filename table.
+Invoke-WebRequest -Uri "https://cmake.org/files/dependencies/internal/$tarball" -OutFile "$outdir\$tarball"
+$hash = Get-FileHash "$outdir\$tarball" -Algorithm SHA256
+if ($hash.Hash -ne $sha256sum) {
+ exit 1
+}
+
+Add-Type -AssemblyName System.IO.Compression.FileSystem
+[System.IO.Compression.ZipFile]::ExtractToDirectory("$outdir\$tarball", "$outdir")
+Move-Item -Path "$outdir\$filename" -Destination "$outdir\msvc"
+
+$bat = Get-Content -path "$outdir\msvc\$vcvars.in" -Raw
+$bat = $bat -replace "@VS_ROOT@","$outdir\msvc"
+$bat | Set-Content -path "$outdir\msvc\$vcvars"
+
+Set-Item -Force -Path "env:VCVARSALL" -Value "$outdir\msvc\$vcvars"
diff --git a/.gitlab/ci/ninja-nightly.ps1 b/.gitlab/ci/ninja-nightly.ps1
new file mode 100755
index 0000000000..071b07712c
--- /dev/null
+++ b/.gitlab/ci/ninja-nightly.ps1
@@ -0,0 +1,9 @@
+$erroractionpreference = "stop"
+
+Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1
+Set-Location -Path ".gitlab"
+git clone https://github.com/ninja-build/ninja.git ninja-src
+cmake -S ninja-src -B ninja-src/build -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release
+cmake --build ninja-src/build --target ninja
+Move-Item -Path "ninja-src\build\ninja.exe" -Destination . -Force
+Remove-Item "ninja-src" -Recurse -Force
diff --git a/.gitlab/ci/ninja.ps1 b/.gitlab/ci/ninja.ps1
index 4c5333ab73..47bb0561e5 100755
--- a/.gitlab/ci/ninja.ps1
+++ b/.gitlab/ci/ninja.ps1
@@ -1,5 +1,10 @@
$erroractionpreference = "stop"
+if ("$env:CMAKE_CI_JOB_NIGHTLY_NINJA" -eq "true" -And "$env:CMAKE_CI_NIGHTLY" -eq "true") {
+ & .gitlab/ci/ninja-nightly.ps1
+ exit $LASTEXITCODE
+}
+
$version = "1.10.2"
$sha256sum = "BBDE850D247D2737C5764C927D1071CBB1F1957DCABDA4A130FA8547C12C695F"
$filename = "ninja-win"
diff --git a/.gitlab/ci/openwatcom.ps1 b/.gitlab/ci/openwatcom.ps1
new file mode 100755
index 0000000000..4f1012cc8f
--- /dev/null
+++ b/.gitlab/ci/openwatcom.ps1
@@ -0,0 +1,25 @@
+$erroractionpreference = "stop"
+
+if ("$env:CMAKE_CONFIGURATION".Contains("openwatcom1.9")) {
+ # Open Watcom 1.9
+ # https://web.archive.org/web/20210312132437/http://www.openwatcom.org/download.php
+ $filename = "open-watcom-1.9-1"
+ $sha256sum = "FFE6F5BBA200912697C6EC26C4D3B2623A0358FBE7CBB23BD264CBF7D54E4988"
+} else {
+ throw ('unknown CMAKE_CONFIGURATION: ' + "$env:CMAKE_CONFIGURATION")
+}
+$tarball = "$filename.zip"
+
+$outdir = $pwd.Path
+$outdir = "$outdir\.gitlab"
+$ProgressPreference = 'SilentlyContinue'
+# This URL is only visible inside of Kitware's network. See above filename table.
+Invoke-WebRequest -Uri "https://cmake.org/files/dependencies/internal/$tarball" -OutFile "$outdir\$tarball"
+$hash = Get-FileHash "$outdir\$tarball" -Algorithm SHA256
+if ($hash.Hash -ne $sha256sum) {
+ exit 1
+}
+
+Add-Type -AssemblyName System.IO.Compression.FileSystem
+[System.IO.Compression.ZipFile]::ExtractToDirectory("$outdir\$tarball", "$outdir")
+Move-Item -Path "$outdir\$filename" -Destination "$outdir\watcom"
diff --git a/.gitlab/ci/vcvarsall.ps1 b/.gitlab/ci/vcvarsall.ps1
index 57d338632b..f91b100840 100755
--- a/.gitlab/ci/vcvarsall.ps1
+++ b/.gitlab/ci/vcvarsall.ps1
@@ -1,6 +1,6 @@
$erroractionpreference = "stop"
-cmd /c "`"$env:VCVARSALL`" $VCVARSPLATFORM -vcvars_ver=$VCVARSVERSION & set" |
+cmd /c "`"$env:VCVARSALL`" $env:VCVARSPLATFORM -vcvars_ver=$env:VCVARSVERSION & set" |
foreach {
if ($_ -match "=") {
$v = $_.split("=")
diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml
index a1194331bf..e15bbe9e8f 100644
--- a/.gitlab/os-windows.yml
+++ b/.gitlab/os-windows.yml
@@ -31,15 +31,20 @@
CMAKE_CI_BUILD_TYPE: Release
CTEST_NO_WARNINGS_ALLOWED: 1
-.windows_vs2022_x64_ninja:
- extends: .windows_ninja
-
+.windows_vcvarsall_vs2022_x64:
variables:
- CMAKE_CONFIGURATION: windows_vs2022_x64_ninja
VCVARSALL: "${VS170COMNTOOLS}\\..\\..\\VC\\Auxiliary\\Build\\vcvarsall.bat"
VCVARSPLATFORM: "x64"
VCVARSVERSION: "14.30.30705"
+.windows_vs2022_x64_ninja:
+ extends:
+ - .windows_ninja
+ - .windows_vcvarsall_vs2022_x64
+
+ variables:
+ CMAKE_CONFIGURATION: windows_vs2022_x64_ninja
+
### External testing
.windows_vs2022_x64:
@@ -52,6 +57,90 @@
CMAKE_GENERATOR_TOOLSET: "v143,version=14.30.30705"
CMAKE_CI_NIGHTLY_IGNORE_DEPS: "true"
+.windows_vs2019_x64:
+ extends: .windows
+
+ variables:
+ CMAKE_CONFIGURATION: windows_vs2019_x64
+ CMAKE_GENERATOR: "Visual Studio 16 2019"
+ CMAKE_GENERATOR_PLATFORM: "x64"
+ CMAKE_GENERATOR_TOOLSET: "v142,version=14.29.30133"
+ CMAKE_CI_NIGHTLY_IGNORE_DEPS: "true"
+
+.windows_borland:
+ extends: .windows
+
+ variables:
+ CMAKE_GENERATOR: "Borland Makefiles"
+ CMAKE_CI_BUILD_TYPE: Release
+ CMAKE_CI_NIGHTLY_IGNORE_DEPS: "true"
+
+.windows_borland5.5:
+ extends: .windows_borland
+
+ variables:
+ CMAKE_CONFIGURATION: windows_borland5.5
+
+.windows_borland5.8:
+ extends: .windows_borland
+
+ variables:
+ CMAKE_CONFIGURATION: windows_borland5.8
+
+.windows_nmake:
+ extends: .windows
+
+ variables:
+ CMAKE_GENERATOR: "NMake Makefiles"
+ CMAKE_CI_BUILD_TYPE: Release
+ CMAKE_CI_NIGHTLY_IGNORE_DEPS: "true"
+
+.windows_jom:
+ extends: .windows
+
+ variables:
+ CMAKE_GENERATOR: "NMake Makefiles JOM"
+ CMAKE_CI_BUILD_TYPE: Release
+ CMAKE_CI_NIGHTLY_IGNORE_DEPS: "true"
+
+.windows_vs2022_x64_nmake:
+ extends:
+ - .windows_nmake
+ - .windows_vcvarsall_vs2022_x64
+
+ variables:
+ CMAKE_CONFIGURATION: windows_vs2022_x64_nmake
+
+.windows_vs2022_x64_jom:
+ extends:
+ - .windows_jom
+ - .windows_vcvarsall_vs2022_x64
+
+ variables:
+ CMAKE_CONFIGURATION: windows_vs2022_x64_jom
+
+.windows_msvc_v71_nmake:
+ extends: .windows_nmake
+
+ variables:
+ CMAKE_CONFIGURATION: windows_msvc_v71_nmake
+
+.windows_openwatcom:
+ extends: .windows
+
+ variables:
+ # Watcom does not support spaces in the path.
+ GIT_CLONE_PATH: "$CI_BUILDS_DIR\\cmake-ci-ext\\$CI_CONCURRENT_ID"
+ CMAKE_GENERATOR: "Watcom WMake"
+ CMAKE_CI_BUILD_TYPE: Release
+ CMAKE_CI_NIGHTLY_IGNORE_DEPS: "true"
+
+.windows_openwatcom1.9:
+ extends: .windows_openwatcom
+
+ variables:
+ CMAKE_CONFIGURATION: windows_openwatcom1.9
+
## Tags
.windows_tags_nonconcurrent_vs2022:
@@ -72,16 +161,33 @@
- msvc-19.30
- concurrent
+.windows_tags_concurrent_vs2019:
+ tags:
+ - cmake # Since this is a bare runner, pin to a project.
+ - windows
+ - shell
+ - vs2019
+ - msvc-19.29-16.11
+ - concurrent
+
+.windows_tags_concurrent:
+ tags:
+ - cmake # Since this is a bare runner, pin to a project.
+ - windows
+ - shell
+ - concurrent
+
## Windows-specific scripts
.before_script_windows: &before_script_windows
- - Invoke-Expression -Command .gitlab/ci/wix.ps1
- - Invoke-Expression -Command .gitlab/ci/cmake.ps1
- - Invoke-Expression -Command .gitlab/ci/ninja.ps1
- $pwdpath = $pwd.Path
+ - powershell -File ".gitlab/ci/wix.ps1"
- Set-Item -Force -Path "env:WIX" -Value "$pwdpath\.gitlab\wix"
+ - powershell -File ".gitlab/ci/cmake.ps1"
+ - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\cmake\bin;$env:PATH"
+ - powershell -File ".gitlab/ci/ninja.ps1"
+ - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab;$env:PATH"
- (& "$env:WIX\bin\light.exe" -help) | Select -First 1
- - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab;$pwdpath\.gitlab\cmake\bin;$env:PATH"
- cmake --version
- ninja --version
- cmake -P .gitlab/ci/download_qt.cmake
@@ -123,3 +229,60 @@
- build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake
interruptible: true
+
+.cmake_test_windows_nmake:
+ stage: test-ext
+
+ script:
+ - Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1
+ - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake
+
+ interruptible: true
+
+.cmake_test_windows_jom:
+ stage: test-ext
+
+ script:
+ - Invoke-Expression -Command .gitlab/ci/jom.ps1
+ - $pwdpath = $pwd.Path
+ - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\jom;$env:PATH"
+ - Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1
+ - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake
+
+ interruptible: true
+
+.cmake_test_windows_borland:
+ stage: test-ext
+
+ script:
+ - Invoke-Expression -Command .gitlab/ci/borland.ps1
+ - $pwdpath = $pwd.Path
+ - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\bcc\bin;$env:PATH"
+ - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake
+
+ interruptible: true
+
+.cmake_test_windows_msvc:
+ stage: test-ext
+
+ script:
+ - Invoke-Expression -Command .gitlab/ci/msvc.ps1
+ - Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1
+ - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake
+
+ interruptible: true
+
+.cmake_test_windows_openwatcom:
+ stage: test-ext
+
+ script:
+ - Invoke-Expression -Command .gitlab/ci/openwatcom.ps1
+ - $pwdpath = $pwd.Path
+ - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\watcom\binnt;$pwdpath\.gitlab\watcom\binw;$env:PATH"
+ - Set-Item -Force -Path "env:INCLUDE" -Value "$pwdpath\.gitlab\watcom\h;$pwdpath\.gitlab\watcom\h\nt"
+ - Set-Item -Force -Path "env:EDPATH" -Value "$pwdpath\.gitlab\watcom\eddat"
+ - Set-Item -Force -Path "env:WATCOM" -Value "$pwdpath\.gitlab\watcom"
+ - Set-Item -Force -Path "env:WLINKTMP" -Value "."
+ - build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_test_external.cmake
+
+ interruptible: true
diff --git a/Auxiliary/cmake.m4 b/Auxiliary/cmake.m4
index a40c0ae977..39826bcd2e 100644
--- a/Auxiliary/cmake.m4
+++ b/Auxiliary/cmake.m4
@@ -13,7 +13,7 @@ fi
# $2: language (e.g. C/CXX/Fortran)
# $3: The compiler ID, defaults to GNU.
# Possible values are: GNU, Intel, Clang, SunPro, HP, XL, VisualAge, PGI,
-# PathScale, Cray, SCO, MSVC
+# PathScale, Cray, SCO, MSVC, LCC
# $4: optional extra arguments to cmake, e.g. "-DCMAKE_SIZEOF_VOID_P=8"
# $5: optional path to cmake binary
AC_DEFUN([CMAKE_FIND_PACKAGE], [
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim
index 7a3e4ed624..52330f7c51 100644
--- a/Auxiliary/vim/syntax/cmake.vim
+++ b/Auxiliary/vim/syntax/cmake.vim
@@ -426,6 +426,7 @@ syn keyword cmakeProperty contained
\ XCODE_SCHEME_ARGUMENTS
\ XCODE_SCHEME_DEBUG_AS_ROOT
\ XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING
+ \ XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE
\ XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER
\ XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS
\ XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE
@@ -1524,6 +1525,7 @@ syn keyword cmakeVariable contained
\ CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER
\ CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN
\ CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING
+ \ CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE
\ CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER
\ CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS
\ CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE
@@ -1608,6 +1610,7 @@ syn keyword cmakeVariable contained
\ CTEST_SCP_COMMAND
\ CTEST_SITE
\ CTEST_SOURCE_DIRECTORY
+ \ CTEST_SUBMIT_INACTIVITY_TIMEOUT
\ CTEST_SUBMIT_URL
\ CTEST_SVN_COMMAND
\ CTEST_SVN_OPTIONS
@@ -1900,7 +1903,7 @@ syn keyword cmakeVariable contained
\ DOXYGEN_XML_PROGRAMLISTING
\ ENV
\ EXECUTABLE_OUTPUT_PATH
- \ GHS-MULTI
+ \ GHSMULTI
\ IOS
\ LIBRARY_OUTPUT_PATH
\ MINGW
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fdfe456aa9..1fe847f9ae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,9 +1,14 @@
# 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.1...3.20 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.1...3.21 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)
+
+if(POLICY CMP0129)
+ cmake_policy(SET CMP0129 NEW) # CMake 3.23
+endif()
+
project(CMake)
unset(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX)
unset(CMAKE_USER_MAKE_RULES_OVERRIDE_C)
@@ -633,7 +638,7 @@ macro (CMAKE_BUILD_UTILITIES)
message(FATAL_ERROR
"CMAKE_USE_SYSTEM_JSONCPP is ON but a JsonCpp is not found!")
endif()
- if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
+ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC|Clang")
set_property(TARGET JsonCpp::JsonCpp APPEND PROPERTY
INTERFACE_COMPILE_OPTIONS -Wno-deprecated-declarations)
endif()
@@ -820,7 +825,8 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND
NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 3.0 AND
NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") OR
- CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
+ CMAKE_C_COMPILER_ID STREQUAL "AppleClang" OR
+ CMAKE_C_COMPILER_ID STREQUAL "LCC")
set(C_FLAGS_LIST -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts
-Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security
-Wmissing-format-attribute -fno-common -Wundef
diff --git a/Copyright.txt b/Copyright.txt
index 7f5129361a..b7031932b8 100644
--- a/Copyright.txt
+++ b/Copyright.txt
@@ -63,6 +63,7 @@ The following individuals and institutions are among the Contributors:
* Ilya Lavrenov <ilya.lavrenov@itseez.com>
* Insight Software Consortium <insightsoftwareconsortium.org>
* Jan Woetzel
+* Jordan Williams <jordan@jwillikers.com>
* Julien Schueller
* Kelly Thompson <kgt@lanl.gov>
* Konstantin Podsvirov <konstantin@podsvirov.pro>
diff --git a/Help/command/install.rst b/Help/command/install.rst
index 1236f1d32b..8216a69445 100644
--- a/Help/command/install.rst
+++ b/Help/command/install.rst
@@ -132,7 +132,7 @@ Installing Targets
install(TARGETS targets... [EXPORT <export-name>]
[RUNTIME_DEPENDENCIES args...|RUNTIME_DEPENDENCY_SET <set-name>]
[[ARCHIVE|LIBRARY|RUNTIME|OBJECTS|FRAMEWORK|BUNDLE|
- PRIVATE_HEADER|PUBLIC_HEADER|RESOURCE]
+ PRIVATE_HEADER|PUBLIC_HEADER|RESOURCE|FILE_SET <set-name>]
[DESTINATION <dir>]
[PERMISSIONS permissions...]
[CONFIGURATIONS [Debug|Release|...]]
@@ -204,6 +204,15 @@ that may be installed:
Similar to ``PUBLIC_HEADER`` and ``PRIVATE_HEADER``, but for
``RESOURCE`` files. See :prop_tgt:`RESOURCE` for details.
+``FILE_SET <set>``
+ .. versionadded:: 3.23
+
+ If the file set ``<set>`` exists and is ``PUBLIC`` or ``INTERFACE``, any
+ files added to the file set ``<set>`` created by
+ :command:`target_sources(FILE_SET)` are installed in the specified
+ destination, preserving their directory structure relative to the file set's
+ base directories.
+
For each of these arguments given, the arguments following them only apply
to the target or file type specified in the argument. If none is given, the
installation properties apply to all target types. If only one is given then
@@ -225,15 +234,16 @@ end of this section).
The following table shows the target types with their associated variables and
built-in defaults that apply when no destination is given:
-================== =============================== ======================
- Target Type GNUInstallDirs Variable Built-In Default
-================== =============================== ======================
-``RUNTIME`` ``${CMAKE_INSTALL_BINDIR}`` ``bin``
-``LIBRARY`` ``${CMAKE_INSTALL_LIBDIR}`` ``lib``
-``ARCHIVE`` ``${CMAKE_INSTALL_LIBDIR}`` ``lib``
-``PRIVATE_HEADER`` ``${CMAKE_INSTALL_INCLUDEDIR}`` ``include``
-``PUBLIC_HEADER`` ``${CMAKE_INSTALL_INCLUDEDIR}`` ``include``
-================== =============================== ======================
+=============================== =============================== ======================
+ Target Type GNUInstallDirs Variable Built-In Default
+=============================== =============================== ======================
+``RUNTIME`` ``${CMAKE_INSTALL_BINDIR}`` ``bin``
+``LIBRARY`` ``${CMAKE_INSTALL_LIBDIR}`` ``lib``
+``ARCHIVE`` ``${CMAKE_INSTALL_LIBDIR}`` ``lib``
+``PRIVATE_HEADER`` ``${CMAKE_INSTALL_INCLUDEDIR}`` ``include``
+``PUBLIC_HEADER`` ``${CMAKE_INSTALL_INCLUDEDIR}`` ``include``
+``FILE_SET`` (type ``HEADERS``) ``${CMAKE_INSTALL_INCLUDEDIR}`` ``include``
+=============================== =============================== ======================
Projects wishing to follow the common practice of installing headers into a
project-specific subdirectory will need to provide a destination rather than
@@ -338,6 +348,11 @@ top level:
See documentation of the :prop_tgt:`EXPORT_NAME` target property to change
the name of the exported target.
+ If ``EXPORT`` is used and the targets include ``PUBLIC`` or ``INTERFACE``
+ file sets, all of them must be specified with ``FILE_SET`` arguments. All
+ ``PUBLIC`` or ``INTERFACE`` file sets associated with a target are included
+ in the export.
+
``INCLUDES DESTINATION``
This option specifies a list of directories which will be added to the
:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` target property of the
diff --git a/Help/command/target_sources.rst b/Help/command/target_sources.rst
index 520614a17b..f4833e7a73 100644
--- a/Help/command/target_sources.rst
+++ b/Help/command/target_sources.rst
@@ -15,34 +15,154 @@ Specifies sources to use when building a target and/or its dependents.
The named ``<target>`` must have been created by a command such as
:command:`add_executable` or :command:`add_library` or
:command:`add_custom_target` and must not be an
-:ref:`ALIAS target <Alias Targets>`.
-
-.. versionchanged:: 3.13
- Relative source file paths are interpreted as being relative to the current
- source directory (i.e. :variable:`CMAKE_CURRENT_SOURCE_DIR`).
- See policy :policy:`CMP0076`.
+:ref:`ALIAS target <Alias Targets>`. The ``<items>`` may use
+:manual:`generator expressions <cmake-generator-expressions(7)>`.
.. versionadded:: 3.20
``<target>`` can be a custom target.
The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to
-specify the scope of the items following them. ``PRIVATE`` and ``PUBLIC``
-items will populate the :prop_tgt:`SOURCES` property of
-``<target>``, which are used when building the target itself.
+specify the scope of the source file paths (``<items>``) that follow
+them. ``PRIVATE`` and ``PUBLIC`` items will populate the :prop_tgt:`SOURCES`
+property of ``<target>``, which are used when building the target itself.
``PUBLIC`` and ``INTERFACE`` items will populate the
:prop_tgt:`INTERFACE_SOURCES` property of ``<target>``, which are used
-when building dependents.
-The following arguments specify sources. Repeated calls for the same
-``<target>`` append items in the order called. The targets created by
-:command:`add_custom_target` can only have ``PRIVATE`` scope.
+when building dependents. A target created by :command:`add_custom_target`
+can only have ``PRIVATE`` scope.
+
+Repeated calls for the same ``<target>`` append items in the order called.
.. versionadded:: 3.3
Allow exporting targets with :prop_tgt:`INTERFACE_SOURCES`.
.. versionadded:: 3.11
- Allow setting ``INTERFACE`` items on :ref:`IMPORTED targets <Imported Targets>`.
+ Allow setting ``INTERFACE`` items on
+ :ref:`IMPORTED targets <Imported Targets>`.
+
+.. versionchanged:: 3.13
+ Relative source file paths are interpreted as being relative to the current
+ source directory (i.e. :variable:`CMAKE_CURRENT_SOURCE_DIR`).
+ See policy :policy:`CMP0076`.
+
+A path that begins with a generator expression is left unmodified.
+When a target's :prop_tgt:`SOURCE_DIR` property differs from
+:variable:`CMAKE_CURRENT_SOURCE_DIR`, use absolute paths in generator
+expressions to ensure the sources are correctly assigned to the target.
+
+.. code-block:: cmake
+
+ # WRONG: starts with generator expression, but relative path used
+ target_sources(MyTarget "$<$<CONFIG:Debug>:dbgsrc.cpp>")
+
+ # CORRECT: absolute path used inside the generator expression
+ target_sources(MyTarget "$<$<CONFIG:Debug>:${CMAKE_CURRENT_SOURCE_DIR}/dbgsrc.cpp>")
+
+See the :manual:`cmake-buildsystem(7)` manual for more on defining
+buildsystem properties.
+
+File Sets
+^^^^^^^^^
+
+.. versionadded:: 3.23
+
+.. code-block:: cmake
+
+ target_sources(<target>
+ <INTERFACE|PUBLIC|PRIVATE> FILE_SET set1 [TYPE type1] [BASE_DIRS dirs1...] [FILES files1...]
+ [<INTERFACE|PUBLIC|PRIVATE> FILE_SET set2 [TYPE type2] [BASE_DIRS dirs2...] [FILES files2...])
+
+Adds a file set to a target, or adds files to an existing file set. Targets
+have zero or more named file sets. Each file set has a name, a type, a scope of
+``INTERFACE``, ``PUBLIC``, or ``PRIVATE``, one or more base directories, and
+files within those directories. The only acceptable type is ``HEADERS``. The
+optional default file sets are named after their type.
+
+Files in a ``PRIVATE`` or ``PUBLIC`` file set are marked as source files for
+the purposes of IDE integration. Additionally, files in ``HEADERS`` file sets
+have their :prop_sf:`HEADER_FILE_ONLY` property set to ``TRUE``. Files in an
+``INTERFACE`` or ``PUBLIC`` file set can be installed with the
+:command:`install(TARGETS)` command, and exported with the
+:command:`install(EXPORT)` and :command:`export` commands.
+
+Each ``target_sources(FILE_SET)`` entry starts with ``INTERFACE``, ``PUBLIC``, or
+``PRIVATE`` and accepts the following arguments:
+
+``FILE_SET <set>``
+
+ A string representing the name of the file set to create or add to. This must
+ not start with a capital letter, unless its name is ``HEADERS``.
+
+``TYPE <type>``
+
+ A string representing the type of the file set. The only acceptable value is
+ ``HEADERS``. This may be omitted if the name of the file set is ``HEADERS``.
+
+``BASE_DIRS <dirs>``
+
+ An optional list of strings representing the base directories of the file
+ set. This argument supports
+ :manual:`generator expressions <cmake-generator-expressions(7)>`. No two
+ ``BASE_DIRS`` may be sub-directories of each other. If no ``BASE_DIRS`` are
+ specified when the file set is first created, the value of
+ :variable:`CMAKE_CURRENT_SOURCE_DIR` is added.
+
+``FILES <files>``
+
+ An optional list of strings representing files in the file set. Each file
+ must be in one of the ``BASE_DIRS``. This argument supports
+ :manual:`generator expressions <cmake-generator-expressions(7)>`. If relative
+ paths are specified, they are considered relative to
+ :variable:`CMAKE_CURRENT_SOURCE_DIR` at the time ``target_sources()`` is
+ called, unless they start with ``$<``, in which case they are computed
+ relative to the target's source directory after genex evaluation.
+
+The following target properties are set by ``target_sources(FILE_SET)``:
+
+:prop_tgt:`HEADER_SETS`
+
+ List of ``PRIVATE`` and ``PUBLIC`` header sets associated with a target.
+ Headers listed in these header sets are treated as source files for the
+ purposes of IDE integration, and have their :prop_sf:`HEADER_FILE_ONLY`
+ property set to ``TRUE``.
+
+:prop_tgt:`INTERFACE_HEADER_SETS`
+
+ List of ``INTERFACE`` and ``PUBLIC`` header sets associated with a target.
+ Headers listed in these header sets can be installed with
+ :command:`install(TARGETS)` and exported with :command:`install(EXPORT)` and
+ :command:`export`.
+
+:prop_tgt:`HEADER_SET`
+
+ Headers in the default header set associated with a target. This property
+ supports :manual:`generator expressions <cmake-generator-expressions(7)>`.
+
+:prop_tgt:`HEADER_SET_<NAME>`
+
+ Headers in the named header set ``<NAME>`` associated with a target. This
+ property supports
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
+
+:prop_tgt:`HEADER_DIRS`
+
+ Base directories of the default header set associated with a target. This
+ property supports
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
+
+:prop_tgt:`HEADER_DIRS_<NAME>`
+
+ Base directories of the header set ``<NAME>`` associated with a target. This
+ property supports
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
+
+:prop_tgt:`INCLUDE_DIRECTORIES`
+
+ If the ``TYPE`` is ``HEADERS``, and the scope of the file set is ``PRIVATE``
+ or ``PUBLIC``, all of the ``BASE_DIRS`` of the file set are wrapped in
+ :genex:`$<BUILD_INTERFACE>` and appended to this property.
+
+:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`
-Arguments to ``target_sources`` may use "generator expressions"
-with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
-manual for available expressions. See the :manual:`cmake-buildsystem(7)`
-manual for more on defining buildsystem properties.
+ If the ``TYPE`` is ``HEADERS``, and the scope of the file set is
+ ``INTERFACE`` or ``PUBLIC``, all of the ``BASE_DIRS`` of the file set are
+ wrapped in :genex:`$<BUILD_INTERFACE>` and appended to this property.
diff --git a/Help/cpack_gen/ifw.rst b/Help/cpack_gen/ifw.rst
index 6817eac999..a293a16a80 100644
--- a/Help/cpack_gen/ifw.rst
+++ b/Help/cpack_gen/ifw.rst
@@ -195,6 +195,14 @@ Package
Is ``ON`` for QtIFW less 2.0 tools.
+.. variable:: CPACK_IFW_PACKAGE_DISABLE_COMMAND_LINE_INTERFACE
+
+ .. versionadded:: 3.23
+
+ Set to ``ON`` if command line interface features should be disabled.
+
+ Is ``OFF`` by default, but will only have an effect if using QtIFW 4.0 or later.
+
.. variable:: CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH
.. versionadded:: 3.3
@@ -248,6 +256,89 @@ Package
By default is ``OFF`` or used value
from ``CPACK_DOWNLOAD_ALL`` if set
+.. variable:: CPACK_IFW_PACKAGE_PRODUCT_IMAGES
+
+ .. versionadded:: 3.23
+
+ A list of images to be shown on the ``PerformInstallationPage``.
+
+ This feature is available for QtIFW 4.0.0 or newer.
+
+.. variable:: CPACK_IFW_PACKAGE_RUN_PROGRAM
+
+ .. versionadded:: 3.23
+
+ Command executed after the installer is done if the user accepts the action.
+ Provide the full path to the application.
+
+ This feature is available for QtIFW 4.0.0 and newer.
+
+.. variable:: CPACK_IFW_PACKAGE_RUN_PROGRAM_ARGUMENTS
+
+ .. versionadded:: 3.23
+
+ List of arguments passed to the program specified in
+ :variable:`CPACK_IFW_PACKAGE_RUN_PROGRAM`.
+
+ This feature is available for QtIFW 4.0.0 and newer.
+
+.. variable:: CPACK_IFW_PACKAGE_RUN_PROGRAM_DESCRIPTION
+
+ .. versionadded:: 3.23
+
+ Text shown next to the check box for running the program after the
+ installation. If :variable:`CPACK_IFW_PACKAGE_RUN_PROGRAM` is set but no
+ description provided, the UI will display ``Run <Name> now``. instead.
+
+ This feature is available for QtIFW 4.0.0 and newer.
+
+.. variable:: CPACK_IFW_PACKAGE_SIGNING_IDENTITY
+
+ .. versionadded: 3.23
+
+ Allows specifying a code signing identity to be used for signing the generated
+ app bundle. Only available on macOS.
+
+.. variable:: CPACK_IFW_ARCHIVE_FORMAT
+
+ .. versionadded:: 3.23
+
+ Set the format used when packaging new component data archives. If you omit
+ this option, the ``7z`` format will be used as a default. Supported formats:
+
+ * 7z
+ * zip
+ * tar.gz
+ * tar.bz2
+ * tar.xz
+
+ .. note::
+
+ If the Qt Installer Framework tools were built without libarchive support,
+ only ``7z`` format is supported.
+
+ This feature is available for QtIFW 4.2.0 and newer.
+
+.. variable:: CPACK_IFW_ARCHIVE_COMPRESSION
+
+ .. versionadded:: 3.23
+
+ Archive compression level. Defaults to 5 (*Normal compression*).
+
+ * 0 (*No compression*)
+ * 1 (*Fastest compressing*)
+ * 3 (*Fast compressing*)
+ * 5 (*Normal compressing*)
+ * 7 (*Maximum compressing*)
+ * 9 (*Ultra compressing*)
+
+ .. note::
+
+ Some formats do not support all the possible values. For example ``zip``
+ compression only supports values from 1 to 7.
+
+ This feature is available for QtIFW 4.2.0 and newer.
+
Components
""""""""""
diff --git a/Help/cpack_gen/productbuild.rst b/Help/cpack_gen/productbuild.rst
index cf3041f306..75d5cff6b9 100644
--- a/Help/cpack_gen/productbuild.rst
+++ b/Help/cpack_gen/productbuild.rst
@@ -18,6 +18,14 @@ macOS using ProductBuild:
the automatically detected command (or specify its location if the
auto-detection fails to find it).
+.. variable:: CPACK_PRODUCTBUILD_IDENTIFIER
+
+ .. versionadded:: 3.23
+
+ Set the unique (non-localized) product identifier to be associated with the
+ product (i.e., ``com.kitware.cmake``). Any component product names will be
+ appended to this value.
+
.. variable:: CPACK_PRODUCTBUILD_IDENTITY_NAME
.. versionadded:: 3.8
diff --git a/Help/cpack_gen/wix.rst b/Help/cpack_gen/wix.rst
index 79f835e71c..e9d5af63da 100644
--- a/Help/cpack_gen/wix.rst
+++ b/Help/cpack_gen/wix.rst
@@ -320,3 +320,11 @@ Windows using WiX.
name is the plain namespace without the usual xmlns: prefix and url is an unquoted
namespace url. A list of commonly known WiX schemata can be found here:
https://wixtoolset.org/documentation/manual/v3/xsd/
+
+.. variable:: CPACK_WIX_SKIP_WIX_UI_EXTENSION
+
+ .. versionadded:: 3.23
+
+ If this variable is set then the inclusion of WixUIExtensions is skipped,
+ i.e. the ``-ext "WixUIExtension"`` command line is not included during
+ the execution of the WiX light tool.
diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst
index 5d2b1cd4dc..1b4739b57c 100644
--- a/Help/generator/Green Hills MULTI.rst
+++ b/Help/generator/Green Hills MULTI.rst
@@ -8,70 +8,125 @@ Green Hills MULTI
Generates Green Hills MULTI project files (experimental, work-in-progress).
-Customizations are available through the following cache variables:
-
-* ``GHS_CUSTOMIZATION``
-* ``GHS_GPJ_MACROS``
-
-.. versionadded:: 3.14
The buildsystem has predetermined build-configuration settings that can be controlled
via the :variable:`CMAKE_BUILD_TYPE` variable.
-Toolset and Platform Selection
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Platform Selection
+^^^^^^^^^^^^^^^^^^
.. versionadded:: 3.13
-Customizations that are used to pick toolset and target system:
+The variable ``GHS_PRIMARY_TARGET`` can be used to select the target platform.
+
+ | Sets ``primaryTarget`` entry in project file.
+
+For example:
-* The ``-A <arch>`` can be supplied for setting the target architecture.
- ``<arch>`` usually is one of ``arm``, ``ppc``, ``86``, etcetera.
- If the target architecture is not specified then
- the default architecture of ``arm`` will be used.
+* ``cmake -G "Green Hills MULTI" -D GHS_PRIMARY_TARGET=ppc_integrity.tgt``
-* The ``-T <toolset>`` option can be used to set the directory location of the toolset.
- Both absolute and relative paths are valid. Relative paths use ``GHS_TOOLSET_ROOT``
- as the root. If the toolset is not specified then the latest toolset found in
- ``GHS_TOOLSET_ROOT`` will be used.
+Otherwise the ``primaryTarget`` will be composed from the values of :variable:`CMAKE_GENERATOR_PLATFORM`
+and ``GHS_TARGET_PLATFORM``. Defaulting to the value of ``arm_integrity.tgt``
-Cache variables that are used for toolset and target system customization:
+* The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps
+ via the :manual:`cmake(1)` ``-A`` option.
-* ``GHS_TARGET_PLATFORM``
+ | Typical values of ``arm``, ``ppc``, ``86``, etcetera, are used.
+
+* The variable ``GHS_TARGET_PLATFORM`` may be set, perhaps via the :manual:`cmake(1)`
+ ``-D`` option.
| Defaults to ``integrity``.
| Usual values are ``integrity``, ``threadx``, ``uvelosity``, ``velosity``,
``vxworks``, ``standalone``.
-* ``GHS_PRIMARY_TARGET``
+For example:
- | Sets ``primaryTarget`` entry in project file.
- | Defaults to ``<arch>_<GHS_TARGET_PLATFORM>.tgt``.
+* ``cmake -G "Green Hills MULTI"`` for ``arm_integrity.tgt``.
+* ``cmake -G "Green Hills MULTI" -A 86`` for ``86_integrity.tgt``.
+* ``cmake -G "Green Hills MULTI" -D GHS_TARGET_PLATFORM=standalone`` for ``arm_standalone.tgt``.
+* ``cmake -G "Green Hills MULTI" -A ppc -D GHS_TARGET_PLATFORM=standalone`` for ``ppc_standalone.tgt``.
-* ``GHS_TOOLSET_ROOT``
+Toolset Selection
+^^^^^^^^^^^^^^^^^
- | Root path for ``toolset`` searches.
- | Defaults to ``C:/ghs`` in Windows or ``/usr/ghs`` in Linux.
+.. versionadded:: 3.13
-* ``GHS_OS_ROOT``
+The generator searches for the latest compiler or can be given a location to use.
+``GHS_TOOLSET_ROOT`` is the directory that is checked for the latest compiler.
- | Root path for RTOS searches.
+* The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps
+ via the :manual:`cmake(1)` ``-T`` option, to specify the location of the toolset.
+ Both absolute and relative paths are valid. Paths are relative to ``GHS_TOOLSET_ROOT``.
+
+* The variable ``GHS_TOOLSET_ROOT`` may be set, perhaps via the :manual:`cmake(1)`
+ ``-D`` option.
+
+ | Root path for toolset searches and relative paths.
| Defaults to ``C:/ghs`` in Windows or ``/usr/ghs`` in Linux.
+For example, setting a specific compiler:
+
+* ``cmake -G "Green Hills MULTI" -T comp_201754`` for ``/usr/ghs/comp_201754``.
+* ``cmake -G "Green Hills MULTI" -T comp_201754 -D GHS_TOOLSET_ROOT=/opt/ghs`` for ``/opt/ghs/comp_201754``.
+* ``cmake -G "Green Hills MULTI" -T /usr/ghs/comp_201554``
+* ``cmake -G "Green Hills MULTI" -T C:/ghs/comp_201754``
+
+For example, searching for latest compiler:
+
+* ``cmake -G "Green Hills MULTI"`` for searching ``/usr/ghs``.
+* ``cmake -G "Green Hills MULTI -D GHS_TOOLSET_ROOT=/opt/ghs"`` for searching ``/opt/ghs``.
+
+.. note::
+ The :variable:`CMAKE_GENERATOR_TOOLSET` should use CMake style paths.
+
+OS and BSP Selection
+^^^^^^^^^^^^^^^^^^^^
+
+.. versionadded:: 3.3
+
+Certain target platforms, like Integrity, require an OS. The RTOS directory path
+can be explicitly set using ``GHS_OS_DIR``. Otherwise ``GHS_OS_ROOT`` will be
+searched for the latest Integrity RTOS.
+
+If the target platform, like Integrity, requires a BSP name then it can be set via
+the ``GHS_BSP_NAME`` variable.
+
* ``GHS_OS_DIR`` and ``GHS_OS_DIR_OPTION``
| Sets ``-os_dir`` entry in project file.
- | Defaults to latest platform OS installation at ``GHS_OS_ROOT``. Set this value if
- a specific RTOS is to be used.
+
| ``GHS_OS_DIR_OPTION`` default value is ``-os_dir``.
.. versionadded:: 3.15
The ``GHS_OS_DIR_OPTION`` variable.
+ For example:
+
+ * ``cmake -G "Green Hills MULTI" -D GHS_OS_DIR=/usr/ghs/int1144``
+
+* ``GHS_OS_ROOT``
+
+ | Root path for RTOS searches.
+ | Defaults to ``C:/ghs`` in Windows or ``/usr/ghs`` in Linux.
+
+ For example:
+
+ * ``cmake -G "Green Hills MULTI" -D GHS_OS_ROOT=/opt/ghs``
+
* ``GHS_BSP_NAME``
| Sets ``-bsp`` entry in project file.
| Defaults to ``sim<arch>`` for ``integrity`` platforms.
+ For example:
+
+ * ``cmake -G "Green Hills MULTI"`` for ``simarm`` on ``arm_integrity.tgt``.
+ * ``cmake -G "Green Hills MULTI" -A 86`` for ``sim86`` on ``86_integrity.tgt``.
+ * ``cmake -G "Green Hills MULTI" -A ppc -D GHS_BSP_NAME=sim800`` for ``sim800``
+ on ``ppc_integrity.tgt``.
+ * ``cmake -G "Green Hills MULTI" -D GHS_PRIMARY_TARGET=ppc_integrity.tgt -D GHS_BSP_NAME=fsl-t1040``
+ for ``fsl-t1040`` on ``ppc_integrity.tgt``.
+
Target Properties
^^^^^^^^^^^^^^^^^
@@ -82,6 +137,17 @@ The following properties are available:
* :prop_tgt:`GHS_INTEGRITY_APP`
* :prop_tgt:`GHS_NO_SOURCE_GROUP_FILE`
+MULTI Project Variables
+^^^^^^^^^^^^^^^^^^^^^^^
+
+.. versionadded:: 3.3
+
+Adding a Customization file and macros are available through the use of the following
+variables:
+
+* ``GHS_CUSTOMIZATION`` - CMake path name to Customization File.
+* ``GHS_GPJ_MACROS`` - CMake list of Macros.
+
.. note::
This generator is deemed experimental as of CMake |release|
and is still a work in progress. Future versions of CMake
diff --git a/Help/generator/Visual Studio 15 2017.rst b/Help/generator/Visual Studio 15 2017.rst
index b4d6f6d9f6..912afade09 100644
--- a/Help/generator/Visual Studio 15 2017.rst
+++ b/Help/generator/Visual Studio 15 2017.rst
@@ -17,18 +17,8 @@ Instance Selection
.. versionadded:: 3.11
-VS 2017 supports multiple installations on the same machine.
-The :variable:`CMAKE_GENERATOR_INSTANCE` variable may be set as a
-cache entry containing the absolute path to a Visual Studio instance.
-If the value is not specified explicitly by the user or a toolchain file,
-CMake queries the Visual Studio Installer to locate VS instances, chooses
-one, and sets the variable as a cache entry to hold the value persistently.
-
-When CMake first chooses an instance, if the ``VS150COMNTOOLS`` environment
-variable is set and points to the ``Common7/Tools`` directory within
-one of the instances, that instance will be used. Otherwise, if more
-than one instance is installed we do not define which one is chosen
-by default.
+VS 2017 supports multiple installations on the same machine. The
+:variable:`CMAKE_GENERATOR_INSTANCE` variable may be used to select one.
Platform Selection
^^^^^^^^^^^^^^^^^^
diff --git a/Help/generator/Visual Studio 16 2019.rst b/Help/generator/Visual Studio 16 2019.rst
index 72399e0a25..6cefe6dbba 100644
--- a/Help/generator/Visual Studio 16 2019.rst
+++ b/Help/generator/Visual Studio 16 2019.rst
@@ -15,18 +15,8 @@ Powershell, Python, etc.) are not supported.
Instance Selection
^^^^^^^^^^^^^^^^^^
-VS 2019 supports multiple installations on the same machine.
-The :variable:`CMAKE_GENERATOR_INSTANCE` variable may be set as a
-cache entry containing the absolute path to a Visual Studio instance.
-If the value is not specified explicitly by the user or a toolchain file,
-CMake queries the Visual Studio Installer to locate VS instances, chooses
-one, and sets the variable as a cache entry to hold the value persistently.
-
-When CMake first chooses an instance, if the ``VS160COMNTOOLS`` environment
-variable is set and points to the ``Common7/Tools`` directory within
-one of the instances, that instance will be used. Otherwise, if more
-than one instance is installed we do not define which one is chosen
-by default.
+VS 2019 supports multiple installations on the same machine. The
+:variable:`CMAKE_GENERATOR_INSTANCE` variable may be used to select one.
Platform Selection
^^^^^^^^^^^^^^^^^^
diff --git a/Help/generator/Visual Studio 17 2022.rst b/Help/generator/Visual Studio 17 2022.rst
index b3f49f3dfa..edf9d60319 100644
--- a/Help/generator/Visual Studio 17 2022.rst
+++ b/Help/generator/Visual Studio 17 2022.rst
@@ -15,18 +15,8 @@ Powershell, Python, etc.) are not supported.
Instance Selection
^^^^^^^^^^^^^^^^^^
-VS 2022 supports multiple installations on the same machine.
-The :variable:`CMAKE_GENERATOR_INSTANCE` variable may be set as a
-cache entry containing the absolute path to a Visual Studio instance.
-If the value is not specified explicitly by the user or a toolchain file,
-CMake queries the Visual Studio Installer to locate VS instances, chooses
-one, and sets the variable as a cache entry to hold the value persistently.
-
-When CMake first chooses an instance, if the ``VS170COMNTOOLS`` environment
-variable is set and points to the ``Common7/Tools`` directory within
-one of the instances, that instance will be used. Otherwise, if more
-than one instance is installed we do not define which one is chosen
-by default.
+VS 2022 supports multiple installations on the same machine. The
+:variable:`CMAKE_GENERATOR_INSTANCE` variable may be used to select one.
Platform Selection
^^^^^^^^^^^^^^^^^^
diff --git a/Help/guide/tutorial/Complete/CMakeLists.txt b/Help/guide/tutorial/Complete/CMakeLists.txt
index ac1d0839aa..41baf64840 100644
--- a/Help/guide/tutorial/Complete/CMakeLists.txt
+++ b/Help/guide/tutorial/Complete/CMakeLists.txt
@@ -10,7 +10,7 @@ target_compile_features(tutorial_compiler_flags INTERFACE cxx_std_11)
# add compiler warning flags just when building this project via
# the BUILD_INTERFACE genex
-set(gcc_like_cxx "$<COMPILE_LANG_AND_ID:CXX,ARMClang,AppleClang,Clang,GNU>")
+set(gcc_like_cxx "$<COMPILE_LANG_AND_ID:CXX,ARMClang,AppleClang,Clang,GNU,LCC>")
set(msvc_cxx "$<COMPILE_LANG_AND_ID:CXX,MSVC>")
target_compile_options(tutorial_compiler_flags INTERFACE
"$<${gcc_like_cxx}:$<BUILD_INTERFACE:-Wall;-Wextra;-Wshadow;-Wformat=2;-Wunused>>"
@@ -88,6 +88,7 @@ include(InstallRequiredSystemLibraries)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
set(CPACK_PACKAGE_VERSION_MAJOR "${Tutorial_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${Tutorial_VERSION_MINOR}")
+set(CPACK_SOURCE_GENERATOR "TGZ")
include(CPack)
# install the configuration targets
diff --git a/Help/guide/tutorial/Complete/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Complete/MathFunctions/CMakeLists.txt
index a47d5e027a..40b9fd21aa 100644
--- a/Help/guide/tutorial/Complete/MathFunctions/CMakeLists.txt
+++ b/Help/guide/tutorial/Complete/MathFunctions/CMakeLists.txt
@@ -62,6 +62,6 @@ if(TARGET SqrtLibrary)
list(APPEND installable_libs SqrtLibrary)
endif()
install(TARGETS ${installable_libs}
- DESTINATION lib
- EXPORT MathFunctionsTargets)
+ EXPORT MathFunctionsTargets
+ DESTINATION lib)
install(FILES MathFunctions.h DESTINATION include)
diff --git a/Help/guide/tutorial/Packaging an Installer.rst b/Help/guide/tutorial/Packaging an Installer.rst
index 5eb3e3e5f6..55e74e06b6 100644
--- a/Help/guide/tutorial/Packaging an Installer.rst
+++ b/Help/guide/tutorial/Packaging an Installer.rst
@@ -23,7 +23,8 @@ libraries that are needed by the project for the current platform. Next we set
some CPack variables to where we have stored the license and version
information for this project. The version information was set earlier in this
tutorial and the ``license.txt`` has been included in the top-level source
-directory for this step.
+directory for this step. The :variable:`CPACK_SOURCE_GENERATOR` variable
+selects a file format for the source package.
Finally we include the :module:`CPack module <CPack>` which will use these
variables and some other properties of the current system to setup an
@@ -44,7 +45,11 @@ To specify the generator, use the ``-G`` option. For multi-config builds, use
cpack -G ZIP -C Debug
-To create a source distribution you would type:
+For a list of available generators, see :manual:`cpack-generators(7)` or call
+``cpack --help``. An :cpack_gen:`archive generator <CPack Archive Generator>`
+like ZIP creates a compressed archive of all *installed* files.
+
+To create an archive of the *full* source tree you would type:
.. code-block:: console
diff --git a/Help/guide/tutorial/Step10/CMakeLists.txt b/Help/guide/tutorial/Step10/CMakeLists.txt
index dc9a0e8e62..55dc409652 100644
--- a/Help/guide/tutorial/Step10/CMakeLists.txt
+++ b/Help/guide/tutorial/Step10/CMakeLists.txt
@@ -70,4 +70,5 @@ include(InstallRequiredSystemLibraries)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
set(CPACK_PACKAGE_VERSION_MAJOR "${Tutorial_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${Tutorial_VERSION_MINOR}")
+set(CPACK_SOURCE_GENERATOR "TGZ")
include(CPack)
diff --git a/Help/guide/tutorial/Step11/CMakeLists.txt b/Help/guide/tutorial/Step11/CMakeLists.txt
index 10f35ce2dd..1044748d99 100644
--- a/Help/guide/tutorial/Step11/CMakeLists.txt
+++ b/Help/guide/tutorial/Step11/CMakeLists.txt
@@ -8,7 +8,7 @@ target_compile_features(tutorial_compiler_flags INTERFACE cxx_std_11)
# add compiler warning flags just when building this project via
# the BUILD_INTERFACE genex
-set(gcc_like_cxx "$<COMPILE_LANG_AND_ID:CXX,ARMClang,AppleClang,Clang,GNU>")
+set(gcc_like_cxx "$<COMPILE_LANG_AND_ID:CXX,ARMClang,AppleClang,Clang,GNU,LCC>")
set(msvc_cxx "$<COMPILE_LANG_AND_ID:CXX,MSVC>")
target_compile_options(tutorial_compiler_flags INTERFACE
"$<${gcc_like_cxx}:$<BUILD_INTERFACE:-Wall;-Wextra;-Wshadow;-Wformat=2;-Wunused>>"
@@ -78,4 +78,5 @@ include(InstallRequiredSystemLibraries)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
set(CPACK_PACKAGE_VERSION_MAJOR "${Tutorial_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${Tutorial_VERSION_MINOR}")
+set(CPACK_SOURCE_GENERATOR "TGZ")
include(CPack)
diff --git a/Help/guide/tutorial/Step12/CMakeLists.txt b/Help/guide/tutorial/Step12/CMakeLists.txt
index 634b84cdd4..63f96432de 100644
--- a/Help/guide/tutorial/Step12/CMakeLists.txt
+++ b/Help/guide/tutorial/Step12/CMakeLists.txt
@@ -8,7 +8,7 @@ target_compile_features(tutorial_compiler_flags INTERFACE cxx_std_11)
# add compiler warning flags just when building this project via
# the BUILD_INTERFACE genex
-set(gcc_like_cxx "$<COMPILE_LANG_AND_ID:CXX,ARMClang,AppleClang,Clang,GNU>")
+set(gcc_like_cxx "$<COMPILE_LANG_AND_ID:CXX,ARMClang,AppleClang,Clang,GNU,LCC>")
set(msvc_cxx "$<COMPILE_LANG_AND_ID:CXX,MSVC>")
target_compile_options(tutorial_compiler_flags INTERFACE
"$<${gcc_like_cxx}:$<BUILD_INTERFACE:-Wall;-Wextra;-Wshadow;-Wformat=2;-Wunused>>"
diff --git a/Help/guide/tutorial/Step12/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Step12/MathFunctions/CMakeLists.txt
index ea3861c1f5..d5961da4b1 100644
--- a/Help/guide/tutorial/Step12/MathFunctions/CMakeLists.txt
+++ b/Help/guide/tutorial/Step12/MathFunctions/CMakeLists.txt
@@ -58,6 +58,6 @@ if(TARGET SqrtLibrary)
list(APPEND installable_libs SqrtLibrary)
endif()
install(TARGETS ${installable_libs}
- DESTINATION lib
- EXPORT MathFunctionsTargets)
+ EXPORT MathFunctionsTargets
+ DESTINATION lib)
install(FILES MathFunctions.h DESTINATION include)
diff --git a/Help/guide/tutorial/Step8/CMakeLists.txt b/Help/guide/tutorial/Step8/CMakeLists.txt
index 4ae898f9ba..4c78b94c0b 100644
--- a/Help/guide/tutorial/Step8/CMakeLists.txt
+++ b/Help/guide/tutorial/Step8/CMakeLists.txt
@@ -70,4 +70,5 @@ include(InstallRequiredSystemLibraries)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
set(CPACK_PACKAGE_VERSION_MAJOR "${Tutorial_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${Tutorial_VERSION_MINOR}")
+set(CPACK_SOURCE_GENERATOR "TGZ")
include(CPack)
diff --git a/Help/guide/tutorial/Step9/CMakeLists.txt b/Help/guide/tutorial/Step9/CMakeLists.txt
index 130bc9a208..6bae26e42b 100644
--- a/Help/guide/tutorial/Step9/CMakeLists.txt
+++ b/Help/guide/tutorial/Step9/CMakeLists.txt
@@ -69,4 +69,5 @@ include(InstallRequiredSystemLibraries)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
set(CPACK_PACKAGE_VERSION_MAJOR "${Tutorial_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${Tutorial_VERSION_MINOR}")
+set(CPACK_SOURCE_GENERATOR "TGZ")
include(CPack)
diff --git a/Help/manual/cmake-file-api.7.rst b/Help/manual/cmake-file-api.7.rst
index 5e22ea9051..4b8ac65035 100644
--- a/Help/manual/cmake-file-api.7.rst
+++ b/Help/manual/cmake-file-api.7.rst
@@ -425,7 +425,7 @@ Version 1 does not exist to avoid confusion with that from
{
"kind": "codemodel",
- "version": { "major": 2, "minor": 2 },
+ "version": { "major": 2, "minor": 4 },
"paths": {
"source": "/path/to/top-level-source-dir",
"build": "/path/to/top-level-build-dir"
@@ -758,6 +758,15 @@ with members:
``destination`` member is populated. This type has additional members
``runtimeDependencySetName`` and ``runtimeDependencySetType``.
+ ``fileSet``
+ An :command:`install(TARGETS)` call with ``FILE_SET``.
+ The ``destination`` and ``paths`` members are populated.
+ The ``isOptional`` member may exist.
+ This type has additional members ``fileSetName``, ``fileSetType``,
+ ``fileSetDirectories``, and ``fileSetTarget``.
+
+ This type was added in codemodel version 2.4.
+
``isExcludeFromAll``
Optional member that is present with boolean value ``true`` when
:command:`install` is called with the ``EXCLUDE_FROM_ALL`` option.
@@ -835,6 +844,41 @@ with members:
Indicates that this installer installs dependencies that are macOS
frameworks.
+ ``fileSetName``
+ Optional member that is present when ``type`` is ``fileSet``. The value is
+ a string with the name of the file set.
+
+ This field was added in codemodel version 2.4.
+
+ ``fileSetType``
+ Optional member that is present when ``type`` is ``fileSet``. The value is
+ a string with the type of the file set.
+
+ This field was added in codemodel version 2.4.
+
+ ``fileSetDirectories``
+ Optional member that is present when ``type`` is ``fileSet``. The value
+ is a list of strings with the file set's base directories (determined by
+ genex-evaluation of :prop_tgt:`HEADER_DIRS` or
+ :prop_tgt:`HEADER_DIRS_<NAME>`).
+
+ This field was added in codemodel version 2.4.
+
+ ``fileSetTarget``
+ Optional member that is present when ``type`` is ``fileSet``. The value
+ is a JSON object with members:
+
+ ``id``
+ A string uniquely identifying the target. This matches
+ the ``id`` member of the target in the main "codemodel"
+ object's ``targets`` array.
+
+ ``index``
+ An unsigned integer 0-based index into the main "codemodel"
+ object's ``targets`` array for the target.
+
+ This field was added in codemodel version 2.4.
+
``scriptFile``
Optional member that is present when ``type`` is ``script``.
The value is a string specifying the path to the script file on disk,
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 3df4f9fa79..0939a82b27 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -51,6 +51,15 @@ 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.23
+=================================
+
+.. toctree::
+ :maxdepth: 1
+
+ CMP0129: Compiler id for MCST LCC compilers is now LCC, not GNU. </policy/CMP0129>
+
Policies Introduced by CMake 3.22
=================================
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index bb5dba3f01..5e18e10748 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -214,6 +214,11 @@ Properties on Targets
/prop_tgt/GHS_NO_SOURCE_GROUP_FILE
/prop_tgt/GNUtoMS
/prop_tgt/HAS_CXX
+ /prop_tgt/HEADER_DIRS
+ /prop_tgt/HEADER_DIRS_NAME
+ /prop_tgt/HEADER_SET
+ /prop_tgt/HEADER_SET_NAME
+ /prop_tgt/HEADER_SETS
/prop_tgt/HIP_ARCHITECTURES
/prop_tgt/HIP_EXTENSIONS
/prop_tgt/HIP_STANDARD
@@ -239,6 +244,7 @@ Properties on Targets
/prop_tgt/IMPORTED_LOCATION_CONFIG
/prop_tgt/IMPORTED_NO_SONAME
/prop_tgt/IMPORTED_NO_SONAME_CONFIG
+ /prop_tgt/IMPORTED_NO_SYSTEM
/prop_tgt/IMPORTED_OBJECTS
/prop_tgt/IMPORTED_OBJECTS_CONFIG
/prop_tgt/IMPORTED_SONAME
@@ -254,6 +260,7 @@ Properties on Targets
/prop_tgt/INTERFACE_COMPILE_DEFINITIONS
/prop_tgt/INTERFACE_COMPILE_FEATURES
/prop_tgt/INTERFACE_COMPILE_OPTIONS
+ /prop_tgt/INTERFACE_HEADER_SETS
/prop_tgt/INTERFACE_INCLUDE_DIRECTORIES
/prop_tgt/INTERFACE_LINK_DEPENDS
/prop_tgt/INTERFACE_LINK_DIRECTORIES
@@ -425,6 +432,7 @@ Properties on Targets
/prop_tgt/XCODE_SCHEME_ARGUMENTS
/prop_tgt/XCODE_SCHEME_DEBUG_AS_ROOT
/prop_tgt/XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING
+ /prop_tgt/XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE
/prop_tgt/XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER
/prop_tgt/XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS
/prop_tgt/XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 4ed0b2e62a..3c50117d32 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -262,6 +262,7 @@ Variables that Change Behavior
/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER
/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN
/variable/CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING
+ /variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE
/variable/CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER
/variable/CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS
/variable/CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE
@@ -307,7 +308,7 @@ Variables that Describe the System
/variable/CMAKE_SYSTEM_PROCESSOR
/variable/CMAKE_SYSTEM_VERSION
/variable/CYGWIN
- /variable/GHS-MULTI
+ /variable/GHSMULTI
/variable/IOS
/variable/MINGW
/variable/MSVC
@@ -668,6 +669,7 @@ Variables for CTest
/variable/CTEST_SCP_COMMAND
/variable/CTEST_SCRIPT_DIRECTORY
/variable/CTEST_SITE
+ /variable/CTEST_SUBMIT_INACTIVITY_TIMEOUT
/variable/CTEST_SUBMIT_URL
/variable/CTEST_SOURCE_DIRECTORY
/variable/CTEST_SVN_COMMAND
diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst
index d66c5a9d58..1e7b077e88 100644
--- a/Help/manual/ctest.1.rst
+++ b/Help/manual/ctest.1.rst
@@ -1353,6 +1353,13 @@ Configuration settings include:
* :module:`CTest` module variable: ``SUBMIT_URL`` if set,
else ``CTEST_SUBMIT_URL``
+``SubmitInactivityTimeout``
+ The time to wait for the submission after which it is canceled
+ if not completed. Specify a zero value to disable timeout.
+
+ * `CTest Script`_ variable: :variable:`CTEST_SUBMIT_INACTIVITY_TIMEOUT`
+ * :module:`CTest` module variable: ``CTEST_SUBMIT_INACTIVITY_TIMEOUT``
+
``TriggerSite``
Legacy option. Not used.
diff --git a/Help/policy/CMP0129.rst b/Help/policy/CMP0129.rst
new file mode 100644
index 0000000000..31a26e5555
--- /dev/null
+++ b/Help/policy/CMP0129.rst
@@ -0,0 +1,34 @@
+CMP0129
+-------
+
+.. versionadded:: 3.23
+
+Compiler id for MCST LCC compilers is now ``LCC``, not ``GNU``.
+
+CMake 3.23 and above recognize MCST LCC compiler as a different from ``GNU``,
+with its own command line and set of capabilities.
+CMake now prefers to present this to projects by setting the
+:variable:`CMAKE_<LANG>_COMPILER_ID` variable to ``LCC`` instead
+of ``GNU``. However, existing projects may assume the compiler id for
+LCC is ``GNU`` as it was in CMake versions prior to 3.23.
+Therefore this policy determines for MCST LCC compiler which
+compiler id to report in the :variable:`CMAKE_<LANG>_COMPILER_ID`
+variable after language ``<LANG>`` is enabled by the :command:`project`
+or :command:`enable_language` command. The policy must be set prior
+to the invocation of either command.
+
+The ``OLD`` behavior for this policy is to use compiler id ``GNU`` (and set
+:variable:`CMAKE_<LANG>_COMPILER_VERSION` to the supported GNU compiler version.)
+``NEW`` behavior for this policy is to use compiler id ``LCC``, and set
+:variable:`CMAKE_<LANG>_SIMULATE_ID` to ``GNU``, and
+:variable:`CMAKE_<LANG>_SIMULATE_VERSION` to the supported GNU compiler version.
+
+This policy was introduced in CMake version 3.23. Use the
+:command:`cmake_policy` command to set this policy to ``OLD`` or ``NEW`` explicitly.
+Unlike most policies, CMake version |release| does *not* warn
+by default when this policy is not set and simply uses ``OLD`` behavior.
+See documentation of the
+:variable:`CMAKE_POLICY_WARNING_CMP0129 <CMAKE_POLICY_WARNING_CMP<NNNN>>`
+variable to control the warning.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/prop_tgt/CUDA_ARCHITECTURES.rst b/Help/prop_tgt/CUDA_ARCHITECTURES.rst
index a3191e8e01..41e5ae45f3 100644
--- a/Help/prop_tgt/CUDA_ARCHITECTURES.rst
+++ b/Help/prop_tgt/CUDA_ARCHITECTURES.rst
@@ -20,6 +20,18 @@ variable if it is set when a target is created.
The ``CUDA_ARCHITECTURES`` target property must be set to a non-empty value on targets
that compile CUDA sources, or it is an error. See policy :policy:`CMP0104`.
+.. versionadded:: 3.23
+
+ The ``CUDA_ARCHITECTURES`` may be set to the following special keywords:
+
+ ``all``
+ Requires NVIDIA 11.5+. Will compile for all supported major and minor real
+ architectures, and the highest major virtual architecture.
+
+ ``all-major``
+ Requires NVIDIA 11.5+. Will compile for all supported major real
+ architectures, and the highest major virtual architecture.
+
Examples
^^^^^^^^
diff --git a/Help/prop_tgt/HEADER_DIRS.rst b/Help/prop_tgt/HEADER_DIRS.rst
new file mode 100644
index 0000000000..6cdd4f1620
--- /dev/null
+++ b/Help/prop_tgt/HEADER_DIRS.rst
@@ -0,0 +1,8 @@
+HEADER_DIRS
+-----------
+
+.. versionadded:: 3.23
+
+Semicolon-separated list of base directories of the default header set created
+by :command:`target_sources(FILE_SET)`. This property supports
+:manual:`generator expressions <cmake-generator-expressions(7)>`.
diff --git a/Help/prop_tgt/HEADER_DIRS_NAME.rst b/Help/prop_tgt/HEADER_DIRS_NAME.rst
new file mode 100644
index 0000000000..7d282e5010
--- /dev/null
+++ b/Help/prop_tgt/HEADER_DIRS_NAME.rst
@@ -0,0 +1,8 @@
+HEADER_DIRS_<NAME>
+------------------
+
+.. versionadded:: 3.23
+
+Semicolon-separated list of base directories of the header set with name
+``<NAME>`` created by :command:`target_sources(FILE_SET)`. This property
+supports :manual:`generator expressions <cmake-generator-expressions(7)>`.
diff --git a/Help/prop_tgt/HEADER_SET.rst b/Help/prop_tgt/HEADER_SET.rst
new file mode 100644
index 0000000000..eee834fabe
--- /dev/null
+++ b/Help/prop_tgt/HEADER_SET.rst
@@ -0,0 +1,10 @@
+HEADER_SET
+----------
+
+.. versionadded:: 3.23
+
+Semicolon-separated list of headers in the default header set created by
+:command:`target_sources(FILE_SET)`. This property supports
+:manual:`generator expressions <cmake-generator-expressions(7)>`. If any of the
+headers are relative paths, they are computed relative to the target's source
+directory.
diff --git a/Help/prop_tgt/HEADER_SETS.rst b/Help/prop_tgt/HEADER_SETS.rst
new file mode 100644
index 0000000000..d07763b21a
--- /dev/null
+++ b/Help/prop_tgt/HEADER_SETS.rst
@@ -0,0 +1,8 @@
+HEADER_SETS
+-----------
+
+.. versionadded:: 3.23
+
+List of ``PRIVATE`` and ``PUBLIC`` header sets added by
+:command:`target_sources(FILE_SET)`. Headers listed in these header sets are
+treated as source files for the purposes of IDE integration.
diff --git a/Help/prop_tgt/HEADER_SET_NAME.rst b/Help/prop_tgt/HEADER_SET_NAME.rst
new file mode 100644
index 0000000000..3405690582
--- /dev/null
+++ b/Help/prop_tgt/HEADER_SET_NAME.rst
@@ -0,0 +1,10 @@
+HEADER_SET_<NAME>
+-----------------
+
+.. versionadded:: 3.23
+
+Semicolon-separated list of headers in the named header set ``<NAME>`` created
+by :command:`target_sources(FILE_SET)`. This property supports
+:manual:`generator expressions <cmake-generator-expressions(7)>`. If any of the
+headers are relative paths, they are computed relative to the target's source
+directory.
diff --git a/Help/prop_tgt/IMPORTED_NO_SYSTEM.rst b/Help/prop_tgt/IMPORTED_NO_SYSTEM.rst
new file mode 100644
index 0000000000..cc726d1e1f
--- /dev/null
+++ b/Help/prop_tgt/IMPORTED_NO_SYSTEM.rst
@@ -0,0 +1,17 @@
+IMPORTED_NO_SYSTEM
+------------------
+
+Specifies that an :ref:`Imported Target <Imported Targets>` is not
+a ``SYSTEM`` library. This has the following effects:
+
+* Entries of :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` are not treated
+ as ``SYSTEM`` include directories when compiling consumers, as they
+ would be by default.
+
+This property can also be enabled on a non-imported target. Doing so does
+not affect the build system, but does tell the :command:`install(EXPORT)` and
+:command:`export` commands to enable it on the imported targets they generate.
+
+See the :prop_tgt:`NO_SYSTEM_FROM_IMPORTED` target property to set this
+behavior on the target consuming the include directories rather than
+providing them.
diff --git a/Help/prop_tgt/INTERFACE_HEADER_SETS.rst b/Help/prop_tgt/INTERFACE_HEADER_SETS.rst
new file mode 100644
index 0000000000..909510d302
--- /dev/null
+++ b/Help/prop_tgt/INTERFACE_HEADER_SETS.rst
@@ -0,0 +1,9 @@
+INTERFACE_HEADER_SETS
+---------------------
+
+.. versionadded:: 3.23
+
+List of ``INTERFACE`` and ``PUBLIC`` header sets added by
+:command:`target_sources(FILE_SET)`. Headers listed in these header sets can be
+installed with :command:`install(TARGETS)` and exported with
+:command:`install(EXPORT)` and :command:`export`.
diff --git a/Help/prop_tgt/NO_SYSTEM_FROM_IMPORTED.rst b/Help/prop_tgt/NO_SYSTEM_FROM_IMPORTED.rst
index 880343de4b..e5cc09be62 100644
--- a/Help/prop_tgt/NO_SYSTEM_FROM_IMPORTED.rst
+++ b/Help/prop_tgt/NO_SYSTEM_FROM_IMPORTED.rst
@@ -13,3 +13,6 @@ imported targets as system includes.
This property is initialized by the value of the
:variable:`CMAKE_NO_SYSTEM_FROM_IMPORTED` variable if it is set when a target
is created.
+
+See the :prop_tgt:`IMPORTED_NO_SYSTEM` target property to set this behavior
+on the target providing the include directories rather than consuming them.
diff --git a/Help/prop_tgt/SOURCES.rst b/Help/prop_tgt/SOURCES.rst
index 493643e841..1ebfa14dfc 100644
--- a/Help/prop_tgt/SOURCES.rst
+++ b/Help/prop_tgt/SOURCES.rst
@@ -1,6 +1,38 @@
SOURCES
-------
-Source names specified for a target.
+This specifies the list of paths to source files for the target.
+The following commands all set or add to the ``SOURCES`` target property
+and are the usual way to manipulate it:
-List of sources specified for a target.
+* :command:`add_executable`
+* :command:`add_library`
+* :command:`add_custom_target`
+* :command:`target_sources`
+
+Contents of ``SOURCES`` may use
+:manual:`generator expressions <cmake-generator-expressions(7)>`.
+If a path starts with a generator expression, it is expected to
+evaluate to an absolute path. Not doing so is considered undefined behavior.
+
+Paths that are for files generated by the build will be treated
+as relative to the build directory of the target, if the path is not
+already specified as an absolute path. Note that whether a file is seen as
+generated may be affected by policy :policy:`CMP0118`.
+
+If a path does not start with a generator expression, is not an
+absolute path and is not a generated file, it will be treated as relative to
+the location selected by the first of the following that matches:
+
+* If a file by the specified path exists relative to the target's source
+ directory, use that file.
+* If policy :policy:`CMP0115` is not set to ``NEW``, try appending each
+ known source file extension to the path and check if that exists
+ relative to the target's source directory.
+* Repeat the above two steps, this time relative to the target's binary
+ directory instead.
+
+Note that the above decisions are made at generation time, not build time.
+
+See the :manual:`cmake-buildsystem(7)` manual for more on defining
+buildsystem properties.
diff --git a/Help/prop_tgt/XCODE_EMBED_type.rst b/Help/prop_tgt/XCODE_EMBED_type.rst
index a1af56f12c..e8383c2403 100644
--- a/Help/prop_tgt/XCODE_EMBED_type.rst
+++ b/Help/prop_tgt/XCODE_EMBED_type.rst
@@ -19,6 +19,12 @@ The supported values for ``<type>`` are:
The specified items will be added to the ``Embed App Extensions`` build phase.
They must be CMake target names.
+``PLUGINS``
+ .. versionadded:: 3.23
+
+ The specified items will be added to the ``Embed PlugIns`` build phase.
+ They must be CMake target names.
+
See also :prop_tgt:`XCODE_EMBED_<type>_PATH`,
:prop_tgt:`XCODE_EMBED_<type>_REMOVE_HEADERS_ON_COPY` and
:prop_tgt:`XCODE_EMBED_<type>_CODE_SIGN_ON_COPY`.
diff --git a/Help/prop_tgt/XCODE_EMBED_type_CODE_SIGN_ON_COPY.rst b/Help/prop_tgt/XCODE_EMBED_type_CODE_SIGN_ON_COPY.rst
index 7ec03857b4..cb449ac492 100644
--- a/Help/prop_tgt/XCODE_EMBED_type_CODE_SIGN_ON_COPY.rst
+++ b/Help/prop_tgt/XCODE_EMBED_type_CODE_SIGN_ON_COPY.rst
@@ -14,5 +14,8 @@ The supported values for ``<type>`` are:
``APP_EXTENSIONS``
.. versionadded:: 3.21
+``PLUGINS``
+ .. versionadded:: 3.23
+
If a ``XCODE_EMBED_<type>_CODE_SIGN_ON_COPY`` property is not defined on the
target, no code signing on copy will be performed for that ``<type>``.
diff --git a/Help/prop_tgt/XCODE_EMBED_type_PATH.rst b/Help/prop_tgt/XCODE_EMBED_type_PATH.rst
index a6f980dccf..160f765ace 100644
--- a/Help/prop_tgt/XCODE_EMBED_type_PATH.rst
+++ b/Help/prop_tgt/XCODE_EMBED_type_PATH.rst
@@ -16,3 +16,6 @@ The supported values for ``<type>`` are:
``APP_EXTENSIONS``
.. versionadded:: 3.21
+
+``PLUGINS``
+ .. versionadded:: 3.23
diff --git a/Help/prop_tgt/XCODE_EMBED_type_REMOVE_HEADERS_ON_COPY.rst b/Help/prop_tgt/XCODE_EMBED_type_REMOVE_HEADERS_ON_COPY.rst
index 75c8eae13e..e3a7cedd11 100644
--- a/Help/prop_tgt/XCODE_EMBED_type_REMOVE_HEADERS_ON_COPY.rst
+++ b/Help/prop_tgt/XCODE_EMBED_type_REMOVE_HEADERS_ON_COPY.rst
@@ -18,3 +18,6 @@ The supported values for ``<type>`` are:
If the ``XCODE_EMBED_APP_EXTENSIONS_REMOVE_HEADERS_ON_COPY`` property is not
defined, headers WILL be removed on copy by default.
+
+``PLUGINS``
+ .. versionadded:: 3.23
diff --git a/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst b/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst
index 06a3cf9921..8f46d2f265 100644
--- a/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst
+++ b/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst
@@ -38,6 +38,7 @@ The following target properties will be applied on the
- :prop_tgt:`XCODE_SCHEME_ARGUMENTS`
- :prop_tgt:`XCODE_SCHEME_DEBUG_AS_ROOT`
- :prop_tgt:`XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING`
+- :prop_tgt:`XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE`
- :prop_tgt:`XCODE_SCHEME_ENVIRONMENT`
- :prop_tgt:`XCODE_SCHEME_EXECUTABLE`
- :prop_tgt:`XCODE_SCHEME_WORKING_DIRECTORY`
diff --git a/Help/prop_tgt/XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE.rst b/Help/prop_tgt/XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE.rst
new file mode 100644
index 0000000000..6ffd6943d8
--- /dev/null
+++ b/Help/prop_tgt/XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE.rst
@@ -0,0 +1,15 @@
+XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE
+------------------------------------------
+
+.. versionadded:: 3.23
+
+Property value for ``GPU Frame Capture`` in the Options section of
+the generated Xcode scheme. Example values are `Metal` and
+`Disabled`.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE`
+if it is set when a target is created.
+
+Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property
+documentation to see all Xcode schema related properties.
diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst
new file mode 100644
index 0000000000..e4cc01e23f
--- /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/FindGTest-target-for-gmock.rst b/Help/release/dev/FindGTest-target-for-gmock.rst
new file mode 100644
index 0000000000..f78242c80e
--- /dev/null
+++ b/Help/release/dev/FindGTest-target-for-gmock.rst
@@ -0,0 +1,4 @@
+FindGTest-target-for-gmock
+--------------------------
+
+* The :module:`FindGTest` module now provides a target for GMock, if found.
diff --git a/Help/release/dev/FindVulkan-version.rst b/Help/release/dev/FindVulkan-version.rst
new file mode 100644
index 0000000000..4e9f121fce
--- /dev/null
+++ b/Help/release/dev/FindVulkan-version.rst
@@ -0,0 +1,5 @@
+FindVulkan-version
+------------------
+
+* The :module:`FindVulkan` module gained a ``Vulkan_VERSION`` result
+ variable reporting the version number.
diff --git a/Help/release/dev/cpack-drop-osxx11.rst b/Help/release/dev/cpack-drop-osxx11.rst
new file mode 100644
index 0000000000..c8dfafff90
--- /dev/null
+++ b/Help/release/dev/cpack-drop-osxx11.rst
@@ -0,0 +1,4 @@
+cpack-drop-osxx11
+-----------------
+
+* The :manual:`cpack(1)` undocumented ``OSXX11`` generator has been removed.
diff --git a/Help/release/dev/cpack-productbuild-identifier.rst b/Help/release/dev/cpack-productbuild-identifier.rst
new file mode 100644
index 0000000000..bfa0dd9740
--- /dev/null
+++ b/Help/release/dev/cpack-productbuild-identifier.rst
@@ -0,0 +1,6 @@
+cpack-productbuild-identifier
+-----------------------------
+
+* The :cpack_gen:`CPack productbuild Generator` gained a new variable,
+ :variable:`CPACK_PRODUCTBUILD_IDENTIFIER`, used to customize the unique
+ product identifier associated with the product.
diff --git a/Help/release/dev/cpack-wix-skip-ui-ext.rst b/Help/release/dev/cpack-wix-skip-ui-ext.rst
new file mode 100644
index 0000000000..e139469629
--- /dev/null
+++ b/Help/release/dev/cpack-wix-skip-ui-ext.rst
@@ -0,0 +1,5 @@
+cpack-wix-skip-ui-ext
+---------------------
+
+* An option to the WiX Generator was added to be able to skip
+ the inclusion of the WixUIExtensions
diff --git a/Help/release/dev/cpackifw-archive-format.rst b/Help/release/dev/cpackifw-archive-format.rst
new file mode 100644
index 0000000000..8884d7491d
--- /dev/null
+++ b/Help/release/dev/cpackifw-archive-format.rst
@@ -0,0 +1,9 @@
+
+cpackifw-archive-format
+-----------------------
+
+* The :cpack_gen:`CPack IFW Generator` gained the new
+ :variable:`CPACK_IFW_ARCHIVE_FORMAT` and
+ :variable:`CPACK_IFW_ARCHIVE_COMPRESSION` variables for setting the format
+ used when packaging new component data archives, and choosing the compression
+ level used. These features are available for QtIFW 4.2 and newer.
diff --git a/Help/release/dev/cpackifw-package-disable-command-line-interface.rst b/Help/release/dev/cpackifw-package-disable-command-line-interface.rst
new file mode 100644
index 0000000000..2de222e524
--- /dev/null
+++ b/Help/release/dev/cpackifw-package-disable-command-line-interface.rst
@@ -0,0 +1,8 @@
+cpackifw-package-disable-command-line-interface
+-----------------------------------------------
+
+* The :cpack_gen:`CPack IFW Generator` gained new
+ :variable:`CPACK_IFW_PACKAGE_DISABLE_COMMAND_LINE_INTERFACE` variable to
+ prevents the user from passing any consumer command to installer, like
+ ``install``, ``update``, and ``remove``.
+ This feature is available for QtIFW 4.0 and newer.
diff --git a/Help/release/dev/cpackifw-package-product-images.rst b/Help/release/dev/cpackifw-package-product-images.rst
new file mode 100644
index 0000000000..3a0253482a
--- /dev/null
+++ b/Help/release/dev/cpackifw-package-product-images.rst
@@ -0,0 +1,8 @@
+
+cpackifw-package-product-images
+-------------------------------
+
+* The :cpack_gen:`CPack IFW Generator` gained the new
+ :variable:`CPACK_IFW_PACKAGE_PRODUCT_IMAGES` variable for adding a list of
+ images to be shown on the ``PerformInstallationPage``.
+ This feature is available for QtIFW 4.0 and newer.
diff --git a/Help/release/dev/cpackifw-package-run-program.rst b/Help/release/dev/cpackifw-package-run-program.rst
new file mode 100644
index 0000000000..5d6f1b2abd
--- /dev/null
+++ b/Help/release/dev/cpackifw-package-run-program.rst
@@ -0,0 +1,10 @@
+
+cpackifw-package-run-program
+----------------------------
+
+* The :cpack_gen:`CPack IFW Generator` gained the new
+ :variable:`CPACK_IFW_PACKAGE_RUN_PROGRAM`,
+ :variable:`CPACK_IFW_PACKAGE_RUN_PROGRAM_ARGUMENTS`, and
+ :variable:`CPACK_IFW_PACKAGE_RUN_PROGRAM_DESCRIPTION` variables for executing
+ a command after the installer is done if the user accepts the action.
+ This feature is available for QtIFW 4.0 and newer.
diff --git a/Help/release/dev/cpackifw-signing-identity.rst b/Help/release/dev/cpackifw-signing-identity.rst
new file mode 100644
index 0000000000..58f5030338
--- /dev/null
+++ b/Help/release/dev/cpackifw-signing-identity.rst
@@ -0,0 +1,7 @@
+cpackifw-signing-identity
+-------------------------
+
+* The :cpack_gen:`CPack IFW Generator` gained the new
+ :variable:`CPACK_IFW_PACKAGE_SIGNING_IDENTITY` variable for specifying a code
+ signing identity to be used for signing the generated app bundle.
+ This feature is available on macOS only, and for QtIFW 3.0 and newer.
diff --git a/Help/release/dev/ctest_submit-inactivity-timeout.rst b/Help/release/dev/ctest_submit-inactivity-timeout.rst
new file mode 100644
index 0000000000..3d4c408bbd
--- /dev/null
+++ b/Help/release/dev/ctest_submit-inactivity-timeout.rst
@@ -0,0 +1,5 @@
+ctest_submit-inactivity-timeout
+-------------------------------
+
+* :manual:`ctest(1)` gained a new :variable:`CTEST_SUBMIT_INACTIVITY_TIMEOUT`
+ variable, which can be used to specify a timeout for submission inactivity.
diff --git a/Help/release/dev/cuda-clang-device-link-flags.rst b/Help/release/dev/cuda-clang-device-link-flags.rst
new file mode 100644
index 0000000000..2f4f16e2f7
--- /dev/null
+++ b/Help/release/dev/cuda-clang-device-link-flags.rst
@@ -0,0 +1,7 @@
+cuda-clang-device-link-flags
+----------------------------
+
+* Policy :policy:`CMP0105` and the ``$<DEVICE_LINK:...>`` and
+ ``$<HOST_LINK:...>``
+ :manual:`generator expressions <cmake-generator-expressions(7)>`
+ are now supported for Clang.
diff --git a/Help/release/dev/cuda-new-arch-modes.rst b/Help/release/dev/cuda-new-arch-modes.rst
new file mode 100644
index 0000000000..549abc34cd
--- /dev/null
+++ b/Help/release/dev/cuda-new-arch-modes.rst
@@ -0,0 +1,10 @@
+cuda-new-arch-modes
+-------------------
+
+* The :prop_tgt:`CUDA_ARCHITECTURES` target property now supports the
+ `all`, and `all-major` values when the CUDA compiler id is ``NVIDIA``,
+ and version is 11.5+.
+
+* The :variable:`CMAKE_CUDA_ARCHITECTURES` variable now supports the
+ `all`, and `all-major` values when the `CUDA` compiler id is ``NVIDIA``,
+ and version is 11.5+.
diff --git a/Help/release/dev/cuda-ptx-separable-compilation.rst b/Help/release/dev/cuda-ptx-separable-compilation.rst
new file mode 100644
index 0000000000..49c66c0581
--- /dev/null
+++ b/Help/release/dev/cuda-ptx-separable-compilation.rst
@@ -0,0 +1,5 @@
+cuda-ptx-separable-compilation
+------------------------------
+
+* ``CUDA`` targets can now enable both :prop_tgt:`CUDA_SEPARABLE_COMPILATION` and
+ :prop_tgt:`CUDA_PTX_COMPILATION`.
diff --git a/Help/release/dev/imported-no-system.rst b/Help/release/dev/imported-no-system.rst
new file mode 100644
index 0000000000..a35e8bb8c7
--- /dev/null
+++ b/Help/release/dev/imported-no-system.rst
@@ -0,0 +1,7 @@
+imported-no-system
+------------------
+
+* The :prop_tgt:`IMPORTED_NO_SYSTEM` target property was added to
+ specify that an :ref:`Imported Target <Imported Targets>` should
+ not be treated as a system library (i.e. its include directories
+ are not automatically ``SYSTEM``).
diff --git a/Help/release/dev/lcc-compiler.rst b/Help/release/dev/lcc-compiler.rst
new file mode 100644
index 0000000000..719611dc7e
--- /dev/null
+++ b/Help/release/dev/lcc-compiler.rst
@@ -0,0 +1,5 @@
+lcc-compiler
+------------
+
+* The MCST LCC compiler is now supported with compiler id ``LCC``.
+ See policy :policy:`CMP0129`.
diff --git a/Help/release/dev/target-sources-file-set.rst b/Help/release/dev/target-sources-file-set.rst
new file mode 100644
index 0000000000..bd28efa0bb
--- /dev/null
+++ b/Help/release/dev/target-sources-file-set.rst
@@ -0,0 +1,18 @@
+target-headers
+--------------
+
+* The :command:`target_sources` command gained a new ``FILE_SET`` mode, which
+ can be used to add headers as header-only source files of a target.
+* New :prop_tgt:`HEADER_SETS` and :prop_tgt:`INTERFACE_HEADER_SETS` properties
+ were added, which list the header file sets associated with a target.
+* New :prop_tgt:`HEADER_SET` and :prop_tgt:`HEADER_SET_<NAME>` properties were
+ added, which list the files in the associated header file set.
+* New :prop_tgt:`HEADER_DIRS` and :prop_tgt:`HEADER_DIRS_<NAME>` properties
+ were added, which specify the base directories of the associated header file
+ set.
+* The :command:`install(TARGETS)` command gained a new ``FILE_SET`` argument,
+ which can be used to install header file sets associated with a target.
+* The :manual:`File API <cmake-file-api(7)>` ``codemodel-v2`` minor version has
+ been bumped to ``4``.
+* The :manual:`File API <cmake-file-api(7)>` ``codemodel-v2`` ``directory``
+ object gained a new installer type of ``fileSet``.
diff --git a/Help/release/dev/vs-instance.rst b/Help/release/dev/vs-instance.rst
new file mode 100644
index 0000000000..0b9ff4b7f0
--- /dev/null
+++ b/Help/release/dev/vs-instance.rst
@@ -0,0 +1,6 @@
+vs-instance
+-----------
+
+* The :ref:`Visual Studio Generators` for VS 2017 and above learned to
+ use portable instances of Visual Studio not known to the VS installer.
+ See the :variable:`CMAKE_GENERATOR_INSTANCE` variable.
diff --git a/Help/release/dev/xcode-embed-plugins.rst b/Help/release/dev/xcode-embed-plugins.rst
new file mode 100644
index 0000000000..10f91f61f1
--- /dev/null
+++ b/Help/release/dev/xcode-embed-plugins.rst
@@ -0,0 +1,6 @@
+xcode-embed-plugins
+-------------------
+
+* The :prop_tgt:`XCODE_EMBED_PLUGINS <XCODE_EMBED_<type>>` target property
+ was added to tell the :generator:`Xcode` generator what targets to put in
+ the ``Embed PlugIns`` build phase.
diff --git a/Help/release/dev/xcode-scheme-enable-gpu-frame-capture-mode.rst b/Help/release/dev/xcode-scheme-enable-gpu-frame-capture-mode.rst
new file mode 100644
index 0000000000..a93e4e96ae
--- /dev/null
+++ b/Help/release/dev/xcode-scheme-enable-gpu-frame-capture-mode.rst
@@ -0,0 +1,4 @@
+xcode-scheme-enable-gpu-frame-capture-mode
+------------------------------------------
+
+* The Xcode project generation learned the variable `XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE` to enable specifying the Xcode scheme option property `GPU Frame Capture`.
diff --git a/Help/release/index.rst b/Help/release/index.rst
index 3d2ed43105..131595a262 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_GENERATOR_INSTANCE.rst b/Help/variable/CMAKE_GENERATOR_INSTANCE.rst
index 5858d7a771..6a35f17786 100644
--- a/Help/variable/CMAKE_GENERATOR_INSTANCE.rst
+++ b/Help/variable/CMAKE_GENERATOR_INSTANCE.rst
@@ -18,10 +18,43 @@ variable may initialize ``CMAKE_GENERATOR_INSTANCE`` as a cache entry.
Once a given build tree has been initialized with a particular value
for this variable, changing the value has undefined behavior.
-Instance specification is supported only on specific generators:
+Instance specification is supported only on specific generators.
-* For the :generator:`Visual Studio 15 2017` generator (and above)
- this specifies the absolute path to the VS installation directory
- of the selected VS instance.
+Visual Studio Instance Selection
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-See native build system documentation for allowed instance values.
+:ref:`Visual Studio Generators` support instance specification for
+Visual Studio 2017 and above. The ``CMAKE_GENERATOR_INSTANCE`` variable
+may be set as a cache entry selecting an instance of Visual Studio
+via one of the following forms:
+
+* ``location``
+* ``location[,key=value]*``
+* ``key=value[,key=value]*``
+
+The ``location`` specifies the absolute path to the top-level directory
+of the VS installation.
+
+The ``key=value`` pairs form a comma-separated list of options to
+specify details of the instance selection.
+Supported pairs are:
+
+``version=<major>.<minor>.<MMMDD>.<BBB>``
+ .. versionadded:: 3.23
+
+ Specify the 4-component VS Build Version.
+
+.. versionadded:: 3.23
+
+ A portable VS instance may be specified that is not known to the
+ Visual Studio Installer tool. The ``location`` and ``version=``
+ values must both be provided.
+
+If the value of ``CMAKE_GENERATOR_INSTANCE`` is not specified explicitly
+by the user or a toolchain file, CMake queries the Visual Studio Installer
+to locate VS instances, chooses one, and sets the variable as a cache entry
+to hold the value persistently. If an environment variable of the form
+``VS##0COMNTOOLS``, where ``##`` the Visual Studio major version number,
+is set and points to the ``Common7/Tools`` directory within one of the
+VS instances, that instance will be used. Otherwise, if more than one
+VS instance is installed we do not define which one is chosen by default.
diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst
index 0abedde6a5..1db42c7acc 100644
--- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst
+++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst
@@ -28,6 +28,7 @@ include:
IAR = IAR Systems (iar.com)
Intel = Intel Compiler (intel.com)
IntelLLVM = Intel LLVM-Based Compiler (intel.com)
+ LCC = MCST Elbrus C/C++/Fortran Compiler (mcst.ru)
MSVC = Microsoft Visual Studio (microsoft.com)
NVHPC = NVIDIA HPC SDK Compiler (nvidia.com)
NVIDIA = NVIDIA CUDA Compiler (nvidia.com)
diff --git a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
index 02316682ed..8c84f9115c 100644
--- a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
+++ b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
@@ -34,6 +34,8 @@ only for the policies that do not warn by default:
policy :policy:`CMP0126`.
* ``CMAKE_POLICY_WARNING_CMP0128`` controls the warning for
policy :policy:`CMP0128`.
+* ``CMAKE_POLICY_WARNING_CMP0129`` controls the warning for
+ policy :policy:`CMP0129`.
This variable should not be set by a project in CMake code. Project
developers running CMake may set this variable in their cache to
diff --git a/Help/variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE.rst b/Help/variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE.rst
new file mode 100644
index 0000000000..3a3c847e63
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE.rst
@@ -0,0 +1,15 @@
+CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE
+------------------------------------------------
+
+.. versionadded:: 3.23
+
+Property value for ``GPU Frame Capture`` in the Options section of
+the generated Xcode scheme. Example values are `Metal` and
+`Disabled`.
+
+This variable initializes the
+:prop_tgt:`XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE`
+property on all targets.
+
+Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property
+documentation to see all Xcode schema related properties.
diff --git a/Help/variable/CTEST_CUSTOM_TESTS_IGNORE.rst b/Help/variable/CTEST_CUSTOM_TESTS_IGNORE.rst
index 57222ca1e8..7b1a4b80a0 100644
--- a/Help/variable/CTEST_CUSTOM_TESTS_IGNORE.rst
+++ b/Help/variable/CTEST_CUSTOM_TESTS_IGNORE.rst
@@ -1,7 +1,7 @@
CTEST_CUSTOM_TESTS_IGNORE
-------------------------
-A list of regular expressions to use to exclude tests during the
+A list of test names to be excluded from the set of tests run by the
:command:`ctest_test` command.
.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_SUBMIT_INACTIVITY_TIMEOUT.rst b/Help/variable/CTEST_SUBMIT_INACTIVITY_TIMEOUT.rst
new file mode 100644
index 0000000000..65976fa9b4
--- /dev/null
+++ b/Help/variable/CTEST_SUBMIT_INACTIVITY_TIMEOUT.rst
@@ -0,0 +1,5 @@
+CTEST_SUBMIT_INACTIVITY_TIMEOUT
+-------------------------------
+
+Specify the CTest ``SubmitInactivityTimeout`` setting
+in a :manual:`ctest(1)` dashboard client script.
diff --git a/Help/variable/GHS-MULTI.rst b/Help/variable/GHS-MULTI.rst
deleted file mode 100644
index bb139affd4..0000000000
--- a/Help/variable/GHS-MULTI.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-GHS-MULTI
----------
-
-.. versionadded:: 3.3
-
-``True`` when using :generator:`Green Hills MULTI` generator.
diff --git a/Help/variable/GHSMULTI.rst b/Help/variable/GHSMULTI.rst
new file mode 100644
index 0000000000..3daef5ddfb
--- /dev/null
+++ b/Help/variable/GHSMULTI.rst
@@ -0,0 +1,9 @@
+GHSMULTI
+--------
+
+.. versionadded:: 3.3
+
+``1`` when using :generator:`Green Hills MULTI` generator.
+
+Also, Set to ``1`` when the target system is a Green Hills platform
+(i.e. When CMAKE_SYSTEM_NAME is ``GHS-MULTI``).
diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake
index e9cfed607b..dea721ebb9 100644
--- a/Modules/CMakeCUDAInformation.cmake
+++ b/Modules/CMakeCUDAInformation.cmake
@@ -160,22 +160,9 @@ if(NOT DEFINED CMAKE_CUDA_ARCHIVE_FINISH)
set(CMAKE_CUDA_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
endif()
-#Specify how to compile when ptx has been requested
-if(NOT CMAKE_CUDA_COMPILE_PTX_COMPILATION)
- set(CMAKE_CUDA_COMPILE_PTX_COMPILATION
- "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} ${_CMAKE_CUDA_PTX_FLAG} <SOURCE> -o <OBJECT>")
-endif()
-
-#Specify how to compile when separable compilation has been requested
-if(NOT CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION)
- set(CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION
- "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} ${_CMAKE_CUDA_DEVICE_CODE} <SOURCE> -o <OBJECT>")
-endif()
-
-#Specify how to compile when whole compilation has been requested
-if(NOT CMAKE_CUDA_COMPILE_WHOLE_COMPILATION)
- set(CMAKE_CUDA_COMPILE_WHOLE_COMPILATION
- "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -c <SOURCE> -o <OBJECT>")
+if(NOT CMAKE_CUDA_COMPILE_OBJECT)
+ set(CMAKE_CUDA_COMPILE_OBJECT
+ "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} <CUDA_COMPILE_MODE> <SOURCE> -o <OBJECT>")
endif()
# compile a cu file into an executable
@@ -211,7 +198,7 @@ endif()
# Used when device linking is handled by CMake.
if(NOT CMAKE_CUDA_DEVICE_LINK_COMPILE)
- set(CMAKE_CUDA_DEVICE_LINK_COMPILE "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <FLAGS> -D__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ -D__NV_EXTRA_INITIALIZATION=\"\" -D__NV_EXTRA_FINALIZATION=\"\" -DREGISTERLINKBINARYFILE=\\\"<REGISTER_FILE>\\\" -DFATBINFILE=\\\"<FATBINARY>\\\" ${_CMAKE_COMPILE_AS_CUDA_FLAG} -c \"${CMAKE_CUDA_COMPILER_TOOLKIT_LIBRARY_ROOT}/bin/crt/link.stub\" -o <OBJECT>")
+ set(CMAKE_CUDA_DEVICE_LINK_COMPILE "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <FLAGS> <LINK_FLAGS> -D__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ -D__NV_EXTRA_INITIALIZATION=\"\" -D__NV_EXTRA_FINALIZATION=\"\" -DREGISTERLINKBINARYFILE=\\\"<REGISTER_FILE>\\\" -DFATBINFILE=\\\"<FATBINARY>\\\" ${_CMAKE_COMPILE_AS_CUDA_FLAG} -c \"${CMAKE_CUDA_COMPILER_TOOLKIT_LIBRARY_ROOT}/bin/crt/link.stub\" -o <OBJECT>")
endif()
unset(__IMPLICIT_DLINK_FLAGS)
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index e6b3ee32e6..044326ce1e 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -84,6 +84,7 @@ function(compiler_id_detection outvar lang)
)
list(APPEND ordered_compilers
Clang
+ LCC
GNU
MSVC
ADSP
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 15eab0f5e9..f5298dff46 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -160,7 +160,7 @@ endif ()
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
if (NOT _CMAKE_TOOLCHAIN_PREFIX)
- if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|QCC")
+ if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|QCC|LCC")
get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME)
if (COMPILER_BASENAME MATCHES "^(.+-)?(clang|g?cc)(-cl)?(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index d06315e479..8479831b0b 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -258,13 +258,22 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
# Append user-specified architectures.
if(CMAKE_CUDA_ARCHITECTURES)
- foreach(arch ${CMAKE_CUDA_ARCHITECTURES})
- # Strip specifiers as PTX vs binary doesn't matter.
- string(REGEX MATCH "[0-9]+" arch_name "${arch}")
- string(APPEND clang_test_flags " --cuda-gpu-arch=sm_${arch_name}")
- string(APPEND nvcc_test_flags " -gencode=arch=compute_${arch_name},code=sm_${arch_name}")
- list(APPEND tested_architectures "${arch_name}")
- endforeach()
+ if("x${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "xall")
+ string(APPEND nvcc_test_flags " -arch=all")
+ set(architectures_mode all)
+ elseif("x${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "xall-major")
+ string(APPEND nvcc_test_flags " -arch=all-major")
+ set(architectures_mode all-major)
+ else()
+ set(architectures_mode explicit)
+ foreach(arch ${CMAKE_CUDA_ARCHITECTURES})
+ # Strip specifiers as PTX vs binary doesn't matter.
+ string(REGEX MATCH "[0-9]+" arch_name "${arch}")
+ string(APPEND clang_test_flags " --cuda-gpu-arch=sm_${arch_name}")
+ string(APPEND nvcc_test_flags " -gencode=arch=compute_${arch_name},code=sm_${arch_name}")
+ list(APPEND tested_architectures "${arch_name}")
+ endforeach()
+ endif()
# If the user has specified architectures we'll want to fail during compiler detection if they don't work.
set(CMAKE_CUDA_COMPILER_ID_REQUIRE_SUCCESS ON)
@@ -597,7 +606,18 @@ if(DEFINED detected_architecture AND "${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "")
if(NOT CMAKE_CUDA_ARCHITECTURES)
message(FATAL_ERROR "Failed to find a working CUDA architecture.")
endif()
-elseif(architectures)
+elseif(architectures AND (architectures_mode STREQUAL "xall" OR
+ architectures_mode STREQUAL "xall-major"))
+ if(NOT CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
+ message(FATAL_ERROR
+ "The CMAKE_CUDA_ARCHITECTURES:\n"
+ " ${CMAKE_CUDA_ARCHITECTURES}\n"
+ "is not supported with the ${CMAKE_CUDA_COMPILER_ID} compiler. Try:\n"
+ " ${architectures}\n"
+ "instead.")
+ endif()
+
+elseif(architectures AND architectures_mode STREQUAL "xexplicit")
# Sort since order mustn't matter.
list(SORT architectures)
list(SORT tested_architectures)
@@ -630,5 +650,7 @@ unset(_CUDA_LIBRARY_DIR)
unset(_CUDA_TARGET_DIR)
unset(_CUDA_TARGET_NAME)
+unset(architectures_mode)
+
set(CMAKE_CUDA_COMPILER_ENV_VAR "CUDACXX")
set(CMAKE_CUDA_HOST_COMPILER_ENV_VAR "CUDAHOSTCXX")
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 72dc8d3d57..fd3d028be2 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -159,7 +159,7 @@ endif ()
if (NOT _CMAKE_TOOLCHAIN_PREFIX)
- if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|QCC")
+ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|QCC|LCC")
get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME)
if (COMPILER_BASENAME MATCHES "^(.+-)?(clang\\+\\+|[gc]\\+\\+|clang-cl)(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake
index c967ab7c24..aec86d92c7 100644
--- a/Modules/CMakeDetermineCompiler.cmake
+++ b/Modules/CMakeDetermineCompiler.cmake
@@ -148,7 +148,7 @@ macro(_cmake_find_compiler_path lang)
endmacro()
function(_cmake_find_compiler_sysroot lang)
- if(CMAKE_${lang}_COMPILER_ID STREQUAL "GNU")
+ if(CMAKE_${lang}_COMPILER_ID STREQUAL "GNU" OR CMAKE_${lang}_COMPILER_ID STREQUAL "LCC")
execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" -print-sysroot
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE _cmake_sysroot_run_out
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index c62cb7d249..b7119a805d 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -150,7 +150,28 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
endif()
endif()
- if (COMPILER_QNXNTO AND CMAKE_${lang}_COMPILER_ID STREQUAL "GNU")
+ # For LCC Fortran we need to explicitly query the version.
+ if(lang STREQUAL "Fortran"
+ AND CMAKE_${lang}_COMPILER_ID STREQUAL "LCC")
+ execute_process(
+ COMMAND "${CMAKE_${lang}_COMPILER}"
+ --version
+ OUTPUT_VARIABLE output ERROR_VARIABLE output
+ RESULT_VARIABLE result
+ TIMEOUT 10
+ )
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Running the ${lang} compiler: \"${CMAKE_${lang}_COMPILER}\" --version\n"
+ "${output}\n"
+ )
+
+ if(output MATCHES [[\(GCC\) ([0-9]+\.[0-9]+(\.[0-9]+)?) compatible]])
+ set(CMAKE_${lang}_SIMULATE_ID "GNU")
+ set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_MATCH_1}")
+ endif()
+ endif()
+
+ if (COMPILER_QNXNTO AND (CMAKE_${lang}_COMPILER_ID STREQUAL "GNU" OR CMAKE_${lang}_COMPILER_ID STREQUAL "LCC"))
execute_process(
COMMAND "${CMAKE_${lang}_COMPILER}"
-V
@@ -641,12 +662,8 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
elseif("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
set(id_src "${src}")
- if (GHS_PRIMARY_TARGET)
- set(ghs_primary_target "${GHS_PRIMARY_TARGET}")
- else()
- set(ghs_primary_target "${CMAKE_GENERATOR_PLATFORM}_${GHS_TARGET_PLATFORM}.tgt")
- endif()
- if ("${GHS_TARGET_PLATFORM}" MATCHES "integrity")
+ set(ghs_primary_target "${GHS_PRIMARY_TARGET}")
+ if ("${ghs_primary_target}" MATCHES "integrity")
set(bsp_name "macro GHS_BSP=${GHS_BSP_NAME}")
set(os_dir "macro GHS_OS=${GHS_OS_DIR}")
endif()
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index 6a8984b2bd..33b8bf4491 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -78,12 +78,13 @@ else()
set(CMAKE_Fortran_COMPILER_LIST
ftn
ifort ifc ifx efc pgf95 pgfortran lf95 xlf95 fort
- flang gfortran gfortran-4 g95 f90 pgf90
+ flang lfortran gfortran gfortran-4 g95 f90 pgf90
frt pgf77 xlf g77 f77 nag
)
endif()
# Vendor-specific compiler names.
+ set(_Fortran_COMPILER_NAMES_LCC lfortran gfortran)
set(_Fortran_COMPILER_NAMES_GNU gfortran gfortran-4 g95 g77)
set(_Fortran_COMPILER_NAMES_Intel ifort ifc efc ifx)
set(_Fortran_COMPILER_NAMES_Absoft af95 af90 af77)
diff --git a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
index f90301be91..5d7d430a2b 100644
--- a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
+++ b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
@@ -88,7 +88,7 @@ set(ENV{LANG} C)
# Now check for C, works for gcc and Intel compiler at least
if (NOT CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS)
- if (CMAKE_C_COMPILER_ID MATCHES GNU OR CMAKE_C_COMPILER_ID MATCHES "Intel" OR CMAKE_C_COMPILER_ID MATCHES Clang)
+ if (CMAKE_C_COMPILER_ID MATCHES GNU OR CMAKE_C_COMPILER_ID MATCHES "LCC" OR CMAKE_C_COMPILER_ID MATCHES "Intel" OR CMAKE_C_COMPILER_ID MATCHES Clang)
_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c _dirs _defines)
set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "C compiler system include directories")
set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS "${_defines}" CACHE INTERNAL "C compiler system defined macros")
@@ -99,7 +99,7 @@ endif ()
# And now the same for C++
if (NOT CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS)
- if ("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Clang)
+ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "LCC" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Clang)
_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c++ _dirs _defines)
set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "CXX compiler system include directories")
set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS "${_defines}" CACHE INTERNAL "CXX compiler system defined macros")
diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in
index d0e0e46fb1..969c8414c3 100644
--- a/Modules/CMakeFortranCompilerId.F.in
+++ b/Modules/CMakeFortranCompilerId.F.in
@@ -95,6 +95,13 @@
# endif
#elif defined(__ABSOFT__)
PRINT *, 'INFO:compiler[Absoft]'
+#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__))
+ PRINT *, 'INFO:compiler[LCC]'
+# define COMPILER_VERSION_MAJOR DEC(1)
+# define COMPILER_VERSION_MINOR DEC(__LCC__ - 100)
+# if defined(__LCC_MINOR__)
+# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__)
+# endif
#elif defined(__GNUC__)
PRINT *, 'INFO:compiler[GNU]'
# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake
index a61f71b117..6bdefde833 100644
--- a/Modules/CMakeParseImplicitLinkInfo.cmake
+++ b/Modules/CMakeParseImplicitLinkInfo.cmake
@@ -58,6 +58,10 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
endif()
separate_arguments(args NATIVE_COMMAND "${line}")
list(GET args 0 cmd)
+ if("${cmd}" MATCHES "->")
+ # LCC has '-> ' in-front of the linker
+ list(GET args 1 cmd)
+ endif()
else()
#check to see if the link line is comma-separated instead of space separated
string(REGEX REPLACE "," " " line "${line}")
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index 373a707308..50a9525d07 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -262,7 +262,7 @@ installers. The most commonly-used variables are:
create Start Menu shortcuts. For example, setting this to the list
``ccmake;CMake`` will create a shortcut named "CMake" that will execute the
installed executable ``ccmake``. Not all CPack generators use it (at least
- NSIS, WIX and OSXX11 do).
+ NSIS, and WIX do).
.. variable:: CPACK_STRIP_FILES
@@ -658,13 +658,11 @@ if(NOT CPACK_GENERATOR)
if(APPLE)
option(CPACK_BINARY_BUNDLE "Enable to build OSX bundles" OFF)
option(CPACK_BINARY_DRAGNDROP "Enable to build OSX Drag And Drop package" OFF)
- option(CPACK_BINARY_OSXX11 "Enable to build OSX X11 packages (deprecated)" OFF)
option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages (deprecated)" OFF)
option(CPACK_BINARY_PRODUCTBUILD "Enable to build productbuild packages" OFF)
mark_as_advanced(
CPACK_BINARY_BUNDLE
CPACK_BINARY_DRAGNDROP
- CPACK_BINARY_OSXX11
CPACK_BINARY_PACKAGEMAKER
CPACK_BINARY_PRODUCTBUILD
)
@@ -717,7 +715,6 @@ if(NOT CPACK_GENERATOR)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_IFW IFW)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_NSIS NSIS)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_NUGET NuGet)
- cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_OSXX11 OSXX11)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PACKAGEMAKER PackageMaker)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PRODUCTBUILD productbuild)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_RPM RPM)
diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake
index 48ee3c4779..a7139af5fe 100644
--- a/Modules/CheckSymbolExists.cmake
+++ b/Modules/CheckSymbolExists.cmake
@@ -67,14 +67,29 @@ cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
if(CMAKE_C_COMPILER_LOADED)
+ __CHECK_SYMBOL_EXISTS_FILTER_FLAGS(C)
__CHECK_SYMBOL_EXISTS_IMPL("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" )
+ __CHECK_SYMBOL_EXISTS_RESTORE_FLAGS(C)
elseif(CMAKE_CXX_COMPILER_LOADED)
+ __CHECK_SYMBOL_EXISTS_FILTER_FLAGS(CXX)
__CHECK_SYMBOL_EXISTS_IMPL("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.cxx" "${SYMBOL}" "${FILES}" "${VARIABLE}" )
+ __CHECK_SYMBOL_EXISTS_RESTORE_FLAGS(CXX)
else()
message(FATAL_ERROR "CHECK_SYMBOL_EXISTS needs either C or CXX language enabled")
endif()
endmacro()
+macro(__CHECK_SYMBOL_EXISTS_FILTER_FLAGS LANG)
+ set(__CMAKE_${LANG}_FLAGS_SAVED "${CMAKE_${LANG}_FLAGS}")
+ string(REGEX REPLACE "(^| )-Werror([= ][^ ]*)?( |$)" " " CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS}")
+ string(REGEX REPLACE "(^| )-pedantic-errors( |$)" " " CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS}")
+endmacro()
+
+macro(__CHECK_SYMBOL_EXISTS_RESTORE_FLAGS LANG)
+ set(CMAKE_${LANG}_FLAGS "${__CMAKE_${LANG}_FLAGS_SAVED}")
+ unset(__CMAKE_${LANG}_FLAGS_SAVED)
+endmacro()
+
macro(__CHECK_SYMBOL_EXISTS_IMPL SOURCEFILE SYMBOL FILES VARIABLE)
if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
diff --git a/Modules/Compiler/Clang-CUDA.cmake b/Modules/Compiler/Clang-CUDA.cmake
index 0223081dad..219897e4e1 100644
--- a/Modules/Compiler/Clang-CUDA.cmake
+++ b/Modules/Compiler/Clang-CUDA.cmake
@@ -18,8 +18,13 @@ __compiler_clang_cxx_standards(CUDA)
set(CMAKE_CUDA_COMPILER_HAS_DEVICE_LINK_PHASE TRUE)
set(_CMAKE_COMPILE_AS_CUDA_FLAG "-x cuda")
+set(_CMAKE_CUDA_WHOLE_FLAG "-c")
+set(_CMAKE_CUDA_RDC_FLAG "-fgpu-rdc")
set(_CMAKE_CUDA_PTX_FLAG "--cuda-device-only -S")
-set(_CMAKE_CUDA_DEVICE_CODE "-fgpu-rdc -c")
+
+# Device linking is just regular linking so these are the same.
+set(CMAKE_CUDA_DEVICE_LINKER_WRAPPER_FLAG ${CMAKE_CUDA_LINKER_WRAPPER_FLAG})
+set(CMAKE_CUDA_DEVICE_LINKER_WRAPPER_FLAG_SEP ${CMAKE_CUDA_LINKER_WRAPPER_FLAG_SEP})
# RulePlaceholderExpander expands crosscompile variables like sysroot and target only for CMAKE_<LANG>_COMPILER. Override the default.
set(CMAKE_CUDA_LINK_EXECUTABLE "<CMAKE_CUDA_COMPILER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICIT_LINKS}")
diff --git a/Modules/Compiler/LCC-C-DetermineCompiler.cmake b/Modules/Compiler/LCC-C-DetermineCompiler.cmake
new file mode 100644
index 0000000000..2ce92fe3ae
--- /dev/null
+++ b/Modules/Compiler/LCC-C-DetermineCompiler.cmake
@@ -0,0 +1,19 @@
+
+set(_compiler_id_pp_test "defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__))")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(1)
+# if defined(__LCC__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__LCC__- 100)
+# endif
+# if defined(__LCC_MINOR__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__LCC_MINOR__)
+# endif
+# if defined(__GNUC__) && defined(__GNUC_MINOR__)
+# define @PREFIX@SIMULATE_ID \"GNU\"
+# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(__GNUC__)
+# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(__GNUC_MINOR__)
+# if defined(__GNUC_PATCHLEVEL__)
+# define @PREFIX@SIMULATE_VERSION_PATCH @MACRO_DEC@(__GNUC_PATCHLEVEL__)
+# endif
+# endif")
diff --git a/Modules/Compiler/LCC-C-FeatureTests.cmake b/Modules/Compiler/LCC-C-FeatureTests.cmake
new file mode 100644
index 0000000000..0ab5265a58
--- /dev/null
+++ b/Modules/Compiler/LCC-C-FeatureTests.cmake
@@ -0,0 +1,17 @@
+
+set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 304")
+
+# GNU 4.7 correctly sets __STDC_VERSION__ to 201112L, but GNU 4.6 sets it
+# to 201000L. As the former is strictly greater than the latter, test only
+# for the latter. If in the future CMake learns about a C feature which was
+# introduced with GNU 4.7, that should test for the correct version, similar
+# to the distinction between __cplusplus and __GXX_EXPERIMENTAL_CXX0X__ tests.
+set(GNU46_C11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L")
+set(_cmake_feature_test_c_static_assert "${GNU46_C11}")
+# Since 3.4 at least:
+set(GNU34_C99 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L")
+set(_cmake_feature_test_c_restrict "${GNU34_C99}")
+set(_cmake_feature_test_c_variadic_macros "${GNU34_C99}")
+
+set(GNU_C90 "${_cmake_oldestSupported}")
+set(_cmake_feature_test_c_function_prototypes "${GNU_C90}")
diff --git a/Modules/Compiler/LCC-C.cmake b/Modules/Compiler/LCC-C.cmake
new file mode 100644
index 0000000000..3dd6e686a8
--- /dev/null
+++ b/Modules/Compiler/LCC-C.cmake
@@ -0,0 +1,29 @@
+include(Compiler/LCC)
+__compiler_lcc(C)
+
+
+if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_C)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_C_DEPFILE_FORMAT gcc)
+ set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
+endif()
+
+set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
+
+set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
+set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
+set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
+set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
+set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
+set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
+set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
+set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
+set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x")
+set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x")
+
+__compiler_check_default_language_standard(C 1.23 90 1.20 11 1.26 17)
diff --git a/Modules/Compiler/LCC-CXX-DetermineCompiler.cmake b/Modules/Compiler/LCC-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000000..2ce92fe3ae
--- /dev/null
+++ b/Modules/Compiler/LCC-CXX-DetermineCompiler.cmake
@@ -0,0 +1,19 @@
+
+set(_compiler_id_pp_test "defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__))")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(1)
+# if defined(__LCC__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__LCC__- 100)
+# endif
+# if defined(__LCC_MINOR__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__LCC_MINOR__)
+# endif
+# if defined(__GNUC__) && defined(__GNUC_MINOR__)
+# define @PREFIX@SIMULATE_ID \"GNU\"
+# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(__GNUC__)
+# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(__GNUC_MINOR__)
+# if defined(__GNUC_PATCHLEVEL__)
+# define @PREFIX@SIMULATE_VERSION_PATCH @MACRO_DEC@(__GNUC_PATCHLEVEL__)
+# endif
+# endif")
diff --git a/Modules/Compiler/LCC-CXX-FeatureTests.cmake b/Modules/Compiler/LCC-CXX-FeatureTests.cmake
new file mode 100644
index 0000000000..45c54708e6
--- /dev/null
+++ b/Modules/Compiler/LCC-CXX-FeatureTests.cmake
@@ -0,0 +1,109 @@
+
+# Reference: http://gcc.gnu.org/projects/cxx0x.html
+# http://gcc.gnu.org/projects/cxx1y.html
+
+set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404")
+
+set(GNU50_CXX14 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L")
+set(_cmake_feature_test_cxx_variable_templates "${GNU50_CXX14}")
+set(_cmake_feature_test_cxx_relaxed_constexpr "${GNU50_CXX14}")
+set(_cmake_feature_test_cxx_aggregate_default_initializers "${GNU50_CXX14}")
+
+# GNU 4.9 in c++14 mode sets __cplusplus to 201300L, so don't test for the
+# correct value of it below.
+# https://patchwork.ozlabs.org/patch/382470/
+set(GNU49_CXX14 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L")
+set(_cmake_feature_test_cxx_contextual_conversions "${GNU49_CXX14}")
+set(_cmake_feature_test_cxx_attribute_deprecated "${GNU49_CXX14}")
+set(_cmake_feature_test_cxx_decltype_auto "${GNU49_CXX14}")
+set(_cmake_feature_test_cxx_digit_separators "${GNU49_CXX14}")
+set(_cmake_feature_test_cxx_generic_lambdas "${GNU49_CXX14}")
+# GNU 4.3 supports binary literals as an extension, but may warn about
+# use of extensions prior to GNU 4.9
+# http://stackoverflow.com/questions/16334024/difference-between-gcc-binary-literals-and-c14-ones
+set(_cmake_feature_test_cxx_binary_literals "${GNU49_CXX14}")
+# The features below are documented as available in GNU 4.8 (by implementing an
+# earlier draft of the standard paper), but that version of the compiler
+# does not set __cplusplus to a value greater than 201103L until GNU 4.9:
+# http://gcc.gnu.org/onlinedocs/gcc-4.8.2/cpp/Standard-Predefined-Macros.html#Standard-Predefined-Macros
+# http://gcc.gnu.org/onlinedocs/gcc-4.9.0/cpp/Standard-Predefined-Macros.html#Standard-Predefined-Macros
+# So, CMake only reports availability for it with GNU 4.9 or later.
+set(_cmake_feature_test_cxx_return_type_deduction "${GNU49_CXX14}")
+set(_cmake_feature_test_cxx_lambda_init_captures "${GNU49_CXX14}")
+
+# Introduced in GCC 4.8.1
+set(GNU481_CXX11 "((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40801) && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_decltype_incomplete_return_types "${GNU481_CXX11}")
+set(_cmake_feature_test_cxx_reference_qualified_functions "${GNU481_CXX11}")
+set(GNU48_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_alignas "${GNU48_CXX11}")
+# The alignof feature works with GNU 4.7 and -std=c++11, but it is documented
+# as available with GNU 4.8, so treat that as true.
+set(_cmake_feature_test_cxx_alignof "${GNU48_CXX11}")
+set(_cmake_feature_test_cxx_attributes "${GNU48_CXX11}")
+set(_cmake_feature_test_cxx_inheriting_constructors "${GNU48_CXX11}")
+set(_cmake_feature_test_cxx_thread_local "${GNU48_CXX11}")
+set(GNU47_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_alias_templates "${GNU47_CXX11}")
+set(_cmake_feature_test_cxx_delegating_constructors "${GNU47_CXX11}")
+set(_cmake_feature_test_cxx_extended_friend_declarations "${GNU47_CXX11}")
+set(_cmake_feature_test_cxx_final "${GNU47_CXX11}")
+set(_cmake_feature_test_cxx_nonstatic_member_init "${GNU47_CXX11}")
+set(_cmake_feature_test_cxx_override "${GNU47_CXX11}")
+set(_cmake_feature_test_cxx_user_literals "${GNU47_CXX11}")
+# NOTE: C++11 was ratified in September 2011. GNU 4.7 is the first minor
+# release following that (March 2012), and the first minor release to
+# support -std=c++11. Prior to that, support for C++11 features is technically
+# experiemental and possibly incomplete (see for example the note below about
+# cxx_variadic_template_template_parameters)
+# GNU does not define __cplusplus correctly before version 4.7.
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=1773
+# __GXX_EXPERIMENTAL_CXX0X__ is defined in prior versions, but may not be
+# defined in the future.
+set(GNU_CXX0X_DEFINED "(__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))")
+set(GNU46_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && ${GNU_CXX0X_DEFINED}")
+set(_cmake_feature_test_cxx_constexpr "${GNU46_CXX11}")
+set(_cmake_feature_test_cxx_defaulted_move_initializers "${GNU46_CXX11}")
+set(_cmake_feature_test_cxx_enum_forward_declarations "${GNU46_CXX11}")
+set(_cmake_feature_test_cxx_noexcept "${GNU46_CXX11}")
+set(_cmake_feature_test_cxx_nullptr "${GNU46_CXX11}")
+set(_cmake_feature_test_cxx_range_for "${GNU46_CXX11}")
+set(_cmake_feature_test_cxx_unrestricted_unions "${GNU46_CXX11}")
+set(GNU45_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && ${GNU_CXX0X_DEFINED}")
+set(_cmake_feature_test_cxx_explicit_conversions "${GNU45_CXX11}")
+set(_cmake_feature_test_cxx_lambdas "${GNU45_CXX11}")
+set(_cmake_feature_test_cxx_local_type_template_args "${GNU45_CXX11}")
+set(_cmake_feature_test_cxx_raw_string_literals "${GNU45_CXX11}")
+set(GNU44_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && ${GNU_CXX0X_DEFINED}")
+set(_cmake_feature_test_cxx_auto_type "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_defaulted_functions "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_deleted_functions "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_generalized_initializers "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_inline_namespaces "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_sizeof_member "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_strong_enums "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_trailing_return_types "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_unicode_literals "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_uniform_initialization "${GNU44_CXX11}")
+set(_cmake_feature_test_cxx_variadic_templates "${GNU44_CXX11}")
+# TODO: If features are ever recorded for GNU 4.3, there should possibly
+# be a new feature added like cxx_variadic_template_template_parameters,
+# which is implemented by GNU 4.4, but not 4.3. cxx_variadic_templates is
+# actually implemented by GNU 4.3, but variadic template template parameters
+# 'completes' it, so that is the version we record as having the variadic
+# templates capability in CMake. See
+# http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2555.pdf
+# TODO: Should be supported by GNU 4.3
+set(GNU43_CXX11 "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}")
+set(_cmake_feature_test_cxx_decltype "${GNU43_CXX11}")
+set(_cmake_feature_test_cxx_default_function_template_args "${GNU43_CXX11}")
+set(_cmake_feature_test_cxx_long_long_type "${GNU43_CXX11}")
+set(_cmake_feature_test_cxx_right_angle_brackets "${GNU43_CXX11}")
+set(_cmake_feature_test_cxx_rvalue_references "${GNU43_CXX11}")
+set(_cmake_feature_test_cxx_static_assert "${GNU43_CXX11}")
+# TODO: Should be supported since GNU 3.4?
+set(_cmake_feature_test_cxx_extern_templates "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}")
+# TODO: Should be supported forever?
+set(_cmake_feature_test_cxx_func_identifier "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}")
+set(_cmake_feature_test_cxx_variadic_macros "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}")
+set(_cmake_feature_test_cxx_template_template_parameters "${_cmake_oldestSupported} && __cplusplus")
diff --git a/Modules/Compiler/LCC-CXX.cmake b/Modules/Compiler/LCC-CXX.cmake
new file mode 100644
index 0000000000..b3bdd3c301
--- /dev/null
+++ b/Modules/Compiler/LCC-CXX.cmake
@@ -0,0 +1,31 @@
+include(Compiler/LCC)
+__compiler_lcc(CXX)
+
+
+if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
+ AND CMAKE_DEPFILE_FLAGS_CXX)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_CXX_DEPFILE_FORMAT gcc)
+ set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
+endif()
+
+set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
+
+set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
+
+set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
+set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
+set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
+set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
+set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
+set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
+set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
+set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
+set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++2a")
+set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a")
+
+__compiler_check_default_language_standard(CXX 1.19 98 1.20 11 1.21 14 1.24 17 1.26 20)
diff --git a/Modules/Compiler/LCC-FindBinUtils.cmake b/Modules/Compiler/LCC-FindBinUtils.cmake
new file mode 100644
index 0000000000..4dcdd5377e
--- /dev/null
+++ b/Modules/Compiler/LCC-FindBinUtils.cmake
@@ -0,0 +1,37 @@
+if(NOT DEFINED _CMAKE_PROCESSING_LANGUAGE OR _CMAKE_PROCESSING_LANGUAGE STREQUAL "")
+ message(FATAL_ERROR "Internal error: _CMAKE_PROCESSING_LANGUAGE is not set")
+endif()
+
+# Ubuntu 16.04:
+# * /usr/bin/gcc-ar-5
+# * /usr/bin/gcc-ranlib-5
+string(REGEX MATCH "^([0-9]+)" __version_x
+ "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}")
+
+string(REGEX MATCH "^([0-9]+\\.[0-9]+)" __version_x_y
+ "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}")
+
+# Try to find tools in the same directory as GCC itself
+get_filename_component(__gcc_hints "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER}" DIRECTORY)
+
+# http://manpages.ubuntu.com/manpages/wily/en/man1/gcc-ar.1.html
+find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR NAMES
+ "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar-${__version_x_y}"
+ "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar-${__version_x}"
+ "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar${_CMAKE_COMPILER_SUFFIX}"
+ HINTS ${__gcc_hints}
+ NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH
+ DOC "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler"
+)
+mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR)
+
+# http://manpages.ubuntu.com/manpages/wily/en/man1/gcc-ranlib.1.html
+find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB NAMES
+ "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib-${__version_x_y}"
+ "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib-${__version_x}"
+ "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib${_CMAKE_COMPILER_SUFFIX}"
+ HINTS ${__gcc_hints}
+ NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH
+ DOC "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler"
+)
+mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB)
diff --git a/Modules/Compiler/LCC-Fortran.cmake b/Modules/Compiler/LCC-Fortran.cmake
new file mode 100644
index 0000000000..8091b29949
--- /dev/null
+++ b/Modules/Compiler/LCC-Fortran.cmake
@@ -0,0 +1,26 @@
+include(Compiler/LCC)
+__compiler_lcc(Fortran)
+
+set(CMAKE_Fortran_SUBMODULE_SEP "@")
+set(CMAKE_Fortran_SUBMODULE_EXT ".smod")
+
+set(CMAKE_Fortran_PREPROCESS_SOURCE
+ "<CMAKE_Fortran_COMPILER> -cpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> -o <PREPROCESSED_SOURCE>")
+
+set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed-form")
+set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form")
+
+set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-cpp")
+set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-nocpp")
+
+set(CMAKE_Fortran_POSTPROCESS_FLAG "-fpreprocessed")
+
+# No -DNDEBUG for Fortran.
+string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " -Os")
+string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -O3")
+
+# No -isystem for Fortran because it will not find .mod files.
+unset(CMAKE_INCLUDE_SYSTEM_FLAG_Fortran)
+
+# Fortran-specific feature flags.
+set(CMAKE_Fortran_MODDIR_FLAG -J)
diff --git a/Modules/Compiler/LCC.cmake b/Modules/Compiler/LCC.cmake
new file mode 100644
index 0000000000..8353ab64cf
--- /dev/null
+++ b/Modules/Compiler/LCC.cmake
@@ -0,0 +1,95 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+
+# This module is shared by multiple languages; use include blocker.
+if(__COMPILER_LCC)
+ return()
+endif()
+set(__COMPILER_LCC 1)
+
+include(Compiler/CMakeCommonCompilerMacros)
+
+set(__pch_header_C "c-header")
+set(__pch_header_CXX "c++-header")
+set(__pch_header_OBJC "objective-c-header")
+set(__pch_header_OBJCXX "objective-c++-header")
+
+macro(__compiler_lcc lang)
+ # Feature flags.
+ set(CMAKE_${lang}_VERBOSE_FLAG "-v")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
+ set (_CMAKE_${lang}_PIE_MAY_BE_SUPPORTED_BY_LINKER NO)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
+ # Support of PIE at link stage depends on various elements : platform, compiler, linker
+ # so to activate it, module CheckPIESupported must be used.
+ set (_CMAKE_${lang}_PIE_MAY_BE_SUPPORTED_BY_LINKER YES)
+ set(CMAKE_${lang}_LINK_OPTIONS_PIE ${CMAKE_${lang}_COMPILE_OPTIONS_PIE} "-pie")
+ set(CMAKE_${lang}_LINK_OPTIONS_NO_PIE "-no-pie")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
+ set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_SYSROOT "--sysroot=")
+
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
+ set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
+
+ # Older versions of gcc (< 4.5) contain a bug causing them to report a missing
+ # header file as a warning if depfiles are enabled, causing check_header_file
+ # tests to always succeed. Work around this by disabling dependency tracking
+ # in try_compile mode.
+ get_property(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE)
+ if(CMAKE_${lang}_COMPILER_ID STREQUAL "LCC" AND _IN_TC AND NOT CMAKE_FORCE_DEPFILES)
+ else()
+ # distcc does not transform -o to -MT when invoking the preprocessor
+ # internally, as it ought to. Work around this bug by setting -MT here
+ # even though it isn't strictly necessary.
+ set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")
+ endif()
+
+ # Initial configuration flags.
+ string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
+ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
+ set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+ set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
+ set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
+ set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO)
+ set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)
+ set(__lto_flags -flto)
+ list(APPEND __lto_flags -fno-fat-lto-objects)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_IPO ${__lto_flags})
+
+ set(CMAKE_${lang}_ARCHIVE_CREATE_IPO
+ "\"${CMAKE_${lang}_COMPILER_AR}\" cr <TARGET> <LINK_FLAGS> <OBJECTS>"
+ )
+
+ set(CMAKE_${lang}_ARCHIVE_APPEND_IPO
+ "\"${CMAKE_${lang}_COMPILER_AR}\" r <TARGET> <LINK_FLAGS> <OBJECTS>"
+ )
+
+ set(CMAKE_${lang}_ARCHIVE_FINISH_IPO
+ "\"${CMAKE_${lang}_COMPILER_RANLIB}\" <TARGET>"
+ )
+
+ set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}")
+ if(CMAKE_${lang}_COMPILER_ARG1)
+ separate_arguments(_COMPILER_ARGS NATIVE_COMMAND "${CMAKE_${lang}_COMPILER_ARG1}")
+ list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND ${_COMPILER_ARGS})
+ unset(_COMPILER_ARGS)
+ endif()
+ list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp")
+
+ if(NOT "x${lang}" STREQUAL "xFortran")
+ set(CMAKE_PCH_EXTENSION .gch)
+ if (NOT CMAKE_GENERATOR MATCHES "Xcode")
+ set(CMAKE_PCH_PROLOGUE "#pragma GCC system_header")
+ endif()
+ set(CMAKE_${lang}_COMPILE_OPTIONS_INVALID_PCH -Winvalid-pch)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -include <PCH_HEADER>)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -x ${__pch_header_${lang}} -include <PCH_HEADER>)
+ endif()
+endmacro()
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
index c2fe42df20..2f12b4378b 100644
--- a/Modules/Compiler/NVIDIA-CUDA.cmake
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -5,8 +5,9 @@ set(CMAKE_CUDA_VERBOSE_FLAG "-v")
set(CMAKE_CUDA_VERBOSE_COMPILE_FLAG "-Xcompiler=-v")
set(_CMAKE_COMPILE_AS_CUDA_FLAG "-x cu")
+set(_CMAKE_CUDA_WHOLE_FLAG "-c")
+set(_CMAKE_CUDA_RDC_FLAG "-rdc=true")
set(_CMAKE_CUDA_PTX_FLAG "-ptx")
-set(_CMAKE_CUDA_DEVICE_CODE "-dc")
if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89)
# The -forward-unknown-to-host-compiler flag was only
diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in
index e5b1e5d782..afa36f7f98 100644
--- a/Modules/DartConfiguration.tcl.in
+++ b/Modules/DartConfiguration.tcl.in
@@ -21,6 +21,7 @@ LabelsForSubprojects: @CTEST_LABELS_FOR_SUBPROJECTS@
# Submission information
SubmitURL: @SUBMIT_URL@
+SubmitInactivityTimeout: @CTEST_SUBMIT_INACTIVITY_TIMEOUT@
# Dashboard start time
NightlyStartTime: @NIGHTLY_START_TIME@
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index 308138f411..8ed7558936 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -437,7 +437,7 @@ if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
set(BLAS_mkl_END_GROUP "")
endif()
# Switch to GNU Fortran support layer if needed (but not on Apple, where MKL does not provide it)
- if(CMAKE_Fortran_COMPILER_LOADED AND CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT APPLE)
+ if(CMAKE_Fortran_COMPILER_LOADED AND (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" OR CMAKE_Fortran_COMPILER_ID STREQUAL "LCC") AND NOT APPLE)
set(BLAS_mkl_INTFACE "gf")
set(BLAS_mkl_THREADING "gnu")
set(BLAS_mkl_OMP "gomp")
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 38faca24aa..b63f010642 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -917,14 +917,14 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret)
if(NOT Boost_VERSION_STRING VERSION_LESS 1.69.0)
# From GCC 5 and clang 4, versioning changes and minor becomes patch.
# For those compilers, patch is exclude from compiler tag in Boost 1.69+ library naming.
- if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND _boost_COMPILER_VERSION_MAJOR VERSION_GREATER 4)
+ if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND _boost_COMPILER_VERSION_MAJOR VERSION_GREATER 4) OR CMAKE_CXX_COMPILER_ID STREQUAL "LCC")
set(_boost_COMPILER_VERSION "${_boost_COMPILER_VERSION_MAJOR}")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND _boost_COMPILER_VERSION_MAJOR VERSION_GREATER 3)
set(_boost_COMPILER_VERSION "${_boost_COMPILER_VERSION_MAJOR}")
endif()
endif()
- if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "LCC")
if(Boost_VERSION_STRING VERSION_LESS 1.34)
set(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34
else()
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index d22a6765ea..de5f3761a9 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -933,6 +933,23 @@ if(CUDAToolkit_FOUND)
_CUDAToolkit_find_and_add_import_lib(cusolver DEPS cublas cusparse)
_CUDAToolkit_find_and_add_import_lib(cusolver_static DEPS cublas_static cusparse_static culibos)
+
+ if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 10.1.2)
+ # cusolver depends on liblapack_static.a starting with CUDA 10.1 update 2,
+ # https://docs.nvidia.com/cuda/archive/11.5.0/cusolver/index.html#static-link-lapack
+ _CUDAToolkit_find_and_add_import_lib(cusolver_lapack_static ALT lapack_static) # implementation detail static lib
+ _CUDAToolkit_find_and_add_import_lib(cusolver_static DEPS cusolver_lapack_static)
+ endif()
+
+ if(CUDAToolkit_VERSION VERSION_GREATER 11.2.1)
+ # cusolver depends on libcusolver_metis and cublasLt
+ # https://docs.nvidia.com/cuda/archive/11.2.2/cusolver/index.html#link-dependency
+ _CUDAToolkit_find_and_add_import_lib(cusolver DEPS cublasLt)
+
+ _CUDAToolkit_find_and_add_import_lib(cusolver_metis_static ALT metis_static) # implementation detail static lib
+ _CUDAToolkit_find_and_add_import_lib(cusolver_static DEPS cusolver_metis_static cublasLt_static)
+ endif()
+
# nvGRAPH depends on cuRAND, and cuSOLVER.
_CUDAToolkit_find_and_add_import_lib(nvgraph DEPS curand cusolver)
_CUDAToolkit_find_and_add_import_lib(nvgraph_static DEPS curand_static cusolver_static)
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index 8e22f79198..60bb401032 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -22,6 +22,14 @@ Imported targets
``GTest::gtest_main``
The Google Test ``gtest_main`` library, if found
+.. versionadded:: 3.23
+
+``GTest::gmock``
+ The Google Mock ``gmock`` library, if found; adds Thread::Thread
+ automatically
+``GTest::gmock_main``
+ The Google Mock ``gmock_main`` library, if found
+
.. deprecated:: 3.20
For backwards compatibility, this module defines additionally the
following deprecated :prop_tgt:`IMPORTED` targets (available since 3.5):
@@ -32,7 +40,6 @@ Imported targets
``GTest::Main``
The Google Test ``gtest_main`` library, if found
-
Result variables
^^^^^^^^^^^^^^^^
@@ -245,15 +252,29 @@ if(MSVC AND GTEST_MSVC_SEARCH STREQUAL "MD")
__gtest_find_library(GTEST_LIBRARY_DEBUG gtest-mdd gtestd)
__gtest_find_library(GTEST_MAIN_LIBRARY gtest_main-md gtest_main)
__gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_main-mdd gtest_maind)
+ __gtest_find_library(GMOCK_LIBRARY gmock-md gmock)
+ __gtest_find_library(GMOCK_LIBRARY_DEBUG gmock-mdd gmockd)
+ __gtest_find_library(GMOCK_MAIN_LIBRARY gmock_main-md gmock_main)
+ __gtest_find_library(GMOCK_MAIN_LIBRARY_DEBUG gmock_main-mdd gmock_maind)
else()
__gtest_find_library(GTEST_LIBRARY gtest)
__gtest_find_library(GTEST_LIBRARY_DEBUG gtestd)
__gtest_find_library(GTEST_MAIN_LIBRARY gtest_main)
__gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_maind)
+ __gtest_find_library(GMOCK_LIBRARY gmock)
+ __gtest_find_library(GMOCK_LIBRARY_DEBUG gmockd)
+ __gtest_find_library(GMOCK_MAIN_LIBRARY gmock_main)
+ __gtest_find_library(GMOCK_MAIN_LIBRARY_DEBUG gmock_maind)
endif()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTest DEFAULT_MSG GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY)
+if(GMOCK_LIBRARY AND GMOCK_MAIN_LIBRARY)
+ set(GMock_FOUND True)
+else()
+ set(GMock_FOUND False)
+endif()
+
if(GTest_FOUND)
set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIR})
__gtest_append_debugs(GTEST_LIBRARIES GTEST_LIBRARY)
@@ -292,3 +313,36 @@ if(GTest_FOUND)
__gtest_define_backwards_compatible_library_targets()
endif()
+
+if(GMock_FOUND)
+ if(NOT TARGET GTest::gmock)
+ __gtest_determine_library_type(GMOCK_LIBRARY)
+ add_library(GTest::gmock ${GMOCK_LIBRARY_TYPE} IMPORTED)
+ set(_gmock_link_libraries "GTest::gtest")
+ if(TARGET Threads::Threads)
+ list(APPEND _gmock_link_libraries Threads::Threads)
+ endif()
+ set_target_properties(GTest::gmock PROPERTIES
+ INTERFACE_LINK_LIBRARIES "${_gmock_link_libraries}")
+ if(GMOCK_LIBRARY_TYPE STREQUAL "SHARED")
+ set_target_properties(GTest::gmock PROPERTIES
+ INTERFACE_COMPILE_DEFINITIONS "GMOCK_LINKED_AS_SHARED_LIBRARY=1")
+ endif()
+ if(GTEST_INCLUDE_DIRS)
+ set_target_properties(GTest::gmock PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}")
+ endif()
+ __gtest_import_library(GTest::gmock GMOCK_LIBRARY "")
+ __gtest_import_library(GTest::gmock GMOCK_LIBRARY "RELEASE")
+ __gtest_import_library(GTest::gmock GMOCK_LIBRARY "DEBUG")
+ endif()
+ if(NOT TARGET GTest::gmock_main)
+ __gtest_determine_library_type(GMOCK_MAIN_LIBRARY)
+ add_library(GTest::gmock_main ${GMOCK_MAIN_LIBRARY_TYPE} IMPORTED)
+ set_target_properties(GTest::gmock_main PROPERTIES
+ INTERFACE_LINK_LIBRARIES "GTest::gmock")
+ __gtest_import_library(GTest::gmock_main GMOCK_MAIN_LIBRARY "")
+ __gtest_import_library(GTest::gmock_main GMOCK_MAIN_LIBRARY "RELEASE")
+ __gtest_import_library(GTest::gmock_main GMOCK_MAIN_LIBRARY "DEBUG")
+ endif()
+endif()
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 6cadadb908..6e07da5cd5 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -319,8 +319,6 @@ function(_HDF5_test_regular_compiler_Fortran success is_parallel)
file(WRITE ${test_file}
"program hdf5_hello\n"
" use hdf5\n"
- " use h5lt\n"
- " use h5ds\n"
" integer error\n"
" call h5open_f(error)\n"
" call h5close_f(error)\n"
@@ -881,7 +879,7 @@ if( NOT HDF5_FOUND )
# Add library-based search paths for Fortran modules.
if (NOT _hdf5_main_library STREQUAL "")
# gfortran module directory
- if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
+ if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" OR CMAKE_Fortran_COMPILER_ID STREQUAL "LCC")
get_filename_component(_hdf5_library_dir "${_hdf5_main_library}" DIRECTORY)
list(APPEND _hdf5_inc_extra_paths "${_hdf5_library_dir}")
unset(_hdf5_library_dir)
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index 929a809882..ecfb7f9ba9 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -102,6 +102,7 @@ function(_OPENMP_FLAG_CANDIDATES LANG)
unset(OpenMP_FLAG_CANDIDATES)
set(OMP_FLAG_GNU "-fopenmp")
+ set(OMP_FLAG_LCC "-fopenmp")
set(OMP_FLAG_Clang "-fopenmp=libomp" "-fopenmp=libiomp5" "-fopenmp" "-Xclang -fopenmp")
set(OMP_FLAG_AppleClang "-Xclang -fopenmp")
set(OMP_FLAG_HP "+Oopenmp")
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 8474e05c51..85e386a2a6 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -435,7 +435,7 @@ else()
${_OPENSSL_LIBDIR}
${_OPENSSL_LIBRARY_DIRS}
PATH_SUFFIXES
- lib
+ lib lib64
)
find_library(OPENSSL_CRYPTO_LIBRARY
@@ -447,7 +447,7 @@ else()
${_OPENSSL_LIBDIR}
${_OPENSSL_LIBRARY_DIRS}
PATH_SUFFIXES
- lib
+ lib lib64
)
mark_as_advanced(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY)
@@ -650,7 +650,7 @@ if(OPENSSL_FOUND)
_OpenSSL_target_add_dependencies(OpenSSL::SSL)
endif()
- if("${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_FIX}" VERSION_GREATER_EQUAL "0.9.8")
+ if("${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}" VERSION_GREATER_EQUAL "0.9.8")
if(MSVC)
if(EXISTS "${OPENSSL_INCLUDE_DIR}")
set(_OPENSSL_applink_paths PATHS ${OPENSSL_INCLUDE_DIR})
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index e4d6cf3cb9..4198374b22 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -164,18 +164,21 @@ if(CMAKE_HAVE_PTHREAD_H)
elseif(CMAKE_CXX_COMPILER_LOADED)
CHECK_CXX_SOURCE_COMPILES("${PTHREAD_C_CXX_TEST_SOURCE}" CMAKE_HAVE_LIBC_PTHREAD)
endif()
- if(CMAKE_HAVE_LIBC_PTHREAD)
+
+ # Check for -pthread first if enabled. This is the recommended
+ # way, but not backwards compatible as one must also pass -pthread
+ # as compiler flag then.
+ if(THREADS_PREFER_PTHREAD_FLAG)
+ _check_pthreads_flag()
+ endif()
+
+ if(Threads_FOUND)
+ # do nothing, we are done
+ elseif(CMAKE_HAVE_LIBC_PTHREAD)
set(CMAKE_THREAD_LIBS_INIT "")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(Threads_FOUND TRUE)
else()
- # Check for -pthread first if enabled. This is the recommended
- # way, but not backwards compatible as one must also pass -pthread
- # as compiler flag then.
- if (THREADS_PREFER_PTHREAD_FLAG)
- _check_pthreads_flag()
- endif ()
-
if(CMAKE_SYSTEM MATCHES "GHS-MULTI")
_check_threads_lib(posix pthread_create CMAKE_HAVE_PTHREADS_CREATE)
endif()
diff --git a/Modules/FindVulkan.cmake b/Modules/FindVulkan.cmake
index 4f48e135aa..527ca8bf75 100644
--- a/Modules/FindVulkan.cmake
+++ b/Modules/FindVulkan.cmake
@@ -39,18 +39,29 @@ This module defines :prop_tgt:`IMPORTED` targets if Vulkan has been found:
Result Variables
^^^^^^^^^^^^^^^^
-This module defines the following variables::
-
- Vulkan_FOUND - "True" if Vulkan was found
- Vulkan_INCLUDE_DIRS - include directories for Vulkan
- Vulkan_LIBRARIES - link against this library to use Vulkan
-
-The module will also define three cache variables::
-
- Vulkan_INCLUDE_DIR - the Vulkan include directory
- Vulkan_LIBRARY - the path to the Vulkan library
- Vulkan_GLSLC_EXECUTABLE - the path to the GLSL SPIR-V compiler
- Vulkan_GLSLANG_VALIDATOR_EXECUTABLE - the path to the glslangValidator tool
+This module defines the following variables:
+
+``Vulkan_FOUND``
+ set to true if Vulkan was found
+``Vulkan_INCLUDE_DIRS``
+ include directories for Vulkan
+``Vulkan_LIBRARIES``
+ link against this library to use Vulkan
+``Vulkan_VERSION``
+ .. versionadded:: 3.23
+
+ value from ``vulkan/vulkan_core.h``
+
+The module will also defines these cache variables:
+
+``Vulkan_INCLUDE_DIR``
+ the Vulkan include directory
+``Vulkan_LIBRARY``
+ the path to the Vulkan library
+``Vulkan_GLSLC_EXECUTABLE``
+ the path to the GLSL SPIR-V compiler
+``Vulkan_GLSLANG_VALIDATOR_EXECUTABLE``
+ the path to the glslangValidator tool
Hints
^^^^^
@@ -125,10 +136,33 @@ endif()
set(Vulkan_LIBRARIES ${Vulkan_LIBRARY})
set(Vulkan_INCLUDE_DIRS ${Vulkan_INCLUDE_DIR})
+# detect version e.g 1.2.189
+set(Vulkan_VERSION "")
+if(Vulkan_INCLUDE_DIR)
+ set(VULKAN_CORE_H ${Vulkan_INCLUDE_DIR}/vulkan/vulkan_core.h)
+ if(EXISTS ${VULKAN_CORE_H})
+ file(STRINGS ${VULKAN_CORE_H} VulkanHeaderVersionLine REGEX "^#define VK_HEADER_VERSION ")
+ string(REGEX MATCHALL "[0-9]+" VulkanHeaderVersion "${VulkanHeaderVersionLine}")
+ file(STRINGS ${VULKAN_CORE_H} VulkanHeaderVersionLine2 REGEX "^#define VK_HEADER_VERSION_COMPLETE ")
+ string(REGEX MATCHALL "[0-9]+" VulkanHeaderVersion2 "${VulkanHeaderVersionLine2}")
+ list(LENGTH VulkanHeaderVersion2 _len)
+ # versions >= 1.2.175 have an additional numbers in front of e.g. '0, 1, 2' instead of '1, 2'
+ if(_len EQUAL 3)
+ list(REMOVE_AT VulkanHeaderVersion2 0)
+ endif()
+ list(APPEND VulkanHeaderVersion2 ${VulkanHeaderVersion})
+ list(JOIN VulkanHeaderVersion2 "." Vulkan_VERSION)
+ endif()
+endif()
+
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(Vulkan
- DEFAULT_MSG
- Vulkan_LIBRARY Vulkan_INCLUDE_DIR)
+ REQUIRED_VARS
+ Vulkan_LIBRARY
+ Vulkan_INCLUDE_DIR
+ VERSION_VAR
+ Vulkan_VERSION
+)
mark_as_advanced(Vulkan_INCLUDE_DIR Vulkan_LIBRARY Vulkan_GLSLC_EXECUTABLE
Vulkan_GLSLANG_VALIDATOR_EXECUTABLE)
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake
index 01bd63716c..4e7f87b921 100644
--- a/Modules/GNUInstallDirs.cmake
+++ b/Modules/GNUInstallDirs.cmake
@@ -52,8 +52,10 @@ where ``<dir>`` is one of:
.. versionadded:: 3.9
run-time variable data (``LOCALSTATEDIR/run``)
``LIBDIR``
- object code libraries (``lib`` or ``lib64``
- or ``lib/<multiarch-tuple>`` on Debian)
+ object code libraries (``lib`` or ``lib64``)
+
+ On Debian, this may be ``lib/<multiarch-tuple>`` when
+ :variable:`CMAKE_INSTALL_PREFIX` is ``/``, ``/usr``, or ``/usr/local``.
``INCLUDEDIR``
C header files (``include``)
``OLDINCLUDEDIR``
@@ -271,7 +273,9 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR OR (_libdir_set
if(__system_type_for_install STREQUAL "debian")
if(CMAKE_LIBRARY_ARCHITECTURE)
- if("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
+ if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/"
+ OR "${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$"
+ OR "${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/local/?$")
set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
endif()
if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX
@@ -328,7 +332,7 @@ else()
"Info documentation (DATAROOTDIR/info)")
endif()
-if(CMAKE_SYSTEM_NAME MATCHES "^(([^k].*)?BSD|DragonFly)$")
+if(CMAKE_SYSTEM_NAME MATCHES "^(([^k].*)?BSD|DragonFly)$" AND NOT CMAKE_SYSTEM_NAME MATCHES "^(FreeBSD)$")
_GNUInstallDirs_cache_path_fallback(CMAKE_INSTALL_MANDIR "man"
"Man documentation (man)")
else()
diff --git a/Modules/Internal/CPack/CPack.OSXScriptLauncher.in b/Modules/Internal/CPack/CPack.OSXScriptLauncher.in
deleted file mode 100644
index c715860463..0000000000
--- a/Modules/Internal/CPack/CPack.OSXScriptLauncher.in
+++ /dev/null
Binary files differ
diff --git a/Modules/Internal/CPack/CPack.OSXScriptLauncher.rsrc.in b/Modules/Internal/CPack/CPack.OSXScriptLauncher.rsrc.in
deleted file mode 100644
index 5f5f17a1c7..0000000000
--- a/Modules/Internal/CPack/CPack.OSXScriptLauncher.rsrc.in
+++ /dev/null
Binary files differ
diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake
index c115f003e8..958a6dbd7b 100644
--- a/Modules/Internal/CPack/CPackDeb.cmake
+++ b/Modules/Internal/CPack/CPackDeb.cmake
@@ -332,6 +332,14 @@ function(cpack_deb_prepare_package_vars)
RESULT_VARIABLE SHLIBDEPS_RESULT
ERROR_VARIABLE SHLIBDEPS_ERROR
OUTPUT_STRIP_TRAILING_WHITESPACE )
+
+ # E2K OSL 6.0.1 and prior has broken dpkg-shlibdeps. CPack will deal with that (mocking SHLIBDEPS_OUTPUT), but inform user of this.
+ if("${SHLIBDEPS_ERROR}" MATCHES "unknown gcc system type e2k.*, falling back to default")
+ message(WARNING "CPackDeb: broken dpkg-shlibdeps on E2K detected, will fall back to minimal dependencies.\n"
+ "You should expect that dependencies list in the package will be incomplete.")
+ set(SHLIBDEPS_OUTPUT "shlibs:Depends=libc6, lcc-libs")
+ endif()
+
if(CPACK_DEBIAN_PACKAGE_DEBUG)
# dpkg-shlibdeps will throw some warnings if some input files are not binary
message( "CPackDeb Debug: dpkg-shlibdeps warnings \n${SHLIBDEPS_ERROR}")
diff --git a/Modules/Platform/GHS-MULTI-Determine.cmake b/Modules/Platform/GHS-MULTI-Determine.cmake
index 349d906571..96f0162470 100644
--- a/Modules/Platform/GHS-MULTI-Determine.cmake
+++ b/Modules/Platform/GHS-MULTI-Determine.cmake
@@ -1,26 +1,77 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#Setup Green Hills MULTI specific compilation information
+# Setup variables used for Green Hills MULTI generator
+# -- Allow users to override these values.
+
+if(CMAKE_GENERATOR MATCHES "Green Hills MULTI")
+
+ # Set the project primaryTarget value
+ # If not set then primaryTarget will be determined by the generator
+ if((NOT DEFINED GHS_PRIMARY_TARGET) OR (DEFINED CACHE{GHS_PRIMARY_TARGET}))
+ set(GHS_PRIMARY_TARGET "IGNORE" CACHE STRING "GHS MULTI primaryTarget")
+ mark_as_advanced(GHS_PRIMARY_TARGET)
+ endif()
+
+ # Setup MULTI toolset selection variables
+ if((NOT DEFINED GHS_TOOLSET_ROOT) OR (DEFINED CACHE{GHS_TOOLSET_ROOT}))
+ if(CMAKE_HOST_UNIX)
+ set(_ts_root "/usr/ghs")
+ else()
+ set(_ts_root "C:/ghs")
+ endif()
+ set(GHS_TOOLSET_ROOT "${_ts_root}" CACHE PATH "GHS platform toolset root directory")
+ mark_as_advanced(GHS_TOOLSET_ROOT)
+ unset(_ts_root)
+ endif()
+
+ # Setup MULTI project variables
+ if((NOT DEFINED GHS_CUSTOMIZATION) OR (DEFINED CACHE{GHS_CUSTOMIZATION}))
+ set(GHS_CUSTOMIZATION "" CACHE FILEPATH "optional GHS customization")
+ mark_as_advanced(GHS_CUSTOMIZATION)
+ endif()
+
+ if((NOT DEFINED GHS_GPJ_MACROS) OR (DEFINED CACHE{GHS_GPJ_MACROS}))
+ set(GHS_GPJ_MACROS "" CACHE STRING "optional GHS macros generated in the .gpjs for legacy reasons")
+ mark_as_advanced(GHS_GPJ_MACROS)
+ endif()
-if(CMAKE_HOST_UNIX)
- set(GHS_OS_ROOT "/usr/ghs" CACHE PATH "GHS platform OS search root directory")
-else()
- set(GHS_OS_ROOT "C:/ghs" CACHE PATH "GHS platform OS search root directory")
endif()
-mark_as_advanced(GHS_OS_ROOT)
-set(GHS_OS_DIR "NOTFOUND" CACHE PATH "GHS platform OS directory")
-mark_as_advanced(GHS_OS_DIR)
+# If project primaryTarget not set then set target platform name.
+# -- May be used by the generator when determining the primaryTarget.
+if(NOT GHS_PRIMARY_TARGET)
+ if((NOT DEFINED GHS_TARGET_PLATFORM) OR (DEFINED CACHE{GHS_TARGET_PLATFORM}))
+ set(GHS_TARGET_PLATFORM "integrity" CACHE STRING "GHS MULTI target platform")
+ mark_as_advanced(GHS_TARGET_PLATFORM)
+ endif()
+endif()
-set(GHS_OS_DIR_OPTION "-os_dir " CACHE STRING "GHS compiler OS option")
-mark_as_advanced(GHS_OS_DIR_OPTION)
+# Settings for OS selection
+if((NOT DEFINED GHS_OS_ROOT) OR (DEFINED CACHE{GHS_OS_ROOT}))
+ if(CMAKE_HOST_UNIX)
+ set(_os_root "/usr/ghs")
+ else()
+ set(_os_root "C:/ghs")
+ endif()
+ set(GHS_OS_ROOT "${_os_root}" CACHE PATH "GHS platform OS search root directory")
+ unset(_os_root)
+ mark_as_advanced(GHS_OS_ROOT)
+endif()
-#set GHS_OS_DIR if not set by user
-if(NOT GHS_OS_DIR)
+# Search for GHS_OS_DIR if not set by user and is known to be required
+if(GHS_PRIMARY_TARGET MATCHES "integrity" OR GHS_TARGET_PLATFORM MATCHES "integrity")
+ # Needed - Use a value that will make it apparent RTOS selection failed
+ set(_ghs_os_dir "GHS_OS_DIR-NOT-SPECIFIED")
+else()
+ # Not needed for this target
+ set(_ghs_os_dir "IGNORE")
+endif()
+
+if(_ghs_os_dir AND NOT DEFINED GHS_OS_DIR)
if(EXISTS ${GHS_OS_ROOT})
- #get all directories in root directory
+ # Get all directories in root directory
FILE(GLOB GHS_CANDIDATE_OS_DIRS
LIST_DIRECTORIES true RELATIVE ${GHS_OS_ROOT} ${GHS_OS_ROOT}/*)
FILE(GLOB GHS_CANDIDATE_OS_FILES
@@ -29,28 +80,50 @@ if(NOT GHS_OS_DIR)
list(REMOVE_ITEM GHS_CANDIDATE_OS_DIRS ${GHS_CANDIDATE_OS_FILES})
endif ()
- #filter based on platform name
- if(GHS_TARGET_PLATFORM MATCHES "integrity")
+ # Filter based on platform name
+ if(GHS_PRIMARY_TARGET MATCHES "integrity" OR GHS_TARGET_PLATFORM MATCHES "integrity")
list(FILTER GHS_CANDIDATE_OS_DIRS INCLUDE REGEX "int[0-9][0-9][0-9][0-9a-z]")
- else() #fall-back for standalone
- unset(GHS_CANDIDATE_OS_DIRS)
- set(GHS_OS_DIR "IGNORE")
endif()
+ # Select latest? of matching candidates
if(GHS_CANDIDATE_OS_DIRS)
list(SORT GHS_CANDIDATE_OS_DIRS)
list(GET GHS_CANDIDATE_OS_DIRS -1 GHS_OS_DIR)
- string(CONCAT GHS_OS_DIR ${GHS_OS_ROOT} "/" ${GHS_OS_DIR})
+ string(CONCAT _ghs_os_dir ${GHS_OS_ROOT} "/" ${GHS_OS_DIR})
endif()
-
- #update cache with new value
- set(GHS_OS_DIR "${GHS_OS_DIR}" CACHE PATH "GHS platform OS directory" FORCE)
endif()
endif()
-set(GHS_BSP_NAME "IGNORE" CACHE STRING "BSP name")
+#Used for targets requiring RTOS
+if((NOT DEFINED GHS_OS_DIR) OR (DEFINED CACHE{GHS_OS_DIR}))
+ set(GHS_OS_DIR "${_ghs_os_dir}" CACHE PATH "GHS platform OS directory")
+ mark_as_advanced(GHS_OS_DIR)
+endif()
+unset(_ghs_os_dir)
+
+if((NOT DEFINED GHS_OS_DIR_OPTION) OR (DEFINED CACHE{GHS_OS_DIR_OPTION}))
+ set(GHS_OS_DIR_OPTION "-os_dir " CACHE STRING "GHS compiler OS option")
+ mark_as_advanced(GHS_OS_DIR_OPTION)
+endif()
+
+# Select GHS_BSP_NAME if not set by user and is known to be required
+if(GHS_PRIMARY_TARGET MATCHES "integrity" OR GHS_TARGET_PLATFORM MATCHES "integrity")
+ set(_ghs_bsp_name "GHS_BSP_NAME-NOT-SPECIFIED")
+else()
+ set(_ghs_bsp_name "IGNORE")
+endif()
-set(GHS_CUSTOMIZATION "" CACHE FILEPATH "optional GHS customization")
-mark_as_advanced(GHS_CUSTOMIZATION)
-set(GHS_GPJ_MACROS "" CACHE STRING "optional GHS macros generated in the .gpjs for legacy reasons")
-mark_as_advanced(GHS_GPJ_MACROS)
+if(_ghs_bsp_name AND NOT DEFINED GHS_BSP_NAME)
+ # First try taking architecture from `-A` option
+ if(CMAKE_GENERATOR_PLATFORM)
+ set(_ghs_bsp_name "sim${CMAKE_GENERATOR_PLATFORM}")
+ else()
+ set(_ghs_bsp_name "simarm")
+ endif()
+endif()
+
+if((NOT DEFINED GHS_BSP_NAME) OR (DEFINED CACHE{GHS_BSP_NAME}))
+ set(GHS_BSP_NAME "${_ghs_bsp_name}" CACHE STRING "BSP name")
+ mark_as_advanced(GHS_BSP_NAME)
+endif()
+unset(_ghs_bsp_name)
diff --git a/Modules/Platform/Generic-ELF.cmake b/Modules/Platform/Generic-ELF.cmake
new file mode 100644
index 0000000000..943cb6b03a
--- /dev/null
+++ b/Modules/Platform/Generic-ELF.cmake
@@ -0,0 +1,7 @@
+# This is a platform definition file for platforms without
+# an operating system using the ELF executable format.
+# It is used when CMAKE_SYSTEM_NAME is set to "Generic-ELF"
+
+include(Platform/Generic)
+
+set(CMAKE_EXECUTABLE_SUFFIX .elf)
diff --git a/Modules/Platform/Linux-LCC-C.cmake b/Modules/Platform/Linux-LCC-C.cmake
new file mode 100644
index 0000000000..b204c55048
--- /dev/null
+++ b/Modules/Platform/Linux-LCC-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/Linux-LCC)
+__linux_compiler_lcc(C)
diff --git a/Modules/Platform/Linux-LCC-CXX.cmake b/Modules/Platform/Linux-LCC-CXX.cmake
new file mode 100644
index 0000000000..cf2fa3547e
--- /dev/null
+++ b/Modules/Platform/Linux-LCC-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/Linux-LCC)
+__linux_compiler_lcc(CXX)
diff --git a/Modules/Platform/Linux-LCC-Fortran.cmake b/Modules/Platform/Linux-LCC-Fortran.cmake
new file mode 100644
index 0000000000..d3a4cf47a5
--- /dev/null
+++ b/Modules/Platform/Linux-LCC-Fortran.cmake
@@ -0,0 +1,3 @@
+include(Platform/Linux-LCC)
+__linux_compiler_lcc(Fortran)
+set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-llfortran")
diff --git a/Modules/Platform/Linux-LCC.cmake b/Modules/Platform/Linux-LCC.cmake
new file mode 100644
index 0000000000..a37546157e
--- /dev/null
+++ b/Modules/Platform/Linux-LCC.cmake
@@ -0,0 +1,15 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+
+# This module is shared by multiple languages; use include blocker.
+if(__LINUX_COMPILER_LCC)
+ return()
+endif()
+set(__LINUX_COMPILER_LCC 1)
+
+macro(__linux_compiler_lcc 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")
+endmacro()
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake
index 1c32018f37..c4d6fd8fcc 100644
--- a/Modules/Platform/Windows-Clang.cmake
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -56,7 +56,12 @@ macro(__windows_compiler_clang_gnu lang)
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES 1)
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1)
- set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto")
+ if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 3.9)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto=thin")
+ else()
+ set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto")
+ endif()
+
set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)
set(CMAKE_${lang}_ARCHIVE_CREATE_IPO "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
index b83932eddc..6c1699b3cf 100644
--- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake
+++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
@@ -1,11 +1,7 @@
include(Platform/Windows-MSVC)
-set(CMAKE_CUDA_COMPILE_PTX_COMPILATION
- "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -ptx <SOURCE> -o <OBJECT> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
-set(CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION
- "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -dc <SOURCE> -o <OBJECT> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
-set(CMAKE_CUDA_COMPILE_WHOLE_COMPILATION
- "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -c <SOURCE> -o <OBJECT> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
+set(CMAKE_CUDA_COMPILE_OBJECT
+ "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} <CUDA_COMPILE_MODE> <SOURCE> -o <OBJECT> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
set(__IMPLICIT_LINKS)
foreach(dir ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES})
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index c8498a991f..677fd2fdd6 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -261,6 +261,8 @@ set(SRCS
cmFileLockResult.h
cmFilePathChecksum.cxx
cmFilePathChecksum.h
+ cmFileSet.cxx
+ cmFileSet.h
cmFileTime.cxx
cmFileTime.h
cmFileTimeCache.cxx
@@ -316,6 +318,8 @@ set(SRCS
cmInstallExportGenerator.cxx
cmInstalledFile.h
cmInstalledFile.cxx
+ cmInstallFileSetGenerator.h
+ cmInstallFileSetGenerator.cxx
cmInstallFilesGenerator.h
cmInstallFilesGenerator.cxx
cmInstallImportedRuntimeArtifactsGenerator.h
@@ -1105,7 +1109,6 @@ if(APPLE)
set(CPACK_SRCS ${CPACK_SRCS}
CPack/cmCPackBundleGenerator.cxx
CPack/cmCPackDragNDropGenerator.cxx
- CPack/cmCPackOSXX11Generator.cxx
CPack/cmCPackPKGGenerator.cxx
CPack/cmCPackPackageMakerGenerator.cxx
CPack/cmCPackProductBuildGenerator.cxx
@@ -1142,13 +1145,6 @@ if(CPACK_ENABLE_FREEBSD_PKG AND FREEBSD_PKG_INCLUDE_DIRS AND FREEBSD_PKG_LIBRARI
add_definitions(-DHAVE_FREEBSD_PKG)
endif()
-if(APPLE)
- add_executable(OSXScriptLauncher
- CPack/OSXScriptLauncher.cxx)
- target_link_libraries(OSXScriptLauncher cmsys)
- target_link_libraries(OSXScriptLauncher "-framework CoreFoundation")
-endif()
-
# Build CMake executable
add_executable(cmake cmakemain.cxx cmcmd.cxx cmcmd.h ${MANIFEST_FILE})
list(APPEND _tools cmake)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 3d999e7ca1..bcc198b26f 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 22)
-set(CMake_VERSION_PATCH 0)
+set(CMake_VERSION_PATCH 20211207)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CPack/IFW/cmCPackIFWCommon.cxx b/Source/CPack/IFW/cmCPackIFWCommon.cxx
index f6b8a8a537..5d995c335d 100644
--- a/Source/CPack/IFW/cmCPackIFWCommon.cxx
+++ b/Source/CPack/IFW/cmCPackIFWCommon.cxx
@@ -29,19 +29,18 @@ cmValue cmCPackIFWCommon::GetOption(const std::string& op) const
bool cmCPackIFWCommon::IsOn(const std::string& op) const
{
- return this->Generator ? this->Generator->cmCPackGenerator::IsOn(op) : false;
+ return this->Generator && this->Generator->cmCPackGenerator::IsOn(op);
}
bool cmCPackIFWCommon::IsSetToOff(const std::string& op) const
{
- return this->Generator ? this->Generator->cmCPackGenerator::IsSetToOff(op)
- : false;
+ return this->Generator && this->Generator->cmCPackGenerator::IsSetToOff(op);
}
bool cmCPackIFWCommon::IsSetToEmpty(const std::string& op) const
{
- return this->Generator ? this->Generator->cmCPackGenerator::IsSetToEmpty(op)
- : false;
+ return this->Generator &&
+ this->Generator->cmCPackGenerator::IsSetToEmpty(op);
}
bool cmCPackIFWCommon::IsVersionLess(const char* version) const
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index b375ba605e..9ca7a69e57 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -38,202 +38,266 @@ int cmCPackIFWGenerator::PackageFiles()
std::string ifwTLD = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
std::string ifwTmpFile = cmStrCat(ifwTLD, "/IFWOutput.log");
- // Run repogen
- if (!this->Installer.RemoteRepositories.empty()) {
- std::vector<std::string> ifwCmd;
- std::string ifwArg;
+ // Create repositories
+ if (!this->RunRepogen(ifwTmpFile)) {
+ return 0;
+ }
+
+ // Create installer
+ if (!this->RunBinaryCreator(ifwTmpFile)) {
+ return 0;
+ }
+
+ return 1;
+}
+
+std::vector<std::string> cmCPackIFWGenerator::BuildRepogenCommand()
+{
+ std::vector<std::string> ifwCmd;
+ std::string ifwArg;
- ifwCmd.emplace_back(this->RepoGen);
+ ifwCmd.emplace_back(this->RepoGen);
- if (this->IsVersionLess("2.0.0")) {
- ifwCmd.emplace_back("-c");
- ifwCmd.emplace_back(this->toplevel + "/config/config.xml");
+ if (!this->IsVersionLess("4.2")) {
+ if (!this->ArchiveFormat.empty()) {
+ ifwCmd.emplace_back("--archive-format");
+ ifwCmd.emplace_back(this->ArchiveFormat);
+ }
+ if (!this->ArchiveCompression.empty()) {
+ ifwCmd.emplace_back("--compression");
+ ifwCmd.emplace_back(this->ArchiveCompression);
}
+ }
- ifwCmd.emplace_back("-p");
- ifwCmd.emplace_back(this->toplevel + "/packages");
+ if (this->IsVersionLess("2.0.0")) {
+ ifwCmd.emplace_back("-c");
+ ifwCmd.emplace_back(this->toplevel + "/config/config.xml");
+ }
- if (!this->PkgsDirsVector.empty()) {
- for (std::string const& it : this->PkgsDirsVector) {
- ifwCmd.emplace_back("-p");
- ifwCmd.emplace_back(it);
- }
+ ifwCmd.emplace_back("-p");
+ ifwCmd.emplace_back(this->toplevel + "/packages");
+
+ if (!this->PkgsDirsVector.empty()) {
+ for (std::string const& it : this->PkgsDirsVector) {
+ ifwCmd.emplace_back("-p");
+ ifwCmd.emplace_back(it);
}
+ }
- if (!this->RepoDirsVector.empty()) {
- if (!this->IsVersionLess("3.1")) {
- for (std::string const& rd : this->RepoDirsVector) {
- ifwCmd.emplace_back("--repository");
- ifwCmd.emplace_back(rd);
- }
- } else {
- cmCPackIFWLogger(WARNING,
- "The \"CPACK_IFW_REPOSITORIES_DIRECTORIES\" "
- << "variable is set, but content will be skipped, "
- << "because this feature available only since "
- << "QtIFW 3.1. Please update your QtIFW instance."
- << std::endl);
+ if (!this->RepoDirsVector.empty()) {
+ if (!this->IsVersionLess("3.1")) {
+ for (std::string const& rd : this->RepoDirsVector) {
+ ifwCmd.emplace_back("--repository");
+ ifwCmd.emplace_back(rd);
}
+ } else {
+ cmCPackIFWLogger(WARNING,
+ "The \"CPACK_IFW_REPOSITORIES_DIRECTORIES\" "
+ << "variable is set, but content will be skipped, "
+ << "because this feature available only since "
+ << "QtIFW 3.1. Please update your QtIFW instance."
+ << std::endl);
}
+ }
- if (!this->OnlineOnly && !this->DownloadedPackages.empty()) {
- ifwCmd.emplace_back("-i");
- auto it = this->DownloadedPackages.begin();
- ifwArg = (*it)->Name;
+ if (!this->OnlineOnly && !this->DownloadedPackages.empty()) {
+ ifwCmd.emplace_back("-i");
+ auto it = this->DownloadedPackages.begin();
+ ifwArg = (*it)->Name;
+ ++it;
+ while (it != this->DownloadedPackages.end()) {
+ ifwArg += "," + (*it)->Name;
++it;
- while (it != this->DownloadedPackages.end()) {
- ifwArg += "," + (*it)->Name;
- ++it;
- }
- ifwCmd.emplace_back(ifwArg);
- }
- ifwCmd.emplace_back(this->toplevel + "/repository");
- cmCPackIFWLogger(VERBOSE,
- "Execute: " << cmSystemTools::PrintSingleCommand(ifwCmd)
- << std::endl);
- std::string output;
- int retVal = 1;
- cmCPackIFWLogger(OUTPUT, "- Generate repository" << std::endl);
- bool res = cmSystemTools::RunSingleCommand(
- ifwCmd, &output, &output, &retVal, nullptr, this->GeneratorVerbose,
- cmDuration::zero());
- if (!res || retVal) {
- cmGeneratedFileStream ofs(ifwTmpFile);
- ofs << "# Run command: " << cmSystemTools::PrintSingleCommand(ifwCmd)
- << std::endl
- << "# Output:" << std::endl
- << output << std::endl;
- cmCPackIFWLogger(
- ERROR,
- "Problem running IFW command: "
- << cmSystemTools::PrintSingleCommand(ifwCmd) << std::endl
- << "Please check \"" << ifwTmpFile << "\" for errors" << std::endl);
- return 0;
}
+ ifwCmd.emplace_back(ifwArg);
+ }
+ ifwCmd.emplace_back(this->toplevel + "/repository");
- if (!this->Repository.RepositoryUpdate.empty() &&
- !this->Repository.PatchUpdatesXml()) {
- cmCPackIFWLogger(WARNING,
- "Problem patch IFW \"Updates\" "
- << "file: \"" << this->toplevel
- << "/repository/Updates.xml\"" << std::endl);
- }
+ return ifwCmd;
+}
- cmCPackIFWLogger(OUTPUT,
- "- repository: \"" << this->toplevel
- << "/repository\" generated"
- << std::endl);
+int cmCPackIFWGenerator::RunRepogen(const std::string& ifwTmpFile)
+{
+ if (this->Installer.RemoteRepositories.empty()) {
+ return 1;
+ }
+
+ std::vector<std::string> ifwCmd = this->BuildRepogenCommand();
+ cmCPackIFWLogger(VERBOSE,
+ "Execute: " << cmSystemTools::PrintSingleCommand(ifwCmd)
+ << std::endl);
+ std::string output;
+ int retVal = 1;
+ cmCPackIFWLogger(OUTPUT, "- Generate repository" << std::endl);
+ bool res = cmSystemTools::RunSingleCommand(ifwCmd, &output, &output, &retVal,
+ nullptr, this->GeneratorVerbose,
+ cmDuration::zero());
+ if (!res || retVal) {
+ cmGeneratedFileStream ofs(ifwTmpFile);
+ ofs << "# Run command: " << cmSystemTools::PrintSingleCommand(ifwCmd)
+ << std::endl
+ << "# Output:" << std::endl
+ << output << std::endl;
+ cmCPackIFWLogger(
+ ERROR,
+ "Problem running IFW command: "
+ << cmSystemTools::PrintSingleCommand(ifwCmd) << std::endl
+ << "Please check \"" << ifwTmpFile << "\" for errors" << std::endl);
+ return 0;
}
- // Run binary creator
- {
- std::vector<std::string> ifwCmd;
- std::string ifwArg;
+ if (!this->Repository.RepositoryUpdate.empty() &&
+ !this->Repository.PatchUpdatesXml()) {
+ cmCPackIFWLogger(WARNING,
+ "Problem patch IFW \"Updates\" "
+ << "file: \"" << this->toplevel
+ << "/repository/Updates.xml\"" << std::endl);
+ }
- ifwCmd.emplace_back(this->BinCreator);
+ cmCPackIFWLogger(OUTPUT,
+ "- repository: \"" << this->toplevel
+ << "/repository\" generated"
+ << std::endl);
+ return 1;
+}
- ifwCmd.emplace_back("-c");
- ifwCmd.emplace_back(this->toplevel + "/config/config.xml");
+std::vector<std::string> cmCPackIFWGenerator::BuildBinaryCreatorCommmand()
+{
+ std::vector<std::string> ifwCmd;
+ std::string ifwArg;
+
+ ifwCmd.emplace_back(this->BinCreator);
+
+ if (!this->IsVersionLess("4.2")) {
+ if (!this->ArchiveFormat.empty()) {
+ ifwCmd.emplace_back("--archive-format");
+ ifwCmd.emplace_back(this->ArchiveFormat);
+ }
+ if (!this->ArchiveCompression.empty()) {
+ ifwCmd.emplace_back("--compression");
+ ifwCmd.emplace_back(this->ArchiveCompression);
+ }
+ }
+
+ if (!this->IsVersionLess("3.0")) {
+#ifdef __APPLE__
+ // macOS only
+ std::string signingIdentity = this->Installer.SigningIdentity;
+ if (!signingIdentity.empty()) {
+ ifwCmd.emplace_back("--sign");
+ ifwCmd.emplace_back(signingIdentity);
+ }
+#endif
+ }
- if (!this->Installer.Resources.empty()) {
- ifwCmd.emplace_back("-r");
- auto it = this->Installer.Resources.begin();
- std::string path = this->toplevel + "/resources/";
- ifwArg = path + *it;
+ ifwCmd.emplace_back("-c");
+ ifwCmd.emplace_back(this->toplevel + "/config/config.xml");
+
+ if (!this->Installer.Resources.empty()) {
+ ifwCmd.emplace_back("-r");
+ auto it = this->Installer.Resources.begin();
+ std::string path = this->toplevel + "/resources/";
+ ifwArg = path + *it;
+ ++it;
+ while (it != this->Installer.Resources.end()) {
+ ifwArg += "," + path + *it;
++it;
- while (it != this->Installer.Resources.end()) {
- ifwArg += "," + path + *it;
- ++it;
- }
- ifwCmd.emplace_back(ifwArg);
}
+ ifwCmd.emplace_back(ifwArg);
+ }
- ifwCmd.emplace_back("-p");
- ifwCmd.emplace_back(this->toplevel + "/packages");
+ ifwCmd.emplace_back("-p");
+ ifwCmd.emplace_back(this->toplevel + "/packages");
- if (!this->PkgsDirsVector.empty()) {
- for (std::string const& it : this->PkgsDirsVector) {
- ifwCmd.emplace_back("-p");
- ifwCmd.emplace_back(it);
- }
+ if (!this->PkgsDirsVector.empty()) {
+ for (std::string const& it : this->PkgsDirsVector) {
+ ifwCmd.emplace_back("-p");
+ ifwCmd.emplace_back(it);
}
+ }
- if (!this->RepoDirsVector.empty()) {
- if (!this->IsVersionLess("3.1")) {
- for (std::string const& rd : this->RepoDirsVector) {
- ifwCmd.emplace_back("--repository");
- ifwCmd.emplace_back(rd);
- }
- } else {
- cmCPackIFWLogger(WARNING,
- "The \"CPACK_IFW_REPOSITORIES_DIRECTORIES\" "
- << "variable is set, but content will be skipped, "
- << "because this feature available only since "
- << "QtIFW 3.1. Please update your QtIFW instance."
- << std::endl);
+ if (!this->RepoDirsVector.empty()) {
+ if (!this->IsVersionLess("3.1")) {
+ for (std::string const& rd : this->RepoDirsVector) {
+ ifwCmd.emplace_back("--repository");
+ ifwCmd.emplace_back(rd);
}
+ } else {
+ cmCPackIFWLogger(WARNING,
+ "The \"CPACK_IFW_REPOSITORIES_DIRECTORIES\" "
+ << "variable is set, but content will be skipped, "
+ << "because this feature available only since "
+ << "QtIFW 3.1. Please update your QtIFW instance."
+ << std::endl);
}
+ }
- if (this->OnlineOnly) {
- ifwCmd.emplace_back("--online-only");
- } else if (!this->DownloadedPackages.empty() &&
- !this->Installer.RemoteRepositories.empty()) {
- ifwCmd.emplace_back("-e");
- auto it = this->DownloadedPackages.begin();
- ifwArg = (*it)->Name;
+ if (this->OnlineOnly) {
+ ifwCmd.emplace_back("--online-only");
+ } else if (!this->DownloadedPackages.empty() &&
+ !this->Installer.RemoteRepositories.empty()) {
+ ifwCmd.emplace_back("-e");
+ auto it = this->DownloadedPackages.begin();
+ ifwArg = (*it)->Name;
+ ++it;
+ while (it != this->DownloadedPackages.end()) {
+ ifwArg += "," + (*it)->Name;
++it;
- while (it != this->DownloadedPackages.end()) {
- ifwArg += "," + (*it)->Name;
- ++it;
- }
- ifwCmd.emplace_back(ifwArg);
- } else if (!this->DependentPackages.empty()) {
- ifwCmd.emplace_back("-i");
- ifwArg.clear();
- // Binary
- auto bit = this->BinaryPackages.begin();
- while (bit != this->BinaryPackages.end()) {
- ifwArg += (*bit)->Name + ",";
- ++bit;
- }
- // Depend
- auto it = this->DependentPackages.begin();
- ifwArg += it->second.Name;
- ++it;
- while (it != this->DependentPackages.end()) {
- ifwArg += "," + it->second.Name;
- ++it;
- }
- ifwCmd.emplace_back(ifwArg);
}
- // TODO: set correct name for multipackages
- if (!this->packageFileNames.empty()) {
- ifwCmd.emplace_back(this->packageFileNames[0]);
- } else {
- ifwCmd.emplace_back("installer" + this->OutputExtension);
+ ifwCmd.emplace_back(ifwArg);
+ } else if (!this->DependentPackages.empty()) {
+ ifwCmd.emplace_back("-i");
+ ifwArg.clear();
+ // Binary
+ auto bit = this->BinaryPackages.begin();
+ while (bit != this->BinaryPackages.end()) {
+ ifwArg += (*bit)->Name + ",";
+ ++bit;
}
- cmCPackIFWLogger(VERBOSE,
- "Execute: " << cmSystemTools::PrintSingleCommand(ifwCmd)
- << std::endl);
- std::string output;
- int retVal = 1;
- cmCPackIFWLogger(OUTPUT, "- Generate package" << std::endl);
- bool res = cmSystemTools::RunSingleCommand(
- ifwCmd, &output, &output, &retVal, nullptr, this->GeneratorVerbose,
- cmDuration::zero());
- if (!res || retVal) {
- cmGeneratedFileStream ofs(ifwTmpFile);
- ofs << "# Run command: " << cmSystemTools::PrintSingleCommand(ifwCmd)
- << std::endl
- << "# Output:" << std::endl
- << output << std::endl;
- cmCPackIFWLogger(
- ERROR,
- "Problem running IFW command: "
- << cmSystemTools::PrintSingleCommand(ifwCmd) << std::endl
- << "Please check \"" << ifwTmpFile << "\" for errors" << std::endl);
- return 0;
+ // Depend
+ auto it = this->DependentPackages.begin();
+ ifwArg += it->second.Name;
+ ++it;
+ while (it != this->DependentPackages.end()) {
+ ifwArg += "," + it->second.Name;
+ ++it;
}
+ ifwCmd.emplace_back(ifwArg);
+ }
+ // TODO: set correct name for multipackages
+ if (!this->packageFileNames.empty()) {
+ ifwCmd.emplace_back(this->packageFileNames[0]);
+ } else {
+ ifwCmd.emplace_back("installer" + this->OutputExtension);
+ }
+
+ return ifwCmd;
+}
+
+int cmCPackIFWGenerator::RunBinaryCreator(const std::string& ifwTmpFile)
+{
+ std::vector<std::string> ifwCmd = this->BuildBinaryCreatorCommmand();
+ cmCPackIFWLogger(VERBOSE,
+ "Execute: " << cmSystemTools::PrintSingleCommand(ifwCmd)
+ << std::endl);
+ std::string output;
+ int retVal = 1;
+ cmCPackIFWLogger(OUTPUT, "- Generate package" << std::endl);
+ bool res = cmSystemTools::RunSingleCommand(ifwCmd, &output, &output, &retVal,
+ nullptr, this->GeneratorVerbose,
+ cmDuration::zero());
+ if (!res || retVal) {
+ cmGeneratedFileStream ofs(ifwTmpFile);
+ ofs << "# Run command: " << cmSystemTools::PrintSingleCommand(ifwCmd)
+ << std::endl
+ << "# Output:" << std::endl
+ << output << std::endl;
+ cmCPackIFWLogger(
+ ERROR,
+ "Problem running IFW command: "
+ << cmSystemTools::PrintSingleCommand(ifwCmd) << std::endl
+ << "Please check \"" << ifwTmpFile << "\" for errors" << std::endl);
+ return 0;
}
return 1;
@@ -323,6 +387,14 @@ int cmCPackIFWGenerator::InitializeInternal()
cmExpandList(dirs, this->RepoDirsVector);
}
+ // Archive format and compression level
+ if (cmValue af = this->GetOption("CPACK_IFW_ARCHIVE_FORMAT")) {
+ this->ArchiveFormat = *af;
+ }
+ if (cmValue ac = this->GetOption("CPACK_IFW_ARCHIVE_COMPRESSION")) {
+ this->ArchiveCompression = *ac;
+ }
+
// Installer
this->Installer.Generator = this;
this->Installer.ConfigureFromOptions();
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h
index 024d25d62c..86b4993352 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.h
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.h
@@ -9,13 +9,15 @@
#include <string>
#include <vector>
-#include "cmCPackComponentGroup.h"
#include "cmCPackGenerator.h"
#include "cmCPackIFWCommon.h"
#include "cmCPackIFWInstaller.h"
#include "cmCPackIFWPackage.h"
#include "cmCPackIFWRepository.h"
+class cmCPackComponent;
+class cmCPackComponentGroup;
+
/** \class cmCPackIFWGenerator
* \brief A generator for Qt Installer Framework tools
*
@@ -30,8 +32,6 @@ public:
using PackagesMap = std::map<std::string, cmCPackIFWPackage>;
using RepositoriesMap = std::map<std::string, cmCPackIFWRepository>;
- using ComponentsMap = std::map<std::string, cmCPackComponent>;
- using ComponentGoupsMap = std::map<std::string, cmCPackComponentGroup>;
using DependenceMap =
std::map<std::string, cmCPackIFWPackage::DependenceStruct>;
@@ -140,14 +140,22 @@ protected:
std::map<cmCPackComponentGroup*, cmCPackIFWPackage*> GroupPackages;
private:
+ std::vector<std::string> BuildRepogenCommand();
+ int RunRepogen(const std::string& ifwTmpFile);
+
+ std::vector<std::string> BuildBinaryCreatorCommmand();
+ int RunBinaryCreator(const std::string& ifwTmpFile);
+
std::string RepoGen;
std::string BinCreator;
std::string FrameworkVersion;
std::string ExecutableSuffix;
std::string OutputExtension;
+ std::string ArchiveFormat;
+ std::string ArchiveCompression;
- bool OnlineOnly;
- bool ResolveDuplicateNames;
+ bool OnlineOnly{};
+ bool ResolveDuplicateNames{};
std::vector<std::string> PkgsDirsVector;
std::vector<std::string> RepoDirsVector;
};
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index 7ee6300b80..6fc48480ef 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -254,6 +254,16 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
}
}
+ // DisableCommandLineInterface
+ if (this->GetOption("CPACK_IFW_PACKAGE_DISABLE_COMMAND_LINE_INTERFACE")) {
+ if (this->IsOn("CPACK_IFW_PACKAGE_DISABLE_COMMAND_LINE_INTERFACE")) {
+ this->DisableCommandLineInterface = "true";
+ } else if (this->IsSetToOff(
+ "CPACK_IFW_PACKAGE_DISABLE_COMMAND_LINE_INTERFACE")) {
+ this->DisableCommandLineInterface = "false";
+ }
+ }
+
// Space in path
if (this->GetOption("CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH")) {
if (this->IsOn("CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH")) {
@@ -275,6 +285,34 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
this->Resources.clear();
cmExpandList(optIFW_PACKAGE_RESOURCES, this->Resources);
}
+
+ // ProductImages
+ if (cmValue productImages =
+ this->GetOption("CPACK_IFW_PACKAGE_PRODUCT_IMAGES")) {
+ this->ProductImages.clear();
+ cmExpandList(productImages, this->ProductImages);
+ }
+
+ // Run program, run program arguments, and run program description
+ if (cmValue program = this->GetOption("CPACK_IFW_PACKAGE_RUN_PROGRAM")) {
+ this->RunProgram = *program;
+ }
+ if (cmValue arguments =
+ this->GetOption("CPACK_IFW_PACKAGE_RUN_PROGRAM_ARGUMENTS")) {
+ this->RunProgramArguments.clear();
+ cmExpandList(arguments, this->RunProgramArguments);
+ }
+ if (cmValue description =
+ this->GetOption("CPACK_IFW_PACKAGE_RUN_PROGRAM_DESCRIPTION")) {
+ this->RunProgramDescription = *description;
+ }
+
+#ifdef __APPLE__
+ // Code signing identity for signing the generated app bundle
+ if (cmValue id = this->GetOption("CPACK_IFW_PACKAGE_SIGNING_IDENTITY")) {
+ this->SigningIdentity = *id;
+ }
+#endif
}
/** \class cmCPackIFWResourcesParser
@@ -362,29 +400,11 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
xout.Element("ProductUrl", this->ProductUrl);
}
- // ApplicationIcon
- if (!this->InstallerApplicationIcon.empty()) {
- std::string name =
- cmSystemTools::GetFilenameName(this->InstallerApplicationIcon);
- std::string path = this->Directory + "/config/" + name;
- name = cmSystemTools::GetFilenameWithoutExtension(name);
- cmsys::SystemTools::CopyFileIfDifferent(this->InstallerApplicationIcon,
- path);
- xout.Element("InstallerApplicationIcon", name);
- }
-
- // WindowIcon
- if (!this->InstallerWindowIcon.empty()) {
- std::string name =
- cmSystemTools::GetFilenameName(this->InstallerWindowIcon);
- std::string path = this->Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(this->InstallerWindowIcon, path);
- xout.Element("InstallerWindowIcon", name);
- }
-
// Logo
if (!this->Logo.empty()) {
- std::string name = cmSystemTools::GetFilenameName(this->Logo);
+ std::string srcName = cmSystemTools::GetFilenameName(this->Logo);
+ std::string suffix = cmSystemTools::GetFilenameLastExtension(srcName);
+ std::string name = "cm_logo." + suffix;
std::string path = this->Directory + "/config/" + name;
cmsys::SystemTools::CopyFileIfDifferent(this->Logo, path);
xout.Element("Logo", name);
@@ -414,42 +434,81 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
xout.Element("Background", name);
}
- // WizardStyle
- if (!this->WizardStyle.empty()) {
- xout.Element("WizardStyle", this->WizardStyle);
- }
+ // Attributes introduced in QtIFW 1.4.0
+ if (!this->IsVersionLess("1.4")) {
+ // ApplicationIcon
+ if (!this->InstallerApplicationIcon.empty()) {
+ std::string srcName =
+ cmSystemTools::GetFilenameName(this->InstallerApplicationIcon);
+ std::string suffix = cmSystemTools::GetFilenameLastExtension(srcName);
+ std::string name = "cm_appicon." + suffix;
+ std::string path = this->Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(this->InstallerApplicationIcon,
+ path);
+ // The actual file is looked up by attaching a '.icns' (macOS),
+ // '.ico' (Windows). No functionality on Unix.
+ name = cmSystemTools::GetFilenameWithoutExtension(name);
+ xout.Element("InstallerApplicationIcon", name);
+ }
- // Stylesheet
- if (!this->StyleSheet.empty()) {
- std::string name = cmSystemTools::GetFilenameName(this->StyleSheet);
- std::string path = this->Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(this->StyleSheet, path);
- xout.Element("StyleSheet", name);
+ // WindowIcon
+ if (!this->InstallerWindowIcon.empty()) {
+ std::string srcName =
+ cmSystemTools::GetFilenameName(this->InstallerWindowIcon);
+ std::string suffix = cmSystemTools::GetFilenameLastExtension(srcName);
+ std::string name = "cm_winicon." + suffix;
+ std::string path = this->Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(this->InstallerWindowIcon, path);
+ xout.Element("InstallerWindowIcon", name);
+ }
}
- // WizardDefaultWidth
- if (!this->WizardDefaultWidth.empty()) {
- xout.Element("WizardDefaultWidth", this->WizardDefaultWidth);
- }
+ // Attributes introduced in QtIFW 2.0.0
+ if (!this->IsVersionLess("2.0")) {
+ // WizardDefaultWidth
+ if (!this->WizardDefaultWidth.empty()) {
+ xout.Element("WizardDefaultWidth", this->WizardDefaultWidth);
+ }
- // WizardDefaultHeight
- if (!this->WizardDefaultHeight.empty()) {
- xout.Element("WizardDefaultHeight", this->WizardDefaultHeight);
- }
+ // WizardDefaultHeight
+ if (!this->WizardDefaultHeight.empty()) {
+ xout.Element("WizardDefaultHeight", this->WizardDefaultHeight);
+ }
- // WizardShowPageList
- if (!this->IsVersionLess("4.0") && !this->WizardShowPageList.empty()) {
- xout.Element("WizardShowPageList", this->WizardShowPageList);
- }
+ // Start menu directory
+ if (!this->StartMenuDir.empty()) {
+ xout.Element("StartMenuDir", this->StartMenuDir);
+ }
- // TitleColor
- if (!this->TitleColor.empty()) {
- xout.Element("TitleColor", this->TitleColor);
- }
+ // Maintenance tool
+ if (!this->MaintenanceToolName.empty()) {
+ xout.Element("MaintenanceToolName", this->MaintenanceToolName);
+ }
- // Start menu
- if (!this->IsVersionLess("2.0")) {
- xout.Element("StartMenuDir", this->StartMenuDir);
+ // Maintenance tool ini file
+ if (!this->MaintenanceToolIniFile.empty()) {
+ xout.Element("MaintenanceToolIniFile", this->MaintenanceToolIniFile);
+ }
+
+ if (!this->AllowNonAsciiCharacters.empty()) {
+ xout.Element("AllowNonAsciiCharacters", this->AllowNonAsciiCharacters);
+ }
+ if (!this->AllowSpaceInPath.empty()) {
+ xout.Element("AllowSpaceInPath", this->AllowSpaceInPath);
+ }
+
+ // Control script (copy to config dir)
+ if (!this->ControlScript.empty()) {
+ std::string name = cmSystemTools::GetFilenameName(this->ControlScript);
+ std::string path = this->Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(this->ControlScript, path);
+ xout.Element("ControlScript", name);
+ }
+ } else {
+ // CPack IFW default policy
+ xout.Comment("CPack IFW default policy for QtIFW less 2.0");
+ xout.Element("AllowNonAsciiCharacters", "true");
+ xout.Element("AllowSpaceInPath", "true");
}
// Target dir
@@ -471,41 +530,74 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
xout.EndElement();
}
- // Maintenance tool
- if (!this->IsVersionLess("2.0") && !this->MaintenanceToolName.empty()) {
- xout.Element("MaintenanceToolName", this->MaintenanceToolName);
+ // Attributes introduced in QtIFW 3.0.0
+ if (!this->IsVersionLess("3.0")) {
+ // WizardStyle
+ if (!this->WizardStyle.empty()) {
+ xout.Element("WizardStyle", this->WizardStyle);
+ }
+
+ // Stylesheet (copy to config dir)
+ if (!this->StyleSheet.empty()) {
+ std::string name = cmSystemTools::GetFilenameName(this->StyleSheet);
+ std::string path = this->Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(this->StyleSheet, path);
+ xout.Element("StyleSheet", name);
+ }
+
+ // TitleColor
+ if (!this->TitleColor.empty()) {
+ xout.Element("TitleColor", this->TitleColor);
+ }
}
- // Maintenance tool ini file
- if (!this->IsVersionLess("2.0") && !this->MaintenanceToolIniFile.empty()) {
- xout.Element("MaintenanceToolIniFile", this->MaintenanceToolIniFile);
+ // Attributes introduced in QtIFW 4.0.0
+ if (!this->IsVersionLess("4.0")) {
+ // WizardShowPageList
+ if (!this->WizardShowPageList.empty()) {
+ xout.Element("WizardShowPageList", this->WizardShowPageList);
+ }
+
+ // DisableCommandLineInterface
+ if (!this->DisableCommandLineInterface.empty()) {
+ xout.Element("DisableCommandLineInterface",
+ this->DisableCommandLineInterface);
+ }
+
+ // RunProgram
+ if (!this->RunProgram.empty()) {
+ xout.Element("RunProgram", this->RunProgram);
+ }
+
+ // RunProgramArguments
+ if (!this->RunProgramArguments.empty()) {
+ xout.StartElement("RunProgramArguments");
+ for (const auto& arg : this->RunProgramArguments) {
+ xout.Element("Argument", arg);
+ }
+ xout.EndElement();
+ }
+
+ // RunProgramDescription
+ if (!this->RunProgramDescription.empty()) {
+ xout.Element("RunProgramDescription", this->RunProgramDescription);
+ }
}
if (!this->RemoveTargetDir.empty()) {
xout.Element("RemoveTargetDir", this->RemoveTargetDir);
}
- // Different allows
- if (this->IsVersionLess("2.0")) {
- // CPack IFW default policy
- xout.Comment("CPack IFW default policy for QtIFW less 2.0");
- xout.Element("AllowNonAsciiCharacters", "true");
- xout.Element("AllowSpaceInPath", "true");
- } else {
- if (!this->AllowNonAsciiCharacters.empty()) {
- xout.Element("AllowNonAsciiCharacters", this->AllowNonAsciiCharacters);
- }
- if (!this->AllowSpaceInPath.empty()) {
- xout.Element("AllowSpaceInPath", this->AllowSpaceInPath);
+ // Product images (copy to config dir)
+ if (!this->IsVersionLess("4.0") && !this->ProductImages.empty()) {
+ xout.StartElement("ProductImages");
+ for (auto const& srcImg : this->ProductImages) {
+ std::string name = cmSystemTools::GetFilenameName(srcImg);
+ std::string dstImg = this->Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(srcImg, dstImg);
+ xout.Element("Image", name);
}
- }
-
- // Control script (copy to config dir)
- if (!this->IsVersionLess("2.0") && !this->ControlScript.empty()) {
- std::string name = cmSystemTools::GetFilenameName(this->ControlScript);
- std::string path = this->Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(this->ControlScript, path);
- xout.Element("ControlScript", name);
+ xout.EndElement();
}
// Resources (copy to resources dir)
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h
index a031fc268b..205835b0f2 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.h
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.h
@@ -109,6 +109,9 @@ public:
/// uninstalling
std::string RemoveTargetDir;
+ /// Set to true if command line interface features should be disabled
+ std::string DisableCommandLineInterface;
+
/// Set to false if the installation path cannot contain space characters
std::string AllowSpaceInPath;
@@ -118,6 +121,25 @@ public:
/// List of resources to include in the installer binary
std::vector<std::string> Resources;
+ /// A list of images to be shown on PerformInstallationPage.
+ std::vector<std::string> ProductImages;
+
+ /// Command executed after the installer is done if the user accepts the
+ /// action
+ std::string RunProgram;
+
+ /// Arguments passed to the program specified in <RunProgram>
+ std::vector<std::string> RunProgramArguments;
+
+ /// Text shown next to the check box for running the program after the
+ /// installation
+ std::string RunProgramDescription;
+
+#ifdef __APPLE__
+ /// Code signing identity for signing the generated app bundle
+ std::string SigningIdentity;
+#endif
+
public:
// Internal implementation
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h
index 0cc6f2fdf8..350f6b286f 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.h
+++ b/Source/CPack/IFW/cmCPackIFWPackage.h
@@ -44,7 +44,7 @@ public:
struct DependenceStruct
{
DependenceStruct();
- DependenceStruct(const std::string& dependence);
+ explicit DependenceStruct(const std::string& dependence);
std::string Name;
CompareStruct Compare;
diff --git a/Source/CPack/OSXScriptLauncher.cxx b/Source/CPack/OSXScriptLauncher.cxx
deleted file mode 100644
index b7140abd7e..0000000000
--- a/Source/CPack/OSXScriptLauncher.cxx
+++ /dev/null
@@ -1,122 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include <cstddef>
-#include <iostream>
-#include <string>
-#include <vector>
-
-#include <cm/memory>
-
-#include <CoreFoundation/CoreFoundation.h>
-
-#include "cmsys/FStream.hxx"
-#include "cmsys/Process.h"
-#include "cmsys/SystemTools.hxx"
-
-// For the PATH_MAX constant
-#include <sys/syslimits.h>
-
-#define DebugError(x) \
- ofs << x << std::endl; \
- std::cout << x << std::endl
-
-int main(int argc, char* argv[])
-{
- // if ( cmsys::SystemTools::FileExists(
- cmsys::ofstream ofs("/tmp/output.txt");
-
- CFStringRef fileName;
- CFBundleRef appBundle;
- CFURLRef scriptFileURL;
-
- // get CF URL for script
- if (!(appBundle = CFBundleGetMainBundle())) {
- DebugError("Cannot get main bundle");
- return 1;
- }
- fileName = CFSTR("RuntimeScript");
- if (!(scriptFileURL =
- CFBundleCopyResourceURL(appBundle, fileName, nullptr, nullptr))) {
- DebugError("CFBundleCopyResourceURL failed");
- return 1;
- }
-
- // create path string
- auto path = cm::make_unique<UInt8[]>(PATH_MAX);
- if (!path) {
- return 1;
- }
-
- // get the file system path of the url as a cstring
- // in an encoding suitable for posix apis
- if (!CFURLGetFileSystemRepresentation(scriptFileURL, true, path.get(),
- PATH_MAX)) {
- DebugError("CFURLGetFileSystemRepresentation failed");
- return 1;
- }
-
- // dispose of the CF variable
- CFRelease(scriptFileURL);
-
- std::string fullScriptPath = reinterpret_cast<char*>(path.get());
- path.reset();
-
- if (!cmsys::SystemTools::FileExists(fullScriptPath)) {
- return 1;
- }
-
- std::string scriptDirectory =
- cmsys::SystemTools::GetFilenamePath(fullScriptPath);
- ofs << fullScriptPath << std::endl;
- std::vector<const char*> args;
- args.push_back(fullScriptPath.c_str());
- int cc;
- for (cc = 1; cc < argc; ++cc) {
- args.push_back(argv[cc]);
- }
- args.push_back(nullptr);
-
- cmsysProcess* cp = cmsysProcess_New();
- cmsysProcess_SetCommand(cp, args.data());
- cmsysProcess_SetWorkingDirectory(cp, scriptDirectory.c_str());
- cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1);
- cmsysProcess_SetTimeout(cp, 0);
- cmsysProcess_Execute(cp);
-
- char* data;
- int length;
- while (cmsysProcess_WaitForData(cp, &data, &length, nullptr)) {
- // Translate NULL characters in the output into valid text.
- for (int i = 0; i < length; ++i) {
- if (data[i] == '\0') {
- data[i] = ' ';
- }
- }
- std::cout.write(data, length);
- }
-
- cmsysProcess_WaitForExit(cp, nullptr);
-
- bool result = true;
- if (cmsysProcess_GetState(cp) == cmsysProcess_State_Exited) {
- if (cmsysProcess_GetExitValue(cp) != 0) {
- result = false;
- }
- } else if (cmsysProcess_GetState(cp) == cmsysProcess_State_Exception) {
- const char* exception_str = cmsysProcess_GetExceptionString(cp);
- std::cerr << exception_str << std::endl;
- result = false;
- } else if (cmsysProcess_GetState(cp) == cmsysProcess_State_Error) {
- const char* error_str = cmsysProcess_GetErrorString(cp);
- std::cerr << error_str << std::endl;
- result = false;
- } else if (cmsysProcess_GetState(cp) == cmsysProcess_State_Expired) {
- const char* error_str = "Process terminated due to timeout\n";
- std::cerr << error_str << std::endl;
- result = false;
- }
-
- cmsysProcess_Delete(cp);
-
- return !result;
-}
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index d03239b521..6a0095b708 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -219,7 +219,9 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
CollectExtensions("CPACK_WIX_EXTENSIONS", this->CandleExtensions);
CollectExtensions("CPACK_WIX_CANDLE_EXTENSIONS", this->CandleExtensions);
- this->LightExtensions.insert("WixUIExtension");
+ if (!cmIsOn(GetOption("CPACK_WIX_SKIP_WIX_UI_EXTENSION"))) {
+ this->LightExtensions.insert("WixUIExtension");
+ }
CollectExtensions("CPACK_WIX_EXTENSIONS", this->LightExtensions);
CollectExtensions("CPACK_WIX_LIGHT_EXTENSIONS", this->LightExtensions);
CollectXmlNamespaces("CPACK_WIX_CUSTOM_XMLNS", this->CustomXmlNamespaces);
diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h
index 58377d4127..6a47b6d157 100644
--- a/Source/CPack/cmCPackComponentGroup.h
+++ b/Source/CPack/cmCPackComponentGroup.h
@@ -35,12 +35,10 @@ class cmCPackComponent
{
public:
cmCPackComponent()
- : Group(nullptr)
- , IsRequired(true)
+ : IsRequired(true)
, IsHidden(false)
, IsDisabledByDefault(false)
, IsDownloaded(false)
- , TotalSize(0)
{
}
@@ -51,7 +49,7 @@ public:
std::string DisplayName;
/// The component group that contains this component (if any).
- cmCPackComponentGroup* Group;
+ cmCPackComponentGroup* Group = nullptr;
/// Whether this component group must always be installed.
bool IsRequired : 1;
@@ -103,7 +101,7 @@ public:
unsigned long GetInstalledSizeInKbytes(const std::string& installDir) const;
private:
- mutable unsigned long TotalSize;
+ mutable unsigned long TotalSize = 0;
};
/** \class cmCPackComponentGroup
@@ -113,7 +111,8 @@ class cmCPackComponentGroup
{
public:
cmCPackComponentGroup()
- : ParentGroup(nullptr)
+ : IsBold(false)
+ , IsExpandedByDefault(false)
{
}
@@ -136,7 +135,7 @@ public:
std::vector<cmCPackComponent*> Components;
/// The parent group of this component group (if any).
- cmCPackComponentGroup* ParentGroup;
+ cmCPackComponentGroup* ParentGroup = nullptr;
/// The subgroups of this group.
std::vector<cmCPackComponentGroup*> Subgroups;
diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx
index 484db00380..fabf4c566c 100644
--- a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx
+++ b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx
@@ -17,9 +17,7 @@ cmCPackCygwinBinaryGenerator::cmCPackCygwinBinaryGenerator()
{
}
-cmCPackCygwinBinaryGenerator::~cmCPackCygwinBinaryGenerator()
-{
-}
+cmCPackCygwinBinaryGenerator::~cmCPackCygwinBinaryGenerator() = default;
int cmCPackCygwinBinaryGenerator::InitializeInternal()
{
@@ -43,7 +41,7 @@ int cmCPackCygwinBinaryGenerator::PackageFiles()
// create an extra scope to force the stream
// to create the file before the super class is called
{
- cmGeneratedFileStream ofs(manifestFile.c_str());
+ cmGeneratedFileStream ofs(manifestFile);
for (std::string const& file : files) {
// remove the temp dir and replace with /usr
ofs << file.substr(tempdir.size()) << "\n";
diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.h b/Source/CPack/cmCPackCygwinBinaryGenerator.h
index f5f77005d2..ca8e0b5b08 100644
--- a/Source/CPack/cmCPackCygwinBinaryGenerator.h
+++ b/Source/CPack/cmCPackCygwinBinaryGenerator.h
@@ -19,8 +19,8 @@ public:
~cmCPackCygwinBinaryGenerator() override;
protected:
- virtual int InitializeInternal();
- int PackageFiles();
- virtual const char* GetOutputExtension();
+ int InitializeInternal() override;
+ int PackageFiles() override;
+ const char* GetOutputExtension() override;
std::string OutputExtension;
};
diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.cxx b/Source/CPack/cmCPackCygwinSourceGenerator.cxx
index 59df380c5f..a5863ff836 100644
--- a/Source/CPack/cmCPackCygwinSourceGenerator.cxx
+++ b/Source/CPack/cmCPackCygwinSourceGenerator.cxx
@@ -26,9 +26,7 @@ cmCPackCygwinSourceGenerator::cmCPackCygwinSourceGenerator()
{
}
-cmCPackCygwinSourceGenerator::~cmCPackCygwinSourceGenerator()
-{
-}
+cmCPackCygwinSourceGenerator::~cmCPackCygwinSourceGenerator() = default;
int cmCPackCygwinSourceGenerator::InitializeInternal()
{
@@ -50,7 +48,7 @@ int cmCPackCygwinSourceGenerator::PackageFiles()
// Now create a tar file that contains the above .tar.bz2 file
// and the CPACK_CYGWIN_PATCH_FILE and CPACK_TOPLEVEL_DIRECTORY
// files
- std::string compressOutFile = packageDirFileName;
+ const std::string& compressOutFile = packageDirFileName;
// at this point compressOutFile is the full path to
// _CPack_Package/.../package-2.5.0.tar.bz2
// we want to create a tar _CPack_Package/.../package-2.5.0-1-src.tar.bz2
diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.h b/Source/CPack/cmCPackCygwinSourceGenerator.h
index 964a4d4f75..2207bde466 100644
--- a/Source/CPack/cmCPackCygwinSourceGenerator.h
+++ b/Source/CPack/cmCPackCygwinSourceGenerator.h
@@ -19,10 +19,10 @@ public:
~cmCPackCygwinSourceGenerator() override;
protected:
- const char* GetPackagingInstallPrefix();
- virtual int InitializeInternal();
- int PackageFiles();
- virtual const char* GetOutputExtension();
+ const char* GetPackagingInstallPrefix() override;
+ int InitializeInternal() override;
+ int PackageFiles() override;
+ const char* GetOutputExtension() override;
std::string InstallPrefix;
std::string OutputExtension;
};
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index d7aa287174..8e5e637b39 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -203,7 +203,7 @@ bool DebGenerator::generateDataTar() const
// uid/gid should be the one of the root user, and this root user has
// always uid/gid equal to 0.
- data_tar.SetUIDAndGID(0u, 0u);
+ data_tar.SetUIDAndGID(0U, 0U);
data_tar.SetUNAMEAndGNAME("root", "root");
// now add all directories which have to be compressed
@@ -902,7 +902,7 @@ std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix(
}
if (this->componentPackageMethod == ONE_PACKAGE) {
- return std::string("ALL_COMPONENTS_IN_ONE");
+ return { "ALL_COMPONENTS_IN_ONE" };
}
// We have to find the name of the COMPONENT GROUP
// the current COMPONENT belongs to.
diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h
index 61a6616d3f..11561a4f26 100644
--- a/Source/CPack/cmCPackDebGenerator.h
+++ b/Source/CPack/cmCPackDebGenerator.h
@@ -29,9 +29,9 @@ public:
#ifdef __APPLE__
// on MacOS enable CPackDeb iff dpkg is found
std::vector<std::string> locations;
- locations.push_back("/sw/bin"); // Fink
- locations.push_back("/opt/local/bin"); // MacPorts
- return cmSystemTools::FindProgram("dpkg", locations) != "" ? true : false;
+ locations.emplace_back("/sw/bin"); // Fink
+ locations.emplace_back("/opt/local/bin"); // MacPorts
+ return !cmSystemTools::FindProgram("dpkg", locations).empty();
#else
// legacy behavior on other systems
return true;
diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h
index 310b0ab9ac..6d1267b0cc 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.h
+++ b/Source/CPack/cmCPackDragNDropGenerator.h
@@ -4,12 +4,11 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <cstddef>
#include <sstream>
#include <string>
#include <vector>
-#include <stddef.h>
-
#include "cmCPackGenerator.h"
class cmGeneratedFileStream;
@@ -34,7 +33,7 @@ protected:
bool CopyFile(std::ostringstream& source, std::ostringstream& target);
bool CreateEmptyFile(std::ostringstream& target, size_t size);
- bool RunCommand(std::ostringstream& command, std::string* output = 0);
+ bool RunCommand(std::ostringstream& command, std::string* output = nullptr);
std::string GetComponentInstallDirNameSuffix(
const std::string& componentName) override;
diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx
index 30b6b0d7fb..fcd57538e3 100644
--- a/Source/CPack/cmCPackFreeBSDGenerator.cxx
+++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx
@@ -205,7 +205,7 @@ std::string cmCPackFreeBSDGenerator::var_lookup(const char* var_name)
{
cmValue pv = this->GetOption(var_name);
if (!pv) {
- return std::string();
+ return {};
}
return *pv;
}
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 2f700b4012..7ddb1039df 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -186,7 +186,7 @@ int cmCPackGenerator::InstallProject()
std::string bareTempInstallDirectory =
this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
std::string tempInstallDirectoryStr = bareTempInstallDirectory;
- bool setDestDir = cmIsOn(this->GetOption("CPACK_SET_DESTDIR")) |
+ bool setDestDir = cmIsOn(this->GetOption("CPACK_SET_DESTDIR")) ||
cmIsInternallyOn(this->GetOption("CPACK_SET_DESTDIR"));
if (!setDestDir) {
tempInstallDirectoryStr += this->GetPackagingInstallPrefix();
diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx
index 79e344be76..0b2acca7f8 100644
--- a/Source/CPack/cmCPackGeneratorFactory.cxx
+++ b/Source/CPack/cmCPackGeneratorFactory.cxx
@@ -21,7 +21,6 @@
#ifdef __APPLE__
# include "cmCPackBundleGenerator.h"
# include "cmCPackDragNDropGenerator.h"
-# include "cmCPackOSXX11Generator.h"
# include "cmCPackPackageMakerGenerator.h"
# include "cmCPackProductBuildGenerator.h"
#endif
@@ -113,10 +112,6 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
this->RegisterGenerator("PackageMaker", "Mac OSX Package Maker installer",
cmCPackPackageMakerGenerator::CreateGenerator);
}
- if (cmCPackOSXX11Generator::CanGenerate()) {
- this->RegisterGenerator("OSXX11", "Mac OSX X11 bundle",
- cmCPackOSXX11Generator::CreateGenerator);
- }
if (cmCPackProductBuildGenerator::CanGenerate()) {
this->RegisterGenerator("productbuild", "Mac OSX pkg",
cmCPackProductBuildGenerator::CreateGenerator);
diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h
index 0846573bb0..f3e25a65d1 100644
--- a/Source/CPack/cmCPackGeneratorFactory.h
+++ b/Source/CPack/cmCPackGeneratorFactory.h
@@ -41,5 +41,5 @@ private:
using t_GeneratorCreatorsMap = std::map<std::string, CreateGeneratorCall*>;
t_GeneratorCreatorsMap GeneratorCreators;
DescriptionsMap GeneratorDescriptions;
- cmCPackLog* Logger;
+ cmCPackLog* Logger{};
};
diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h
index 6cec39cd81..2ab2f8ea0e 100644
--- a/Source/CPack/cmCPackLog.h
+++ b/Source/CPack/cmCPackLog.h
@@ -4,12 +4,11 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <cstring>
#include <memory>
#include <ostream>
#include <string>
-#include <string.h>
-
#define cmCPack_Log(ctSelf, logType, msg) \
do { \
std::ostringstream cmCPackLog_msg; \
@@ -129,7 +128,7 @@ public:
}
const char* Data;
- size_t Length;
+ std::streamsize Length;
};
inline std::ostream& operator<<(std::ostream& os, const cmCPackLogWrite& c)
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index ecc5e08499..217f716ea3 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -883,7 +883,7 @@ std::string cmCPackNSISGenerator::CreateSelectionDependenciesDescription(
{
// Don't visit a component twice
if (visited.count(component)) {
- return std::string();
+ return {};
}
visited.insert(component);
@@ -907,7 +907,7 @@ std::string cmCPackNSISGenerator::CreateDeselectionDependenciesDescription(
{
// Don't visit a component twice
if (visited.count(component)) {
- return std::string();
+ return {};
}
visited.insert(component);
@@ -933,7 +933,7 @@ std::string cmCPackNSISGenerator::CreateComponentGroupDescription(
{
if (group->Components.empty() && group->Subgroups.empty()) {
// Silently skip empty groups. NSIS doesn't support them.
- return std::string();
+ return {};
}
std::string code = "SectionGroup ";
diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx
deleted file mode 100644
index 7bf1dc7352..0000000000
--- a/Source/CPack/cmCPackOSXX11Generator.cxx
+++ /dev/null
@@ -1,272 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmCPackOSXX11Generator.h"
-
-#include <sstream>
-
-#include "cm_sys_stat.h"
-
-#include "cmCPackGenerator.h"
-#include "cmCPackLog.h"
-#include "cmDuration.h"
-#include "cmGeneratedFileStream.h"
-#include "cmStringAlgorithms.h"
-#include "cmSystemTools.h"
-#include "cmValue.h"
-
-cmCPackOSXX11Generator::cmCPackOSXX11Generator() = default;
-
-cmCPackOSXX11Generator::~cmCPackOSXX11Generator() = default;
-
-int cmCPackOSXX11Generator::PackageFiles()
-{
- // TODO: Use toplevel ?
- // It is used! Is this an obsolete comment?
-
- cmValue cpackPackageExecutables =
- this->GetOption("CPACK_PACKAGE_EXECUTABLES");
- if (cpackPackageExecutables) {
- cmCPackLogger(cmCPackLog::LOG_DEBUG,
- "The cpackPackageExecutables: " << cpackPackageExecutables
- << "." << std::endl);
- std::ostringstream str;
- std::ostringstream deleteStr;
- std::vector<std::string> cpackPackageExecutablesVector =
- cmExpandedList(cpackPackageExecutables);
- if (cpackPackageExecutablesVector.size() % 2 != 0) {
- cmCPackLogger(
- cmCPackLog::LOG_ERROR,
- "CPACK_PACKAGE_EXECUTABLES should contain pairs of <executable> and "
- "<icon name>."
- << std::endl);
- return 0;
- }
- std::vector<std::string>::iterator it;
- for (it = cpackPackageExecutablesVector.begin();
- it != cpackPackageExecutablesVector.end(); ++it) {
- std::string cpackExecutableName = *it;
- ++it;
- this->SetOptionIfNotSet("CPACK_EXECUTABLE_NAME", cpackExecutableName);
- }
- }
-
- // Disk image directories
- std::string diskImageDirectory = toplevel;
- std::string diskImageBackgroundImageDir =
- diskImageDirectory + "/.background";
-
- // App bundle directories
- std::string packageDirFileName = cmStrCat(
- toplevel, '/', this->GetOption("CPACK_PACKAGE_FILE_NAME"), ".app");
- std::string contentsDirectory = packageDirFileName + "/Contents";
- std::string resourcesDirectory = contentsDirectory + "/Resources";
- std::string appDirectory = contentsDirectory + "/MacOS";
- std::string scriptDirectory = resourcesDirectory + "/Scripts";
- std::string resourceFileName =
- cmStrCat(this->GetOption("CPACK_PACKAGE_FILE_NAME"), ".rsrc");
-
- const char* dir = resourcesDirectory.c_str();
- const char* appdir = appDirectory.c_str();
- const char* scrDir = scriptDirectory.c_str();
- const char* contDir = contentsDirectory.c_str();
- const char* rsrcFile = resourceFileName.c_str();
- cmValue iconFile = this->GetOption("CPACK_PACKAGE_ICON");
- if (iconFile) {
- std::string iconFileName = cmsys::SystemTools::GetFilenameName(iconFile);
- if (!cmSystemTools::FileExists(iconFile)) {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Cannot find icon file: "
- << iconFile
- << ". Please check CPACK_PACKAGE_ICON setting."
- << std::endl);
- return 0;
- }
- std::string destFileName = resourcesDirectory + "/" + iconFileName;
- this->ConfigureFile(iconFile, destFileName, true);
- this->SetOptionIfNotSet("CPACK_APPLE_GUI_ICON", iconFileName);
- }
-
- std::string applicationsLinkName = diskImageDirectory + "/Applications";
- cmSystemTools::CreateSymlink("/Applications", applicationsLinkName);
-
- if (!this->CopyResourcePlistFile("VolumeIcon.icns", diskImageDirectory,
- ".VolumeIcon.icns", true) ||
- !this->CopyResourcePlistFile("DS_Store", diskImageDirectory, ".DS_Store",
- true) ||
- !this->CopyResourcePlistFile("background.png",
- diskImageBackgroundImageDir,
- "background.png", true) ||
- !this->CopyResourcePlistFile("RuntimeScript", dir) ||
- !this->CopyResourcePlistFile("OSXX11.Info.plist", contDir,
- "Info.plist") ||
- !this->CopyResourcePlistFile("OSXX11.main.scpt", scrDir, "main.scpt",
- true) ||
- !this->CopyResourcePlistFile("OSXScriptLauncher.rsrc", dir, rsrcFile,
- true) ||
- !this->CopyResourcePlistFile(
- "OSXScriptLauncher", appdir,
- this->GetOption("CPACK_PACKAGE_FILE_NAME").GetCStr(), true)) {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Problem copying the resource files" << std::endl);
- return 0;
- }
-
- // Two of the files need to have execute permission, so ensure they do:
- std::string runTimeScript = cmStrCat(dir, "/RuntimeScript");
-
- std::string appScriptName =
- cmStrCat(appdir, '/', this->GetOption("CPACK_PACKAGE_FILE_NAME"));
-
- mode_t mode;
- if (cmsys::SystemTools::GetPermissions(runTimeScript.c_str(), mode)) {
- mode |= (S_IXUSR | S_IXGRP | S_IXOTH);
- cmsys::SystemTools::SetPermissions(runTimeScript.c_str(), mode);
- cmCPackLogger(cmCPackLog::LOG_OUTPUT,
- "Setting: " << runTimeScript << " to permission: " << mode
- << std::endl);
- }
-
- if (cmsys::SystemTools::GetPermissions(appScriptName.c_str(), mode)) {
- mode |= (S_IXUSR | S_IXGRP | S_IXOTH);
- cmsys::SystemTools::SetPermissions(appScriptName.c_str(), mode);
- cmCPackLogger(cmCPackLog::LOG_OUTPUT,
- "Setting: " << appScriptName << " to permission: " << mode
- << std::endl);
- }
-
- std::string output;
- std::string tmpFile = cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"),
- "/hdiutilOutput.log");
- std::ostringstream dmgCmd;
- dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM_DISK_IMAGE")
- << "\" create -ov -fs HFS+ -format UDZO -srcfolder \""
- << diskImageDirectory << "\" \"" << packageFileNames[0] << "\"";
- cmCPackLogger(cmCPackLog::LOG_VERBOSE,
- "Compress disk image using command: " << dmgCmd.str()
- << std::endl);
- // since we get random dashboard failures with this one
- // try running it more than once
- int retVal = 1;
- int numTries = 10;
- bool res = false;
- while (numTries > 0) {
- res = cmSystemTools::RunSingleCommand(
- dmgCmd.str(), &output, &output, &retVal, nullptr, this->GeneratorVerbose,
- cmDuration::zero());
- if (res && !retVal) {
- numTries = -1;
- break;
- }
- cmSystemTools::Delay(500);
- numTries--;
- }
- if (!res || retVal) {
- cmGeneratedFileStream ofs(tmpFile);
- ofs << "# Run command: " << dmgCmd.str() << std::endl
- << "# Output:" << std::endl
- << output << std::endl;
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Problem running hdiutil command: "
- << dmgCmd.str() << std::endl
- << "Please check " << tmpFile << " for errors"
- << std::endl);
- return 0;
- }
-
- return 1;
-}
-
-int cmCPackOSXX11Generator::InitializeInternal()
-{
- cmCPackLogger(cmCPackLog::LOG_WARNING,
- "The OSXX11 generator is deprecated "
- "and will be removed in a future version.\n");
- cmCPackLogger(cmCPackLog::LOG_DEBUG,
- "cmCPackOSXX11Generator::Initialize()" << std::endl);
- std::vector<std::string> path;
- std::string pkgPath = cmSystemTools::FindProgram("hdiutil", path, false);
- if (pkgPath.empty()) {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Cannot find hdiutil compiler" << std::endl);
- return 0;
- }
- this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM_DISK_IMAGE", pkgPath);
-
- return this->Superclass::InitializeInternal();
-}
-
-/*
-bool cmCPackOSXX11Generator::CopyCreateResourceFile(const std::string& name)
-{
- std::string uname = cmSystemTools::UpperCase(name);
- std::string cpackVar = "CPACK_RESOURCE_FILE_" + uname;
- const char* inFileName = this->GetOption(cpackVar.c_str());
- if ( !inFileName )
- {
- cmCPackLogger(cmCPackLog::LOG_ERROR, "CPack option: " << cpackVar.c_str()
- << " not specified. It should point to "
- << (name ? name : "(NULL)")
- << ".rtf, " << name
- << ".html, or " << name << ".txt file" << std::endl);
- return false;
- }
- if ( !cmSystemTools::FileExists(inFileName) )
- {
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find "
- << (name ? name : "(NULL)")
- << " resource file: " << inFileName << std::endl);
- return false;
- }
- std::string ext = cmSystemTools::GetFilenameLastExtension(inFileName);
- if ( ext != ".rtfd" && ext != ".rtf" && ext != ".html" && ext != ".txt" )
- {
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Bad file extension specified: "
- << ext << ". Currently only .rtfd, .rtf, .html, and .txt files allowed."
- << std::endl);
- return false;
- }
-
- std::string destFileName = cmStrCat(
-this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/Resources/", name, ext );
-
-
- cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: "
- << (inFileName ? inFileName : "(NULL)")
- << " to " << destFileName << std::endl);
- this->ConfigureFile(inFileName, destFileName);
- return true;
-}
-*/
-
-bool cmCPackOSXX11Generator::CopyResourcePlistFile(
- const std::string& name, const std::string& dir,
- const char* outputFileName /* = 0 */, bool copyOnly /* = false */)
-{
- std::string inFName = cmStrCat("CPack.", name, ".in");
- std::string inFileName = this->FindTemplate(inFName.c_str());
- if (inFileName.empty()) {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Cannot find input file: " << inFName << std::endl);
- return false;
- }
-
- if (!outputFileName) {
- outputFileName = name.c_str();
- }
-
- std::string destFileName = cmStrCat(dir, '/', outputFileName);
-
- cmCPackLogger(cmCPackLog::LOG_VERBOSE,
- "Configure file: " << inFileName << " to " << destFileName
- << std::endl);
- this->ConfigureFile(inFileName, destFileName, copyOnly);
- return true;
-}
-
-const char* cmCPackOSXX11Generator::GetPackagingInstallPrefix()
-{
- this->InstallPrefix =
- cmStrCat('/', this->GetOption("CPACK_PACKAGE_FILE_NAME"),
- ".app/Contents/Resources");
- return this->InstallPrefix.c_str();
-}
diff --git a/Source/CPack/cmCPackOSXX11Generator.h b/Source/CPack/cmCPackOSXX11Generator.h
deleted file mode 100644
index 8fae136eb6..0000000000
--- a/Source/CPack/cmCPackOSXX11Generator.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#pragma once
-
-#include "cmConfigure.h" // IWYU pragma: keep
-
-#include <string>
-
-#include "cmCPackGenerator.h"
-
-/** \class cmCPackOSXX11Generator
- * \brief A generator for OSX X11 modules
- *
- * Based on Gimp.app
- */
-class cmCPackOSXX11Generator : public cmCPackGenerator
-{
-public:
- cmCPackTypeMacro(cmCPackOSXX11Generator, cmCPackGenerator);
-
- /**
- * Construct generator
- */
- cmCPackOSXX11Generator();
- ~cmCPackOSXX11Generator() override;
-
-protected:
- virtual int InitializeInternal() override;
- int PackageFiles() override;
- const char* GetPackagingInstallPrefix() override;
- const char* GetOutputExtension() override { return ".dmg"; }
-
- // bool CopyCreateResourceFile(const std::string& name,
- // const std::string& dir);
- bool CopyResourcePlistFile(const std::string& name, const std::string& dir,
- const char* outputFileName = 0,
- bool copyOnly = false);
- std::string InstallPrefix;
-};
diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx
index 91adf321e7..b62fab8e6d 100644
--- a/Source/CPack/cmCPackPKGGenerator.cxx
+++ b/Source/CPack/cmCPackPKGGenerator.cxx
@@ -210,9 +210,14 @@ void cmCPackPKGGenerator::CreateChoice(const cmCPackComponentGroup& group,
void cmCPackPKGGenerator::CreateChoice(const cmCPackComponent& component,
cmXMLWriter& xout)
{
- std::string packageId =
- cmStrCat("com.", this->GetOption("CPACK_PACKAGE_VENDOR"), '.',
- this->GetOption("CPACK_PACKAGE_NAME"), '.', component.Name);
+ std::string packageId;
+ if (cmValue i = this->GetOption("CPACK_PRODUCTBUILD_IDENTIFIER")) {
+ packageId = cmStrCat(i, '.', component.Name);
+ } else {
+ packageId =
+ cmStrCat("com.", this->GetOption("CPACK_PACKAGE_VENDOR"), '.',
+ this->GetOption("CPACK_PACKAGE_NAME"), '.', component.Name);
+ }
xout.StartElement("choice");
xout.Attribute("id", component.Name + "Choice");
diff --git a/Source/CPack/cmCPackPKGGenerator.h b/Source/CPack/cmCPackPKGGenerator.h
index 17cdcdf59f..5d97d16d86 100644
--- a/Source/CPack/cmCPackPKGGenerator.h
+++ b/Source/CPack/cmCPackPKGGenerator.h
@@ -43,7 +43,8 @@ protected:
// which will be configured via ConfigureFile.
bool CopyCreateResourceFile(const std::string& name,
const std::string& dirName);
- bool CopyResourcePlistFile(const std::string& name, const char* outName = 0);
+ bool CopyResourcePlistFile(const std::string& name,
+ const char* outName = nullptr);
int CopyInstallScript(const std::string& resdir, const std::string& script,
const std::string& name);
diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx
index f55b8def05..4ad616dc28 100644
--- a/Source/CPack/cmCPackProductBuildGenerator.cxx
+++ b/Source/CPack/cmCPackProductBuildGenerator.cxx
@@ -95,6 +95,10 @@ int cmCPackProductBuildGenerator::PackageFiles()
if (cmValue p = this->GetOption("CPACK_PRODUCTBUILD_KEYCHAIN_PATH")) {
keychainPath = p;
}
+ std::string identifier;
+ if (cmValue i = this->GetOption("CPACK_PRODUCTBUILD_IDENTIFIER")) {
+ identifier = i;
+ }
pkgCmd << productbuild << " --distribution \"" << packageDirFileName
<< "/Contents/distribution.dist\""
@@ -102,6 +106,7 @@ int cmCPackProductBuildGenerator::PackageFiles()
<< "\""
<< " --resources \"" << resDir << "\""
<< " --version \"" << version << "\""
+ << (identifier.empty() ? "" : " --identifier \"" + identifier + "\"")
<< (identityName.empty() ? "" : " --sign \"" + identityName + "\"")
<< (keychainPath.empty() ? ""
: " --keychain \"" + keychainPath + "\"")
@@ -204,8 +209,13 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage(
// The command that will be used to run ProductBuild
std::ostringstream pkgCmd;
- std::string pkgId = cmStrCat("com.", this->GetOption("CPACK_PACKAGE_VENDOR"),
- '.', this->GetOption("CPACK_PACKAGE_NAME"));
+ std::string pkgId;
+ if (cmValue n = this->GetOption("CPACK_PRODUCTBUILD_IDENTIFIER")) {
+ pkgId = n;
+ } else {
+ pkgId = cmStrCat("com.", this->GetOption("CPACK_PACKAGE_VENDOR"), '.',
+ this->GetOption("CPACK_PACKAGE_NAME"));
+ }
if (component) {
pkgId += '.';
pkgId += component->Name;
diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx
index 9e50700c60..3d4d05e009 100644
--- a/Source/CPack/cmCPackRPMGenerator.cxx
+++ b/Source/CPack/cmCPackRPMGenerator.cxx
@@ -329,9 +329,10 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup)
if (retval) {
this->AddGeneratedPackageNames();
+ return retval;
}
- return retval;
+ return 0;
}
int cmCPackRPMGenerator::PackageComponentsAllInOne(
@@ -424,7 +425,7 @@ std::string cmCPackRPMGenerator::GetComponentInstallDirNameSuffix(
}
if (this->componentPackageMethod == ONE_PACKAGE) {
- return std::string("ALL_COMPONENTS_IN_ONE");
+ return { "ALL_COMPONENTS_IN_ONE" };
}
// We have to find the name of the COMPONENT GROUP
// the current COMPONENT belongs to.
diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h
index 0288f2fbd0..886afb16bb 100644
--- a/Source/CPack/cmCPackRPMGenerator.h
+++ b/Source/CPack/cmCPackRPMGenerator.h
@@ -32,9 +32,9 @@ public:
#ifdef __APPLE__
// on MacOS enable CPackRPM iff rpmbuild is found
std::vector<std::string> locations;
- locations.push_back("/sw/bin"); // Fink
- locations.push_back("/opt/local/bin"); // MacPorts
- return cmSystemTools::FindProgram("rpmbuild") != "" ? true : false;
+ locations.emplace_back("/sw/bin"); // Fink
+ locations.emplace_back("/opt/local/bin"); // MacPorts
+ return !cmSystemTools::FindProgram("rpmbuild").empty();
#else
// legacy behavior on other systems
return true;
diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx
index 1340fb59f2..6ad3755958 100644
--- a/Source/CPack/cmCPackSTGZGenerator.cxx
+++ b/Source/CPack/cmCPackSTGZGenerator.cxx
@@ -107,7 +107,7 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Number of lines: " << counter << std::endl);
char buffer[1024];
- sprintf(buffer, "%d", counter);
+ snprintf(buffer, sizeof(buffer), "%d", counter);
cmSystemTools::ReplaceString(res, headerLengthTag, buffer);
// Write in file
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 54fd3587cf..f43642f70c 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -67,7 +67,7 @@ struct cpackDefinitions
{
using MapType = std::map<std::string, std::string>;
MapType Map;
- cmCPackLog* Log;
+ cmCPackLog* Log{};
};
int cpackDefinitionArgument(const char* argument, const char* cValue,
diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx
index a35343549a..0fe4ff45e2 100644
--- a/Source/CTest/cmCTestBZR.cxx
+++ b/Source/CTest/cmCTestBZR.cxx
@@ -20,9 +20,9 @@
#include "cmSystemTools.h"
#include "cmXMLParser.h"
-extern "C" int cmBZRXMLParserUnknownEncodingHandler(void* /*unused*/,
- const XML_Char* name,
- XML_Encoding* info)
+static int cmBZRXMLParserUnknownEncodingHandler(void* /*unused*/,
+ const XML_Char* name,
+ XML_Encoding* info)
{
static const int latin1[] = {
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008,
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h
index b9cc35ccbd..e022e68538 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.h
+++ b/Source/CTest/cmCTestBuildAndTestHandler.h
@@ -4,12 +4,11 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <cstddef>
#include <sstream>
#include <string>
#include <vector>
-#include <stddef.h>
-
#include "cmCTestGenericHandler.h"
#include "cmDuration.h"
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index f9c4a8e35b..2aba79d38e 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -81,6 +81,7 @@ static const char* cmCTestErrorMatches[] = {
"^The project cannot be built\\.",
"^\\[ERROR\\]",
"^Command .* failed with exit code",
+ "lcc: \"([^\"]+)\", (line|строка) ([0-9]+): (error|ошибка)",
nullptr
};
@@ -122,6 +123,7 @@ static const char* cmCTestWarningMatches[] = {
"cc-[0-9]* CC: REMARK File = .*, Line = [0-9]*",
"^CMake Warning.*:",
"^\\[WARNING\\]",
+ "lcc: \"([^\"]+)\", (line|строка) ([0-9]+): (warning|предупреждение)",
nullptr
};
@@ -160,6 +162,9 @@ static cmCTestBuildCompileErrorWarningRex cmCTestWarningErrorFileLine[] = {
{ "^([a-zA-Z./0-9_+ ~-]+)\\(([0-9]+)\\)", 1, 2 },
{ "\"([a-zA-Z./0-9_+ ~-]+)\", line ([0-9]+)", 1, 2 },
{ "File = ([a-zA-Z./0-9_+ ~-]+), Line = ([0-9]+)", 1, 2 },
+ { "lcc: \"([^\"]+)\", (line|строка) ([0-9]+): "
+ "(error|ошибка|warning|предупреждение)",
+ 1, 3 },
{ nullptr, 0, 0 }
};
diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h
index 58e8d9cbb1..e33294d8f4 100644
--- a/Source/CTest/cmCTestBuildHandler.h
+++ b/Source/CTest/cmCTestBuildHandler.h
@@ -5,13 +5,12 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <chrono>
+#include <cstddef>
#include <deque>
#include <iosfwd>
#include <string>
#include <vector>
-#include <stddef.h>
-
#include "cmsys/RegularExpression.hxx"
#include "cmCTestGenericHandler.h"
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 57b1ddaf52..1b2f769881 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -49,9 +49,8 @@ public:
}
~cmCTestRunProcess()
{
- if (!(this->PipeState == -1) &&
- !(this->PipeState == cmsysProcess_Pipe_None) &&
- !(this->PipeState == cmsysProcess_Pipe_Timeout)) {
+ if (this->PipeState != -1 && this->PipeState != cmsysProcess_Pipe_None &&
+ this->PipeState != cmsysProcess_Pipe_Timeout) {
this->WaitForExit();
}
cmsysProcess_Delete(this->Process);
@@ -148,7 +147,8 @@ bool cmCTestCoverageHandler::StartCoverageLogFile(
cmGeneratedFileStream& covLogFile, int logFileCount)
{
char covLogFilename[1024];
- sprintf(covLogFilename, "CoverageLog-%d", logFileCount);
+ snprintf(covLogFilename, sizeof(covLogFilename), "CoverageLog-%d",
+ logFileCount);
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Open file: " << covLogFilename << std::endl,
this->Quiet);
@@ -165,7 +165,8 @@ void cmCTestCoverageHandler::EndCoverageLogFile(cmGeneratedFileStream& ostr,
int logFileCount)
{
char covLogFilename[1024];
- sprintf(covLogFilename, "CoverageLog-%d.xml", logFileCount);
+ snprintf(covLogFilename, sizeof(covLogFilename), "CoverageLog-%d.xml",
+ logFileCount);
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Close file: " << covLogFilename << std::endl,
this->Quiet);
@@ -692,7 +693,7 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile* mf)
# define fnc_prefix(s, t) cmHasPrefix(s, t)
#endif
-bool IsFileInDir(const std::string& infile, const std::string& indir)
+static bool IsFileInDir(const std::string& infile, const std::string& indir)
{
std::string file = cmSystemTools::CollapseFullPath(infile);
std::string dir = cmSystemTools::CollapseFullPath(indir);
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index d85edcc5ff..56f805cb8a 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -24,7 +24,7 @@ static unsigned int cmCTestGITVersion(unsigned int epic, unsigned int major,
unsigned int minor, unsigned int fix)
{
// 1.6.5.0 maps to 10605000
- return fix + minor * 1000 + major * 100000 + epic * 10000000;
+ return epic * 10000000 + major * 100000 + minor * 1000 + fix;
}
cmCTestGIT::cmCTestGIT(cmCTest* ct, std::ostream& log)
@@ -582,16 +582,17 @@ private:
time_t seconds = static_cast<time_t>(person.Time);
struct tm* t = gmtime(&seconds);
char dt[1024];
- sprintf(dt, "%04d-%02d-%02d %02d:%02d:%02d", t->tm_year + 1900,
- t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
+ snprintf(dt, sizeof(dt), "%04d-%02d-%02d %02d:%02d:%02d",
+ t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour,
+ t->tm_min, t->tm_sec);
std::string out = dt;
// Add the time-zone field "+zone" or "-zone".
char tz[32];
if (person.TimeZone >= 0) {
- sprintf(tz, " +%04ld", person.TimeZone);
+ snprintf(tz, sizeof(tz), " +%04ld", person.TimeZone);
} else {
- sprintf(tz, " -%04ld", -person.TimeZone);
+ snprintf(tz, sizeof(tz), " -%04ld", -person.TimeZone);
}
out += tz;
return out;
diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h
index b4b0ad8a2a..4bdb9c2adf 100644
--- a/Source/CTest/cmCTestGenericHandler.h
+++ b/Source/CTest/cmCTestGenericHandler.h
@@ -4,12 +4,11 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <cstddef>
#include <map>
#include <string>
#include <vector>
-#include <stddef.h>
-
#include "cmCTest.h"
#include "cmSystemTools.h"
#include "cmValue.h"
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index 15c443a4c7..4a33869fdd 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -20,9 +20,10 @@
#include "cmake.h"
#ifdef _WIN32
+# include <cstdio> // for std{out,err} and fileno
+
# include <fcntl.h> // for _O_BINARY
# include <io.h> // for _setmode
-# include <stdio.h> // for std{out,err} and fileno
#endif
cmCTestLaunch::cmCTestLaunch(int argc, const char* const* argv)
diff --git a/Source/CTest/cmCTestLaunch.h b/Source/CTest/cmCTestLaunch.h
index eabb608156..c5a64767c9 100644
--- a/Source/CTest/cmCTestLaunch.h
+++ b/Source/CTest/cmCTestLaunch.h
@@ -24,14 +24,14 @@ public:
/** Entry point from ctest executable main(). */
static int Main(int argc, const char* const argv[]);
+ cmCTestLaunch(const cmCTestLaunch&) = delete;
+ cmCTestLaunch& operator=(const cmCTestLaunch&) = delete;
+
private:
// Initialize the launcher from its command line.
cmCTestLaunch(int argc, const char* const* argv);
~cmCTestLaunch();
- cmCTestLaunch(const cmCTestLaunch&) = delete;
- cmCTestLaunch& operator=(const cmCTestLaunch&) = delete;
-
// Run the real command.
int Run();
void RunChild();
diff --git a/Source/CTest/cmCTestLaunchReporter.cxx b/Source/CTest/cmCTestLaunchReporter.cxx
index 5334a930ef..149ba5d19f 100644
--- a/Source/CTest/cmCTestLaunchReporter.cxx
+++ b/Source/CTest/cmCTestLaunchReporter.cxx
@@ -13,9 +13,10 @@
#include "cmXMLWriter.h"
#ifdef _WIN32
+# include <cstdio> // for std{out,err} and fileno
+
# include <fcntl.h> // for _O_BINARY
# include <io.h> // for _setmode
-# include <stdio.h> // for std{out,err} and fileno
#endif
cmCTestLaunchReporter::cmCTestLaunchReporter()
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index 5de42f9e32..2f5ad400fc 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -4,6 +4,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <cstddef>
#include <map>
#include <memory>
#include <set>
@@ -11,7 +12,6 @@
#include <vector>
#include <cm3p/uv.h>
-#include <stddef.h>
#include "cmCTest.h"
#include "cmCTestResourceAllocator.h"
diff --git a/Source/CTest/cmCTestP4.h b/Source/CTest/cmCTestP4.h
index d03f9cbae3..18895203be 100644
--- a/Source/CTest/cmCTestP4.h
+++ b/Source/CTest/cmCTestP4.h
@@ -34,14 +34,6 @@ private:
std::string Name;
std::string EMail;
std::string AccessTime;
-
- User()
- : UserName()
- , Name()
- , EMail()
- , AccessTime()
- {
- }
};
std::map<std::string, User> Users;
std::vector<std::string> P4Options;
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 9d2cef69fd..6cd3b0936a 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -229,7 +229,8 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
passed = this->TestResult.Status == cmCTestTestHandler::COMPLETED;
char buf[1024];
- sprintf(buf, "%6.2f sec", this->TestProcess->GetTotalTime().count());
+ snprintf(buf, sizeof(buf), "%6.2f sec",
+ this->TestProcess->GetTotalTime().count());
outputStream << buf << "\n";
bool passedOrSkipped = passed || skipped;
@@ -294,9 +295,10 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
ttime -= minutes;
auto seconds = std::chrono::duration_cast<std::chrono::seconds>(ttime);
char buffer[100];
- sprintf(buffer, "%02d:%02d:%02d", static_cast<unsigned>(hours.count()),
- static_cast<unsigned>(minutes.count()),
- static_cast<unsigned>(seconds.count()));
+ snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d",
+ static_cast<unsigned>(hours.count()),
+ static_cast<unsigned>(minutes.count()),
+ static_cast<unsigned>(seconds.count()));
*this->TestHandler->LogFile
<< "----------------------------------------------------------"
<< std::endl;
diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h
index 2082156b8f..7a97fa9295 100644
--- a/Source/CTest/cmCTestRunTest.h
+++ b/Source/CTest/cmCTestRunTest.h
@@ -4,14 +4,13 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <cstddef>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <vector>
-#include <stddef.h>
-
#include "cmCTest.h"
#include "cmCTestMultiProcessHandler.h"
#include "cmCTestTestHandler.h"
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index f685f66812..16c0a0ec54 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -48,8 +48,6 @@
# include <unistd.h>
#endif
-#define CTEST_INITIAL_CMAKE_OUTPUT_FILE_NAME "CTestInitialCMakeOutput.log"
-
cmCTestScriptHandler::cmCTestScriptHandler() = default;
void cmCTestScriptHandler::Initialize()
@@ -411,7 +409,7 @@ int cmCTestScriptHandler::ExtractVariables()
char updateVar[40];
int i;
for (i = 1; i < 10; ++i) {
- sprintf(updateVar, "CTEST_EXTRA_UPDATES_%i", i);
+ snprintf(updateVar, sizeof(updateVar), "CTEST_EXTRA_UPDATES_%i", i);
cmValue updateVal = this->Makefile->GetDefinition(updateVar);
if (updateVal) {
if (this->UpdateCmd.empty()) {
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index c4f87e993c..a2dc61553f 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -58,6 +58,9 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "CurlOptions", "CTEST_CURL_OPTIONS", this->Quiet);
+ this->CTest->SetCTestConfigurationFromCMakeVariable(
+ this->Makefile, "SubmitInactivityTimeout",
+ "CTEST_SUBMIT_INACTIVITY_TIMEOUT", this->Quiet);
cmValue notesFilesVariable =
this->Makefile->GetDefinition("CTEST_NOTES_FILES");
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index b99bb79d13..fae5e303f0 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -7,6 +7,7 @@
#include <cstdlib>
#include <sstream>
+#include <cm/iomanip>
#include <cmext/algorithm>
#include <cm3p/curl/curl.h>
@@ -216,8 +217,11 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
// if there is little to no activity for too long stop submitting
::curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1);
- ::curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME,
- SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT);
+ auto submitInactivityTimeout = this->GetSubmitInactivityTimeout();
+ if (submitInactivityTimeout != 0) {
+ ::curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME,
+ submitInactivityTimeout);
+ }
/* HTTP PUT please */
::curl_easy_setopt(curl, CURLOPT_PUT, 1);
@@ -499,7 +503,10 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions"));
std::vector<std::string> args = cmExpandedList(curlopt);
curl.SetCurlOptions(args);
- curl.SetTimeOutSeconds(SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT);
+ auto submitInactivityTimeout = this->GetSubmitInactivityTimeout();
+ if (submitInactivityTimeout != 0) {
+ curl.SetTimeOutSeconds(submitInactivityTimeout);
+ }
curl.SetHttpHeaders(this->HttpHeaders);
std::string url = this->CTest->GetSubmitURL();
if (!cmHasLiteralPrefix(url, "http://") &&
@@ -893,6 +900,26 @@ void cmCTestSubmitHandler::SelectParts(std::set<cmCTest::Part> const& parts)
}
}
+int cmCTestSubmitHandler::GetSubmitInactivityTimeout()
+{
+ int submitInactivityTimeout = SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT;
+ std::string const& timeoutStr =
+ this->CTest->GetCTestConfiguration("SubmitInactivityTimeout");
+ if (!timeoutStr.empty()) {
+ unsigned long timeout;
+ if (cmStrToULong(timeoutStr, &timeout)) {
+ submitInactivityTimeout = static_cast<int>(timeout);
+ } else {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "SubmitInactivityTimeout is invalid: "
+ << cm::quoted(timeoutStr) << "."
+ << " Using a default value of "
+ << SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT << "." << std::endl);
+ }
+ }
+ return submitInactivityTimeout;
+}
+
void cmCTestSubmitHandler::SelectFiles(std::set<std::string> const& files)
{
this->Files.insert(files.begin(), files.end());
diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h
index 809c6157bd..0c7253ccfd 100644
--- a/Source/CTest/cmCTestSubmitHandler.h
+++ b/Source/CTest/cmCTestSubmitHandler.h
@@ -63,6 +63,7 @@ private:
void ParseResponse(cmCTestSubmitHandlerVectorOfChar chunk);
std::string GetSubmitResultsPrefix();
+ int GetSubmitInactivityTimeout();
class ResponseParser;
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 6e97a83457..02db0c6500 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -59,6 +59,8 @@ public:
}
virtual ~cmCTestCommand() = default;
+ cmCTestCommand(const cmCTestCommand&) = default;
+ cmCTestCommand& operator=(const cmCTestCommand&) = default;
bool operator()(std::vector<cmListFileArgument> const& args,
cmExecutionStatus& status)
@@ -621,7 +623,7 @@ void cmCTestTestHandler::LogTestSummary(const std::vector<std::string>& passed,
this->PrintLabelOrSubprojectSummary(false);
}
char realBuf[1024];
- sprintf(realBuf, "%6.2f sec", durationInSecs.count());
+ snprintf(realBuf, sizeof(realBuf), "%6.2f sec", durationInSecs.count());
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
"\nTotal Test time (real) = " << realBuf << "\n",
this->Quiet);
@@ -782,7 +784,7 @@ void cmCTestTestHandler::PrintLabelOrSubprojectSummary(bool doSubProject)
label.resize(maxlen + 3, ' ');
char buf[1024];
- sprintf(buf, "%6.2f sec*proc", labelTimes[i]);
+ snprintf(buf, sizeof(buf), "%6.2f sec*proc", labelTimes[i]);
std::ostringstream labelCountStr;
labelCountStr << "(" << labelCounts[i] << " test";
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 3ac05e7bfe..135e764084 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -5,6 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <chrono>
+#include <cstddef>
#include <cstdint>
#include <iosfwd>
#include <map>
@@ -13,8 +14,6 @@
#include <utility>
#include <vector>
-#include <stddef.h>
-
#include "cmsys/RegularExpression.hxx"
#include "cmCTest.h"
diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx
index 423b5064c9..d5711c5a6e 100644
--- a/Source/CTest/cmCTestVC.cxx
+++ b/Source/CTest/cmCTestVC.cxx
@@ -123,9 +123,10 @@ std::string cmCTestVC::GetNightlyTime()
this->CTest->GetCTestConfiguration("NightlyStartTime"),
this->CTest->GetTomorrowTag());
char current_time[1024];
- sprintf(current_time, "%04d-%02d-%02d %02d:%02d:%02d", t->tm_year + 1900,
- t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
- return std::string(current_time);
+ snprintf(current_time, sizeof(current_time), "%04d-%02d-%02d %02d:%02d:%02d",
+ t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min,
+ t->tm_sec);
+ return { current_time };
}
void cmCTestVC::Cleanup()
diff --git a/Source/CTest/cmCTestVC.h b/Source/CTest/cmCTestVC.h
index 9bd7229b3d..7b03d10650 100644
--- a/Source/CTest/cmCTestVC.h
+++ b/Source/CTest/cmCTestVC.h
@@ -95,15 +95,10 @@ protected:
/** Represent change to one file. */
struct File
{
- PathStatus Status;
- Revision const* Rev;
- Revision const* PriorRev;
- File()
- : Status(PathUpdated)
- , Rev(nullptr)
- , PriorRev(nullptr)
- {
- }
+ PathStatus Status = PathUpdated;
+ Revision const* Rev = nullptr;
+ Revision const* PriorRev = nullptr;
+ File() = default;
File(PathStatus status, Revision const* rev, Revision const* priorRev)
: Status(status)
, Rev(rev)
diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx
index 16bca01b57..e14a4e1d0c 100644
--- a/Source/CTest/cmProcess.cxx
+++ b/Source/CTest/cmProcess.cxx
@@ -511,7 +511,7 @@ std::string cmProcess::GetExitExceptionString() const
default:
char buf[1024];
const char* fmt = "Exit code 0x%" KWIML_INT_PRIx64 "\n";
- _snprintf(buf, 1024, fmt, this->ExitValue);
+ snprintf(buf, sizeof(buf), fmt, this->ExitValue);
exception_str.assign(buf);
}
#else
diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h
index a44aeb07c2..be030e4c55 100644
--- a/Source/CTest/cmProcess.h
+++ b/Source/CTest/cmProcess.h
@@ -5,14 +5,14 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <chrono>
+#include <cstddef>
+#include <cstdint>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include <cm3p/uv.h>
-#include <stddef.h>
-#include <stdint.h>
#include "cmDuration.h"
#include "cmProcessOutput.h"
@@ -52,9 +52,9 @@ public:
};
State GetProcessStatus();
- int GetId() { return this->Id; }
+ int GetId() const { return this->Id; }
void SetId(int id) { this->Id = id; }
- int64_t GetExitValue() { return this->ExitValue; }
+ int64_t GetExitValue() const { return this->ExitValue; }
cmDuration GetTotalTime() { return this->TotalTime; }
enum class Exception
@@ -111,15 +111,11 @@ private:
class Buffer : public std::vector<char>
{
// Half-open index range of partial line already scanned.
- size_type First;
- size_type Last;
+ size_type First = 0;
+ size_type Last = 0;
public:
- Buffer()
- : First(0)
- , Last(0)
- {
- }
+ Buffer() = default;
bool GetLine(std::string& line);
bool GetLast(std::string& line);
};
diff --git a/Source/Checks/cm_c11_thread_local.cmake b/Source/Checks/cm_c11_thread_local.cmake
index 2263be3bad..f59688dbdb 100644
--- a/Source/Checks/cm_c11_thread_local.cmake
+++ b/Source/Checks/cm_c11_thread_local.cmake
@@ -1,5 +1,5 @@
set(CMake_C11_THREAD_LOCAL_BROKEN 0)
-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_C11_STANDARD_COMPILE_OPTION)
+if((CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "LCC") AND CMAKE_C11_STANDARD_COMPILE_OPTION)
if(NOT DEFINED CMake_C11_THREAD_LOCAL_WORKS)
include(${CMAKE_CURRENT_LIST_DIR}/cm_message_checks_compat.cmake)
cm_message_checks_compat(
diff --git a/Source/Checks/cm_cxx14_check.cmake b/Source/Checks/cm_cxx14_check.cmake
index e5656bf4ed..abf232a8f5 100644
--- a/Source/Checks/cm_cxx14_check.cmake
+++ b/Source/Checks/cm_cxx14_check.cmake
@@ -1,5 +1,5 @@
set(CMake_CXX14_BROKEN 0)
-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|PGI|Intel")
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC|Clang|PGI|Intel")
if(NOT CMAKE_CXX14_STANDARD_COMPILE_OPTION)
set(CMake_CXX14_WORKS 0)
endif()
diff --git a/Source/Checks/cm_cxx17_check.cmake b/Source/Checks/cm_cxx17_check.cmake
index dba3eaf3b3..78a23820fc 100644
--- a/Source/Checks/cm_cxx17_check.cmake
+++ b/Source/Checks/cm_cxx17_check.cmake
@@ -1,5 +1,5 @@
set(CMake_CXX17_BROKEN 0)
-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|PGI|Intel")
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC|Clang|PGI|Intel")
if(NOT CMAKE_CXX17_STANDARD_COMPILE_OPTION)
set(CMake_CXX17_WORKS 0)
endif()
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index 1ba45e5f7a..ae4c0f6c9d 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -55,7 +55,7 @@ cmCursesForm* cmCursesForm::CurrentForm = nullptr;
extern "C" {
-void onsig(int /*unused*/)
+static void onsig(int /*unused*/)
{
if (cmCursesForm::CurrentForm) {
endwin();
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx
index 591c546e69..7f1815f19e 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.cxx
+++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx
@@ -78,7 +78,8 @@ void cmCursesLongMessageForm::UpdateStatusBar()
char version[cmCursesMainForm::MAX_WIDTH];
char vertmp[128];
- sprintf(vertmp, "CMake Version %s", cmVersion::GetCMakeVersion());
+ snprintf(vertmp, sizeof(vertmp), "CMake Version %s",
+ cmVersion::GetCMakeVersion());
size_t sideSpace = (width - strlen(vertmp));
for (size_t i = 0; i < sideSpace; i++) {
version[i] = ' ';
@@ -105,7 +106,7 @@ void cmCursesLongMessageForm::PrintKeys()
return;
}
char firstLine[512];
- sprintf(firstLine, "Press [e] to exit screen");
+ snprintf(firstLine, sizeof(firstLine), "Press [e] to exit screen");
char fmt_s[] = "%s";
curses_move(y - 2, 0);
@@ -176,7 +177,8 @@ void cmCursesLongMessageForm::HandleInput()
this->PrintKeys();
int key = getch();
- sprintf(debugMessage, "Message widget handling input, key: %d", key);
+ snprintf(debugMessage, sizeof(debugMessage),
+ "Message widget handling input, key: %d", key);
cmCursesForm::LogMessage(debugMessage);
// quit
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index b28c5b7ac4..0012a25c8d 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -322,22 +322,22 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
memset(thirdLine, ' ', 68);
} else {
if (this->OkToGenerate) {
- sprintf(firstLine,
- " [l] Show log output [c] Configure"
- " [g] Generate ");
+ snprintf(firstLine, sizeof(firstLine),
+ " [l] Show log output [c] Configure"
+ " [g] Generate ");
} else {
- sprintf(firstLine,
- " [l] Show log output [c] Configure"
- " ");
+ snprintf(firstLine, sizeof(firstLine),
+ " [l] Show log output [c] Configure"
+ " ");
}
{
const char* toggleKeyInstruction =
" [t] Toggle advanced mode (currently %s)";
- sprintf(thirdLine, toggleKeyInstruction,
- this->AdvancedMode ? "on" : "off");
+ snprintf(thirdLine, sizeof(thirdLine), toggleKeyInstruction,
+ this->AdvancedMode ? "on" : "off");
}
- sprintf(secondLine,
- " [h] Help [q] Quit without generating");
+ snprintf(secondLine, sizeof(secondLine),
+ " [h] Help [q] Quit without generating");
}
curses_move(y - 4, 0);
@@ -356,7 +356,8 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
if (cw) {
char pageLine[512] = "";
- sprintf(pageLine, "Page %d of %d", cw->GetPage(), this->NumberOfPages);
+ snprintf(pageLine, sizeof(pageLine), "Page %d of %d", cw->GetPage(),
+ this->NumberOfPages);
curses_move(0, 65 - static_cast<unsigned int>(strlen(pageLine)) - 1);
printw(fmt_s, pageLine);
}
@@ -739,7 +740,8 @@ void cmCursesMainForm::HandleInput()
if ((!currentWidget || !widgetHandled) && !this->SearchMode) {
// If the current widget does not want to handle input,
// we handle it.
- sprintf(debugMessage, "Main form handling input, key: %d", key);
+ snprintf(debugMessage, sizeof(debugMessage),
+ "Main form handling input, key: %d", key);
cmCursesForm::LogMessage(debugMessage);
// quit
if (key == 'q') {
diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx
index 4830d63054..c0d06ce787 100644
--- a/Source/CursesDialog/cmCursesStringWidget.cxx
+++ b/Source/CursesDialog/cmCursesStringWidget.cxx
@@ -85,7 +85,8 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
// <Enter> is used to change edit mode (like <Esc> in vi).
while (!this->Done) {
- sprintf(debugMessage, "String widget handling input, key: %d", key);
+ snprintf(debugMessage, sizeof(debugMessage),
+ "String widget handling input, key: %d", key);
cmCursesForm::LogMessage(debugMessage);
fm->PrintKeys();
diff --git a/Source/CursesDialog/form/CMakeLists.txt b/Source/CursesDialog/form/CMakeLists.txt
index 9202bc12e3..22a2e84005 100644
--- a/Source/CursesDialog/form/CMakeLists.txt
+++ b/Source/CursesDialog/form/CMakeLists.txt
@@ -5,7 +5,7 @@ project(CMAKE_FORM)
# Disable warnings to avoid changing 3rd party code.
if(CMAKE_C_COMPILER_ID MATCHES
- "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
+ "^(GNU|LCC|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
diff --git a/Source/CursesDialog/form/fty_enum.c b/Source/CursesDialog/form/fty_enum.c
index 59058a98ce..f1059b1cbe 100644
--- a/Source/CursesDialog/form/fty_enum.c
+++ b/Source/CursesDialog/form/fty_enum.c
@@ -116,7 +116,7 @@ static int Compare(const unsigned char *s, const unsigned char *buf,
if (*buf=='\0')
{
- return (((*s)!='\0') ? NOMATCH : EXACT);
+ return (((*s)=='\0') ? EXACT : NOMATCH);
}
else
{
@@ -144,7 +144,7 @@ static int Compare(const unsigned char *s, const unsigned char *buf,
/* If it happens that the reference buffer is at its end, the partial
match is actually an exact match. */
- return ((s[-1]!='\0') ? PARTIAL : EXACT);
+ return ((s[-1]=='\0') ? EXACT : PARTIAL);
}
/*---------------------------------------------------------------------------
diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx
index 0dc954aa47..017fdc087b 100644
--- a/Source/bindexplib.cxx
+++ b/Source/bindexplib.cxx
@@ -320,9 +320,9 @@ private:
};
#endif
-bool DumpFileWithLlvmNm(std::string const& nmPath, const char* filename,
- std::set<std::string>& symbols,
- std::set<std::string>& dataSymbols)
+static bool DumpFileWithLlvmNm(std::string const& nmPath, const char* filename,
+ std::set<std::string>& symbols,
+ std::set<std::string>& dataSymbols)
{
std::string output;
// break up command line into a vector
@@ -375,9 +375,9 @@ bool DumpFileWithLlvmNm(std::string const& nmPath, const char* filename,
return true;
}
-bool DumpFile(std::string const& nmPath, const char* filename,
- std::set<std::string>& symbols,
- std::set<std::string>& dataSymbols)
+static bool DumpFile(std::string const& nmPath, const char* filename,
+ std::set<std::string>& symbols,
+ std::set<std::string>& dataSymbols)
{
#ifndef _WIN32
return DumpFileWithLlvmNm(nmPath, filename, symbols, dataSymbols);
diff --git a/Source/bindexplib.h b/Source/bindexplib.h
index bd1398fa7a..c5d81c7f5e 100644
--- a/Source/bindexplib.h
+++ b/Source/bindexplib.h
@@ -4,11 +4,10 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <cstdio>
#include <set>
#include <string>
-#include <stdio.h>
-
class bindexplib
{
public:
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index a7ce3a60e5..0798ed466a 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -4,6 +4,9 @@
#include <sstream>
#include <unordered_set>
+#include <utility>
+
+#include <cm/memory>
#include "cmCustomCommand.h"
#include "cmCustomCommandLines.h"
@@ -316,21 +319,25 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
}
// Choose which mode of the command to use.
- bool escapeOldStyle = !verbatim;
+ auto cc = cm::make_unique<cmCustomCommand>();
+ cc->SetByproducts(byproducts);
+ cc->SetCommandLines(commandLines);
+ cc->SetComment(comment);
+ cc->SetWorkingDirectory(working.c_str());
+ cc->SetEscapeOldStyle(!verbatim);
+ cc->SetUsesTerminal(uses_terminal);
+ cc->SetDepfile(depfile);
+ cc->SetJobPool(job_pool);
+ cc->SetCommandExpandLists(command_expand_lists);
if (source.empty() && output.empty()) {
// Source is empty, use the target.
- std::vector<std::string> no_depends;
- mf.AddCustomCommandToTarget(
- target, byproducts, no_depends, commandLines, cctype, comment,
- working.c_str(), mf.GetPolicyStatus(cmPolicies::CMP0116), escapeOldStyle,
- uses_terminal, depfile, job_pool, command_expand_lists);
+ mf.AddCustomCommandToTarget(target, cctype, std::move(cc));
} else if (target.empty()) {
// Target is empty, use the output.
- mf.AddCustomCommandToOutput(
- output, byproducts, depends, main_dependency, implicit_depends,
- commandLines, comment, working.c_str(),
- mf.GetPolicyStatus(cmPolicies::CMP0116), nullptr, false, escapeOldStyle,
- uses_terminal, command_expand_lists, depfile, job_pool);
+ cc->SetOutputs(output);
+ cc->SetDepends(depends);
+ cc->SetImplicitDepends(implicit_depends);
+ mf.AddCustomCommandToOutput(main_dependency, std::move(cc));
} else if (!byproducts.empty()) {
status.SetError("BYPRODUCTS may not be specified with SOURCE signatures");
return false;
@@ -366,8 +373,7 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
// Use the old-style mode for backward compatibility.
mf.AddCustomCommandOldStyle(target, outputs, depends, source, commandLines,
- comment,
- mf.GetPolicyStatus(cmPolicies::CMP0116));
+ comment);
}
return true;
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index 2b19aad4fe..a246d0650b 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -4,13 +4,15 @@
#include <utility>
+#include <cm/memory>
+
+#include "cmCustomCommand.h"
#include "cmCustomCommandLines.h"
#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
-#include "cmPolicies.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -211,11 +213,18 @@ bool cmAddCustomTargetCommand(std::vector<std::string> const& args,
}
// Add the utility target to the makefile.
- bool escapeOldStyle = !verbatim;
- cmTarget* target = mf.AddUtilityCommand(
- targetName, excludeFromAll, working_directory.c_str(), byproducts, depends,
- commandLines, mf.GetPolicyStatus(cmPolicies::CMP0116), escapeOldStyle,
- comment, uses_terminal, command_expand_lists, job_pool);
+ auto cc = cm::make_unique<cmCustomCommand>();
+ cc->SetWorkingDirectory(working_directory.c_str());
+ cc->SetByproducts(byproducts);
+ cc->SetDepends(depends);
+ cc->SetCommandLines(commandLines);
+ cc->SetEscapeOldStyle(!verbatim);
+ cc->SetComment(comment);
+ cc->SetUsesTerminal(uses_terminal);
+ cc->SetCommandExpandLists(command_expand_lists);
+ cc->SetJobPool(job_pool);
+ cmTarget* target =
+ mf.AddUtilityCommand(targetName, excludeFromAll, std::move(cc));
// Add additional user-specified source files to the target.
target->AddSources(sources);
diff --git a/Source/cmAffinity.cxx b/Source/cmAffinity.cxx
index 35443e795b..591199b684 100644
--- a/Source/cmAffinity.cxx
+++ b/Source/cmAffinity.cxx
@@ -12,7 +12,7 @@
# define CM_HAVE_CPU_AFFINITY
# include <pthread.h>
# include <sched.h>
-// On some platforms CPU_ZERO needs memset but sched.h forgets string.h
+// On some platforms CPU_ZERO needs memset but sched.h forgets cstring
# include <cstring> // IWYU pragma: keep
# if defined(__FreeBSD__)
# include <pthread_np.h>
diff --git a/Source/cmBase32.cxx b/Source/cmBase32.cxx
index a9c15c2dd6..e8e46aa63a 100644
--- a/Source/cmBase32.cxx
+++ b/Source/cmBase32.cxx
@@ -12,7 +12,7 @@ inline unsigned char Base32EncodeChar(int schar)
return Base32EncodeTable[schar];
}
-void Base32Encode5(const unsigned char src[5], char dst[8])
+static void Base32Encode5(const unsigned char src[5], char dst[8])
{
// [0]:5 bits
dst[0] = Base32EncodeChar((src[0] >> 3) & 0x1F);
diff --git a/Source/cmCMakePresetsFile.cxx b/Source/cmCMakePresetsFile.cxx
index 538b668059..4a0742a0d6 100644
--- a/Source/cmCMakePresetsFile.cxx
+++ b/Source/cmCMakePresetsFile.cxx
@@ -18,7 +18,7 @@
#include "cmSystemTools.h"
#define CHECK_EXPAND(out, field, expanders, version) \
- { \
+ do { \
switch (ExpandMacros(field, expanders, version)) { \
case ExpandMacroResult::Error: \
return false; \
@@ -28,7 +28,7 @@
case ExpandMacroResult::Ok: \
break; \
} \
- }
+ } while (false)
namespace {
enum class CycleStatus
@@ -96,7 +96,7 @@ ReadFileResult VisitPreset(
return ReadFileResult::INVALID_PRESET;
}
- CHECK_OK(preset.VisitPresetBeforeInherit())
+ CHECK_OK(preset.VisitPresetBeforeInherit());
for (auto const& i : preset.Inherits) {
auto parent = presets.find(i);
@@ -114,7 +114,7 @@ ReadFileResult VisitPreset(
return result;
}
- CHECK_OK(preset.VisitPresetInherit(parentPreset))
+ CHECK_OK(preset.VisitPresetInherit(parentPreset));
for (auto const& v : parentPreset.Environment) {
preset.Environment.insert(v);
@@ -129,7 +129,7 @@ ReadFileResult VisitPreset(
preset.ConditionEvaluator.reset();
}
- CHECK_OK(preset.VisitPresetAfterInherit(file.GetVersion(preset)))
+ CHECK_OK(preset.VisitPresetAfterInherit(file.GetVersion(preset)));
cycleStatus[preset.Name] = CycleStatus::Verified;
return ReadFileResult::READ_OK;
@@ -195,7 +195,7 @@ bool ExpandMacros(const cmCMakePresetsFile& file,
const std::vector<MacroExpander>& macroExpanders)
{
std::string binaryDir = preset.BinaryDir;
- CHECK_EXPAND(out, binaryDir, macroExpanders, file.GetVersion(preset))
+ CHECK_EXPAND(out, binaryDir, macroExpanders, file.GetVersion(preset));
if (!binaryDir.empty()) {
if (!cmSystemTools::FileIsFullPath(binaryDir)) {
@@ -207,7 +207,7 @@ bool ExpandMacros(const cmCMakePresetsFile& file,
if (!preset.InstallDir.empty()) {
std::string installDir = preset.InstallDir;
- CHECK_EXPAND(out, installDir, macroExpanders, file.GetVersion(preset))
+ CHECK_EXPAND(out, installDir, macroExpanders, file.GetVersion(preset));
if (!cmSystemTools::FileIsFullPath(installDir)) {
installDir = cmStrCat(file.SourceDir, '/', installDir);
@@ -218,14 +218,14 @@ bool ExpandMacros(const cmCMakePresetsFile& file,
if (!preset.ToolchainFile.empty()) {
std::string toolchain = preset.ToolchainFile;
- CHECK_EXPAND(out, toolchain, macroExpanders, file.GetVersion(preset))
+ CHECK_EXPAND(out, toolchain, macroExpanders, file.GetVersion(preset));
out->ToolchainFile = toolchain;
}
for (auto& variable : out->CacheVariables) {
if (variable.second) {
CHECK_EXPAND(out, variable.second->Value, macroExpanders,
- file.GetVersion(preset))
+ file.GetVersion(preset));
}
}
@@ -237,12 +237,12 @@ bool ExpandMacros(const cmCMakePresetsFile& file, const BuildPreset& preset,
const std::vector<MacroExpander>& macroExpanders)
{
for (auto& target : out->Targets) {
- CHECK_EXPAND(out, target, macroExpanders, file.GetVersion(preset))
+ CHECK_EXPAND(out, target, macroExpanders, file.GetVersion(preset));
}
for (auto& nativeToolOption : out->NativeToolOptions) {
CHECK_EXPAND(out, nativeToolOption, macroExpanders,
- file.GetVersion(preset))
+ file.GetVersion(preset));
}
return true;
@@ -258,15 +258,15 @@ bool ExpandMacros(const cmCMakePresetsFile& file, const TestPreset& preset,
if (out->Output) {
CHECK_EXPAND(out, out->Output->OutputLogFile, macroExpanders,
- file.GetVersion(preset))
+ file.GetVersion(preset));
}
if (out->Filter) {
if (out->Filter->Include) {
CHECK_EXPAND(out, out->Filter->Include->Name, macroExpanders,
- file.GetVersion(preset))
+ file.GetVersion(preset));
CHECK_EXPAND(out, out->Filter->Include->Label, macroExpanders,
- file.GetVersion(preset))
+ file.GetVersion(preset));
if (out->Filter->Include->Index) {
CHECK_EXPAND(out, out->Filter->Include->Index->IndexFile,
@@ -276,24 +276,24 @@ bool ExpandMacros(const cmCMakePresetsFile& file, const TestPreset& preset,
if (out->Filter->Exclude) {
CHECK_EXPAND(out, out->Filter->Exclude->Name, macroExpanders,
- file.GetVersion(preset))
+ file.GetVersion(preset));
CHECK_EXPAND(out, out->Filter->Exclude->Label, macroExpanders,
- file.GetVersion(preset))
+ file.GetVersion(preset));
if (out->Filter->Exclude->Fixtures) {
CHECK_EXPAND(out, out->Filter->Exclude->Fixtures->Any, macroExpanders,
- file.GetVersion(preset))
+ file.GetVersion(preset));
CHECK_EXPAND(out, out->Filter->Exclude->Fixtures->Setup,
- macroExpanders, file.GetVersion(preset))
+ macroExpanders, file.GetVersion(preset));
CHECK_EXPAND(out, out->Filter->Exclude->Fixtures->Cleanup,
- macroExpanders, file.GetVersion(preset))
+ macroExpanders, file.GetVersion(preset));
}
}
}
if (out->Execution) {
CHECK_EXPAND(out, out->Execution->ResourceSpecFile, macroExpanders,
- file.GetVersion(preset))
+ file.GetVersion(preset));
}
return true;
@@ -898,9 +898,9 @@ cmCMakePresetsFile::ReadProjectPresetsInternal(bool allowNoFiles)
: ReadFileResult::FILE_NOT_FOUND;
}
- CHECK_OK(ComputePresetInheritance(this->ConfigurePresets, *this))
- CHECK_OK(ComputePresetInheritance(this->BuildPresets, *this))
- CHECK_OK(ComputePresetInheritance(this->TestPresets, *this))
+ CHECK_OK(ComputePresetInheritance(this->ConfigurePresets, *this));
+ CHECK_OK(ComputePresetInheritance(this->BuildPresets, *this));
+ CHECK_OK(ComputePresetInheritance(this->TestPresets, *this));
for (auto& it : this->ConfigurePresets) {
if (!ExpandMacros(*this, it.second.Unexpanded, it.second.Expanded)) {
diff --git a/Source/cmCMakePresetsFile.h b/Source/cmCMakePresetsFile.h
index 7aa9b6acc7..769fb4e2a7 100644
--- a/Source/cmCMakePresetsFile.h
+++ b/Source/cmCMakePresetsFile.h
@@ -60,18 +60,20 @@ public:
class Preset
{
public:
-#if __cplusplus < 201703L && (!defined(_MSVC_LANG) || _MSVC_LANG < 201703L)
+ Preset() = default;
+ Preset(Preset&& /*other*/) = default;
+ Preset(const Preset& /*other*/) = default;
+ Preset& operator=(const Preset& /*other*/) = default;
+ virtual ~Preset() = default;
+#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
+ Preset& operator=(Preset&& /*other*/) = default;
+#else
// The move assignment operators for several STL classes did not become
// noexcept until C++17, which causes some tools to warn about this move
- // assignment operator throwing an exception when it shouldn't. Disable the
- // move assignment operator until C++17 is enabled.
- // Explicitly defining a copy assignment operator prevents the compiler
- // from automatically generating a move assignment operator.
- Preset& operator=(const Preset& /*other*/) = default;
+ // assignment operator throwing an exception when it shouldn't.
+ Preset& operator=(Preset&& /*other*/) = delete;
#endif
- virtual ~Preset() = default;
-
std::string Name;
std::vector<std::string> Inherits;
bool Hidden;
@@ -99,14 +101,18 @@ public:
class ConfigurePreset : public Preset
{
public:
-#if __cplusplus < 201703L && (!defined(_MSVC_LANG) || _MSVC_LANG < 201703L)
+ ConfigurePreset() = default;
+ ConfigurePreset(ConfigurePreset&& /*other*/) = default;
+ ConfigurePreset(const ConfigurePreset& /*other*/) = default;
+ ConfigurePreset& operator=(const ConfigurePreset& /*other*/) = default;
+ ~ConfigurePreset() override = default;
+#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
+ ConfigurePreset& operator=(ConfigurePreset&& /*other*/) = default;
+#else
// The move assignment operators for several STL classes did not become
// noexcept until C++17, which causes some tools to warn about this move
- // assignment operator throwing an exception when it shouldn't. Disable the
- // move assignment operator until C++17 is enabled.
- // Explicitly defining a copy assignment operator prevents the compiler
- // from automatically generating a move assignment operator.
- ConfigurePreset& operator=(const ConfigurePreset& /*other*/) = default;
+ // assignment operator throwing an exception when it shouldn't.
+ ConfigurePreset& operator=(ConfigurePreset&& /*other*/) = delete;
#endif
std::string Generator;
@@ -140,14 +146,18 @@ public:
class BuildPreset : public Preset
{
public:
-#if __cplusplus < 201703L && (!defined(_MSVC_LANG) || _MSVC_LANG < 201703L)
+ BuildPreset() = default;
+ BuildPreset(BuildPreset&& /*other*/) = default;
+ BuildPreset(const BuildPreset& /*other*/) = default;
+ BuildPreset& operator=(const BuildPreset& /*other*/) = default;
+ ~BuildPreset() override = default;
+#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
+ BuildPreset& operator=(BuildPreset&& /*other*/) = default;
+#else
// The move assignment operators for several STL classes did not become
// noexcept until C++17, which causes some tools to warn about this move
- // assignment operator throwing an exception when it shouldn't. Disable the
- // move assignment operator until C++17 is enabled.
- // Explicitly defining a copy assignment operator prevents the compiler
- // from automatically generating a move assignment operator.
- BuildPreset& operator=(const BuildPreset& /*other*/) = default;
+ // assignment operator throwing an exception when it shouldn't.
+ BuildPreset& operator=(BuildPreset&& /*other*/) = delete;
#endif
std::string ConfigurePreset;
@@ -166,14 +176,18 @@ public:
class TestPreset : public Preset
{
public:
-#if __cplusplus < 201703L && (!defined(_MSVC_LANG) || _MSVC_LANG < 201703L)
+ TestPreset() = default;
+ TestPreset(TestPreset&& /*other*/) = default;
+ TestPreset(const TestPreset& /*other*/) = default;
+ TestPreset& operator=(const TestPreset& /*other*/) = default;
+ ~TestPreset() override = default;
+#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
+ TestPreset& operator=(TestPreset&& /*other*/) = default;
+#else
// The move assignment operators for several STL classes did not become
// noexcept until C++17, which causes some tools to warn about this move
- // assignment operator throwing an exception when it shouldn't. Disable the
- // move assignment operator until C++17 is enabled.
- // Explicitly defining a copy assignment operator prevents the compiler
- // from automatically generating a move assignment operator.
- TestPreset& operator=(const TestPreset& /*other*/) = default;
+ // assignment operator throwing an exception when it shouldn't.
+ TestPreset& operator=(TestPreset&& /*other*/) = delete;
#endif
struct OutputOptions
diff --git a/Source/cmCMakePresetsFileInternal.h b/Source/cmCMakePresetsFileInternal.h
index 326927612a..afb00ced96 100644
--- a/Source/cmCMakePresetsFileInternal.h
+++ b/Source/cmCMakePresetsFileInternal.h
@@ -5,11 +5,11 @@
#include "cmCMakePresetsFile.h"
#define CHECK_OK(expr) \
- { \
+ do { \
auto _result = expr; \
if (_result != ReadFileResult::READ_OK) \
return _result; \
- }
+ } while (false)
namespace cmCMakePresetsFileInternal {
enum class ExpandMacroResult
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index e460031176..9714e167f2 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -22,17 +22,17 @@
extern "C" {
-void CCONV* cmGetClientData(void* info)
+static void CCONV* cmGetClientData(void* info)
{
return ((cmLoadedCommandInfo*)info)->ClientData;
}
-void CCONV cmSetClientData(void* info, void* cd)
+static void CCONV cmSetClientData(void* info, void* cd)
{
((cmLoadedCommandInfo*)info)->ClientData = cd;
}
-void CCONV cmSetError(void* info, const char* err)
+static void CCONV cmSetError(void* info, const char* err)
{
if (((cmLoadedCommandInfo*)info)->Error) {
free(((cmLoadedCommandInfo*)info)->Error);
@@ -40,30 +40,31 @@ void CCONV cmSetError(void* info, const char* err)
((cmLoadedCommandInfo*)info)->Error = strdup(err);
}
-unsigned int CCONV cmGetCacheMajorVersion(void* arg)
+static unsigned int CCONV cmGetCacheMajorVersion(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
cmState* state = mf->GetState();
return state->GetCacheMajorVersion();
}
-unsigned int CCONV cmGetCacheMinorVersion(void* arg)
+static unsigned int CCONV cmGetCacheMinorVersion(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
cmState* state = mf->GetState();
return state->GetCacheMinorVersion();
}
-unsigned int CCONV cmGetMajorVersion(void*)
+static unsigned int CCONV cmGetMajorVersion(void*)
{
return cmVersion::GetMajorVersion();
}
-unsigned int CCONV cmGetMinorVersion(void*)
+static unsigned int CCONV cmGetMinorVersion(void*)
{
return cmVersion::GetMinorVersion();
}
-void CCONV cmAddDefinition(void* arg, const char* name, const char* value)
+static void CCONV cmAddDefinition(void* arg, const char* name,
+ const char* value)
{
if (value) {
cmMakefile* mf = static_cast<cmMakefile*>(arg);
@@ -72,8 +73,9 @@ void CCONV cmAddDefinition(void* arg, const char* name, const char* value)
}
/* Add a definition to this makefile and the global cmake cache. */
-void CCONV cmAddCacheDefinition(void* arg, const char* name, const char* value,
- const char* doc, int type)
+static void CCONV cmAddCacheDefinition(void* arg, const char* name,
+ const char* value, const char* doc,
+ int type)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
@@ -99,7 +101,7 @@ void CCONV cmAddCacheDefinition(void* arg, const char* name, const char* value,
}
}
-const char* CCONV cmGetProjectName(void* arg)
+static const char* CCONV cmGetProjectName(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
static std::string name;
@@ -107,63 +109,63 @@ const char* CCONV cmGetProjectName(void* arg)
return name.c_str();
}
-const char* CCONV cmGetHomeDirectory(void* arg)
+static const char* CCONV cmGetHomeDirectory(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
return mf->GetHomeDirectory().c_str();
}
-const char* CCONV cmGetHomeOutputDirectory(void* arg)
+static const char* CCONV cmGetHomeOutputDirectory(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
return mf->GetHomeOutputDirectory().c_str();
}
-const char* CCONV cmGetStartDirectory(void* arg)
+static const char* CCONV cmGetStartDirectory(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
return mf->GetCurrentSourceDirectory().c_str();
}
-const char* CCONV cmGetStartOutputDirectory(void* arg)
+static const char* CCONV cmGetStartOutputDirectory(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
return mf->GetCurrentBinaryDirectory().c_str();
}
-const char* CCONV cmGetCurrentDirectory(void* arg)
+static const char* CCONV cmGetCurrentDirectory(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
return mf->GetCurrentSourceDirectory().c_str();
}
-const char* CCONV cmGetCurrentOutputDirectory(void* arg)
+static const char* CCONV cmGetCurrentOutputDirectory(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
return mf->GetCurrentBinaryDirectory().c_str();
}
-const char* CCONV cmGetDefinition(void* arg, const char* def)
+static const char* CCONV cmGetDefinition(void* arg, const char* def)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
return mf->GetDefinition(def).GetCStr();
}
-int CCONV cmIsOn(void* arg, const char* name)
+static int CCONV cmIsOn(void* arg, const char* name)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
return static_cast<int>(mf->IsOn(name));
}
/** Check if a command exists. */
-int CCONV cmCommandExists(void* arg, const char* name)
+static int CCONV cmCommandExists(void* arg, const char* name)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
return static_cast<int>(mf->GetState()->GetCommand(name) ? 1 : 0);
}
-void CCONV cmAddDefineFlag(void* arg, const char* definition)
+static void CCONV cmAddDefineFlag(void* arg, const char* definition)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
mf->AddDefineFlag(definition);
}
-void CCONV cmAddLinkDirectoryForTarget(void* arg, const char* tgt,
- const char* d)
+static void CCONV cmAddLinkDirectoryForTarget(void* arg, const char* tgt,
+ const char* d)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
cmTarget* t = mf->FindLocalNonAliasTarget(tgt);
@@ -176,8 +178,8 @@ void CCONV cmAddLinkDirectoryForTarget(void* arg, const char* tgt,
t->InsertLinkDirectory(BT<std::string>(d, mf->GetBacktrace()));
}
-void CCONV cmAddExecutable(void* arg, const char* exename, int numSrcs,
- const char** srcs, int win32)
+static void CCONV cmAddExecutable(void* arg, const char* exename, int numSrcs,
+ const char** srcs, int win32)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
std::vector<std::string> srcs2;
@@ -191,10 +193,11 @@ void CCONV cmAddExecutable(void* arg, const char* exename, int numSrcs,
}
}
-void CCONV cmAddUtilityCommand(void* arg, const char* utilityName,
- const char* command, const char* arguments,
- int all, int numDepends, const char** depends,
- int, const char**)
+static void CCONV cmAddUtilityCommand(void* arg, const char* utilityName,
+ const char* command,
+ const char* arguments, int all,
+ int numDepends, const char** depends,
+ int, const char**)
{
// Get the makefile instance. Perform an extra variable expansion
// now because the API caller expects it.
@@ -220,17 +223,17 @@ void CCONV cmAddUtilityCommand(void* arg, const char* utilityName,
}
// Pass the call to the makefile instance.
- std::vector<std::string> no_byproducts;
- mf->AddUtilityCommand(utilityName, !all, nullptr, no_byproducts, depends2,
- commandLines,
- mf->GetPolicyStatus(cmPolicies::CMP0116));
+ auto cc = cm::make_unique<cmCustomCommand>();
+ cc->SetDepends(depends2);
+ cc->SetCommandLines(commandLines);
+ mf->AddUtilityCommand(utilityName, !all, std::move(cc));
}
-void CCONV cmAddCustomCommand(void* arg, const char* source,
- const char* command, int numArgs,
- const char** args, int numDepends,
- const char** depends, int numOutputs,
- const char** outputs, const char* target)
+static void CCONV cmAddCustomCommand(void* arg, const char* source,
+ const char* command, int numArgs,
+ const char** args, int numDepends,
+ const char** depends, int numOutputs,
+ const char** outputs, const char* target)
{
// Get the makefile instance. Perform an extra variable expansion
// now because the API caller expects it.
@@ -264,15 +267,15 @@ void CCONV cmAddCustomCommand(void* arg, const char* source,
// Pass the call to the makefile instance.
const char* no_comment = nullptr;
mf->AddCustomCommandOldStyle(target, outputs2, depends2, source,
- commandLines, no_comment,
- mf->GetPolicyStatus(cmPolicies::CMP0116));
+ commandLines, no_comment);
}
-void CCONV cmAddCustomCommandToOutput(void* arg, const char* output,
- const char* command, int numArgs,
- const char** args,
- const char* main_dependency,
- int numDepends, const char** depends)
+static void CCONV cmAddCustomCommandToOutput(void* arg, const char* output,
+ const char* command, int numArgs,
+ const char** args,
+ const char* main_dependency,
+ int numDepends,
+ const char** depends)
{
// Get the makefile instance. Perform an extra variable expansion
// now because the API caller expects it.
@@ -297,16 +300,17 @@ void CCONV cmAddCustomCommandToOutput(void* arg, const char* output,
}
// Pass the call to the makefile instance.
- const char* no_comment = nullptr;
- const char* no_working_dir = nullptr;
- mf->AddCustomCommandToOutput(output, depends2, main_dependency, commandLines,
- no_comment, no_working_dir,
- mf->GetPolicyStatus(cmPolicies::CMP0116));
+ auto cc = cm::make_unique<cmCustomCommand>();
+ cc->SetOutputs(output);
+ cc->SetDepends(depends2);
+ cc->SetCommandLines(commandLines);
+ mf->AddCustomCommandToOutput(main_dependency, std::move(cc));
}
-void CCONV cmAddCustomCommandToTarget(void* arg, const char* target,
- const char* command, int numArgs,
- const char** args, int commandType)
+static void CCONV cmAddCustomCommandToTarget(void* arg, const char* target,
+ const char* command, int numArgs,
+ const char** args,
+ int commandType)
{
// Get the makefile instance.
cmMakefile* mf = static_cast<cmMakefile*>(arg);
@@ -338,13 +342,9 @@ void CCONV cmAddCustomCommandToTarget(void* arg, const char* target,
}
// Pass the call to the makefile instance.
- std::vector<std::string> no_byproducts;
- std::vector<std::string> no_depends;
- const char* no_comment = nullptr;
- const char* no_working_dir = nullptr;
- mf->AddCustomCommandToTarget(target, no_byproducts, no_depends, commandLines,
- cctype, no_comment, no_working_dir,
- mf->GetPolicyStatus(cmPolicies::CMP0116));
+ auto cc = cm::make_unique<cmCustomCommand>();
+ cc->SetCommandLines(commandLines);
+ mf->AddCustomCommandToTarget(target, cctype, std::move(cc));
}
static void addLinkLibrary(cmMakefile* mf, std::string const& target,
@@ -376,8 +376,8 @@ static void addLinkLibrary(cmMakefile* mf, std::string const& target,
t->AddLinkLibrary(*mf, lib, llt);
}
-void CCONV cmAddLinkLibraryForTarget(void* arg, const char* tgt,
- const char* value, int libtype)
+static void CCONV cmAddLinkLibraryForTarget(void* arg, const char* tgt,
+ const char* value, int libtype)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
@@ -394,8 +394,8 @@ void CCONV cmAddLinkLibraryForTarget(void* arg, const char* tgt,
}
}
-void CCONV cmAddLibrary(void* arg, const char* libname, int shared,
- int numSrcs, const char** srcs)
+static void CCONV cmAddLibrary(void* arg, const char* libname, int shared,
+ int numSrcs, const char** srcs)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
std::vector<std::string> srcs2;
@@ -409,8 +409,8 @@ void CCONV cmAddLibrary(void* arg, const char* libname, int shared,
srcs2);
}
-char CCONV* cmExpandVariablesInString(void* arg, const char* source,
- int escapeQuotes, int atOnly)
+static char CCONV* cmExpandVariablesInString(void* arg, const char* source,
+ int escapeQuotes, int atOnly)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
std::string barf = source;
@@ -419,8 +419,8 @@ char CCONV* cmExpandVariablesInString(void* arg, const char* source,
return strdup(result.c_str());
}
-int CCONV cmExecuteCommand(void* arg, const char* name, int numArgs,
- const char** args)
+static int CCONV cmExecuteCommand(void* arg, const char* name, int numArgs,
+ const char** args)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
@@ -436,10 +436,10 @@ int CCONV cmExecuteCommand(void* arg, const char* name, int numArgs,
return mf->ExecuteCommand(lff, status);
}
-void CCONV cmExpandSourceListArguments(void* arg, int numArgs,
- const char** args, int* resArgc,
- char*** resArgv,
- unsigned int startArgumentIndex)
+static void CCONV cmExpandSourceListArguments(void* arg, int numArgs,
+ const char** args, int* resArgc,
+ char*** resArgv,
+ unsigned int startArgumentIndex)
{
(void)arg;
(void)startArgumentIndex;
@@ -460,7 +460,7 @@ void CCONV cmExpandSourceListArguments(void* arg, int numArgs,
*resArgv = resargv;
}
-void CCONV cmFreeArguments(int argc, char** argv)
+static void CCONV cmFreeArguments(int argc, char** argv)
{
int i;
for (i = 0; i < argc; ++i) {
@@ -469,7 +469,7 @@ void CCONV cmFreeArguments(int argc, char** argv)
free(argv);
}
-int CCONV cmGetTotalArgumentSize(int argc, char** argv)
+static int CCONV cmGetTotalArgumentSize(int argc, char** argv)
{
int i;
int result = 0;
@@ -497,19 +497,19 @@ struct cmCPluginAPISourceFile
// the CPluginAPI proxy source file.
using cmCPluginAPISourceFileMap =
std::map<cmSourceFile*, std::unique_ptr<cmCPluginAPISourceFile>>;
-cmCPluginAPISourceFileMap cmCPluginAPISourceFiles;
+static cmCPluginAPISourceFileMap cmCPluginAPISourceFiles;
-void* CCONV cmCreateSourceFile(void)
+static void* CCONV cmCreateSourceFile()
{
return new cmCPluginAPISourceFile;
}
-void* CCONV cmCreateNewSourceFile(void*)
+static void* CCONV cmCreateNewSourceFile(void*)
{
return new cmCPluginAPISourceFile;
}
-void CCONV cmDestroySourceFile(void* arg)
+static void CCONV cmDestroySourceFile(void* arg)
{
cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
// Only delete if it was created by cmCreateSourceFile or
@@ -519,7 +519,7 @@ void CCONV cmDestroySourceFile(void* arg)
}
}
-void CCONV* cmGetSource(void* arg, const char* name)
+static void CCONV* cmGetSource(void* arg, const char* name)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
if (cmSourceFile* rsf = mf->GetSource(name)) {
@@ -543,7 +543,7 @@ void CCONV* cmGetSource(void* arg, const char* name)
return nullptr;
}
-void* CCONV cmAddSource(void* arg, void* arg2)
+static void* CCONV cmAddSource(void* arg, void* arg2)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
cmCPluginAPISourceFile* osf = static_cast<cmCPluginAPISourceFile*>(arg2);
@@ -576,19 +576,19 @@ void* CCONV cmAddSource(void* arg, void* arg2)
return value;
}
-const char* CCONV cmSourceFileGetSourceName(void* arg)
+static const char* CCONV cmSourceFileGetSourceName(void* arg)
{
cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
return sf->SourceName.c_str();
}
-const char* CCONV cmSourceFileGetFullPath(void* arg)
+static const char* CCONV cmSourceFileGetFullPath(void* arg)
{
cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
return sf->FullPath.c_str();
}
-const char* CCONV cmSourceFileGetProperty(void* arg, const char* prop)
+static const char* CCONV cmSourceFileGetProperty(void* arg, const char* prop)
{
cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
if (cmSourceFile* rsf = sf->RealSourceFile) {
@@ -600,7 +600,7 @@ const char* CCONV cmSourceFileGetProperty(void* arg, const char* prop)
return sf->Properties.GetPropertyValue(prop).GetCStr();
}
-int CCONV cmSourceFileGetPropertyAsBool(void* arg, const char* prop)
+static int CCONV cmSourceFileGetPropertyAsBool(void* arg, const char* prop)
{
cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
if (cmSourceFile* rsf = sf->RealSourceFile) {
@@ -609,8 +609,8 @@ int CCONV cmSourceFileGetPropertyAsBool(void* arg, const char* prop)
return cmIsOn(cmSourceFileGetProperty(arg, prop)) ? 1 : 0;
}
-void CCONV cmSourceFileSetProperty(void* arg, const char* prop,
- const char* value)
+static void CCONV cmSourceFileSetProperty(void* arg, const char* prop,
+ const char* value)
{
cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
if (cmSourceFile* rsf = sf->RealSourceFile) {
@@ -623,7 +623,7 @@ void CCONV cmSourceFileSetProperty(void* arg, const char* prop,
}
}
-void CCONV cmSourceFileAddDepend(void* arg, const char* depend)
+static void CCONV cmSourceFileAddDepend(void* arg, const char* depend)
{
cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
if (cmSourceFile* rsf = sf->RealSourceFile) {
@@ -633,11 +633,11 @@ void CCONV cmSourceFileAddDepend(void* arg, const char* depend)
}
}
-void CCONV cmSourceFileSetName(void* arg, const char* name, const char* dir,
- int numSourceExtensions,
- const char** sourceExtensions,
- int numHeaderExtensions,
- const char** headerExtensions)
+static void CCONV cmSourceFileSetName(void* arg, const char* name,
+ const char* dir, int numSourceExtensions,
+ const char** sourceExtensions,
+ int numHeaderExtensions,
+ const char** headerExtensions)
{
cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
if (sf->RealSourceFile) {
@@ -718,8 +718,9 @@ void CCONV cmSourceFileSetName(void* arg, const char* name, const char* dir,
cmSystemTools::Error(e.str());
}
-void CCONV cmSourceFileSetName2(void* arg, const char* name, const char* dir,
- const char* ext, int headerFileOnly)
+static void CCONV cmSourceFileSetName2(void* arg, const char* name,
+ const char* dir, const char* ext,
+ int headerFileOnly)
{
cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
if (sf->RealSourceFile) {
@@ -743,48 +744,48 @@ void CCONV cmSourceFileSetName2(void* arg, const char* name, const char* dir,
sf->SourceExtension = ext;
}
-char* CCONV cmGetFilenameWithoutExtension(const char* name)
+static char* CCONV cmGetFilenameWithoutExtension(const char* name)
{
std::string sres = cmSystemTools::GetFilenameWithoutExtension(name);
return strdup(sres.c_str());
}
-char* CCONV cmGetFilenamePath(const char* name)
+static char* CCONV cmGetFilenamePath(const char* name)
{
std::string sres = cmSystemTools::GetFilenamePath(name);
return strdup(sres.c_str());
}
-char* CCONV cmCapitalized(const char* name)
+static char* CCONV cmCapitalized(const char* name)
{
std::string sres = cmSystemTools::Capitalized(name);
return strdup(sres.c_str());
}
-void CCONV cmCopyFileIfDifferent(const char* name1, const char* name2)
+static void CCONV cmCopyFileIfDifferent(const char* name1, const char* name2)
{
cmSystemTools::CopyFileIfDifferent(name1, name2);
}
-void CCONV cmRemoveFile(const char* name)
+static void CCONV cmRemoveFile(const char* name)
{
cmSystemTools::RemoveFile(name);
}
-void CCONV cmDisplayStatus(void* arg, const char* message)
+static void CCONV cmDisplayStatus(void* arg, const char* message)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
mf->DisplayStatus(message, -1);
}
-void CCONV cmFree(void* data)
+static void CCONV cmFree(void* data)
{
free(data);
}
-void CCONV DefineSourceFileProperty(void* arg, const char* name,
- const char* briefDocs,
- const char* longDocs, int chained)
+static void CCONV DefineSourceFileProperty(void* arg, const char* name,
+ const char* briefDocs,
+ const char* longDocs, int chained)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
mf->GetState()->DefineProperty(name, cmProperty::SOURCE_FILE,
@@ -794,7 +795,7 @@ void CCONV DefineSourceFileProperty(void* arg, const char* name,
} // close the extern "C" scope
-cmCAPI cmStaticCAPI = {
+static cmCAPI cmStaticCAPI = {
cmGetClientData,
cmGetTotalArgumentSize,
cmFreeArguments,
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index dfd2b6c345..647dd87247 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -227,8 +227,8 @@ struct tm* cmCTest::GetNightlyTime(std::string const& str, bool tomorrowtag)
char buf[1024];
// add todays year day and month to the time in str because
// curl_getdate no longer assumes the day is today
- sprintf(buf, "%d%02d%02d %s", lctime->tm_year + 1900, lctime->tm_mon + 1,
- lctime->tm_mday, str.c_str());
+ snprintf(buf, sizeof(buf), "%d%02d%02d %s", lctime->tm_year + 1900,
+ lctime->tm_mon + 1, lctime->tm_mday, str.c_str());
cmCTestLog(this, OUTPUT,
"Determine Nightly Start Time" << std::endl
<< " Specified time: " << str
@@ -543,9 +543,9 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
this->Impl->TomorrowTag);
}
char datestring[100];
- sprintf(datestring, "%04d%02d%02d-%02d%02d", lctime->tm_year + 1900,
- lctime->tm_mon + 1, lctime->tm_mday, lctime->tm_hour,
- lctime->tm_min);
+ snprintf(datestring, sizeof(datestring), "%04d%02d%02d-%02d%02d",
+ lctime->tm_year + 1900, lctime->tm_mon + 1, lctime->tm_mday,
+ lctime->tm_hour, lctime->tm_min);
tag = datestring;
cmsys::ofstream ofs(tagfile.c_str());
if (ofs) {
@@ -2967,8 +2967,9 @@ void cmCTest::SetStopTime(std::string const& time_str)
tzone_offset *= 100;
char buf[1024];
- sprintf(buf, "%d%02d%02d %s %+05i", lctime->tm_year + 1900,
- lctime->tm_mon + 1, lctime->tm_mday, time_str.c_str(), tzone_offset);
+ snprintf(buf, sizeof(buf), "%d%02d%02d %s %+05i", lctime->tm_year + 1900,
+ lctime->tm_mon + 1, lctime->tm_mday, time_str.c_str(),
+ tzone_offset);
time_t stop_time = curl_getdate(buf, &current_time);
if (stop_time == -1) {
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 831a81fd2b..2ff91fe17f 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -722,7 +722,7 @@ void cmComputeLinkInformation::AddItem(BT<std::string> const& item,
this->AddFrameworkItem(item.Value);
} else if (cmSystemTools::FileIsDirectory(item.Value)) {
// This is a directory.
- this->DropDirectoryItem(item.Value);
+ this->DropDirectoryItem(item);
} else {
// Use the full path given to the library file.
this->Depends.push_back(item.Value);
@@ -1349,16 +1349,17 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item)
}
}
-void cmComputeLinkInformation::DropDirectoryItem(std::string const& item)
+void cmComputeLinkInformation::DropDirectoryItem(BT<std::string> const& item)
{
// A full path to a directory was found as a link item. Warn the
// user.
- std::ostringstream e;
- e << "WARNING: Target \"" << this->Target->GetName()
- << "\" requests linking to directory \"" << item << "\". "
- << "Targets may link only to libraries. "
- << "CMake is dropping the item.";
- cmSystemTools::Message(e.str());
+ this->CMakeInstance->IssueMessage(
+ MessageType::WARNING,
+ cmStrCat(
+ "Target \"", this->Target->GetName(),
+ "\" requests linking to directory \"", item.Value,
+ "\". Targets may link only to libraries. CMake is dropping the item."),
+ item.Backtrace);
}
void cmComputeLinkInformation::ComputeFrameworkInfo()
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index 90a699ebbd..0315540be8 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -187,7 +187,7 @@ private:
bool CheckImplicitDirItem(std::string const& item);
void AddUserItem(BT<std::string> const& item, bool pathNotKnown);
void AddFrameworkItem(std::string const& item);
- void DropDirectoryItem(std::string const& item);
+ void DropDirectoryItem(BT<std::string> const& item);
bool CheckSharedLibNoSOName(std::string const& item);
void AddSharedLibNoSOName(std::string const& item);
void HandleBadFullItem(std::string const& item, std::string const& file);
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 971c86e598..84fa897795 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -699,7 +699,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
/* Use a random file name to avoid rapid creation and deletion
of the same executable name (some filesystems fail on that). */
- sprintf(targetNameBuf, "cmTC_%05x", cmSystemTools::RandomSeed() & 0xFFFFF);
+ snprintf(targetNameBuf, sizeof(targetNameBuf), "cmTC_%05x",
+ cmSystemTools::RandomSeed() & 0xFFFFF);
targetName = targetNameBuf;
if (!targets.empty()) {
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx
index ec60ff7559..f009632317 100644
--- a/Source/cmCustomCommand.cxx
+++ b/Source/cmCustomCommand.cxx
@@ -6,28 +6,19 @@
#include <cmext/algorithm>
-cmCustomCommand::cmCustomCommand(std::vector<std::string> outputs,
- std::vector<std::string> byproducts,
- std::vector<std::string> depends,
- cmCustomCommandLines commandLines,
- cmListFileBacktrace lfbt, const char* comment,
- const char* workingDirectory,
- bool stdPipesUTF8)
- : Outputs(std::move(outputs))
- , Byproducts(std::move(byproducts))
- , Depends(std::move(depends))
- , CommandLines(std::move(commandLines))
- , Backtrace(std::move(lfbt))
- , Comment(comment ? comment : "")
- , WorkingDirectory(workingDirectory ? workingDirectory : "")
- , HaveComment(comment != nullptr)
- , StdPipesUTF8(stdPipesUTF8)
+const std::vector<std::string>& cmCustomCommand::GetOutputs() const
{
+ return this->Outputs;
}
-const std::vector<std::string>& cmCustomCommand::GetOutputs() const
+void cmCustomCommand::SetOutputs(std::vector<std::string> outputs)
{
- return this->Outputs;
+ this->Outputs = std::move(outputs);
+}
+
+void cmCustomCommand::SetOutputs(std::string output)
+{
+ this->Outputs = { std::move(output) };
}
const std::vector<std::string>& cmCustomCommand::GetByproducts() const
@@ -35,22 +26,43 @@ const std::vector<std::string>& cmCustomCommand::GetByproducts() const
return this->Byproducts;
}
+void cmCustomCommand::SetByproducts(std::vector<std::string> byproducts)
+{
+ this->Byproducts = std::move(byproducts);
+}
+
const std::vector<std::string>& cmCustomCommand::GetDepends() const
{
return this->Depends;
}
+void cmCustomCommand::SetDepends(std::vector<std::string> depends)
+{
+ Depends = std::move(depends);
+}
+
const cmCustomCommandLines& cmCustomCommand::GetCommandLines() const
{
return this->CommandLines;
}
+void cmCustomCommand::SetCommandLines(cmCustomCommandLines commandLines)
+{
+ this->CommandLines = std::move(commandLines);
+}
+
const char* cmCustomCommand::GetComment() const
{
const char* no_comment = nullptr;
return this->HaveComment ? this->Comment.c_str() : no_comment;
}
+void cmCustomCommand::SetComment(const char* comment)
+{
+ this->Comment = comment ? comment : "";
+ this->HaveComment = (comment != nullptr);
+}
+
void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines)
{
cm::append(this->CommandLines, commandLines);
@@ -86,6 +98,11 @@ cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const
return this->Backtrace;
}
+void cmCustomCommand::SetBacktrace(cmListFileBacktrace lfbt)
+{
+ this->Backtrace = std::move(lfbt);
+}
+
cmImplicitDependsList const& cmCustomCommand::GetImplicitDepends() const
{
return this->ImplicitDepends;
diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h
index 5cbd3d17a9..5ae26dd0dd 100644
--- a/Source/cmCustomCommand.h
+++ b/Source/cmCustomCommand.h
@@ -25,22 +25,18 @@ class cmImplicitDependsList
class cmCustomCommand
{
public:
- /** Main constructor specifies all information for the command. */
- cmCustomCommand(std::vector<std::string> outputs,
- std::vector<std::string> byproducts,
- std::vector<std::string> depends,
- cmCustomCommandLines commandLines, cmListFileBacktrace lfbt,
- const char* comment, const char* workingDirectory,
- bool stdPipesUTF8);
-
/** Get the output file produced by the command. */
const std::vector<std::string>& GetOutputs() const;
+ void SetOutputs(std::vector<std::string> outputs);
+ void SetOutputs(std::string output);
/** Get the extra files produced by the command. */
const std::vector<std::string>& GetByproducts() const;
+ void SetByproducts(std::vector<std::string> byproducts);
/** Get the vector that holds the list of dependencies. */
const std::vector<std::string>& GetDepends() const;
+ void SetDepends(std::vector<std::string> depends);
/** Get the working directory. */
std::string const& GetWorkingDirectory() const
@@ -48,14 +44,25 @@ public:
return this->WorkingDirectory;
}
+ void SetWorkingDirectory(const char* workingDirectory)
+ {
+ this->WorkingDirectory = (workingDirectory ? workingDirectory : "");
+ }
+
/** Get the list of command lines. */
const cmCustomCommandLines& GetCommandLines() const;
+ void SetCommandLines(cmCustomCommandLines commandLines);
/** Get the comment string for the command. */
const char* GetComment() const;
+ void SetComment(const char* comment);
/** Get a value indicating if the command uses UTF-8 output pipes. */
bool GetStdPipesUTF8() const { return this->StdPipesUTF8; }
+ void SetStdPipesUTF8(bool stdPipesUTF8)
+ {
+ this->StdPipesUTF8 = stdPipesUTF8;
+ }
/** Append to the list of command lines. */
void AppendCommands(const cmCustomCommandLines& commandLines);
@@ -74,6 +81,7 @@ public:
/** Backtrace of the command that created this custom command. */
cmListFileBacktrace const& GetBacktrace() const;
+ void SetBacktrace(cmListFileBacktrace lfbt);
void SetImplicitDepends(cmImplicitDependsList const&);
void AppendImplicitDepends(cmImplicitDependsList const&);
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index fd0a63c295..41d4442f15 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -346,7 +346,7 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
return this->CommandLines[c][0];
}
-std::string escapeForShellOldStyle(const std::string& str)
+static std::string escapeForShellOldStyle(const std::string& str)
{
std::string result;
#if defined(_WIN32) && !defined(__CYGWIN__)
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 1678ce8c6e..66f173329b 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -26,17 +26,14 @@ template <size_t s>
struct cmELFByteSwapSize
{
};
-void cmELFByteSwap(char* /*unused*/, cmELFByteSwapSize<1> /*unused*/)
-{
-}
-void cmELFByteSwap(char* data, cmELFByteSwapSize<2> /*unused*/)
+static void cmELFByteSwap(char* data, cmELFByteSwapSize<2> /*unused*/)
{
char one_byte;
one_byte = data[0];
data[0] = data[1];
data[1] = one_byte;
}
-void cmELFByteSwap(char* data, cmELFByteSwapSize<4> /*unused*/)
+static void cmELFByteSwap(char* data, cmELFByteSwapSize<4> /*unused*/)
{
char one_byte;
one_byte = data[0];
@@ -46,7 +43,7 @@ void cmELFByteSwap(char* data, cmELFByteSwapSize<4> /*unused*/)
data[1] = data[2];
data[2] = one_byte;
}
-void cmELFByteSwap(char* data, cmELFByteSwapSize<8> /*unused*/)
+static void cmELFByteSwap(char* data, cmELFByteSwapSize<8> /*unused*/)
{
char one_byte;
one_byte = data[0];
diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx
index 51fb2191a5..e069b7712a 100644
--- a/Source/cmExecProgramCommand.cxx
+++ b/Source/cmExecProgramCommand.cxx
@@ -114,7 +114,7 @@ bool cmExecProgramCommand(std::vector<std::string> const& args,
if (!return_variable.empty()) {
char buffer[100];
- sprintf(buffer, "%d", retVal);
+ snprintf(buffer, sizeof(buffer), "%d", retVal);
status.GetMakefile().AddDefinition(return_variable, buffer);
}
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index ffcc415a1b..3b990ccbbf 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -318,7 +318,7 @@ bool cmExecuteProcessCommand(std::vector<std::string> const& args,
case cmsysProcess_State_Exited: {
int v = cmsysProcess_GetExitValue(cp);
char buf[16];
- sprintf(buf, "%d", v);
+ snprintf(buf, sizeof(buf), "%d", v);
status.GetMakefile().AddDefinition(arguments.ResultVariable, buf);
} break;
case cmsysProcess_State_Exception:
@@ -346,7 +346,7 @@ bool cmExecuteProcessCommand(std::vector<std::string> const& args,
int exitCode =
cmsysProcess_GetExitValueByIndex(cp, static_cast<int>(i));
char buf[16];
- sprintf(buf, "%d", exitCode);
+ snprintf(buf, sizeof(buf), "%d", exitCode);
res.emplace_back(buf);
} break;
case kwsysProcess_StateByIndex_Exception:
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index aa968dc389..a47f1e5adf 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -11,12 +11,15 @@
#include <cmext/algorithm>
#include "cmExportSet.h"
+#include "cmFileSet.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
+#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmOutputConverter.h"
#include "cmPolicies.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
@@ -135,6 +138,8 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
this->PopulateCompatibleInterfaceProperties(gte, properties);
this->GenerateInterfaceProperties(gte, os, properties);
+
+ this->GenerateTargetFileSets(gte, os);
}
// Generate import file content for each configuration.
@@ -356,3 +361,17 @@ std::string cmExportBuildFileGenerator::InstallNameDir(
return install_name_dir;
}
+
+std::string cmExportBuildFileGenerator::GetFileSetDirectories(
+ cmGeneratorTarget* /*gte*/, cmFileSet* fileSet, cmTargetExport* /*te*/)
+{
+ return cmOutputConverter::EscapeForCMake(
+ cmJoin(fileSet->GetDirectoryEntries(), ";"));
+}
+
+std::string cmExportBuildFileGenerator::GetFileSetFiles(
+ cmGeneratorTarget* /*gte*/, cmFileSet* fileSet, cmTargetExport* /*te*/)
+{
+ return cmOutputConverter::EscapeForCMake(
+ cmJoin(fileSet->GetFileEntries(), ";"));
+}
diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h
index 244f526db1..a7985c713c 100644
--- a/Source/cmExportBuildFileGenerator.h
+++ b/Source/cmExportBuildFileGenerator.h
@@ -15,9 +15,11 @@
#include "cmStateTypes.h"
class cmExportSet;
+class cmFileSet;
class cmGeneratorTarget;
class cmGlobalGenerator;
class cmLocalGenerator;
+class cmTargetExport;
/** \class cmExportBuildFileGenerator
* \brief Generate a file exporting targets from a build tree.
@@ -76,6 +78,11 @@ protected:
std::string InstallNameDir(cmGeneratorTarget const* target,
const std::string& config) override;
+ std::string GetFileSetDirectories(cmGeneratorTarget* gte, cmFileSet* fileSet,
+ cmTargetExport* te) override;
+ std::string GetFileSetFiles(cmGeneratorTarget* gte, cmFileSet* fileSet,
+ cmTargetExport* te) override;
+
std::pair<std::vector<std::string>, std::string> FindBuildExportInfo(
cmGlobalGenerator* gg, const std::string& name);
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 8ca9a66cd1..896240cad7 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -12,6 +12,7 @@
#include "cmsys/FStream.hxx"
#include "cmComputeLinkInformation.h"
+#include "cmFileSet.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
@@ -494,8 +495,9 @@ void cmExportFileGenerator::PopulateInterfaceProperty(
properties, missingTargets);
}
-void getPropertyContents(cmGeneratorTarget const* tgt, const std::string& prop,
- std::set<std::string>& ifaceProperties)
+static void getPropertyContents(cmGeneratorTarget const* tgt,
+ const std::string& prop,
+ std::set<std::string>& ifaceProperties)
{
cmValue p = tgt->GetProperty(prop);
if (!p) {
@@ -505,9 +507,9 @@ void getPropertyContents(cmGeneratorTarget const* tgt, const std::string& prop,
ifaceProperties.insert(content.begin(), content.end());
}
-void getCompatibleInterfaceProperties(cmGeneratorTarget const* target,
- std::set<std::string>& ifaceProperties,
- const std::string& config)
+static void getCompatibleInterfaceProperties(
+ cmGeneratorTarget const* target, std::set<std::string>& ifaceProperties,
+ const std::string& config)
{
if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
// object libraries have no link information, so nothing to compute
@@ -924,13 +926,13 @@ void cmExportFileGenerator::GeneratePolicyHeaderCode(std::ostream& os)
// 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.20 (this upper limit may be reviewed
+ // policy settings for up to CMake 3.21 (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.6...3.20)\n";
+ << "cmake_policy(VERSION 2.6...3.21)\n";
/* clang-format on */
}
@@ -1072,6 +1074,12 @@ void cmExportFileGenerator::GenerateImportTargetCode(
os << "set_property(TARGET " << targetName << " PROPERTY DEPRECATION "
<< cmExportFileGeneratorEscape(target->GetDeprecation()) << ")\n";
}
+
+ if (target->GetPropertyAsBool("IMPORTED_NO_SYSTEM")) {
+ os << "set_property(TARGET " << targetName
+ << " PROPERTY IMPORTED_NO_SYSTEM 1)\n";
+ }
+
os << "\n";
}
@@ -1249,3 +1257,39 @@ bool cmExportFileGenerator::PopulateExportProperties(
}
return true;
}
+
+void cmExportFileGenerator::GenerateTargetFileSets(cmGeneratorTarget* gte,
+ std::ostream& os,
+ cmTargetExport* te)
+{
+ auto interfaceFileSets = gte->Target->GetAllInterfaceFileSets();
+ if (!interfaceFileSets.empty()) {
+ std::string targetName = cmStrCat(this->Namespace, gte->GetExportName());
+ os << "if(NOT CMAKE_VERSION VERSION_LESS \"" << DEVEL_CMAKE_VERSION(3, 23)
+ << "\")\n"
+ " target_sources("
+ << targetName << "\n";
+
+ for (auto const& name : interfaceFileSets) {
+ auto* fileSet = gte->Target->GetFileSet(name);
+ if (!fileSet) {
+ gte->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("File set \"", name,
+ "\" is listed in interface file sets of ", gte->GetName(),
+ " but has not been created"));
+ return;
+ }
+
+ os << " INTERFACE"
+ << "\n FILE_SET " << cmOutputConverter::EscapeForCMake(name)
+ << "\n TYPE "
+ << cmOutputConverter::EscapeForCMake(fileSet->GetType())
+ << "\n BASE_DIRS "
+ << this->GetFileSetDirectories(gte, fileSet, te) << "\n FILES "
+ << this->GetFileSetFiles(gte, fileSet, te) << "\n";
+ }
+
+ os << " )\nendif()\n\n";
+ }
+}
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index 24e048bca2..58752470bc 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -15,7 +15,9 @@
#include "cmVersion.h"
#include "cmVersionConfig.h"
+class cmFileSet;
class cmGeneratorTarget;
+class cmTargetExport;
#define STRINGIFY_HELPER(X) #X
#define STRINGIFY(X) STRINGIFY_HELPER(X)
@@ -184,6 +186,16 @@ protected:
ImportPropertyMap& properties,
std::string& errorMessage);
+ void GenerateTargetFileSets(cmGeneratorTarget* gte, std::ostream& os,
+ cmTargetExport* te = nullptr);
+
+ virtual std::string GetFileSetDirectories(cmGeneratorTarget* gte,
+ cmFileSet* fileSet,
+ cmTargetExport* te) = 0;
+ virtual std::string GetFileSetFiles(cmGeneratorTarget* gte,
+ cmFileSet* fileSet,
+ cmTargetExport* te) = 0;
+
// The namespace in which the exports are placed in the generated file.
std::string Namespace;
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index e9ac8752fe..2dd8b8fe27 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -2,19 +2,23 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExportInstallFileGenerator.h"
+#include <algorithm>
#include <memory>
#include <sstream>
#include <utility>
#include "cmExportSet.h"
+#include "cmFileSet.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmInstallExportGenerator.h"
+#include "cmInstallFileSetGenerator.h"
#include "cmInstallTargetGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmOutputConverter.h"
#include "cmPolicies.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
@@ -147,6 +151,8 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
this->PopulateCompatibleInterfaceProperties(gt, properties);
this->GenerateInterfaceProperties(gt, os, properties);
+
+ this->GenerateTargetFileSets(gt, os, te);
}
if (require3_1_0) {
@@ -534,3 +540,102 @@ std::string cmExportInstallFileGenerator::InstallNameDir(
return install_name_dir;
}
+
+namespace {
+bool EntryIsContextSensitive(
+ const std::unique_ptr<cmCompiledGeneratorExpression>& cge)
+{
+ return cge->GetHadContextSensitiveCondition();
+}
+}
+
+std::string cmExportInstallFileGenerator::GetFileSetDirectories(
+ cmGeneratorTarget* gte, cmFileSet* fileSet, cmTargetExport* te)
+{
+ std::vector<std::string> resultVector;
+
+ auto configs =
+ gte->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
+
+ cmGeneratorExpression ge;
+ auto cge = ge.Parse(te->FileSetGenerators.at(fileSet)->GetDestination());
+
+ for (auto const& config : configs) {
+ auto dest = cmStrCat("${_IMPORT_PREFIX}/",
+ cmOutputConverter::EscapeForCMake(
+ cge->Evaluate(gte->LocalGenerator, config, gte),
+ cmOutputConverter::WrapQuotes::NoWrap));
+
+ if (cge->GetHadContextSensitiveCondition() && configs.size() != 1) {
+ resultVector.push_back(
+ cmStrCat("\"$<$<CONFIG:", config, ">:", dest, ">\""));
+ } else {
+ resultVector.push_back(cmStrCat('"', dest, '"'));
+ break;
+ }
+ }
+
+ return cmJoin(resultVector, " ");
+}
+
+std::string cmExportInstallFileGenerator::GetFileSetFiles(
+ cmGeneratorTarget* gte, cmFileSet* fileSet, cmTargetExport* te)
+{
+ std::vector<std::string> resultVector;
+
+ auto configs =
+ gte->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
+
+ auto fileEntries = fileSet->CompileFileEntries();
+ auto directoryEntries = fileSet->CompileDirectoryEntries();
+
+ cmGeneratorExpression destGe;
+ auto destCge =
+ destGe.Parse(te->FileSetGenerators.at(fileSet)->GetDestination());
+
+ for (auto const& config : configs) {
+ auto directories = fileSet->EvaluateDirectoryEntries(
+ directoryEntries, gte->LocalGenerator, config, gte);
+
+ std::map<std::string, std::vector<std::string>> files;
+ for (auto const& entry : fileEntries) {
+ fileSet->EvaluateFileEntry(directories, files, entry,
+ gte->LocalGenerator, config, gte);
+ }
+ auto dest = cmStrCat("${_IMPORT_PREFIX}/",
+ cmOutputConverter::EscapeForCMake(
+ destCge->Evaluate(gte->LocalGenerator, config, gte),
+ cmOutputConverter::WrapQuotes::NoWrap),
+ '/');
+
+ bool const contextSensitive = destCge->GetHadContextSensitiveCondition() ||
+ std::any_of(directoryEntries.begin(), directoryEntries.end(),
+ EntryIsContextSensitive) ||
+ std::any_of(fileEntries.begin(), fileEntries.end(),
+ EntryIsContextSensitive);
+
+ for (auto const& it : files) {
+ auto prefix = it.first.empty() ? "" : cmStrCat(it.first, '/');
+ for (auto const& filename : it.second) {
+ auto relFile =
+ cmStrCat(prefix, cmSystemTools::GetFilenameName(filename));
+ auto escapedFile =
+ cmStrCat(dest,
+ cmOutputConverter::EscapeForCMake(
+ relFile, cmOutputConverter::WrapQuotes::NoWrap));
+ if (contextSensitive && configs.size() != 1) {
+ resultVector.push_back(
+ cmStrCat("\"$<$<CONFIG:", config, ">:", escapedFile, ">\""));
+ } else {
+ resultVector.push_back(cmStrCat('"', escapedFile, '"'));
+ }
+ }
+ }
+
+ if (!(contextSensitive && configs.size() != 1)) {
+ break;
+ }
+ }
+
+ return cmJoin(resultVector, " ");
+}
diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h
index 5cec2e05ec..9374c6b1ed 100644
--- a/Source/cmExportInstallFileGenerator.h
+++ b/Source/cmExportInstallFileGenerator.h
@@ -14,6 +14,7 @@
#include "cmExportFileGenerator.h"
#include "cmStateTypes.h"
+class cmFileSet;
class cmGeneratorTarget;
class cmGlobalGenerator;
class cmInstallExportGenerator;
@@ -97,6 +98,11 @@ protected:
std::string InstallNameDir(cmGeneratorTarget const* target,
const std::string& config) override;
+ std::string GetFileSetDirectories(cmGeneratorTarget* gte, cmFileSet* fileSet,
+ cmTargetExport* te) override;
+ std::string GetFileSetFiles(cmGeneratorTarget* gte, cmFileSet* fileSet,
+ cmTargetExport* te) override;
+
cmInstallExportGenerator* IEGen;
// The import file generated for each configuration.
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index cbe3c4dc7d..4fe92c696c 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -7,17 +7,22 @@
#include <cm/memory>
+#include "cmFileSet.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorExpressionDAGChecker.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
+#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmOutputConverter.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmTarget.h"
#include "cmValue.h"
+class cmTargetExport;
+
cmExportTryCompileFileGenerator::cmExportTryCompileFileGenerator(
cmGlobalGenerator* gg, const std::vector<std::string>& targets,
cmMakefile* mf, std::set<std::string> const& langs)
@@ -137,3 +142,17 @@ std::string cmExportTryCompileFileGenerator::InstallNameDir(
return install_name_dir;
}
+
+std::string cmExportTryCompileFileGenerator::GetFileSetDirectories(
+ cmGeneratorTarget* /*gte*/, cmFileSet* fileSet, cmTargetExport* /*te*/)
+{
+ return cmOutputConverter::EscapeForCMake(
+ cmJoin(fileSet->GetDirectoryEntries(), ";"));
+}
+
+std::string cmExportTryCompileFileGenerator::GetFileSetFiles(
+ cmGeneratorTarget* /*gte*/, cmFileSet* fileSet, cmTargetExport* /*te*/)
+{
+ return cmOutputConverter::EscapeForCMake(
+ cmJoin(fileSet->GetFileEntries(), ";"));
+}
diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h
index 127b8df151..8a1fd7e3af 100644
--- a/Source/cmExportTryCompileFileGenerator.h
+++ b/Source/cmExportTryCompileFileGenerator.h
@@ -11,9 +11,11 @@
#include "cmExportFileGenerator.h"
+class cmFileSet;
class cmGeneratorTarget;
class cmGlobalGenerator;
class cmMakefile;
+class cmTargetExport;
class cmExportTryCompileFileGenerator : public cmExportFileGenerator
{
@@ -48,6 +50,13 @@ protected:
std::string InstallNameDir(cmGeneratorTarget const* target,
const std::string& config) override;
+ std::string GetFileSetDirectories(cmGeneratorTarget* target,
+ cmFileSet* fileSet,
+ cmTargetExport* te) override;
+
+ std::string GetFileSetFiles(cmGeneratorTarget* target, cmFileSet* fileSet,
+ cmTargetExport* te) override;
+
private:
std::string FindTargets(const std::string& prop,
const cmGeneratorTarget* tgt,
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index e2c54d77e9..988c5c3d55 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -677,6 +677,12 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf)
} else {
compiler = "pgi"; // does not exist as default in CodeBlocks 16.01
}
+ } else if (compilerId == "LCC") {
+ if (pureFortran) {
+ compiler = "lfortran";
+ } else {
+ compiler = "lcc";
+ }
} else if (compilerId == "GNU") {
if (pureFortran) {
compiler = "gfortran";
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index fa93b04d2e..19e87d52f8 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -435,8 +435,7 @@ std::string cmExtraSublimeTextGenerator::ComputeIncludes(
lg->GetIncludeDirectories(includes, target, language, config);
std::string includesString =
- lg->GetIncludeFlags(includes, target, language, config, false,
- cmLocalGenerator::IncludePathStyle::Absolute);
+ lg->GetIncludeFlags(includes, target, language, config, false);
return includesString;
}
diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index 77d57957cd..47dd7095d1 100644
--- a/Source/cmFLTKWrapUICommand.cxx
+++ b/Source/cmFLTKWrapUICommand.cxx
@@ -3,14 +3,17 @@
#include "cmFLTKWrapUICommand.h"
#include <cstddef>
+#include <utility>
+#include <cm/memory>
+
+#include "cmCustomCommand.h"
#include "cmCustomCommandLines.h"
#include "cmExecutionStatus.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
-#include "cmPolicies.h"
#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmStringAlgorithms.h"
@@ -96,14 +99,17 @@ bool cmFLTKWrapUICommand(std::vector<std::string> const& args,
// Add command for generating the .h and .cxx files
std::string no_main_dependency;
- const char* no_comment = nullptr;
- const char* no_working_dir = nullptr;
- mf.AddCustomCommandToOutput(cxxres, depends, no_main_dependency,
- commandLines, no_comment, no_working_dir,
- mf.GetPolicyStatus(cmPolicies::CMP0116));
- mf.AddCustomCommandToOutput(hname, depends, no_main_dependency,
- commandLines, no_comment, no_working_dir,
- mf.GetPolicyStatus(cmPolicies::CMP0116));
+
+ auto hcc = cm::make_unique<cmCustomCommand>();
+ hcc->SetDepends(depends);
+ hcc->SetCommandLines(commandLines);
+ auto ccc = cm::make_unique<cmCustomCommand>(*hcc);
+
+ hcc->SetOutputs(cxxres);
+ mf.AddCustomCommandToOutput(no_main_dependency, std::move(hcc));
+
+ ccc->SetOutputs(hname);
+ mf.AddCustomCommandToOutput(no_main_dependency, std::move(ccc));
cmSourceFile* sf = mf.GetSource(cxxres);
sf->AddDepend(hname);
diff --git a/Source/cmFileAPI.cxx b/Source/cmFileAPI.cxx
index d529f5268e..c1df992ccb 100644
--- a/Source/cmFileAPI.cxx
+++ b/Source/cmFileAPI.cxx
@@ -686,7 +686,8 @@ std::string cmFileAPI::NoSupportedVersion(
// The "codemodel" object kind.
-static unsigned int const CodeModelV2Minor = 3;
+// Update Help/manual/cmake-file-api.7.rst when updating this constant.
+static unsigned int const CodeModelV2Minor = 4;
void cmFileAPI::BuildClientRequestCodeModel(
ClientRequest& r, std::vector<RequestVersion> const& versions)
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 147181e3f0..40e1d2e37a 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -23,11 +23,13 @@
#include "cmCryptoHash.h"
#include "cmExportSet.h"
#include "cmFileAPI.h"
+#include "cmFileSet.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmInstallDirectoryGenerator.h"
#include "cmInstallExportGenerator.h"
+#include "cmInstallFileSetGenerator.h"
#include "cmInstallFilesGenerator.h"
#include "cmInstallGenerator.h"
#include "cmInstallGetRuntimeDependenciesGenerator.h"
@@ -1043,6 +1045,53 @@ Json::Value DirectoryObject::DumpInstaller(cmInstallGenerator* gen)
installer["runtimeDependencySetType"] = "library";
break;
}
+ } else if (auto* installFileSet =
+ dynamic_cast<cmInstallFileSetGenerator*>(gen)) {
+ installer["type"] = "fileSet";
+ installer["destination"] = installFileSet->GetDestination(this->Config);
+
+ auto* fileSet = installFileSet->GetFileSet();
+ auto* target = installFileSet->GetTarget();
+
+ auto dirCges = fileSet->CompileDirectoryEntries();
+ auto dirs = fileSet->EvaluateDirectoryEntries(
+ dirCges, target->GetLocalGenerator(), this->Config, target);
+
+ auto entryCges = fileSet->CompileFileEntries();
+ std::map<std::string, std::vector<std::string>> entries;
+ for (auto const& entryCge : entryCges) {
+ fileSet->EvaluateFileEntry(dirs, entries, entryCge,
+ target->GetLocalGenerator(), this->Config,
+ target);
+ }
+
+ Json::Value files = Json::arrayValue;
+ for (auto const& it : entries) {
+ auto dir = it.first;
+ if (!dir.empty()) {
+ dir += '/';
+ }
+ for (auto const& file : it.second) {
+ files.append(this->DumpInstallerPath(
+ this->TopSource, file,
+ cmStrCat(dir, cmSystemTools::GetFilenameName(file))));
+ }
+ }
+ installer["paths"] = std::move(files);
+ installer["fileSetName"] = fileSet->GetName();
+ installer["fileSetType"] = fileSet->GetType();
+ installer["fileSetDirectories"] = Json::arrayValue;
+ for (auto const& dir : dirs) {
+ installer["fileSetDirectories"].append(
+ RelativeIfUnder(this->TopSource, dir));
+ }
+ installer["fileSetTarget"] = Json::objectValue;
+ installer["fileSetTarget"]["id"] = TargetId(target, this->TopBuild);
+ installer["fileSetTarget"]["index"] = this->TargetIndexMap[target];
+
+ if (installFileSet->GetOptional()) {
+ installer["isOptional"] = true;
+ }
}
// Add fields common to all install generators.
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index fd0595d88e..338f3c9121 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -217,7 +217,7 @@ bool HandleReadCommand(std::vector<std::string> const& args,
char c;
while ((sizeLimit != 0) && (file.get(c))) {
char hex[4];
- sprintf(hex, "%.2x", c & 0xff);
+ snprintf(hex, sizeof(hex), "%.2x", c & 0xff);
output += hex;
if (sizeLimit > 0) {
sizeLimit--;
@@ -1627,8 +1627,9 @@ size_t cmFileCommandCurlDebugCallback(CURL*, curl_infotype type, char* chPtr,
case CURLINFO_SSL_DATA_IN:
case CURLINFO_SSL_DATA_OUT: {
char buf[128];
- int n = sprintf(buf, "[%" KWIML_INT_PRIu64 " bytes data]\n",
- static_cast<KWIML_INT_uint64_t>(size));
+ int n =
+ snprintf(buf, sizeof(buf), "[%" KWIML_INT_PRIu64 " bytes data]\n",
+ static_cast<KWIML_INT_uint64_t>(size));
if (n > 0) {
cm::append(vec, buf, buf + n);
}
diff --git a/Source/cmFileLockResult.cxx b/Source/cmFileLockResult.cxx
index 9d5a6c67af..70b8cdbdd6 100644
--- a/Source/cmFileLockResult.cxx
+++ b/Source/cmFileLockResult.cxx
@@ -5,7 +5,6 @@
#include <cerrno>
#include <cstring>
-#define WINMSG_BUF_LEN (1024)
cmFileLockResult cmFileLockResult::MakeOk()
{
return { OK, 0 };
@@ -54,6 +53,7 @@ std::string cmFileLockResult::GetOutputMessage() const
case SYSTEM:
#if defined(_WIN32)
{
+# define WINMSG_BUF_LEN (1024)
char winmsg[WINMSG_BUF_LEN];
DWORD flags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS;
if (FormatMessageA(flags, NULL, this->ErrorValue,
diff --git a/Source/cmFileSet.cxx b/Source/cmFileSet.cxx
new file mode 100644
index 0000000000..08d56ba1aa
--- /dev/null
+++ b/Source/cmFileSet.cxx
@@ -0,0 +1,151 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cmFileSet.h"
+
+#include <sstream>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "cmGeneratorExpression.h"
+#include "cmListFileCache.h"
+#include "cmLocalGenerator.h"
+#include "cmMessageType.h"
+#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
+#include "cmake.h"
+
+cmFileSet::cmFileSet(std::string name, std::string type)
+ : Name(std::move(name))
+ , Type(std::move(type))
+{
+}
+
+void cmFileSet::ClearDirectoryEntries()
+{
+ this->DirectoryEntries.clear();
+}
+
+void cmFileSet::AddDirectoryEntry(BT<std::string> directories)
+{
+ this->DirectoryEntries.push_back(std::move(directories));
+}
+
+void cmFileSet::ClearFileEntries()
+{
+ this->FileEntries.clear();
+}
+
+void cmFileSet::AddFileEntry(BT<std::string> files)
+{
+ this->FileEntries.push_back(std::move(files));
+}
+
+std::vector<std::unique_ptr<cmCompiledGeneratorExpression>>
+cmFileSet::CompileFileEntries() const
+{
+ std::vector<std::unique_ptr<cmCompiledGeneratorExpression>> result;
+
+ for (auto const& entry : this->FileEntries) {
+ for (auto const& ex : cmExpandedList(entry.Value)) {
+ cmGeneratorExpression ge(entry.Backtrace);
+ auto cge = ge.Parse(ex);
+ result.push_back(std::move(cge));
+ }
+ }
+
+ return result;
+}
+
+std::vector<std::unique_ptr<cmCompiledGeneratorExpression>>
+cmFileSet::CompileDirectoryEntries() const
+{
+ std::vector<std::unique_ptr<cmCompiledGeneratorExpression>> result;
+
+ for (auto const& entry : this->DirectoryEntries) {
+ for (auto const& ex : cmExpandedList(entry.Value)) {
+ cmGeneratorExpression ge(entry.Backtrace);
+ auto cge = ge.Parse(ex);
+ result.push_back(std::move(cge));
+ }
+ }
+
+ return result;
+}
+
+std::vector<std::string> cmFileSet::EvaluateDirectoryEntries(
+ const std::vector<std::unique_ptr<cmCompiledGeneratorExpression>>& cges,
+ cmLocalGenerator* lg, const std::string& config,
+ const cmGeneratorTarget* target,
+ cmGeneratorExpressionDAGChecker* dagChecker) const
+{
+ std::vector<std::string> result;
+ for (auto const& cge : cges) {
+ auto entry = cge->Evaluate(lg, config, target, dagChecker);
+ auto dirs = cmExpandedList(entry);
+ for (std::string dir : dirs) {
+ if (!cmSystemTools::FileIsFullPath(dir)) {
+ dir = cmStrCat(lg->GetCurrentSourceDirectory(), '/', dir);
+ }
+ auto collapsedDir = cmSystemTools::CollapseFullPath(dir);
+ for (auto const& priorDir : result) {
+ auto collapsedPriorDir = cmSystemTools::CollapseFullPath(priorDir);
+ if (!cmSystemTools::SameFile(collapsedDir, collapsedPriorDir) &&
+ (cmSystemTools::IsSubDirectory(collapsedDir, collapsedPriorDir) ||
+ cmSystemTools::IsSubDirectory(collapsedPriorDir, collapsedDir))) {
+ lg->GetCMakeInstance()->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat(
+ "Base directories in file set cannot be subdirectories of each "
+ "other:\n ",
+ priorDir, "\n ", dir),
+ cge->GetBacktrace());
+ return {};
+ }
+ }
+ result.push_back(dir);
+ }
+ }
+ return result;
+}
+
+void cmFileSet::EvaluateFileEntry(
+ const std::vector<std::string>& dirs,
+ std::map<std::string, std::vector<std::string>>& filesPerDir,
+ const std::unique_ptr<cmCompiledGeneratorExpression>& cge,
+ cmLocalGenerator* lg, const std::string& config,
+ const cmGeneratorTarget* target,
+ cmGeneratorExpressionDAGChecker* dagChecker) const
+{
+ auto files = cge->Evaluate(lg, config, target, dagChecker);
+ for (std::string file : cmExpandedList(files)) {
+ if (!cmSystemTools::FileIsFullPath(file)) {
+ file = cmStrCat(lg->GetCurrentSourceDirectory(), '/', file);
+ }
+ auto collapsedFile = cmSystemTools::CollapseFullPath(file);
+ bool found = false;
+ std::string relDir;
+ for (auto const& dir : dirs) {
+ auto collapsedDir = cmSystemTools::CollapseFullPath(dir);
+ if (cmSystemTools::IsSubDirectory(collapsedFile, collapsedDir)) {
+ found = true;
+ relDir = cmSystemTools::GetParentDirectory(
+ cmSystemTools::RelativePath(collapsedDir, collapsedFile));
+ break;
+ }
+ }
+ if (!found) {
+ std::ostringstream e;
+ e << "File:\n " << file
+ << "\nmust be in one of the file set's base directories:";
+ for (auto const& dir : dirs) {
+ e << "\n " << dir;
+ }
+ lg->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, e.str(),
+ cge->GetBacktrace());
+ return;
+ }
+
+ filesPerDir[relDir].push_back(file);
+ }
+}
diff --git a/Source/cmFileSet.h b/Source/cmFileSet.h
new file mode 100644
index 0000000000..5ee4a98bae
--- /dev/null
+++ b/Source/cmFileSet.h
@@ -0,0 +1,64 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#pragma once
+
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "cmListFileCache.h"
+
+class cmCompiledGeneratorExpression;
+struct cmGeneratorExpressionDAGChecker;
+class cmGeneratorTarget;
+class cmLocalGenerator;
+
+class cmFileSet
+{
+public:
+ cmFileSet(std::string name, std::string type);
+
+ const std::string& GetName() const { return this->Name; }
+ const std::string& GetType() const { return this->Type; }
+
+ void ClearDirectoryEntries();
+ void AddDirectoryEntry(BT<std::string> directories);
+ const std::vector<BT<std::string>>& GetDirectoryEntries() const
+ {
+ return this->DirectoryEntries;
+ }
+
+ void ClearFileEntries();
+ void AddFileEntry(BT<std::string> files);
+ const std::vector<BT<std::string>>& GetFileEntries() const
+ {
+ return this->FileEntries;
+ }
+
+ std::vector<std::unique_ptr<cmCompiledGeneratorExpression>>
+ CompileFileEntries() const;
+
+ std::vector<std::unique_ptr<cmCompiledGeneratorExpression>>
+ CompileDirectoryEntries() const;
+
+ std::vector<std::string> EvaluateDirectoryEntries(
+ const std::vector<std::unique_ptr<cmCompiledGeneratorExpression>>& cges,
+ cmLocalGenerator* lg, const std::string& config,
+ const cmGeneratorTarget* target,
+ cmGeneratorExpressionDAGChecker* dagChecker = nullptr) const;
+
+ void EvaluateFileEntry(
+ const std::vector<std::string>& dirs,
+ std::map<std::string, std::vector<std::string>>& filesPerDir,
+ const std::unique_ptr<cmCompiledGeneratorExpression>& cge,
+ cmLocalGenerator* lg, const std::string& config,
+ const cmGeneratorTarget* target,
+ cmGeneratorExpressionDAGChecker* dagChecker = nullptr) const;
+
+private:
+ std::string Name;
+ std::string Type;
+ std::vector<BT<std::string>> DirectoryEntries;
+ std::vector<BT<std::string>> FileEntries;
+};
diff --git a/Source/cmFileTime.h b/Source/cmFileTime.h
index 4419880658..ccc963340c 100644
--- a/Source/cmFileTime.h
+++ b/Source/cmFileTime.h
@@ -24,6 +24,8 @@ public:
#endif
cmFileTime() = default;
~cmFileTime() = default;
+ cmFileTime(const cmFileTime&) = default;
+ cmFileTime& operator=(const cmFileTime&) = default;
/**
* @brief Loads the file time of fileName from the file system
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index bdc9207727..70d59c21ce 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -240,14 +240,20 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
std::vector<std::string> unrootedPaths = paths;
paths.clear();
+ auto isSameDirectoryOrSubDirectory = [](std::string const& l,
+ std::string const& r) {
+ return (cmSystemTools::GetRealPath(l) == cmSystemTools::GetRealPath(r)) ||
+ cmSystemTools::IsSubDirectory(l, r);
+ };
+
for (std::string const& r : roots) {
for (std::string const& up : unrootedPaths) {
// Place the unrooted path under the current root if it is not
// already inside. Skip the unrooted path if it is relative to
// a user home directory or is empty.
std::string rootedDir;
- if (cmSystemTools::IsSubDirectory(up, r) ||
- (stagePrefix && cmSystemTools::IsSubDirectory(up, *stagePrefix))) {
+ if (isSameDirectoryOrSubDirectory(up, r) ||
+ (stagePrefix && isSameDirectoryOrSubDirectory(up, *stagePrefix))) {
rootedDir = up;
} else if (!up.empty() && up[0] != '~') {
// Start with the new root.
@@ -347,7 +353,7 @@ void cmFindCommon::AddPathSuffix(std::string const& arg)
this->SearchPathSuffixes.push_back(std::move(suffix));
}
-void AddTrailingSlash(std::string& s)
+static void AddTrailingSlash(std::string& s)
{
if (!s.empty() && s.back() != '/') {
s += '/';
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 335ebbe4e6..694eb0f2d0 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -671,7 +671,7 @@ void cmFindPackageCommand::SetVersionVariables(
addDefinition(prefix, version);
char buf[64];
- sprintf(buf, "%u", major);
+ snprintf(buf, sizeof(buf), "%u", major);
addDefinition(prefix + "_MAJOR", buf);
sprintf(buf, "%u", minor);
addDefinition(prefix + "_MINOR", buf);
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx
index 1c87625e29..9a4b063d7b 100644
--- a/Source/cmFindProgramCommand.cxx
+++ b/Source/cmFindProgramCommand.cxx
@@ -104,6 +104,26 @@ struct cmFindProgramHelper
}
bool FileIsExecutable(std::string const& file) const
{
+#ifdef _WIN32
+ if (!this->FileIsExecutableCMP0109(file)) {
+ return false;
+ }
+ // Pretend the Windows "python" app installer alias does not exist.
+ if (cmSystemTools::LowerCase(file).find("/windowsapps/python") !=
+ std::string::npos) {
+ std::string dest;
+ if (cmSystemTools::ReadSymlink(file, dest) &&
+ cmHasLiteralSuffix(dest, "\\AppInstallerPythonRedirector.exe")) {
+ return false;
+ }
+ }
+ return true;
+#else
+ return this->FileIsExecutableCMP0109(file);
+#endif
+ }
+ bool FileIsExecutableCMP0109(std::string const& file) const
+ {
switch (this->PolicyCMP0109) {
case cmPolicies::OLD:
return cmSystemTools::FileExists(file, true);
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx
index 06778b1ebc..c86001a641 100644
--- a/Source/cmGeneratedFileStream.cxx
+++ b/Source/cmGeneratedFileStream.cxx
@@ -136,7 +136,8 @@ void cmGeneratedFileStreamBase::Open(std::string const& name)
this->TempName += this->TempExt;
} else {
char buf[64];
- sprintf(buf, "tmp%05x", cmSystemTools::RandomSeed() & 0xFFFFF);
+ snprintf(buf, sizeof(buf), "tmp%05x",
+ cmSystemTools::RandomSeed() & 0xFFFFF);
this->TempName += buf;
}
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index c357ee145c..396e9c9e08 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -814,7 +814,8 @@ struct PlatformIdNode : public cmGeneratorExpressionNode
}
return "0";
}
-} platformIdNode;
+};
+static struct PlatformIdNode platformIdNode;
template <cmSystemTools::CompareOp Op>
struct VersionNode : public cmGeneratorExpressionNode
@@ -1261,7 +1262,7 @@ static const struct DeviceLinkNode : public cmGeneratorExpressionNode
}
} deviceLinkNode;
-std::string getLinkedTargetsContent(
+static std::string getLinkedTargetsContent(
cmGeneratorTarget const* target, std::string const& prop,
cmGeneratorExpressionContext* context,
cmGeneratorExpressionDAGChecker* dagChecker)
@@ -1830,8 +1831,8 @@ static const char* targetPolicyWhitelist[] = {
#undef TARGET_POLICY_STRING
};
-cmPolicies::PolicyStatus statusForTarget(cmGeneratorTarget const* tgt,
- const char* policy)
+static cmPolicies::PolicyStatus statusForTarget(cmGeneratorTarget const* tgt,
+ const char* policy)
{
#define RETURN_POLICY(POLICY) \
if (strcmp(policy, #POLICY) == 0) { \
@@ -1846,7 +1847,7 @@ cmPolicies::PolicyStatus statusForTarget(cmGeneratorTarget const* tgt,
return cmPolicies::WARN;
}
-cmPolicies::PolicyID policyForString(const char* policy_id)
+static cmPolicies::PolicyID policyForString(const char* policy_id)
{
#define RETURN_POLICY_ID(POLICY_ID) \
if (strcmp(policy_id, #POLICY_ID) == 0) { \
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 8033ef5443..2fedbd1ea3 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -25,6 +25,7 @@
#include "cmAlgorithms.h"
#include "cmComputeLinkInformation.h"
#include "cmCustomCommandGenerator.h"
+#include "cmFileSet.h"
#include "cmFileTimes.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorExpression.h"
@@ -41,6 +42,7 @@
#include "cmSourceFile.h"
#include "cmSourceFileLocation.h"
#include "cmSourceFileLocationKind.h"
+#include "cmSourceGroup.h"
#include "cmStandardLevelResolver.h"
#include "cmState.h"
#include "cmStringAlgorithms.h"
@@ -173,9 +175,73 @@ private:
BT<std::string> PropertyValue;
};
-std::unique_ptr<cmGeneratorTarget::TargetPropertyEntry>
-CreateTargetPropertyEntry(const BT<std::string>& propertyValue,
- bool evaluateForBuildsystem = false)
+class TargetPropertyEntryFileSet
+ : public cmGeneratorTarget::TargetPropertyEntry
+{
+public:
+ TargetPropertyEntryFileSet(
+ std::vector<std::string> dirs, bool contextSensitiveDirs,
+ std::unique_ptr<cmCompiledGeneratorExpression> entryCge,
+ const cmFileSet* fileSet, cmLinkImplItem const& item = NoLinkImplItem)
+ : cmGeneratorTarget::TargetPropertyEntry(item)
+ , BaseDirs(std::move(dirs))
+ , ContextSensitiveDirs(contextSensitiveDirs)
+ , EntryCge(std::move(entryCge))
+ , FileSet(fileSet)
+ {
+ }
+
+ const std::string& Evaluate(cmLocalGenerator* lg, const std::string& config,
+ cmGeneratorTarget const* headTarget,
+ cmGeneratorExpressionDAGChecker* dagChecker,
+ std::string const& /*lang*/) const override
+ {
+ std::map<std::string, std::vector<std::string>> filesPerDir;
+ this->FileSet->EvaluateFileEntry(this->BaseDirs, filesPerDir,
+ this->EntryCge, lg, config, headTarget,
+ dagChecker);
+
+ std::vector<std::string> files;
+ for (auto const& it : filesPerDir) {
+ files.insert(files.end(), it.second.begin(), it.second.end());
+ }
+
+ static std::string filesStr;
+ filesStr = cmJoin(files, ";");
+ return filesStr;
+ }
+
+ cmListFileBacktrace GetBacktrace() const override
+ {
+ return this->EntryCge->GetBacktrace();
+ }
+
+ std::string const& GetInput() const override
+ {
+ return this->EntryCge->GetInput();
+ }
+
+ bool GetHadContextSensitiveCondition() const override
+ {
+ return this->ContextSensitiveDirs ||
+ this->EntryCge->GetHadContextSensitiveCondition();
+ }
+
+private:
+ const std::vector<std::string> BaseDirs;
+ const bool ContextSensitiveDirs;
+ const std::unique_ptr<cmCompiledGeneratorExpression> EntryCge;
+ const cmFileSet* FileSet;
+};
+
+std::unique_ptr<
+ cmGeneratorTarget::
+ TargetPropertyEntry> static CreateTargetPropertyEntry(const BT<std::
+ string>&
+ propertyValue,
+ bool
+ evaluateForBuildsystem =
+ false)
{
if (cmGeneratorExpression::Find(propertyValue.Value) != std::string::npos) {
cmGeneratorExpression ge(propertyValue.Backtrace);
@@ -190,7 +256,7 @@ CreateTargetPropertyEntry(const BT<std::string>& propertyValue,
cm::make_unique<TargetPropertyEntryString>(propertyValue));
}
-void CreatePropertyGeneratorExpressions(
+static void CreatePropertyGeneratorExpressions(
cmBTStringRange entries,
std::vector<std::unique_ptr<cmGeneratorTarget::TargetPropertyEntry>>& items,
bool evaluateForBuildsystem = false)
@@ -747,6 +813,9 @@ void handleSystemIncludesDep(cmLocalGenerator* lg,
if (!depTgt->IsImported() || excludeImported) {
return;
}
+ if (depTgt->GetPropertyAsBool("IMPORTED_NO_SYSTEM")) {
+ return;
+ }
if (cmValue dirs = depTgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES")) {
cmExpandList(cmGeneratorExpression::Evaluate(*dirs, lg, config, headTarget,
@@ -1586,6 +1655,80 @@ void AddObjectEntries(cmGeneratorTarget const* headTarget,
}
}
+void addFileSetEntry(cmGeneratorTarget const* headTarget,
+ std::string const& config,
+ cmGeneratorExpressionDAGChecker* dagChecker,
+ cmFileSet const* fileSet,
+ EvaluatedTargetPropertyEntries& entries)
+{
+ auto dirCges = fileSet->CompileDirectoryEntries();
+ auto dirs = fileSet->EvaluateDirectoryEntries(
+ dirCges, headTarget->GetLocalGenerator(), config, headTarget, dagChecker);
+ bool contextSensitiveDirs = false;
+ for (auto const& dirCge : dirCges) {
+ if (dirCge->GetHadContextSensitiveCondition()) {
+ contextSensitiveDirs = true;
+ break;
+ }
+ }
+ cmake* cm = headTarget->GetLocalGenerator()->GetCMakeInstance();
+ for (auto& entryCge : fileSet->CompileFileEntries()) {
+ TargetPropertyEntryFileSet tpe(dirs, contextSensitiveDirs,
+ std::move(entryCge), fileSet);
+ entries.Entries.emplace_back(
+ EvaluateTargetPropertyEntry(headTarget, config, "", dagChecker, tpe));
+ for (auto const& file : entries.Entries.back().Values) {
+ auto* sf = headTarget->Makefile->GetOrCreateSource(file);
+ if (fileSet->GetType() == "HEADERS"_s) {
+ sf->SetProperty("HEADER_FILE_ONLY", "TRUE");
+ }
+
+#ifndef CMAKE_BOOTSTRAP
+ std::string e;
+ std::string w;
+ auto path = sf->ResolveFullPath(&e, &w);
+ if (!w.empty()) {
+ cm->IssueMessage(MessageType::AUTHOR_WARNING, w,
+ headTarget->GetBacktrace());
+ }
+ if (path.empty()) {
+ if (!e.empty()) {
+ cm->IssueMessage(MessageType::FATAL_ERROR, e,
+ headTarget->GetBacktrace());
+ }
+ return;
+ }
+ bool found = false;
+ for (auto const& sg : headTarget->Makefile->GetSourceGroups()) {
+ if (sg.MatchesFiles(path)) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ if (fileSet->GetType() == "HEADERS"_s) {
+ headTarget->Makefile->GetOrCreateSourceGroup("Header Files")
+ ->AddGroupFile(path);
+ }
+ }
+#endif
+ }
+ }
+}
+
+void AddFileSetEntries(cmGeneratorTarget const* headTarget,
+ std::string const& config,
+ cmGeneratorExpressionDAGChecker* dagChecker,
+ EvaluatedTargetPropertyEntries& entries)
+{
+ for (auto const& entry : headTarget->Target->GetHeaderSetsEntries()) {
+ for (auto const& name : cmExpandedList(entry.Value)) {
+ auto const* headerSet = headTarget->Target->GetFileSet(name);
+ addFileSetEntry(headTarget, config, dagChecker, headerSet, entries);
+ }
+ }
+}
+
bool processSources(cmGeneratorTarget const* tgt,
EvaluatedTargetPropertyEntries& entries,
std::vector<BT<std::string>>& srcs,
@@ -1723,10 +1866,18 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
uniqueSrcs, debugSources);
}
+ // 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())) {
+ !(contextDependentObjects && numFilesBefore2 < files.size()) &&
+ !(contextDependentFileSets && numFilesBefore3 < files.size())) {
this->SourcesAreContextDependent = Tribool::False;
} else {
this->SourcesAreContextDependent = Tribool::True;
@@ -2923,11 +3074,11 @@ void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string>& result,
result);
}
-void processILibs(const std::string& config,
- cmGeneratorTarget const* headTarget, cmLinkItem const& item,
- cmGlobalGenerator* gg,
- std::vector<cmGeneratorTarget const*>& tgts,
- std::set<cmGeneratorTarget const*>& emitted)
+static void processILibs(const std::string& config,
+ cmGeneratorTarget const* headTarget,
+ cmLinkItem const& item, cmGlobalGenerator* gg,
+ std::vector<cmGeneratorTarget const*>& tgts,
+ std::set<cmGeneratorTarget const*>& emitted)
{
if (item.Target && emitted.insert(item.Target).second) {
tgts.push_back(item.Target);
@@ -3314,6 +3465,22 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(std::string& flags) const
return;
}
+ std::string const& compiler =
+ this->Makefile->GetSafeDefinition("CMAKE_CUDA_COMPILER_ID");
+
+ // Check for special modes: `all`, `all-major`.
+ if (property == "all") {
+ if (compiler == "NVIDIA") {
+ flags += " -arch=all";
+ return;
+ }
+ } else if (property == "all-major") {
+ if (compiler == "NVIDIA") {
+ flags += " -arch=all-major";
+ return;
+ }
+ }
+
struct CudaArchitecture
{
std::string name;
@@ -3355,9 +3522,6 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(std::string& flags) const
}
}
- std::string const& compiler =
- this->Makefile->GetSafeDefinition("CMAKE_CUDA_COMPILER_ID");
-
if (compiler == "NVIDIA") {
for (CudaArchitecture& architecture : architectures) {
flags +=
@@ -5692,7 +5856,7 @@ std::string valueAsString<std::nullptr_t>(std::nullptr_t /*unused*/)
return "(unset)";
}
-std::string compatibilityType(CompatibleType t)
+static std::string compatibilityType(CompatibleType t)
{
switch (t) {
case BoolType:
@@ -5708,7 +5872,7 @@ std::string compatibilityType(CompatibleType t)
return "";
}
-std::string compatibilityAgree(CompatibleType t, bool dominant)
+static std::string compatibilityAgree(CompatibleType t, bool dominant)
{
switch (t) {
case BoolType:
@@ -5798,23 +5962,23 @@ std::pair<bool, bool> consistentProperty(bool lhs, bool rhs,
return { lhs == rhs, lhs };
}
-std::pair<bool, const char*> consistentStringProperty(const char* lhs,
- const char* rhs)
+static std::pair<bool, const char*> consistentStringProperty(const char* lhs,
+ const char* rhs)
{
const bool b = strcmp(lhs, rhs) == 0;
return { b, b ? lhs : nullptr };
}
-std::pair<bool, std::string> consistentStringProperty(const std::string& lhs,
- const std::string& rhs)
+static std::pair<bool, std::string> consistentStringProperty(
+ const std::string& lhs, const std::string& rhs)
{
const bool b = lhs == rhs;
return { b, b ? lhs : valueAsString(nullptr) };
}
-std::pair<bool, const char*> consistentNumberProperty(const char* lhs,
- const char* rhs,
- CompatibleType t)
+static std::pair<bool, const char*> consistentNumberProperty(const char* lhs,
+ const char* rhs,
+ CompatibleType t)
{
char* pEnd;
@@ -5865,9 +6029,9 @@ std::pair<bool, const char*> consistentProperty(const char* lhs,
return { false, nullptr };
}
-std::pair<bool, std::string> consistentProperty(const std::string& lhs,
- const std::string& rhs,
- CompatibleType t)
+static std::pair<bool, std::string> consistentProperty(const std::string& lhs,
+ const std::string& rhs,
+ CompatibleType t)
{
const std::string null_ptr = valueAsString(nullptr);
diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index b7bac9c130..5503619144 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.cxx
+++ b/Source/cmGlobalBorlandMakefileGenerator.cxx
@@ -2,14 +2,16 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalBorlandMakefileGenerator.h"
+#include <ostream>
#include <utility>
#include <cm/memory>
#include "cmDocumentationEntry.h"
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
-#include "cmMessageType.h"
#include "cmState.h"
#include "cmake.h"
diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h
index 5a4e8c2399..646dfffa89 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.h
+++ b/Source/cmGlobalBorlandMakefileGenerator.h
@@ -4,8 +4,16 @@
#include <iosfwd>
#include <memory>
+#include <string>
+#include <vector>
-#include "cmGlobalNMakeMakefileGenerator.h"
+#include "cmGlobalGeneratorFactory.h"
+#include "cmGlobalUnixMakefileGenerator3.h"
+
+class cmLocalGenerator;
+class cmMakefile;
+class cmake;
+struct cmDocumentationEntry;
/** \class cmGlobalBorlandMakefileGenerator
* \brief Write a Borland makefiles.
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 97ad7ab553..0a2e7b5258 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -38,7 +38,6 @@
#include "cmInstallGenerator.h"
#include "cmInstallRuntimeDependencySet.h"
#include "cmLinkLineComputer.h"
-#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMSVC60LinkLineComputer.h"
#include "cmMakefile.h"
@@ -337,6 +336,12 @@ bool cmGlobalGenerator::CheckTargetsForType() const
bool failed = false;
for (const auto& generator : this->LocalGenerators) {
for (const auto& target : generator->GetGeneratorTargets()) {
+ std::string systemName =
+ target->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME");
+ if (systemName.find("Windows") == std::string::npos) {
+ continue;
+ }
+
if (target->GetType() == cmStateEnums::EXECUTABLE) {
std::vector<std::string> const& configs =
target->Makefile->GetGeneratorConfigs(
@@ -1028,6 +1033,54 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(
break;
}
}
+
+ if (compilerId == "LCC") {
+ switch (mf->GetPolicyStatus(cmPolicies::CMP0129)) {
+ case cmPolicies::WARN:
+ if (!this->CMakeInstance->GetIsInTryCompile() &&
+ mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0129")) {
+ std::ostringstream w;
+ /* clang-format off */
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0129) << "\n"
+ "Converting " << lang <<
+ R"( compiler id "LCC" to "GNU" for compatibility.)"
+ ;
+ /* clang-format on */
+ mf->IssueMessage(MessageType::AUTHOR_WARNING, w.str());
+ }
+ CM_FALLTHROUGH;
+ case cmPolicies::OLD:
+ // OLD behavior is to convert LCC to GNU.
+ mf->AddDefinition(compilerIdVar, "GNU");
+ if (lang == "C") {
+ mf->AddDefinition("CMAKE_COMPILER_IS_GNUCC", "1");
+ } else if (lang == "CXX") {
+ mf->AddDefinition("CMAKE_COMPILER_IS_GNUCXX", "1");
+ } else if (lang == "Fortran") {
+ mf->AddDefinition("CMAKE_COMPILER_IS_GNUG77", "1");
+ }
+ {
+ // Fix compiler versions.
+ std::string version = "CMAKE_" + lang + "_COMPILER_VERSION";
+ std::string emulated = "CMAKE_" + lang + "_SIMULATE_VERSION";
+ std::string emulatedId = "CMAKE_" + lang + "_SIMULATE_ID";
+ std::string const& actual = mf->GetRequiredDefinition(emulated);
+ mf->AddDefinition(version, actual);
+ mf->RemoveDefinition(emulatedId);
+ mf->RemoveDefinition(emulated);
+ }
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ mf->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0129));
+ CM_FALLTHROUGH;
+ case cmPolicies::NEW:
+ // NEW behavior is to keep LCC.
+ break;
+ }
+ }
}
std::string cmGlobalGenerator::GetLanguageOutputExtension(
@@ -1264,7 +1317,7 @@ void cmGlobalGenerator::Configure()
// update the cache entry for the number of local generators, this is used
// for progress
char num[100];
- sprintf(num, "%d", static_cast<int>(this->Makefiles.size()));
+ snprintf(num, sizeof(num), "%d", static_cast<int>(this->Makefiles.size()));
this->GetCMakeInstance()->AddCacheEntry("CMAKE_NUMBER_OF_MAKEFILES", num,
"number of local generators",
cmStateEnums::INTERNAL);
@@ -2824,13 +2877,11 @@ void cmGlobalGenerator::CreateGlobalTarget(GlobalTargetInfo const& gti,
cmTarget& target = tb.first;
target.SetProperty("EXCLUDE_FROM_ALL", "TRUE");
- std::vector<std::string> no_outputs;
- std::vector<std::string> no_byproducts;
- std::vector<std::string> no_depends;
// Store the custom command in the target.
- cmCustomCommand cc(no_outputs, no_byproducts, no_depends, gti.CommandLines,
- cmListFileBacktrace(), nullptr, gti.WorkingDir.c_str(),
- gti.StdPipesUTF8);
+ cmCustomCommand cc;
+ cc.SetCommandLines(gti.CommandLines);
+ cc.SetWorkingDirectory(gti.WorkingDir.c_str());
+ cc.SetStdPipesUTF8(gti.StdPipesUTF8);
cc.SetUsesTerminal(gti.UsesTerminal);
target.AddPostBuildCommand(std::move(cc));
if (!gti.Message.empty()) {
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index b1c0488d43..bf537b738a 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalGhsMultiGenerator.h"
-#include <algorithm>
#include <map>
#include <ostream>
#include <utility>
@@ -18,6 +17,7 @@
#include "cmLocalGenerator.h"
#include "cmLocalGhsMultiGenerator.h"
#include "cmMakefile.h"
+#include "cmMessageType.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
@@ -29,10 +29,8 @@
const char* cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj";
#ifdef __linux__
const char* cmGlobalGhsMultiGenerator::DEFAULT_BUILD_PROGRAM = "gbuild";
-const char* cmGlobalGhsMultiGenerator::DEFAULT_TOOLSET_ROOT = "/usr/ghs";
#elif defined(_WIN32)
const char* cmGlobalGhsMultiGenerator::DEFAULT_BUILD_PROGRAM = "gbuild.exe";
-const char* cmGlobalGhsMultiGenerator::DEFAULT_TOOLSET_ROOT = "C:/ghs";
#endif
cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator(cmake* cm)
@@ -70,31 +68,21 @@ void cmGlobalGhsMultiGenerator::ComputeTargetObjectDirectory(
bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
bool build, cmMakefile* mf)
{
+ /* In build mode nothing to be done.
+ * Toolset already determined and build tool absolute path is cached.
+ */
if (build) {
return true;
}
- std::string tsp; /* toolset path */
+ /* Determine the absolute directory for the toolset */
+ std::string tsp;
this->GetToolset(mf, tsp, ts);
/* no toolset was found */
if (tsp.empty()) {
return false;
}
- if (ts.empty()) {
- std::string message;
- message = cmStrCat(
- "Green Hills MULTI: -T <toolset> not specified; defaulting to \"", tsp,
- '"');
- cmSystemTools::Message(message);
-
- /* store the full toolset for later use
- * -- already done if -T<toolset> was specified
- */
- mf->AddCacheDefinition("CMAKE_GENERATOR_TOOLSET", tsp,
- "Location of generator toolset.",
- cmStateEnums::INTERNAL);
- }
/* set the build tool to use */
std::string gbuild(tsp + ((tsp.back() == '/') ? "" : "/") +
@@ -102,13 +90,13 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
cmValue prevTool = mf->GetDefinition("CMAKE_MAKE_PROGRAM");
/* check if the toolset changed from last generate */
- if (prevTool && (gbuild != *prevTool)) {
- std::string message =
+ if (cmNonempty(prevTool) && !cmSystemTools::ComparePath(gbuild, prevTool)) {
+ std::string const& e =
cmStrCat("toolset build tool: ", gbuild,
- "\nDoes not match the previously used build tool: ", *prevTool,
+ "\nDoes not match the previously used build tool: ", prevTool,
"\nEither remove the CMakeCache.txt file and CMakeFiles "
"directory or choose a different binary directory.");
- cmSystemTools::Error(message);
+ mf->IssueMessage(MessageType::FATAL_ERROR, e);
return false;
}
@@ -124,58 +112,20 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p,
cmMakefile* mf)
{
- std::string arch;
- if (p.empty()) {
- cmSystemTools::Message(
- "Green Hills MULTI: -A <arch> not specified; defaulting to \"arm\"");
- arch = "arm";
-
- /* store the platform name for later use
- * -- already done if -A<arch> was specified
- */
- mf->AddCacheDefinition("CMAKE_GENERATOR_PLATFORM", arch,
- "Name of generator platform.",
- cmStateEnums::INTERNAL);
- } else {
- arch = p;
- }
-
- /* check if OS location has been updated by platform scripts */
- std::string platform = mf->GetSafeDefinition("GHS_TARGET_PLATFORM");
- std::string osdir = mf->GetSafeDefinition("GHS_OS_DIR");
- if (cmIsOff(osdir) && platform.find("integrity") != std::string::npos) {
- if (!this->CMakeInstance->GetIsInTryCompile()) {
- /* required OS location is not found */
- std::string m = cmStrCat(
- "Green Hills MULTI: GHS_OS_DIR not specified; No OS found in \"",
- mf->GetSafeDefinition("GHS_OS_ROOT"), '"');
- cmSystemTools::Message(m);
+ /* set primary target */
+ cmValue t = mf->GetDefinition("GHS_PRIMARY_TARGET");
+ if (cmIsOff(t)) {
+ /* Use the value from `-A` or use `arm` */
+ std::string arch = "arm";
+ if (!cmIsOff(p)) {
+ arch = p;
}
- osdir = "GHS_OS_DIR-NOT-SPECIFIED";
- } else if (!this->CMakeInstance->GetIsInTryCompile() &&
- cmIsOff(this->OsDir) && !cmIsOff(osdir)) {
- /* OS location was updated by auto-selection */
- std::string m = cmStrCat(
- "Green Hills MULTI: GHS_OS_DIR not specified; found \"", osdir, '"');
- cmSystemTools::Message(m);
- }
- this->OsDir = osdir;
-
- // Determine GHS_BSP_NAME
- std::string bspName = mf->GetSafeDefinition("GHS_BSP_NAME");
-
- if (cmIsOff(bspName) && platform.find("integrity") != std::string::npos) {
- bspName = "sim" + arch;
- /* write back the calculate name for next time */
- mf->AddCacheDefinition("GHS_BSP_NAME", bspName,
- "Name of GHS target platform.",
- cmStateEnums::STRING, true);
- std::string m = cmStrCat(
- "Green Hills MULTI: GHS_BSP_NAME not specified; defaulting to \"",
- bspName, '"');
- cmSystemTools::Message(m);
- }
+ cmValue platform = mf->GetDefinition("GHS_TARGET_PLATFORM");
+ std::string tgt = cmStrCat(arch, '_', platform, ".tgt");
+ /* update the primary target name*/
+ mf->AddDefinition("GHS_PRIMARY_TARGET", tgt);
+ }
return true;
}
@@ -186,20 +136,6 @@ void cmGlobalGhsMultiGenerator::EnableLanguage(
mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files
- const char* tgtPlatform = mf->GetDefinition("GHS_TARGET_PLATFORM")->c_str();
- if (!tgtPlatform) {
- cmSystemTools::Message("Green Hills MULTI: GHS_TARGET_PLATFORM not "
- "specified; defaulting to \"integrity\"");
- tgtPlatform = "integrity";
- }
-
- /* store the platform name for later use */
- mf->AddCacheDefinition("GHS_TARGET_PLATFORM", tgtPlatform,
- "Name of GHS target platform.", cmStateEnums::STRING);
-
- /* store original OS location */
- this->OsDir = mf->GetSafeDefinition("GHS_OS_DIR");
-
this->cmGlobalGenerator::EnableLanguage(l, mf, optional);
}
@@ -212,43 +148,59 @@ bool cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile* /*mf*/)
return true;
}
-void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsd,
+void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsp,
const std::string& ts)
{
- cmValue ghsRoot = mf->GetDefinition("GHS_TOOLSET_ROOT");
+ /* Determine tsp - full path of the toolset from ts (toolset hint via -T) */
- if (cmNonempty(ghsRoot)) {
- tsd = *ghsRoot;
- } else {
- tsd = DEFAULT_TOOLSET_ROOT;
- }
+ std::string root = mf->GetSafeDefinition("GHS_TOOLSET_ROOT");
+ // Check if `-T` was set by user
if (ts.empty()) {
+ // Enter toolset search mode
std::vector<std::string> output;
- // Use latest? version
- if (tsd.back() != '/') {
- tsd += "/";
+ // Make sure root exists...
+ if (!cmSystemTools::PathExists(root)) {
+ std::string msg =
+ "GHS_TOOLSET_ROOT directory \"" + root + "\" does not exist.";
+ mf->IssueMessage(MessageType::FATAL_ERROR, msg);
+ tsp = "";
+ return;
+ }
+
+ // Add a directory separator
+ if (root.back() != '/') {
+ root += "/";
}
- cmSystemTools::Glob(tsd, "comp_[^;]+", output);
+
+ // Get all compiler directories in toolset root
+ cmSystemTools::Glob(root, "comp_[^;]+", output);
if (output.empty()) {
+ // No compiler directories found
std::string msg =
- "No GHS toolsets found in GHS_TOOLSET_ROOT \"" + tsd + "\".";
- cmSystemTools::Error(msg);
- tsd = "";
+ "No GHS toolsets found in GHS_TOOLSET_ROOT \"" + root + "\".";
+ mf->IssueMessage(MessageType::FATAL_ERROR, msg);
+ tsp = "";
} else {
- tsd += output.back();
+ // Use latest? version
+ tsp = root + output.back();
}
+
} else {
+ // Toolset was provided by user
std::string tryPath;
- tryPath = cmSystemTools::CollapseFullPath(ts, tsd);
+
+ // NOTE: CollapseFullPath() will determine if user toolset was full path or
+ // or relative path.
+ tryPath = cmSystemTools::CollapseFullPath(ts, root);
if (!cmSystemTools::FileExists(tryPath)) {
- std::string msg = "GHS toolset \"" + tryPath + "\" not found.";
- cmSystemTools::Error(msg);
- tsd = "";
+ std::string msg = "GHS toolset \"" + tryPath + "\" does not exist.";
+ mf->IssueMessage(MessageType::FATAL_ERROR, msg);
+ tsp = "";
} else {
- tsd = tryPath;
+ tsp = tryPath;
}
}
}
@@ -333,25 +285,25 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject(std::ostream& fout,
fout << "# Top Level Project File\n";
// Specify BSP option if supplied by user
- cmValue bspName =
- this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME");
+ // -- not all platforms require this entry in the project file
+ cmValue bspName = root->GetMakefile()->GetDefinition("GHS_BSP_NAME");
if (!cmIsOff(bspName)) {
fout << " -bsp " << *bspName << '\n';
}
// Specify OS DIR if supplied by user
// -- not all platforms require this entry in the project file
- if (!cmIsOff(this->OsDir)) {
+ cmValue osDir = root->GetMakefile()->GetDefinition("GHS_OS_DIR");
+ if (!cmIsOff(osDir)) {
cmValue osDirOption =
- this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR_OPTION");
- std::replace(this->OsDir.begin(), this->OsDir.end(), '\\', '/');
+ root->GetMakefile()->GetDefinition("GHS_OS_DIR_OPTION");
fout << " ";
if (cmIsOff(osDirOption)) {
fout << "";
} else {
fout << *osDirOption;
}
- fout << "\"" << this->OsDir << "\"\n";
+ fout << "\"" << osDir << "\"\n";
}
}
@@ -616,8 +568,7 @@ void cmGlobalGhsMultiGenerator::WriteMacros(std::ostream& fout,
cmLocalGenerator* root)
{
fout << "macro PROJ_NAME=" << root->GetProjectName() << '\n';
- cmValue ghsGpjMacros =
- this->GetCMakeInstance()->GetCacheDefinition("GHS_GPJ_MACROS");
+ cmValue ghsGpjMacros = root->GetMakefile()->GetDefinition("GHS_GPJ_MACROS");
if (ghsGpjMacros) {
std::vector<std::string> expandedList = cmExpandedList(*ghsGpjMacros);
for (std::string const& arg : expandedList) {
@@ -629,20 +580,8 @@ void cmGlobalGhsMultiGenerator::WriteMacros(std::ostream& fout,
void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives(
cmLocalGenerator* root, std::ostream& fout)
{
- /* set primary target */
- std::string tgt;
- cmValue t =
- this->GetCMakeInstance()->GetCacheDefinition("GHS_PRIMARY_TARGET");
- if (cmNonempty(t)) {
- tgt = *t;
- this->GetCMakeInstance()->MarkCliAsUsed("GHS_PRIMARY_TARGET");
- } else {
- cmValue a =
- this->GetCMakeInstance()->GetCacheDefinition("CMAKE_GENERATOR_PLATFORM");
- cmValue p =
- this->GetCMakeInstance()->GetCacheDefinition("GHS_TARGET_PLATFORM");
- tgt = cmStrCat((a ? *a : ""), '_', (p ? *p : ""), ".tgt");
- }
+ /* put primary target and customization files into project file */
+ cmValue const tgt = root->GetMakefile()->GetDefinition("GHS_PRIMARY_TARGET");
/* clang-format off */
fout << "primaryTarget=" << tgt << "\n"
@@ -653,7 +592,7 @@ void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives(
/* clang-format on */
cmValue const customization =
- this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION");
+ root->GetMakefile()->GetDefinition("GHS_CUSTOMIZATION");
if (cmNonempty(customization)) {
fout << "customization="
<< cmGlobalGhsMultiGenerator::TrimQuotes(*customization) << '\n';
diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h
index bd08301fdf..9076e0e319 100644
--- a/Source/cmGlobalGhsMultiGenerator.h
+++ b/Source/cmGlobalGhsMultiGenerator.h
@@ -112,9 +112,7 @@ private:
static std::string TrimQuotes(std::string str);
- std::string OsDir;
static const char* DEFAULT_BUILD_PROGRAM;
- static const char* DEFAULT_TOOLSET_ROOT;
bool ComputeTargetBuildOrder(cmGeneratorTarget const* tgt,
std::vector<cmGeneratorTarget const*>& build);
diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx
index 40deebb049..1b406a6969 100644
--- a/Source/cmGlobalJOMMakefileGenerator.cxx
+++ b/Source/cmGlobalJOMMakefileGenerator.cxx
@@ -2,8 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalJOMMakefileGenerator.h"
+#include <ostream>
+
+#include <cmext/algorithm>
+
#include "cmDocumentationEntry.h"
-#include "cmLocalUnixMakefileGenerator3.h"
+#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmState.h"
#include "cmake.h"
diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h
index 58860dd642..822974589b 100644
--- a/Source/cmGlobalJOMMakefileGenerator.h
+++ b/Source/cmGlobalJOMMakefileGenerator.h
@@ -4,8 +4,16 @@
#include <iosfwd>
#include <memory>
+#include <string>
+#include <vector>
+#include "cmGlobalGeneratorFactory.h"
#include "cmGlobalUnixMakefileGenerator3.h"
+#include "cmValue.h"
+
+class cmMakefile;
+class cmake;
+struct cmDocumentationEntry;
/** \class cmGlobalJOMMakefileGenerator
* \brief Write a JOM makefiles.
diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx
index ae9d5a7680..c8520b835c 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.cxx
+++ b/Source/cmGlobalMSYSMakefileGenerator.cxx
@@ -5,10 +5,10 @@
#include "cmsys/FStream.hxx"
#include "cmDocumentationEntry.h"
-#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
-#include "cmMessageType.h"
#include "cmState.h"
+#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
#include "cmake.h"
cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator(cmake* cm)
diff --git a/Source/cmGlobalMSYSMakefileGenerator.h b/Source/cmGlobalMSYSMakefileGenerator.h
index 1a47b4f182..586487f512 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.h
+++ b/Source/cmGlobalMSYSMakefileGenerator.h
@@ -3,9 +3,16 @@
#pragma once
#include <memory>
+#include <string>
+#include <vector>
+#include "cmGlobalGeneratorFactory.h"
#include "cmGlobalUnixMakefileGenerator3.h"
+class cmMakefile;
+class cmake;
+struct cmDocumentationEntry;
+
/** \class cmGlobalMSYSMakefileGenerator
* \brief Write a NMake makefiles.
*
diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx
index d9fc50530a..54d048dedf 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.cxx
+++ b/Source/cmGlobalMinGWMakefileGenerator.cxx
@@ -3,9 +3,9 @@
#include "cmGlobalMinGWMakefileGenerator.h"
#include "cmDocumentationEntry.h"
-#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
#include "cmState.h"
+#include "cmSystemTools.h"
#include "cmake.h"
cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator(cmake* cm)
diff --git a/Source/cmGlobalMinGWMakefileGenerator.h b/Source/cmGlobalMinGWMakefileGenerator.h
index ffc9ebe033..1574fafaed 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.h
+++ b/Source/cmGlobalMinGWMakefileGenerator.h
@@ -3,9 +3,16 @@
#pragma once
#include <memory>
+#include <string>
+#include <vector>
+#include "cmGlobalGeneratorFactory.h"
#include "cmGlobalUnixMakefileGenerator3.h"
+class cmMakefile;
+class cmake;
+struct cmDocumentationEntry;
+
/** \class cmGlobalMinGWMakefileGenerator
* \brief Write a NMake makefiles.
*
diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx
index a038f871e7..9f3d30eeb2 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.cxx
+++ b/Source/cmGlobalNMakeMakefileGenerator.cxx
@@ -2,13 +2,20 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalNMakeMakefileGenerator.h"
+#include <ostream>
+
+#include <cmext/algorithm>
+
#include "cmsys/RegularExpression.hxx"
#include "cmDocumentationEntry.h"
#include "cmDuration.h"
-#include "cmLocalUnixMakefileGenerator3.h"
+#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
+#include "cmMessageType.h"
#include "cmState.h"
+#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
#include "cmake.h"
cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator(cmake* cm)
diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h
index 4f202b5a47..ca5b8d61b4 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.h
+++ b/Source/cmGlobalNMakeMakefileGenerator.h
@@ -4,8 +4,18 @@
#include <iosfwd>
#include <memory>
+#include <string>
+#include <vector>
+#include "cm_codecvt.hxx"
+
+#include "cmGlobalGeneratorFactory.h"
#include "cmGlobalUnixMakefileGenerator3.h"
+#include "cmValue.h"
+
+class cmMakefile;
+class cmake;
+struct cmDocumentationEntry;
/** \class cmGlobalNMakeMakefileGenerator
* \brief Write a NMake makefiles.
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 7122b9f8f2..19c4ee3a21 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -156,7 +156,7 @@ std::string cmGlobalNinjaGenerator::EncodeRuleName(std::string const& name)
encoded += i;
} else {
char buf[16];
- sprintf(buf, ".%02x", static_cast<unsigned int>(i));
+ snprintf(buf, sizeof(buf), ".%02x", static_cast<unsigned int>(i));
encoded += buf;
}
}
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 6cab492692..d7bc05d64a 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -3,24 +3,35 @@
#include "cmGlobalVisualStudio10Generator.h"
#include <algorithm>
+#include <cstring>
+#include <map>
+#include <sstream>
#include <utility>
#include <cm/memory>
#include <cm3p/json/reader.h>
+#include <cm3p/json/value.h>
#include "cmsys/FStream.hxx"
#include "cmsys/Glob.hxx"
#include "cmsys/RegularExpression.hxx"
-#include "cmAlgorithms.h"
#include "cmDocumentationEntry.h"
#include "cmGeneratorTarget.h"
+#include "cmGlobalGenerator.h"
+#include "cmGlobalGeneratorFactory.h"
+#include "cmGlobalVisualStudio71Generator.h"
+#include "cmGlobalVisualStudio7Generator.h"
+#include "cmGlobalVisualStudioGenerator.h"
+#include "cmIDEFlagTable.h"
+#include "cmLocalGenerator.h"
#include "cmLocalVisualStudio10Generator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmSourceFile.h"
#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
#include "cmVersion.h"
#include "cmVisualStudioSlnData.h"
#include "cmVisualStudioSlnParser.h"
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 6e6239065b..c8fd14975a 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -2,14 +2,25 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#pragma once
+#include <cstddef>
#include <memory>
#include <set>
+#include <string>
+#include <vector>
#include <cm/optional>
#include <cm/string_view>
#include "cmGlobalVisualStudio8Generator.h"
+class cmGeneratorTarget;
+class cmGlobalGeneratorFactory;
+class cmLocalGenerator;
+class cmMakefile;
+class cmSourceFile;
+class cmake;
+struct cmIDEFlagTable;
+
/** \class cmGlobalVisualStudio10Generator
* \brief Write a Unix makefiles.
*
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index a5ffcf0f88..6126cb4eff 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -2,12 +2,19 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudio11Generator.h"
+#include <cstring>
+#include <sstream>
#include <utility>
+#include <vector>
-#include "cmAlgorithms.h"
#include "cmDocumentationEntry.h"
-#include "cmLocalVisualStudio10Generator.h"
+#include "cmGlobalGenerator.h"
+#include "cmGlobalGeneratorFactory.h"
+#include "cmGlobalVisualStudioGenerator.h"
#include "cmMakefile.h"
+#include "cmMessageType.h"
+#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
static const char vs11generatorName[] = "Visual Studio 11 2012";
diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h
index b11905ec14..2f8a7f60e7 100644
--- a/Source/cmGlobalVisualStudio11Generator.h
+++ b/Source/cmGlobalVisualStudio11Generator.h
@@ -4,13 +4,14 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include <iosfwd>
#include <memory>
#include <set>
#include <string>
+#include <cm/optional>
+
#include "cmGlobalVisualStudio10Generator.h"
-#include "cmStateTypes.h"
+#include "cmTransformDepfile.h"
class cmGlobalGeneratorFactory;
class cmMakefile;
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index 8bdf356606..d8c1b43825 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -2,10 +2,18 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudio12Generator.h"
-#include "cmAlgorithms.h"
+#include <cstring>
+#include <sstream>
+#include <vector>
+
#include "cmDocumentationEntry.h"
-#include "cmLocalVisualStudio10Generator.h"
+#include "cmGlobalGenerator.h"
+#include "cmGlobalGeneratorFactory.h"
+#include "cmGlobalVisualStudioGenerator.h"
#include "cmMakefile.h"
+#include "cmMessageType.h"
+#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
static const char vs12generatorName[] = "Visual Studio 12 2013";
diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h
index c220d403a9..a84756e5f9 100644
--- a/Source/cmGlobalVisualStudio12Generator.h
+++ b/Source/cmGlobalVisualStudio12Generator.h
@@ -4,7 +4,6 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include <iosfwd>
#include <memory>
#include <string>
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index ff1642f8b6..014668f8e5 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -2,11 +2,20 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudio14Generator.h"
+#include <cstring>
+#include <sstream>
+
#include <cm/vector>
#include "cmDocumentationEntry.h"
-#include "cmLocalVisualStudio10Generator.h"
+#include "cmGlobalGenerator.h"
+#include "cmGlobalGeneratorFactory.h"
+#include "cmGlobalVisualStudioGenerator.h"
#include "cmMakefile.h"
+#include "cmMessageType.h"
+#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
+#include "cmValue.h"
static const char vs14generatorName[] = "Visual Studio 14 2015";
diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h
index 7804b83cbf..7fb9b4bbb8 100644
--- a/Source/cmGlobalVisualStudio14Generator.h
+++ b/Source/cmGlobalVisualStudio14Generator.h
@@ -4,7 +4,6 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include <iosfwd>
#include <memory>
#include <string>
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index 50975ffdf4..ce943a2c97 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -2,11 +2,19 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudio71Generator.h"
-#include "cmDocumentationEntry.h"
+#include <map>
+#include <sstream>
+
#include "cmGeneratorTarget.h"
-#include "cmLocalVisualStudio7Generator.h"
+#include "cmGlobalGenerator.h"
+#include "cmGlobalVisualStudioGenerator.h"
+#include "cmListFileCache.h"
+#include "cmLocalGenerator.h"
#include "cmMakefile.h"
-#include "cmMessageType.h"
+#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
+
+class cmake;
cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator(
cmake* cm, const std::string& platformName)
diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h
index cb3b8c13b5..0e7ddd09b8 100644
--- a/Source/cmGlobalVisualStudio71Generator.h
+++ b/Source/cmGlobalVisualStudio71Generator.h
@@ -2,7 +2,20 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#pragma once
+#include <iosfwd>
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
+
#include "cmGlobalVisualStudio7Generator.h"
+#include "cmValue.h"
+
+class cmGeneratorTarget;
+class cmLocalGenerator;
+class cmake;
+template <typename T>
+class BT;
/** \class cmGlobalVisualStudio71Generator
* \brief Write a Unix makefiles.
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 6876e6179a..b3f8d9057b 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -2,6 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudio7Generator.h"
+#include <algorithm>
+#include <cstdio>
+#include <ostream>
#include <utility>
#include <vector>
@@ -10,19 +13,22 @@
#include <windows.h>
-#include <assert.h>
-
-#include "cmsys/Encoding.hxx"
-
#include "cmGeneratedFileStream.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
#include "cmLocalVisualStudio7Generator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmState.h"
+#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cmTargetDepend.h"
#include "cmUuid.h"
+#include "cmVisualStudioGeneratorOptions.h"
#include "cmake.h"
static cmVS7FlagTable cmVS7ExtraFlagTable[] = {
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 8e762cf90f..d1fb8040c7 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -2,14 +2,26 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#pragma once
+#include <iosfwd>
+#include <map>
#include <memory>
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include <cm3p/json/value.h>
-#include "cmGlobalGeneratorFactory.h"
#include "cmGlobalVisualStudioGenerator.h"
#include "cmValue.h"
-class cmTarget;
+class cmGeneratorTarget;
struct cmIDEFlagTable;
+class cmLocalGenerator;
+class cmMakefile;
+class cmake;
+template <typename T>
+class BT;
/** \class cmGlobalVisualStudio7Generator
* \brief Write a Unix makefiles.
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 1e45813bb9..4e53dff6bd 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -2,22 +2,41 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudio8Generator.h"
+#include <algorithm>
+#include <functional>
+#include <ostream>
+#include <utility>
+
#include <cm/memory>
+#include <cmext/algorithm>
#include <cmext/memory>
#include "cmCustomCommand.h"
#include "cmCustomCommandLines.h"
-#include "cmDocumentationEntry.h"
+#include "cmCustomCommandTypes.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
+#include "cmGlobalGenerator.h"
+#include "cmGlobalVisualStudio7Generator.h"
+#include "cmGlobalVisualStudioGenerator.h"
+#include "cmListFileCache.h"
+#include "cmLocalGenerator.h"
#include "cmLocalVisualStudio7Generator.h"
#include "cmMakefile.h"
-#include "cmMessageType.h"
+#include "cmPolicies.h"
#include "cmSourceFile.h"
-#include "cmVisualStudioWCEPlatformParser.h"
+#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cmTargetDepend.h"
+#include "cmValue.h"
+#include "cmVisualStudioGeneratorOptions.h"
#include "cmake.h"
+struct cmIDEFlagTable;
+
cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator(
cmake* cm, const std::string& name,
std::string const& platformInGeneratorName)
@@ -147,13 +166,10 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
auto& lg =
cm::static_reference_cast<cmLocalVisualStudio7Generator>(generators[0]);
- const char* no_working_directory = nullptr;
- std::vector<std::string> no_byproducts;
- std::vector<std::string> no_depends;
- cmCustomCommandLines no_commands;
- cmTarget* tgt = lg.AddUtilityCommand(
- CMAKE_CHECK_BUILD_SYSTEM_TARGET, false, no_working_directory,
- no_byproducts, no_depends, no_commands, cmPolicies::NEW);
+ auto cc = cm::make_unique<cmCustomCommand>();
+ cc->SetCMP0116Status(cmPolicies::NEW);
+ cmTarget* tgt = lg.AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false,
+ std::move(cc));
auto ptr = cm::make_unique<cmGeneratorTarget>(tgt, &lg);
auto gt = ptr.get();
@@ -203,11 +219,15 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
std::vector<std::string> byproducts;
byproducts.push_back(cm->GetGlobVerifyStamp());
- lg.AddCustomCommandToTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET, byproducts,
- no_depends, verifyCommandLines,
+ cc = cm::make_unique<cmCustomCommand>();
+ cc->SetByproducts(byproducts);
+ cc->SetCommandLines(verifyCommandLines);
+ cc->SetComment("Checking File Globs");
+ cc->SetCMP0116Status(cmPolicies::NEW);
+ cc->SetStdPipesUTF8(stdPipesUTF8);
+ lg.AddCustomCommandToTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET,
cmCustomCommandType::PRE_BUILD,
- "Checking File Globs", no_working_directory,
- cmPolicies::NEW, stdPipesUTF8);
+ std::move(cc));
// Ensure ZERO_CHECK always runs in Visual Studio using MSBuild,
// otherwise the prebuild command will not be run.
@@ -235,12 +255,16 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
// overwritten by the CreateVCProjBuildRule.
// (this could be avoided with per-target source files)
std::string no_main_dependency;
- cmImplicitDependsList no_implicit_depends;
+ cc = cm::make_unique<cmCustomCommand>();
+ cc->SetOutputs(stamps);
+ cc->SetDepends(listFiles);
+ cc->SetCommandLines(commandLines);
+ cc->SetComment("Checking Build System");
+ cc->SetCMP0116Status(cmPolicies::NEW);
+ cc->SetEscapeOldStyle(false);
+ cc->SetStdPipesUTF8(stdPipesUTF8);
if (cmSourceFile* file = lg.AddCustomCommandToOutput(
- stamps, no_byproducts, listFiles, no_main_dependency,
- no_implicit_depends, commandLines, "Checking Build System",
- no_working_directory, cmPolicies::NEW, true, false, false, false, "",
- "", stdPipesUTF8)) {
+ no_main_dependency, std::move(cc), true)) {
gt->AddSource(file->ResolveFullPath());
} else {
cmSystemTools::Error("Error adding rule for " + stamps[0]);
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index b6ecdf07f8..fe57c545fd 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -2,10 +2,20 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#pragma once
+#include <iosfwd>
+#include <set>
+#include <string>
+#include <vector>
+
#include <cm/optional>
#include "cmGlobalVisualStudio71Generator.h"
+class cmGeneratorTarget;
+class cmMakefile;
+class cmake;
+struct cmIDEFlagTable;
+
/** \class cmGlobalVisualStudio8Generator
* \brief Write a Unix makefiles.
*
diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx
index 2339a80527..5f867f5a1d 100644
--- a/Source/cmGlobalVisualStudio9Generator.cxx
+++ b/Source/cmGlobalVisualStudio9Generator.cxx
@@ -2,14 +2,19 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudio9Generator.h"
+#include <cstring>
#include <utility>
+#include <vector>
#include "cmDocumentationEntry.h"
-#include "cmLocalVisualStudio7Generator.h"
-#include "cmMakefile.h"
-#include "cmMessageType.h"
+#include "cmGlobalGenerator.h"
+#include "cmGlobalGeneratorFactory.h"
+#include "cmGlobalVisualStudioGenerator.h"
+#include "cmSystemTools.h"
#include "cmVisualStudioWCEPlatformParser.h"
+class cmake;
+
static const char vs9generatorName[] = "Visual Studio 9 2008";
class cmGlobalVisualStudio9Generator::Factory : public cmGlobalGeneratorFactory
diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h
index 6f4d159ecc..1c93d49bad 100644
--- a/Source/cmGlobalVisualStudio9Generator.h
+++ b/Source/cmGlobalVisualStudio9Generator.h
@@ -3,9 +3,13 @@
#pragma once
#include <memory>
+#include <string>
#include "cmGlobalVisualStudio8Generator.h"
+class cmGlobalGeneratorFactory;
+class cmake;
+
/** \class cmGlobalVisualStudio9Generator
* \brief Write a Unix makefiles.
*
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index f9bd67e083..948fa5300b 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -3,8 +3,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudioGenerator.h"
+#include <cassert>
#include <future>
#include <iostream>
+#include <sstream>
+#include <system_error>
+#include <utility>
#include <cm/iterator>
#include <cm/memory>
@@ -14,17 +18,20 @@
#include <objbase.h>
#include <shellapi.h>
-#include "cmsys/Encoding.hxx"
-
#include "cmCallVisualStudioMacro.h"
#include "cmCustomCommand.h"
#include "cmCustomCommandLines.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
-#include "cmLocalVisualStudioGenerator.h"
+#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmMessageType.h"
+#include "cmPolicies.h"
#include "cmSourceFile.h"
#include "cmState.h"
+#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmake.h"
@@ -199,19 +206,18 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
{
// Add a special target that depends on ALL projects for easy build
// of one configuration only.
- const char* no_working_dir = nullptr;
- std::vector<std::string> no_byproducts;
- std::vector<std::string> no_depends;
- cmCustomCommandLines no_commands;
for (auto const& it : this->ProjectMap) {
std::vector<cmLocalGenerator*> const& gen = it.second;
// add the ALL_BUILD to the first local generator of each project
if (!gen.empty()) {
// Use no actual command lines so that the target itself is not
// considered always out of date.
- cmTarget* allBuild = gen[0]->AddUtilityCommand(
- "ALL_BUILD", true, no_working_dir, no_byproducts, no_depends,
- no_commands, cmPolicies::NEW, false, "Build all projects");
+ auto cc = cm::make_unique<cmCustomCommand>();
+ cc->SetCMP0116Status(cmPolicies::NEW);
+ cc->SetEscapeOldStyle(false);
+ cc->SetComment("Build all projects");
+ cmTarget* allBuild =
+ gen[0]->AddUtilityCommand("ALL_BUILD", true, std::move(cc));
gen[0]->AddGeneratorTarget(
cm::make_unique<cmGeneratorTarget>(allBuild, gen[0]));
@@ -942,9 +948,13 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand(
cmCustomCommandLines commandLines = cmMakeSingleCommandLine(
{ cmakeCommand, "-E", "__create_def", mdi->DefFile, objs_file });
- cmCustomCommand command(outputs, empty, empty, commandLines,
- gt->Target->GetMakefile()->GetBacktrace(),
- "Auto build dll exports", ".", true);
+ cmCustomCommand command;
+ command.SetOutputs(outputs);
+ command.SetCommandLines(commandLines);
+ command.SetComment("Auto build dll exports");
+ command.SetBacktrace(gt->Target->GetMakefile()->GetBacktrace());
+ command.SetWorkingDirectory(".");
+ command.SetStdPipesUTF8(true);
commands.push_back(std::move(command));
}
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index 23c8a02908..1eff135abf 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -10,8 +10,11 @@
#include <string>
#include <vector>
+#include "cm_codecvt.hxx"
+
#include "cmGlobalGenerator.h"
#include "cmTargetDepend.h"
+#include "cmValue.h"
class cmCustomCommand;
class cmGeneratorTarget;
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index b5a6b9fdc6..ef8fee1c38 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -2,16 +2,26 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudioVersionedGenerator.h"
+#include <cstring>
+#include <set>
+#include <sstream>
+#include <utility>
+#include <vector>
+
#include <cmext/string_view>
#include "cmsys/FStream.hxx"
#include "cmsys/Glob.hxx"
+#include "cmsys/RegularExpression.hxx"
-#include "cmAlgorithms.h"
#include "cmDocumentationEntry.h"
-#include "cmLocalVisualStudio10Generator.h"
+#include "cmGlobalGenerator.h"
+#include "cmGlobalGeneratorFactory.h"
#include "cmMakefile.h"
+#include "cmMessageType.h"
+#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
#include "cmVSSetupHelper.h"
#include "cmake.h"
@@ -109,6 +119,30 @@ static const char* VSVersionToToolset(
return "";
}
+static std::string VSVersionToMajorString(
+ cmGlobalVisualStudioGenerator::VSVersion v)
+{
+ switch (v) {
+ case cmGlobalVisualStudioGenerator::VS9:
+ return "9";
+ case cmGlobalVisualStudioGenerator::VS10:
+ return "10";
+ case cmGlobalVisualStudioGenerator::VS11:
+ return "11";
+ case cmGlobalVisualStudioGenerator::VS12:
+ return "12";
+ case cmGlobalVisualStudioGenerator::VS14:
+ return "14";
+ case cmGlobalVisualStudioGenerator::VS15:
+ return "15";
+ case cmGlobalVisualStudioGenerator::VS16:
+ return "16";
+ case cmGlobalVisualStudioGenerator::VS17:
+ return "17";
+ }
+ return "";
+}
+
static const char* VSVersionToAndroidToolset(
cmGlobalVisualStudioGenerator::VSVersion v)
{
@@ -447,15 +481,25 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance(
return true;
}
- if (!i.empty()) {
- if (!this->vsSetupAPIHelper.SetVSInstance(i)) {
+ if (!this->ParseGeneratorInstance(i, mf)) {
+ return false;
+ }
+
+ if (!this->GeneratorInstanceVersion.empty()) {
+ std::string const majorStr = VSVersionToMajorString(this->Version);
+ cmsys::RegularExpression versionRegex(
+ cmStrCat("^", majorStr, "\\.[0-9]+\\.[0-9]+\\.[0-9]+$"));
+ if (!versionRegex.find(this->GeneratorInstanceVersion)) {
std::ostringstream e;
/* clang-format off */
e <<
"Generator\n"
" " << this->GetName() << "\n"
- "could not find specified instance of Visual Studio:\n"
- " " << i;
+ "given instance specification\n"
+ " " << i << "\n"
+ "but the version field is not 4 integer components"
+ " starting in " << majorStr << "."
+ ;
/* clang-format on */
mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
return false;
@@ -463,7 +507,29 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance(
}
std::string vsInstance;
- if (!this->vsSetupAPIHelper.GetVSInstanceInfo(vsInstance)) {
+ if (!i.empty()) {
+ vsInstance = i;
+ if (!this->vsSetupAPIHelper.SetVSInstance(
+ this->GeneratorInstance, this->GeneratorInstanceVersion)) {
+ std::ostringstream e;
+ /* clang-format off */
+ e <<
+ "Generator\n"
+ " " << this->GetName() << "\n"
+ "could not find specified instance of Visual Studio:\n"
+ " " << i;
+ /* clang-format on */
+ if (!this->GeneratorInstance.empty() &&
+ this->GeneratorInstanceVersion.empty() &&
+ cmSystemTools::FileIsDirectory(this->GeneratorInstance)) {
+ e << "\n"
+ "The directory exists, but the instance is not known to the "
+ "Visual Studio Installer, and no 'version=' field was given.";
+ }
+ mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ return false;
+ }
+ } else if (!this->vsSetupAPIHelper.GetVSInstanceInfo(vsInstance)) {
std::ostringstream e;
/* clang-format off */
e <<
@@ -491,6 +557,88 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance(
return true;
}
+bool cmGlobalVisualStudioVersionedGenerator::ParseGeneratorInstance(
+ std::string const& is, cmMakefile* mf)
+{
+ this->GeneratorInstance.clear();
+ this->GeneratorInstanceVersion.clear();
+
+ std::vector<std::string> const fields = cmTokenize(is, ",");
+ std::vector<std::string>::const_iterator fi = fields.begin();
+ if (fi == fields.end()) {
+ return true;
+ }
+
+ // The first field may be the VS instance.
+ if (fi->find('=') == fi->npos) {
+ this->GeneratorInstance = *fi;
+ ++fi;
+ }
+
+ std::set<std::string> handled;
+
+ // The rest of the fields must be key=value pairs.
+ for (; fi != fields.end(); ++fi) {
+ std::string::size_type pos = fi->find('=');
+ if (pos == fi->npos) {
+ std::ostringstream e;
+ /* clang-format off */
+ e <<
+ "Generator\n"
+ " " << this->GetName() << "\n"
+ "given instance specification\n"
+ " " << is << "\n"
+ "that contains a field after the first ',' with no '='."
+ ;
+ /* clang-format on */
+ mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ return false;
+ }
+ std::string const key = fi->substr(0, pos);
+ std::string const value = fi->substr(pos + 1);
+ if (!handled.insert(key).second) {
+ std::ostringstream e;
+ /* clang-format off */
+ e <<
+ "Generator\n"
+ " " << this->GetName() << "\n"
+ "given instance specification\n"
+ " " << is << "\n"
+ "that contains duplicate field key '" << key << "'."
+ ;
+ /* clang-format on */
+ mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ return false;
+ }
+ if (!this->ProcessGeneratorInstanceField(key, value)) {
+ std::ostringstream e;
+ /* clang-format off */
+ e <<
+ "Generator\n"
+ " " << this->GetName() << "\n"
+ "given instance specification\n"
+ " " << is << "\n"
+ "that contains invalid field '" << *fi << "'."
+ ;
+ /* clang-format on */
+ mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool cmGlobalVisualStudioVersionedGenerator::ProcessGeneratorInstanceField(
+ std::string const& key, std::string const& value)
+{
+ if (key == "version") {
+ this->GeneratorInstanceVersion = value;
+ return true;
+ }
+ return false;
+}
+
bool cmGlobalVisualStudioVersionedGenerator::GetVSInstance(
std::string& dir) const
{
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h
index 2aed65b87f..2e573ec8cf 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.h
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.h
@@ -4,16 +4,18 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include <iosfwd>
#include <memory>
#include <string>
#include <cm/optional>
+#include "cmGlobalVisualStudio10Generator.h"
#include "cmGlobalVisualStudio14Generator.h"
+#include "cmGlobalVisualStudioGenerator.h"
#include "cmVSSetupHelper.h"
class cmGlobalGeneratorFactory;
+class cmMakefile;
class cmake;
/** \class cmGlobalVisualStudioVersionedGenerator */
@@ -65,6 +67,9 @@ protected:
std::string GetWindows10SDKMaxVersionDefault(cmMakefile*) const override;
+ virtual bool ProcessGeneratorInstanceField(std::string const& key,
+ std::string const& value);
+
std::string FindMSBuildCommand() override;
std::string FindDevEnvCommand() override;
@@ -76,5 +81,10 @@ private:
class Factory17;
friend class Factory17;
mutable cmVSSetupAPIHelper vsSetupAPIHelper;
+
+ bool ParseGeneratorInstance(std::string const& is, cmMakefile* mf);
+
+ std::string GeneratorInstance;
+ std::string GeneratorInstanceVersion;
cm::optional<std::string> LastGeneratorInstanceString;
};
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index f34ef62709..44a3eb7f63 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -6,6 +6,7 @@
#include <cassert>
#include <cstdio>
#include <cstring>
+#include <functional>
#include <iomanip>
#include <sstream>
#include <unordered_set>
@@ -17,36 +18,42 @@
#include "cmsys/RegularExpression.hxx"
-#include "cmCMakePath.h"
#include "cmComputeLinkInformation.h"
#include "cmCryptoHash.h"
#include "cmCustomCommand.h"
#include "cmCustomCommandGenerator.h"
#include "cmCustomCommandLines.h"
+#include "cmCustomCommandTypes.h"
#include "cmDocumentationEntry.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGeneratorFactory.h"
+#include "cmLinkItem.h"
+#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmLocalXCodeGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmOutputConverter.h"
+#include "cmPolicies.h"
#include "cmSourceFile.h"
+#include "cmSourceFileLocation.h"
+#include "cmSourceFileLocationKind.h"
#include "cmSourceGroup.h"
#include "cmState.h"
+#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
+#include "cmTargetDepend.h"
#include "cmXCode21Object.h"
#include "cmXCodeObject.h"
#include "cmXCodeScheme.h"
+#include "cmXMLWriter.h"
#include "cmake.h"
-struct cmLinkImplementation;
-
#if !defined(CMAKE_BOOTSTRAP) && defined(__APPLE__)
# include <CoreFoundation/CoreFoundation.h>
# if !TARGET_OS_IPHONE
@@ -601,15 +608,13 @@ std::string cmGlobalXCodeGenerator::PostBuildMakeTarget(
void cmGlobalXCodeGenerator::AddExtraTargets(
cmLocalGenerator* root, std::vector<cmLocalGenerator*>& gens)
{
- const char* no_working_directory = nullptr;
- std::vector<std::string> no_byproducts;
- std::vector<std::string> no_depends;
-
// Add ALL_BUILD
- cmTarget* allbuild = root->AddUtilityCommand(
- "ALL_BUILD", true, no_working_directory, no_byproducts, no_depends,
- cmMakeSingleCommandLine({ "echo", "Build all projects" }),
- cmPolicies::NEW);
+ auto cc = cm::make_unique<cmCustomCommand>();
+ cc->SetCommandLines(
+ cmMakeSingleCommandLine({ "echo", "Build all projects" }));
+ cc->SetCMP0116Status(cmPolicies::NEW);
+ cmTarget* allbuild =
+ root->AddUtilityCommand("ALL_BUILD", true, std::move(cc));
root->AddGeneratorTarget(cm::make_unique<cmGeneratorTarget>(allbuild, root));
@@ -635,10 +640,11 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
std::string file =
this->ConvertToRelativeForMake(this->CurrentReRunCMakeMakefile);
cmSystemTools::ReplaceString(file, "\\ ", " ");
- cmTarget* check = root->AddUtilityCommand(
- CMAKE_CHECK_BUILD_SYSTEM_TARGET, true, no_working_directory,
- no_byproducts, no_depends,
- cmMakeSingleCommandLine({ "make", "-f", file }), cmPolicies::NEW);
+ cc = cm::make_unique<cmCustomCommand>();
+ cc->SetCommandLines(cmMakeSingleCommandLine({ "make", "-f", file }));
+ cc->SetCMP0116Status(cmPolicies::NEW);
+ cmTarget* check = root->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET,
+ true, std::move(cc));
root->AddGeneratorTarget(cm::make_unique<cmGeneratorTarget>(check, root));
}
@@ -664,11 +670,13 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
legacyDependHelperCommandLines.front().back() = // fill placeholder
this->PostBuildMakeTarget(target->GetName(), "$(CONFIGURATION)");
+ cc = cm::make_unique<cmCustomCommand>();
+ cc->SetCommandLines(legacyDependHelperCommandLines);
+ cc->SetComment("Depend check for xcode");
+ cc->SetWorkingDirectory(legacyDependHelperDir.c_str());
+ cc->SetCMP0116Status(cmPolicies::NEW);
gen->AddCustomCommandToTarget(
- target->GetName(), no_byproducts, no_depends,
- legacyDependHelperCommandLines, cmCustomCommandType::POST_BUILD,
- "Depend check for xcode", legacyDependHelperDir.c_str(),
- cmPolicies::NEW, true, false, "", "", false,
+ target->GetName(), cmCustomCommandType::POST_BUILD, std::move(cc),
cmObjectLibraryCommands::Accept);
}
@@ -833,8 +841,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateFlatClone(cmXCodeObject* orig)
return obj;
}
-std::string GetGroupMapKeyFromPath(cmGeneratorTarget* target,
- const std::string& fullpath)
+static std::string GetGroupMapKeyFromPath(cmGeneratorTarget* target,
+ const std::string& fullpath)
{
std::string key(target->GetName());
key += "-";
@@ -1716,15 +1724,16 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(
cmStrCat("$<TARGET_SONAME_FILE:", gtgt->GetName(), '>');
std::string str_link_file =
cmStrCat("$<TARGET_LINKER_FILE:", gtgt->GetName(), '>');
- bool stdPipesUTF8 = true;
cmCustomCommandLines cmd = cmMakeSingleCommandLine(
{ cmSystemTools::GetCMakeCommand(), "-E", "cmake_symlink_library",
str_file, str_so_file, str_link_file });
- cmCustomCommand command(
- std::vector<std::string>(), std::vector<std::string>(),
- std::vector<std::string>(), cmd, this->CurrentMakefile->GetBacktrace(),
- "Creating symlinks", "", stdPipesUTF8);
+ cmCustomCommand command;
+ command.SetCommandLines(cmd);
+ command.SetComment("Creating symlinks");
+ command.SetWorkingDirectory("");
+ command.SetBacktrace(this->CurrentMakefile->GetBacktrace());
+ command.SetStdPipesUTF8(true);
postbuild.push_back(std::move(command));
}
@@ -3910,6 +3919,14 @@ void cmGlobalXCodeGenerator::AddEmbeddedFrameworks(cmXCodeObject* target)
NoActionOnCopyByDefault);
}
+void cmGlobalXCodeGenerator::AddEmbeddedPlugIns(cmXCodeObject* target)
+{
+ static const auto dstSubfolderSpec = "13";
+
+ this->AddEmbeddedObjects(target, "Embed PlugIns", "XCODE_EMBED_PLUGINS",
+ dstSubfolderSpec, NoActionOnCopyByDefault);
+}
+
void cmGlobalXCodeGenerator::AddEmbeddedAppExtensions(cmXCodeObject* target)
{
static const auto dstSubfolderSpec = "13";
@@ -4298,6 +4315,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
for (auto t : targets) {
this->AddDependAndLinkInformation(t);
this->AddEmbeddedFrameworks(t);
+ this->AddEmbeddedPlugIns(t);
this->AddEmbeddedAppExtensions(t);
// Inherit project-wide values for any target-specific search paths.
this->InheritBuildSettingAttribute(t, "HEADER_SEARCH_PATHS");
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 4d7ee9010b..5917db3135 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -11,10 +11,12 @@
#include <string>
#include <vector>
+#include <cm/optional>
#include <cm/string_view>
#include "cmGlobalGenerator.h"
#include "cmTransformDepfile.h"
+#include "cmValue.h"
#include "cmXCodeObject.h"
class cmCustomCommand;
@@ -216,6 +218,7 @@ private:
const std::string& dstSubfolderSpec,
int actionsOnByDefault);
void AddEmbeddedFrameworks(cmXCodeObject* target);
+ void AddEmbeddedPlugIns(cmXCodeObject* target);
void AddEmbeddedAppExtensions(cmXCodeObject* target);
void AddPositionIndependentLinkAttribute(cmGeneratorTarget* target,
cmXCodeObject* buildSettings,
diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx
index b53319f510..c09aa466c2 100644
--- a/Source/cmIDEOptions.cxx
+++ b/Source/cmIDEOptions.cxx
@@ -2,15 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmIDEOptions.h"
+#include <algorithm>
+#include <cstring>
#include <iterator>
+#include <utility>
#include <cmext/algorithm>
-#include <string.h>
-
#include "cmsys/String.h"
-#include "cmAlgorithms.h"
#include "cmIDEFlagTable.h"
#include "cmStringAlgorithms.h"
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index eaf88f64a0..52a411b350 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -6,11 +6,13 @@
#include <cassert>
#include <cstddef>
#include <iterator>
+#include <map>
#include <set>
#include <sstream>
#include <utility>
#include <cm/memory>
+#include <cm/string_view>
#include <cmext/string_view>
#include "cmsys/Glob.hxx"
@@ -18,11 +20,13 @@
#include "cmArgumentParser.h"
#include "cmExecutionStatus.h"
#include "cmExportSet.h"
+#include "cmFileSet.h"
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmInstallCommandArguments.h"
#include "cmInstallDirectoryGenerator.h"
#include "cmInstallExportGenerator.h"
+#include "cmInstallFileSetGenerator.h"
#include "cmInstallFilesGenerator.h"
#include "cmInstallGenerator.h"
#include "cmInstallGetRuntimeDependenciesGenerator.h"
@@ -89,6 +93,9 @@ public:
bool MakeFilesFullPath(const char* modeName,
const std::vector<std::string>& relFiles,
std::vector<std::string>& absFiles);
+ bool MakeFilesFullPath(const char* modeName, const std::string& basePath,
+ const std::vector<std::string>& relFiles,
+ std::vector<std::string>& absFiles);
bool CheckCMP0006(bool& failure) const;
std::string GetDestination(const cmInstallCommandArguments* args,
@@ -177,6 +184,19 @@ std::unique_ptr<cmInstallFilesGenerator> CreateInstallFilesGenerator(
args.GetDestination());
}
+std::unique_ptr<cmInstallFileSetGenerator> CreateInstallFileSetGenerator(
+ Helper& helper, cmTarget& target, cmFileSet* fileSet,
+ const std::string& destination, const cmInstallCommandArguments& args)
+{
+ cmInstallGenerator::MessageLevel message =
+ cmInstallGenerator::SelectMessageLevel(helper.Makefile);
+ return cm::make_unique<cmInstallFileSetGenerator>(
+ target.GetName(), fileSet, destination, args.GetPermissions(),
+ args.GetConfigurations(), args.GetComponent(), message,
+ args.GetExcludeFromAll(), args.GetOptional(),
+ helper.Makefile->GetBacktrace());
+}
+
void AddInstallRuntimeDependenciesGenerator(
Helper& helper, cmInstallRuntimeDependencySet* runtimeDependencySet,
const cmInstallCommandArguments& runtimeArgs,
@@ -390,6 +410,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
std::vector<std::string> PrivateHeader;
std::vector<std::string> PublicHeader;
std::vector<std::string> Resource;
+ std::vector<std::vector<std::string>> FileSets;
};
static auto const argHelper =
@@ -403,7 +424,8 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
.Bind("INCLUDES"_s, &ArgVectors::Includes)
.Bind("PRIVATE_HEADER"_s, &ArgVectors::PrivateHeader)
.Bind("PUBLIC_HEADER"_s, &ArgVectors::PublicHeader)
- .Bind("RESOURCE"_s, &ArgVectors::Resource);
+ .Bind("RESOURCE"_s, &ArgVectors::Resource)
+ .Bind("FILE_SET"_s, &ArgVectors::FileSets);
std::vector<std::string> genericArgVector;
ArgVectors const argVectors = argHelper.Parse(args, &genericArgVector);
@@ -442,6 +464,8 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
cmInstallCommandArguments publicHeaderArgs(helper.DefaultComponentName);
cmInstallCommandArguments resourceArgs(helper.DefaultComponentName);
cmInstallCommandIncludesArgument includesArgs;
+ std::vector<cmInstallCommandFileSetArguments> fileSetArgs(
+ argVectors.FileSets.size(), { helper.DefaultComponentName });
// now parse the args for specific parts of the target (e.g. LIBRARY,
// RUNTIME, ARCHIVE etc.
@@ -455,6 +479,15 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
publicHeaderArgs.Parse(argVectors.PublicHeader, &unknownArgs);
resourceArgs.Parse(argVectors.Resource, &unknownArgs);
includesArgs.Parse(&argVectors.Includes, &unknownArgs);
+ for (std::size_t i = 0; i < argVectors.FileSets.size(); i++) {
+ // We have to create a separate object for the parsing because
+ // cmArgumentParser<void>::Bind() binds to a specific address, but the
+ // objects in the vector can move around. So we parse in an object with a
+ // fixed address and then copy the data into the vector.
+ cmInstallCommandFileSetArguments fileSetArg(helper.DefaultComponentName);
+ fileSetArg.Parse(argVectors.FileSets[i], &unknownArgs);
+ fileSetArgs[i] = std::move(fileSetArg);
+ }
if (!unknownArgs.empty()) {
// Unknown argument.
@@ -473,6 +506,9 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
privateHeaderArgs.SetGenericArguments(&genericArgs);
publicHeaderArgs.SetGenericArguments(&genericArgs);
resourceArgs.SetGenericArguments(&genericArgs);
+ for (auto& fileSetArg : fileSetArgs) {
+ fileSetArg.SetGenericArguments(&genericArgs);
+ }
success = success && archiveArgs.Finalize();
success = success && libraryArgs.Finalize();
@@ -483,6 +519,9 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
success = success && privateHeaderArgs.Finalize();
success = success && publicHeaderArgs.Finalize();
success = success && resourceArgs.Finalize();
+ for (auto& fileSetArg : fileSetArgs) {
+ success = success && fileSetArg.Finalize();
+ }
if (!success) {
return false;
@@ -493,7 +532,10 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
if (archiveArgs.GetNamelinkOnly() || runtimeArgs.GetNamelinkOnly() ||
objectArgs.GetNamelinkOnly() || frameworkArgs.GetNamelinkOnly() ||
bundleArgs.GetNamelinkOnly() || privateHeaderArgs.GetNamelinkOnly() ||
- publicHeaderArgs.GetNamelinkOnly() || resourceArgs.GetNamelinkOnly()) {
+ publicHeaderArgs.GetNamelinkOnly() || resourceArgs.GetNamelinkOnly() ||
+ std::any_of(fileSetArgs.begin(), fileSetArgs.end(),
+ [](const cmInstallCommandFileSetArguments& fileSetArg)
+ -> bool { return fileSetArg.GetNamelinkOnly(); })) {
status.SetError(
"TARGETS given NAMELINK_ONLY option not in LIBRARY group. "
"The NAMELINK_ONLY option may be specified only following LIBRARY.");
@@ -502,7 +544,10 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
if (archiveArgs.GetNamelinkSkip() || runtimeArgs.GetNamelinkSkip() ||
objectArgs.GetNamelinkSkip() || frameworkArgs.GetNamelinkSkip() ||
bundleArgs.GetNamelinkSkip() || privateHeaderArgs.GetNamelinkSkip() ||
- publicHeaderArgs.GetNamelinkSkip() || resourceArgs.GetNamelinkSkip()) {
+ publicHeaderArgs.GetNamelinkSkip() || resourceArgs.GetNamelinkSkip() ||
+ std::any_of(fileSetArgs.begin(), fileSetArgs.end(),
+ [](const cmInstallCommandFileSetArguments& fileSetArg)
+ -> bool { return fileSetArg.GetNamelinkSkip(); })) {
status.SetError(
"TARGETS given NAMELINK_SKIP option not in LIBRARY group. "
"The NAMELINK_SKIP option may be specified only following LIBRARY.");
@@ -515,7 +560,10 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
bundleArgs.HasNamelinkComponent() ||
privateHeaderArgs.HasNamelinkComponent() ||
publicHeaderArgs.HasNamelinkComponent() ||
- resourceArgs.HasNamelinkComponent()) {
+ resourceArgs.HasNamelinkComponent() ||
+ std::any_of(fileSetArgs.begin(), fileSetArgs.end(),
+ [](const cmInstallCommandFileSetArguments& fileSetArg)
+ -> bool { return fileSetArg.HasNamelinkComponent(); })) {
status.SetError(
"TARGETS given NAMELINK_COMPONENT option not in LIBRARY group. "
"The NAMELINK_COMPONENT option may be specified only following "
@@ -531,12 +579,21 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
!libraryArgs.GetType().empty() || !runtimeArgs.GetType().empty() ||
!objectArgs.GetType().empty() || !frameworkArgs.GetType().empty() ||
!bundleArgs.GetType().empty() || !privateHeaderArgs.GetType().empty() ||
- !publicHeaderArgs.GetType().empty() || !resourceArgs.GetType().empty()) {
+ !publicHeaderArgs.GetType().empty() || !resourceArgs.GetType().empty() ||
+ std::any_of(fileSetArgs.begin(), fileSetArgs.end(),
+ [](const cmInstallCommandFileSetArguments& fileSetArg)
+ -> bool { return !fileSetArg.GetType().empty(); })) {
status.SetError(
"TARGETS given TYPE option. The TYPE option may only be specified in "
" install(FILES) and install(DIRECTORIES).");
return false;
}
+ if (std::any_of(fileSetArgs.begin(), fileSetArgs.end(),
+ [](const cmInstallCommandFileSetArguments& fileSetArg)
+ -> bool { return fileSetArg.GetFileSet().empty(); })) {
+ status.SetError("TARGETS given FILE_SET option without file set name.");
+ return false;
+ }
cmInstallRuntimeDependencySet* runtimeDependencySet = nullptr;
if (withRuntimeDependencies) {
@@ -647,6 +704,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
bool installsPrivateHeader = false;
bool installsPublicHeader = false;
bool installsResource = false;
+ std::vector<bool> installsFileSet(fileSetArgs.size(), false);
// Generate install script code to install the given targets.
for (cmTarget* ti : targets) {
@@ -662,6 +720,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
std::unique_ptr<cmInstallFilesGenerator> privateHeaderGenerator;
std::unique_ptr<cmInstallFilesGenerator> publicHeaderGenerator;
std::unique_ptr<cmInstallFilesGenerator> resourceGenerator;
+ std::vector<std::unique_ptr<cmInstallFileSetGenerator>> fileSetGenerators;
// Avoid selecting default destinations for PUBLIC_HEADER and
// PRIVATE_HEADER if any artifacts are specified.
@@ -670,9 +729,24 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
// Track whether this is a namelink-only rule.
bool namelinkOnly = false;
- auto addTargetExport = [&]() {
+ auto addTargetExport = [&]() -> bool {
// Add this install rule to an export if one was specified.
if (!exports.empty()) {
+ auto interfaceFileSets = target.GetAllInterfaceFileSets();
+ if (std::any_of(
+ interfaceFileSets.begin(), interfaceFileSets.end(),
+ [=](const std::string& name) -> bool {
+ return !std::any_of(
+ fileSetArgs.begin(), fileSetArgs.end(),
+ [=](const cmInstallCommandFileSetArguments& fileSetArg)
+ -> bool { return fileSetArg.GetFileSet() == name; });
+ })) {
+ status.SetError(cmStrCat(
+ "TARGETS target ", target.GetName(),
+ " is exported but not all of its file sets are installed"));
+ return false;
+ }
+
auto te = cm::make_unique<cmTargetExport>();
te->TargetName = target.GetName();
te->ArchiveGenerator = archiveGenerator.get();
@@ -682,6 +756,9 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
te->LibraryGenerator = libraryGenerator.get();
te->RuntimeGenerator = runtimeGenerator.get();
te->ObjectsGenerator = objectGenerator.get();
+ for (auto const& gen : fileSetGenerators) {
+ te->FileSetGenerators[gen->GetFileSet()] = gen.get();
+ }
target.AddInstallIncludeDirectories(
cmMakeRange(includesArgs.GetIncludeDirs()));
te->NamelinkOnly = namelinkOnly;
@@ -689,6 +766,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
->GetExportSets()[exports]
.AddTargetExport(std::move(te));
}
+ return true;
};
switch (target.GetType()) {
@@ -700,7 +778,9 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
// When in namelink only mode skip all libraries on Windows.
if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) {
namelinkOnly = true;
- addTargetExport();
+ if (!addTargetExport()) {
+ return false;
+ }
continue;
}
@@ -736,7 +816,9 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
// When in namelink only mode skip frameworks.
if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) {
namelinkOnly = true;
- addTargetExport();
+ if (!addTargetExport()) {
+ return false;
+ }
continue;
}
@@ -785,7 +867,9 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
// When in namelink only mode skip frameworks.
if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) {
namelinkOnly = true;
- addTargetExport();
+ if (!addTargetExport()) {
+ return false;
+ }
continue;
}
@@ -942,9 +1026,9 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
helper.GetIncludeDestination(&privateHeaderArgs));
} else {
std::ostringstream e;
- e << "INSTALL TARGETS - target " << target.GetName() << " has "
+ e << "Target " << target.GetName() << " has "
<< "PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION.";
- cmSystemTools::Message(e.str(), "Warning");
+ helper.Makefile->IssueMessage(MessageType::AUTHOR_WARNING, e.str());
}
}
@@ -964,9 +1048,9 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
helper.GetIncludeDestination(&publicHeaderArgs));
} else {
std::ostringstream e;
- e << "INSTALL TARGETS - target " << target.GetName() << " has "
+ e << "Target " << target.GetName() << " has "
<< "PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION.";
- cmSystemTools::Message(e.str(), "Warning");
+ helper.Makefile->IssueMessage(MessageType::AUTHOR_WARNING, e.str());
}
}
@@ -983,16 +1067,47 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
resourceGenerator = CreateInstallFilesGenerator(
helper.Makefile, absFiles, resourceArgs, false);
} else if (!target.IsAppBundleOnApple()) {
- cmSystemTools::Message(
- cmStrCat("INSTALL TARGETS - target ", target.GetName(),
- " has RESOURCE files but no RESOURCE DESTINATION."),
- "Warning");
+ helper.Makefile->IssueMessage(
+ MessageType::AUTHOR_WARNING,
+ cmStrCat("Target ", target.GetName(),
+ " has RESOURCE files but no RESOURCE DESTINATION."));
+ }
+ }
+ }
+
+ if (!namelinkOnly) {
+ for (std::size_t i = 0; i < fileSetArgs.size(); i++) {
+ auto* fileSet = target.GetFileSet(fileSetArgs[i].GetFileSet());
+ auto interfaceFileSetEntries = cmExpandedList(target.GetSafeProperty(
+ cmTarget::GetInterfaceFileSetsPropertyName(fileSet->GetType())));
+ if (fileSet &&
+ std::find(
+ interfaceFileSetEntries.begin(), interfaceFileSetEntries.end(),
+ fileSetArgs[i].GetFileSet()) != interfaceFileSetEntries.end()) {
+ std::string destination;
+ if (fileSet->GetType() == "HEADERS"_s) {
+ destination = helper.GetIncludeDestination(&fileSetArgs[i]);
+ } else {
+ destination = fileSetArgs[i].GetDestination();
+ if (destination.empty()) {
+ status.SetError(
+ cmStrCat("TARGETS given no FILE_SET DESTINATION for target \"",
+ target.GetName(), "\" file set \"",
+ fileSet->GetName(), "\"."));
+ return false;
+ }
+ }
+ fileSetGenerators.push_back(CreateInstallFileSetGenerator(
+ helper, target, fileSet, destination, fileSetArgs[i]));
+ installsFileSet[i] = true;
}
}
}
// Add this install rule to an export if one was specified.
- addTargetExport();
+ if (!addTargetExport()) {
+ return false;
+ }
// Keep track of whether we're installing anything in each category
installsArchive = installsArchive || archiveGenerator;
@@ -1016,6 +1131,9 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
helper.Makefile->AddInstallGenerator(std::move(privateHeaderGenerator));
helper.Makefile->AddInstallGenerator(std::move(publicHeaderGenerator));
helper.Makefile->AddInstallGenerator(std::move(resourceGenerator));
+ for (auto& gen : fileSetGenerators) {
+ helper.Makefile->AddInstallGenerator(std::move(gen));
+ }
}
if (withRuntimeDependencies && !runtimeDependencySet->Empty()) {
@@ -1067,6 +1185,12 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
helper.Makefile->GetGlobalGenerator()->AddInstallComponent(
resourceArgs.GetComponent());
}
+ for (std::size_t i = 0; i < fileSetArgs.size(); i++) {
+ if (installsFileSet[i]) {
+ helper.Makefile->GetGlobalGenerator()->AddInstallComponent(
+ fileSetArgs[i].GetComponent());
+ }
+ }
return true;
}
@@ -2063,12 +2187,20 @@ bool Helper::MakeFilesFullPath(const char* modeName,
const std::vector<std::string>& relFiles,
std::vector<std::string>& absFiles)
{
+ return this->MakeFilesFullPath(
+ modeName, this->Makefile->GetCurrentSourceDirectory(), relFiles, absFiles);
+}
+
+bool Helper::MakeFilesFullPath(const char* modeName,
+ const std::string& basePath,
+ const std::vector<std::string>& relFiles,
+ std::vector<std::string>& absFiles)
+{
for (std::string const& relFile : relFiles) {
std::string file = relFile;
std::string::size_type gpos = cmGeneratorExpression::Find(file);
if (gpos != 0 && !cmSystemTools::FileIsFullPath(file)) {
- file =
- cmStrCat(this->Makefile->GetCurrentSourceDirectory(), '/', relFile);
+ file = cmStrCat(basePath, '/', relFile);
}
// Make sure the file is not a directory.
diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx
index cc3df2abb3..7309316454 100644
--- a/Source/cmInstallCommandArguments.cxx
+++ b/Source/cmInstallCommandArguments.cxx
@@ -152,6 +152,11 @@ const std::string& cmInstallCommandArguments::GetType() const
return this->Type;
}
+const std::string& cmInstallCommandArguments::GetDefaultComponent() const
+{
+ return this->DefaultComponentName;
+}
+
const std::vector<std::string>& cmInstallCommandArguments::GetConfigurations()
const
{
@@ -220,3 +225,17 @@ void cmInstallCommandIncludesArgument::Parse(
this->IncludeDirs.push_back(std::move(dir));
}
}
+
+cmInstallCommandFileSetArguments::cmInstallCommandFileSetArguments(
+ std::string defaultComponent)
+ : cmInstallCommandArguments(std::move(defaultComponent))
+{
+ this->Bind("FILE_SET"_s, this->FileSet);
+}
+
+void cmInstallCommandFileSetArguments::Parse(
+ std::vector<std::string> args, std::vector<std::string>* unconsumedArgs)
+{
+ args.insert(args.begin(), "FILE_SET");
+ this->cmInstallCommandArguments::Parse(args, unconsumedArgs);
+}
diff --git a/Source/cmInstallCommandArguments.h b/Source/cmInstallCommandArguments.h
index f318a1a881..79bd945c7a 100644
--- a/Source/cmInstallCommandArguments.h
+++ b/Source/cmInstallCommandArguments.h
@@ -34,6 +34,8 @@ public:
bool HasNamelinkComponent() const;
const std::string& GetType() const;
+ const std::string& GetDefaultComponent() const;
+
static bool CheckPermissions(const std::string& onePerm, std::string& perm);
private:
@@ -71,3 +73,17 @@ public:
private:
std::vector<std::string> IncludeDirs;
};
+
+class cmInstallCommandFileSetArguments : public cmInstallCommandArguments
+{
+public:
+ cmInstallCommandFileSetArguments(std::string defaultComponent);
+
+ void Parse(std::vector<std::string> args,
+ std::vector<std::string>* unconsumedArgs);
+
+ const std::string& GetFileSet() const { return this->FileSet; }
+
+private:
+ std::string FileSet;
+};
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index d932fd9e6f..820f24a8f4 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -85,7 +85,9 @@ void cmInstallExportGenerator::ComputeTempDir()
}
if (useMD5) {
// Replace the destination path with a hash to keep it short.
+#ifndef CMAKE_BOOTSTRAP
this->TempDir += cmSystemTools::ComputeStringMD5(this->Destination);
+#endif
} else {
std::string dest = this->Destination;
// Avoid unix full paths.
diff --git a/Source/cmInstallFileSetGenerator.cxx b/Source/cmInstallFileSetGenerator.cxx
new file mode 100644
index 0000000000..7121ea399c
--- /dev/null
+++ b/Source/cmInstallFileSetGenerator.cxx
@@ -0,0 +1,88 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cmInstallFileSetGenerator.h"
+
+#include <map>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "cmFileSet.h"
+#include "cmGeneratorExpression.h"
+#include "cmGlobalGenerator.h"
+#include "cmInstallType.h"
+#include "cmLocalGenerator.h"
+#include "cmStringAlgorithms.h"
+
+cmInstallFileSetGenerator::cmInstallFileSetGenerator(
+ std::string targetName, cmFileSet* fileSet, std::string const& dest,
+ std::string file_permissions, std::vector<std::string> const& configurations,
+ std::string const& component, MessageLevel message, bool exclude_from_all,
+ bool optional, cmListFileBacktrace backtrace)
+ : cmInstallGenerator(dest, configurations, component, message,
+ exclude_from_all, false, std::move(backtrace))
+ , TargetName(std::move(targetName))
+ , FileSet(fileSet)
+ , FilePermissions(std::move(file_permissions))
+ , Optional(optional)
+{
+ this->ActionsPerConfig = true;
+}
+
+cmInstallFileSetGenerator::~cmInstallFileSetGenerator() = default;
+
+bool cmInstallFileSetGenerator::Compute(cmLocalGenerator* lg)
+{
+ this->LocalGenerator = lg;
+
+ // Lookup this target in the current directory.
+ this->Target = lg->FindLocalNonAliasGeneratorTarget(this->TargetName);
+ if (!this->Target) {
+ // If no local target has been found, find it in the global scope.
+ this->Target =
+ lg->GetGlobalGenerator()->FindGeneratorTarget(this->TargetName);
+ }
+
+ return true;
+}
+
+std::string cmInstallFileSetGenerator::GetDestination(
+ std::string const& config) const
+{
+ return cmGeneratorExpression::Evaluate(this->Destination,
+ this->LocalGenerator, config);
+}
+
+void cmInstallFileSetGenerator::GenerateScriptForConfig(
+ std::ostream& os, const std::string& config, Indent indent)
+{
+ for (auto const& dirEntry : this->CalculateFilesPerDir(config)) {
+ std::string destSub;
+ if (!dirEntry.first.empty()) {
+ destSub = cmStrCat('/', dirEntry.first);
+ }
+ this->AddInstallRule(os, cmStrCat(this->GetDestination(config), destSub),
+ cmInstallType_FILES, dirEntry.second,
+ this->GetOptional(), this->FilePermissions.c_str(),
+ nullptr, nullptr, nullptr, indent);
+ }
+}
+
+std::map<std::string, std::vector<std::string>>
+cmInstallFileSetGenerator::CalculateFilesPerDir(
+ const std::string& config) const
+{
+ std::map<std::string, std::vector<std::string>> result;
+
+ auto dirCges = this->FileSet->CompileDirectoryEntries();
+ auto dirs = this->FileSet->EvaluateDirectoryEntries(
+ dirCges, this->LocalGenerator, config, this->Target);
+
+ auto fileCges = this->FileSet->CompileFileEntries();
+ for (auto const& fileCge : fileCges) {
+ this->FileSet->EvaluateFileEntry(
+ dirs, result, fileCge, this->LocalGenerator, config, this->Target);
+ }
+
+ return result;
+}
diff --git a/Source/cmInstallFileSetGenerator.h b/Source/cmInstallFileSetGenerator.h
new file mode 100644
index 0000000000..8d067d99da
--- /dev/null
+++ b/Source/cmInstallFileSetGenerator.h
@@ -0,0 +1,52 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#pragma once
+
+#include <iosfwd>
+#include <map>
+#include <string>
+#include <vector>
+
+#include "cmInstallGenerator.h"
+#include "cmListFileCache.h"
+#include "cmScriptGenerator.h"
+
+class cmGeneratorTarget;
+class cmFileSet;
+class cmLocalGenerator;
+
+class cmInstallFileSetGenerator : public cmInstallGenerator
+{
+public:
+ cmInstallFileSetGenerator(std::string targetName, cmFileSet* fileSet,
+ std::string const& dest,
+ std::string file_permissions,
+ std::vector<std::string> const& configurations,
+ std::string const& component, MessageLevel message,
+ bool exclude_from_all, bool optional,
+ cmListFileBacktrace backtrace);
+ ~cmInstallFileSetGenerator() override;
+
+ bool Compute(cmLocalGenerator* lg) override;
+
+ std::string GetDestination(std::string const& config) const;
+ std::string GetDestination() const { return this->Destination; }
+ bool GetOptional() const { return this->Optional; }
+ cmFileSet* GetFileSet() const { return this->FileSet; }
+ cmGeneratorTarget* GetTarget() const { return this->Target; }
+
+protected:
+ void GenerateScriptForConfig(std::ostream& os, const std::string& config,
+ Indent indent) override;
+
+private:
+ std::string TargetName;
+ cmLocalGenerator* LocalGenerator;
+ cmFileSet* const FileSet;
+ std::string const FilePermissions;
+ bool const Optional;
+ cmGeneratorTarget* Target;
+
+ std::map<std::string, std::vector<std::string>> CalculateFilesPerDir(
+ const std::string& config) const;
+};
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 7d42fc8276..b35832797d 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -155,7 +155,7 @@ bool HandleLengthCommand(std::vector<std::string> const& args,
GetList(varArgsExpanded, listName, status.GetMakefile());
size_t length = varArgsExpanded.size();
char buffer[1024];
- sprintf(buffer, "%d", static_cast<int>(length));
+ snprintf(buffer, sizeof(buffer), "%d", static_cast<int>(length));
status.GetMakefile().AddDefinition(variableName, buffer);
return true;
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index 2456db9fe8..2080b40aa8 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -44,6 +44,7 @@ namespace {
const char* LastName = nullptr;
+extern "C" void TrapsForSignals(int sig);
extern "C" void TrapsForSignals(int sig)
{
fprintf(stderr, "CMake loaded command %s crashed with signal: %d.\n",
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index fc5e6e5f18..a07e2981b8 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -37,6 +37,7 @@
#include "cmInstallTargetGenerator.h"
#include "cmLinkLineComputer.h"
#include "cmMakefile.h"
+#include "cmRange.h"
#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
#include "cmSourceFileLocation.h"
@@ -834,16 +835,14 @@ cmValue cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target,
}
std::string cmLocalGenerator::ConvertToIncludeReference(
- std::string const& path, IncludePathStyle pathStyle, OutputFormat format)
+ std::string const& path, OutputFormat format)
{
- static_cast<void>(pathStyle);
return this->ConvertToOutputForExisting(path, format);
}
std::string cmLocalGenerator::GetIncludeFlags(
std::vector<std::string> const& includeDirs, cmGeneratorTarget* target,
- std::string const& lang, std::string const& config, bool forResponseFile,
- IncludePathStyle pathStyle)
+ std::string const& lang, std::string const& config, bool forResponseFile)
{
if (lang.empty()) {
return "";
@@ -922,8 +921,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
}
flagUsed = true;
}
- std::string includePath =
- this->ConvertToIncludeReference(i, pathStyle, shellFormat);
+ std::string includePath = this->ConvertToIncludeReference(i, shellFormat);
if (quotePaths && !includePath.empty() && includePath.front() != '\"') {
includeFlags << "\"";
}
@@ -1056,14 +1054,8 @@ void cmLocalGenerator::AddCompileOptions(std::vector<BT<std::string>>& flags,
}
cmTarget* cmLocalGenerator::AddCustomCommandToTarget(
- const std::string& target, const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends,
- const cmCustomCommandLines& commandLines, cmCustomCommandType type,
- const char* comment, const char* workingDir,
- cmPolicies::PolicyStatus cmp0116, bool escapeOldStyle, bool uses_terminal,
- const std::string& depfile, const std::string& job_pool,
- bool command_expand_lists, cmObjectLibraryCommands objLibCommands,
- bool stdPipesUTF8)
+ const std::string& target, cmCustomCommandType type,
+ std::unique_ptr<cmCustomCommand> cc, cmObjectLibraryCommands objLibCommands)
{
cmTarget* t = this->Makefile->GetCustomCommandTarget(
target, objLibCommands, this->DirectoryBacktrace);
@@ -1071,74 +1063,45 @@ cmTarget* cmLocalGenerator::AddCustomCommandToTarget(
return nullptr;
}
- detail::AddCustomCommandToTarget(
- *this, this->DirectoryBacktrace, cmCommandOrigin::Generator, t, byproducts,
- depends, commandLines, type, comment, workingDir, escapeOldStyle,
- uses_terminal, depfile, job_pool, command_expand_lists, stdPipesUTF8,
- cmp0116);
+ cc->SetBacktrace(this->DirectoryBacktrace);
- return t;
-}
+ detail::AddCustomCommandToTarget(*this, cmCommandOrigin::Generator, t, type,
+ std::move(cc));
-cmSourceFile* cmLocalGenerator::AddCustomCommandToOutput(
- const std::string& output, const std::vector<std::string>& depends,
- const std::string& main_dependency, const cmCustomCommandLines& commandLines,
- const char* comment, const char* workingDir,
- cmPolicies::PolicyStatus cmp0116, bool replace, bool escapeOldStyle,
- bool uses_terminal, bool command_expand_lists, const std::string& depfile,
- const std::string& job_pool, bool stdPipesUTF8)
-{
- std::vector<std::string> no_byproducts;
- cmImplicitDependsList no_implicit_depends;
- return this->AddCustomCommandToOutput(
- { output }, no_byproducts, depends, main_dependency, no_implicit_depends,
- commandLines, comment, workingDir, cmp0116, replace, escapeOldStyle,
- uses_terminal, command_expand_lists, depfile, job_pool, stdPipesUTF8);
+ return t;
}
cmSourceFile* cmLocalGenerator::AddCustomCommandToOutput(
- const std::vector<std::string>& outputs,
- const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends, const std::string& main_dependency,
- const cmImplicitDependsList& implicit_depends,
- const cmCustomCommandLines& commandLines, const char* comment,
- const char* workingDir, cmPolicies::PolicyStatus cmp0116, bool replace,
- bool escapeOldStyle, bool uses_terminal, bool command_expand_lists,
- const std::string& depfile, const std::string& job_pool, bool stdPipesUTF8)
+ const std::string& main_dependency, std::unique_ptr<cmCustomCommand> cc,
+ bool replace)
{
// Make sure there is at least one output.
- if (outputs.empty()) {
+ if (cc->GetOutputs().empty()) {
cmSystemTools::Error("Attempt to add a custom rule with no output!");
return nullptr;
}
- return detail::AddCustomCommandToOutput(
- *this, this->DirectoryBacktrace, cmCommandOrigin::Generator, outputs,
- byproducts, depends, main_dependency, implicit_depends, commandLines,
- comment, workingDir, replace, escapeOldStyle, uses_terminal,
- command_expand_lists, depfile, job_pool, stdPipesUTF8, cmp0116);
+ cc->SetBacktrace(this->DirectoryBacktrace);
+ return detail::AddCustomCommandToOutput(*this, cmCommandOrigin::Generator,
+ main_dependency, std::move(cc),
+ replace);
}
cmTarget* cmLocalGenerator::AddUtilityCommand(
- const std::string& utilityName, bool excludeFromAll, const char* workingDir,
- const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends,
- const cmCustomCommandLines& commandLines, cmPolicies::PolicyStatus cmp0116,
- bool escapeOldStyle, const char* comment, bool uses_terminal,
- bool command_expand_lists, const std::string& job_pool, bool stdPipesUTF8)
+ const std::string& utilityName, bool excludeFromAll,
+ std::unique_ptr<cmCustomCommand> cc)
{
cmTarget* target =
this->Makefile->AddNewUtilityTarget(utilityName, excludeFromAll);
target->SetIsGeneratorProvided(true);
- if (commandLines.empty() && depends.empty()) {
+ if (cc->GetCommandLines().empty() && cc->GetDepends().empty()) {
return target;
}
- detail::AddUtilityCommand(
- *this, this->DirectoryBacktrace, cmCommandOrigin::Generator, target,
- workingDir, byproducts, depends, commandLines, escapeOldStyle, comment,
- uses_terminal, command_expand_lists, job_pool, stdPipesUTF8, cmp0116);
+ cc->SetBacktrace(this->DirectoryBacktrace);
+ detail::AddUtilityCommand(*this, cmCommandOrigin::Generator, target,
+ std::move(cc));
return target;
}
@@ -1410,25 +1373,23 @@ std::vector<BT<std::string>> cmLocalGenerator::GetStaticLibraryFlags(
}
void cmLocalGenerator::GetDeviceLinkFlags(
- cmLinkLineComputer* linkLineComputer, const std::string& config,
+ cmLinkLineComputer& linkLineComputer, const std::string& config,
std::string& linkLibs, std::string& linkFlags, std::string& frameworkPath,
std::string& linkPath, cmGeneratorTarget* target)
{
cmGeneratorTarget::DeviceLinkSetter setter(*target);
cmComputeLinkInformation* pcli = target->GetLinkInformation(config);
- const std::string linkLanguage =
- linkLineComputer->GetLinkerLanguage(target, config);
if (pcli) {
// Compute the required device link libraries when
// resolving gpu lang device symbols
- this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs, frameworkPath,
+ this->OutputLinkLibraries(pcli, &linkLineComputer, linkLibs, frameworkPath,
linkPath);
}
std::vector<std::string> linkOpts;
- target->GetLinkOptions(linkOpts, config, linkLanguage);
+ target->GetLinkOptions(linkOpts, config, "CUDA");
// LINK_OPTIONS are escaped.
this->AppendCompileOptions(linkFlags, linkOpts);
}
@@ -2751,8 +2712,6 @@ void cmLocalGenerator::CopyPchCompilePdb(
file << "endforeach()\n";
}
- bool stdPipesUTF8 = true;
-
auto configGenex = [&](cm::string_view expr) -> std::string {
if (this->GetGlobalGenerator()->IsMultiConfig()) {
return cmStrCat("$<$<CONFIG:", config, ">:", expr, ">");
@@ -2766,28 +2725,27 @@ void cmLocalGenerator::CopyPchCompilePdb(
configGenex(copy_script) });
const std::string no_main_dependency;
- const std::vector<std::string> no_deps;
const char* no_message = "";
- const char* no_current_dir = nullptr;
- const cmPolicies::PolicyStatus cmp0116_new = cmPolicies::NEW;
- std::vector<std::string> no_byproducts;
std::vector<std::string> outputs;
outputs.push_back(configGenex(
cmStrCat(target_compile_pdb_dir, pdb_prefix, ReuseFrom, ".pdb")));
+ auto cc = cm::make_unique<cmCustomCommand>();
+ cc->SetCommandLines(commandLines);
+ cc->SetComment(no_message);
+ cc->SetCMP0116Status(cmPolicies::NEW);
+ cc->SetStdPipesUTF8(true);
+
if (this->GetGlobalGenerator()->IsVisualStudio()) {
+ cc->SetByproducts(outputs);
this->AddCustomCommandToTarget(
- target->GetName(), outputs, no_deps, commandLines,
- cmCustomCommandType::PRE_BUILD, no_message, no_current_dir, cmp0116_new,
- true, false, "", "", false, cmObjectLibraryCommands::Accept,
- stdPipesUTF8);
+ target->GetName(), cmCustomCommandType::PRE_BUILD, std::move(cc),
+ cmObjectLibraryCommands::Accept);
} else {
- cmImplicitDependsList no_implicit_depends;
- cmSourceFile* copy_rule = this->AddCustomCommandToOutput(
- outputs, no_byproducts, no_deps, no_main_dependency, no_implicit_depends,
- commandLines, no_message, no_current_dir, cmp0116_new, false, true,
- false, false, "", "", stdPipesUTF8);
+ cc->SetOutputs(outputs);
+ cmSourceFile* copy_rule =
+ this->AddCustomCommandToOutput(no_main_dependency, std::move(cc));
if (copy_rule) {
target->AddSource(copy_rule->ResolveFullPath());
@@ -2808,10 +2766,47 @@ inline void RegisterUnitySources(cmGeneratorTarget* target, cmSourceFile* sf,
}
}
-void cmLocalGenerator::IncludeFileInUnitySources(
- cmGeneratedFileStream& unity_file, std::string const& sf_full_path,
- cmValue beforeInclude, cmValue afterInclude, cmValue uniqueIdName) const
+cmLocalGenerator::UnitySource cmLocalGenerator::WriteUnitySource(
+ cmGeneratorTarget* target, std::vector<std::string> const& configs,
+ cmRange<std::vector<UnityBatchedSource>::const_iterator> sources,
+ cmValue beforeInclude, cmValue afterInclude, std::string filename) const
{
+ cmValue uniqueIdName = target->GetProperty("UNITY_BUILD_UNIQUE_ID");
+ cmGeneratedFileStream file(
+ filename, false, target->GetGlobalGenerator()->GetMakefileEncoding());
+ file.SetCopyIfDifferent(true);
+ file << "/* generated by CMake */\n\n";
+
+ bool perConfig = false;
+ for (UnityBatchedSource const& ubs : sources) {
+ cm::optional<std::string> cond;
+ if (ubs.Configs.size() != configs.size()) {
+ perConfig = true;
+ cond = std::string();
+ cm::string_view sep;
+ for (size_t ci : ubs.Configs) {
+ cond = cmStrCat(*cond, sep, "defined(CMAKE_UNITY_CONFIG_",
+ cmSystemTools::UpperCase(configs[ci]), ")");
+ sep = " || "_s;
+ }
+ }
+ RegisterUnitySources(target, ubs.Source, filename);
+ WriteUnitySourceInclude(file, cond, ubs.Source->ResolveFullPath(),
+ beforeInclude, afterInclude, uniqueIdName);
+ }
+
+ return UnitySource(std::move(filename), perConfig);
+}
+
+void cmLocalGenerator::WriteUnitySourceInclude(
+ std::ostream& unity_file, cm::optional<std::string> const& cond,
+ std::string const& sf_full_path, cmValue beforeInclude, cmValue afterInclude,
+ cmValue uniqueIdName) const
+{
+ if (cond) {
+ unity_file << "#if " << *cond << "\n";
+ }
+
if (cmNonempty(uniqueIdName)) {
std::string pathToHash;
auto PathEqOrSubDir = [](std::string const& a, std::string const& b) {
@@ -2831,7 +2826,10 @@ void cmLocalGenerator::IncludeFileInUnitySources(
unity_file << "/* " << pathToHash << " */\n"
<< "#undef " << *uniqueIdName << "\n"
<< "#define " << *uniqueIdName << " unity_"
- << cmSystemTools::ComputeStringMD5(pathToHash) << "\n";
+#ifndef CMAKE_BOOTSTRAP
+ << cmSystemTools::ComputeStringMD5(pathToHash) << "\n"
+#endif
+ ;
}
if (beforeInclude) {
@@ -2843,21 +2841,25 @@ void cmLocalGenerator::IncludeFileInUnitySources(
if (afterInclude) {
unity_file << *afterInclude << "\n";
}
+ if (cond) {
+ unity_file << "#endif\n";
+ }
unity_file << "\n";
}
-std::vector<std::string> cmLocalGenerator::AddUnityFilesModeAuto(
+std::vector<cmLocalGenerator::UnitySource>
+cmLocalGenerator::AddUnityFilesModeAuto(
cmGeneratorTarget* target, std::string const& lang,
- std::vector<cmSourceFile*> const& filtered_sources, cmValue beforeInclude,
- cmValue afterInclude, std::string const& filename_base, size_t batchSize)
+ std::vector<std::string> const& configs,
+ std::vector<UnityBatchedSource> const& filtered_sources,
+ cmValue beforeInclude, cmValue afterInclude,
+ std::string const& filename_base, size_t batchSize)
{
if (batchSize == 0) {
batchSize = filtered_sources.size();
}
- cmValue uniqueIdName = target->GetProperty("UNITY_BUILD_UNIQUE_ID");
-
- std::vector<std::string> unity_files;
+ std::vector<UnitySource> unity_files;
for (size_t itemsLeft = filtered_sources.size(), chunk, batch = 0;
itemsLeft > 0; itemsLeft -= chunk, ++batch) {
@@ -2865,74 +2867,48 @@ std::vector<std::string> cmLocalGenerator::AddUnityFilesModeAuto(
std::string filename = cmStrCat(filename_base, "unity_", batch,
(lang == "C") ? "_c.c" : "_cxx.cxx");
-
- const std::string filename_tmp = cmStrCat(filename, ".tmp");
- {
- size_t begin = batch * batchSize;
- size_t end = begin + chunk;
-
- cmGeneratedFileStream file(
- filename_tmp, false,
- target->GetGlobalGenerator()->GetMakefileEncoding());
- file << "/* generated by CMake */\n\n";
-
- for (; begin != end; ++begin) {
- cmSourceFile* sf = filtered_sources[begin];
- RegisterUnitySources(target, sf, filename);
- IncludeFileInUnitySources(file, sf->ResolveFullPath(), beforeInclude,
- afterInclude, uniqueIdName);
- }
- }
- cmSystemTools::MoveFileIfDifferent(filename_tmp, filename);
- unity_files.emplace_back(std::move(filename));
+ auto const begin = filtered_sources.begin() + batch * batchSize;
+ auto const end = begin + chunk;
+ unity_files.emplace_back(this->WriteUnitySource(
+ target, configs, cmMakeRange(begin, end), beforeInclude, afterInclude,
+ std::move(filename)));
}
return unity_files;
}
-std::vector<std::string> cmLocalGenerator::AddUnityFilesModeGroup(
+std::vector<cmLocalGenerator::UnitySource>
+cmLocalGenerator::AddUnityFilesModeGroup(
cmGeneratorTarget* target, std::string const& lang,
- std::vector<cmSourceFile*> const& filtered_sources, cmValue beforeInclude,
- cmValue afterInclude, std::string const& filename_base)
+ std::vector<std::string> const& configs,
+ std::vector<UnityBatchedSource> const& filtered_sources,
+ cmValue beforeInclude, cmValue afterInclude,
+ std::string const& filename_base)
{
- std::vector<std::string> unity_files;
+ std::vector<UnitySource> unity_files;
// sources organized by group name. Drop any source
// without a group
- std::unordered_map<std::string, std::vector<cmSourceFile*>> explicit_mapping;
- for (cmSourceFile* sf : filtered_sources) {
- if (cmValue value = sf->GetProperty("UNITY_GROUP")) {
+ std::unordered_map<std::string, std::vector<UnityBatchedSource>>
+ explicit_mapping;
+ for (UnityBatchedSource const& ubs : filtered_sources) {
+ if (cmValue value = ubs.Source->GetProperty("UNITY_GROUP")) {
auto i = explicit_mapping.find(*value);
if (i == explicit_mapping.end()) {
- std::vector<cmSourceFile*> sources{ sf };
- explicit_mapping.emplace(*value, sources);
+ std::vector<UnityBatchedSource> sources{ ubs };
+ explicit_mapping.emplace(*value, std::move(sources));
} else {
- i->second.emplace_back(sf);
+ i->second.emplace_back(ubs);
}
}
}
- cmValue uniqueIdName = target->GetProperty("UNITY_BUILD_UNIQUE_ID");
-
for (auto const& item : explicit_mapping) {
auto const& name = item.first;
std::string filename = cmStrCat(filename_base, "unity_", name,
(lang == "C") ? "_c.c" : "_cxx.cxx");
-
- const std::string filename_tmp = cmStrCat(filename, ".tmp");
- {
- cmGeneratedFileStream file(
- filename_tmp, false,
- target->GetGlobalGenerator()->GetMakefileEncoding());
- file << "/* generated by CMake */\n\n";
-
- for (cmSourceFile* sf : item.second) {
- RegisterUnitySources(target, sf, filename);
- IncludeFileInUnitySources(file, sf->ResolveFullPath(), beforeInclude,
- afterInclude, uniqueIdName);
- }
- }
- cmSystemTools::MoveFileIfDifferent(filename_tmp, filename);
- unity_files.emplace_back(std::move(filename));
+ unity_files.emplace_back(this->WriteUnitySource(
+ target, configs, cmMakeRange(item.second), beforeInclude, afterInclude,
+ std::move(filename)));
}
return unity_files;
@@ -2944,20 +2920,33 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
return;
}
- // FIXME: Handle all configurations in multi-config generators.
- std::string config;
- if (!this->GetGlobalGenerator()->IsMultiConfig()) {
- config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ std::vector<UnityBatchedSource> unitySources;
+
+ std::vector<std::string> configs =
+ this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
+
+ std::map<cmSourceFile const*, size_t> index;
+
+ for (size_t ci = 0; ci < configs.size(); ++ci) {
+ // FIXME: Refactor collection of sources to not evaluate object libraries.
+ std::vector<cmSourceFile*> sources;
+ target->GetSourceFiles(sources, configs[ci]);
+ for (cmSourceFile* sf : sources) {
+ auto mi = index.find(sf);
+ if (mi == index.end()) {
+ unitySources.emplace_back(sf);
+ std::map<cmSourceFile const*, size_t>::value_type entry(
+ sf, unitySources.size() - 1);
+ mi = index.insert(entry).first;
+ }
+ unitySources[mi->second].Configs.emplace_back(ci);
+ }
}
std::string filename_base =
cmStrCat(this->GetCurrentBinaryDirectory(), "/CMakeFiles/",
target->GetName(), ".dir/Unity/");
- // FIXME: Refactor collection of sources to not evaluate object libraries.
- std::vector<cmSourceFile*> sources;
- target->GetSourceFiles(sources, config);
-
cmValue batchSizeString = target->GetProperty("UNITY_BUILD_BATCH_SIZE");
const size_t unityBatchSize = batchSizeString
? static_cast<size_t>(std::atoi(batchSizeString->c_str()))
@@ -2969,9 +2958,11 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
cmValue unityMode = target->GetProperty("UNITY_BUILD_MODE");
for (std::string lang : { "C", "CXX" }) {
- std::vector<cmSourceFile*> filtered_sources;
- std::copy_if(sources.begin(), sources.end(),
- std::back_inserter(filtered_sources), [&](cmSourceFile* sf) {
+ std::vector<UnityBatchedSource> filtered_sources;
+ std::copy_if(unitySources.begin(), unitySources.end(),
+ std::back_inserter(filtered_sources),
+ [&](UnityBatchedSource const& ubs) -> bool {
+ cmSourceFile* sf = ubs.Source;
return sf->GetLanguage() == lang &&
!sf->GetPropertyAsBool("SKIP_UNITY_BUILD_INCLUSION") &&
!sf->GetPropertyAsBool("HEADER_FILE_ONLY") &&
@@ -2981,15 +2972,15 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
!sf->GetProperty("INCLUDE_DIRECTORIES");
});
- std::vector<std::string> unity_files;
+ std::vector<UnitySource> unity_files;
if (!unityMode || *unityMode == "BATCH") {
- unity_files =
- AddUnityFilesModeAuto(target, lang, filtered_sources, beforeInclude,
- afterInclude, filename_base, unityBatchSize);
+ unity_files = AddUnityFilesModeAuto(
+ target, lang, configs, filtered_sources, beforeInclude, afterInclude,
+ filename_base, unityBatchSize);
} else if (unityMode && *unityMode == "GROUP") {
unity_files =
- AddUnityFilesModeGroup(target, lang, filtered_sources, beforeInclude,
- afterInclude, filename_base);
+ AddUnityFilesModeGroup(target, lang, configs, filtered_sources,
+ beforeInclude, afterInclude, filename_base);
} else {
// unity mode is set to an unsupported value
std::string e("Invalid UNITY_BUILD_MODE value of " + *unityMode +
@@ -2998,11 +2989,15 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
this->IssueMessage(MessageType::FATAL_ERROR, e);
}
- for (auto const& file : unity_files) {
- auto* unity = this->GetMakefile()->GetOrCreateSource(file);
- target->AddSource(file, true);
+ for (UnitySource const& file : unity_files) {
+ auto* unity = this->GetMakefile()->GetOrCreateSource(file.Path);
+ target->AddSource(file.Path, true);
unity->SetProperty("SKIP_UNITY_BUILD_INCLUSION", "ON");
- unity->SetProperty("UNITY_SOURCE_FILE", file);
+ unity->SetProperty("UNITY_SOURCE_FILE", file.Path);
+ if (file.PerConfig) {
+ unity->SetProperty("COMPILE_DEFINITIONS",
+ "CMAKE_UNITY_CONFIG_$<UPPER_CASE:$<CONFIG>>");
+ }
}
}
}
@@ -3505,7 +3500,7 @@ std::string& cmLocalGenerator::CreateSafeUniqueObjectFileName(
bool done;
int cc = 0;
char rpstr[100];
- sprintf(rpstr, "_p_");
+ snprintf(rpstr, sizeof(rpstr), "_p_");
cmSystemTools::ReplaceString(ssin, "+", rpstr);
std::string sssin = sin;
do {
@@ -3521,7 +3516,7 @@ std::string& cmLocalGenerator::CreateSafeUniqueObjectFileName(
}
sssin = ssin;
cmSystemTools::ReplaceString(ssin, "_p_", rpstr);
- sprintf(rpstr, "_p%d_", cc++);
+ snprintf(rpstr, sizeof(rpstr), "_p%d_", cc++);
} while (!done);
}
@@ -4015,19 +4010,16 @@ std::string ComputeCustomCommandRuleFileName(cmLocalGenerator& lg,
h.HashString(output).substr(0, 16));
}
-cmSourceFile* AddCustomCommand(
- cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
- cmCommandOrigin origin, const std::vector<std::string>& outputs,
- const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends, const std::string& main_dependency,
- const cmImplicitDependsList& implicit_depends,
- const cmCustomCommandLines& commandLines, const char* comment,
- const char* workingDir, bool replace, bool escapeOldStyle,
- bool uses_terminal, bool command_expand_lists, const std::string& depfile,
- const std::string& job_pool, bool stdPipesUTF8,
- cmPolicies::PolicyStatus cmp0116)
+cmSourceFile* AddCustomCommand(cmLocalGenerator& lg, cmCommandOrigin origin,
+ const std::string& main_dependency,
+ std::unique_ptr<cmCustomCommand> cc,
+ bool replace)
{
cmMakefile* mf = lg.GetMakefile();
+ const auto& lfbt = cc->GetBacktrace();
+ const auto& outputs = cc->GetOutputs();
+ const auto& byproducts = cc->GetByproducts();
+ const auto& commandLines = cc->GetCommandLines();
// Choose a source file on which to store the custom command.
cmSourceFile* file = nullptr;
@@ -4082,28 +4074,18 @@ cmSourceFile* AddCustomCommand(
// Attach the custom command to the file.
if (file) {
// Construct a complete list of dependencies.
- std::vector<std::string> depends2(depends);
if (!main_dependency.empty()) {
- depends2.push_back(main_dependency);
+ cc->AppendDepends({ main_dependency });
}
- std::unique_ptr<cmCustomCommand> cc = cm::make_unique<cmCustomCommand>(
- outputs, byproducts, depends2, commandLines, lfbt, comment, workingDir,
- stdPipesUTF8);
- cc->SetEscapeOldStyle(escapeOldStyle);
cc->SetEscapeAllowMakeVars(true);
- cc->SetImplicitDepends(implicit_depends);
- cc->SetUsesTerminal(uses_terminal);
- cc->SetCommandExpandLists(command_expand_lists);
- cc->SetDepfile(depfile);
- cc->SetJobPool(job_pool);
- cc->SetCMP0116Status(cmp0116);
- file->SetCustomCommand(std::move(cc));
lg.AddSourceOutputs(file, outputs, cmLocalGenerator::OutputRole::Primary,
lfbt, origin);
lg.AddSourceOutputs(file, byproducts,
cmLocalGenerator::OutputRole::Byproduct, lfbt, origin);
+
+ file->SetCustomCommand(std::move(cc));
}
return file;
}
@@ -4132,63 +4114,39 @@ bool AnyTargetCommandOutputMatches(
}
namespace detail {
-void AddCustomCommandToTarget(cmLocalGenerator& lg,
- const cmListFileBacktrace& lfbt,
- cmCommandOrigin origin, cmTarget* target,
- const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends,
- const cmCustomCommandLines& commandLines,
- cmCustomCommandType type, const char* comment,
- const char* workingDir, bool escapeOldStyle,
- bool uses_terminal, const std::string& depfile,
- const std::string& job_pool,
- bool command_expand_lists, bool stdPipesUTF8,
- cmPolicies::PolicyStatus cmp0116)
+void AddCustomCommandToTarget(cmLocalGenerator& lg, cmCommandOrigin origin,
+ cmTarget* target, cmCustomCommandType type,
+ std::unique_ptr<cmCustomCommand> cc)
{
// Add the command to the appropriate build step for the target.
- std::vector<std::string> no_output;
- cmCustomCommand cc(no_output, byproducts, depends, commandLines, lfbt,
- comment, workingDir, stdPipesUTF8);
- cc.SetEscapeOldStyle(escapeOldStyle);
- cc.SetEscapeAllowMakeVars(true);
- cc.SetUsesTerminal(uses_terminal);
- cc.SetCommandExpandLists(command_expand_lists);
- cc.SetDepfile(depfile);
- cc.SetJobPool(job_pool);
- cc.SetCMP0116Status(cmp0116);
- cc.SetTarget(target->GetName());
+ cc->SetEscapeAllowMakeVars(true);
+ cc->SetTarget(target->GetName());
+
+ lg.AddTargetByproducts(target, cc->GetByproducts(), cc->GetBacktrace(),
+ origin);
+
switch (type) {
case cmCustomCommandType::PRE_BUILD:
- target->AddPreBuildCommand(std::move(cc));
+ target->AddPreBuildCommand(std::move(*cc));
break;
case cmCustomCommandType::PRE_LINK:
- target->AddPreLinkCommand(std::move(cc));
+ target->AddPreLinkCommand(std::move(*cc));
break;
case cmCustomCommandType::POST_BUILD:
- target->AddPostBuildCommand(std::move(cc));
+ target->AddPostBuildCommand(std::move(*cc));
break;
}
- lg.AddTargetByproducts(target, byproducts, lfbt, origin);
+ cc.reset();
}
-cmSourceFile* AddCustomCommandToOutput(
- cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
- cmCommandOrigin origin, const std::vector<std::string>& outputs,
- const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends, const std::string& main_dependency,
- const cmImplicitDependsList& implicit_depends,
- const cmCustomCommandLines& commandLines, const char* comment,
- const char* workingDir, bool replace, bool escapeOldStyle,
- bool uses_terminal, bool command_expand_lists, const std::string& depfile,
- const std::string& job_pool, bool stdPipesUTF8,
- cmPolicies::PolicyStatus cmp0116)
+cmSourceFile* AddCustomCommandToOutput(cmLocalGenerator& lg,
+ cmCommandOrigin origin,
+ const std::string& main_dependency,
+ std::unique_ptr<cmCustomCommand> cc,
+ bool replace)
{
- return AddCustomCommand(lg, lfbt, origin, outputs, byproducts, depends,
- main_dependency, implicit_depends, commandLines,
- comment, workingDir, replace, escapeOldStyle,
- uses_terminal, command_expand_lists, depfile,
- job_pool, stdPipesUTF8, cmp0116);
+ return AddCustomCommand(lg, origin, main_dependency, std::move(cc), replace);
}
void AppendCustomCommandToOutput(cmLocalGenerator& lg,
@@ -4231,33 +4189,27 @@ void AppendCustomCommandToOutput(cmLocalGenerator& lg,
lfbt);
}
-void AddUtilityCommand(cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
- cmCommandOrigin origin, cmTarget* target,
- const char* workingDir,
- const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends,
- const cmCustomCommandLines& commandLines,
- bool escapeOldStyle, const char* comment,
- bool uses_terminal, bool command_expand_lists,
- const std::string& job_pool, bool stdPipesUTF8,
- cmPolicies::PolicyStatus cmp0116)
+void AddUtilityCommand(cmLocalGenerator& lg, cmCommandOrigin origin,
+ cmTarget* target, std::unique_ptr<cmCustomCommand> cc)
{
+ // They might be moved away
+ auto byproducts = cc->GetByproducts();
+ auto lfbt = cc->GetBacktrace();
+
// Use an empty comment to avoid generation of default comment.
- if (!comment) {
- comment = "";
+ if (!cc->GetComment()) {
+ cc->SetComment("");
}
// Create the generated symbolic output name of the utility target.
std::string output =
lg.CreateUtilityOutput(target->GetName(), byproducts, lfbt);
+ cc->SetOutputs(output);
std::string no_main_dependency;
- cmImplicitDependsList no_implicit_depends;
- cmSourceFile* rule = AddCustomCommand(
- lg, lfbt, origin, { output }, byproducts, depends, no_main_dependency,
- no_implicit_depends, commandLines, comment, workingDir,
- /*replace=*/false, escapeOldStyle, uses_terminal, command_expand_lists,
- /*depfile=*/"", job_pool, stdPipesUTF8, cmp0116);
+ cmSourceFile* rule =
+ AddCustomCommand(lg, origin, no_main_dependency, std::move(cc),
+ /*replace=*/false);
if (rule) {
lg.AddTargetByproducts(target, byproducts, lfbt, origin);
}
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 3614c8466e..5793f29627 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -11,8 +11,11 @@
#include <set>
#include <string>
#include <unordered_map>
+#include <utility>
#include <vector>
+#include <cm/optional>
+
#include <cm3p/kwiml/int.h>
#include "cmCustomCommandTypes.h"
@@ -28,7 +31,6 @@ class cmComputeLinkInformation;
class cmCustomCommand;
class cmCustomCommandGenerator;
class cmCustomCommandLines;
-class cmGeneratedFileStream;
class cmGeneratorTarget;
class cmGlobalGenerator;
class cmImplicitDependsList;
@@ -40,6 +42,9 @@ class cmState;
class cmTarget;
class cmake;
+template <typename Iter>
+class cmRange;
+
/** Flag if byproducts shall also be considered. */
enum class cmSourceOutputKind
{
@@ -174,18 +179,12 @@ public:
bool AppendLWYUFlags(std::string& flags, const cmGeneratorTarget* target,
const std::string& lang);
- enum class IncludePathStyle
- {
- Default,
- Absolute,
- };
-
//! Get the include flags for the current makefile and language
- std::string GetIncludeFlags(
- std::vector<std::string> const& includes, cmGeneratorTarget* target,
- std::string const& lang, std::string const& config,
- bool forResponseFile = false,
- IncludePathStyle pathStyle = IncludePathStyle::Default);
+ std::string GetIncludeFlags(std::vector<std::string> const& includes,
+ cmGeneratorTarget* target,
+ std::string const& lang,
+ std::string const& config,
+ bool forResponseFile = false);
using GeneratorTargetVector =
std::vector<std::unique_ptr<cmGeneratorTarget>>;
@@ -324,53 +323,24 @@ public:
* Add a custom PRE_BUILD, PRE_LINK, or POST_BUILD command to a target.
*/
cmTarget* AddCustomCommandToTarget(
- const std::string& target, const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends,
- const cmCustomCommandLines& commandLines, cmCustomCommandType type,
- const char* comment, const char* workingDir,
- cmPolicies::PolicyStatus cmp0116, bool escapeOldStyle = true,
- bool uses_terminal = false, const std::string& depfile = "",
- const std::string& job_pool = "", bool command_expand_lists = false,
- cmObjectLibraryCommands objLibCommands = cmObjectLibraryCommands::Reject,
- bool stdPipesUTF8 = false);
+ const std::string& target, cmCustomCommandType type,
+ std::unique_ptr<cmCustomCommand> cc,
+ cmObjectLibraryCommands objLibCommands = cmObjectLibraryCommands::Reject);
/**
* Add a custom command to a source file.
*/
- cmSourceFile* AddCustomCommandToOutput(
- const std::string& output, const std::vector<std::string>& depends,
- const std::string& main_dependency,
- const cmCustomCommandLines& commandLines, const char* comment,
- const char* workingDir, cmPolicies::PolicyStatus cmp0116,
- bool replace = false, bool escapeOldStyle = true,
- bool uses_terminal = false, bool command_expand_lists = false,
- const std::string& depfile = "", const std::string& job_pool = "",
- bool stdPipesUTF8 = false);
- cmSourceFile* AddCustomCommandToOutput(
- const std::vector<std::string>& outputs,
- const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends,
- const std::string& main_dependency,
- const cmImplicitDependsList& implicit_depends,
- const cmCustomCommandLines& commandLines, const char* comment,
- const char* workingDir, cmPolicies::PolicyStatus cmp0116,
- bool replace = false, bool escapeOldStyle = true,
- bool uses_terminal = false, bool command_expand_lists = false,
- const std::string& depfile = "", const std::string& job_pool = "",
- bool stdPipesUTF8 = false);
+ cmSourceFile* AddCustomCommandToOutput(const std::string& main_dependency,
+ std::unique_ptr<cmCustomCommand> cc,
+ bool replace = false);
/**
* Add a utility to the build. A utility target is a command that is run
* every time the target is built.
*/
- cmTarget* AddUtilityCommand(
- const std::string& utilityName, bool excludeFromAll,
- const char* workingDir, const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends,
- const cmCustomCommandLines& commandLines, cmPolicies::PolicyStatus cmp0116,
- bool escapeOldStyle = true, const char* comment = nullptr,
- bool uses_terminal = false, bool command_expand_lists = false,
- const std::string& job_pool = "", bool stdPipesUTF8 = false);
+ cmTarget* AddUtilityCommand(const std::string& utilityName,
+ bool excludeFromAll,
+ std::unique_ptr<cmCustomCommand> cc);
virtual std::string CreateUtilityOutput(
std::string const& targetName, std::vector<std::string> const& byproducts,
@@ -496,7 +466,7 @@ public:
/** Fill out these strings for the given target. Libraries to link,
* flags, and linkflags. */
- void GetDeviceLinkFlags(cmLinkLineComputer* linkLineComputer,
+ void GetDeviceLinkFlags(cmLinkLineComputer& linkLineComputer,
const std::string& config, std::string& linkLibs,
std::string& linkFlags, std::string& frameworkPath,
std::string& linkPath, cmGeneratorTarget* target);
@@ -550,12 +520,11 @@ public:
cmValue GetRuleLauncher(cmGeneratorTarget* target, const std::string& prop);
protected:
- // The default implementation ignores the IncludePathStyle and always
- // uses absolute paths. A generator may override this to use relative
- // paths in some cases.
+ // The default implementation converts to a Windows shortpath to
+ // help older toolchains handle spaces and such. A generator may
+ // override this to avoid that conversion.
virtual std::string ConvertToIncludeReference(
- std::string const& path, IncludePathStyle pathStyle,
- cmOutputConverter::OutputFormat format);
+ std::string const& path, cmOutputConverter::OutputFormat format);
//! put all the libraries for a target on into the given stream
void OutputLinkLibraries(cmComputeLinkInformation* pcli,
@@ -657,18 +626,48 @@ private:
const std::string& ReuseFrom,
cmGeneratorTarget* reuseTarget,
std::vector<std::string> const& extensions);
- void IncludeFileInUnitySources(cmGeneratedFileStream& unity_file,
- std::string const& sf_full_path,
- cmValue beforeInclude, cmValue afterInclude,
- cmValue uniqueIdName) const;
- std::vector<std::string> AddUnityFilesModeAuto(
+
+ struct UnityBatchedSource
+ {
+ cmSourceFile* Source = nullptr;
+ std::vector<size_t> Configs;
+ UnityBatchedSource(cmSourceFile* sf)
+ : Source(sf)
+ {
+ }
+ };
+ struct UnitySource
+ {
+ std::string Path;
+ bool PerConfig = false;
+ UnitySource(std::string path, bool perConfig)
+ : Path(std::move(path))
+ , PerConfig(perConfig)
+ {
+ }
+ };
+
+ UnitySource WriteUnitySource(
+ cmGeneratorTarget* target, std::vector<std::string> const& configs,
+ cmRange<std::vector<UnityBatchedSource>::const_iterator> sources,
+ cmValue beforeInclude, cmValue afterInclude, std::string filename) const;
+ void WriteUnitySourceInclude(std::ostream& unity_file,
+ cm::optional<std::string> const& cond,
+ std::string const& sf_full_path,
+ cmValue beforeInclude, cmValue afterInclude,
+ cmValue uniqueIdName) const;
+ std::vector<UnitySource> AddUnityFilesModeAuto(
cmGeneratorTarget* target, std::string const& lang,
- std::vector<cmSourceFile*> const& filtered_sources, cmValue beforeInclude,
- cmValue afterInclude, std::string const& filename_base, size_t batchSize);
- std::vector<std::string> AddUnityFilesModeGroup(
+ std::vector<std::string> const& configs,
+ std::vector<UnityBatchedSource> const& filtered_sources,
+ cmValue beforeInclude, cmValue afterInclude,
+ std::string const& filename_base, size_t batchSize);
+ std::vector<UnitySource> AddUnityFilesModeGroup(
cmGeneratorTarget* target, std::string const& lang,
- std::vector<cmSourceFile*> const& filtered_sources, cmValue beforeInclude,
- cmValue afterInclude, std::string const& filename_base);
+ std::vector<std::string> const& configs,
+ std::vector<UnityBatchedSource> const& filtered_sources,
+ cmValue beforeInclude, cmValue afterInclude,
+ std::string const& filename_base);
};
#if !defined(CMAKE_BOOTSTRAP)
@@ -678,30 +677,15 @@ bool cmLocalGeneratorCheckObjectName(std::string& objName,
#endif
namespace detail {
-void AddCustomCommandToTarget(cmLocalGenerator& lg,
- const cmListFileBacktrace& lfbt,
- cmCommandOrigin origin, cmTarget* target,
- const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends,
- const cmCustomCommandLines& commandLines,
- cmCustomCommandType type, const char* comment,
- const char* workingDir, bool escapeOldStyle,
- bool uses_terminal, const std::string& depfile,
- const std::string& job_pool,
- bool command_expand_lists, bool stdPipesUTF8,
- cmPolicies::PolicyStatus cmp0116);
-
-cmSourceFile* AddCustomCommandToOutput(
- cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
- cmCommandOrigin origin, const std::vector<std::string>& outputs,
- const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends, const std::string& main_dependency,
- const cmImplicitDependsList& implicit_depends,
- const cmCustomCommandLines& commandLines, const char* comment,
- const char* workingDir, bool replace, bool escapeOldStyle,
- bool uses_terminal, bool command_expand_lists, const std::string& depfile,
- const std::string& job_pool, bool stdPipesUTF8,
- cmPolicies::PolicyStatus cmp0116);
+void AddCustomCommandToTarget(cmLocalGenerator& lg, cmCommandOrigin origin,
+ cmTarget* target, cmCustomCommandType type,
+ std::unique_ptr<cmCustomCommand> cc);
+
+cmSourceFile* AddCustomCommandToOutput(cmLocalGenerator& lg,
+ cmCommandOrigin origin,
+ const std::string& main_dependency,
+ std::unique_ptr<cmCustomCommand> cc,
+ bool replace);
void AppendCustomCommandToOutput(cmLocalGenerator& lg,
const cmListFileBacktrace& lfbt,
@@ -710,16 +694,8 @@ void AppendCustomCommandToOutput(cmLocalGenerator& lg,
const cmImplicitDependsList& implicit_depends,
const cmCustomCommandLines& commandLines);
-void AddUtilityCommand(cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
- cmCommandOrigin origin, cmTarget* target,
- const char* workingDir,
- const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends,
- const cmCustomCommandLines& commandLines,
- bool escapeOldStyle, const char* comment,
- bool uses_terminal, bool command_expand_lists,
- const std::string& job_pool, bool stdPipesUTF8,
- cmPolicies::PolicyStatus cmp0116);
+void AddUtilityCommand(cmLocalGenerator& lg, cmCommandOrigin origin,
+ cmTarget* target, std::unique_ptr<cmCustomCommand> cc);
std::vector<std::string> ComputeISPCObjectSuffixes(cmGeneratorTarget* target);
std::vector<std::string> ComputeISPCExtraObjects(
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 8556fe6b56..106f76bf8e 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -205,11 +205,8 @@ cmGlobalNinjaGenerator* cmLocalNinjaGenerator::GetGlobalNinjaGenerator()
// Virtual protected methods.
std::string cmLocalNinjaGenerator::ConvertToIncludeReference(
- std::string const& path, IncludePathStyle pathStyle,
- cmOutputConverter::OutputFormat format)
+ std::string const& path, cmOutputConverter::OutputFormat format)
{
- // FIXME: Remove IncludePathStyle infrastructure. It is no longer used.
- static_cast<void>(pathStyle);
return this->ConvertToOutputFormat(path, format);
}
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index 64040374e4..3118bb472d 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -12,7 +12,6 @@
#include "cmListFileCache.h"
#include "cmLocalCommonGenerator.h"
-#include "cmLocalGenerator.h"
#include "cmNinjaTypes.h"
#include "cmOutputConverter.h"
@@ -93,8 +92,7 @@ public:
protected:
std::string ConvertToIncludeReference(
- std::string const& path, IncludePathStyle pathStyle,
- cmOutputConverter::OutputFormat format) override;
+ std::string const& path, cmOutputConverter::OutputFormat format) override;
private:
cmGeneratedFileStream& GetImplFileStream(const std::string& config) const;
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 7e39b91f10..2700ded91e 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1279,7 +1279,7 @@ std::string cmLocalUnixMakefileGenerator3::CreateMakeVariable(
// it is used then add number to the end of the variable
while (this->ShortMakeVariableMap.count(ret) && ni < 1000) {
++ni;
- sprintf(buffer, "%04d", ni);
+ snprintf(buffer, sizeof(buffer), "%04d", ni);
ret = unmodified + buffer;
}
this->ShortMakeVariableMap[ret] = "1";
@@ -1304,11 +1304,11 @@ std::string cmLocalUnixMakefileGenerator3::CreateMakeVariable(
}
char buffer[5];
int ni = 0;
- sprintf(buffer, "%04d", ni);
+ snprintf(buffer, sizeof(buffer), "%04d", ni);
ret = str1 + str2 + buffer;
while (this->ShortMakeVariableMap.count(ret) && ni < 1000) {
++ni;
- sprintf(buffer, "%04d", ni);
+ snprintf(buffer, sizeof(buffer), "%04d", ni);
ret = str1 + str2 + buffer;
}
if (ni == 1000) {
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 3ed49a03f4..4c0d2eea64 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -2,18 +2,19 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmLocalVisualStudio10Generator.h"
-#include <cmext/algorithm>
-
#include <cm3p/expat.h>
-#include "cmAlgorithms.h"
-#include "cmGeneratorTarget.h"
+#include "cmGlobalGenerator.h"
#include "cmGlobalVisualStudio10Generator.h"
-#include "cmMakefile.h"
+#include "cmGlobalVisualStudioGenerator.h"
+#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmVisualStudio10TargetGenerator.h"
#include "cmXMLParser.h"
#include "cmake.h"
+class cmGeneratorTarget;
+
class cmVS10XMLParser : public cmXMLParser
{
public:
diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h
index 45ee0822c3..75fe262a0b 100644
--- a/Source/cmLocalVisualStudio10Generator.h
+++ b/Source/cmLocalVisualStudio10Generator.h
@@ -8,6 +8,7 @@
#include "cmLocalVisualStudio7Generator.h"
+class cmGeneratorTarget;
class cmGlobalGenerator;
class cmMakefile;
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 96dda53939..c40e33e5d5 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -2,26 +2,44 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmLocalVisualStudio7Generator.h"
+#include <algorithm>
+#include <cassert>
+#include <cstring>
+#include <functional>
+#include <sstream>
+#include <utility>
+
#include <cm/memory>
#include <cmext/algorithm>
#include <windows.h>
#include <cm3p/expat.h>
-#include <ctype.h> // for isspace
+
+#include "cmsys/FStream.hxx"
#include "cmComputeLinkInformation.h"
#include "cmCustomCommand.h"
#include "cmCustomCommandGenerator.h"
+#include "cmCustomCommandLines.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
+#include "cmGlobalGenerator.h"
#include "cmGlobalVisualStudio7Generator.h"
+#include "cmGlobalVisualStudioGenerator.h"
+#include "cmListFileCache.h"
#include "cmMakefile.h"
-#include "cmMessageType.h"
+#include "cmOutputConverter.h"
+#include "cmPolicies.h"
#include "cmSourceFile.h"
+#include "cmSourceGroup.h"
+#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cmTargetDepend.h"
+#include "cmValue.h"
#include "cmXMLParser.h"
#include "cmake.h"
@@ -109,7 +127,6 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
const auto& tgts = this->GetGeneratorTargets();
for (auto& l : tgts) {
if (l->GetType() == cmStateEnums::GLOBAL_TARGET) {
- std::vector<std::string> no_depends;
cmCustomCommandLines force_commands =
cmMakeSingleCommandLine({ "cd", "." });
std::string no_main_dependency;
@@ -119,9 +136,13 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
this->Makefile->GetOrCreateGeneratedSource(force)) {
sf->SetProperty("SYMBOLIC", "1");
}
+ auto cc = cm::make_unique<cmCustomCommand>();
+ cc->SetOutputs(force);
+ cc->SetCommandLines(force_commands);
+ cc->SetComment(" ");
+ cc->SetCMP0116Status(cmPolicies::NEW);
if (cmSourceFile* file = this->AddCustomCommandToOutput(
- force, no_depends, no_main_dependency, force_commands, " ",
- nullptr, cmPolicies::NEW, true)) {
+ no_main_dependency, std::move(cc), true)) {
l->AddSource(file->ResolveFullPath());
}
}
@@ -239,16 +260,19 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
std::string argB = cmStrCat("-B", this->GetBinaryDirectory());
std::string stampName =
cmStrCat(this->GetCurrentBinaryDirectory(), "/CMakeFiles/generate.stamp");
- bool stdPipesUTF8 = true;
cmCustomCommandLines commandLines =
cmMakeSingleCommandLine({ cmSystemTools::GetCMakeCommand(), argS, argB,
"--check-stamp-file", stampName });
std::string comment = cmStrCat("Building Custom Rule ", makefileIn);
- const char* no_working_directory = nullptr;
- this->AddCustomCommandToOutput(stampName, listFiles, makefileIn,
- commandLines, comment.c_str(),
- no_working_directory, cmPolicies::NEW, true,
- false, false, false, "", "", stdPipesUTF8);
+ auto cc = cm::make_unique<cmCustomCommand>();
+ cc->SetOutputs(stampName);
+ cc->SetDepends(listFiles);
+ cc->SetCommandLines(commandLines);
+ cc->SetComment(comment.c_str());
+ cc->SetCMP0116Status(cmPolicies::NEW);
+ cc->SetEscapeOldStyle(false);
+ cc->SetStdPipesUTF8(true);
+ this->AddCustomCommandToOutput(makefileIn, std::move(cc), true);
if (cmSourceFile* file = this->Makefile->GetSource(makefileIn)) {
// Finalize the source file path now since we're adding this after
// the generator validated all project-named sources.
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index 6e06c09879..d95ebc2e1b 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -5,7 +5,9 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <iosfwd>
+#include <map>
#include <memory>
+#include <set>
#include <string>
#include <vector>
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index 03213ef1c9..ee7e77f962 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -2,15 +2,21 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmLocalVisualStudioGenerator.h"
+#include <utility>
+
#include "windows.h"
#include "cmCustomCommand.h"
#include "cmCustomCommandGenerator.h"
+#include "cmCustomCommandLines.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
+#include "cmOutputConverter.h"
#include "cmSourceFile.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
+#include "cmValue.h"
cmLocalVisualStudioGenerator::cmLocalVisualStudioGenerator(
cmGlobalGenerator* gg, cmMakefile* mf)
@@ -99,15 +105,11 @@ cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmGeneratorTarget* target,
}
// Add a pre-build event to create the directory.
- std::vector<std::string> no_output;
- std::vector<std::string> no_byproducts;
- std::vector<std::string> no_depends;
- bool stdPipesUTF8 = true;
cmCustomCommandLines commands = cmMakeSingleCommandLine(
{ cmSystemTools::GetCMakeCommand(), "-E", "make_directory", impDir });
- pcc.reset(new cmCustomCommand(no_output, no_byproducts, no_depends, commands,
- cmListFileBacktrace(), nullptr, nullptr,
- stdPipesUTF8));
+ pcc.reset(new cmCustomCommand());
+ pcc->SetCommandLines(commands);
+ pcc->SetStdPipesUTF8(true);
pcc->SetEscapeOldStyle(false);
pcc->SetEscapeAllowMakeVars(true);
return pcc;
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index 3b4e3a8ece..dd064a1969 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -2,14 +2,18 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmLocalXCodeGenerator.h"
+#include <memory>
+#include <ostream>
+#include <utility>
+
#include "cmGeneratorTarget.h"
#include "cmGlobalXCodeGenerator.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
+#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
-class cmGeneratorTarget;
class cmGlobalGenerator;
-class cmMakefile;
cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmGlobalGenerator* gg,
cmMakefile* mf)
diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h
index 5f72f6d6c4..ff6b356547 100644
--- a/Source/cmLocalXCodeGenerator.h
+++ b/Source/cmLocalXCodeGenerator.h
@@ -4,6 +4,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <iosfwd>
#include <map>
#include <string>
diff --git a/Source/cmMachO.cxx b/Source/cmMachO.cxx
index 53112e0615..4fcaedf370 100644
--- a/Source/cmMachO.cxx
+++ b/Source/cmMachO.cxx
@@ -56,7 +56,7 @@ bool peek(cmsys::ifstream& fin, T& v)
template <typename T>
bool read(cmsys::ifstream& fin, T& v)
{
- return !!fin.read(reinterpret_cast<char*>(&v), sizeof(T));
+ return static_cast<bool>(fin.read(reinterpret_cast<char*>(&v), sizeof(T)));
}
// read from the file and fill multiple data structures where
@@ -68,7 +68,8 @@ bool read(cmsys::ifstream& fin, std::vector<T>& v)
if (v.empty()) {
return true;
}
- return !!fin.read(reinterpret_cast<char*>(&v[0]), sizeof(T) * v.size());
+ return static_cast<bool>(
+ fin.read(reinterpret_cast<char*>(&v[0]), sizeof(T) * v.size()));
}
}
@@ -340,7 +341,8 @@ bool cmMachO::GetInstallName(std::string& install_name)
if (lc_cmd == LC_ID_DYLIB || lc_cmd == LC_LOAD_WEAK_DYLIB ||
lc_cmd == LC_LOAD_DYLIB) {
if (sizeof(dylib_command) < cmd.LoadCommand.size()) {
- uint32_t namelen = cmd.LoadCommand.size() - sizeof(dylib_command);
+ uint32_t namelen = static_cast<uint32_t>(cmd.LoadCommand.size() -
+ sizeof(dylib_command));
install_name.assign(&cmd.LoadCommand[sizeof(dylib_command)], namelen);
return true;
}
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 8c4b2a71d0..154df63f07 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -77,7 +77,7 @@ bool cmMacroHelperCommand::operator()(
argVs.reserve(expandedArgs.size());
char argvName[60];
for (unsigned int j = 0; j < expandedArgs.size(); ++j) {
- sprintf(argvName, "${ARGV%u}", j);
+ snprintf(argvName, sizeof(argvName), "${ARGV%u}", j);
argVs.emplace_back(argvName);
}
// Invoke all the functions that were collected in the block.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 88f3cc7b1f..661cb05e0b 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -134,8 +134,8 @@ cmDirectoryId cmMakefile::GetDirectoryId() const
// If we ever need to expose this to CMake language code we should
// add a read-only property in cmMakefile::GetProperty.
char buf[32];
- sprintf(buf, "(%p)",
- static_cast<void const*>(this)); // cast avoids format warning
+ snprintf(buf, sizeof(buf), "(%p)",
+ static_cast<void const*>(this)); // cast avoids format warning
return std::string(buf);
}
@@ -891,12 +891,23 @@ struct file_not_persistent
};
}
-void cmMakefile::AddGeneratorAction(GeneratorAction action)
+void cmMakefile::AddGeneratorAction(GeneratorAction&& action)
{
assert(!this->GeneratorActionsInvoked);
this->GeneratorActions.emplace_back(std::move(action), this->Backtrace);
}
+void cmMakefile::GeneratorAction::operator()(cmLocalGenerator& lg,
+ const cmListFileBacktrace& lfbt)
+{
+ if (cc) {
+ CCAction(lg, lfbt, std::move(cc));
+ } else {
+ assert(Action);
+ Action(lg, lfbt);
+ }
+}
+
void cmMakefile::DoGenerate(cmLocalGenerator& lg)
{
// do all the variable expansions here
@@ -904,7 +915,7 @@ void cmMakefile::DoGenerate(cmLocalGenerator& lg)
// give all the commands a chance to do something
// after the file has been parsed before generation
- for (const BT<GeneratorAction>& action : this->GeneratorActions) {
+ for (auto& action : this->GeneratorActions) {
action.Value(lg, action.Backtrace);
}
this->GeneratorActionsInvoked = true;
@@ -956,19 +967,6 @@ private:
cmListFileBacktrace& Backtrace;
cmListFileBacktrace Previous;
};
-
-cm::optional<std::string> MakeOptionalString(const char* str)
-{
- if (str) {
- return str;
- }
- return cm::nullopt;
-}
-
-const char* GetCStrOrNull(const cm::optional<std::string>& str)
-{
- return str ? str->c_str() : nullptr;
-}
}
bool cmMakefile::ValidateCustomCommand(
@@ -1056,14 +1054,12 @@ cmTarget* cmMakefile::GetCustomCommandTarget(
}
cmTarget* cmMakefile::AddCustomCommandToTarget(
- const std::string& target, const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends,
- const cmCustomCommandLines& commandLines, cmCustomCommandType type,
- const char* comment, const char* workingDir,
- cmPolicies::PolicyStatus cmp0116, bool escapeOldStyle, bool uses_terminal,
- const std::string& depfile, const std::string& job_pool,
- bool command_expand_lists, bool stdPipesUTF8)
+ const std::string& target, cmCustomCommandType type,
+ std::unique_ptr<cmCustomCommand> cc)
{
+ const auto& byproducts = cc->GetByproducts();
+ const auto& commandLines = cc->GetCommandLines();
+
cmTarget* t = this->GetCustomCommandTarget(
target, cmObjectLibraryCommands::Reject, this->Backtrace);
@@ -1075,53 +1071,30 @@ cmTarget* cmMakefile::AddCustomCommandToTarget(
// Always create the byproduct sources and mark them generated.
this->CreateGeneratedOutputs(byproducts);
- // Strings could be moved into the callback function with C++14.
- cm::optional<std::string> commentStr = MakeOptionalString(comment);
- cm::optional<std::string> workingStr = MakeOptionalString(workingDir);
+ cc->SetCMP0116Status(this->GetPolicyStatus(cmPolicies::CMP0116));
// Dispatch command creation to allow generator expressions in outputs.
this->AddGeneratorAction(
- [=](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt) {
+ std::move(cc),
+ [=](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
+ std::unique_ptr<cmCustomCommand> tcc) {
BacktraceGuard guard(this->Backtrace, lfbt);
- detail::AddCustomCommandToTarget(
- lg, lfbt, cmCommandOrigin::Project, t, byproducts, depends,
- commandLines, type, GetCStrOrNull(commentStr),
- GetCStrOrNull(workingStr), escapeOldStyle, uses_terminal, depfile,
- job_pool, command_expand_lists, stdPipesUTF8, cmp0116);
+ tcc->SetBacktrace(lfbt);
+ detail::AddCustomCommandToTarget(lg, cmCommandOrigin::Project, t, type,
+ std::move(tcc));
});
return t;
}
void cmMakefile::AddCustomCommandToOutput(
- const std::string& output, const std::vector<std::string>& depends,
- const std::string& main_dependency, const cmCustomCommandLines& commandLines,
- const char* comment, const char* workingDir,
- cmPolicies::PolicyStatus cmp0116, const CommandSourceCallback& callback,
- bool replace, bool escapeOldStyle, bool uses_terminal,
- bool command_expand_lists, const std::string& depfile,
- const std::string& job_pool, bool stdPipesUTF8)
-{
- std::vector<std::string> no_byproducts;
- cmImplicitDependsList no_implicit_depends;
- this->AddCustomCommandToOutput(
- { output }, no_byproducts, depends, main_dependency, no_implicit_depends,
- commandLines, comment, workingDir, cmp0116, callback, replace,
- escapeOldStyle, uses_terminal, command_expand_lists, depfile, job_pool,
- stdPipesUTF8);
-}
-
-void cmMakefile::AddCustomCommandToOutput(
- const std::vector<std::string>& outputs,
- const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends, const std::string& main_dependency,
- const cmImplicitDependsList& implicit_depends,
- const cmCustomCommandLines& commandLines, const char* comment,
- const char* workingDir, cmPolicies::PolicyStatus cmp0116,
- const CommandSourceCallback& callback, bool replace, bool escapeOldStyle,
- bool uses_terminal, bool command_expand_lists, const std::string& depfile,
- const std::string& job_pool, bool stdPipesUTF8)
+ const std::string& main_dependency, std::unique_ptr<cmCustomCommand> cc,
+ const CommandSourceCallback& callback, bool replace)
{
+ const auto& outputs = cc->GetOutputs();
+ const auto& byproducts = cc->GetByproducts();
+ const auto& commandLines = cc->GetCommandLines();
+
// Make sure there is at least one output.
if (outputs.empty()) {
cmSystemTools::Error("Attempt to add a custom rule with no output!");
@@ -1137,20 +1110,18 @@ void cmMakefile::AddCustomCommandToOutput(
this->CreateGeneratedOutputs(outputs);
this->CreateGeneratedOutputs(byproducts);
- // Strings could be moved into the callback function with C++14.
- cm::optional<std::string> commentStr = MakeOptionalString(comment);
- cm::optional<std::string> workingStr = MakeOptionalString(workingDir);
+ cc->SetCMP0116Status(this->GetPolicyStatus(cmPolicies::CMP0116));
// Dispatch command creation to allow generator expressions in outputs.
this->AddGeneratorAction(
- [=](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt) {
+ std::move(cc),
+ [=](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
+ std::unique_ptr<cmCustomCommand> tcc) {
BacktraceGuard guard(this->Backtrace, lfbt);
+ tcc->SetBacktrace(lfbt);
cmSourceFile* sf = detail::AddCustomCommandToOutput(
- lg, lfbt, cmCommandOrigin::Project, outputs, byproducts, depends,
- main_dependency, implicit_depends, commandLines,
- GetCStrOrNull(commentStr), GetCStrOrNull(workingStr), replace,
- escapeOldStyle, uses_terminal, command_expand_lists, depfile, job_pool,
- stdPipesUTF8, cmp0116);
+ lg, cmCommandOrigin::Project, main_dependency, std::move(tcc),
+ replace);
if (callback && sf) {
callback(sf);
}
@@ -1160,19 +1131,21 @@ void cmMakefile::AddCustomCommandToOutput(
void cmMakefile::AddCustomCommandOldStyle(
const std::string& target, const std::vector<std::string>& outputs,
const std::vector<std::string>& depends, const std::string& source,
- const cmCustomCommandLines& commandLines, const char* comment,
- cmPolicies::PolicyStatus cmp0116)
+ const cmCustomCommandLines& commandLines, const char* comment)
{
+ auto cc = cm::make_unique<cmCustomCommand>();
+ cc->SetDepends(depends);
+ cc->SetCommandLines(commandLines);
+ cc->SetComment(comment);
+
// Translate the old-style signature to one of the new-style
// signatures.
if (source == target) {
// In the old-style signature if the source and target were the
// same then it added a post-build rule to the target. Preserve
// this behavior.
- std::vector<std::string> no_byproducts;
- this->AddCustomCommandToTarget(
- target, no_byproducts, depends, commandLines,
- cmCustomCommandType::POST_BUILD, comment, nullptr, cmp0116);
+ this->AddCustomCommandToTarget(target, cmCustomCommandType::POST_BUILD,
+ std::move(cc));
return;
}
@@ -1204,19 +1177,20 @@ void cmMakefile::AddCustomCommandOldStyle(
if (sourceFiles.find(source)) {
// The source looks like a real file. Use it as the main dependency.
for (std::string const& output : outputs) {
- this->AddCustomCommandToOutput(output, depends, source, commandLines,
- comment, nullptr, cmp0116,
+ auto cc1 = cm::make_unique<cmCustomCommand>(*cc);
+ cc1->SetOutputs(output);
+ this->AddCustomCommandToOutput(source, std::move(cc1),
addRuleFileToTarget);
}
} else {
std::string no_main_dependency;
- std::vector<std::string> depends2 = depends;
- depends2.push_back(source);
+ cc->AppendDepends({ source });
// The source may not be a real file. Do not use a main dependency.
for (std::string const& output : outputs) {
- this->AddCustomCommandToOutput(output, depends2, no_main_dependency,
- commandLines, comment, nullptr, cmp0116,
+ auto cc1 = cm::make_unique<cmCustomCommand>(*cc);
+ cc1->SetOutputs(output);
+ this->AddCustomCommandToOutput(no_main_dependency, std::move(cc1),
addRuleFileToTarget);
}
}
@@ -1239,14 +1213,13 @@ void cmMakefile::AppendCustomCommandToOutput(
}
}
-cmTarget* cmMakefile::AddUtilityCommand(
- const std::string& utilityName, bool excludeFromAll, const char* workingDir,
- const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends,
- const cmCustomCommandLines& commandLines, cmPolicies::PolicyStatus cmp0116,
- bool escapeOldStyle, const char* comment, bool uses_terminal,
- bool command_expand_lists, const std::string& job_pool, bool stdPipesUTF8)
+cmTarget* cmMakefile::AddUtilityCommand(const std::string& utilityName,
+ bool excludeFromAll,
+ std::unique_ptr<cmCustomCommand> cc)
{
+ const auto& depends = cc->GetDepends();
+ const auto& byproducts = cc->GetByproducts();
+ const auto& commandLines = cc->GetCommandLines();
cmTarget* target = this->AddNewUtilityTarget(utilityName, excludeFromAll);
// Validate custom commands.
@@ -1258,19 +1231,17 @@ cmTarget* cmMakefile::AddUtilityCommand(
// Always create the byproduct sources and mark them generated.
this->CreateGeneratedOutputs(byproducts);
- // Strings could be moved into the callback function with C++14.
- cm::optional<std::string> commentStr = MakeOptionalString(comment);
- cm::optional<std::string> workingStr = MakeOptionalString(workingDir);
+ cc->SetCMP0116Status(this->GetPolicyStatus(cmPolicies::CMP0116));
// Dispatch command creation to allow generator expressions in outputs.
this->AddGeneratorAction(
- [=](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt) {
+ std::move(cc),
+ [=](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
+ std::unique_ptr<cmCustomCommand> tcc) {
BacktraceGuard guard(this->Backtrace, lfbt);
- detail::AddUtilityCommand(
- lg, lfbt, cmCommandOrigin::Project, target, GetCStrOrNull(workingStr),
- byproducts, depends, commandLines, escapeOldStyle,
- GetCStrOrNull(commentStr), uses_terminal, command_expand_lists,
- job_pool, stdPipesUTF8, cmp0116);
+ tcc->SetBacktrace(lfbt);
+ detail::AddUtilityCommand(lg, cmCommandOrigin::Project, target,
+ std::move(tcc));
});
return target;
@@ -4428,11 +4399,12 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
}
// Deprecate old policies.
- if (status == cmPolicies::OLD && id <= cmPolicies::CMP0088 &&
+ if (status == cmPolicies::OLD && id <= cmPolicies::CMP0094 &&
!(this->GetCMakeInstance()->GetIsInTryCompile() &&
(
// Policies set by cmCoreTryCompile::TryCompileCode.
- id == cmPolicies::CMP0065 || id == cmPolicies::CMP0083))) {
+ id == cmPolicies::CMP0065 || id == cmPolicies::CMP0083 ||
+ id == cmPolicies::CMP0091))) {
this->IssueMessage(MessageType::DEPRECATION_WARNING,
cmPolicies::GetPolicyDeprecatedWarning(id));
}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 671cdab469..af18230a60 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -24,6 +24,7 @@
#include "cm_sys_stat.h"
#include "cmAlgorithms.h"
+#include "cmCustomCommand.h"
#include "cmCustomCommandTypes.h"
#include "cmListFileCache.h"
#include "cmMessageType.h"
@@ -50,7 +51,6 @@ class cmExportBuildFileGenerator;
class cmFunctionBlocker;
class cmGeneratorExpressionEvaluationFile;
class cmGlobalGenerator;
-class cmImplicitDependsList;
class cmInstallGenerator;
class cmLocalGenerator;
class cmMessenger;
@@ -140,13 +140,47 @@ public:
bool EnforceUniqueName(std::string const& name, std::string& msg,
bool isCustom = false) const;
- using GeneratorAction =
- std::function<void(cmLocalGenerator&, const cmListFileBacktrace&)>;
+ class GeneratorAction
+ {
+ using ActionT =
+ std::function<void(cmLocalGenerator&, const cmListFileBacktrace&)>;
+ using CCActionT =
+ std::function<void(cmLocalGenerator&, const cmListFileBacktrace&,
+ std::unique_ptr<cmCustomCommand> cc)>;
+
+ public:
+ GeneratorAction(ActionT&& action)
+ : Action(std::move(action))
+ {
+ }
+
+ GeneratorAction(std::unique_ptr<cmCustomCommand> tcc, CCActionT&& action)
+ : CCAction(std::move(action))
+ , cc(std::move(tcc))
+ {
+ }
+
+ void operator()(cmLocalGenerator& lg, const cmListFileBacktrace& lfbt);
+
+ private:
+ ActionT Action;
+
+ // FIXME: Use std::variant
+ CCActionT CCAction;
+ std::unique_ptr<cmCustomCommand> cc;
+ };
/**
* Register an action that is executed during Generate
*/
- void AddGeneratorAction(GeneratorAction action);
+ void AddGeneratorAction(GeneratorAction&& action);
+
+ /// Helper to insert the constructor GeneratorAction(args...)
+ template <class... Args>
+ void AddGeneratorAction(Args&&... args)
+ {
+ AddGeneratorAction(GeneratorAction(std::move(args)...));
+ }
/**
* Perform generate actions, Library dependency analysis etc before output of
@@ -165,15 +199,9 @@ public:
* Dispatch adding a custom PRE_BUILD, PRE_LINK, or POST_BUILD command to a
* target.
*/
- cmTarget* AddCustomCommandToTarget(
- const std::string& target, const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends,
- const cmCustomCommandLines& commandLines, cmCustomCommandType type,
- const char* comment, const char* workingDir,
- cmPolicies::PolicyStatus cmp0116, bool escapeOldStyle = true,
- bool uses_terminal = false, const std::string& depfile = "",
- const std::string& job_pool = "", bool command_expand_lists = false,
- bool stdPipesUTF8 = false);
+ cmTarget* AddCustomCommandToTarget(const std::string& target,
+ cmCustomCommandType type,
+ std::unique_ptr<cmCustomCommand> cc);
/**
* Called for each file with custom command.
@@ -184,33 +212,14 @@ public:
* Dispatch adding a custom command to a source file.
*/
void AddCustomCommandToOutput(
- const std::string& output, const std::vector<std::string>& depends,
- const std::string& main_dependency,
- const cmCustomCommandLines& commandLines, const char* comment,
- const char* workingDir, cmPolicies::PolicyStatus cmp0116,
- const CommandSourceCallback& callback = nullptr, bool replace = false,
- bool escapeOldStyle = true, bool uses_terminal = false,
- bool command_expand_lists = false, const std::string& depfile = "",
- const std::string& job_pool = "", bool stdPipesUTF8 = false);
- void AddCustomCommandToOutput(
- const std::vector<std::string>& outputs,
- const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends,
- const std::string& main_dependency,
- const cmImplicitDependsList& implicit_depends,
- const cmCustomCommandLines& commandLines, const char* comment,
- const char* workingDir, cmPolicies::PolicyStatus cmp0116,
- const CommandSourceCallback& callback = nullptr, bool replace = false,
- bool escapeOldStyle = true, bool uses_terminal = false,
- bool command_expand_lists = false, const std::string& depfile = "",
- const std::string& job_pool = "", bool stdPipesUTF8 = false);
+ const std::string& main_dependency, std::unique_ptr<cmCustomCommand> cc,
+ const CommandSourceCallback& callback = nullptr, bool replace = false);
void AddCustomCommandOldStyle(const std::string& target,
const std::vector<std::string>& outputs,
const std::vector<std::string>& depends,
const std::string& source,
const cmCustomCommandLines& commandLines,
- const char* comment,
- cmPolicies::PolicyStatus cmp0116);
+ const char* comment);
void AppendCustomCommandToOutput(
const std::string& output, const std::vector<std::string>& depends,
const cmImplicitDependsList& implicit_depends,
@@ -252,14 +261,9 @@ public:
* Dispatch adding a utility to the build. A utility target is a command
* that is run every time the target is built.
*/
- cmTarget* AddUtilityCommand(
- const std::string& utilityName, bool excludeFromAll,
- const char* workingDir, const std::vector<std::string>& byproducts,
- const std::vector<std::string>& depends,
- const cmCustomCommandLines& commandLines, cmPolicies::PolicyStatus cmp0116,
- bool escapeOldStyle = true, const char* comment = nullptr,
- bool uses_terminal = false, bool command_expand_lists = false,
- const std::string& job_pool = "", bool stdPipesUTF8 = false);
+ cmTarget* AddUtilityCommand(const std::string& utilityName,
+ bool excludeFromAll,
+ std::unique_ptr<cmCustomCommand> cc);
/**
* Add a subdirectory to the build.
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 575fb05693..e41ed8ce11 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -170,9 +170,6 @@ void cmMakefileExecutableTargetGenerator::WriteNvidiaDeviceExecutableRule(
// Expand the rule variables.
{
- bool useWatcomQuote =
- this->Makefile->IsOn(linkRuleVar + "_USE_WATCOM_QUOTE");
-
// Set path conversion for link script shells.
this->LocalGenerator->SetLinkScriptShell(useLinkScript);
@@ -181,7 +178,6 @@ void cmMakefileExecutableTargetGenerator::WriteNvidiaDeviceExecutableRule(
this->LocalGenerator,
this->LocalGenerator->GetStateSnapshot().GetDirectory()));
linkLineComputer->SetForResponse(useResponseFileForLibs);
- linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
linkLineComputer->SetRelink(relink);
// Collect up flags to link in needed libraries.
@@ -193,7 +189,7 @@ void cmMakefileExecutableTargetGenerator::WriteNvidiaDeviceExecutableRule(
// rule.
std::string buildObjs;
this->CreateObjectLists(useLinkScript, false, useResponseFileForObjects,
- buildObjs, depends, useWatcomQuote);
+ buildObjs, depends, false);
std::string const& aixExports = this->GetAIXExports(this->GetConfigName());
@@ -204,11 +200,9 @@ void cmMakefileExecutableTargetGenerator::WriteNvidiaDeviceExecutableRule(
this->LocalGenerator->MaybeRelativeToCurBinDir(objectDir),
cmOutputConverter::SHELL);
- cmOutputConverter::OutputFormat output = (useWatcomQuote)
- ? cmOutputConverter::WATCOMQUOTE
- : cmOutputConverter::SHELL;
std::string target = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->MaybeRelativeToCurBinDir(targetOutput), output);
+ this->LocalGenerator->MaybeRelativeToCurBinDir(targetOutput),
+ cmOutputConverter::SHELL);
std::string targetFullPathCompilePDB =
this->ComputeTargetCompilePDB(this->GetConfigName());
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index ace73a77ed..66031dbc4e 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -308,9 +308,6 @@ void cmMakefileLibraryTargetGenerator::WriteNvidiaDeviceLibraryRules(
// Expand the rule variables.
std::vector<std::string> real_link_commands;
{
- bool useWatcomQuote =
- this->Makefile->IsOn(linkRuleVar + "_USE_WATCOM_QUOTE");
-
// Set path conversion for link script shells.
this->LocalGenerator->SetLinkScriptShell(useLinkScript);
@@ -321,7 +318,6 @@ void cmMakefileLibraryTargetGenerator::WriteNvidiaDeviceLibraryRules(
this->LocalGenerator,
this->LocalGenerator->GetStateSnapshot().GetDirectory()));
linkLineComputer->SetForResponse(useResponseFileForLibs);
- linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
linkLineComputer->SetRelink(relink);
this->CreateLinkLibs(linkLineComputer.get(), linkLibs,
@@ -332,11 +328,7 @@ void cmMakefileLibraryTargetGenerator::WriteNvidiaDeviceLibraryRules(
std::string buildObjs;
this->CreateObjectLists(useLinkScript, false, // useArchiveRules
useResponseFileForObjects, buildObjs, depends,
- useWatcomQuote);
-
- cmOutputConverter::OutputFormat output = (useWatcomQuote)
- ? cmOutputConverter::WATCOMQUOTE
- : cmOutputConverter::SHELL;
+ false);
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
objectDir = this->LocalGenerator->ConvertToOutputFormat(
@@ -344,7 +336,8 @@ void cmMakefileLibraryTargetGenerator::WriteNvidiaDeviceLibraryRules(
cmOutputConverter::SHELL);
std::string target = this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->MaybeRelativeToCurBinDir(targetOutput), output);
+ this->LocalGenerator->MaybeRelativeToCurBinDir(targetOutput),
+ cmOutputConverter::SHELL);
std::string targetFullPathCompilePDB =
this->ComputeTargetCompilePDB(this->GetConfigName());
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 8edadd31e7..82308489ad 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -897,28 +897,31 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
// Construct the compile rules.
{
- std::vector<std::string> compileCommands;
+ std::string cudaCompileMode;
if (lang == "CUDA") {
- std::string cmdVar;
if (this->GeneratorTarget->GetPropertyAsBool(
"CUDA_SEPARABLE_COMPILATION")) {
- cmdVar = "CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION";
- } else if (this->GeneratorTarget->GetPropertyAsBool(
- "CUDA_PTX_COMPILATION")) {
- cmdVar = "CMAKE_CUDA_COMPILE_PTX_COMPILATION";
+ const std::string& rdcFlag =
+ this->Makefile->GetRequiredDefinition("_CMAKE_CUDA_RDC_FLAG");
+ cudaCompileMode = cmStrCat(cudaCompileMode, rdcFlag, " ");
+ }
+ if (this->GeneratorTarget->GetPropertyAsBool("CUDA_PTX_COMPILATION")) {
+ const std::string& ptxFlag =
+ this->Makefile->GetRequiredDefinition("_CMAKE_CUDA_PTX_FLAG");
+ cudaCompileMode = cmStrCat(cudaCompileMode, ptxFlag);
} else {
- cmdVar = "CMAKE_CUDA_COMPILE_WHOLE_COMPILATION";
+ const std::string& wholeFlag =
+ this->Makefile->GetRequiredDefinition("_CMAKE_CUDA_WHOLE_FLAG");
+ cudaCompileMode = cmStrCat(cudaCompileMode, wholeFlag);
}
- const std::string& compileRule =
- this->Makefile->GetRequiredDefinition(cmdVar);
- cmExpandList(compileRule, compileCommands);
- } else {
- const std::string cmdVar = "CMAKE_" + lang + "_COMPILE_OBJECT";
- const std::string& compileRule =
- this->Makefile->GetRequiredDefinition(cmdVar);
- cmExpandList(compileRule, compileCommands);
+ vars.CudaCompileMode = cudaCompileMode.c_str();
}
+ std::vector<std::string> compileCommands;
+ const std::string& compileRule = this->Makefile->GetRequiredDefinition(
+ "CMAKE_" + lang + "_COMPILE_OBJECT");
+ cmExpandList(compileRule, compileCommands);
+
if (this->GeneratorTarget->GetPropertyAsBool("EXPORT_COMPILE_COMMANDS") &&
lang_can_export_cmds && compileCommands.size() == 1) {
std::string compileCommand = compileCommands[0];
@@ -1527,9 +1530,9 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule(
return;
}
+ cmLocalUnixMakefileGenerator3* localGen{ this->LocalGenerator };
std::vector<std::string> architectures = cmExpandedList(architecturesStr);
- std::string const& relPath =
- this->LocalGenerator->GetHomeRelativeOutputPath();
+ std::string const& relPath = localGen->GetHomeRelativeOutputPath();
// Ensure there are no duplicates.
const std::vector<std::string> linkDeps = [&]() -> std::vector<std::string> {
@@ -1549,12 +1552,12 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule(
const std::string objectDir = this->GeneratorTarget->ObjectDirectory;
const std::string relObjectDir =
- this->LocalGenerator->MaybeRelativeToCurBinDir(objectDir);
+ localGen->MaybeRelativeToCurBinDir(objectDir);
// Construct a list of files associated with this executable that
// may need to be cleaned.
std::vector<std::string> cleanFiles;
- cleanFiles.push_back(this->LocalGenerator->MaybeRelativeToCurBinDir(output));
+ cleanFiles.push_back(localGen->MaybeRelativeToCurBinDir(output));
std::string profiles;
std::vector<std::string> fatbinaryDepends;
@@ -1591,8 +1594,8 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule(
" -arch=sm_", architecture, registerFileCmd, " -o=$@ ",
cmJoin(linkDeps, " "));
- this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, nullptr, cubin,
- linkDeps, { command }, false);
+ localGen->WriteMakeRule(*this->BuildFileStream, nullptr, cubin, linkDeps,
+ { command }, false);
}
// Combine all architectures into a single fatbinary.
@@ -1606,9 +1609,8 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule(
const std::string fatbinaryOutputRel =
cmStrCat(relPath, relObjectDir, "cmake_cuda_fatbin.h");
- this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, nullptr,
- fatbinaryOutputRel, fatbinaryDepends,
- { fatbinaryCommand }, false);
+ localGen->WriteMakeRule(*this->BuildFileStream, nullptr, fatbinaryOutputRel,
+ fatbinaryDepends, { fatbinaryCommand }, false);
// Compile the stub that registers the kernels and contains the
// fatbinaries.
@@ -1622,18 +1624,21 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule(
vars.Fatbinary = fatbinaryOutput.c_str();
vars.RegisterFile = registerFile.c_str();
+ std::string linkFlags;
+ this->GetDeviceLinkFlags(linkFlags, "CUDA");
+ vars.LinkFlags = linkFlags.c_str();
+
std::string flags = this->GetFlags("CUDA", this->GetConfigName());
vars.Flags = flags.c_str();
std::string compileCmd = this->GetLinkRule("CMAKE_CUDA_DEVICE_LINK_COMPILE");
std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
- this->LocalGenerator->CreateRulePlaceholderExpander());
- rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator,
- compileCmd, vars);
+ localGen->CreateRulePlaceholderExpander());
+ rulePlaceholderExpander->ExpandRuleVariables(localGen, compileCmd, vars);
commands.emplace_back(compileCmd);
- this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, nullptr, output,
- { fatbinaryOutputRel }, commands, false);
+ localGen->WriteMakeRule(*this->BuildFileStream, nullptr, output,
+ { fatbinaryOutputRel }, commands, false);
// Clean all the possible executable names and symlinks.
this->CleanFiles.insert(cleanFiles.begin(), cleanFiles.end());
@@ -2173,7 +2178,7 @@ void cmMakefileTargetGenerator::CreateObjectLists(
for (unsigned int i = 0; i < object_strings.size(); ++i) {
// Number the response files.
char rsp[32];
- sprintf(rsp, "objects%u.rsp", i + 1);
+ snprintf(rsp, sizeof(rsp), "objects%u.rsp", i + 1);
// Create this response file.
std::string objects_rsp =
diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx
index 56221bf5b1..df9ebcf976 100644
--- a/Source/cmMathCommand.cxx
+++ b/Source/cmMathCommand.cxx
@@ -107,7 +107,7 @@ bool HandleExprCommand(std::vector<std::string> const& args,
fmt = "%" KWIML_INT_PRId64;
break;
}
- sprintf(buffer, fmt, helper.GetResult());
+ snprintf(buffer, sizeof(buffer), fmt, helper.GetResult());
std::string const& w = helper.GetWarning();
if (!w.empty()) {
diff --git a/Source/cmMessenger.cxx b/Source/cmMessenger.cxx
index 1cb638ac25..2eead6b596 100644
--- a/Source/cmMessenger.cxx
+++ b/Source/cmMessenger.cxx
@@ -102,7 +102,7 @@ static int getMessageColor(MessageType t)
}
}
-void printMessageText(std::ostream& msg, std::string const& text)
+static void printMessageText(std::ostream& msg, std::string const& text)
{
msg << ":\n";
cmDocumentationFormatter formatter;
@@ -110,7 +110,7 @@ void printMessageText(std::ostream& msg, std::string const& text)
formatter.PrintFormatted(msg, text.c_str());
}
-void displayMessage(MessageType t, std::ostringstream& msg)
+static void displayMessage(MessageType t, std::ostringstream& msg)
{
// Add a note about warning suppression.
if (t == MessageType::AUTHOR_WARNING) {
@@ -155,19 +155,16 @@ void cmMessenger::IssueMessage(MessageType t, const std::string& text,
const cmListFileBacktrace& backtrace) const
{
bool force = false;
- if (!force) {
- // override the message type, if needed, for warnings and errors
- MessageType override = this->ConvertMessageType(t);
- if (override != t) {
- t = override;
- force = true;
- }
+ // override the message type, if needed, for warnings and errors
+ MessageType override = this->ConvertMessageType(t);
+ if (override != t) {
+ t = override;
+ force = true;
}
- if (!force && !this->IsMessageTypeVisible(t)) {
- return;
+ if (force || this->IsMessageTypeVisible(t)) {
+ this->DisplayMessage(t, text, backtrace);
}
- this->DisplayMessage(t, text, backtrace);
}
void cmMessenger::DisplayMessage(MessageType t, const std::string& text,
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 517d52955d..1c5bac8c70 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -326,6 +326,7 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRules(
vars.Object = "$out";
vars.Fatbinary = "$FATBIN";
vars.RegisterFile = "$REGISTER";
+ vars.LinkFlags = "$LINK_FLAGS";
std::string flags = this->GetFlags("CUDA", config);
vars.Flags = flags.c_str();
@@ -744,9 +745,10 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatements(
return deps;
}();
+ cmGlobalNinjaGenerator* globalGen{ this->GetGlobalGenerator() };
const std::string objectDir =
cmStrCat(this->GeneratorTarget->GetSupportDirectory(),
- this->GetGlobalGenerator()->ConfigDirectory(config));
+ globalGen->ConfigDirectory(config));
const std::string ninjaOutputDir = this->ConvertToNinjaPath(objectDir);
cmNinjaBuild fatbinary(this->LanguageLinkerCudaFatbinaryRule(config));
@@ -777,26 +779,37 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatements(
cmStrCat(" -im=profile=sm_", architecture, ",file=", cubin);
fatbinary.ExplicitDeps.emplace_back(cubin);
- this->GetGlobalGenerator()->WriteBuild(this->GetCommonFileStream(), dlink);
+ globalGen->WriteBuild(this->GetCommonFileStream(), dlink);
}
// Combine all architectures into a single fatbinary.
fatbinary.Outputs = { cmStrCat(ninjaOutputDir, "/cmake_cuda_fatbin.h") };
- this->GetGlobalGenerator()->WriteBuild(this->GetCommonFileStream(),
- fatbinary);
+ globalGen->WriteBuild(this->GetCommonFileStream(), fatbinary);
// Compile the stub that registers the kernels and contains the fatbinaries.
+ cmLocalNinjaGenerator* localGen{ this->GetLocalGenerator() };
cmNinjaBuild dcompile(this->LanguageLinkerCudaDeviceCompileRule(config));
dcompile.Outputs = { output };
dcompile.ExplicitDeps = { cmStrCat(ninjaOutputDir, "/cmake_cuda_fatbin.h") };
- dcompile.Variables["FATBIN"] =
- this->GetLocalGenerator()->ConvertToOutputFormat(
- cmStrCat(objectDir, "/cmake_cuda_fatbin.h"), cmOutputConverter::SHELL);
- dcompile.Variables["REGISTER"] =
- this->GetLocalGenerator()->ConvertToOutputFormat(
- cmStrCat(objectDir, "/cmake_cuda_register.h"), cmOutputConverter::SHELL);
- this->GetGlobalGenerator()->WriteBuild(this->GetCommonFileStream(),
- dcompile);
+ dcompile.Variables["FATBIN"] = localGen->ConvertToOutputFormat(
+ cmStrCat(objectDir, "/cmake_cuda_fatbin.h"), cmOutputConverter::SHELL);
+ dcompile.Variables["REGISTER"] = localGen->ConvertToOutputFormat(
+ cmStrCat(objectDir, "/cmake_cuda_register.h"), cmOutputConverter::SHELL);
+
+ cmNinjaLinkLineDeviceComputer linkLineComputer(
+ localGen, localGen->GetStateSnapshot().GetDirectory(), globalGen);
+ linkLineComputer.SetUseNinjaMulti(globalGen->IsMultiConfig());
+
+ // Link libraries and paths are only used during the final executable/library
+ // link.
+ std::string frameworkPath;
+ std::string linkPath;
+ std::string linkLibs;
+ localGen->GetDeviceLinkFlags(linkLineComputer, config, linkLibs,
+ dcompile.Variables["LINK_FLAGS"], frameworkPath,
+ linkPath, this->GetGeneratorTarget());
+
+ globalGen->WriteBuild(this->GetCommonFileStream(), dcompile);
}
void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkStatement(
@@ -850,24 +863,19 @@ void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkStatement(
std::string createRule =
genTarget->GetCreateRuleVariable(this->TargetLinkLanguage(config), config);
- const bool useWatcomQuote =
- this->GetMakefile()->IsOn(createRule + "_USE_WATCOM_QUOTE");
cmLocalNinjaGenerator& localGen = *this->GetLocalGenerator();
vars["TARGET_FILE"] =
localGen.ConvertToOutputFormat(output, cmOutputConverter::SHELL);
- std::unique_ptr<cmLinkLineComputer> linkLineComputer(
- new cmNinjaLinkLineDeviceComputer(
- this->GetLocalGenerator(),
- this->GetLocalGenerator()->GetStateSnapshot().GetDirectory(),
- globalGen));
- linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
- linkLineComputer->SetUseNinjaMulti(globalGen->IsMultiConfig());
+ cmNinjaLinkLineDeviceComputer linkLineComputer(
+ this->GetLocalGenerator(),
+ this->GetLocalGenerator()->GetStateSnapshot().GetDirectory(), globalGen);
+ linkLineComputer.SetUseNinjaMulti(globalGen->IsMultiConfig());
- localGen.GetDeviceLinkFlags(linkLineComputer.get(), config,
- vars["LINK_LIBRARIES"], vars["LINK_FLAGS"],
- frameworkPath, linkPath, genTarget);
+ localGen.GetDeviceLinkFlags(linkLineComputer, config, vars["LINK_LIBRARIES"],
+ vars["LINK_FLAGS"], frameworkPath, linkPath,
+ genTarget);
this->addPoolNinjaVariable("JOB_POOL_LINK", genTarget, vars);
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 57657b1c7d..191b428aba 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -263,10 +263,7 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags,
language, config);
// Add include directory flags.
std::string includeFlags = this->LocalGenerator->GetIncludeFlags(
- includes, this->GeneratorTarget, language, config, false,
- // full include paths for RC needed by cmcldeps
- language == "RC" ? cmLocalGenerator::IncludePathStyle::Absolute
- : cmLocalGenerator::IncludePathStyle::Default);
+ includes, this->GeneratorTarget, language, config, false);
if (this->GetGlobalGenerator()->IsGCCOnWindows()) {
std::replace(includeFlags.begin(), includeFlags.end(), '\\', '/');
}
@@ -325,8 +322,7 @@ std::string cmNinjaTargetGenerator::ComputeIncludes(
}
std::string includesString = this->LocalGenerator->GetIncludeFlags(
- includes, this->GeneratorTarget, language, config, false,
- cmLocalGenerator::IncludePathStyle::Absolute);
+ includes, this->GeneratorTarget, language, config, false);
this->LocalGenerator->AppendFlags(includesString,
this->GetIncludes(language, config));
@@ -605,6 +601,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
vars.TargetCompilePDB = "$TARGET_COMPILE_PDB";
vars.ObjectDir = "$OBJECT_DIR";
vars.ObjectFileDir = "$OBJECT_FILE_DIR";
+ vars.CudaCompileMode = "$CUDA_COMPILE_MODE";
vars.ISPCHeader = "$ISPC_HEADER_FILE";
cmMakefile* mf = this->GetMakefile();
@@ -815,27 +812,32 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
vars.Flags = flags.c_str();
vars.DependencyFile = rule.DepFile.c_str();
- // Rule for compiling object file.
- std::vector<std::string> compileCmds;
+ std::string cudaCompileMode;
if (lang == "CUDA") {
- std::string cmdVar;
if (this->GeneratorTarget->GetPropertyAsBool(
"CUDA_SEPARABLE_COMPILATION")) {
- cmdVar = "CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION";
- } else if (this->GeneratorTarget->GetPropertyAsBool(
- "CUDA_PTX_COMPILATION")) {
- cmdVar = "CMAKE_CUDA_COMPILE_PTX_COMPILATION";
+ const std::string& rdcFlag =
+ this->Makefile->GetRequiredDefinition("_CMAKE_CUDA_RDC_FLAG");
+ cudaCompileMode = cmStrCat(cudaCompileMode, rdcFlag, " ");
+ }
+ if (this->GeneratorTarget->GetPropertyAsBool("CUDA_PTX_COMPILATION")) {
+ const std::string& ptxFlag =
+ this->Makefile->GetRequiredDefinition("_CMAKE_CUDA_PTX_FLAG");
+ cudaCompileMode = cmStrCat(cudaCompileMode, ptxFlag);
} else {
- cmdVar = "CMAKE_CUDA_COMPILE_WHOLE_COMPILATION";
+ const std::string& wholeFlag =
+ this->Makefile->GetRequiredDefinition("_CMAKE_CUDA_WHOLE_FLAG");
+ cudaCompileMode = cmStrCat(cudaCompileMode, wholeFlag);
}
- const std::string& compileCmd = mf->GetRequiredDefinition(cmdVar);
- cmExpandList(compileCmd, compileCmds);
- } else {
- const std::string cmdVar = cmStrCat("CMAKE_", lang, "_COMPILE_OBJECT");
- const std::string& compileCmd = mf->GetRequiredDefinition(cmdVar);
- cmExpandList(compileCmd, compileCmds);
+ vars.CudaCompileMode = cudaCompileMode.c_str();
}
+ // Rule for compiling object file.
+ std::vector<std::string> compileCmds;
+ const std::string cmdVar = cmStrCat("CMAKE_", lang, "_COMPILE_OBJECT");
+ const std::string& compileCmd = mf->GetRequiredDefinition(cmdVar);
+ cmExpandList(compileCmd, compileCmds);
+
// See if we need to use a compiler launcher like ccache or distcc
std::string compilerLauncher;
if (!compileCmds.empty() &&
@@ -1407,8 +1409,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
cmSystemTools::GetParentDirectory(source->GetFullPath()));
std::string sourceDirectoryFlag = this->LocalGenerator->GetIncludeFlags(
- sourceDirectory, this->GeneratorTarget, language, config, false,
- cmLocalGenerator::IncludePathStyle::Default);
+ sourceDirectory, this->GeneratorTarget, language, config, false);
vars["INCLUDES"] = cmStrCat(sourceDirectoryFlag, ' ', vars["INCLUDES"]);
}
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index 2b785e1d3b..4503038d1d 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -143,7 +143,7 @@ std::string cmOutputConverter::ConvertToOutputFormat(cm::string_view source,
result = this->EscapeForShell(result, true, false, output == WATCOMQUOTE,
output == NINJAMULTI);
} else if (output == RESPONSE) {
- result = this->EscapeForShell(result, false, false, false);
+ result = this->EscapeForShell(result, false, false, false, false, true);
}
return result;
}
@@ -175,9 +175,11 @@ static bool cmOutputConverterIsShellOperator(cm::string_view str)
return (shellOperators.count(str) != 0);
}
-std::string cmOutputConverter::EscapeForShell(
- cm::string_view str, bool makeVars, bool forEcho, bool useWatcomQuote,
- bool unescapeNinjaConfiguration) const
+std::string cmOutputConverter::EscapeForShell(cm::string_view str,
+ bool makeVars, bool forEcho,
+ bool useWatcomQuote,
+ bool unescapeNinjaConfiguration,
+ bool forResponse) const
{
// Do not escape shell operators.
if (cmOutputConverterIsShellOperator(str)) {
@@ -203,6 +205,9 @@ std::string cmOutputConverter::EscapeForShell(
if (useWatcomQuote) {
flags |= Shell_Flag_WatcomQuote;
}
+ if (forResponse) {
+ flags |= Shell_Flag_IsResponse;
+ }
if (this->GetState()->UseWatcomWMake()) {
flags |= Shell_Flag_WatcomWMake;
}
@@ -219,10 +224,11 @@ std::string cmOutputConverter::EscapeForShell(
return Shell_GetArgument(str, flags);
}
-std::string cmOutputConverter::EscapeForCMake(cm::string_view str)
+std::string cmOutputConverter::EscapeForCMake(cm::string_view str,
+ WrapQuotes wrapQuotes)
{
// Always double-quote the argument to take care of most escapes.
- std::string result = "\"";
+ std::string result = (wrapQuotes == WrapQuotes::Wrap) ? "\"" : "";
for (const char c : str) {
if (c == '"') {
// Escape the double quote to avoid ending the argument.
@@ -238,7 +244,9 @@ std::string cmOutputConverter::EscapeForCMake(cm::string_view str)
result += c;
}
}
- result += "\"";
+ if (wrapQuotes == WrapQuotes::Wrap) {
+ result += "\"";
+ }
return result;
}
@@ -357,6 +365,13 @@ bool cmOutputConverter::Shell_CharNeedsQuotes(char c, int flags)
return true;
}
+ /* Quote hyphens in response files */
+ if (flags & Shell_Flag_IsResponse) {
+ if (c == '-') {
+ return true;
+ }
+ }
+
if (flags & Shell_Flag_IsUnix) {
/* On UNIX several special characters need quotes to preserve them. */
if (Shell_CharNeedsQuotesOnUnix(c)) {
diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h
index 865df718b1..335442df42 100644
--- a/Source/cmOutputConverter.h
+++ b/Source/cmOutputConverter.h
@@ -88,13 +88,22 @@ public:
Shell_Flag_IsUnix = (1 << 8),
Shell_Flag_UnescapeNinjaConfiguration = (1 << 9),
+
+ Shell_Flag_IsResponse = (1 << 10)
};
std::string EscapeForShell(cm::string_view str, bool makeVars = false,
bool forEcho = false, bool useWatcomQuote = false,
- bool unescapeNinjaConfiguration = false) const;
+ bool unescapeNinjaConfiguration = false,
+ bool forResponse = false) const;
- static std::string EscapeForCMake(cm::string_view str);
+ enum class WrapQuotes
+ {
+ Wrap,
+ NoWrap,
+ };
+ static std::string EscapeForCMake(cm::string_view str,
+ WrapQuotes wrapQuotes = WrapQuotes::Wrap);
/** Compute an escaped version of the given argument for use in a
windows shell. */
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 23000fae68..e31de1c15a 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -103,7 +103,7 @@ static bool isPolicyNewerThan(cmPolicies::PolicyID id, unsigned int majorV,
return false;
}
-const char* idToShortDescription(cmPolicies::PolicyID id)
+static const char* idToShortDescription(cmPolicies::PolicyID id)
{
switch (id) {
#define POLICY_CASE(ID, SHORT_DESCRIPTION) \
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index ce0411761c..99e2eb6bbc 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -385,7 +385,10 @@ class cmMakefile;
0, cmPolicies::WARN) \
SELECT(POLICY, CMP0128, \
"Selection of language standard and extension flags improved.", 3, \
- 22, 0, cmPolicies::WARN)
+ 22, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0129, \
+ "Compiler id for MCST LCC compilers is now LCC, not GNU.", 3, 23, 0, \
+ cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 20fcdbed9f..04d99c96ed 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -235,14 +235,15 @@ bool cmProjectCommand(std::vector<std::string> const& args,
std::array<std::string, MAX_VERSION_COMPONENTS> version_components;
if (cmp0096 == cmPolicies::OLD || cmp0096 == cmPolicies::WARN) {
- char vb[MAX_VERSION_COMPONENTS]
- [std::numeric_limits<unsigned>::digits10 + 2];
+ constexpr size_t maxIntLength =
+ std::numeric_limits<unsigned>::digits10 + 2;
+ char vb[MAX_VERSION_COMPONENTS][maxIntLength];
unsigned v[MAX_VERSION_COMPONENTS] = { 0, 0, 0, 0 };
const int vc = std::sscanf(version.c_str(), "%u.%u.%u.%u", &v[0], &v[1],
&v[2], &v[3]);
for (auto i = 0u; i < MAX_VERSION_COMPONENTS; ++i) {
if (int(i) < vc) {
- std::sprintf(vb[i], "%u", v[i]);
+ std::snprintf(vb[i], maxIntLength, "%u", v[i]);
version_string += &"."[std::size_t(i == 0)];
version_string += vb[i];
version_components[i] = vb[i];
diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx
index ca0b259dc5..b489944c04 100644
--- a/Source/cmQTWrapCPPCommand.cxx
+++ b/Source/cmQTWrapCPPCommand.cxx
@@ -2,10 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmQTWrapCPPCommand.h"
+#include <utility>
+
+#include <cm/memory>
+
+#include "cmCustomCommand.h"
#include "cmCustomCommandLines.h"
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-#include "cmPolicies.h"
#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmStringAlgorithms.h"
@@ -72,10 +76,12 @@ bool cmQTWrapCPPCommand(std::vector<std::string> const& args,
depends.push_back(hname);
std::string no_main_dependency;
- const char* no_working_dir = nullptr;
- mf.AddCustomCommandToOutput(
- newName, depends, no_main_dependency, commandLines, "Qt Wrapped File",
- no_working_dir, mf.GetPolicyStatus(cmPolicies::CMP0116));
+ auto cc = cm::make_unique<cmCustomCommand>();
+ cc->SetOutputs(newName);
+ cc->SetDepends(depends);
+ cc->SetCommandLines(commandLines);
+ cc->SetComment("Qt Wrapped File");
+ mf.AddCustomCommandToOutput(no_main_dependency, std::move(cc));
}
}
diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx
index f98f0b3214..4d65f331a5 100644
--- a/Source/cmQTWrapUICommand.cxx
+++ b/Source/cmQTWrapUICommand.cxx
@@ -2,10 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmQTWrapUICommand.h"
+#include <utility>
+
+#include <cm/memory>
+
+#include "cmCustomCommand.h"
#include "cmCustomCommandLines.h"
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-#include "cmPolicies.h"
#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmStringAlgorithms.h"
@@ -85,22 +89,26 @@ bool cmQTWrapUICommand(std::vector<std::string> const& args,
std::vector<std::string> depends;
depends.push_back(uiName);
std::string no_main_dependency;
- const char* no_comment = nullptr;
- const char* no_working_dir = nullptr;
- mf.AddCustomCommandToOutput(hName, depends, no_main_dependency,
- hCommandLines, no_comment, no_working_dir,
- mf.GetPolicyStatus(cmPolicies::CMP0116));
+ auto cc = cm::make_unique<cmCustomCommand>();
+ cc->SetOutputs(hName);
+ cc->SetDepends(depends);
+ cc->SetCommandLines(hCommandLines);
+ mf.AddCustomCommandToOutput(no_main_dependency, std::move(cc));
depends.push_back(hName);
- mf.AddCustomCommandToOutput(cxxName, depends, no_main_dependency,
- cxxCommandLines, no_comment, no_working_dir,
- mf.GetPolicyStatus(cmPolicies::CMP0116));
+ cc = cm::make_unique<cmCustomCommand>();
+ cc->SetOutputs(cxxName);
+ cc->SetDepends(depends);
+ cc->SetCommandLines(cxxCommandLines);
+ mf.AddCustomCommandToOutput(no_main_dependency, std::move(cc));
depends.clear();
depends.push_back(hName);
- mf.AddCustomCommandToOutput(mocName, depends, no_main_dependency,
- mocCommandLines, no_comment, no_working_dir,
- mf.GetPolicyStatus(cmPolicies::CMP0116));
+ cc = cm::make_unique<cmCustomCommand>();
+ cc->SetOutputs(mocName);
+ cc->SetDepends(depends);
+ cc->SetCommandLines(mocCommandLines);
+ mf.AddCustomCommandToOutput(no_main_dependency, std::move(cc));
}
}
diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx
index 9584e5c41a..0a394b57cd 100644
--- a/Source/cmQtAutoGen.cxx
+++ b/Source/cmQtAutoGen.cxx
@@ -22,10 +22,10 @@
/// @brief Merges newOpts into baseOpts
/// @arg valueOpts list of options that accept a value
-void MergeOptions(std::vector<std::string>& baseOpts,
- std::vector<std::string> const& newOpts,
- std::initializer_list<cm::string_view> valueOpts,
- bool isQt5OrLater)
+static void MergeOptions(std::vector<std::string>& baseOpts,
+ std::vector<std::string> const& newOpts,
+ std::initializer_list<cm::string_view> valueOpts,
+ bool isQt5OrLater)
{
if (newOpts.empty()) {
return;
diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx
index f9e889a666..b7ea7d6d7e 100644
--- a/Source/cmQtAutoGenGlobalInitializer.cxx
+++ b/Source/cmQtAutoGenGlobalInitializer.cxx
@@ -7,7 +7,7 @@
#include <cm/memory>
-#include "cmCustomCommandLines.h"
+#include "cmCustomCommand.h"
#include "cmDuration.h"
#include "cmGeneratorTarget.h"
#include "cmLocalGenerator.h"
@@ -171,13 +171,12 @@ void cmQtAutoGenGlobalInitializer::GetOrCreateGlobalTarget(
cmMakefile* makefile = localGen->GetMakefile();
// Create utility target
- std::vector<std::string> no_byproducts;
- std::vector<std::string> no_depends;
- cmCustomCommandLines no_commands;
- const cmPolicies::PolicyStatus cmp0116_new = cmPolicies::NEW;
- cmTarget* target = localGen->AddUtilityCommand(
- name, true, makefile->GetHomeOutputDirectory().c_str(), no_byproducts,
- no_depends, no_commands, cmp0116_new, false, comment.c_str());
+ auto cc = cm::make_unique<cmCustomCommand>();
+ cc->SetWorkingDirectory(makefile->GetHomeOutputDirectory().c_str());
+ cc->SetCMP0116Status(cmPolicies::NEW);
+ cc->SetEscapeOldStyle(false);
+ cc->SetComment(comment.c_str());
+ cmTarget* target = localGen->AddUtilityCommand(name, true, std::move(cc));
localGen->AddGeneratorTarget(
cm::make_unique<cmGeneratorTarget>(target, localGen));
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index c49cafee51..c2a37fedef 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -636,12 +636,12 @@ bool cmQtAutoGenInitializer::InitMoc()
auto getDefs = [this](std::string const& cfg) -> std::set<std::string> {
std::set<std::string> defines;
this->LocalGen->GetTargetDefines(this->GenTarget, cfg, "CXX", defines);
-#ifdef _WIN32
- if (this->Moc.PredefsCmd.empty()) {
+ if (this->Moc.PredefsCmd.empty() &&
+ this->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME") ==
+ "Windows") {
// Add WIN32 definition if we don't have a moc_predefs.h
defines.insert("WIN32");
}
-#endif
return defines;
};
@@ -1231,14 +1231,16 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
// Add a rule file to cause the target to build if a dependency has
// changed, which will trigger the pre-build command to run autogen
std::string no_main_dependency;
- cmCustomCommandLines no_command_lines;
- this->LocalGen->AddCustomCommandToOutput(
- timestampFileGenex, uicDependencies, no_main_dependency,
- no_command_lines, /*comment=*/"", this->Dir.Work.c_str(),
- /*cmp0116=*/cmPolicies::NEW, /*replace=*/false,
- /*escapeOldStyle=*/false, /*uses_terminal=*/false,
- /*command_expand_lists=*/false, /*depfile=*/"", /*job_pool=*/"",
- stdPipesUTF8);
+ auto cc = cm::make_unique<cmCustomCommand>();
+ cc->SetOutputs(timestampFileGenex);
+ cc->SetDepends(uicDependencies);
+ cc->SetComment("");
+ cc->SetWorkingDirectory(this->Dir.Work.c_str());
+ cc->SetCMP0116Status(cmPolicies::NEW);
+ cc->SetEscapeOldStyle(false);
+ cc->SetStdPipesUTF8(stdPipesUTF8);
+ this->LocalGen->AddCustomCommandToOutput(no_main_dependency,
+ std::move(cc));
}
// Add the pre-build command directly to bypass the OBJECT_LIBRARY
@@ -1246,11 +1248,13 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
// PRE_BUILD will work for an OBJECT_LIBRARY in this specific case.
//
// PRE_BUILD does not support file dependencies!
- const std::vector<std::string> no_output;
- const std::vector<std::string> no_deps;
- cmCustomCommand cc(no_output, autogenByproducts, no_deps, commandLines,
- this->Makefile->GetBacktrace(), autogenComment.c_str(),
- this->Dir.Work.c_str(), stdPipesUTF8);
+ cmCustomCommand cc;
+ cc.SetByproducts(autogenByproducts);
+ cc.SetCommandLines(commandLines);
+ cc.SetComment(autogenComment.c_str());
+ cc.SetBacktrace(this->Makefile->GetBacktrace());
+ cc.SetWorkingDirectory(this->Dir.Work.c_str());
+ cc.SetStdPipesUTF8(stdPipesUTF8);
cc.SetEscapeOldStyle(false);
cc.SetEscapeAllowMakeVars(true);
this->GenTarget->Target->AddPreBuildCommand(std::move(cc));
@@ -1321,11 +1325,15 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
dependencies.push_back(depname);
}
+ auto cc = cm::make_unique<cmCustomCommand>();
+ cc->SetWorkingDirectory(this->Dir.Work.c_str());
+ cc->SetByproducts(timestampTargetProvides);
+ cc->SetDepends(dependencies);
+ cc->SetCommandLines(timestampTargetCommandLines);
+ cc->SetCMP0116Status(cmPolicies::NEW);
+ cc->SetEscapeOldStyle(false);
cmTarget* timestampTarget = this->LocalGen->AddUtilityCommand(
- timestampTargetName, true, this->Dir.Work.c_str(),
- /*byproducts=*/timestampTargetProvides,
- /*depends=*/dependencies, timestampTargetCommandLines, cmPolicies::NEW,
- false, nullptr);
+ timestampTargetName, true, std::move(cc));
this->LocalGen->AddGeneratorTarget(
cm::make_unique<cmGeneratorTarget>(timestampTarget, this->LocalGen));
@@ -1355,15 +1363,19 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
this->AddGeneratedSource(outputFile, this->Moc);
const std::string no_main_dependency;
- this->LocalGen->AddCustomCommandToOutput(
- { outputFile }, timestampByproducts, dependencies, no_main_dependency,
- /*implicit_depends=*/{}, commandLines, autogenComment.c_str(),
- this->Dir.Work.c_str(),
- /*cmp0116=*/cmPolicies::NEW, /*replace=*/false,
- /*escapeOldStyle=*/false,
- /*uses_terminal=*/false,
- /*command_expand_lists=*/false, this->AutogenTarget.DepFile, "",
- stdPipesUTF8);
+ cc = cm::make_unique<cmCustomCommand>();
+ cc->SetOutputs(outputFile);
+ cc->SetByproducts(timestampByproducts);
+ cc->SetDepends(dependencies);
+ cc->SetCommandLines(commandLines);
+ cc->SetComment(autogenComment.c_str());
+ cc->SetWorkingDirectory(this->Dir.Work.c_str());
+ cc->SetCMP0116Status(cmPolicies::NEW);
+ cc->SetEscapeOldStyle(false);
+ cc->SetDepfile(this->AutogenTarget.DepFile);
+ cc->SetStdPipesUTF8(stdPipesUTF8);
+ this->LocalGen->AddCustomCommandToOutput(no_main_dependency,
+ std::move(cc));
// Alter variables for the autogen target which now merely wraps the
// custom command
@@ -1374,11 +1386,16 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
}
// Create autogen target
+ auto cc = cm::make_unique<cmCustomCommand>();
+ cc->SetWorkingDirectory(this->Dir.Work.c_str());
+ cc->SetByproducts(autogenByproducts);
+ cc->SetDepends(dependencies);
+ cc->SetCommandLines(commandLines);
+ cc->SetCMP0116Status(cmPolicies::NEW);
+ cc->SetEscapeOldStyle(false);
+ cc->SetComment(autogenComment.c_str());
cmTarget* autogenTarget = this->LocalGen->AddUtilityCommand(
- this->AutogenTarget.Name, true, this->Dir.Work.c_str(),
- /*byproducts=*/autogenByproducts,
- /*depends=*/dependencies, commandLines, cmPolicies::NEW, false,
- autogenComment.c_str());
+ this->AutogenTarget.Name, true, std::move(cc));
// Create autogen generator target
this->LocalGen->AddGeneratorTarget(
cm::make_unique<cmGeneratorTarget>(autogenTarget, this->LocalGen));
@@ -1435,7 +1452,6 @@ bool cmQtAutoGenInitializer::InitRccTargets()
ccDepends.push_back(qrc.QrcFile);
ccDepends.push_back(qrc.InfoFile);
- bool stdPipesUTF8 = true;
cmCustomCommandLines commandLines;
if (this->MultiConfig) {
// Build for all configurations
@@ -1453,6 +1469,13 @@ bool cmQtAutoGenInitializer::InitRccTargets()
cmStrCat("Automatic RCC for ",
FileProjectRelativePath(this->Makefile, qrc.QrcFile));
+ auto cc = cm::make_unique<cmCustomCommand>();
+ cc->SetWorkingDirectory(this->Dir.Work.c_str());
+ cc->SetCommandLines(commandLines);
+ cc->SetCMP0116Status(cmPolicies::NEW);
+ cc->SetComment(ccComment.c_str());
+ cc->SetStdPipesUTF8(true);
+
if (qrc.Generated || this->Rcc.GlobalTarget) {
// Create custom rcc target
std::string ccName;
@@ -1462,10 +1485,11 @@ bool cmQtAutoGenInitializer::InitRccTargets()
ccName += cmStrCat('_', qrc.QrcPathChecksum);
}
- cmTarget* autoRccTarget = this->LocalGen->AddUtilityCommand(
- ccName, true, this->Dir.Work.c_str(), ccOutput, ccDepends,
- commandLines, cmPolicies::NEW, false, ccComment.c_str(), false,
- false, "", stdPipesUTF8);
+ cc->SetByproducts(ccOutput);
+ cc->SetDepends(ccDepends);
+ cc->SetEscapeOldStyle(false);
+ cmTarget* autoRccTarget =
+ this->LocalGen->AddUtilityCommand(ccName, true, std::move(cc));
// Create autogen generator target
this->LocalGen->AddGeneratorTarget(
@@ -1501,12 +1525,11 @@ bool cmQtAutoGenInitializer::InitRccTargets()
ccDepends.push_back(this->Rcc.ExecutableTargetName);
}
std::string no_main_dependency;
- cmImplicitDependsList no_implicit_depends;
- this->LocalGen->AddCustomCommandToOutput(
- ccOutput, ccByproducts, ccDepends, no_main_dependency,
- no_implicit_depends, commandLines, ccComment.c_str(),
- this->Dir.Work.c_str(), cmPolicies::NEW, false, true, false, false,
- "", "", stdPipesUTF8);
+ cc->SetOutputs(ccOutput);
+ cc->SetByproducts(ccByproducts);
+ cc->SetDepends(ccDepends);
+ this->LocalGen->AddCustomCommandToOutput(no_main_dependency,
+ std::move(cc));
}
// Reconfigure when .qrc file changes
this->Makefile->AddCMakeDependFile(qrc.QrcFile);
diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx
index 7480aebe24..4cee09d5f6 100644
--- a/Source/cmRulePlaceholderExpander.cxx
+++ b/Source/cmRulePlaceholderExpander.cxx
@@ -85,6 +85,11 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable(
return replaceValues.ObjectsQuoted;
}
}
+ if (replaceValues.CudaCompileMode) {
+ if (variable == "CUDA_COMPILE_MODE") {
+ return replaceValues.CudaCompileMode;
+ }
+ }
if (replaceValues.AIXExports) {
if (variable == "AIX_EXPORTS") {
return replaceValues.AIXExports;
diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h
index c22e0fa9fb..852954fe4d 100644
--- a/Source/cmRulePlaceholderExpander.h
+++ b/Source/cmRulePlaceholderExpander.h
@@ -65,6 +65,7 @@ public:
const char* SwiftOutputFileMap = nullptr;
const char* SwiftSources = nullptr;
const char* ISPCHeader = nullptr;
+ const char* CudaCompileMode = nullptr;
const char* Fatbinary = nullptr;
const char* RegisterFile = nullptr;
const char* Launcher = nullptr;
diff --git a/Source/cmSearchPath.h b/Source/cmSearchPath.h
index c15cb97b7b..09f9722886 100644
--- a/Source/cmSearchPath.h
+++ b/Source/cmSearchPath.h
@@ -26,6 +26,9 @@ public:
cmSearchPath(cmFindCommon* findCmd = nullptr);
~cmSearchPath();
+ cmSearchPath(const cmSearchPath&) = default;
+ cmSearchPath& operator=(const cmSearchPath&) = default;
+
const std::vector<std::string>& GetPaths() const { return this->Paths; }
std::size_t size() const { return this->Paths.size(); }
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index f44fcf7c68..e5935b8c05 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -526,7 +526,7 @@ bool HandleLengthCommand(std::vector<std::string> const& args,
size_t length = stringValue.size();
char buffer[1024];
- sprintf(buffer, "%d", static_cast<int>(length));
+ snprintf(buffer, sizeof(buffer), "%d", static_cast<int>(length));
status.GetMakefile().AddDefinition(variableName, buffer);
return true;
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 1934393bb0..effb837f15 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -540,7 +540,7 @@ size_t cmSystemTools::CalculateCommandLineLengthLimit()
#if defined(_SC_ARG_MAX)
// ARG_MAX is the maximum size of the command and environment
// that can be passed to the exec functions on UNIX.
- // The value in limits.h does not need to be present and may
+ // The value in climits does not need to be present and may
// depend upon runtime memory constraints, hence sysconf()
// should be used to query it.
long szArgMax = sysconf(_SC_ARG_MAX);
@@ -1158,39 +1158,26 @@ void cmSystemTools::MoveFileIfDifferent(const std::string& source,
RemoveFile(source);
}
+#ifndef CMAKE_BOOTSTRAP
std::string cmSystemTools::ComputeFileHash(const std::string& source,
cmCryptoHash::Algo algo)
{
-#if !defined(CMAKE_BOOTSTRAP)
cmCryptoHash hash(algo);
return hash.HashFile(source);
-#else
- (void)source;
- cmSystemTools::Message("hashsum not supported in bootstrapping mode",
- "Error");
- return std::string();
-#endif
}
std::string cmSystemTools::ComputeStringMD5(const std::string& input)
{
-#if !defined(CMAKE_BOOTSTRAP)
cmCryptoHash md5(cmCryptoHash::AlgoMD5);
return md5.HashString(input);
-#else
- (void)input;
- cmSystemTools::Message("md5sum not supported in bootstrapping mode",
- "Error");
- return "";
-#endif
}
+# ifdef _WIN32
std::string cmSystemTools::ComputeCertificateThumbprint(
const std::string& source)
{
std::string thumbprint;
-#if !defined(CMAKE_BOOTSTRAP) && defined(_WIN32)
CRYPT_INTEGER_BLOB cryptBlob;
HCERTSTORE certStore = NULL;
PCCERT_CONTEXT certContext = NULL;
@@ -1247,14 +1234,11 @@ std::string cmSystemTools::ComputeCertificateThumbprint(
}
CloseHandle(certFile);
}
-#else
- (void)source;
- cmSystemTools::Message("ComputeCertificateThumbprint is not implemented",
- "Error");
-#endif
return thumbprint;
}
+# endif
+#endif
void cmSystemTools::Glob(const std::string& directory,
const std::string& regexp,
@@ -1693,7 +1677,8 @@ void list_item_verbose(FILE* out, struct archive_entry* entry)
/* Use uname if it's present, else uid. */
p = archive_entry_uname(entry);
if ((p == nullptr) || (*p == '\0')) {
- sprintf(tmp, "%lu ", static_cast<unsigned long>(archive_entry_uid(entry)));
+ snprintf(tmp, sizeof(tmp), "%lu ",
+ static_cast<unsigned long>(archive_entry_uid(entry)));
p = tmp;
}
w = strlen(p);
@@ -1707,7 +1692,8 @@ void list_item_verbose(FILE* out, struct archive_entry* entry)
fprintf(out, "%s", p);
w = strlen(p);
} else {
- sprintf(tmp, "%lu", static_cast<unsigned long>(archive_entry_gid(entry)));
+ snprintf(tmp, sizeof(tmp), "%lu",
+ static_cast<unsigned long>(archive_entry_gid(entry)));
w = strlen(tmp);
fprintf(out, "%s", tmp);
}
@@ -1721,15 +1707,15 @@ void list_item_verbose(FILE* out, struct archive_entry* entry)
archive_entry_filetype(entry) == AE_IFBLK) {
unsigned long rdevmajor = archive_entry_rdevmajor(entry);
unsigned long rdevminor = archive_entry_rdevminor(entry);
- sprintf(tmp, "%lu,%lu", rdevmajor, rdevminor);
+ snprintf(tmp, sizeof(tmp), "%lu,%lu", rdevmajor, rdevminor);
} else {
/*
* Note the use of platform-dependent macros to format
* the filesize here. We need the format string and the
* corresponding type for the cast.
*/
- sprintf(tmp, BSDTAR_FILESIZE_PRINTF,
- static_cast<BSDTAR_FILESIZE_TYPE>(archive_entry_size(entry)));
+ snprintf(tmp, sizeof(tmp), BSDTAR_FILESIZE_PRINTF,
+ static_cast<BSDTAR_FILESIZE_TYPE>(archive_entry_size(entry)));
}
if (w + strlen(tmp) >= gs_width) {
gs_width = w + strlen(tmp) + 1;
@@ -2496,8 +2482,8 @@ bool cmSystemTools::GuessLibraryInstallName(std::string const& fullPath,
return false;
}
-std::string::size_type cmSystemToolsFindRPath(cm::string_view const& have,
- cm::string_view const& want)
+static std::string::size_type cmSystemToolsFindRPath(
+ cm::string_view const& have, cm::string_view const& want)
{
std::string::size_type pos = 0;
while (pos < have.size()) {
@@ -2694,11 +2680,11 @@ std::function<bool(std::string*, const cmELF&)> MakeEmptyCallback(
}
}
-cm::optional<bool> ChangeRPathELF(std::string const& file,
- std::string const& oldRPath,
- std::string const& newRPath,
- bool removeEnvironmentRPath,
- std::string* emsg, bool* changed)
+static cm::optional<bool> ChangeRPathELF(std::string const& file,
+ std::string const& oldRPath,
+ std::string const& newRPath,
+ bool removeEnvironmentRPath,
+ std::string* emsg, bool* changed)
{
auto adjustCallback = [oldRPath, newRPath, removeEnvironmentRPath](
cm::optional<std::string>& outRPath,
@@ -3306,7 +3292,7 @@ std::string cmSystemTools::EncodeURL(std::string const& in, bool escapeSlashes)
case ' ':
case '=':
case '%':
- sprintf(hexCh, "%%%02X", static_cast<int>(c));
+ snprintf(hexCh, sizeof(hexCh), "%%%02X", static_cast<int>(c));
break;
case '/':
if (escapeSlashes) {
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 715724c3c8..19dabe8e17 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -179,6 +179,7 @@ public:
static void MoveFileIfDifferent(const std::string& source,
const std::string& destination);
+#ifndef CMAKE_BOOTSTRAP
//! Compute the hash of a file
static std::string ComputeFileHash(const std::string& source,
cmCryptoHash::Algo algo);
@@ -186,8 +187,11 @@ public:
/** Compute the md5sum of a string. */
static std::string ComputeStringMD5(const std::string& input);
+# ifdef _WIN32
//! Get the SHA thumbprint for a certificate file
static std::string ComputeCertificateThumbprint(const std::string& source);
+# endif
+#endif
/**
* Run a single executable command
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 97d60cf030..efae6916fc 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -14,11 +14,13 @@
#include <cm/memory>
#include <cmext/algorithm>
+#include <cmext/string_view>
#include "cmsys/RegularExpression.hxx"
#include "cmAlgorithms.h"
#include "cmCustomCommand.h"
+#include "cmFileSet.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
@@ -200,8 +202,11 @@ public:
std::vector<BT<std::string>> LinkOptionsEntries;
std::vector<BT<std::string>> LinkDirectoriesEntries;
std::vector<BT<std::string>> LinkImplementationPropertyEntries;
+ std::vector<BT<std::string>> HeaderSetsEntries;
+ std::vector<BT<std::string>> InterfaceHeaderSetsEntries;
std::vector<std::pair<cmTarget::TLLSignature, cmListFileContext>>
TLLCommands;
+ std::map<std::string, cmFileSet> FileSets;
cmListFileBacktrace Backtrace;
bool CheckImportedLibName(std::string const& prop,
@@ -395,6 +400,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("XCODE_SCHEME_ADDRESS_SANITIZER");
initProp("XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN");
initProp("XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING");
+ initProp("XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE");
initProp("XCODE_SCHEME_THREAD_SANITIZER");
initProp("XCODE_SCHEME_THREAD_SANITIZER_STOP");
initProp("XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER");
@@ -1110,6 +1116,16 @@ cmBTStringRange cmTarget::GetLinkImplementationEntries() const
return cmMakeRange(this->impl->LinkImplementationPropertyEntries);
}
+cmBTStringRange cmTarget::GetHeaderSetsEntries() const
+{
+ return cmMakeRange(this->impl->HeaderSetsEntries);
+}
+
+cmBTStringRange cmTarget::GetInterfaceHeaderSetsEntries() const
+{
+ return cmMakeRange(this->impl->InterfaceHeaderSetsEntries);
+}
+
namespace {
#define MAKE_PROP(PROP) const std::string prop##PROP = #PROP
MAKE_PROP(C_STANDARD);
@@ -1139,6 +1155,10 @@ MAKE_PROP(BINARY_DIR);
MAKE_PROP(SOURCE_DIR);
MAKE_PROP(FALSE);
MAKE_PROP(TRUE);
+MAKE_PROP(HEADER_DIRS);
+MAKE_PROP(HEADER_SET);
+MAKE_PROP(HEADER_SETS);
+MAKE_PROP(INTERFACE_HEADER_SETS);
#undef MAKE_PROP
}
@@ -1158,6 +1178,21 @@ std::string ConvertToString<cmValue>(cmValue value)
{
return std::string(*value);
}
+
+template <typename ValueType>
+bool StringIsEmpty(ValueType value);
+
+template <>
+bool StringIsEmpty<const char*>(const char* value)
+{
+ return cmValue::IsEmpty(value);
+}
+
+template <>
+bool StringIsEmpty<cmValue>(cmValue value)
+{
+ return value.IsEmpty();
+}
}
template <typename ValueType>
@@ -1321,6 +1356,104 @@ void cmTarget::StoreProperty(const std::string& prop, ValueType value)
} else {
this->impl->LanguageStandardProperties.erase(prop);
}
+ } else if (prop == propHEADER_DIRS) {
+ auto* fileSet = this->GetFileSet("HEADERS");
+ if (!fileSet) {
+ this->impl->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ "The default header set has not yet been created.");
+ return;
+ }
+ fileSet->ClearDirectoryEntries();
+ if (!StringIsEmpty(value)) {
+ fileSet->AddDirectoryEntry(
+ BT<std::string>(value, this->impl->Makefile->GetBacktrace()));
+ }
+ } else if (prop == propHEADER_SET) {
+ auto* fileSet = this->GetFileSet("HEADERS");
+ if (!fileSet) {
+ this->impl->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ "The default header set has not yet been created.");
+ return;
+ }
+ fileSet->ClearFileEntries();
+ if (!StringIsEmpty(value)) {
+ fileSet->AddFileEntry(
+ BT<std::string>(value, this->impl->Makefile->GetBacktrace()));
+ }
+ } else if (cmHasLiteralPrefix(prop, "HEADER_DIRS_")) {
+ auto fileSetName = prop.substr(cmStrLen("HEADER_DIRS_"));
+ if (fileSetName.empty()) {
+ this->impl->Makefile->IssueMessage(MessageType::FATAL_ERROR,
+ "Header set name cannot be empty.");
+ return;
+ }
+ auto* fileSet = this->GetFileSet(fileSetName);
+ if (!fileSet) {
+ this->impl->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Header set \"", fileSetName,
+ "\" has not yet been created."));
+ return;
+ }
+ fileSet->ClearDirectoryEntries();
+ if (!StringIsEmpty(value)) {
+ fileSet->AddDirectoryEntry(
+ BT<std::string>(value, this->impl->Makefile->GetBacktrace()));
+ }
+ } else if (cmHasLiteralPrefix(prop, "HEADER_SET_")) {
+ auto fileSetName = prop.substr(cmStrLen("HEADER_SET_"));
+ if (fileSetName.empty()) {
+ this->impl->Makefile->IssueMessage(MessageType::FATAL_ERROR,
+ "Header set name cannot be empty.");
+ return;
+ }
+ auto* fileSet = this->GetFileSet(fileSetName);
+ if (!fileSet) {
+ this->impl->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Header set \"", fileSetName,
+ "\" has not yet been created."));
+ return;
+ }
+ fileSet->ClearFileEntries();
+ if (!StringIsEmpty(value)) {
+ fileSet->AddFileEntry(
+ BT<std::string>(value, this->impl->Makefile->GetBacktrace()));
+ }
+ } else if (prop == propHEADER_SETS) {
+ if (value) {
+ for (auto const& name : cmExpandedList(value)) {
+ if (!this->GetFileSet(name)) {
+ this->impl->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Header set \"", name, "\" has not yet been created."));
+ return;
+ }
+ }
+ }
+ this->impl->HeaderSetsEntries.clear();
+ if (!StringIsEmpty(value)) {
+ this->impl->HeaderSetsEntries.emplace_back(
+ value, this->impl->Makefile->GetBacktrace());
+ }
+ } else if (prop == propINTERFACE_HEADER_SETS) {
+ if (value) {
+ for (auto const& name : cmExpandedList(value)) {
+ if (!this->GetFileSet(name)) {
+ this->impl->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Header set \"", name, "\" has not yet been created."));
+ return;
+ }
+ }
+ }
+ this->impl->InterfaceHeaderSetsEntries.clear();
+ if (!StringIsEmpty(value)) {
+ this->impl->InterfaceHeaderSetsEntries.emplace_back(
+ value, this->impl->Makefile->GetBacktrace());
+ }
} else {
this->impl->Properties.SetProperty(prop, value);
}
@@ -1415,6 +1548,82 @@ void cmTarget::AppendProperty(const std::string& prop,
prop == "OBJC_STANDARD" || prop == "OBJCXX_STANDARD") {
this->impl->Makefile->IssueMessage(
MessageType::FATAL_ERROR, prop + " property may not be appended.");
+ } else if (prop == "HEADER_DIRS") {
+ auto* fileSet = this->GetFileSet("HEADERS");
+ if (!fileSet) {
+ this->impl->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ "The default header set has not yet been created.");
+ return;
+ }
+ fileSet->AddDirectoryEntry(
+ BT<std::string>(value, this->impl->Makefile->GetBacktrace()));
+ } else if (cmHasLiteralPrefix(prop, "HEADER_DIRS_")) {
+ auto fileSetName = prop.substr(cmStrLen("HEADER_DIRS_"));
+ if (fileSetName.empty()) {
+ this->impl->Makefile->IssueMessage(MessageType::FATAL_ERROR,
+ "Header set name cannot be empty.");
+ return;
+ }
+ auto* fileSet = this->GetFileSet(fileSetName);
+ if (!fileSet) {
+ this->impl->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Header set \"", fileSetName,
+ "\" has not yet been created."));
+ return;
+ }
+ fileSet->AddDirectoryEntry(
+ BT<std::string>(value, this->impl->Makefile->GetBacktrace()));
+ } else if (prop == "HEADER_SET") {
+ auto* fileSet = this->GetFileSet("HEADERS");
+ if (!fileSet) {
+ this->impl->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ "The default header set has not yet been created.");
+ return;
+ }
+ fileSet->AddFileEntry(
+ BT<std::string>(value, this->impl->Makefile->GetBacktrace()));
+ } else if (cmHasLiteralPrefix(prop, "HEADER_SET_")) {
+ auto fileSetName = prop.substr(cmStrLen("HEADER_SET_"));
+ if (fileSetName.empty()) {
+ this->impl->Makefile->IssueMessage(MessageType::FATAL_ERROR,
+ "Header set name cannot be empty.");
+ return;
+ }
+ auto* fileSet = this->GetFileSet(fileSetName);
+ if (!fileSet) {
+ this->impl->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Header set \"", fileSetName,
+ "\" has not yet been created."));
+ return;
+ }
+ fileSet->AddFileEntry(
+ BT<std::string>(value, this->impl->Makefile->GetBacktrace()));
+ } else if (prop == "HEADER_SETS") {
+ for (auto const& name : cmExpandedList(value)) {
+ if (!this->GetFileSet(name)) {
+ this->impl->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Header set \"", name, "\" has not yet been created."));
+ return;
+ }
+ }
+ this->impl->HeaderSetsEntries.emplace_back(
+ value, this->impl->Makefile->GetBacktrace());
+ } else if (prop == "INTERFACE_HEADER_SETS") {
+ for (auto const& name : cmExpandedList(value)) {
+ if (!this->GetFileSet(name)) {
+ this->impl->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Header set \"", name, "\" has not yet been created."));
+ return;
+ }
+ }
+ this->impl->InterfaceHeaderSetsEntries.emplace_back(
+ value, this->impl->Makefile->GetBacktrace());
} else {
this->impl->Properties.AppendProperty(prop, value, asString);
}
@@ -1633,7 +1842,11 @@ cmValue cmTarget::GetProperty(const std::string& prop) const
propNAME,
propBINARY_DIR,
propSOURCE_DIR,
- propSOURCES
+ propSOURCES,
+ propHEADER_DIRS,
+ propHEADER_SET,
+ propHEADER_SETS,
+ propINTERFACE_HEADER_SETS,
};
if (specialProps.count(prop)) {
if (prop == propC_STANDARD || prop == propCXX_STANDARD ||
@@ -1759,6 +1972,60 @@ cmValue cmTarget::GetProperty(const std::string& prop) const
.GetDirectory()
.GetCurrentSource());
}
+ if (prop == propHEADER_DIRS) {
+ auto const* fileSet = this->GetFileSet("HEADERS");
+ if (!fileSet) {
+ return nullptr;
+ }
+ static std::string output;
+ output = cmJoin(fileSet->GetDirectoryEntries(), ";"_s);
+ return cmValue(output);
+ }
+ if (prop == propHEADER_SET) {
+ auto const* fileSet = this->GetFileSet("HEADERS");
+ if (!fileSet) {
+ return nullptr;
+ }
+ static std::string output;
+ output = cmJoin(fileSet->GetFileEntries(), ";"_s);
+ return cmValue(output);
+ }
+ if (prop == propHEADER_SETS) {
+ static std::string output;
+ output = cmJoin(this->impl->HeaderSetsEntries, ";"_s);
+ return cmValue(output);
+ }
+ if (prop == propINTERFACE_HEADER_SETS) {
+ static std::string output;
+ output = cmJoin(this->impl->InterfaceHeaderSetsEntries, ";"_s);
+ return cmValue(output);
+ }
+ }
+ if (cmHasLiteralPrefix(prop, "HEADER_DIRS_")) {
+ std::string fileSetName = prop.substr(cmStrLen("HEADER_DIRS_"));
+ if (fileSetName.empty()) {
+ return nullptr;
+ }
+ auto const* fileSet = this->GetFileSet(fileSetName);
+ if (!fileSet) {
+ return nullptr;
+ }
+ static std::string output;
+ output = cmJoin(fileSet->GetDirectoryEntries(), ";"_s);
+ return cmValue(output);
+ }
+ if (cmHasLiteralPrefix(prop, "HEADER_SET_")) {
+ std::string fileSetName = prop.substr(cmStrLen("HEADER_SET_"));
+ if (fileSetName.empty()) {
+ return nullptr;
+ }
+ auto const* fileSet = this->GetFileSet(fileSetName);
+ if (!fileSet) {
+ return nullptr;
+ }
+ static std::string output;
+ output = cmJoin(fileSet->GetFileEntries(), ";"_s);
+ return cmValue(output);
}
cmValue retVal = this->impl->Properties.GetPropertyValue(prop);
@@ -2015,6 +2282,59 @@ std::string cmTarget::ImportedGetFullPath(
return result;
}
+const cmFileSet* cmTarget::GetFileSet(const std::string& name) const
+{
+ auto it = this->impl->FileSets.find(name);
+ return it == this->impl->FileSets.end() ? nullptr : &it->second;
+}
+
+cmFileSet* cmTarget::GetFileSet(const std::string& name)
+{
+ auto it = this->impl->FileSets.find(name);
+ return it == this->impl->FileSets.end() ? nullptr : &it->second;
+}
+
+std::pair<cmFileSet*, bool> cmTarget::GetOrCreateFileSet(
+ const std::string& name, const std::string& type)
+{
+ auto result =
+ this->impl->FileSets.emplace(std::make_pair(name, cmFileSet(name, type)));
+ return std::make_pair(&result.first->second, result.second);
+}
+
+std::string cmTarget::GetFileSetsPropertyName(const std::string& type)
+{
+ if (type == "HEADERS") {
+ return "HEADER_SETS";
+ }
+ return "";
+}
+
+std::string cmTarget::GetInterfaceFileSetsPropertyName(const std::string& type)
+{
+ if (type == "HEADERS") {
+ return "INTERFACE_HEADER_SETS";
+ }
+ return "";
+}
+
+std::vector<std::string> cmTarget::GetAllInterfaceFileSets() const
+{
+ std::vector<std::string> result;
+ auto inserter = std::back_inserter(result);
+
+ auto appendEntries = [=](const std::vector<BT<std::string>>& entries) {
+ for (auto const& entry : entries) {
+ auto expanded = cmExpandedList(entry.Value);
+ std::copy(expanded.begin(), expanded.end(), inserter);
+ }
+ };
+
+ appendEntries(this->impl->InterfaceHeaderSetsEntries);
+
+ return result;
+}
+
bool cmTargetInternals::CheckImportedLibName(std::string const& prop,
std::string const& value) const
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 3cf69429cf..27b325ae5b 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -20,6 +20,7 @@
#include "cmValue.h"
class cmCustomCommand;
+class cmFileSet;
class cmGlobalGenerator;
class cmInstallTargetGenerator;
class cmMakefile;
@@ -260,6 +261,10 @@ public:
cmBTStringRange GetLinkImplementationEntries() const;
+ cmBTStringRange GetHeaderSetsEntries() const;
+
+ cmBTStringRange GetInterfaceHeaderSetsEntries() const;
+
std::string ImportedGetFullPath(const std::string& config,
cmStateEnums::ArtifactType artifact) const;
@@ -268,6 +273,16 @@ public:
bool operator()(cmTarget const* t1, cmTarget const* t2) const;
};
+ const cmFileSet* GetFileSet(const std::string& name) const;
+ cmFileSet* GetFileSet(const std::string& name);
+ std::pair<cmFileSet*, bool> GetOrCreateFileSet(const std::string& name,
+ const std::string& type);
+
+ std::vector<std::string> GetAllInterfaceFileSets() const;
+
+ static std::string GetFileSetsPropertyName(const std::string& type);
+ static std::string GetInterfaceFileSetsPropertyName(const std::string& type);
+
private:
template <typename ValueType>
void StoreProperty(const std::string& prop, ValueType value);
diff --git a/Source/cmTargetExport.h b/Source/cmTargetExport.h
index 19fc9319ae..885ac7451d 100644
--- a/Source/cmTargetExport.h
+++ b/Source/cmTargetExport.h
@@ -6,7 +6,9 @@
#include <string>
+class cmFileSet;
class cmGeneratorTarget;
+class cmInstallFileSetGenerator;
class cmInstallFilesGenerator;
class cmInstallTargetGenerator;
@@ -29,6 +31,7 @@ public:
cmInstallTargetGenerator* FrameworkGenerator;
cmInstallTargetGenerator* BundleGenerator;
cmInstallFilesGenerator* HeaderGenerator;
+ std::map<cmFileSet*, cmInstallFileSetGenerator*> FileSetGenerators;
///@}
bool NamelinkOnly = false;
diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx
index 3bd1ea3c6b..391b9542ab 100644
--- a/Source/cmTargetPropCommandBase.cxx
+++ b/Source/cmTargetPropCommandBase.cxx
@@ -155,10 +155,10 @@ bool cmTargetPropCommandBase::ProcessContentArgs(
return false;
}
}
- return this->PopulateTargetProperies(scope, content, prepend, system);
+ return this->PopulateTargetProperties(scope, content, prepend, system);
}
-bool cmTargetPropCommandBase::PopulateTargetProperies(
+bool cmTargetPropCommandBase::PopulateTargetProperties(
const std::string& scope, const std::vector<std::string>& content,
bool prepend, bool system)
{
diff --git a/Source/cmTargetPropCommandBase.h b/Source/cmTargetPropCommandBase.h
index fc24fe8eed..6bf7c3c06d 100644
--- a/Source/cmTargetPropCommandBase.h
+++ b/Source/cmTargetPropCommandBase.h
@@ -40,6 +40,9 @@ protected:
virtual void HandleInterfaceContent(cmTarget* tgt,
const std::vector<std::string>& content,
bool prepend, bool system);
+ virtual bool PopulateTargetProperties(
+ const std::string& scope, const std::vector<std::string>& content,
+ bool prepend, bool system);
private:
virtual void HandleMissingTarget(const std::string& name) = 0;
@@ -52,9 +55,6 @@ private:
bool ProcessContentArgs(std::vector<std::string> const& args,
unsigned int& argIndex, bool prepend, bool system);
- bool PopulateTargetProperies(const std::string& scope,
- const std::vector<std::string>& content,
- bool prepend, bool system);
cmExecutionStatus& Status;
};
diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx
index 26282effb6..818e271e06 100644
--- a/Source/cmTargetSourcesCommand.cxx
+++ b/Source/cmTargetSourcesCommand.cxx
@@ -2,9 +2,17 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTargetSourcesCommand.h"
+#include <algorithm>
#include <sstream>
+#include <utility>
+#include <cm/string_view>
+#include <cmext/string_view>
+
+#include "cmArgumentParser.h"
+#include "cmFileSet.h"
#include "cmGeneratorExpression.h"
+#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
@@ -15,6 +23,20 @@
namespace {
+struct FileSetArgs
+{
+ std::string Type;
+ std::string FileSet;
+ std::vector<std::string> BaseDirs;
+ std::vector<std::string> Files;
+};
+
+auto const FileSetArgsParser = cmArgumentParser<FileSetArgs>()
+ .Bind("TYPE"_s, &FileSetArgs::Type)
+ .Bind("FILE_SET"_s, &FileSetArgs::FileSet)
+ .Bind("BASE_DIRS"_s, &FileSetArgs::BaseDirs)
+ .Bind("FILES"_s, &FileSetArgs::Files);
+
class TargetSourcesImpl : public cmTargetPropCommandBase
{
public:
@@ -26,8 +48,10 @@ protected:
bool prepend, bool system) override
{
this->cmTargetPropCommandBase::HandleInterfaceContent(
- tgt, this->ConvertToAbsoluteContent(tgt, content, true), prepend,
- system);
+ tgt,
+ this->ConvertToAbsoluteContent(tgt, content, IsInterface::Yes,
+ CheckCMP0076::Yes),
+ prepend, system);
}
private:
@@ -43,29 +67,55 @@ private:
const std::vector<std::string>& content,
bool /*prepend*/, bool /*system*/) override
{
- tgt->AppendProperty(
- "SOURCES",
- this->Join(this->ConvertToAbsoluteContent(tgt, content, false)));
+ tgt->AppendProperty("SOURCES",
+ this->Join(this->ConvertToAbsoluteContent(
+ tgt, content, IsInterface::No, CheckCMP0076::Yes)));
return true; // Successfully handled.
}
+ bool PopulateTargetProperties(const std::string& scope,
+ const std::vector<std::string>& content,
+ bool prepend, bool system) override
+ {
+ if (!content.empty() && content.front() == "FILE_SET"_s) {
+ return this->HandleFileSetMode(scope, content, prepend, system);
+ }
+ return this->cmTargetPropCommandBase::PopulateTargetProperties(
+ scope, content, prepend, system);
+ }
+
std::string Join(const std::vector<std::string>& content) override
{
return cmJoin(content, ";");
}
+ enum class IsInterface
+ {
+ Yes,
+ No,
+ };
+ enum class CheckCMP0076
+ {
+ Yes,
+ No,
+ };
std::vector<std::string> ConvertToAbsoluteContent(
cmTarget* tgt, const std::vector<std::string>& content,
- bool isInterfaceContent);
+ IsInterface isInterfaceContent, CheckCMP0076 checkCmp0076);
+
+ bool HandleFileSetMode(const std::string& scope,
+ const std::vector<std::string>& content, bool prepend,
+ bool system);
};
std::vector<std::string> TargetSourcesImpl::ConvertToAbsoluteContent(
cmTarget* tgt, const std::vector<std::string>& content,
- bool isInterfaceContent)
+ IsInterface isInterfaceContent, CheckCMP0076 checkCmp0076)
{
// Skip conversion in case old behavior has been explicitly requested
- if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0076) ==
- cmPolicies::OLD) {
+ if (checkCmp0076 == CheckCMP0076::Yes &&
+ this->Makefile->GetPolicyStatus(cmPolicies::CMP0076) ==
+ cmPolicies::OLD) {
return content;
}
@@ -76,7 +126,7 @@ std::vector<std::string> TargetSourcesImpl::ConvertToAbsoluteContent(
std::string absoluteSrc;
if (cmSystemTools::FileIsFullPath(src) ||
cmGeneratorExpression::Find(src) == 0 ||
- (!isInterfaceContent &&
+ (isInterfaceContent == IsInterface::No &&
(this->Makefile->GetCurrentSourceDirectory() ==
tgt->GetMakefile()->GetCurrentSourceDirectory()))) {
absoluteSrc = src;
@@ -95,28 +145,33 @@ std::vector<std::string> TargetSourcesImpl::ConvertToAbsoluteContent(
bool issueMessage = true;
bool useAbsoluteContent = false;
std::ostringstream e;
- switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0076)) {
- case cmPolicies::WARN:
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0076) << "\n";
- break;
- case cmPolicies::OLD:
- issueMessage = false;
- break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- this->Makefile->IssueMessage(
- MessageType::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0076));
- break;
- case cmPolicies::NEW: {
- issueMessage = false;
- useAbsoluteContent = true;
- break;
+ if (checkCmp0076 == CheckCMP0076::Yes) {
+ switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0076)) {
+ case cmPolicies::WARN:
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0076) << "\n";
+ break;
+ case cmPolicies::OLD:
+ issueMessage = false;
+ break;
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::REQUIRED_IF_USED:
+ this->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0076));
+ break;
+ case cmPolicies::NEW: {
+ issueMessage = false;
+ useAbsoluteContent = true;
+ break;
+ }
}
+ } else {
+ issueMessage = false;
+ useAbsoluteContent = true;
}
if (issueMessage) {
- if (isInterfaceContent) {
+ if (isInterfaceContent == IsInterface::Yes) {
e << "An interface source of target \"" << tgt->GetName()
<< "\" has a relative path.";
} else {
@@ -129,6 +184,133 @@ std::vector<std::string> TargetSourcesImpl::ConvertToAbsoluteContent(
return useAbsoluteContent ? absoluteContent : content;
}
+bool TargetSourcesImpl::HandleFileSetMode(
+ const std::string& scope, const std::vector<std::string>& content,
+ bool /*prepend*/, bool /*system*/)
+{
+ std::vector<std::string> unparsed;
+ auto args = FileSetArgsParser.Parse(content, &unparsed);
+
+ if (!unparsed.empty()) {
+ this->SetError(
+ cmStrCat("Unrecognized keyword: \"", unparsed.front(), "\""));
+ return false;
+ }
+
+ if (args.FileSet.empty()) {
+ this->SetError("FILE_SET must not be empty");
+ return false;
+ }
+
+ bool const isDefault = args.Type == args.FileSet ||
+ (args.Type.empty() && args.FileSet[0] >= 'A' && args.FileSet[0] <= 'Z');
+ std::string type = isDefault ? args.FileSet : args.Type;
+
+ auto fileSet = this->Target->GetOrCreateFileSet(args.FileSet, type);
+ if (fileSet.second) {
+ if (!isDefault) {
+ if (args.FileSet[0] >= 'A' && args.FileSet[0] <= 'Z') {
+ this->SetError(
+ "Non-default file set name must not start with a capital letter");
+ return false;
+ }
+ }
+ if (type.empty()) {
+ this->SetError("Must specify a TYPE when creating file set");
+ return false;
+ }
+ if (type != "HEADERS"_s) {
+ this->SetError("File set TYPE may only be \"HEADERS\"");
+ return false;
+ }
+
+ if (args.BaseDirs.empty()) {
+ args.BaseDirs.emplace_back(this->Makefile->GetCurrentSourceDirectory());
+ }
+
+ if (scope == "PRIVATE"_s || scope == "PUBLIC"_s) {
+ this->Target->AppendProperty(cmTarget::GetFileSetsPropertyName(type),
+ args.FileSet);
+ }
+ if (scope == "INTERFACE"_s || scope == "PUBLIC"_s) {
+ this->Target->AppendProperty(
+ cmTarget::GetInterfaceFileSetsPropertyName(type), args.FileSet);
+ }
+ } else {
+ type = fileSet.first->GetType();
+ if (!args.Type.empty() && args.Type != type) {
+ this->SetError(cmStrCat(
+ "Type \"", args.Type, "\" for file set \"", fileSet.first->GetName(),
+ "\" does not match original type \"", type, "\""));
+ return false;
+ }
+
+ std::string existingScope = "PRIVATE";
+
+ auto const fileSetsProperty = cmTarget::GetFileSetsPropertyName(type);
+ auto const interfaceFileSetsProperty =
+ cmTarget::GetInterfaceFileSetsPropertyName(type);
+ std::vector<std::string> fileSets;
+ std::vector<std::string> interfaceFileSets;
+ cmExpandList(this->Target->GetSafeProperty(fileSetsProperty), fileSets);
+ cmExpandList(this->Target->GetSafeProperty(interfaceFileSetsProperty),
+ interfaceFileSets);
+
+ if (std::find(interfaceFileSets.begin(), interfaceFileSets.end(),
+ args.FileSet) != interfaceFileSets.end()) {
+ existingScope = "INTERFACE";
+ }
+ if (std::find(fileSets.begin(), fileSets.end(), args.FileSet) !=
+ fileSets.end()) {
+ if (existingScope == "INTERFACE"_s) {
+ existingScope = "PUBLIC";
+ }
+ } else if (existingScope != "INTERFACE"_s) {
+ this->SetError(cmStrCat("File set \"", args.FileSet, "\" is not in ",
+ fileSetsProperty, " or ",
+ interfaceFileSetsProperty));
+ return false;
+ }
+
+ if (scope != existingScope) {
+ this->SetError(
+ cmStrCat("Scope ", scope, " for file set \"", args.FileSet,
+ "\" does not match original scope ", existingScope));
+ return false;
+ }
+ }
+
+ auto files = this->Join(this->ConvertToAbsoluteContent(
+ this->Target, args.Files, IsInterface::Yes, CheckCMP0076::No));
+ if (!files.empty()) {
+ fileSet.first->AddFileEntry(
+ BT<std::string>(files, this->Makefile->GetBacktrace()));
+ }
+
+ auto baseDirectories = this->Join(this->ConvertToAbsoluteContent(
+ this->Target, args.BaseDirs, IsInterface::Yes, CheckCMP0076::No));
+ if (!baseDirectories.empty()) {
+ fileSet.first->AddDirectoryEntry(
+ BT<std::string>(baseDirectories, this->Makefile->GetBacktrace()));
+ if (type == "HEADERS"_s) {
+ for (auto const& dir : cmExpandedList(baseDirectories)) {
+ auto interfaceDirectoriesGenex =
+ cmStrCat("$<BUILD_INTERFACE:", dir, ">");
+ if (scope == "PRIVATE"_s || scope == "PUBLIC"_s) {
+ this->Target->AppendProperty("INCLUDE_DIRECTORIES",
+ interfaceDirectoriesGenex);
+ }
+ if (scope == "INTERFACE"_s || scope == "PUBLIC"_s) {
+ this->Target->AppendProperty("INTERFACE_INCLUDE_DIRECTORIES",
+ interfaceDirectoriesGenex);
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
} // namespace
bool cmTargetSourcesCommand(std::vector<std::string> const& args,
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index cc9e15864c..cd468b935b 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -211,7 +211,7 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
char retChar[16];
const char* retStr;
if (worked) {
- sprintf(retChar, "%i", retVal);
+ snprintf(retChar, sizeof(retChar), "%i", retVal);
retStr = retChar;
} else {
retStr = "FAILED_TO_RUN";
diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx
index 969a2c2c1c..cbd241b5ac 100644
--- a/Source/cmVSSetupHelper.cxx
+++ b/Source/cmVSSetupHelper.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmVSSetupHelper.h"
+#include <utility>
+
#include "cmsys/Encoding.hxx"
#include "cmsys/FStream.hxx"
@@ -46,17 +48,36 @@ const CLSID CLSID_SetupConfiguration = {
/* clang-format on */
#endif
+namespace {
const WCHAR* Win10SDKComponent =
L"Microsoft.VisualStudio.Component.Windows10SDK";
const WCHAR* Win81SDKComponent =
L"Microsoft.VisualStudio.Component.Windows81SDK";
const WCHAR* ComponentType = L"Component";
+bool LoadVSInstanceVCToolsetVersion(VSInstanceInfo& vsInstanceInfo)
+{
+ std::string const vcRoot = vsInstanceInfo.GetInstallLocation();
+ std::string vcToolsVersionFile =
+ vcRoot + "/VC/Auxiliary/Build/Microsoft.VCToolsVersion.default.txt";
+ std::string vcToolsVersion;
+ cmsys::ifstream fin(vcToolsVersionFile.c_str());
+ if (!fin || !cmSystemTools::GetLineFromStream(fin, vcToolsVersion)) {
+ return false;
+ }
+ vcToolsVersion = cmTrimWhitespace(vcToolsVersion);
+ std::string const vcToolsDir = vcRoot + "/VC/Tools/MSVC/" + vcToolsVersion;
+ if (!cmSystemTools::FileIsDirectory(vcToolsDir)) {
+ return false;
+ }
+ vsInstanceInfo.VCToolsetVersion = vcToolsVersion;
+ return true;
+}
+}
+
std::string VSInstanceInfo::GetInstallLocation() const
{
- std::string loc = cmsys::Encoding::ToNarrow(this->VSInstallLocation);
- cmSystemTools::ConvertToUnixSlashes(loc);
- return loc;
+ return this->VSInstallLocation;
}
cmVSSetupAPIHelper::cmVSSetupAPIHelper(unsigned int version)
@@ -83,10 +104,12 @@ cmVSSetupAPIHelper::~cmVSSetupAPIHelper()
CoUninitialize();
}
-bool cmVSSetupAPIHelper::SetVSInstance(std::string const& vsInstallLocation)
+bool cmVSSetupAPIHelper::SetVSInstance(std::string const& vsInstallLocation,
+ std::string const& vsInstallVersion)
{
this->SpecifiedVSInstallLocation = vsInstallLocation;
cmSystemTools::ConvertToUnixSlashes(this->SpecifiedVSInstallLocation);
+ this->SpecifiedVSInstallVersion = vsInstallVersion;
chosenInstanceInfo = VSInstanceInfo();
return this->EnumerateAndChooseVSInstance();
}
@@ -152,29 +175,17 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo(
if (pInstance == NULL)
return false;
- SmartBSTR bstrId;
- if (SUCCEEDED(pInstance->GetInstanceId(&bstrId))) {
- vsInstanceInfo.InstanceId = std::wstring(bstrId);
- } else {
- return false;
- }
-
InstanceState state;
if (FAILED(pInstance->GetState(&state))) {
return false;
}
- ULONGLONG ullVersion = 0;
SmartBSTR bstrVersion;
if (FAILED(pInstance->GetInstallationVersion(&bstrVersion))) {
return false;
} else {
- vsInstanceInfo.Version = std::wstring(bstrVersion);
- if (FAILED(setupHelper->ParseVersion(bstrVersion, &ullVersion))) {
- vsInstanceInfo.ullVersion = 0;
- } else {
- vsInstanceInfo.ullVersion = ullVersion;
- }
+ vsInstanceInfo.Version =
+ cmsys::Encoding::ToNarrow(std::wstring(bstrVersion));
}
// Reboot may have been required before the installation path was created.
@@ -183,26 +194,15 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo(
if (FAILED(pInstance->GetInstallationPath(&bstrInstallationPath))) {
return false;
} else {
- vsInstanceInfo.VSInstallLocation = std::wstring(bstrInstallationPath);
+ vsInstanceInfo.VSInstallLocation =
+ cmsys::Encoding::ToNarrow(std::wstring(bstrInstallationPath));
+ cmSystemTools::ConvertToUnixSlashes(vsInstanceInfo.VSInstallLocation);
}
}
// Check if a compiler is installed with this instance.
- {
- std::string const vcRoot = vsInstanceInfo.GetInstallLocation();
- std::string vcToolsVersionFile =
- vcRoot + "/VC/Auxiliary/Build/Microsoft.VCToolsVersion.default.txt";
- std::string vcToolsVersion;
- cmsys::ifstream fin(vcToolsVersionFile.c_str());
- if (!fin || !cmSystemTools::GetLineFromStream(fin, vcToolsVersion)) {
- return false;
- }
- vcToolsVersion = cmTrimWhitespace(vcToolsVersion);
- std::string const vcToolsDir = vcRoot + "/VC/Tools/MSVC/" + vcToolsVersion;
- if (!cmSystemTools::FileIsDirectory(vcToolsDir)) {
- return false;
- }
- vsInstanceInfo.VCToolsetVersion = vcToolsVersion;
+ if (!LoadVSInstanceVCToolsetVersion(vsInstanceInfo)) {
+ return false;
}
// Reboot may have been required before the product package was registered
@@ -264,7 +264,7 @@ bool cmVSSetupAPIHelper::GetVSInstanceVersion(std::string& vsInstanceVersion)
bool isInstalled = this->EnumerateAndChooseVSInstance();
if (isInstalled) {
- vsInstanceVersion = cmsys::Encoding::ToNarrow(chosenInstanceInfo.Version);
+ vsInstanceVersion = chosenInstanceInfo.Version;
}
return isInstalled;
@@ -298,7 +298,7 @@ bool cmVSSetupAPIHelper::IsEWDKEnabled()
bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance()
{
bool isVSInstanceExists = false;
- if (chosenInstanceInfo.VSInstallLocation.compare(L"") != 0) {
+ if (chosenInstanceInfo.VSInstallLocation.compare("") != 0) {
return true;
}
@@ -311,12 +311,11 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance()
if (envVSVersion.empty() || envVsInstallDir.empty())
return false;
- chosenInstanceInfo.VSInstallLocation =
- std::wstring(envVsInstallDir.begin(), envVsInstallDir.end());
- chosenInstanceInfo.Version =
- std::wstring(envVSVersion.begin(), envVSVersion.end());
- chosenInstanceInfo.VCToolsetVersion = envVSVersion;
- chosenInstanceInfo.ullVersion = std::stoi(envVSVersion);
+ chosenInstanceInfo.VSInstallLocation = envVsInstallDir;
+ chosenInstanceInfo.Version = envVSVersion;
+ if (!LoadVSInstanceVCToolsetVersion(chosenInstanceInfo)) {
+ return false;
+ }
chosenInstanceInfo.IsWin10SDKInstalled = true;
chosenInstanceInfo.IsWin81SDKInstalled = !envWindowsSdkDir81.empty();
return true;
@@ -343,7 +342,9 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance()
return false;
}
- std::wstring const wantVersion = std::to_wstring(this->Version) + L'.';
+ std::string const wantVersion = std::to_string(this->Version) + '.';
+
+ bool specifiedLocationNotSpecifiedVersion = false;
SmartCOMPtr<ISetupInstance> instance;
while (SUCCEEDED(enumInstances->Next(1, &instance, NULL)) && instance) {
@@ -371,6 +372,16 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance()
std::string currentVSLocation = instanceInfo.GetInstallLocation();
if (cmSystemTools::ComparePath(currentVSLocation,
this->SpecifiedVSInstallLocation)) {
+ if (this->SpecifiedVSInstallVersion.empty() ||
+ instanceInfo.Version == this->SpecifiedVSInstallVersion) {
+ chosenInstanceInfo = instanceInfo;
+ return true;
+ }
+ specifiedLocationNotSpecifiedVersion = true;
+ }
+ } else if (!this->SpecifiedVSInstallVersion.empty()) {
+ // We are looking for a specific version.
+ if (instanceInfo.Version == this->SpecifiedVSInstallVersion) {
chosenInstanceInfo = instanceInfo;
return true;
}
@@ -392,6 +403,13 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance()
}
}
+ if (!this->SpecifiedVSInstallLocation.empty() &&
+ !specifiedLocationNotSpecifiedVersion) {
+ // The VS Installer does not know about the specified location.
+ // Check for one directly on disk.
+ return this->LoadSpecifiedVSInstanceFromDisk();
+ }
+
if (vecVSInstances.size() > 0) {
isVSInstanceExists = true;
int index = ChooseVSInstance(vecVSInstances);
@@ -454,6 +472,32 @@ int cmVSSetupAPIHelper::ChooseVSInstance(
return chosenIndex;
}
+bool cmVSSetupAPIHelper::LoadSpecifiedVSInstanceFromDisk()
+{
+ if (!cmSystemTools::FileIsDirectory(this->SpecifiedVSInstallLocation)) {
+ return false;
+ }
+ VSInstanceInfo vsInstanceInfo;
+ vsInstanceInfo.VSInstallLocation = this->SpecifiedVSInstallLocation;
+ // FIXME: Is there a better way to get SDK information?
+ vsInstanceInfo.IsWin10SDKInstalled = true;
+ vsInstanceInfo.IsWin81SDKInstalled = false;
+
+ if (!this->SpecifiedVSInstallVersion.empty()) {
+ // Assume the version specified by the user is correct.
+ vsInstanceInfo.Version = this->SpecifiedVSInstallVersion;
+ } else {
+ return false;
+ }
+
+ if (!LoadVSInstanceVCToolsetVersion(vsInstanceInfo)) {
+ return false;
+ }
+
+ chosenInstanceInfo = std::move(vsInstanceInfo);
+ return true;
+}
+
bool cmVSSetupAPIHelper::Initialize()
{
if (initializationFailure)
diff --git a/Source/cmVSSetupHelper.h b/Source/cmVSSetupHelper.h
index 61a3ac7f8d..44c883be28 100644
--- a/Source/cmVSSetupHelper.h
+++ b/Source/cmVSSetupHelper.h
@@ -84,11 +84,9 @@ private:
struct VSInstanceInfo
{
- std::wstring InstanceId;
- std::wstring VSInstallLocation;
- std::wstring Version;
+ std::string VSInstallLocation;
+ std::string Version;
std::string VCToolsetVersion;
- ULONGLONG ullVersion = 0; // A.B.C.D = (A<<48)|(B<<32)|(C<<16)|D
bool IsWin10SDKInstalled = false;
bool IsWin81SDKInstalled = false;
@@ -101,7 +99,8 @@ public:
cmVSSetupAPIHelper(unsigned int version);
~cmVSSetupAPIHelper();
- bool SetVSInstance(std::string const& vsInstallLocation);
+ bool SetVSInstance(std::string const& vsInstallLocation,
+ std::string const& vsInstallVersion);
bool IsVSInstalled();
bool GetVSInstanceInfo(std::string& vsInstallLocation);
@@ -118,6 +117,7 @@ private:
bool& bWin10SDK, bool& bWin81SDK);
int ChooseVSInstance(const std::vector<VSInstanceInfo>& vecVSInstances);
bool EnumerateAndChooseVSInstance();
+ bool LoadSpecifiedVSInstanceFromDisk();
unsigned int Version;
@@ -134,4 +134,5 @@ private:
bool IsEWDKEnabled();
std::string SpecifiedVSInstallLocation;
+ std::string SpecifiedVSInstallVersion;
};
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index a871e4ce53..16f52e0352 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2,8 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmVisualStudio10TargetGenerator.h"
+#include <algorithm>
+#include <cstdio>
+#include <cstring>
#include <iterator>
#include <set>
+#include <sstream>
#include <cm/memory>
#include <cm/optional>
@@ -13,22 +17,41 @@
#include "windows.h"
+#include "cmsys/FStream.hxx"
+#include "cmsys/RegularExpression.hxx"
+
#include "cmComputeLinkInformation.h"
#include "cmCustomCommand.h"
#include "cmCustomCommandGenerator.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
+#include "cmGlobalGenerator.h"
#include "cmGlobalVisualStudio10Generator.h"
-#include "cmGlobalVisualStudioVersionedGenerator.h"
+#include "cmGlobalVisualStudio7Generator.h"
+#include "cmGlobalVisualStudioGenerator.h"
#include "cmLinkLineDeviceComputer.h"
+#include "cmListFileCache.h"
+#include "cmLocalGenerator.h"
#include "cmLocalVisualStudio10Generator.h"
+#include "cmLocalVisualStudio7Generator.h"
+#include "cmLocalVisualStudioGenerator.h"
#include "cmMakefile.h"
+#include "cmMessageType.h"
+#include "cmPropertyMap.h"
#include "cmSourceFile.h"
+#include "cmSourceFileLocation.h"
+#include "cmSourceFileLocationKind.h"
+#include "cmSourceGroup.h"
+#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
+#include "cmTarget.h"
+#include "cmValue.h"
#include "cmVisualStudioGeneratorOptions.h"
+struct cmIDEFlagTable;
+
static void ConvertToWindowsSlash(std::string& s);
static std::string cmVS10EscapeXML(std::string arg)
@@ -267,7 +290,8 @@ std::string cmVisualStudio10TargetGenerator::CalcCondition(
oss << config << "|" << this->Platform;
oss << "'";
// handle special case for 32 bit C# targets
- if (this->ProjectType == csproj && this->Platform == "Win32") {
+ if (this->ProjectType == VsProjectType::csproj &&
+ this->Platform == "Win32") {
oss << " Or ";
oss << "'$(Configuration)|$(Platform)'=='";
oss << config << "|x86";
@@ -318,7 +342,7 @@ void cmVisualStudio10TargetGenerator::Generate()
const std::string ProjectFileExtension =
computeProjectFileExtension(this->GeneratorTarget);
if (ProjectFileExtension == ".vcxproj") {
- this->ProjectType = vcxproj;
+ this->ProjectType = VsProjectType::vcxproj;
this->Managed = false;
} else if (ProjectFileExtension == ".csproj") {
if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) {
@@ -328,7 +352,7 @@ void cmVisualStudio10TargetGenerator::Generate()
"disabled in future). Make it a SHARED library instead.";
this->Makefile->IssueMessage(MessageType::DEPRECATION_WARNING, message);
}
- this->ProjectType = csproj;
+ this->ProjectType = VsProjectType::csproj;
this->Managed = true;
}
@@ -423,7 +447,7 @@ void cmVisualStudio10TargetGenerator::Generate()
e1.Element("PreferredToolArchitecture", hostArch);
}
- if (this->ProjectType != csproj) {
+ if (this->ProjectType != VsProjectType::csproj) {
this->WriteProjectConfigurations(e0);
}
@@ -442,7 +466,7 @@ void cmVisualStudio10TargetGenerator::Generate()
this->GeneratorTarget->GetProperty("VS_GLOBAL_PROJECT_TYPES");
if (vsProjectTypes) {
const char* tagName = "ProjectTypes";
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
tagName = "ProjectTypeGuids";
}
e1.Element(tagName, *vsProjectTypes);
@@ -507,16 +531,16 @@ void cmVisualStudio10TargetGenerator::Generate()
} else if (cmValue tfVer = this->GeneratorTarget->GetProperty(
"DOTNET_TARGET_FRAMEWORK_VERSION")) {
targetFrameworkVersion = *tfVer;
- } else if (this->ProjectType == csproj) {
+ } else if (this->ProjectType == VsProjectType::csproj) {
targetFrameworkVersion =
this->GlobalGenerator->GetTargetFrameworkVersion();
}
- if (this->ProjectType == vcxproj &&
+ if (this->ProjectType == VsProjectType::vcxproj &&
this->GlobalGenerator->TargetsWindowsCE()) {
e1.Element("EnableRedirectPlatform", "true");
e1.Element("RedirectPlatformValue", this->Platform);
}
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
if (this->GlobalGenerator->TargetsWindowsCE()) {
// FIXME: These target VS_TARGET_FRAMEWORK* target properties
// are undocumented settings only ever supported for WinCE.
@@ -643,7 +667,7 @@ void cmVisualStudio10TargetGenerator::Generate()
}
switch (this->ProjectType) {
- case vcxproj: {
+ case VsProjectType::vcxproj: {
std::string const& props =
this->GlobalGenerator->GetPlatformToolsetVersionProps();
if (!props.empty()) {
@@ -651,7 +675,7 @@ void cmVisualStudio10TargetGenerator::Generate()
}
Elem(e0, "Import").Attribute("Project", VS10_CXX_DEFAULT_PROPS);
} break;
- case csproj:
+ case VsProjectType::csproj:
Elem(e0, "Import")
.Attribute("Project", VS10_CSharp_DEFAULT_PROPS)
.Attribute("Condition", "Exists('" VS10_CSharp_DEFAULT_PROPS "')");
@@ -660,7 +684,7 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteProjectConfigurationValues(e0);
- if (this->ProjectType == vcxproj) {
+ if (this->ProjectType == VsProjectType::vcxproj) {
Elem(e0, "Import").Attribute("Project", VS10_CXX_PROPS);
}
{
@@ -706,10 +730,10 @@ void cmVisualStudio10TargetGenerator::Generate()
e1.Attribute("Label", "PropertySheets");
std::string props;
switch (this->ProjectType) {
- case vcxproj:
+ case VsProjectType::vcxproj:
props = VS10_CXX_USER_PROPS;
break;
- case csproj:
+ case VsProjectType::csproj:
props = VS10_CSharp_USER_PROPS;
break;
}
@@ -744,10 +768,10 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteProjectReferences(e0);
this->WriteSDKReferences(e0);
switch (this->ProjectType) {
- case vcxproj:
+ case VsProjectType::vcxproj:
Elem(e0, "Import").Attribute("Project", VS10_CXX_TARGETS);
break;
- case csproj:
+ case VsProjectType::csproj:
if (this->GlobalGenerator->TargetsWindowsCE()) {
Elem(e0, "Import").Attribute("Project", VS10_CSharp_NETCF_TARGETS);
} else {
@@ -788,12 +812,13 @@ void cmVisualStudio10TargetGenerator::Generate()
Elem(e1, "Import").Attribute("Project", nasmTargets);
}
}
- if (this->ProjectType == vcxproj && this->HaveCustomCommandDepfile) {
+ if (this->ProjectType == VsProjectType::vcxproj &&
+ this->HaveCustomCommandDepfile) {
std::string depfileTargets =
GetCMakeFilePath("Templates/MSBuild/CustomBuildDepFile.targets");
Elem(e0, "Import").Attribute("Project", depfileTargets);
}
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
for (std::string const& c : this->Configurations) {
Elem e1(e0, "PropertyGroup");
e1.Attribute("Condition", "'$(Configuration)' == '" + c + "'");
@@ -959,7 +984,8 @@ void cmVisualStudio10TargetGenerator::WriteDotNetDocumentationFile(Elem& e0)
std::string const& documentationFile =
this->GeneratorTarget->GetSafeProperty("VS_DOTNET_DOCUMENTATION_FILE");
- if (this->ProjectType == csproj && !documentationFile.empty()) {
+ if (this->ProjectType == VsProjectType::csproj &&
+ !documentationFile.empty()) {
Elem e1(e0, "PropertyGroup");
Elem e2(e1, "DocumentationFile");
e2.Content(documentationFile);
@@ -976,7 +1002,7 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup(Elem& e0)
std::string obj = oi->GetFullPath();
ConvertToWindowsSlash(obj);
bool useRelativePath = false;
- if (this->ProjectType == csproj && this->InSourceBuild) {
+ if (this->ProjectType == VsProjectType::csproj && this->InSourceBuild) {
// If we do an in-source build and the resource file is in a
// subdirectory
// of the .csproj file, we have to use relative pathnames, otherwise
@@ -990,7 +1016,7 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup(Elem& e0)
Elem e2(e1, "EmbeddedResource");
e2.Attribute("Include", obj);
- if (this->ProjectType != csproj) {
+ if (this->ProjectType != VsProjectType::csproj) {
std::string hFileName = obj.substr(0, obj.find_last_of(".")) + ".h";
e2.Element("DependentUpon", hFileName);
@@ -1161,7 +1187,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues(Elem& e0)
e1.Attribute("Condition", this->CalcCondition(c));
e1.Attribute("Label", "Configuration");
- if (this->ProjectType != csproj) {
+ if (this->ProjectType != VsProjectType::csproj) {
std::string configType;
if (cmValue vsConfigurationType =
this->GeneratorTarget->GetProperty("VS_CONFIGURATION_TYPE")) {
@@ -1470,7 +1496,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
std::unique_ptr<Elem> spe1;
std::unique_ptr<Elem> spe2;
- if (this->ProjectType != csproj) {
+ if (this->ProjectType != VsProjectType::csproj) {
spe1 = cm::make_unique<Elem>(e0, "ItemGroup");
spe2 = cm::make_unique<Elem>(*spe1, "CustomBuild");
this->WriteSource(*spe2, source);
@@ -1494,7 +1520,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
std::stringstream additional_inputs;
{
const char* sep = "";
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
// csproj files do not attach the command to a specific file
// so the primary input must be listed explicitly.
additional_inputs << source->GetFullPath();
@@ -1524,7 +1550,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
}
}
}
- if (this->ProjectType != csproj) {
+ if (this->ProjectType != VsProjectType::csproj) {
additional_inputs << sep << "%(AdditionalInputs)";
}
}
@@ -1545,7 +1571,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
}
}
}
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
std::string name = "CustomCommand_" + c + "_" +
cmSystemTools::ComputeStringMD5(sourcePath);
this->WriteCustomRuleCSharp(e0, c, name, script, additional_inputs.str(),
@@ -1636,7 +1662,7 @@ static void ConvertToWindowsSlash(std::string& s)
void cmVisualStudio10TargetGenerator::WriteGroups()
{
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
return;
}
@@ -1901,7 +1927,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(
std::string includeInVsix;
std::string ext = cmSystemTools::LowerCase(sf->GetExtension());
- if (this->ProjectType == csproj && !this->InSourceBuild) {
+ if (this->ProjectType == VsProjectType::csproj && !this->InSourceBuild) {
toolHasSettings = true;
}
if (ext == "hlsl") {
@@ -2162,7 +2188,7 @@ void cmVisualStudio10TargetGenerator::WriteSource(Elem& e2,
ConvertToWindowsSlash(sourceFile);
e2.Attribute("Include", sourceFile);
- if (this->ProjectType == csproj && !this->InSourceBuild) {
+ if (this->ProjectType == VsProjectType::csproj && !this->InSourceBuild) {
// For out of source projects we have to provide a link (if not specified
// via property) for every source file (besides .cs files) otherwise they
// will not be visible in VS at all.
@@ -2348,12 +2374,13 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
// Visual Studio versions prior to 2017 15.8 do not know about unity
// builds, thus we exclude the files already part of unity sources.
if (!si.Source->GetPropertyAsBool("SKIP_UNITY_BUILD_INCLUSION")) {
- exclude_configs = si.Configs;
+ exclude_configs = all_configs;
}
}
}
- if (si.Kind == cmGeneratorTarget::SourceKindObjectSource) {
+ if (si.Kind == cmGeneratorTarget::SourceKindObjectSource ||
+ si.Kind == cmGeneratorTarget::SourceKindUnityBatched) {
this->OutputSourceSpecificFlags(e2, si.Source);
}
if (si.Source->GetPropertyAsBool("SKIP_PRECOMPILE_HEADERS")) {
@@ -2603,7 +2630,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
e2.Element("DependentUpon",
fileName.substr(0, fileName.find_last_of(".")));
}
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
std::string f = source->GetFullPath();
using CsPropMap = std::map<std::string, std::string>;
CsPropMap sourceFileTags;
@@ -2634,7 +2661,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions(
if (ttype > cmStateEnums::GLOBAL_TARGET) {
return;
}
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
return;
}
@@ -2643,40 +2670,6 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions(
for (std::string const& config : this->Configurations) {
const std::string cond = this->CalcCondition(config);
- if (ttype <= cmStateEnums::UTILITY) {
- if (cmValue workingDir = this->GeneratorTarget->GetProperty(
- "VS_DEBUGGER_WORKING_DIRECTORY")) {
- std::string genWorkingDir = cmGeneratorExpression::Evaluate(
- *workingDir, this->LocalGenerator, config);
- e1.WritePlatformConfigTag("LocalDebuggerWorkingDirectory", cond,
- genWorkingDir);
- }
-
- if (cmValue environment =
- this->GeneratorTarget->GetProperty("VS_DEBUGGER_ENVIRONMENT")) {
- std::string genEnvironment = cmGeneratorExpression::Evaluate(
- *environment, this->LocalGenerator, config);
- e1.WritePlatformConfigTag("LocalDebuggerEnvironment", cond,
- genEnvironment);
- }
-
- if (cmValue debuggerCommand =
- this->GeneratorTarget->GetProperty("VS_DEBUGGER_COMMAND")) {
- std::string genDebuggerCommand = cmGeneratorExpression::Evaluate(
- *debuggerCommand, this->LocalGenerator, config);
- e1.WritePlatformConfigTag("LocalDebuggerCommand", cond,
- genDebuggerCommand);
- }
-
- if (cmValue commandArguments = this->GeneratorTarget->GetProperty(
- "VS_DEBUGGER_COMMAND_ARGUMENTS")) {
- std::string genCommandArguments = cmGeneratorExpression::Evaluate(
- *commandArguments, this->LocalGenerator, config);
- e1.WritePlatformConfigTag("LocalDebuggerCommandArguments", cond,
- genCommandArguments);
- }
- }
-
if (ttype >= cmStateEnums::UTILITY) {
e1.WritePlatformConfigTag(
"IntDir", cond, "$(Platform)\\$(Configuration)\\$(ProjectName)\\");
@@ -2753,6 +2746,40 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions(
this->OutputLinkIncremental(e1, config);
}
+
+ if (ttype <= cmStateEnums::UTILITY) {
+ if (cmValue workingDir = this->GeneratorTarget->GetProperty(
+ "VS_DEBUGGER_WORKING_DIRECTORY")) {
+ std::string genWorkingDir = cmGeneratorExpression::Evaluate(
+ *workingDir, this->LocalGenerator, config);
+ e1.WritePlatformConfigTag("LocalDebuggerWorkingDirectory", cond,
+ genWorkingDir);
+ }
+
+ if (cmValue environment =
+ this->GeneratorTarget->GetProperty("VS_DEBUGGER_ENVIRONMENT")) {
+ std::string genEnvironment = cmGeneratorExpression::Evaluate(
+ *environment, this->LocalGenerator, config);
+ e1.WritePlatformConfigTag("LocalDebuggerEnvironment", cond,
+ genEnvironment);
+ }
+
+ if (cmValue debuggerCommand =
+ this->GeneratorTarget->GetProperty("VS_DEBUGGER_COMMAND")) {
+ std::string genDebuggerCommand = cmGeneratorExpression::Evaluate(
+ *debuggerCommand, this->LocalGenerator, config);
+ e1.WritePlatformConfigTag("LocalDebuggerCommand", cond,
+ genDebuggerCommand);
+ }
+
+ if (cmValue commandArguments = this->GeneratorTarget->GetProperty(
+ "VS_DEBUGGER_COMMAND_ARGUMENTS")) {
+ std::string genCommandArguments = cmGeneratorExpression::Evaluate(
+ *commandArguments, this->LocalGenerator, config);
+ e1.WritePlatformConfigTag("LocalDebuggerCommandArguments", cond,
+ genCommandArguments);
+ }
+ }
}
}
@@ -2762,7 +2789,7 @@ void cmVisualStudio10TargetGenerator::OutputLinkIncremental(
if (!this->MSTools) {
return;
}
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
return;
}
// static libraries and things greater than modules do not need
@@ -2830,11 +2857,11 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator;
std::unique_ptr<Options> pOptions;
switch (this->ProjectType) {
- case vcxproj:
+ case VsProjectType::vcxproj:
pOptions = cm::make_unique<Options>(
this->LocalGenerator, Options::Compiler, gg->GetClFlagTable());
break;
- case csproj:
+ case VsProjectType::csproj:
pOptions =
cm::make_unique<Options>(this->LocalGenerator, Options::CSharpCompiler,
gg->GetCSharpFlagTable());
@@ -2854,7 +2881,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// Choose a language whose flags to use for ClCompile.
static const char* clLangs[] = { "CXX", "C", "Fortran" };
std::string langForClCompile;
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
langForClCompile = "CSharp";
} else if (cm::contains(clLangs, linkLanguage)) {
langForClCompile = linkLanguage;
@@ -2884,9 +2911,10 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// Precompile Headers
std::string pchHeader =
this->GeneratorTarget->GetPchHeader(configName, linkLanguage);
- if (this->MSTools && vcxproj == this->ProjectType && pchHeader.empty()) {
+ if (this->MSTools && VsProjectType::vcxproj == this->ProjectType &&
+ pchHeader.empty()) {
clOptions.AddFlag("PrecompiledHeader", "NotUsing");
- } else if (this->MSTools && vcxproj == this->ProjectType &&
+ } else if (this->MSTools && VsProjectType::vcxproj == this->ProjectType &&
!pchHeader.empty()) {
clOptions.AddFlag("PrecompiledHeader", "Use");
clOptions.AddFlag("PrecompiledHeaderFile", pchHeader);
@@ -2898,7 +2926,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// Get preprocessor definitions for this directory.
std::string defineFlags = this->Makefile->GetDefineFlags();
if (this->MSTools) {
- if (this->ProjectType == vcxproj) {
+ if (this->ProjectType == VsProjectType::vcxproj) {
clOptions.FixExceptionHandlingDefault();
if (this->GlobalGenerator->GetVersion() >=
cmGlobalVisualStudioGenerator::VS15) {
@@ -2916,7 +2944,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// check for managed C++ assembly compiler flag. This overrides any
// /clr* compiler flags which may be defined in the flags variable(s).
- if (this->ProjectType != csproj) {
+ if (this->ProjectType != VsProjectType::csproj) {
// Warn if /clr was added manually. This should not be done
// anymore, because cmGeneratorTarget may not be aware that the
// target uses C++/CLI.
@@ -2945,13 +2973,13 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
clOptions.Parse(defineFlags);
std::vector<std::string> targetDefines;
switch (this->ProjectType) {
- case vcxproj:
+ case VsProjectType::vcxproj:
if (!langForClCompile.empty()) {
this->GeneratorTarget->GetCompileDefinitions(targetDefines, configName,
langForClCompile);
}
break;
- case csproj:
+ case VsProjectType::csproj:
this->GeneratorTarget->GetCompileDefinitions(targetDefines, configName,
"CSharp");
cm::erase_if(targetDefines, [](std::string const& def) {
@@ -2961,7 +2989,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
}
clOptions.AddDefines(targetDefines);
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
clOptions.AppendFlag("DefineConstants", targetDefines);
}
@@ -3024,7 +3052,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
}
}
- if (this->ProjectType != csproj && clOptions.IsManaged()) {
+ if (this->ProjectType != VsProjectType::csproj && clOptions.IsManaged()) {
this->Managed = true;
std::string managedType = clOptions.GetFlag("CompileAsManaged");
if (managedType == "Safe" || managedType == "Pure") {
@@ -3037,7 +3065,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
clOptions.AddFlag("ExceptionHandling", "Async");
clOptions.AddFlag("BasicRuntimeChecks", "Default");
}
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
// /nowin32manifest overrides /win32manifest: parameter
if (clOptions.HasFlag("NoWin32Manifest")) {
clOptions.RemoveFlag("ApplicationManifest");
@@ -3063,7 +3091,7 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
Elem& e1, std::string const& configName)
{
Options& clOptions = *(this->ClOptions[configName]);
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
return;
}
Elem e2(e1, "ClCompile");
@@ -3226,18 +3254,17 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions(
// the default to not have any extension
cudaOptions.AddFlag("CompileOut", "$(IntDir)%(Filename).obj");
- bool notPtx = true;
if (this->GeneratorTarget->GetPropertyAsBool("CUDA_SEPARABLE_COMPILATION")) {
cudaOptions.AddFlag("GenerateRelocatableDeviceCode", "true");
- } else if (this->GeneratorTarget->GetPropertyAsBool(
- "CUDA_PTX_COMPILATION")) {
+ }
+ bool notPtx = true;
+ if (this->GeneratorTarget->GetPropertyAsBool("CUDA_PTX_COMPILATION")) {
cudaOptions.AddFlag("NvccCompilation", "ptx");
// We drop the %(Extension) component as CMake expects all PTX files
// to not have the source file extension at all
cudaOptions.AddFlag("CompileOut", "$(IntDir)%(Filename).ptx");
notPtx = false;
}
-
if (notPtx &&
cmSystemTools::VersionCompareGreaterEq(
"8.0", this->GlobalGenerator->GetPlatformToolsetCudaString())) {
@@ -4014,7 +4041,7 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(
this->GeneratorTarget->GetType() > cmStateEnums::MODULE_LIBRARY) {
return;
}
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
return;
}
@@ -4050,7 +4077,7 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
if (!location.empty()) {
ConvertToWindowsSlash(location);
switch (this->ProjectType) {
- case csproj:
+ case VsProjectType::csproj:
// If the target we want to "link" to is an imported managed
// target and this is a C# project, we add a hint reference. This
// reference is written to project file in
@@ -4058,7 +4085,7 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
this->DotNetHintReferences[config].push_back(
DotNetHintReference(l.Target->GetName(), location));
break;
- case vcxproj:
+ case VsProjectType::vcxproj:
// Add path of assembly to list of using-directories, so the
// managed assembly can be used by '#using <assembly.dll>' in
// code.
@@ -4118,7 +4145,7 @@ void cmVisualStudio10TargetGenerator::WriteMidlOptions(
if (!this->MSTools) {
return;
}
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
return;
}
if (this->GeneratorTarget->GetType() > cmStateEnums::UTILITY) {
@@ -4159,7 +4186,7 @@ void cmVisualStudio10TargetGenerator::WriteMidlOptions(
void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups(Elem& e0)
{
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
return;
}
for (const std::string& c : this->Configurations) {
@@ -4178,7 +4205,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups(Elem& e0)
// output midl flags <Midl></Midl>
this->WriteMidlOptions(e1, c);
// write events
- if (this->ProjectType != csproj) {
+ if (this->ProjectType != VsProjectType::csproj) {
this->WriteEvents(e1, c);
}
// output link flags <Link></Link>
@@ -4244,7 +4271,7 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
}
}
comment = cmVS10EscapeComment(comment);
- if (this->ProjectType != csproj) {
+ if (this->ProjectType != VsProjectType::csproj) {
Elem e2(e1, name);
if (stdPipesUTF8) {
this->WriteStdOutEncodingUtf8(e2);
@@ -5066,7 +5093,7 @@ bool cmVisualStudio10TargetGenerator::ForceOld(const std::string& source) const
void cmVisualStudio10TargetGenerator::GetCSharpSourceProperties(
cmSourceFile const* sf, std::map<std::string, std::string>& tags)
{
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
const cmPropertyMap& props = sf->GetProperties();
for (const std::string& p : props.GetKeys()) {
static const cm::string_view propNamePrefix = "VS_CSHARP_";
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index a5ce5e58fa..ec6362f148 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -4,12 +4,13 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include <iosfwd>
+#include <cstddef>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
+#include <utility>
#include <vector>
#include "cmGeneratorTarget.h"
@@ -17,7 +18,6 @@
class cmComputeLinkInformation;
class cmCustomCommand;
class cmCustomCommandGenerator;
-class cmGeneratedFileStream;
class cmGlobalVisualStudio10Generator;
class cmLocalVisualStudio10Generator;
class cmMakefile;
@@ -209,7 +209,8 @@ private:
OptionsMap NasmOptions;
OptionsMap LinkOptions;
std::string LangForClCompile;
- enum VsProjectType
+
+ enum class VsProjectType
{
vcxproj,
csproj
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 058ffb4958..e495db04dc 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -1,12 +1,18 @@
#include "cmVisualStudioGeneratorOptions.h"
+#include <algorithm>
+#include <map>
+#include <sstream>
+#include <utility>
+#include <vector>
+
#include <cm/iterator>
#include "cmAlgorithms.h"
-#include "cmGeneratorExpression.h"
-#include "cmGeneratorTarget.h"
#include "cmLocalVisualStudioGenerator.h"
#include "cmOutputConverter.h"
+#include "cmRange.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
static void cmVS10EscapeForMSBuild(std::string& ret)
diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h
index b123019cb3..ed4ee1d5f6 100644
--- a/Source/cmVisualStudioGeneratorOptions.h
+++ b/Source/cmVisualStudioGeneratorOptions.h
@@ -12,7 +12,6 @@
#include "cmIDEOptions.h"
class cmLocalVisualStudioGenerator;
-class cmGeneratorTarget;
using cmVS7FlagTable = cmIDEFlagTable;
diff --git a/Source/cmVisualStudioSlnData.cxx b/Source/cmVisualStudioSlnData.cxx
index 48112ddeaa..8d4b658aec 100644
--- a/Source/cmVisualStudioSlnData.cxx
+++ b/Source/cmVisualStudioSlnData.cxx
@@ -2,6 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmVisualStudioSlnData.h"
+#include <cstddef>
+#include <utility>
+
const cmSlnProjectEntry* cmSlnData::GetProjectByGUID(
const std::string& projectGUID) const
{
diff --git a/Source/cmVisualStudioSlnParser.cxx b/Source/cmVisualStudioSlnParser.cxx
index d7822b14d7..d900a95814 100644
--- a/Source/cmVisualStudioSlnParser.cxx
+++ b/Source/cmVisualStudioSlnParser.cxx
@@ -3,12 +3,14 @@
#include "cmVisualStudioSlnParser.h"
#include <cassert>
+#include <memory>
#include <stack>
+#include <utility>
+#include <vector>
#include "cmsys/FStream.hxx"
#include "cmStringAlgorithms.h"
-#include "cmSystemTools.h"
#include "cmVisualStudioSlnData.h"
namespace {
diff --git a/Source/cmVisualStudioSlnParser.h b/Source/cmVisualStudioSlnParser.h
index 1c3375951a..60be598429 100644
--- a/Source/cmVisualStudioSlnParser.h
+++ b/Source/cmVisualStudioSlnParser.h
@@ -5,13 +5,12 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <bitset>
+#include <cstddef>
#include <iosfwd>
#include <string>
#include <cm/string_view>
-#include <stddef.h>
-
class cmSlnData;
class cmVisualStudioSlnParser
diff --git a/Source/cmVisualStudioWCEPlatformParser.cxx b/Source/cmVisualStudioWCEPlatformParser.cxx
index 3b113aadb3..2f71cf583c 100644
--- a/Source/cmVisualStudioWCEPlatformParser.cxx
+++ b/Source/cmVisualStudioWCEPlatformParser.cxx
@@ -2,8 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmVisualStudioWCEPlatformParser.h"
+#include <algorithm>
+#include <cstring>
+#include <utility>
+
#include "cmGlobalVisualStudioGenerator.h"
-#include "cmXMLParser.h"
+#include "cmSystemTools.h"
int cmVisualStudioWCEPlatformParser::ParseVersion(const char* version)
{
diff --git a/Source/cmVisualStudioWCEPlatformParser.h b/Source/cmVisualStudioWCEPlatformParser.h
index eb4e978a2c..2fff91c2e7 100644
--- a/Source/cmVisualStudioWCEPlatformParser.h
+++ b/Source/cmVisualStudioWCEPlatformParser.h
@@ -4,12 +4,11 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <cstddef>
#include <map>
#include <string>
#include <vector>
-#include <stddef.h>
-
#include "cmXMLParser.h"
// This class is used to parse XML with configuration
diff --git a/Source/cmXCOFF.cxx b/Source/cmXCOFF.cxx
index 890636e06f..a6d278dd0f 100644
--- a/Source/cmXCOFF.cxx
+++ b/Source/cmXCOFF.cxx
@@ -61,20 +61,20 @@ namespace {
struct XCOFF32
{
- typedef struct filehdr filehdr;
- typedef struct aouthdr aouthdr;
- typedef struct scnhdr scnhdr;
- typedef struct ldhdr ldhdr;
+ using filehdr = struct filehdr;
+ using aouthdr = struct aouthdr;
+ using scnhdr = struct scnhdr;
+ using ldhdr = struct ldhdr;
static const std::size_t aouthdr_size = _AOUTHSZ_EXEC;
};
const unsigned char xcoff32_magic[] = { 0x01, 0xDF };
struct XCOFF64
{
- typedef struct filehdr_64 filehdr;
- typedef struct aouthdr_64 aouthdr;
- typedef struct scnhdr_64 scnhdr;
- typedef struct ldhdr_64 ldhdr;
+ using filehdr = struct filehdr_64;
+ using aouthdr = struct aouthdr_64;
+ using scnhdr = struct scnhdr_64;
+ using ldhdr = struct ldhdr_64;
static const std::size_t aouthdr_size = _AOUTHSZ_EXEC_64;
};
const unsigned char xcoff64_magic[] = { 0x01, 0xF7 };
@@ -326,8 +326,8 @@ cmXCOFF::cmXCOFF(const char* fname, Mode mode)
cmXCOFF::~cmXCOFF() = default;
-cmXCOFF::cmXCOFF(cmXCOFF&&) = default;
-cmXCOFF& cmXCOFF::operator=(cmXCOFF&&) = default;
+cmXCOFF::cmXCOFF(cmXCOFF&&) noexcept = default;
+cmXCOFF& cmXCOFF::operator=(cmXCOFF&&) noexcept = default;
bool cmXCOFF::Valid() const
{
diff --git a/Source/cmXCOFF.h b/Source/cmXCOFF.h
index 16cda9daf0..f6d9d94ec8 100644
--- a/Source/cmXCOFF.h
+++ b/Source/cmXCOFF.h
@@ -35,9 +35,9 @@ public:
/** Destruct. */
~cmXCOFF();
- cmXCOFF(cmXCOFF&&);
+ cmXCOFF(cmXCOFF&&) noexcept;
cmXCOFF(cmXCOFF const&) = delete;
- cmXCOFF& operator=(cmXCOFF&&);
+ cmXCOFF& operator=(cmXCOFF&&) noexcept;
cmXCOFF& operator=(cmXCOFF const&) = delete;
/** Get the error message if any. */
diff --git a/Source/cmXCode21Object.h b/Source/cmXCode21Object.h
index f3fc43898d..0c7f22b26b 100644
--- a/Source/cmXCode21Object.h
+++ b/Source/cmXCode21Object.h
@@ -6,6 +6,7 @@
#include <iosfwd>
#include <memory>
+#include <string>
#include <vector>
#include "cmXCodeObject.h"
diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx
index d5c52756b1..c817980fbd 100644
--- a/Source/cmXCodeObject.cxx
+++ b/Source/cmXCodeObject.cxx
@@ -6,8 +6,6 @@
#include <CoreFoundation/CoreFoundation.h>
-#include "cmSystemTools.h"
-
const char* cmXCodeObject::PBXTypeNames[] = {
/* clang-format needs this comment to break after the opening brace */
"PBXGroup",
diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h
index dd5e86ea30..389fb62a7d 100644
--- a/Source/cmXCodeObject.h
+++ b/Source/cmXCodeObject.h
@@ -5,6 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <algorithm>
+#include <cstddef>
#include <iosfwd>
#include <map>
#include <string>
diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx
index e2c0f2daf6..adc500a076 100644
--- a/Source/cmXCodeScheme.cxx
+++ b/Source/cmXCodeScheme.cxx
@@ -3,16 +3,24 @@
#include "cmXCodeScheme.h"
#include <iomanip>
-#include <iostream>
#include <sstream>
#include <utility>
#include <cmext/algorithm>
+#include "cmsys/String.h"
+
#include "cmGeneratedFileStream.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
-#include "cmXMLSafe.h"
+#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
+#include "cmValue.h"
+#include "cmXCodeObject.h"
+#include "cmXMLWriter.h"
+
+class cmLocalGenerator;
cmXCodeScheme::cmXCodeScheme(cmLocalGenerator* lg, cmXCodeObject* xcObj,
TestObjects tests,
@@ -148,6 +156,16 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
true);
xout.Attribute("debugServiceExtension", "internal");
xout.Attribute("allowLocationSimulation", "YES");
+ if (cmValue gpuFrameCaptureMode = this->Target->GetTarget()->GetProperty(
+ "XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE")) {
+ std::string value = *gpuFrameCaptureMode;
+ if (cmsysString_strcasecmp(value.c_str(), "Metal") == 0) {
+ value = "1";
+ } else if (cmsysString_strcasecmp(value.c_str(), "Disabled") == 0) {
+ value = "3";
+ }
+ xout.Attribute("enableGPUFrameCaptureMode", value);
+ }
// Diagnostics tab begin
diff --git a/Source/cmXCodeScheme.h b/Source/cmXCodeScheme.h
index 11f043e93c..07fdedbb7b 100644
--- a/Source/cmXCodeScheme.h
+++ b/Source/cmXCodeScheme.h
@@ -4,12 +4,13 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <iosfwd>
+#include <string>
#include <vector>
-#include "cmGlobalXCodeGenerator.h"
-#include "cmSystemTools.h"
-#include "cmXCodeObject.h"
-#include "cmXMLWriter.h"
+class cmLocalGenerator;
+class cmXCodeObject;
+class cmXMLWriter;
/** \class cmXCodeScheme
* \brief Write shared schemes for native targets in Xcode project.
diff --git a/Source/cmXMLParser.h b/Source/cmXMLParser.h
index 7e805d7899..176252d461 100644
--- a/Source/cmXMLParser.h
+++ b/Source/cmXMLParser.h
@@ -21,6 +21,7 @@ class cmXMLParser
{
public:
cmXMLParser();
+ cmXMLParser(const cmXMLParser& /*other*/) = default;
virtual ~cmXMLParser();
//! Parse given XML string
diff --git a/Source/cmXMLSafe.cxx b/Source/cmXMLSafe.cxx
index d31a239c73..40146355df 100644
--- a/Source/cmXMLSafe.cxx
+++ b/Source/cmXMLSafe.cxx
@@ -73,7 +73,7 @@ std::ostream& operator<<(std::ostream& os, cmXMLSafe const& self)
} else {
// Use a human-readable hex value for this invalid character.
char buf[16];
- sprintf(buf, "%X", ch);
+ snprintf(buf, sizeof(buf), "%X", ch);
os << "[NON-XML-CHAR-0x" << buf << "]";
}
@@ -82,7 +82,7 @@ std::ostream& operator<<(std::ostream& os, cmXMLSafe const& self)
ch = static_cast<unsigned char>(*first++);
// Use a human-readable hex value for this invalid byte.
char buf[16];
- sprintf(buf, "%X", ch);
+ snprintf(buf, sizeof(buf), "%X", ch);
os << "[NON-UTF-8-BYTE-0x" << buf << "]";
}
}
diff --git a/Source/cm_codecvt.cxx b/Source/cm_codecvt.cxx
index 216d3f0175..8115306d78 100644
--- a/Source/cm_codecvt.cxx
+++ b/Source/cm_codecvt.cxx
@@ -3,17 +3,14 @@
#include "cm_codecvt.hxx"
#if defined(_WIN32)
-# include <windows.h>
+# include <cassert>
+# include <cstring>
-# include <assert.h>
-# include <string.h>
+# include <windows.h>
# undef max
# include "cmsys/Encoding.hxx"
-#endif
-#if defined(_WIN32)
-/* Number of leading ones before a zero in the byte (see cm_utf8.c). */
-extern "C" unsigned char const cm_utf8_ones[256];
+# include "cm_utf8.h"
#endif
codecvt::codecvt(Encoding e)
@@ -42,7 +39,7 @@ codecvt::codecvt(Encoding e)
codecvt::~codecvt() = default;
-bool codecvt::do_always_noconv() const throw()
+bool codecvt::do_always_noconv() const noexcept
{
return this->m_noconv;
}
@@ -234,12 +231,12 @@ void codecvt::BufferPartial(mbstate_t& state, int size,
}
#endif
-int codecvt::do_max_length() const throw()
+int codecvt::do_max_length() const noexcept
{
return 4;
}
-int codecvt::do_encoding() const throw()
+int codecvt::do_encoding() const noexcept
{
return 0;
}
diff --git a/Source/cm_codecvt.hxx b/Source/cm_codecvt.hxx
index b73204f2aa..9af083fee1 100644
--- a/Source/cm_codecvt.hxx
+++ b/Source/cm_codecvt.hxx
@@ -24,14 +24,14 @@ public:
protected:
~codecvt() override;
- bool do_always_noconv() const throw() override;
+ bool do_always_noconv() const noexcept override;
result do_out(mbstate_t& state, const char* from, const char* from_end,
const char*& from_next, char* to, char* to_end,
char*& to_next) const override;
result do_unshift(mbstate_t& state, char* to, char*,
char*& to_next) const override;
- int do_max_length() const throw() override;
- int do_encoding() const throw() override;
+ int do_max_length() const noexcept override;
+ int do_encoding() const noexcept override;
private:
// The mbstate_t argument to do_out and do_unshift is responsible
diff --git a/Source/cm_utf8.h b/Source/cm_utf8.h
index fa9ed3a043..67f3d3f327 100644
--- a/Source/cm_utf8.h
+++ b/Source/cm_utf8.h
@@ -6,6 +6,8 @@
extern "C" {
#endif
+extern unsigned char const cm_utf8_ones[256];
+
/** Decode one UTF-8 character from the input byte range. On success,
stores the unicode character number in *pc and returns the first
position not extracted. On failure, returns 0. */
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index fda7900917..8c6a2ec08f 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -205,7 +205,7 @@ cmake::cmake(Role role, cmState::Mode mode, cmState::ProjectKind projectKind)
exts.ordered.reserve(extList.size());
for (cm::string_view ext : extList) {
exts.ordered.emplace_back(ext);
- };
+ }
// Fill unordered set
exts.unordered.insert(exts.ordered.begin(), exts.ordered.end());
};
diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx
index 5c27ac1034..8921aa0ca1 100644
--- a/Source/cmcldeps.cxx
+++ b/Source/cmcldeps.cxx
@@ -294,7 +294,8 @@ int main()
return exit_code;
// compile rc file with rc.exe
- return process(srcfilename, "", objfile, prefix, binpath + " " + rest);
+ return process(srcfilename, "", objfile, prefix, binpath + " " + rest,
+ std::string(), true);
}
usage("Invalid language specified.");
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index bdddc4e780..32c01e5274 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -58,7 +58,6 @@
#ifdef _WIN32
# include <fcntl.h> // for _O_BINARY
# include <io.h> // for _setmode
-# include <stdio.h> // for std{out,err} and fileno
#endif
#include <cm/string_view>
@@ -1112,7 +1111,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args,
int count;
if (countFile) {
if (1 != fscanf(countFile, "%i", &count)) {
- cmSystemTools::Message("Could not read from count file.");
+ std::cerr << "Could not read from count file.\n";
}
fclose(countFile);
} else {
@@ -1426,8 +1425,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args,
action = cmSystemTools::TarActionExtract;
} break;
default: {
- cmSystemTools::Message(
- std::string("tar: Unknown argument: ") + flag, "Warning");
+ std::cerr << "tar: Unknown argument: " << flag << "\n";
}
}
}
@@ -1448,8 +1446,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args,
}
} else if (action == cmSystemTools::TarActionCreate) {
if (files.empty()) {
- cmSystemTools::Message("tar: No files or directories specified",
- "Warning");
+ std::cerr << "tar: No files or directories specified\n";
}
if (!cmSystemTools::CreateTar(outFile, files, compress, verbose, mtime,
format)) {
@@ -1588,7 +1585,11 @@ int cmcmd::HashSumFile(std::vector<std::string> const& args,
std::cerr << "Error: " << filename << " is a directory" << std::endl;
retval++;
} else {
- std::string value = cmSystemTools::ComputeFileHash(filename, algo);
+ std::string value
+#ifndef CMAKE_BOOTSTRAP
+ = cmSystemTools::ComputeFileHash(filename, algo)
+#endif
+ ;
if (value.empty()) {
// To mimic "md5sum/shasum" behavior in a shell:
std::cerr << filename << ": No such file or directory" << std::endl;
@@ -1684,7 +1685,7 @@ static void cmcmdProgressReport(std::string const& dir, std::string const& num)
return;
}
if (1 != fscanf(progFile, "%i", &count)) {
- cmSystemTools::Message("Could not read from progress file.");
+ std::cerr << "Could not read from progress file.\n";
}
fclose(progFile);
@@ -2135,8 +2136,8 @@ struct NumberFormatter
{
}
};
-std::ostream& operator<<(std::ostream& stream,
- NumberFormatter const& formatter)
+static std::ostream& operator<<(std::ostream& stream,
+ NumberFormatter const& formatter)
{
auto const& flags = stream.flags();
if (formatter.Format == FORMAT_DECIMAL) {
diff --git a/Source/kwsys/CTestConfig.cmake b/Source/kwsys/CTestConfig.cmake
index 12347b6ef4..6484cc27cc 100644
--- a/Source/kwsys/CTestConfig.cmake
+++ b/Source/kwsys/CTestConfig.cmake
@@ -3,9 +3,7 @@
set(CTEST_PROJECT_NAME "KWSys")
set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT")
-if (NOT CTEST_DROP_METHOD STREQUAL "https")
- set(CTEST_DROP_METHOD "http")
-endif ()
+set(CTEST_DROP_METHOD "https")
set(CTEST_DROP_SITE "open.cdash.org")
set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard")
set(CTEST_DROP_SITE_CDASH TRUE)
diff --git a/Source/kwsys/Configure.hxx.in b/Source/kwsys/Configure.hxx.in
index 29a2dd11e3..8d47340594 100644
--- a/Source/kwsys/Configure.hxx.in
+++ b/Source/kwsys/Configure.hxx.in
@@ -16,11 +16,11 @@
@KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP@
#if defined(__SUNPRO_CC) && __SUNPRO_CC > 0x5130 && defined(__has_attribute)
-# define @KWSYS_NAMESPACE@__has_cpp_attribute(x) __has_attribute(x)
+# define @KWSYS_NAMESPACE@_has_cpp_attribute(x) __has_attribute(x)
#elif defined(__has_cpp_attribute)
-# define @KWSYS_NAMESPACE@__has_cpp_attribute(x) __has_cpp_attribute(x)
+# define @KWSYS_NAMESPACE@_has_cpp_attribute(x) __has_cpp_attribute(x)
#else
-# define @KWSYS_NAMESPACE@__has_cpp_attribute(x) 0
+# define @KWSYS_NAMESPACE@_has_cpp_attribute(x) 0
#endif
#if __cplusplus >= 201103L
@@ -31,13 +31,13 @@
#ifndef @KWSYS_NAMESPACE@_FALLTHROUGH
# if __cplusplus >= 201703L && \
- @KWSYS_NAMESPACE@__has_cpp_attribute(fallthrough)
+ @KWSYS_NAMESPACE@_has_cpp_attribute(fallthrough)
# define @KWSYS_NAMESPACE@_FALLTHROUGH [[fallthrough]]
# elif __cplusplus >= 201103L && \
- @KWSYS_NAMESPACE@__has_cpp_attribute(gnu::fallthrough)
+ @KWSYS_NAMESPACE@_has_cpp_attribute(gnu::fallthrough)
# define @KWSYS_NAMESPACE@_FALLTHROUGH [[gnu::fallthrough]]
# elif __cplusplus >= 201103L && \
- @KWSYS_NAMESPACE@__has_cpp_attribute(clang::fallthrough)
+ @KWSYS_NAMESPACE@_has_cpp_attribute(clang::fallthrough)
# define @KWSYS_NAMESPACE@_FALLTHROUGH [[clang::fallthrough]]
# endif
#endif
@@ -45,7 +45,7 @@
# define @KWSYS_NAMESPACE@_FALLTHROUGH static_cast<void>(0)
#endif
-#undef @KWSYS_NAMESPACE@__has_cpp_attribute
+#undef @KWSYS_NAMESPACE@_has_cpp_attribute
/* If building a C++ file in kwsys itself, give the source file
access to the macros without a configured namespace. */
diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx
index 2e8aa83f4c..6e31cbfc73 100644
--- a/Source/kwsys/Directory.cxx
+++ b/Source/kwsys/Directory.cxx
@@ -99,18 +99,21 @@ Status Directory::Load(std::string const& name, std::string* errorMessage)
this->Clear();
intptr_t srchHandle;
char* buf;
+ size_t bufLength;
size_t n = name.size();
if (name.back() == '/' || name.back() == '\\') {
- buf = new char[n + 1 + 1];
- sprintf(buf, "%s*", name.c_str());
+ bufLength = n + 1 + 1;
+ buf = new char[bufLength];
+ snprintf(buf, bufLength, "%s*", name.c_str());
} else {
// Make sure the slashes in the wildcard suffix are consistent with the
// rest of the path
- buf = new char[n + 2 + 1];
+ bufLength = n + 2 + 1;
+ buf = new char[bufLength];
if (name.find('\\') != std::string::npos) {
- sprintf(buf, "%s\\*", name.c_str());
+ snprintf(buf, bufLength, "%s\\*", name.c_str());
} else {
- sprintf(buf, "%s/*", name.c_str());
+ snprintf(buf, bufLength, "%s/*", name.c_str());
}
}
struct _wfinddata_t data; // data of current file
@@ -148,13 +151,16 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
{
intptr_t srchHandle;
char* buf;
+ size_t bufLength;
size_t n = name.size();
if (name.back() == '/') {
+ bufLength = n + 1 + 1;
buf = new char[n + 1 + 1];
- sprintf(buf, "%s*", name.c_str());
+ snprintf(buf, bufLength, "%s*", name.c_str());
} else {
+ bufLength = n + 2 + 1;
buf = new char[n + 2 + 1];
- sprintf(buf, "%s/*", name.c_str());
+ snprintf(buf, bufLength, "%s/*", name.c_str());
}
struct _wfinddata_t data; // data of current file
diff --git a/Source/kwsys/DynamicLoader.cxx b/Source/kwsys/DynamicLoader.cxx
index 66ee9eafa7..8afc2e8e0b 100644
--- a/Source/kwsys/DynamicLoader.cxx
+++ b/Source/kwsys/DynamicLoader.cxx
@@ -275,20 +275,20 @@ const char* DynamicLoader::LastError()
if (length < 1) {
/* FormatMessage failed. Use a default message. */
- _snprintf(str, DYNLOAD_ERROR_BUFFER_SIZE,
- "DynamicLoader encountered error 0x%X. "
- "FormatMessage failed with error 0x%X",
- error, GetLastError());
+ snprintf(str, DYNLOAD_ERROR_BUFFER_SIZE,
+ "DynamicLoader encountered error 0x%lX. "
+ "FormatMessage failed with error 0x%lX",
+ error, GetLastError());
return str;
}
if (!WideCharToMultiByte(CP_UTF8, 0, lpMsgBuf, -1, str,
DYNLOAD_ERROR_BUFFER_SIZE, nullptr, nullptr)) {
/* WideCharToMultiByte failed. Use a default message. */
- _snprintf(str, DYNLOAD_ERROR_BUFFER_SIZE,
- "DynamicLoader encountered error 0x%X. "
- "WideCharToMultiByte failed with error 0x%X",
- error, GetLastError());
+ snprintf(str, DYNLOAD_ERROR_BUFFER_SIZE,
+ "DynamicLoader encountered error 0x%lX. "
+ "WideCharToMultiByte failed with error 0x%lX",
+ error, GetLastError());
}
return str;
@@ -436,9 +436,14 @@ namespace KWSYS_NAMESPACE {
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
const std::string& libname, int flags)
{
- CHECK_OPEN_FLAGS(flags, 0, nullptr);
+ CHECK_OPEN_FLAGS(flags, RTLDGlobal, nullptr);
+
+ int llFlags = RTLD_LAZY;
+ if (flags & RTLDGlobal) {
+ llFlags |= RTLD_GLOBAL;
+ }
- return dlopen(libname.c_str(), RTLD_LAZY);
+ return dlopen(libname.c_str(), llFlags);
}
int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
diff --git a/Source/kwsys/DynamicLoader.hxx.in b/Source/kwsys/DynamicLoader.hxx.in
index 539c742598..4edd31c6ca 100644
--- a/Source/kwsys/DynamicLoader.hxx.in
+++ b/Source/kwsys/DynamicLoader.hxx.in
@@ -73,7 +73,12 @@ public:
// This is currently only supported on Windows.
SearchBesideLibrary = 0x00000001,
- AllOpenFlags = SearchBesideLibrary
+ // Make loaded symbols visible globally
+ //
+ // This is currently only supported on *nix systems.
+ RTLDGlobal = 0x00000002,
+
+ AllOpenFlags = SearchBesideLibrary | RTLDGlobal
};
/** Load a dynamic library into the current process.
diff --git a/Source/kwsys/MD5.c b/Source/kwsys/MD5.c
index fb18a5bba4..76995e22f0 100644
--- a/Source/kwsys/MD5.c
+++ b/Source/kwsys/MD5.c
@@ -10,6 +10,7 @@
#endif
#include <stddef.h> /* size_t */
+#include <stdint.h> /* uintptr_t */
#include <stdlib.h> /* malloc, free */
#include <string.h> /* memcpy, strlen */
@@ -202,7 +203,7 @@ static void md5_process(md5_state_t* pms, const md5_byte_t* data /*[64]*/)
* On little-endian machines, we can process properly aligned
* data without copying it.
*/
- if (!((data - (const md5_byte_t*)0) & 3)) {
+ if (!((uintptr_t)data & 3)) {
/* data are properly aligned */
X = (const md5_word_t*)data;
} else {
diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c
index a8a15ddb0a..1963b275d2 100644
--- a/Source/kwsys/ProcessUNIX.c
+++ b/Source/kwsys/ProcessUNIX.c
@@ -2287,7 +2287,8 @@ static void kwsysProcessSetExitExceptionByIndex(kwsysProcess* cp, int sig,
#endif
default:
cp->ProcessResults[idx].ExitException = kwsysProcess_Exception_Other;
- sprintf(cp->ProcessResults[idx].ExitExceptionString, "Signal %d", sig);
+ snprintf(cp->ProcessResults[idx].ExitExceptionString,
+ KWSYSPE_PIPE_BUFFER_SIZE + 1, "Signal %d", sig);
break;
}
}
@@ -2540,7 +2541,7 @@ static void kwsysProcessKill(pid_t process_id)
int pid;
if (sscanf(d->d_name, "%d", &pid) == 1 && pid != 0) {
struct stat finfo;
- sprintf(fname, "/proc/%d/stat", pid);
+ snprintf(fname, sizeof(fname), "/proc/%d/stat", pid);
if (stat(fname, &finfo) == 0) {
FILE* f = fopen(fname, "r");
if (f) {
diff --git a/Source/kwsys/ProcessWin32.c b/Source/kwsys/ProcessWin32.c
index 8f01684a1a..e97973ecc4 100644
--- a/Source/kwsys/ProcessWin32.c
+++ b/Source/kwsys/ProcessWin32.c
@@ -29,7 +29,7 @@ a UNIX-style select system call.
# define KWSYS_WINDOWS_DEPRECATED_GetVersionEx
#endif
#include <io.h> /* _unlink */
-#include <stdio.h> /* sprintf */
+#include <stdio.h> /* snprintf */
#include <string.h> /* strlen, strdup */
#ifndef _MAX_FNAME
@@ -1867,18 +1867,18 @@ void kwsysProcessCleanup(kwsysProcess* cp, DWORD error)
KWSYSPE_PIPE_BUFFER_SIZE, 0);
if (length < 1) {
/* FormatMessage failed. Use a default message. */
- _snprintf(cp->ErrorMessage, KWSYSPE_PIPE_BUFFER_SIZE,
- "Process execution failed with error 0x%X. "
- "FormatMessage failed with error 0x%X",
- error, GetLastError());
+ snprintf(cp->ErrorMessage, KWSYSPE_PIPE_BUFFER_SIZE,
+ "Process execution failed with error 0x%lX. "
+ "FormatMessage failed with error 0x%lX",
+ error, GetLastError());
}
if (!WideCharToMultiByte(CP_UTF8, 0, err_msg, -1, cp->ErrorMessage,
KWSYSPE_PIPE_BUFFER_SIZE, NULL, NULL)) {
/* WideCharToMultiByte failed. Use a default message. */
- _snprintf(cp->ErrorMessage, KWSYSPE_PIPE_BUFFER_SIZE,
- "Process execution failed with error 0x%X. "
- "WideCharToMultiByte failed with error 0x%X",
- error, GetLastError());
+ snprintf(cp->ErrorMessage, KWSYSPE_PIPE_BUFFER_SIZE,
+ "Process execution failed with error 0x%lX. "
+ "WideCharToMultiByte failed with error 0x%lX",
+ error, GetLastError());
}
}
@@ -2144,8 +2144,8 @@ static void kwsysProcessSetExitExceptionByIndex(kwsysProcess* cp, int code,
case STATUS_NO_MEMORY:
default:
cp->ProcessResults[idx].ExitException = kwsysProcess_Exception_Other;
- _snprintf(cp->ProcessResults[idx].ExitExceptionString,
- KWSYSPE_PIPE_BUFFER_SIZE, "Exit code 0x%x\n", code);
+ snprintf(cp->ProcessResults[idx].ExitExceptionString,
+ KWSYSPE_PIPE_BUFFER_SIZE, "Exit code 0x%x\n", code);
break;
}
}
diff --git a/Source/kwsys/SharedForward.h.in b/Source/kwsys/SharedForward.h.in
index 091334b75d..d6ae75c47b 100644
--- a/Source/kwsys/SharedForward.h.in
+++ b/Source/kwsys/SharedForward.h.in
@@ -457,9 +457,9 @@ static void kwsys_shared_forward_strerror(char* message)
message, KWSYS_SHARED_FORWARD_MAXPATH, 0);
if (length < 1 || length > KWSYS_SHARED_FORWARD_MAXPATH) {
/* FormatMessage failed. Use a default message. */
- _snprintf(message, KWSYS_SHARED_FORWARD_MAXPATH,
- "Error 0x%X (FormatMessage failed with error 0x%X)", original,
- GetLastError());
+ snprintf(message, KWSYS_SHARED_FORWARD_MAXPATH,
+ "Error 0x%lX (FormatMessage failed with error 0x%lX)", original,
+ GetLastError());
}
# else
/* Implementation for UNIX. */
diff --git a/Source/kwsys/Status.cxx b/Source/kwsys/Status.cxx
index 503d1e1d51..edda7a0790 100644
--- a/Source/kwsys/Status.cxx
+++ b/Source/kwsys/Status.cxx
@@ -53,7 +53,7 @@ std::string Status::GetString() const
LocalFree(message);
} break;
#endif
- };
+ }
return err;
}
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index f2bf85f6a1..ecb9bf3776 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -1267,7 +1267,9 @@ public:
private:
void* GetRealAddress() const
{
- return (void*)((char*)this->Address - (char*)this->BinaryBaseAddress);
+ return reinterpret_cast<void*>(
+ static_cast<char*>(this->Address) -
+ static_cast<char*>(this->BinaryBaseAddress));
}
std::string GetFileName(const std::string& path) const;
@@ -2789,19 +2791,20 @@ bool SystemInformationImplementation::RetrieveProcessorSerialNumber()
// ; ecx: middle 32 bits are the processor signature bits
// ; edx: bottom 32 bits are the processor signature bits
char sn[128];
- sprintf(sn, "%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x",
- ((SerialNumber[1] & 0xff000000) >> 24),
- ((SerialNumber[1] & 0x00ff0000) >> 16),
- ((SerialNumber[1] & 0x0000ff00) >> 8),
- ((SerialNumber[1] & 0x000000ff) >> 0),
- ((SerialNumber[2] & 0xff000000) >> 24),
- ((SerialNumber[2] & 0x00ff0000) >> 16),
- ((SerialNumber[2] & 0x0000ff00) >> 8),
- ((SerialNumber[2] & 0x000000ff) >> 0),
- ((SerialNumber[3] & 0xff000000) >> 24),
- ((SerialNumber[3] & 0x00ff0000) >> 16),
- ((SerialNumber[3] & 0x0000ff00) >> 8),
- ((SerialNumber[3] & 0x000000ff) >> 0));
+ snprintf(sn, sizeof(sn),
+ "%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x",
+ ((SerialNumber[1] & 0xff000000) >> 24),
+ ((SerialNumber[1] & 0x00ff0000) >> 16),
+ ((SerialNumber[1] & 0x0000ff00) >> 8),
+ ((SerialNumber[1] & 0x000000ff) >> 0),
+ ((SerialNumber[2] & 0xff000000) >> 24),
+ ((SerialNumber[2] & 0x00ff0000) >> 16),
+ ((SerialNumber[2] & 0x0000ff00) >> 8),
+ ((SerialNumber[2] & 0x000000ff) >> 0),
+ ((SerialNumber[3] & 0xff000000) >> 24),
+ ((SerialNumber[3] & 0x00ff0000) >> 16),
+ ((SerialNumber[3] & 0x0000ff00) >> 8),
+ ((SerialNumber[3] & 0x000000ff) >> 0));
this->ChipID.SerialNumber = sn;
return true;
@@ -3749,24 +3752,24 @@ long long SystemInformationImplementation::GetProcMemoryAvailable(
ResourceLimitType rlim;
ierr = GetResourceLimit(RLIMIT_DATA, &rlim);
if ((ierr == 0) && (rlim.rlim_cur != RLIM_INFINITY)) {
- memAvail = min((long long)rlim.rlim_cur / 1024, memAvail);
+ memAvail = min(static_cast<long long>(rlim.rlim_cur) / 1024, memAvail);
}
ierr = GetResourceLimit(RLIMIT_AS, &rlim);
if ((ierr == 0) && (rlim.rlim_cur != RLIM_INFINITY)) {
- memAvail = min((long long)rlim.rlim_cur / 1024, memAvail);
+ memAvail = min(static_cast<long long>(rlim.rlim_cur) / 1024, memAvail);
}
#elif defined(__APPLE__)
struct rlimit rlim;
int ierr;
ierr = getrlimit(RLIMIT_DATA, &rlim);
if ((ierr == 0) && (rlim.rlim_cur != RLIM_INFINITY)) {
- memAvail = min((long long)rlim.rlim_cur / 1024, memAvail);
+ memAvail = min(static_cast<long long>(rlim.rlim_cur) / 1024, memAvail);
}
ierr = getrlimit(RLIMIT_RSS, &rlim);
if ((ierr == 0) && (rlim.rlim_cur != RLIM_INFINITY)) {
- memAvail = min((long long)rlim.rlim_cur / 1024, memAvail);
+ memAvail = min(static_cast<long long>(rlim.rlim_cur) / 1024, memAvail);
}
#endif
@@ -4068,7 +4071,7 @@ void SystemInformationImplementation::SetStackTraceOnError(int enable)
// install ours
struct sigaction sa;
- sa.sa_sigaction = (SigAction)StacktraceSignalHandler;
+ sa.sa_sigaction = static_cast<SigAction>(StacktraceSignalHandler);
sa.sa_flags = SA_SIGINFO | SA_RESETHAND;
# ifdef SA_RESTART
sa.sa_flags |= SA_RESTART;
@@ -4564,7 +4567,8 @@ bool SystemInformationImplementation::ParseSysCtl()
this->AvailablePhysicalMemory = 0;
vm_statistics_data_t vmstat;
mach_msg_type_number_t count = HOST_VM_INFO_COUNT;
- if (host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)&vmstat,
+ if (host_statistics(mach_host_self(), HOST_VM_INFO,
+ reinterpret_cast<host_info_t>(&vmstat),
&count) == KERN_SUCCESS) {
err = kw_sysctlbyname_int64("hw.pagesize", &tempInt64);
if (err == 0) {
@@ -5395,8 +5399,8 @@ bool SystemInformationImplementation::QueryOSInformation()
}
}
- sprintf(operatingSystem, "%ls (Build %ld)", osvi.szCSDVersion,
- osvi.dwBuildNumber & 0xFFFF);
+ snprintf(operatingSystem, sizeof(operatingSystem), "%ls (Build %ld)",
+ osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF);
this->OSVersion = operatingSystem;
} else
# endif // VER_NT_WORKSTATION
@@ -5439,9 +5443,10 @@ bool SystemInformationImplementation::QueryOSInformation()
// Display version, service pack (if any), and build number.
if (osvi.dwMajorVersion <= 4) {
// NB: NT 4.0 and earlier.
- sprintf(operatingSystem, "version %ld.%ld %ls (Build %ld)",
- osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.szCSDVersion,
- osvi.dwBuildNumber & 0xFFFF);
+ snprintf(operatingSystem, sizeof(operatingSystem),
+ "version %ld.%ld %ls (Build %ld)", osvi.dwMajorVersion,
+ osvi.dwMinorVersion, osvi.szCSDVersion,
+ osvi.dwBuildNumber & 0xFFFF);
this->OSVersion = operatingSystem;
} else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1) {
// Windows XP and .NET server.
@@ -5467,8 +5472,8 @@ bool SystemInformationImplementation::QueryOSInformation()
}
} else {
// Windows 2000 and everything else.
- sprintf(operatingSystem, "%ls (Build %ld)", osvi.szCSDVersion,
- osvi.dwBuildNumber & 0xFFFF);
+ snprintf(operatingSystem, sizeof(operatingSystem), "%ls (Build %ld)",
+ osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF);
this->OSVersion = operatingSystem;
}
break;
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 930d84c873..6a8520fe5f 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -34,6 +34,10 @@
#include <utility>
#include <vector>
+#ifdef _WIN32
+# include <cwchar>
+#endif
+
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
@@ -103,6 +107,9 @@
# if defined(_MSC_VER) && _MSC_VER >= 1800
# define KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# endif
+# ifndef IO_REPARSE_TAG_APPEXECLINK
+# define IO_REPARSE_TAG_APPEXECLINK (0x8000001BL)
+# endif
// from ntifs.h, which can only be used by drivers
typedef struct _REPARSE_DATA_BUFFER
{
@@ -132,8 +139,46 @@ typedef struct _REPARSE_DATA_BUFFER
{
UCHAR DataBuffer[1];
} GenericReparseBuffer;
+ struct
+ {
+ ULONG Version;
+ WCHAR StringList[1];
+ // In version 3, there are 4 NUL-terminated strings:
+ // * Package ID
+ // * Entry Point
+ // * Executable Path
+ // * Application Type
+ } AppExecLinkReparseBuffer;
} DUMMYUNIONNAME;
} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
+
+namespace {
+WCHAR* GetAppExecLink(PREPARSE_DATA_BUFFER data, size_t& len)
+{
+ // We only know the layout of version 3.
+ if (data->AppExecLinkReparseBuffer.Version != 3) {
+ return nullptr;
+ }
+
+ WCHAR* pstr = data->AppExecLinkReparseBuffer.StringList;
+
+ // Skip the package id and entry point strings.
+ for (int i = 0; i < 2; ++i) {
+ len = std::wcslen(pstr);
+ if (len == 0) {
+ return nullptr;
+ }
+ pstr += len + 1;
+ }
+
+ // The third string is the executable path.
+ len = std::wcslen(pstr);
+ if (len == 0) {
+ return nullptr;
+ }
+ return pstr;
+}
+}
#endif
#if !KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
@@ -1343,8 +1388,8 @@ bool SystemTools::FileExists(const std::string& filename)
return false;
}
#if defined(_WIN32)
- DWORD attr =
- GetFileAttributesW(Encoding::ToWindowsExtendedPath(filename).c_str());
+ const std::wstring path = Encoding::ToWindowsExtendedPath(filename);
+ DWORD attr = GetFileAttributesW(path.c_str());
if (attr == INVALID_FILE_ATTRIBUTES) {
return false;
}
@@ -1352,12 +1397,38 @@ bool SystemTools::FileExists(const std::string& filename)
if (attr & FILE_ATTRIBUTE_REPARSE_POINT) {
// Using 0 instead of GENERIC_READ as it allows reading of file attributes
// even if we do not have permission to read the file itself
- HANDLE handle =
- CreateFileW(Encoding::ToWindowsExtendedPath(filename).c_str(), 0, 0,
- nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr);
+ HANDLE handle = CreateFileW(path.c_str(), 0, 0, nullptr, OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS, nullptr);
if (handle == INVALID_HANDLE_VALUE) {
- return false;
+ // A reparse point may be an execution alias (Windows Store app), which
+ // is similar to a symlink but it cannot be opened as a regular file.
+ // We must look at the reparse point data explicitly.
+ handle = CreateFileW(
+ path.c_str(), 0, 0, nullptr, OPEN_EXISTING,
+ FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, nullptr);
+
+ if (handle == INVALID_HANDLE_VALUE) {
+ return false;
+ }
+
+ byte buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
+ DWORD bytesReturned = 0;
+
+ if (!DeviceIoControl(handle, FSCTL_GET_REPARSE_POINT, nullptr, 0, buffer,
+ MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &bytesReturned,
+ nullptr)) {
+ CloseHandle(handle);
+ return false;
+ }
+
+ CloseHandle(handle);
+
+ PREPARSE_DATA_BUFFER data =
+ reinterpret_cast<PREPARSE_DATA_BUFFER>(&buffer[0]);
+
+ // Assume that file exists if it is an execution alias.
+ return data->ReparseTag == IO_REPARSE_TAG_APPEXECLINK;
}
CloseHandle(handle);
@@ -3011,11 +3082,7 @@ bool SystemTools::FileIsDirectory(const std::string& inName)
bool SystemTools::FileIsExecutable(const std::string& name)
{
-#if defined(_WIN32)
- return SystemTools::FileExists(name, true);
-#else
return !FileIsDirectory(name) && TestFileAccess(name, TEST_FILE_EXECUTE);
-#endif
}
bool SystemTools::FileIsSymlink(const std::string& name)
@@ -3164,6 +3231,15 @@ Status SystemTools::ReadSymlink(std::string const& newName,
data->MountPointReparseBuffer.SubstituteNameLength / sizeof(WCHAR);
substituteNameData = data->MountPointReparseBuffer.PathBuffer +
data->MountPointReparseBuffer.SubstituteNameOffset / sizeof(WCHAR);
+ } else if (data->ReparseTag == IO_REPARSE_TAG_APPEXECLINK) {
+ // The reparse buffer is a list of 0-terminated non-empty strings,
+ // terminated by an empty string (0-0). We need the third string.
+ size_t destLen;
+ substituteNameData = GetAppExecLink(data, destLen);
+ if (substituteNameData == nullptr || destLen == 0) {
+ return Status::Windows(ERROR_SYMLINK_NOT_SUPPORTED);
+ }
+ substituteNameLength = static_cast<USHORT>(destLen);
} else {
return Status::Windows(ERROR_REPARSE_TAG_MISMATCH);
}
@@ -3767,6 +3843,32 @@ bool SystemTools::Split(const std::string& str,
return true;
}
+std::string SystemTools::Join(const std::vector<std::string>& list,
+ const std::string& separator)
+{
+ std::string result;
+ if (list.empty()) {
+ return result;
+ }
+
+ size_t total_size = separator.size() * (list.size() - 1);
+ for (const std::string& string : list) {
+ total_size += string.size();
+ }
+
+ result.reserve(total_size);
+ bool needs_separator = false;
+ for (const std::string& string : list) {
+ if (needs_separator) {
+ result += separator;
+ }
+ result += string;
+ needs_separator = true;
+ }
+
+ return result;
+}
+
/**
* Return path of a full filename (no trailing slashes).
* Warning: returned path is converted to Unix slashes format.
@@ -4526,10 +4628,10 @@ std::string SystemTools::GetOperatingSystemNameAndVersion()
}
res += " ";
- sprintf(buffer, "%ld", osvi.dwMajorVersion);
+ snprintf(buffer, sizeof(buffer), "%ld", osvi.dwMajorVersion);
res += buffer;
res += ".";
- sprintf(buffer, "%ld", osvi.dwMinorVersion);
+ snprintf(buffer, sizeof(buffer), "%ld", osvi.dwMinorVersion);
res += buffer;
}
@@ -4549,7 +4651,7 @@ std::string SystemTools::GetOperatingSystemNameAndVersion()
if (lRet == ERROR_SUCCESS) {
res += " Service Pack 6a (Build ";
- sprintf(buffer, "%ld", osvi.dwBuildNumber & 0xFFFF);
+ snprintf(buffer, sizeof(buffer), "%ld", osvi.dwBuildNumber & 0xFFFF);
res += buffer;
res += ")";
} else // Windows NT 4.0 prior to SP6a
@@ -4557,7 +4659,7 @@ std::string SystemTools::GetOperatingSystemNameAndVersion()
res += " ";
res += osvi.szCSDVersion;
res += " (Build ";
- sprintf(buffer, "%ld", osvi.dwBuildNumber & 0xFFFF);
+ snprintf(buffer, sizeof(buffer), "%ld", osvi.dwBuildNumber & 0xFFFF);
res += buffer;
res += ")";
}
@@ -4568,7 +4670,7 @@ std::string SystemTools::GetOperatingSystemNameAndVersion()
res += " ";
res += osvi.szCSDVersion;
res += " (Build ";
- sprintf(buffer, "%ld", osvi.dwBuildNumber & 0xFFFF);
+ snprintf(buffer, sizeof(buffer), "%ld", osvi.dwBuildNumber & 0xFFFF);
res += buffer;
res += ")";
}
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index e5d115e089..dd0cb3ba5b 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -214,6 +214,13 @@ public:
char separator);
/**
+ * Joins a vector of strings into a single string, with separator in between
+ * each string.
+ */
+ static std::string Join(const std::vector<std::string>& list,
+ const std::string& separator);
+
+ /**
* Return string with space added between capitalized words
* (i.e. EatMyShorts becomes Eat My Shorts )
* (note that IEatShorts becomes IEat Shorts)
diff --git a/Source/kwsys/testDirectory.cxx b/Source/kwsys/testDirectory.cxx
index a847462a3b..79bdc986b0 100644
--- a/Source/kwsys/testDirectory.cxx
+++ b/Source/kwsys/testDirectory.cxx
@@ -19,7 +19,7 @@ file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
#include <testSystemTools.h>
-int _doLongPathTest()
+static int _doLongPathTest()
{
using namespace kwsys;
static const int LONG_PATH_THRESHOLD = 512;
@@ -77,7 +77,7 @@ int _doLongPathTest()
return res;
}
-int _nonExistentDirectoryTest()
+static int _nonExistentDirectoryTest()
{
using namespace kwsys;
int res = 0;
@@ -105,7 +105,7 @@ int _nonExistentDirectoryTest()
return res;
}
-int _copyDirectoryTest()
+static int _copyDirectoryTest()
{
using namespace kwsys;
const std::string source(TEST_SYSTEMTOOLS_BINARY_DIR
diff --git a/Source/kwsys/testDynamicLoader.cxx b/Source/kwsys/testDynamicLoader.cxx
index 9ba204e788..806c01a0cf 100644
--- a/Source/kwsys/testDynamicLoader.cxx
+++ b/Source/kwsys/testDynamicLoader.cxx
@@ -11,20 +11,20 @@
// Needed for __GLIBC__ test macro.
#ifdef __linux__
# include <features.h>
-#endif
// Will define LIBDL_SO macro on systems with glibc.
-#ifdef __GLIBC__
-# include <gnu/lib-names.h>
+# ifdef __GLIBC__
+# include <gnu/lib-names.h>
// Define to LIBC_SO, if not defined by above header.
-# ifndef LIBDL_SO
-# define LIBDL_SO LIBC_SO
+# ifndef LIBDL_SO
+# define LIBDL_SO LIBC_SO
+# endif
# endif
-#endif
// Define the LIBDL_SO macro, if not defined above.
-#ifndef LIBDL_SO
-# define LIBDL_SO "libdl.so"
+# ifndef LIBDL_SO
+# define LIBDL_SO "libdl.so"
+# endif
#endif
// Work-around CMake dependency scanning limitation. This must
@@ -40,6 +40,10 @@
// left on disk.
#include <testSystemTools.h>
+// For TestDynamicLoaderData, which, though not referenced literally,
+// is referenced semantically.
+#include "testDynload.h"
+
static std::string GetLibName(const char* lname, const char* subdir = nullptr)
{
// Construct proper name of lib
diff --git a/Source/kwsys/testDynload.c b/Source/kwsys/testDynload.c
index 33a431e9d0..83056c0ab1 100644
--- a/Source/kwsys/testDynload.c
+++ b/Source/kwsys/testDynload.c
@@ -6,6 +6,8 @@
# define DL_EXPORT
#endif
+#include "testDynload.h"
+
DL_EXPORT int TestDynamicLoaderData = 0;
DL_EXPORT void TestDynamicLoaderSymbolPointer(void)
diff --git a/Source/kwsys/testDynload.h b/Source/kwsys/testDynload.h
new file mode 100644
index 0000000000..dc0d7a182d
--- /dev/null
+++ b/Source/kwsys/testDynload.h
@@ -0,0 +1,9 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
+#ifdef _WIN32
+# define DL_EXPORT __declspec(dllexport)
+#else
+# define DL_EXPORT
+#endif
+
+extern DL_EXPORT int TestDynamicLoaderData;
diff --git a/Source/kwsys/testEncoding.cxx b/Source/kwsys/testEncoding.cxx
index ee93e8d8dc..1d605cb694 100644
--- a/Source/kwsys/testEncoding.cxx
+++ b/Source/kwsys/testEncoding.cxx
@@ -80,7 +80,7 @@ static int testRobustEncoding()
std::ios::fmtflags const& flags = std::cout.flags();
int ret = 0;
- char cstr[] = { (char)-1, 0 };
+ char cstr[] = { static_cast<char>(-1), 0 };
// this conversion could fail
std::wstring wstr = kwsys::Encoding::ToWide(cstr);
@@ -89,7 +89,7 @@ static int testRobustEncoding()
const wchar_t* wcstr = wstr.c_str();
std::cout << "ToWide(NULL) returned";
for (size_t i = 0; i < wstr.size(); i++) {
- std::cout << " " << std::hex << (int)wcstr[i];
+ std::cout << " " << std::hex << static_cast<int>(wcstr[i]);
}
std::cout << std::endl;
ret++;
@@ -99,7 +99,7 @@ static int testRobustEncoding()
const wchar_t* wcstr = wstr.c_str();
std::cout << "ToWide(\"\") returned";
for (size_t i = 0; i < wstr.size(); i++) {
- std::cout << " " << std::hex << (int)wcstr[i];
+ std::cout << " " << std::hex << static_cast<int>(wcstr[i]);
}
std::cout << std::endl;
ret++;
@@ -160,7 +160,9 @@ static int testCommandLineArguments()
{
int status = 0;
- char const* argv[2] = { "./app.exe", (char const*)helloWorldStrings[1] };
+ char const* argv[2] = {
+ "./app.exe", reinterpret_cast<char const*>(helloWorldStrings[1])
+ };
kwsys::Encoding::CommandLineArguments args(2, argv);
kwsys::Encoding::CommandLineArguments arg2 =
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index 6ccc7a7cb8..f96bd71994 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/testSystemTools.cxx
@@ -626,6 +626,16 @@ static bool CheckStringOperations()
res = false;
}
+ std::vector<std::string> linesToJoin = { "Mary", "Had", "A", "Little",
+ "Lamb." };
+ std::string joinResult = kwsys::SystemTools::Join(linesToJoin, " ");
+ if (joinResult != "Mary Had A Little Lamb.") {
+ std::cerr << "Problem with Join "
+ "\"Mary Had A Little Lamb.\""
+ << std::endl;
+ res = false;
+ }
+
if (kwsys::SystemTools::ConvertToWindowsOutputPath(
"L://Local Mojo/Hex Power Pack/Iffy Voodoo") !=
"\"L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"") {
diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in
index 632bb8065c..c47266a75e 100644
--- a/Templates/TestDriver.cxx.in
+++ b/Templates/TestDriver.cxx.in
@@ -63,7 +63,7 @@ static char* lowercase(const char* string)
return new_string;
}
-int isTestSkipped(const char *name, int n_skipped_tests, char *skipped_tests[]) {
+static int isTestSkipped(const char *name, int n_skipped_tests, char *skipped_tests[]) {
int i;
for (i = 0; i < n_skipped_tests; i++) {
if (strcmp(name, skipped_tests[i]) == 0) {
diff --git a/Tests/Assembler/CMakeLists.txt b/Tests/Assembler/CMakeLists.txt
index 0a2c819fd6..1b7e57d28c 100644
--- a/Tests/Assembler/CMakeLists.txt
+++ b/Tests/Assembler/CMakeLists.txt
@@ -1,4 +1,7 @@
cmake_minimum_required (VERSION 3.8)
+if(POLICY CMP0129)
+ cmake_policy(SET CMP0129 NEW)
+endif()
project(Assembler C)
message("CTEST_FULL_OUTPUT ")
set(CMAKE_VERBOSE_MAKEFILE 1)
@@ -9,7 +12,7 @@ set(SRCS)
# and also generate assembler files from C:
if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode|Ninja" AND
NOT CMAKE_OSX_ARCHITECTURES MATCHES ";")
- if((CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang|HP|SunPro|XL)$") OR (CMAKE_C_COMPILER_ID MATCHES "Intel" AND UNIX)
+ if((CMAKE_C_COMPILER_ID MATCHES "^(GNU|LCC|Clang|AppleClang|HP|SunPro|XL)$") OR (CMAKE_C_COMPILER_ID MATCHES "Intel" AND UNIX)
AND NOT (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC"))
set(C_FLAGS "${CMAKE_C_FLAGS}")
separate_arguments(C_FLAGS)
diff --git a/Tests/BundleTest/BundleLib.cxx b/Tests/BundleTest/BundleLib.cxx
index d25ad279ed..cfb5f7d8dd 100644
--- a/Tests/BundleTest/BundleLib.cxx
+++ b/Tests/BundleTest/BundleLib.cxx
@@ -20,7 +20,8 @@ int findBundleFile(char* exec, const char* file)
{
int res;
char* nexec = strdup(exec);
- char* fpath = (char*)malloc(strlen(exec) + 100);
+ size_t fpathlen = strlen(nexec) + 1 + strlen(file);
+ char* fpath = (char*)malloc(fpathlen);
int cc;
int cnt = 0;
printf("Process executable name: %s\n", exec);
@@ -36,7 +37,7 @@ int findBundleFile(char* exec, const char* file)
}
}
printf("Process executable path: %s\n", nexec);
- sprintf(fpath, "%s/%s", nexec, file);
+ snprintf(fpath, fpathlen, "%s/%s", nexec, file);
printf("Check for file: %s\n", fpath);
res = fileExists(fpath);
free(nexec);
diff --git a/Tests/CMakeCommands/add_compile_options/CMakeLists.txt b/Tests/CMakeCommands/add_compile_options/CMakeLists.txt
index b28d0bee99..a6b3ffe101 100644
--- a/Tests/CMakeCommands/add_compile_options/CMakeLists.txt
+++ b/Tests/CMakeCommands/add_compile_options/CMakeLists.txt
@@ -1,12 +1,16 @@
cmake_minimum_required(VERSION 2.8.12)
+if(POLICY CMP0129)
+ cmake_policy(SET CMP0129 NEW)
+endif()
+
project(add_compile_options)
add_compile_options(-DTEST_OPTION)
add_executable(add_compile_options main.cpp)
-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC")
target_compile_definitions(add_compile_options
PRIVATE
"DO_GNU_TESTS"
diff --git a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt
index 268c7eb928..869a941568 100644
--- a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt
@@ -1,20 +1,24 @@
cmake_minimum_required(VERSION 2.8.12)
+if(POLICY CMP0129)
+ cmake_policy(SET CMP0129 NEW)
+endif()
+
project(target_compile_options)
add_executable(target_compile_options
"${CMAKE_CURRENT_SOURCE_DIR}/main.cpp"
)
target_compile_options(target_compile_options
- PRIVATE $<$<CXX_COMPILER_ID:AppleClang,Clang,GNU>:-DMY_PRIVATE_DEFINE>
- PUBLIC $<$<COMPILE_LANG_AND_ID:CXX,GNU>:-DMY_PUBLIC_DEFINE>
- PUBLIC $<$<COMPILE_LANG_AND_ID:CXX,GNU,Clang,AppleClang>:-DMY_MUTLI_COMP_PUBLIC_DEFINE>
- INTERFACE $<$<CXX_COMPILER_ID:GNU>:-DMY_INTERFACE_DEFINE>
- INTERFACE $<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-DMY_MULTI_COMP_INTERFACE_DEFINE>
+ PRIVATE $<$<CXX_COMPILER_ID:AppleClang,Clang,GNU,LCC>:-DMY_PRIVATE_DEFINE>
+ PUBLIC $<$<COMPILE_LANG_AND_ID:CXX,GNU,LCC>:-DMY_PUBLIC_DEFINE>
+ PUBLIC $<$<COMPILE_LANG_AND_ID:CXX,GNU,LCC,Clang,AppleClang>:-DMY_MUTLI_COMP_PUBLIC_DEFINE>
+ INTERFACE $<$<CXX_COMPILER_ID:GNU,LCC>:-DMY_INTERFACE_DEFINE>
+ INTERFACE $<$<CXX_COMPILER_ID:GNU,LCC,Clang,AppleClang>:-DMY_MULTI_COMP_INTERFACE_DEFINE>
)
-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC")
target_compile_definitions(target_compile_options
PRIVATE
"DO_GNU_TESTS"
@@ -47,10 +51,10 @@ if(CMAKE_GENERATOR MATCHES "Visual Studio")
endif()
target_compile_options(consumer
- PRIVATE $<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:$<TARGET_PROPERTY:target_compile_options,INTERFACE_COMPILE_OPTIONS>>
+ PRIVATE $<$<CXX_COMPILER_ID:GNU,LCC,Clang,AppleClang>:$<TARGET_PROPERTY:target_compile_options,INTERFACE_COMPILE_OPTIONS>>
)
-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC")
target_compile_definitions(consumer
PRIVATE
"DO_GNU_TESTS"
diff --git a/Tests/CMakeCommands/target_link_directories/CMakeLists.txt b/Tests/CMakeCommands/target_link_directories/CMakeLists.txt
index bc7b9b2129..a5f69f30fc 100644
--- a/Tests/CMakeCommands/target_link_directories/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_link_directories/CMakeLists.txt
@@ -10,31 +10,31 @@ target_link_directories(target_link_directories PRIVATE)
add_library(target_link_directories_2 SHARED EXCLUDE_FROM_ALL LinkDirectoriesLib.c)
target_link_directories(target_link_directories_2 PRIVATE /private/dir INTERFACE /interface/dir)
get_target_property(result target_link_directories_2 LINK_DIRECTORIES)
-if (NOT result MATCHES "/private/dir")
+if (NOT result STREQUAL "/private/dir")
message(SEND_ERROR "${result} target_link_directories not populated the LINK_DIRECTORIES target property")
endif()
get_target_property(result target_link_directories_2 INTERFACE_LINK_DIRECTORIES)
-if (NOT result MATCHES "/interface/dir")
+if (NOT result STREQUAL "/interface/dir")
message(SEND_ERROR "target_link_directories not populated the INTERFACE_LINK_DIRECTORIES target property of shared library")
endif()
add_library(target_link_directories_3 STATIC EXCLUDE_FROM_ALL LinkDirectoriesLib.c)
target_link_directories(target_link_directories_3 INTERFACE /interface/dir)
get_target_property(result target_link_directories_3 INTERFACE_LINK_DIRECTORIES)
-if (NOT result MATCHES "/interface/dir")
+if (NOT result STREQUAL "/interface/dir")
message(SEND_ERROR "target_link_directories not populated the INTERFACE_LINK_DIRECTORIES target property of static library")
endif()
add_library(target_link_directories_4 SHARED EXCLUDE_FROM_ALL LinkDirectoriesLib.c)
target_link_directories(target_link_directories_4 PRIVATE relative/dir)
get_target_property(result target_link_directories_4 LINK_DIRECTORIES)
-if (NOT result MATCHES "${CMAKE_CURRENT_SOURCE_DIR}/relative/dir")
+if (NOT result STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/relative/dir")
message(SEND_ERROR "target_link_directories not populated the LINK_DIRECTORIES with relative path")
endif()
add_subdirectory(subdir)
target_link_directories(target_link_directories_5 PRIVATE relative/dir)
get_target_property(result target_link_directories_5 LINK_DIRECTORIES)
-if (NOT result MATCHES "${CMAKE_CURRENT_SOURCE_DIR}/relative/dir")
+if (NOT result STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/relative/dir")
message(SEND_ERROR "target_link_directories not populated the LINK_DIRECTORIES with relative path")
endif()
diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
index 07ec4e32db..52080bdc97 100644
--- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
@@ -3,6 +3,10 @@
# 2.8.12
cmake_minimum_required(VERSION 2.8)
+if(POLICY CMP0129)
+ cmake_policy(SET CMP0129 NEW)
+endif()
+
project(target_link_libraries)
file(WRITE
diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt
index 741c73e778..83103cf383 100644
--- a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt
@@ -25,7 +25,7 @@ target_link_libraries(staticlib1 LINK_PUBLIC staticlib2)
# Try adding a private link item to be propagated out of a static lib.
set(private_link "")
-if (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang)
+if (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang OR CMAKE_CXX_COMPILER_ID MATCHES LCC)
if (CMAKE_SYSTEM_NAME STREQUAL "SunOS")
set(private_link "-Wl,-V")
else()
diff --git a/Tests/CMakeLib/testCTestBinPacker.cxx b/Tests/CMakeLib/testCTestBinPacker.cxx
index abdbefb231..772f41715d 100644
--- a/Tests/CMakeLib/testCTestBinPacker.cxx
+++ b/Tests/CMakeLib/testCTestBinPacker.cxx
@@ -224,7 +224,7 @@ static const std::vector<AllocationComparison> comparisons{
/* clang-format on */
};
-bool TestExpectedPackResult(const ExpectedPackResult& expected)
+static bool TestExpectedPackResult(const ExpectedPackResult& expected)
{
std::vector<cmCTestBinPackerAllocation> roundRobinAllocations;
roundRobinAllocations.reserve(expected.SlotsNeeded.size());
diff --git a/Tests/CMakeLib/testCTestResourceAllocator.cxx b/Tests/CMakeLib/testCTestResourceAllocator.cxx
index 33d6b913df..72e06e5d40 100644
--- a/Tests/CMakeLib/testCTestResourceAllocator.cxx
+++ b/Tests/CMakeLib/testCTestResourceAllocator.cxx
@@ -12,7 +12,7 @@ static const cmCTestResourceSpec spec{ { {
/* clang-format on */
} } };
-bool testInitializeFromResourceSpec()
+static bool testInitializeFromResourceSpec()
{
bool retval = true;
@@ -39,7 +39,7 @@ bool testInitializeFromResourceSpec()
return retval;
}
-bool testAllocateResource()
+static bool testAllocateResource()
{
bool retval = true;
@@ -216,7 +216,7 @@ bool testAllocateResource()
return retval;
}
-bool testDeallocateResource()
+static bool testDeallocateResource()
{
bool retval = true;
@@ -370,7 +370,7 @@ bool testDeallocateResource()
return retval;
}
-bool testResourceFree()
+static bool testResourceFree()
{
bool retval = true;
diff --git a/Tests/CMakeLib/testCTestResourceGroups.cxx b/Tests/CMakeLib/testCTestResourceGroups.cxx
index c3532a68d7..776d65d956 100644
--- a/Tests/CMakeLib/testCTestResourceGroups.cxx
+++ b/Tests/CMakeLib/testCTestResourceGroups.cxx
@@ -104,7 +104,7 @@ static const std::vector<ExpectedParseResult> expectedResults{
/* clang-format on */
};
-bool TestExpectedParseResult(const ExpectedParseResult& expected)
+static bool TestExpectedParseResult(const ExpectedParseResult& expected)
{
std::vector<std::vector<cmCTestTestHandler::cmCTestTestResourceRequirement>>
result;
diff --git a/Tests/CMakeLib/testOptional.cxx b/Tests/CMakeLib/testOptional.cxx
index 9d4b72aa42..2007fffc49 100644
--- a/Tests/CMakeLib/testOptional.cxx
+++ b/Tests/CMakeLib/testOptional.cxx
@@ -116,7 +116,7 @@ public:
# define END_IGNORE_UNINITIALIZED
#endif
-void swap(EventLogger& e1, EventLogger& e2)
+static void swap(EventLogger& e1, EventLogger& e2)
{
BEGIN_IGNORE_UNINITIALIZED
events.push_back({ Event::SWAP, &e1, &e2, e2.Value });
@@ -180,37 +180,37 @@ EventLogger& EventLogger::operator=(int value)
return *this;
}
-bool operator==(const EventLogger& lhs, const EventLogger& rhs)
+static bool operator==(const EventLogger& lhs, const EventLogger& rhs)
{
events.push_back({ Event::COMPARE_EE_EQ, &lhs, &rhs, lhs.Value });
return lhs.Value == rhs.Value;
}
-bool operator!=(const EventLogger& lhs, const EventLogger& rhs)
+static bool operator!=(const EventLogger& lhs, const EventLogger& rhs)
{
events.push_back({ Event::COMPARE_EE_NE, &lhs, &rhs, lhs.Value });
return lhs.Value != rhs.Value;
}
-bool operator<(const EventLogger& lhs, const EventLogger& rhs)
+static bool operator<(const EventLogger& lhs, const EventLogger& rhs)
{
events.push_back({ Event::COMPARE_EE_LT, &lhs, &rhs, lhs.Value });
return lhs.Value < rhs.Value;
}
-bool operator<=(const EventLogger& lhs, const EventLogger& rhs)
+static bool operator<=(const EventLogger& lhs, const EventLogger& rhs)
{
events.push_back({ Event::COMPARE_EE_LE, &lhs, &rhs, lhs.Value });
return lhs.Value <= rhs.Value;
}
-bool operator>(const EventLogger& lhs, const EventLogger& rhs)
+static bool operator>(const EventLogger& lhs, const EventLogger& rhs)
{
events.push_back({ Event::COMPARE_EE_GT, &lhs, &rhs, lhs.Value });
return lhs.Value > rhs.Value;
}
-bool operator>=(const EventLogger& lhs, const EventLogger& rhs)
+static bool operator>=(const EventLogger& lhs, const EventLogger& rhs)
{
events.push_back({ Event::COMPARE_EE_GE, &lhs, &rhs, lhs.Value });
return lhs.Value >= rhs.Value;
diff --git a/Tests/CMakeLib/testRST.cxx b/Tests/CMakeLib/testRST.cxx
index 28d80a5f61..77f2a662af 100644
--- a/Tests/CMakeLib/testRST.cxx
+++ b/Tests/CMakeLib/testRST.cxx
@@ -8,7 +8,8 @@
#include "cmRST.h"
#include "cmSystemTools.h"
-void reportLine(std::ostream& os, bool ret, std::string const& line, bool eol)
+static void reportLine(std::ostream& os, bool ret, std::string const& line,
+ bool eol)
{
if (ret) {
os << "\"" << line << "\" (" << (eol ? "with EOL" : "without EOL") << ")";
diff --git a/Tests/CMakeLib/testUVProcessChain.cxx b/Tests/CMakeLib/testUVProcessChain.cxx
index a003205c2d..c924083eb4 100644
--- a/Tests/CMakeLib/testUVProcessChain.cxx
+++ b/Tests/CMakeLib/testUVProcessChain.cxx
@@ -64,14 +64,15 @@ bool operator==(const cmUVProcessChain::Status* actual,
return true;
}
-bool resultsMatch(const std::vector<const cmUVProcessChain::Status*>& actual,
- const std::vector<ExpectedStatus>& expected)
+static bool resultsMatch(
+ const std::vector<const cmUVProcessChain::Status*>& actual,
+ const std::vector<ExpectedStatus>& expected)
{
return actual.size() == expected.size() &&
std::equal(actual.begin(), actual.end(), expected.begin());
}
-std::string getInput(std::istream& input)
+static std::string getInput(std::istream& input)
{
char buffer[1024];
std::ostringstream str;
@@ -103,8 +104,9 @@ std::ostream& operator<<(
return func(stream);
}
-void printResults(const std::vector<const cmUVProcessChain::Status*>& actual,
- const std::vector<ExpectedStatus>& expected)
+static void printResults(
+ const std::vector<const cmUVProcessChain::Status*>& actual,
+ const std::vector<ExpectedStatus>& expected)
{
std::cout << "Expected: " << std::endl;
for (auto const& e : expected) {
@@ -129,8 +131,8 @@ void printResults(const std::vector<const cmUVProcessChain::Status*>& actual,
}
}
-bool checkExecution(cmUVProcessChainBuilder& builder,
- std::unique_ptr<cmUVProcessChain>& chain)
+static bool checkExecution(cmUVProcessChainBuilder& builder,
+ std::unique_ptr<cmUVProcessChain>& chain)
{
std::vector<const cmUVProcessChain::Status*> status;
@@ -171,7 +173,7 @@ bool checkExecution(cmUVProcessChainBuilder& builder,
return true;
}
-bool checkOutput(std::istream& outputStream, std::istream& errorStream)
+static bool checkOutput(std::istream& outputStream, std::istream& errorStream)
{
std::string output = getInput(outputStream);
if (output != "HELO WRD!") {
diff --git a/Tests/CMakeLib/testUVProcessChainHelper.cxx b/Tests/CMakeLib/testUVProcessChainHelper.cxx
index 9c258342eb..bc0ef8e8e9 100644
--- a/Tests/CMakeLib/testUVProcessChainHelper.cxx
+++ b/Tests/CMakeLib/testUVProcessChainHelper.cxx
@@ -7,7 +7,7 @@
#include <string>
#include <thread>
-std::string getStdin()
+static std::string getStdin()
{
char buffer[1024];
std::ostringstream str;
diff --git a/Tests/CMakeLib/testUVRAII.cxx b/Tests/CMakeLib/testUVRAII.cxx
index 7d21959bff..fd88e24c84 100644
--- a/Tests/CMakeLib/testUVRAII.cxx
+++ b/Tests/CMakeLib/testUVRAII.cxx
@@ -221,10 +221,15 @@ static bool testLoopDestructor()
int testUVRAII(int, char** const)
{
- if ((testAsyncShutdown() &&
- testAsyncDtor() & testAsyncMove() & testCrossAssignment() &
- testAllMoves() & testLoopReset() & testLoopDestructor()) == 0) {
+ if (!testAsyncShutdown()) {
return -1;
}
- return 0;
+ bool passed = true;
+ passed = testAsyncDtor() && passed;
+ passed = testAsyncMove() && passed;
+ passed = testCrossAssignment() && passed;
+ passed = testAllMoves() && passed;
+ passed = testLoopReset() && passed;
+ passed = testLoopDestructor() && passed;
+ return passed ? 0 : -1;
}
diff --git a/Tests/CMakeLib/testUVStreambuf.cxx b/Tests/CMakeLib/testUVStreambuf.cxx
index b86ed76ea1..760fa29e0e 100644
--- a/Tests/CMakeLib/testUVStreambuf.cxx
+++ b/Tests/CMakeLib/testUVStreambuf.cxx
@@ -15,9 +15,10 @@
#define TEST_STR_LINE_3 "with libuv's uv_stream_t."
#define TEST_STR TEST_STR_LINE_1 "\n" TEST_STR_LINE_2 "\n" TEST_STR_LINE_3
-bool writeDataToStreamPipe(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe,
- char* outputData, unsigned int outputDataLength,
- const char* /* unused */)
+static bool writeDataToStreamPipe(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe,
+ char* outputData,
+ unsigned int outputDataLength,
+ const char* /* unused */)
{
int err;
@@ -66,9 +67,11 @@ bool writeDataToStreamPipe(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe,
return true;
}
-bool writeDataToStreamProcess(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe,
- char* outputData, unsigned int /* unused */,
- const char* cmakeCommand)
+static bool writeDataToStreamProcess(uv_loop_t& loop,
+ cm::uv_pipe_ptr& inputPipe,
+ char* outputData,
+ unsigned int /* unused */,
+ const char* cmakeCommand)
{
int err;
@@ -130,7 +133,7 @@ bool writeDataToStreamProcess(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe,
return true;
}
-bool testUVStreambufRead(
+static bool testUVStreambufRead(
bool (*cb)(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe, char* outputData,
unsigned int outputDataLength, const char* cmakeCommand),
const char* cmakeCommand)
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 8b38080fdd..b1f473b87e 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -531,8 +531,8 @@ if(BUILD_TESTING)
if (NOT CMAKE_GENERATOR STREQUAL "Xcode")
ADD_TEST_MACRO(SourceFileIncludeDirProperty SourceFileIncludeDirProperty)
endif()
- if(CMAKE_CXX_COMPILER_ID STREQUAL GNU
- AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "LCC" OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
+ AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7))
set(runCxxDialectTest 1)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL Clang
@@ -670,7 +670,7 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(Module.WriteCompilerDetectionHeader WriteCompilerDetectionHeader)
- if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+ if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "LCC")
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-fPIE run_pic_test)
else()
@@ -687,9 +687,10 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(PositionIndependentTargets PositionIndependentTargets)
endif()
- if((CMAKE_CXX_COMPILER_ID MATCHES "GNU") AND
+ if(CMAKE_CXX_COMPILER_ID MATCHES "LCC" OR
+ ((CMAKE_CXX_COMPILER_ID MATCHES "GNU") AND
(NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 4.2) AND
- (CMAKE_SYSTEM_NAME MATCHES "Linux"))
+ (CMAKE_SYSTEM_NAME MATCHES "Linux")))
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(
@@ -2011,7 +2012,7 @@ if(BUILD_TESTING)
set_tests_properties ( linkorder2 PROPERTIES DEPENDS linkorder1)
# Test static linking on toolchains known to support it.
- if(CMAKE_C_COMPILER_ID STREQUAL "GNU"
+ if((CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "LCC")
AND NOT APPLE AND NOT WIN32 AND NOT CYGWIN
AND EXISTS "/usr/lib/libm.a")
add_test(LinkStatic ${CMAKE_CTEST_COMMAND}
@@ -2026,7 +2027,7 @@ if(BUILD_TESTING)
)
endif()
- if(MAKE_SUPPORTS_SPACES AND NOT CMAKE_GENERATOR STREQUAL "Xcode")
+ if(MAKE_SUPPORTS_SPACES AND NOT CMAKE_GENERATOR STREQUAL "Xcode" AND NOT CMAKE_GENERATOR STREQUAL "Watcom WMake")
add_test(SubDirSpaces ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/SubDirSpaces"
@@ -3665,6 +3666,7 @@ if(BUILD_TESTING)
if(CMAKE_GENERATOR MATCHES "^((Unix|MSYS) Makefiles|Ninja)$" AND
((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.4)
OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+ OR (CMAKE_CXX_COMPILER_ID STREQUAL "LCC")
OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")))
add_test(IncludeDirectoriesCPATH ${CMAKE_CTEST_COMMAND}
--build-and-test
diff --git a/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt b/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt
index aca99ceff7..c7e3105045 100644
--- a/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt
+++ b/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt
@@ -1,4 +1,7 @@
cmake_minimum_required(VERSION 2.8.12)
+if(POLICY CMP0129)
+ cmake_policy(SET CMP0129 NEW)
+endif()
project(CheckCXXCompilerFlag)
message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
@@ -57,7 +60,7 @@ else()
message("Unhandled Platform")
endif()
-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC|Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
check_cxx_compiler_flag("-x c++" HAVE_X_CXX)
if(NOT HAVE_X_CXX)
message(FATAL_ERROR "${CMAKE_CXX_COMPILER_ID} compiler flag '-x c++' check failed")
diff --git a/Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt b/Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt
index 9a9bb2a395..3d65b7ab18 100644
--- a/Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt
+++ b/Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt
@@ -48,4 +48,15 @@ if (CMAKE_COMPILER_IS_GNUCC)
if (CSE_RESULT_O3)
message(SEND_ERROR "CheckSymbolExists reported a nonexistent symbol as existing with optimization -O3")
endif ()
+
+ string(APPEND CMAKE_C_FLAGS " -pedantic-errors")
+ unset(CS_RESULT_PEDANTIC_ERRORS CACHE)
+ message(STATUS "Testing with -pedantic-errors")
+
+ check_symbol_exists(fopen "stdio.h" CSE_RESULT_PEDANTIC_ERRORS)
+
+ if(NOT CSE_RESULT_PEDANTIC_ERRORS)
+ message(SEND_ERROR "CheckSymbolExists reported an existing symbol as nonexisting with -pedantic-errors")
+ endif()
+
endif ()
diff --git a/Tests/CTestTestCrash/crash.cxx b/Tests/CTestTestCrash/crash.cxx
index 370c3fbbe0..88d4b1d2cf 100644
--- a/Tests/CTestTestCrash/crash.cxx
+++ b/Tests/CTestTestCrash/crash.cxx
@@ -1,6 +1,6 @@
// causes a segfault
int main()
{
- int* ptr = 0;
+ volatile int* ptr = 0;
*ptr = 1;
}
diff --git a/Tests/CompileFeatures/cxx_generalized_initializers.cpp b/Tests/CompileFeatures/cxx_generalized_initializers.cpp
index bfe0d415e3..c4f47fe0d6 100644
--- a/Tests/CompileFeatures/cxx_generalized_initializers.cpp
+++ b/Tests/CompileFeatures/cxx_generalized_initializers.cpp
@@ -11,8 +11,11 @@ class initializer_list
const _E* __begin_;
size_t __size_;
-#ifdef __INTEL_COMPILER
- // The Intel compiler internally asserts the constructor overloads, so
+#if defined(__INTEL_COMPILER) || \
+ (defined(__LCC__) && \
+ (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__)))
+ // Compilers based on EDG, such as Intel compiler and MCST LCC,
+ // internally assert the constructor overloads, so
// reproduce the constructor used in its <initializer_list> header.
initializer_list(const _E*, size_t) {}
#else
diff --git a/Tests/CompileOptions/CMakeLists.txt b/Tests/CompileOptions/CMakeLists.txt
index 1bedac0192..0fbfb83716 100644
--- a/Tests/CompileOptions/CMakeLists.txt
+++ b/Tests/CompileOptions/CMakeLists.txt
@@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.0)
if(POLICY CMP0092)
cmake_policy(SET CMP0092 NEW)
endif()
+if(POLICY CMP0129)
+ cmake_policy(SET CMP0129 NEW)
+endif()
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(NOT _isMultiConfig AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build" FORCE)
@@ -30,8 +33,8 @@ endif()
set_property(TARGET CompileOptions PROPERTY COMPILE_OPTIONS
"-DTEST_DEFINE"
"-DNEEDS_ESCAPE=\"E$CAPE\""
- "$<$<CXX_COMPILER_ID:GNU>:-DTEST_DEFINE_GNU>"
- "$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-DTEST_DEFINE_CXX_AND_GNU>"
+ "$<$<CXX_COMPILER_ID:GNU,LCC>:-DTEST_DEFINE_GNU>"
+ "$<$<COMPILE_LANG_AND_ID:CXX,GNU,LCC>:-DTEST_DEFINE_CXX_AND_GNU>"
"SHELL:" # produces no options
${c_tests}
${cxx_tests}
@@ -49,15 +52,15 @@ else()
)
endif()
-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|Borland|Embarcadero" AND NOT "${CMAKE_GENERATOR}" MATCHES "NMake Makefiles")
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC|Clang|Borland|Embarcadero" AND NOT "${CMAKE_GENERATOR}" MATCHES "NMake Makefiles")
set_property(TARGET CompileOptions APPEND PROPERTY COMPILE_OPTIONS
"-DTEST_OCTOTHORPE=\"#\""
)
endif()
-if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|AppleClang|MSVC)$")
+if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|LCC|AppleClang|MSVC)$")
target_compile_definitions(CompileOptions PRIVATE "DO_FLAG_TESTS")
- if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|AppleClang)$")
+ if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|LCC|AppleClang)$")
string(APPEND CMAKE_CXX_FLAGS " -w")
endif()
string(APPEND CMAKE_CXX_FLAGS " -DFLAG_A=1 -DFLAG_B=1")
@@ -79,7 +82,7 @@ endif()
target_link_libraries(CompileOptions testlib)
-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC")
target_compile_definitions(CompileOptions
PRIVATE
"DO_GNU_TESTS"
diff --git a/Tests/CudaOnly/All/CMakeLists.txt b/Tests/CudaOnly/All/CMakeLists.txt
new file mode 100644
index 0000000000..fe29bb062c
--- /dev/null
+++ b/Tests/CudaOnly/All/CMakeLists.txt
@@ -0,0 +1,44 @@
+cmake_minimum_required(VERSION 3.20)
+project(CudaOnlyAll CUDA)
+
+if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" AND
+ CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11.5.0)
+
+ set(compile_options -Wno-deprecated-gpu-targets)
+ function(verify_output flag output_var)
+ string(REGEX MATCHALL "-arch compute_([0-9]+)" target_archs "${${output_var}}")
+ list(LENGTH target_archs count)
+ if(count LESS 2)
+ message(FATAL_ERROR "${flag} failed to map to multiple architectures")
+ endif()
+ endfunction()
+endif()
+
+if(COMMAND verify_output)
+ set(try_compile_flags -v ${compile_options})
+
+ set(CMAKE_CUDA_ARCHITECTURES all)
+ try_compile(all_archs_compiles
+ ${CMAKE_CURRENT_BINARY_DIR}/try_compile/all_archs_compiles
+ ${CMAKE_CURRENT_SOURCE_DIR}/main.cu
+ COMPILE_DEFINITIONS ${try_compile_flags}
+ OUTPUT_VARIABLE output
+ )
+ verify_output(all output)
+
+ set(CMAKE_CUDA_ARCHITECTURES all-major)
+ try_compile(all_major_archs_compiles
+ ${CMAKE_CURRENT_BINARY_DIR}/try_compile/all_major_archs_compiles
+ ${CMAKE_CURRENT_SOURCE_DIR}/main.cu
+ COMPILE_DEFINITIONS ${try_compile_flags}
+ OUTPUT_VARIABLE output
+ )
+ verify_output(all-major output)
+
+ if(all_archs_compiles AND all_major_archs_compiles)
+ add_executable(CudaOnlyAll main.cu)
+ target_compile_options(CudaOnlyAll PRIVATE ${compile_options})
+ endif()
+else()
+ add_executable(CudaOnlyAll main.cu)
+endif()
diff --git a/Tests/CudaOnly/All/main.cu b/Tests/CudaOnly/All/main.cu
new file mode 100644
index 0000000000..5047a34e39
--- /dev/null
+++ b/Tests/CudaOnly/All/main.cu
@@ -0,0 +1,3 @@
+int main()
+{
+}
diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt
index a3fb409b91..cacfb76275 100644
--- a/Tests/CudaOnly/CMakeLists.txt
+++ b/Tests/CudaOnly/CMakeLists.txt
@@ -4,8 +4,10 @@ macro (add_cuda_test_macro name)
PROPERTY LABELS "CUDA")
endmacro ()
+add_cuda_test_macro(CudaOnly.All CudaOnlyAll)
add_cuda_test_macro(CudaOnly.Architecture Architecture)
add_cuda_test_macro(CudaOnly.CompileFlags CudaOnlyCompileFlags)
+
add_cuda_test_macro(CudaOnly.EnableStandard CudaOnlyEnableStandard)
add_cuda_test_macro(CudaOnly.ExportPTX CudaOnlyExportPTX)
add_cuda_test_macro(CudaOnly.SharedRuntimePlusToolkit CudaOnlySharedRuntimePlusToolkit)
@@ -16,6 +18,7 @@ add_cuda_test_macro(CudaOnly.WithDefs CudaOnlyWithDefs)
add_cuda_test_macro(CudaOnly.CircularLinkLine CudaOnlyCircularLinkLine)
add_cuda_test_macro(CudaOnly.ResolveDeviceSymbols CudaOnlyResolveDeviceSymbols)
add_cuda_test_macro(CudaOnly.SeparateCompilation main/CudaOnlySeparateCompilation)
+add_cuda_test_macro(CudaOnly.SeparateCompilationPTX CudaOnlySeparateCompilationPTX)
if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang")
# Clang doesn't have flags for selecting the runtime.
diff --git a/Tests/CudaOnly/ExportPTX/CMakeLists.txt b/Tests/CudaOnly/ExportPTX/CMakeLists.txt
index e7e7bc4f4b..f1667af3c7 100644
--- a/Tests/CudaOnly/ExportPTX/CMakeLists.txt
+++ b/Tests/CudaOnly/ExportPTX/CMakeLists.txt
@@ -56,7 +56,7 @@ add_custom_command(
"-DBIN_TO_C_COMMAND=${bin_to_c}"
"-DOBJECTS=$<TARGET_OBJECTS:CudaPTX>"
"-DOUTPUT=${output_file}"
- -P ${CMAKE_CURRENT_SOURCE_DIR}/bin2c_wrapper.cmake
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/../utils/bin2c_wrapper.cmake
VERBATIM
DEPENDS $<TARGET_OBJECTS:CudaPTX>
COMMENT "Converting Object files to a C header"
diff --git a/Tests/CudaOnly/SeparateCompilationPTX/CMakeLists.txt b/Tests/CudaOnly/SeparateCompilationPTX/CMakeLists.txt
new file mode 100644
index 0000000000..273f95578f
--- /dev/null
+++ b/Tests/CudaOnly/SeparateCompilationPTX/CMakeLists.txt
@@ -0,0 +1,51 @@
+cmake_minimum_required(VERSION 3.19)
+project (SeparateCompPTX CUDA)
+
+#Goal for this example:
+# How to generate PTX files with RDC enabled
+
+# PTX can be compiled only for a single virtual architecture at a time
+list(POP_FRONT CMAKE_CUDA_ARCHITECTURES temp)
+set(CMAKE_CUDA_ARCHITECTURES ${temp})
+string(APPEND CMAKE_CUDA_ARCHITECTURES "-virtual")
+
+add_library(CudaPTX OBJECT kernels.cu)
+set_property(TARGET CudaPTX PROPERTY CUDA_PTX_COMPILATION ON)
+set_property(TARGET CudaPTX PROPERTY CUDA_SEPARABLE_COMPILATION ON)
+
+
+set(output_file ${CMAKE_CURRENT_BINARY_DIR}/embedded_objs.h)
+
+find_package(CUDAToolkit REQUIRED)
+find_program(bin_to_c
+ NAMES bin2c
+ PATHS ${CUDAToolkit_BIN_DIR}
+ )
+if(NOT bin_to_c)
+ message(FATAL_ERROR
+ "bin2c not found:\n"
+ " CUDAToolkit_BIN_DIR='${CUDAToolkit_BIN_DIR}'\n"
+ )
+endif()
+
+add_custom_command(
+ OUTPUT "${output_file}"
+ COMMAND ${CMAKE_COMMAND}
+ "-DBIN_TO_C_COMMAND=${bin_to_c}"
+ "-DOBJECTS=$<TARGET_OBJECTS:CudaPTX>"
+ "-DOUTPUT=${output_file}"
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/../utils/bin2c_wrapper.cmake
+ VERBATIM
+ DEPENDS $<TARGET_OBJECTS:CudaPTX>
+ COMMENT "Converting Object files to a C header"
+ )
+
+add_executable(CudaOnlySeparateCompilationPTX main.cu ${output_file})
+target_compile_features(CudaOnlySeparateCompilationPTX PRIVATE cuda_std_11)
+target_include_directories(CudaOnlySeparateCompilationPTX PRIVATE
+ ${CMAKE_CURRENT_BINARY_DIR} )
+target_link_libraries(CudaOnlySeparateCompilationPTX PRIVATE CUDA::cuda_driver)
+if(APPLE)
+ # Help the static cuda runtime find the driver (libcuda.dyllib) at runtime.
+ set_property(TARGET CudaOnlySeparateCompilationPTX PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
+endif()
diff --git a/Tests/CudaOnly/SeparateCompilationPTX/kernels.cu b/Tests/CudaOnly/SeparateCompilationPTX/kernels.cu
new file mode 100644
index 0000000000..f4a52d4217
--- /dev/null
+++ b/Tests/CudaOnly/SeparateCompilationPTX/kernels.cu
@@ -0,0 +1,14 @@
+
+__global__ void kernelA(float* r, float* x, float* y, float* z, int size)
+{
+ for (int i = threadIdx.x; i < size; i += blockDim.x) {
+ r[i] = x[i] * y[i] + z[i];
+ }
+}
+
+__global__ void kernelB(float* r, float* x, float* y, float* z, int size)
+{
+ for (int i = threadIdx.x; i < size; i += blockDim.x) {
+ r[i] = x[i] * y[i] + z[i];
+ }
+}
diff --git a/Tests/CudaOnly/SeparateCompilationPTX/main.cu b/Tests/CudaOnly/SeparateCompilationPTX/main.cu
new file mode 100644
index 0000000000..164cde55a7
--- /dev/null
+++ b/Tests/CudaOnly/SeparateCompilationPTX/main.cu
@@ -0,0 +1,30 @@
+#include <iostream>
+
+#include <cuda.h>
+
+#include "embedded_objs.h"
+
+int main()
+{
+ cuInit(0);
+ int count = 0;
+ cuDeviceGetCount(&count);
+ if (count == 0) {
+ std::cerr << "No CUDA devices found\n";
+ return 1;
+ }
+
+ CUdevice device;
+ cuDeviceGet(&device, 0);
+
+ CUcontext context;
+ cuCtxCreate(&context, 0, device);
+
+ CUmodule module;
+ cuModuleLoadData(&module, kernels);
+ if (module == nullptr) {
+ std::cerr << "Failed to load the embedded ptx" << std::endl;
+ return 1;
+ }
+ std::cout << module << std::endl;
+}
diff --git a/Tests/CudaOnly/ExportPTX/bin2c_wrapper.cmake b/Tests/CudaOnly/utils/bin2c_wrapper.cmake
index 0baf93434d..0baf93434d 100644
--- a/Tests/CudaOnly/ExportPTX/bin2c_wrapper.cmake
+++ b/Tests/CudaOnly/utils/bin2c_wrapper.cmake
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index a2968d4334..a79efd0961 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -1,4 +1,7 @@
cmake_minimum_required (VERSION 2.7.20090711)
+if(POLICY CMP0129)
+ cmake_policy(SET CMP0129 NEW)
+endif()
project(Export C CXX)
# Pretend that RelWithDebInfo should link to debug libraries to test
@@ -145,6 +148,19 @@ set_property(TARGET testLibCycleA PROPERTY LINK_INTERFACE_MULTIPLICITY 3)
add_library(testLibNoSONAME SHARED testLibNoSONAME.c)
set_property(TARGET testLibNoSONAME PROPERTY NO_SONAME 1)
+add_library(testInterfaceIncludeUser INTERFACE)
+target_include_directories(testInterfaceIncludeUser
+ INTERFACE
+ "$<INSTALL_INTERFACE:include/testInterfaceIncludeUser>"
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/testInterfaceIncludeUser>"
+)
+set_property(TARGET testInterfaceIncludeUser PROPERTY IMPORTED_NO_SYSTEM 1)
+install(
+ FILES
+ "${CMAKE_CURRENT_SOURCE_DIR}/include/testInterfaceIncludeUser/testInterfaceInclude.h"
+ DESTINATION include/testInterfaceIncludeUser
+)
+
cmake_policy(PUSH)
cmake_policy(SET CMP0022 NEW)
# Test exporting dependent libraries into different exports
@@ -286,6 +302,7 @@ set_property(TARGET testSharedLibRequired
set_property(TARGET testSharedLibRequired APPEND PROPERTY
INTERFACE_COMPILE_OPTIONS
$<$<CXX_COMPILER_ID:GNU>:-DCUSTOM_COMPILE_OPTION>
+ $<$<CXX_COMPILER_ID:LCC>:-DCUSTOM_COMPILE_OPTION>
)
add_library(testSharedLibRequiredUser SHARED testSharedLibRequiredUser.cpp)
@@ -531,6 +548,7 @@ install(
cmp0022NEW cmp0022OLD
TopDirLib SubDirLinkA
systemlib
+ testInterfaceIncludeUser
EXPORT exp
RUNTIME DESTINATION $<1:bin>$<0:/wrong>
LIBRARY DESTINATION $<1:lib>$<0:/wrong> NAMELINK_SKIP
@@ -590,6 +608,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3
cmp0022NEW cmp0022OLD
TopDirLib SubDirLinkA
systemlib
+ testInterfaceIncludeUser
NAMESPACE bld_
FILE ExportBuildTree.cmake
)
diff --git a/Tests/ExportImport/Export/include/testInterfaceIncludeUser/testInterfaceInclude.h b/Tests/ExportImport/Export/include/testInterfaceIncludeUser/testInterfaceInclude.h
new file mode 100644
index 0000000000..fa882cb5b0
--- /dev/null
+++ b/Tests/ExportImport/Export/include/testInterfaceIncludeUser/testInterfaceInclude.h
@@ -0,0 +1 @@
+/* empty file */
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 3cb383329e..d6cc8d04d3 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -70,6 +70,10 @@ target_link_libraries(imp_testExe1
exp_testLibPerConfigDest
)
+add_library(imp_testInterfaceInclude1 STATIC imp_testInterfaceInclude1.c)
+target_include_directories(imp_testInterfaceInclude1 SYSTEM PRIVATE testInterfaceIncludeSystem)
+target_link_libraries(imp_testInterfaceInclude1 PRIVATE exp_testInterfaceIncludeUser)
+
# Try building a plugin to an executable imported from the install tree.
add_library(imp_mod1 MODULE imp_mod1.c)
target_link_libraries(imp_mod1 exp_testExe2)
@@ -110,6 +114,10 @@ target_link_libraries(imp_testExe1b
bld_testLibPerConfigDest
)
+add_library(imp_testInterfaceInclude1b STATIC imp_testInterfaceInclude1.c)
+target_include_directories(imp_testInterfaceInclude1b SYSTEM PRIVATE testInterfaceIncludeSystem)
+target_link_libraries(imp_testInterfaceInclude1b PRIVATE bld_testInterfaceIncludeUser)
+
add_custom_target(check_testLib1_genex ALL
COMMAND ${CMAKE_COMMAND} -DtestLib1=$<TARGET_FILE:exp_testLib1>
-Dprefix=${CMAKE_INSTALL_PREFIX}
@@ -325,14 +333,14 @@ target_compile_definitions(deps_shared_iface
$<$<STREQUAL:$<TARGET_PROPERTY:CUSTOM_STRING>,testcontent>:CUSTOM_STRING_IS_MATCH>
)
-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "LCC")
target_compile_definitions(deps_shared_iface
PRIVATE
"DO_GNU_TESTS"
)
endif()
-if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "LCC")
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-fPIE run_pic_test)
else()
@@ -365,7 +373,7 @@ endif()
add_executable(deps_shared_iface2 deps_shared_iface.cpp)
target_link_libraries(deps_shared_iface2 bld_testSharedLibDepends bld_subdirlib)
-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "LCC")
target_compile_definitions(deps_shared_iface2
PRIVATE
"DO_GNU_TESTS"
@@ -413,6 +421,7 @@ endforeach()
unset(_configs)
if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.4)
+ OR CMAKE_C_COMPILER_ID MATCHES "LCC"
OR (CMAKE_C_COMPILER_ID STREQUAL Clang AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"))
AND (CMAKE_GENERATOR STREQUAL "Unix Makefiles" OR CMAKE_GENERATOR STREQUAL "Ninja"))
include(CheckCXXCompilerFlag)
diff --git a/Tests/ExportImport/Import/A/imp_testInterfaceInclude1.c b/Tests/ExportImport/Import/A/imp_testInterfaceInclude1.c
new file mode 100644
index 0000000000..88a49b5846
--- /dev/null
+++ b/Tests/ExportImport/Import/A/imp_testInterfaceInclude1.c
@@ -0,0 +1,6 @@
+#include "testInterfaceInclude.h"
+
+int imp_testInterfaceInclude1(void)
+{
+ return 0;
+}
diff --git a/Tests/ExportImport/Import/A/testInterfaceIncludeSystem/testInterfaceInclude.h b/Tests/ExportImport/Import/A/testInterfaceIncludeSystem/testInterfaceInclude.h
new file mode 100644
index 0000000000..2beeb8b533
--- /dev/null
+++ b/Tests/ExportImport/Import/A/testInterfaceIncludeSystem/testInterfaceInclude.h
@@ -0,0 +1 @@
+#error testInterfaceInclude.h included from testInterfaceIncludeSystem
diff --git a/Tests/ExportImport/Import/CMakeLists.txt b/Tests/ExportImport/Import/CMakeLists.txt
index 006313091f..e6dcd65f97 100644
--- a/Tests/ExportImport/Import/CMakeLists.txt
+++ b/Tests/ExportImport/Import/CMakeLists.txt
@@ -1,5 +1,8 @@
cmake_minimum_required (VERSION 2.7.20090711)
cmake_policy(SET CMP0025 NEW)
+if(POLICY CMP0129)
+ cmake_policy(SET CMP0129 NEW)
+endif()
project(Import C CXX)
# Import everything in a subdirectory.
diff --git a/Tests/FindGTest/Test/CMakeLists.txt b/Tests/FindGTest/Test/CMakeLists.txt
index 6537238693..9c1eb5e92b 100644
--- a/Tests/FindGTest/Test/CMakeLists.txt
+++ b/Tests/FindGTest/Test/CMakeLists.txt
@@ -16,3 +16,7 @@ add_executable(test_gtest_var main.cxx)
target_include_directories(test_gtest_var PRIVATE ${GTEST_INCLUDE_DIRS})
target_link_libraries(test_gtest_var PRIVATE ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
add_test(NAME test_gtest_var COMMAND test_gtest_var)
+
+add_executable(test_gmock_tgt main.cxx)
+target_link_libraries(test_gmock_tgt GTest::gmock_main)
+add_test(NAME test_gmock_tgt COMMAND test_gmock_tgt)
diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt
index 2fc47a5191..cdc08c4d70 100644
--- a/Tests/Fortran/CMakeLists.txt
+++ b/Tests/Fortran/CMakeLists.txt
@@ -1,4 +1,7 @@
cmake_minimum_required (VERSION 3.1)
+if(POLICY CMP0129)
+ cmake_policy(SET CMP0129 NEW)
+endif()
project(testf C CXX Fortran)
message("CTEST_FULL_OUTPUT ")
@@ -14,7 +17,7 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "^(XL|VisualAge)$")
# We do not implement SHARED Fortran libs on AIX yet!
# Workaround: Set LINKER_LANGUAGE to C, which uses 'xlc' and Fortran implicits.
set(_SHARED STATIC)
-elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
+elseif(CMAKE_Fortran_COMPILER_ID MATCHES "GNU|LCC")
# g77 2.96 does not support shared libs on Itanium because g2c is not -fPIC
execute_process(COMMAND ${CMAKE_Fortran_COMPILER} --version
OUTPUT_VARIABLE output ERROR_VARIABLE output)
@@ -26,7 +29,7 @@ endif()
# Pick a module .def file with the properly mangled symbol name.
set(world_def "")
if(WIN32 AND NOT CYGWIN)
- if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
+ if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU|LCC")
set(world_def world_gnu.def)
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel" OR
CMAKE_GENERATOR MATCHES "Visual Studio") # Intel plugin
diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt
index f00565e563..788c5bee82 100644
--- a/Tests/IncludeDirectories/CMakeLists.txt
+++ b/Tests/IncludeDirectories/CMakeLists.txt
@@ -1,10 +1,15 @@
cmake_minimum_required (VERSION 2.6)
-project(IncludeDirectories)
+if(POLICY CMP0129)
+ cmake_policy(SET CMP0129 NEW)
+endif()
+
+project(IncludeDirectories)
if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.4)
OR (CMAKE_C_COMPILER_ID STREQUAL Clang AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
OR CMAKE_C_COMPILER_ID STREQUAL NVHPC
OR CMAKE_C_COMPILER_ID STREQUAL AppleClang
+ OR CMAKE_C_COMPILER_ID STREQUAL LCC
OR ("x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC" AND
CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "19.29.30036.3" AND
NOT CMAKE_GENERATOR MATCHES "Visual Studio")) # No support for VS generators yet.
@@ -116,6 +121,13 @@ add_library(ordertest ordertest.cpp)
target_include_directories(ordertest SYSTEM PUBLIC SystemIncludeDirectories/systemlib)
target_include_directories(ordertest PUBLIC SystemIncludeDirectories/userlib)
+add_library(ordertest2 ordertest.cpp)
+target_include_directories(ordertest2 SYSTEM PRIVATE SystemIncludeDirectories/systemlib)
+target_link_libraries(ordertest2 PRIVATE ordertest2_userlib)
+add_library(ordertest2_userlib INTERFACE IMPORTED)
+target_include_directories(ordertest2_userlib INTERFACE SystemIncludeDirectories/userlib)
+set_property(TARGET ordertest2_userlib PROPERTY IMPORTED_NO_SYSTEM 1)
+
add_subdirectory(StandardIncludeDirectories)
add_subdirectory(TargetIncludeDirectories)
diff --git a/Tests/LinkStatic/CMakeLists.txt b/Tests/LinkStatic/CMakeLists.txt
index 200d4e51c5..ad3b11169a 100644
--- a/Tests/LinkStatic/CMakeLists.txt
+++ b/Tests/LinkStatic/CMakeLists.txt
@@ -1,8 +1,11 @@
cmake_minimum_required(VERSION 2.8.4.20110303 FATAL_ERROR)
+if(POLICY CMP0129)
+ cmake_policy(SET CMP0129 NEW)
+endif()
project(LinkStatic C)
-if(NOT CMAKE_C_COMPILER_ID STREQUAL "GNU")
- message(FATAL_ERROR "This test works only with the GNU compiler!")
+if(NOT CMAKE_C_COMPILER_ID MATCHES "GNU|LCC")
+ message(FATAL_ERROR "This test works only with the GNU or LCC compiler!")
endif()
find_library(MATH_LIBRARY NAMES libm.a)
diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
index e4067580a8..8898f3bcc4 100644
--- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
+++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
@@ -1,4 +1,7 @@
cmake_minimum_required(VERSION 3.1.0)
+if(POLICY CMP0129)
+ cmake_policy(SET CMP0129 NEW)
+endif()
project(WriteCompilerDetectionHeader)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -52,7 +55,7 @@ endmacro()
# detailed features tables, not just meta-features
if (CMAKE_C_COMPILE_FEATURES)
- if (NOT CMAKE_C_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IntelLLVM|Fujitsu|FujitsuClang)$")
+ if (NOT CMAKE_C_COMPILER_ID MATCHES "^(LCC|Cray|PGI|NVHPC|XL|XLClang|IntelLLVM|Fujitsu|FujitsuClang)$")
set(C_expected_features ${CMAKE_C_COMPILE_FEATURES})
list(FILTER C_expected_features EXCLUDE REGEX "^c_std_[0-9][0-9]")
endif()
@@ -95,7 +98,7 @@ if (C_expected_features)
endif()
if (CMAKE_CXX_COMPILE_FEATURES)
- if (NOT CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IntelLLVM|Fujitsu|FujitsuClang)$")
+ if (NOT CMAKE_CXX_COMPILER_ID MATCHES "^(LCC|Cray|PGI|NVHPC|XL|XLClang|IntelLLVM|Fujitsu|FujitsuClang)$")
set(CXX_expected_features ${CMAKE_CXX_COMPILE_FEATURES})
list(FILTER CXX_expected_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]")
endif()
diff --git a/Tests/RunCMake/BuildDepends/MakeDependencies.step1.cmake b/Tests/RunCMake/BuildDepends/MakeDependencies.step1.cmake
index c74f03319c..04cd698366 100644
--- a/Tests/RunCMake/BuildDepends/MakeDependencies.step1.cmake
+++ b/Tests/RunCMake/BuildDepends/MakeDependencies.step1.cmake
@@ -1,5 +1,10 @@
file(TOUCH "${RunCMake_TEST_BINARY_DIR}/main.c")
-foreach(i RANGE 1 20000)
+if(RunCMake_GENERATOR STREQUAL "Borland Makefiles")
+ set(num_headers 2000)
+else()
+ set(num_headers 20000)
+endif()
+foreach(i RANGE 1 ${num_headers})
file(WRITE "${RunCMake_TEST_BINARY_DIR}/temp_header_file_${i}.h"
"#define HEADER_${i} ${i}\n"
)
diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
index 27bbff69b8..06f416b8c6 100644
--- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
+++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
@@ -159,6 +159,7 @@ endif()
if ((RunCMake_GENERATOR STREQUAL "Unix Makefiles"
AND (CMAKE_C_COMPILER_ID STREQUAL "GNU"
+ OR CMAKE_C_COMPILER_ID STREQUAL "LCC"
OR CMAKE_C_COMPILER_ID STREQUAL "Clang"
OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang"))
OR (RunCMake_GENERATOR STREQUAL "NMake Makefiles"
diff --git a/Tests/RunCMake/CMP0119/RunCMakeTest.cmake b/Tests/RunCMake/CMP0119/RunCMakeTest.cmake
index e547ef5a28..73958273c2 100644
--- a/Tests/RunCMake/CMP0119/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0119/RunCMakeTest.cmake
@@ -12,6 +12,6 @@ if(NOT RunCMake_GENERATOR MATCHES "Visual Studio|Xcode" AND
run_CMP0119(WARN)
run_CMP0119(OLD)
endif()
-if((CMAKE_C_COMPILER_ID MATCHES "(GNU|Clang|MSVC|Borland|Embarcadero|Intel|TI)"))
+if((CMAKE_C_COMPILER_ID MATCHES "(GNU|LCC|Clang|MSVC|Borland|Embarcadero|Intel|TI)"))
run_CMP0119(NEW)
endif()
diff --git a/Tests/RunCMake/CMP0129/C.cmake b/Tests/RunCMake/CMP0129/C.cmake
new file mode 100644
index 0000000000..e9ebe90e14
--- /dev/null
+++ b/Tests/RunCMake/CMP0129/C.cmake
@@ -0,0 +1,8 @@
+if(SET_CMP0129)
+ cmake_policy(SET CMP0129 ${SET_CMP0129})
+endif()
+
+enable_language(C)
+set(CMAKE_VERBOSE_MAKEFILE TRUE)
+include(CompareCompilerVersion.cmake)
+compare_compiler_version(C)
diff --git a/Tests/RunCMake/CMP0129/CMakeLists.txt b/Tests/RunCMake/CMP0129/CMakeLists.txt
new file mode 100644
index 0000000000..d8200fca0a
--- /dev/null
+++ b/Tests/RunCMake/CMP0129/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.22)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0129/CXX.cmake b/Tests/RunCMake/CMP0129/CXX.cmake
new file mode 100644
index 0000000000..ffb81b84c5
--- /dev/null
+++ b/Tests/RunCMake/CMP0129/CXX.cmake
@@ -0,0 +1,8 @@
+if(SET_CMP0129)
+ cmake_policy(SET CMP0129 ${SET_CMP0129})
+endif()
+
+enable_language(CXX)
+set(CMAKE_VERBOSE_MAKEFILE TRUE)
+include(CompareCompilerVersion.cmake)
+compare_compiler_version(CXX)
diff --git a/Tests/RunCMake/CMP0129/CompareCompilerVersion.cmake b/Tests/RunCMake/CMP0129/CompareCompilerVersion.cmake
new file mode 100644
index 0000000000..e4ba19173e
--- /dev/null
+++ b/Tests/RunCMake/CMP0129/CompareCompilerVersion.cmake
@@ -0,0 +1,41 @@
+function(compare_compiler_version lang)
+ cmake_policy(GET CMP0129 LCC_FALLBACK_MODE)
+ if(${CMAKE_${lang}_COMPILER} STREQUAL "LCC" OR ${CMAKE_${lang}_COMPILER} STREQUAL "GNU")
+ execute_process(COMMAND ${CMAKE_${lang}_COMPILER} --version OUTPUT_VARIABLE output)
+ if("${output}" MATCHES [[lcc:([0-9]+.[0-9]+.([0-9]+)):]])
+ set(native_version ${CMAKE_MATCH_1})
+ else()
+ message(FATAL_ERROR "Can not identify native LCC version for language ${lang}.")
+ endif()
+ if("${output}" MATCHES [[\(GCC\) ([0-9]+.[0-9]+.([0-9]+)) compatible]])
+ set(simulated_version ${CMAKE_MATCH_1})
+ else()
+ message(FATAL_ERROR "Can not identify simulated GNU version for language ${lang}.")
+ endif()
+ message(STATUS "Compiler native version is ${native_version}, simulated version is ${simulated_version}.")
+ if("${LCC_FALLBACK_MODE}" STREQUAL "NEW")
+ if(NOT "${CMAKE_${lang}_COMPILER_ID}" STREQUAL "LCC")
+ message(FATAL_ERROR "Policy is in NEW mode, but compiler identification is ${CMAKE_${lang}_COMPILER_ID} instead of LCC.")
+ endif()
+ if(NOT "${CMAKE_${lang}_COMPILER_VERSION}" STREQUAL "${native_version}")
+ message(FATAL_ERROR "Policy is in NEW mode, but compiler version is ${CMAKE_${lang}_COMPILER_VERSION} instead of ${native_version}.")
+ endif()
+ if(NOT "${CMAKE_${lang}_SIMULATE_ID}" STREQUAL "GNU")
+ message(FATAL_ERROR "Policy is in NEW mode, but simulated compiler identification is ${CMAKE_${lang}_SIMULATE_ID} instead of GNU.")
+ endif()
+ if(NOT "${CMAKE_${lang}_SIMULATE_VERSION}" STREQUAL "${simulated_version}")
+ message(FATAL_ERROR "Policy is in NEW mode, but simulated compiler version is ${CMAKE_${lang}_SIMULATE_VERSION} instead of ${simulated_version}.")
+ endif()
+ else()
+ if(NOT "${CMAKE_${lang}_COMPILER_ID}" STREQUAL "GNU")
+ message(FATAL_ERROR "Policy is in OLD mode, but compiler identification is ${CMAKE_${lang}_COMPILER_ID} instead of GNU.")
+ endif()
+ if(NOT "${CMAKE_${lang}_COMPILER_VERSION}" STREQUAL "${simulated_version}")
+ message(FATAL_ERROR "Policy is in OLD mode, but compiler version is ${CMAKE_${lang}_COMPILER_VERSION} instead of ${simulated_version}.")
+ endif()
+ if(${CMAKE_${lang}_SIMULATE_VERSION} OR ${CMAKE_${lang}_SIMULATE_ID)
+ message(FATAL_ERROR "Policy is in OLD mode, but simulated compiler ID/version is ${CMAKE_${lang}_COMPILER_ID}/${CMAKE_${lang}_COMPILER_VERSION} instead of undefined.")
+ endif()
+ endif()
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/CMP0129/Fortran.cmake b/Tests/RunCMake/CMP0129/Fortran.cmake
new file mode 100644
index 0000000000..abaca7e19a
--- /dev/null
+++ b/Tests/RunCMake/CMP0129/Fortran.cmake
@@ -0,0 +1,15 @@
+include(CheckLanguage)
+check_language(Fortran)
+if(NOT CMAKE_Fortran_COMPILER)
+ # No Fortran compiler, skipping Fortran test
+ return()
+endif()
+
+if(SET_CMP0129)
+ cmake_policy(SET CMP0129 ${SET_CMP0129})
+endif()
+
+enable_language(Fortran)
+set(CMAKE_VERBOSE_MAKEFILE TRUE)
+include(CompareCompilerVersion.cmake)
+compare_compiler_version(Fortran)
diff --git a/Tests/RunCMake/CMP0129/RunCMakeTest.cmake b/Tests/RunCMake/CMP0129/RunCMakeTest.cmake
new file mode 100644
index 0000000000..1b0e11bca2
--- /dev/null
+++ b/Tests/RunCMake/CMP0129/RunCMakeTest.cmake
@@ -0,0 +1,8 @@
+set(RunCMake_TEST_NO_CMP0129 ON)
+include(RunCMake)
+
+foreach(lang C CXX Fortran)
+ run_cmake(${lang})
+ run_cmake_with_options(${lang} "-DSET_CMP0129=NEW")
+ run_cmake_with_options(${lang} "-DSET_CMP0129=OLD")
+endforeach()
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index e24ef58501..5dc7031b97 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -256,7 +256,7 @@ endif()
add_RunCMake_test(ArtifactOutputDirs)
if(NOT DEFINED CMake_TEST_BuildDepends_GNU_AS
- AND CMAKE_C_COMPILER_ID STREQUAL "GNU"
+ AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "LCC")
AND CMAKE_GENERATOR MATCHES "^Ninja"
)
execute_process(COMMAND "${CMAKE_C_COMPILER}" -print-prog-name=as
@@ -345,9 +345,8 @@ if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG AND CMAKE_EXECUTABLE_FORMAT STRE
add_RunCMake_test(RuntimePath)
endif()
add_RunCMake_test(ScriptMode)
-add_RunCMake_test(Swift -DCMAKE_Swift_COMPILER=${CMAKE_Swift_COMPILER})
+add_RunCMake_test(Swift -DCMAKE_Swift_COMPILER=${CMAKE_Swift_COMPILER} -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
add_RunCMake_test(TargetObjects)
-add_RunCMake_test(TargetSources)
add_RunCMake_test(TargetProperties)
add_RunCMake_test(ToolchainFile)
add_RunCMake_test(find_dependency)
@@ -682,7 +681,7 @@ set_property(TEST RunCMake.CheckCompilerFlag
add_RunCMake_test(CheckModules)
add_RunCMake_test(CheckIPOSupported)
if (CMAKE_SYSTEM_NAME MATCHES "(Linux|Darwin)"
- AND (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU" OR CMAKE_Fortran_COMPILER_ID MATCHES "GNU"))
+ AND (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU|LCC" OR CMAKE_Fortran_COMPILER_ID MATCHES "GNU|LCC"))
add_RunCMake_test(CheckLinkerFlag -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
-DCMAKE_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID}
-DCMake_TEST_CUDA=${CMake_TEST_CUDA}
@@ -928,3 +927,7 @@ endif()
if(WIN32)
add_RunCMake_test(Win32GenEx)
endif()
+
+if("${CMAKE_C_COMPILER_ID}" STREQUAL "LCC" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "LCC" OR "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "LCC")
+ add_RunCMake_test("CMP0129")
+endif()
diff --git a/Tests/RunCMake/CPack/CMakeLists.txt b/Tests/RunCMake/CPack/CMakeLists.txt
index 1b3dbb2282..c81b34ecd6 100644
--- a/Tests/RunCMake/CPack/CMakeLists.txt
+++ b/Tests/RunCMake/CPack/CMakeLists.txt
@@ -1,5 +1,9 @@
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
+if(POLICY CMP0129)
+ cmake_policy(SET CMP0129 NEW)
+endif()
+
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "")
project(${RunCMake_TEST} CXX)
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index 7997c785f0..eb9ff03978 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -3,13 +3,22 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
include(RunCMake)
include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake")
+# A debugedit binary is required for these tests, so skip them if it's not found
+find_program(DEBUGEDIT debugedit)
+
# run_cpack_test args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP "PACKAGING_TYPES"
run_cpack_test(CUSTOM_BINARY_SPEC_FILE "RPM.CUSTOM_BINARY_SPEC_FILE" false "MONOLITHIC;COMPONENT")
run_cpack_test(CUSTOM_NAMES "RPM.CUSTOM_NAMES;DEB.CUSTOM_NAMES;TGZ;DragNDrop" true "COMPONENT")
-run_cpack_test(DEBUGINFO "RPM.DEBUGINFO;DEB.DEBUGINFO" true "COMPONENT")
+run_cpack_test(DEBUGINFO "DEB.DEBUGINFO" true "COMPONENT")
+if(NOT "${DEBUGEDIT}" STREQUAL "DEBUGEDIT-NOTFOUND")
+ run_cpack_test(DEBUGINFO "RPM.DEBUGINFO" true "COMPONENT")
+endif()
run_cpack_test(DEBUGINFO "DEB.DEBUGINFO" true "MONOLITHIC")
run_cpack_test_subtests(DEFAULT_PERMISSIONS "CMAKE_var_set;CPACK_var_set;both_set;invalid_CMAKE_var;invalid_CPACK_var" "RPM.DEFAULT_PERMISSIONS;DEB.DEFAULT_PERMISSIONS" false "MONOLITHIC;COMPONENT")
-run_cpack_test(DEPENDENCIES "RPM.DEPENDENCIES;DEB.DEPENDENCIES" true "COMPONENT")
+run_cpack_test(DEPENDENCIES "DEB.DEPENDENCIES" true "COMPONENT")
+if(NOT "${DEBUGEDIT}" STREQUAL "DEBUGEDIT-NOTFOUND")
+ run_cpack_test(DEPENDENCIES "RPM.DEPENDENCIES" true "COMPONENT")
+endif()
run_cpack_test(DIST "RPM.DIST" false "MONOLITHIC")
run_cpack_test(DMG_SLA "DragNDrop" false "MONOLITHIC")
run_cpack_test(EMPTY_DIR "RPM.EMPTY_DIR;DEB.EMPTY_DIR;TGZ" true "MONOLITHIC;COMPONENT")
@@ -17,7 +26,10 @@ run_cpack_test(VERSION "RPM.VERSION;DEB.VERSION" false "MONOLITHIC;COMPONENT")
run_cpack_test(EXTRA "DEB.EXTRA" false "COMPONENT")
run_cpack_test_subtests(GENERATE_SHLIBS "soversion_not_zero;soversion_zero" "DEB.GENERATE_SHLIBS" true "COMPONENT")
run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB.GENERATE_SHLIBS_LDCONFIG" true "COMPONENT")
-run_cpack_test_subtests(INSTALL_SCRIPTS "default;single_debug_info;no_scripts;no_scripts_single_debug_info" "RPM.INSTALL_SCRIPTS" false "COMPONENT")
+run_cpack_test_subtests(INSTALL_SCRIPTS "default;no_scripts" "RPM.INSTALL_SCRIPTS" false "COMPONENT")
+if(NOT "${DEBUGEDIT}" STREQUAL "DEBUGEDIT-NOTFOUND")
+ run_cpack_test_subtests(INSTALL_SCRIPTS "single_debug_info;no_scripts_single_debug_info" "RPM.INSTALL_SCRIPTS" false "COMPONENT")
+endif()
run_cpack_test(LONG_FILENAMES "DEB.LONG_FILENAMES" false "MONOLITHIC")
run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM.MAIN_COMPONENT" false "COMPONENT")
run_cpack_test(MINIMAL "RPM.MINIMAL;DEB.MINIMAL;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External" false "MONOLITHIC;COMPONENT")
@@ -27,8 +39,13 @@ run_cpack_test_package_target(THREADED "TXZ;DEB" false "MONOLITHIC;COMPONENT")
run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512" "TGZ" false "MONOLITHIC")
run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM.PARTIALLY_RELOCATABLE_WARNING" false "COMPONENT")
run_cpack_test(PER_COMPONENT_FIELDS "RPM.PER_COMPONENT_FIELDS;DEB.PER_COMPONENT_FIELDS" false "COMPONENT")
-run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component;one_component;one_component_main;no_debuginfo;one_component_no_debuginfo;no_components;valid" "RPM.SINGLE_DEBUGINFO" true "CUSTOM")
-run_cpack_test(EXTRA_SLASH_IN_PATH "RPM.EXTRA_SLASH_IN_PATH" true "COMPONENT")
+run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component" "RPM.SINGLE_DEBUGINFO" true "CUSTOM")
+if(NOT "${DEBUGEDIT}" STREQUAL "DEBUGEDIT-NOTFOUND")
+ run_cpack_test_subtests(SINGLE_DEBUGINFO "one_component;one_component_main;no_debuginfo;one_component_no_debuginfo;no_components;valid" "RPM.SINGLE_DEBUGINFO" true "CUSTOM")
+endif()
+if(NOT "${DEBUGEDIT}" STREQUAL "DEBUGEDIT-NOTFOUND")
+ run_cpack_test(EXTRA_SLASH_IN_PATH "RPM.EXTRA_SLASH_IN_PATH" true "COMPONENT")
+endif()
run_cpack_source_test(SOURCE_PACKAGE "RPM.SOURCE_PACKAGE")
run_cpack_test(SUGGESTS "RPM.SUGGESTS" false "MONOLITHIC")
run_cpack_test(SYMLINKS "RPM.SYMLINKS;TGZ" false "MONOLITHIC;COMPONENT")
diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake
index e9cebbf8d6..1d21dec117 100644
--- a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake
+++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake
@@ -1,7 +1,7 @@
set(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
# Some compilers do not add build id to binaries by default.
-if(CMAKE_CXX_COMPILER_ID MATCHES "^(IntelLLVM|PGI|NVHPC)$")
+if(CMAKE_CXX_COMPILER_ID MATCHES "^(LCC|IntelLLVM|PGI|NVHPC)$")
string(APPEND CMAKE_EXE_LINKER_FLAGS "-Wl,--build-id")
string(APPEND CMAKE_SHARED_LINKER_FLAGS "-Wl,--build-id")
endif()
diff --git a/Tests/RunCMake/CPack/tests/DEPENDENCIES/DEB-stderr.txt b/Tests/RunCMake/CPack/tests/DEPENDENCIES/DEB-stderr.txt
index 5df274a45b..df777eac54 100644
--- a/Tests/RunCMake/CPack/tests/DEPENDENCIES/DEB-stderr.txt
+++ b/Tests/RunCMake/CPack/tests/DEPENDENCIES/DEB-stderr.txt
@@ -1 +1,2 @@
-^CPackDeb: ((- Generating dependency list)|(Using only user-provided dependencies because dpkg-shlibdeps is not found\.))$
+^CPackDeb: ((- Generating dependency list)(
+CMake Warning.*broken dpkg-shlibdeps on E2K detected.*\(cpack_deb_prepare_package_vars\))?|(Using only user-provided dependencies because dpkg-shlibdeps is not found\.))$
diff --git a/Tests/RunCMake/CheckCompilerFlag/CMakeLists.txt b/Tests/RunCMake/CheckCompilerFlag/CMakeLists.txt
index 0421e28036..30cb9aebf0 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CMakeLists.txt
+++ b/Tests/RunCMake/CheckCompilerFlag/CMakeLists.txt
@@ -1,5 +1,9 @@
cmake_minimum_required(VERSION 3.13)
+if(POLICY CMP0129)
+ cmake_policy(SET CMP0129 NEW)
+endif()
+
project(${RunCMake_TEST} LANGUAGES NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake
index 6483f1123c..79d67e5312 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake
@@ -9,14 +9,14 @@ if(SHOULD_FAIL)
message(SEND_ERROR "invalid C compile flag didn't fail.")
endif()
-if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang" AND NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
+if(CMAKE_C_COMPILER_ID MATCHES "GNU|LCC|Clang" AND NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
check_compiler_flag(C "-x c" SHOULD_WORK)
if(NOT SHOULD_WORK)
message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-x c' check failed")
endif()
endif()
-if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU") # LCC C compiler silently ignore -frtti instead of failing, so skip it here.
check_compiler_flag(C "-frtti" SHOULD_FAIL_RTTI)
if(SHOULD_FAIL_RTTI)
message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-frtti' check passed but should have failed")
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake
index 60e9755b35..4b20ebd1b0 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake
@@ -9,7 +9,7 @@ if(SHOULD_FAIL)
message(SEND_ERROR "invalid CXX compile flag didn't fail.")
endif()
-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC|Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
check_compiler_flag(CXX "-x c++" SHOULD_WORK)
if(NOT SHOULD_WORK)
message(SEND_ERROR "${CMAKE_CXX_COMPILER_ID} compiler flag '-x c++' check failed")
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake
index 7bb88b19d6..236f37b544 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake
@@ -8,7 +8,7 @@ if(SHOULD_FAIL)
message(SEND_ERROR "invalid Fortran compile flag didn't fail.")
endif()
-if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
+if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU|LCC")
check_compiler_flag(Fortran "-Wall" SHOULD_WORK)
if(NOT SHOULD_WORK)
message(SEND_ERROR "${CMAKE_Fortran_COMPILER_ID} compiler flag '-Wall' check failed")
diff --git a/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake b/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake
index 5e5bff6c90..39fc430972 100644
--- a/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake
@@ -1,6 +1,6 @@
include(RunCMake)
-if (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
+if (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU|LCC")
run_cmake(CheckCLinkerFlag)
run_cmake(CheckCXXLinkerFlag)
if (APPLE)
@@ -9,7 +9,7 @@ if (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
endif()
endif()
-if (CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
+if (CMAKE_Fortran_COMPILER_ID MATCHES "GNU|LCC")
run_cmake(CheckFortranLinkerFlag)
endif()
diff --git a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt
index 3df3e523d6..6a932f1e95 100644
--- a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt
+++ b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt
@@ -1 +1 @@
-^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":3}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]},{"kind":"toolchains","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":false,"version":{.*}}$
+^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":4}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]},{"kind":"toolchains","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":false,"version":{.*}}$
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index dc066f1d1f..74cd90aae4 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -247,8 +247,14 @@ function(run_BuildDir)
run_cmake_command(BuildDir--build-jobs-no-number-trailing--target ${CMAKE_COMMAND} -E chdir ..
${CMAKE_COMMAND} --build BuildDir-build -j --target CustomTarget)
if(RunCMake_GENERATOR MATCHES "Unix Makefiles" OR RunCMake_GENERATOR MATCHES "Ninja")
+ set(_backup_lang "$ENV{LANG}")
+ set(_backup_lc_messages "$ENV{LC_MESSAGES}")
+ set(ENV{LANG} "C")
+ set(ENV{LC_MESSAGES} "C")
run_cmake_command(BuildDir--build-jobs-no-number-trailing--invalid-target ${CMAKE_COMMAND} -E chdir ..
${CMAKE_COMMAND} --build BuildDir-build -j --target invalid-target)
+ set(ENV{LANG} "${_backup_lang}")
+ set(ENV{LC_MESSAGES} "${_backup_lc_messages}")
endif()
run_cmake_command(BuildDir--build--parallel-no-number ${CMAKE_COMMAND} -E chdir ..
${CMAKE_COMMAND} --build BuildDir-build --parallel)
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py
index 6cf57a3a96..b31088d244 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py
@@ -12,7 +12,7 @@ def read_codemodel_json_data(filename):
def check_objects(o, g):
assert is_list(o)
assert len(o) == 1
- check_index_object(o[0], "codemodel", 2, 3, check_object_codemodel(g))
+ check_index_object(o[0], "codemodel", 2, 4, check_object_codemodel(g))
def check_backtrace(t, b, backtrace):
btg = t["backtraceGraph"]
@@ -188,6 +188,31 @@ def check_directory(c):
expected_keys.append("runtimeDependencySetType")
assert is_string(a["runtimeDependencySetType"], e["runtimeDependencySetType"])
+ if e.get("fileSetName", None) is not None:
+ expected_keys.append("fileSetName")
+ assert is_string(a["fileSetName"], e["fileSetName"])
+
+ if e.get("fileSetType", None) is not None:
+ expected_keys.append("fileSetType")
+ assert is_string(a["fileSetType"], e["fileSetType"])
+
+ if e.get("fileSetDirectories", None) is not None:
+ expected_keys.append("fileSetDirectories")
+ assert is_list(a["fileSetDirectories"])
+ assert len(a["fileSetDirectories"]) == len(e["fileSetDirectories"])
+ for ad, ed in zip(a["fileSetDirectories"], e["fileSetDirectories"]):
+ assert matches(ad, ed)
+
+ if e.get("fileSetTarget", None) is not None:
+ expected_keys.append("fileSetTarget")
+ et = e["fileSetTarget"]
+ at = a["fileSetTarget"]
+ assert is_dict(at)
+ assert sorted(at.keys()) == ["id", "index"]
+ assert matches(at["id"], et["id"])
+ assert is_int(at["index"])
+ assert c["targets"][at["index"]]["name"] == et["index"]
+
if e["backtrace"] is not None:
expected_keys.append("backtrace")
check_backtrace(d, a["backtrace"], e["backtrace"])
@@ -628,6 +653,7 @@ def gen_check_directories(c, g):
read_codemodel_json_data("directories/dir.json"),
read_codemodel_json_data("directories/dir_dir.json"),
read_codemodel_json_data("directories/external.json"),
+ read_codemodel_json_data("directories/fileset.json"),
]
if matches(g["name"], "^Visual Studio "):
@@ -729,9 +755,12 @@ def gen_check_targets(c, g, inSource):
read_codemodel_json_data("targets/all_build_external.json"),
read_codemodel_json_data("targets/zero_check_external.json"),
read_codemodel_json_data("targets/generated_exe.json"),
+
+ read_codemodel_json_data("targets/c_headers_1.json"),
+ read_codemodel_json_data("targets/c_headers_2.json"),
]
- if cxx_compiler_id in ['Clang', 'AppleClang', 'GNU', 'Intel', 'IntelLLVM', 'MSVC', 'Embarcadero'] and g["name"] != "Xcode":
+ if cxx_compiler_id in ['Clang', 'AppleClang', 'LCC', 'GNU', 'Intel', 'IntelLLVM', 'MSVC', 'Embarcadero'] and g["name"] != "Xcode":
for e in expected:
if e["name"] == "cxx_exe":
if matches(g["name"], "^(Visual Studio |Ninja Multi-Config)"):
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json
new file mode 100644
index 0000000000..4774a13e90
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json
@@ -0,0 +1,203 @@
+{
+ "source": "^fileset$",
+ "build": "^fileset$",
+ "parentSource": "^\\.$",
+ "childSources": null,
+ "targetIds": [
+ "^c_headers_1::@6b8db101d64c125f29fe$",
+ "^c_headers_2::@6b8db101d64c125f29fe$"
+ ],
+ "projectName": "codemodel-v2",
+ "minimumCMakeVersion": "3.12",
+ "hasInstallRule": true,
+ "installers": [
+ {
+ "component": "Unspecified",
+ "type": "target",
+ "destination": "lib",
+ "paths": [
+ "^fileset/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib)?c_headers_1\\.(a|lib)?$"
+ ],
+ "isExcludeFromAll": null,
+ "isForAllComponents": null,
+ "isOptional": null,
+ "targetId": "^c_headers_1::@6b8db101d64c125f29fe$",
+ "targetIndex": "c_headers_1",
+ "targetIsImportLibrary": null,
+ "targetInstallNamelink": null,
+ "exportName": null,
+ "exportTargets": null,
+ "scriptFile": null,
+ "backtrace": [
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": 20,
+ "command": "install",
+ "hasParent": true
+ },
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ },
+ {
+ "component": "Headers",
+ "type": "fileSet",
+ "destination": "include",
+ "paths": [
+ "^fileset/error\\.c$",
+ "^fileset/other\\.c$"
+ ],
+ "isExcludeFromAll": null,
+ "isForAllComponents": null,
+ "isOptional": null,
+ "targetId": null,
+ "targetIndex": null,
+ "targetIsImportLibrary": null,
+ "targetInstallNamelink": null,
+ "exportName": null,
+ "exportTargets": null,
+ "scriptFile": null,
+ "fileSetName": "HEADERS",
+ "fileSetType": "HEADERS",
+ "fileSetDirectories": [
+ "^fileset$"
+ ],
+ "fileSetTarget": {
+ "id": "^c_headers_1::@6b8db101d64c125f29fe$",
+ "index": "c_headers_1"
+ },
+ "backtrace": [
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": 20,
+ "command": "install",
+ "hasParent": true
+ },
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ },
+ {
+ "component": "Unspecified",
+ "type": "fileSet",
+ "destination": "include/dir",
+ "paths": [
+ "^fileset/dir/h2\\.h$"
+ ],
+ "isExcludeFromAll": null,
+ "isForAllComponents": null,
+ "isOptional": null,
+ "targetId": null,
+ "targetIndex": null,
+ "targetIsImportLibrary": null,
+ "targetInstallNamelink": null,
+ "exportName": null,
+ "exportTargets": null,
+ "scriptFile": null,
+ "fileSetName": "b",
+ "fileSetType": "HEADERS",
+ "fileSetDirectories": [
+ "^fileset/dir$"
+ ],
+ "fileSetTarget": {
+ "id": "^c_headers_1::@6b8db101d64c125f29fe$",
+ "index": "c_headers_1"
+ },
+ "backtrace": [
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": 20,
+ "command": "install",
+ "hasParent": true
+ },
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ },
+ {
+ "component": "Unspecified",
+ "type": "fileSet",
+ "destination": "include",
+ "paths": [
+ "^fileset/h3\\.h$"
+ ],
+ "isExcludeFromAll": null,
+ "isForAllComponents": null,
+ "isOptional": null,
+ "targetId": null,
+ "targetIndex": null,
+ "targetIsImportLibrary": null,
+ "targetInstallNamelink": null,
+ "exportName": null,
+ "exportTargets": null,
+ "scriptFile": null,
+ "fileSetName": "c",
+ "fileSetType": "HEADERS",
+ "fileSetDirectories": [
+ "^fileset$"
+ ],
+ "fileSetTarget": {
+ "id": "^c_headers_1::@6b8db101d64c125f29fe$",
+ "index": "c_headers_1"
+ },
+ "backtrace": [
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": 20,
+ "command": "install",
+ "hasParent": true
+ },
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ },
+ {
+ "component": "Unspecified",
+ "type": "target",
+ "destination": "lib",
+ "paths": [
+ "^fileset/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib)?c_headers_2\\.(a|lib)?$"
+ ],
+ "isExcludeFromAll": null,
+ "isForAllComponents": null,
+ "isOptional": null,
+ "targetId": "^c_headers_2::@6b8db101d64c125f29fe$",
+ "targetIndex": "c_headers_2",
+ "targetIsImportLibrary": null,
+ "targetInstallNamelink": null,
+ "exportName": null,
+ "exportTargets": null,
+ "scriptFile": null,
+ "backtrace": [
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": 25,
+ "command": "install",
+ "hasParent": true
+ },
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ }
+ ]
+}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json
index 99287fb6f0..22b4536775 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json
@@ -10,7 +10,8 @@
"^interface$",
"^object$",
"^.*/Tests/RunCMake/FileAPIExternalSource$",
- "^dir$"
+ "^dir$",
+ "^fileset$"
],
"targetIds": [
"^ALL_BUILD::@6890427a1f51a3e7e1df$",
@@ -47,7 +48,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 38,
+ "line": 39,
"command": "install",
"hasParent": true
},
@@ -92,7 +93,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 41,
+ "line": 42,
"command": "install",
"hasParent": true
},
@@ -140,7 +141,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 41,
+ "line": 42,
"command": "install",
"hasParent": true
},
@@ -185,7 +186,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 41,
+ "line": 42,
"command": "install",
"hasParent": true
},
@@ -229,7 +230,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 41,
+ "line": 42,
"command": "install",
"hasParent": true
},
@@ -273,7 +274,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 46,
+ "line": 47,
"command": "install",
"hasParent": true
},
@@ -320,7 +321,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 48,
+ "line": 49,
"command": "install",
"hasParent": true
},
@@ -365,7 +366,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 49,
+ "line": 50,
"command": "install",
"hasParent": true
},
@@ -414,7 +415,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 50,
+ "line": 51,
"command": "install",
"hasParent": true
},
@@ -466,7 +467,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 51,
+ "line": 52,
"command": "install",
"hasParent": true
},
@@ -515,7 +516,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 52,
+ "line": 53,
"command": "install",
"hasParent": true
},
@@ -557,7 +558,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 53,
+ "line": 54,
"command": "install",
"hasParent": true
},
@@ -599,7 +600,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 54,
+ "line": 55,
"command": "install",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json
index 4d0cdc0564..0d6c4a16d3 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json
@@ -13,7 +13,8 @@
"directorySources": [
"^\\.$",
"^dir$",
- "^dir/dir$"
+ "^dir/dir$",
+ "^fileset$"
],
"targetIds": [
"^ALL_BUILD::@6890427a1f51a3e7e1df$",
@@ -24,6 +25,8 @@
"^c_shared_lib::@6890427a1f51a3e7e1df$",
"^c_shared_exe::@6890427a1f51a3e7e1df$",
"^c_static_lib::@6890427a1f51a3e7e1df$",
- "^c_static_exe::@6890427a1f51a3e7e1df$"
+ "^c_static_exe::@6890427a1f51a3e7e1df$",
+ "^c_headers_1::@6b8db101d64c125f29fe$",
+ "^c_headers_2::@6b8db101d64c125f29fe$"
]
}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json
index d023f99a72..4e772a7f73 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json
@@ -186,6 +186,14 @@
{
"id": "^generated_exe::@[0-9a-f]+$",
"backtrace": null
+ },
+ {
+ "id": "^c_headers_1::@6b8db101d64c125f29fe$",
+ "backtrace": null
+ },
+ {
+ "id": "^c_headers_2::@6b8db101d64c125f29fe$",
+ "backtrace": null
}
]
}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json
new file mode 100644
index 0000000000..c18962364a
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json
@@ -0,0 +1,231 @@
+{
+ "name": "c_headers_1",
+ "id": "^c_headers_1::@6b8db101d64c125f29fe$",
+ "directorySource": "^fileset$",
+ "projectName": "codemodel-v2",
+ "type": "STATIC_LIBRARY",
+ "isGeneratorProvided": null,
+ "sources": [
+ {
+ "path": "^fileset/empty\\.c$",
+ "isGenerated": null,
+ "sourceGroupName": "Source Files",
+ "compileGroupLanguage": "C",
+ "backtrace": [
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": 1,
+ "command": "add_library",
+ "hasParent": true
+ },
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ },
+ {
+ "path": "^fileset/error\\.c$",
+ "isGenerated": null,
+ "sourceGroupName": "Header Files",
+ "compileGroupLanguage": null,
+ "backtrace": [
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": 3,
+ "command": "target_sources",
+ "hasParent": true
+ },
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ },
+ {
+ "path": "^fileset/other\\.c$",
+ "isGenerated": null,
+ "sourceGroupName": "Source Files",
+ "compileGroupLanguage": null,
+ "backtrace": [
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": 3,
+ "command": "target_sources",
+ "hasParent": true
+ },
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ },
+ {
+ "path": "^fileset/h1\\.h$",
+ "isGenerated": null,
+ "sourceGroupName": "Header Files",
+ "compileGroupLanguage": null,
+ "backtrace": [
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": 3,
+ "command": "target_sources",
+ "hasParent": true
+ },
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ },
+ {
+ "path": "^fileset/dir/h2\\.h$",
+ "isGenerated": null,
+ "sourceGroupName": "Header Files",
+ "compileGroupLanguage": null,
+ "backtrace": [
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": 7,
+ "command": "target_sources",
+ "hasParent": true
+ },
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ }
+ ],
+ "sourceGroups": [
+ {
+ "name": "Source Files",
+ "sourcePaths": [
+ "^fileset/empty\\.c$",
+ "^fileset/other\\.c$"
+ ]
+ },
+ {
+ "name": "Header Files",
+ "sourcePaths": [
+ "^fileset/error\\.c$",
+ "^fileset/h1\\.h$",
+ "^fileset/dir/h2\\.h$"
+ ]
+ }
+ ],
+ "compileGroups": [
+ {
+ "language": "C",
+ "sourcePaths": [
+ "^fileset/empty\\.c$"
+ ],
+ "includes": [
+ {
+ "path": "^.*/Tests/RunCMake/FileAPI/fileset$",
+ "isSystem": null,
+ "backtrace": [
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": 3,
+ "command": "target_sources",
+ "hasParent": true
+ },
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ },
+ {
+ "path": "^.*/Tests/RunCMake/FileAPI/fileset/dir$",
+ "isSystem": null,
+ "backtrace": [
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": 7,
+ "command": "target_sources",
+ "hasParent": true
+ },
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ }
+ ],
+ "defines": null,
+ "compileCommandFragments": null
+ }
+ ],
+ "backtrace": [
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": 1,
+ "command": "add_library",
+ "hasParent": true
+ },
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ],
+ "folder": null,
+ "nameOnDisk": "^(lib)?c_headers_1\\.(a|lib)$",
+ "artifacts": [
+ {
+ "path": "^fileset/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_headers_1\\.(a|lib)$",
+ "_dllExtra": false
+ }
+ ],
+ "build": "^fileset$",
+ "source": "^fileset$",
+ "install": {
+ "prefix": "^(/usr/local|[A-Za-z]:.*/codemodel-v2)$",
+ "destinations": [
+ {
+ "path": "lib",
+ "backtrace": [
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": 20,
+ "command": "install",
+ "hasParent": true
+ },
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ }
+ ]
+ },
+ "link": null,
+ "archive": {
+ "lto": null
+ },
+ "dependencies": [
+ {
+ "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$",
+ "backtrace": null
+ }
+ ]
+}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json
new file mode 100644
index 0000000000..75fe58c5a2
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json
@@ -0,0 +1,105 @@
+{
+ "name": "c_headers_2",
+ "id": "^c_headers_2::@6b8db101d64c125f29fe$",
+ "directorySource": "^fileset$",
+ "projectName": "codemodel-v2",
+ "type": "STATIC_LIBRARY",
+ "isGeneratorProvided": null,
+ "sources": [
+ {
+ "path": "^fileset/empty\\.c$",
+ "isGenerated": null,
+ "sourceGroupName": "Source Files",
+ "compileGroupLanguage": "C",
+ "backtrace": [
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": 15,
+ "command": "add_library",
+ "hasParent": true
+ },
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ }
+ ],
+ "sourceGroups": [
+ {
+ "name": "Source Files",
+ "sourcePaths": [
+ "^fileset/empty\\.c$"
+ ]
+ }
+ ],
+ "compileGroups": [
+ {
+ "language": "C",
+ "sourcePaths": [
+ "^fileset/empty\\.c$"
+ ],
+ "includes": null,
+ "defines": null,
+ "compileCommandFragments": null
+ }
+ ],
+ "backtrace": [
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": 15,
+ "command": "add_library",
+ "hasParent": true
+ },
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ],
+ "folder": null,
+ "nameOnDisk": "^(lib)?c_headers_2\\.(a|lib)$",
+ "artifacts": [
+ {
+ "path": "^fileset/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_headers_2\\.(a|lib)$",
+ "_dllExtra": false
+ }
+ ],
+ "build": "^fileset$",
+ "source": "^fileset$",
+ "install": {
+ "prefix": "^(/usr/local|[A-Za-z]:.*/codemodel-v2)$",
+ "destinations": [
+ {
+ "path": "lib",
+ "backtrace": [
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": 25,
+ "command": "install",
+ "hasParent": true
+ },
+ {
+ "file": "^fileset/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ }
+ ]
+ },
+ "link": null,
+ "archive": {
+ "lto": null
+ },
+ "dependencies": [
+ {
+ "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$",
+ "backtrace": null
+ }
+ ]
+}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json
index e3a8d0b2de..b4318ddfdc 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json
@@ -115,7 +115,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 41,
+ "line": 42,
"command": "install",
"hasParent": true
},
@@ -145,7 +145,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 41,
+ "line": 42,
"command": "install",
"hasParent": true
},
@@ -175,7 +175,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 46,
+ "line": 47,
"command": "install",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json
index 385fa622dd..5769f0cda3 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json
@@ -136,7 +136,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 38,
+ "line": 39,
"command": "install",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json
index 73e8e127b8..1fe4d678c8 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json
@@ -91,7 +91,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 41,
+ "line": 42,
"command": "install",
"hasParent": true
},
@@ -121,7 +121,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 41,
+ "line": 42,
"command": "install",
"hasParent": true
},
@@ -151,7 +151,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 46,
+ "line": 47,
"command": "install",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2.cmake b/Tests/RunCMake/FileAPI/codemodel-v2.cmake
index da928ebfc8..019eb87629 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2.cmake
+++ b/Tests/RunCMake/FileAPI/codemodel-v2.cmake
@@ -22,6 +22,7 @@ add_subdirectory(interface)
add_subdirectory(custom)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../FileAPIExternalSource" "${CMAKE_CURRENT_BINARY_DIR}/../FileAPIExternalBuild")
add_subdirectory(dir)
+add_subdirectory(fileset)
set_property(TARGET c_shared_lib PROPERTY LIBRARY_OUTPUT_DIRECTORY lib)
set_property(TARGET c_shared_lib PROPERTY RUNTIME_OUTPUT_DIRECTORY lib)
diff --git a/Tests/RunCMake/FileAPI/fileset/CMakeLists.txt b/Tests/RunCMake/FileAPI/fileset/CMakeLists.txt
new file mode 100644
index 0000000000..f80f12bee1
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/fileset/CMakeLists.txt
@@ -0,0 +1,25 @@
+add_library(c_headers_1 STATIC empty.c)
+
+target_sources(c_headers_1
+ PUBLIC FILE_SET HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES error.c other.c
+ PRIVATE FILE_SET a TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES h1.h
+ )
+target_sources(c_headers_1
+ PUBLIC FILE_SET b TYPE HEADERS BASE_DIRS "$<1:${CMAKE_CURRENT_SOURCE_DIR}/dir>" FILES "$<1:${CMAKE_CURRENT_SOURCE_DIR}/dir/h2.h>"
+ )
+target_sources(c_headers_1
+ INTERFACE FILE_SET c TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES h3.h
+ )
+source_group("Source Files" FILES "${CMAKE_CURRENT_SOURCE_DIR}/other.c")
+
+add_library(c_headers_2 STATIC empty.c)
+target_sources(c_headers_2
+ INTERFACE FILE_SET HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES h1.h
+ )
+
+install(TARGETS c_headers_1
+ FILE_SET HEADERS DESTINATION include COMPONENT Headers
+ FILE_SET b DESTINATION include/dir
+ FILE_SET c
+ )
+install(TARGETS c_headers_2)
diff --git a/Tests/RunCMake/FileAPI/fileset/dir/h2.h b/Tests/RunCMake/FileAPI/fileset/dir/h2.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/fileset/dir/h2.h
diff --git a/Tests/RunCMake/FileAPI/fileset/empty.c b/Tests/RunCMake/FileAPI/fileset/empty.c
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/fileset/empty.c
diff --git a/Tests/RunCMake/FileAPI/fileset/error.c b/Tests/RunCMake/FileAPI/fileset/error.c
new file mode 100644
index 0000000000..f10e687006
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/fileset/error.c
@@ -0,0 +1 @@
+#error "This should not be compiled"
diff --git a/Tests/RunCMake/FileAPI/fileset/h1.h b/Tests/RunCMake/FileAPI/fileset/h1.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/fileset/h1.h
diff --git a/Tests/RunCMake/FileAPI/fileset/h3.h b/Tests/RunCMake/FileAPI/fileset/h3.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/fileset/h3.h
diff --git a/Tests/RunCMake/FileAPI/fileset/other.c b/Tests/RunCMake/FileAPI/fileset/other.c
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/fileset/other.c
diff --git a/Tests/RunCMake/FindBoost/CMP0093-OLD-stderr.txt b/Tests/RunCMake/FindBoost/CMP0093-OLD-stderr.txt
new file mode 100644
index 0000000000..899122e97b
--- /dev/null
+++ b/Tests/RunCMake/FindBoost/CMP0093-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0093-OLD.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0093 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/GNUInstallDirs/Opt-FreeBSD-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Opt-FreeBSD-stderr.txt
index feb747b182..3e1841060f 100644
--- a/Tests/RunCMake/GNUInstallDirs/Opt-FreeBSD-stderr.txt
+++ b/Tests/RunCMake/GNUInstallDirs/Opt-FreeBSD-stderr.txt
@@ -9,7 +9,7 @@ CMAKE_INSTALL_LIBEXECDIR='libexec'
CMAKE_INSTALL_LOCALEDIR='share/locale'
CMAKE_INSTALL_LOCALSTATEDIR='var'
CMAKE_INSTALL_RUNSTATEDIR='var/run'
-CMAKE_INSTALL_MANDIR='man'
+CMAKE_INSTALL_MANDIR='share/man'
CMAKE_INSTALL_SBINDIR='sbin'
CMAKE_INSTALL_SHAREDSTATEDIR='com'
CMAKE_INSTALL_SYSCONFDIR='etc'
@@ -24,7 +24,7 @@ CMAKE_INSTALL_FULL_LIBEXECDIR='/opt/Opt/libexec'
CMAKE_INSTALL_FULL_LOCALEDIR='/opt/Opt/share/locale'
CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var/opt/Opt'
CMAKE_INSTALL_FULL_RUNSTATEDIR='/var/run/opt/Opt'
-CMAKE_INSTALL_FULL_MANDIR='/opt/Opt/man'
+CMAKE_INSTALL_FULL_MANDIR='/opt/Opt/share/man'
CMAKE_INSTALL_FULL_SBINDIR='/opt/Opt/sbin'
CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/opt/Opt/com'
CMAKE_INSTALL_FULL_SYSCONFDIR='/etc/opt/Opt'$
diff --git a/Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt
index 25f80d3f61..2019459d71 100644
--- a/Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt
+++ b/Tests/RunCMake/GNUInstallDirs/Root-Debian-stderr.txt
@@ -4,7 +4,7 @@ CMAKE_INSTALL_DATAROOTDIR='usr/share'
CMAKE_INSTALL_DOCDIR='usr/share/doc/Root'
CMAKE_INSTALL_INCLUDEDIR='usr/include'
CMAKE_INSTALL_INFODIR='usr/share/info'
-CMAKE_INSTALL_LIBDIR='usr/lib'
+CMAKE_INSTALL_LIBDIR='usr/lib/arch'
CMAKE_INSTALL_LIBEXECDIR='usr/libexec'
CMAKE_INSTALL_LOCALEDIR='usr/share/locale'
CMAKE_INSTALL_LOCALSTATEDIR='var'
@@ -19,7 +19,7 @@ CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/share'
CMAKE_INSTALL_FULL_DOCDIR='/usr/share/doc/Root'
CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/include'
CMAKE_INSTALL_FULL_INFODIR='/usr/share/info'
-CMAKE_INSTALL_FULL_LIBDIR='/usr/lib'
+CMAKE_INSTALL_FULL_LIBDIR='/usr/lib/arch'
CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec'
CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale'
CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var'
diff --git a/Tests/RunCMake/GNUInstallDirs/Root-FreeBSD-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Root-FreeBSD-stderr.txt
index 4284a15b18..8c133681f1 100644
--- a/Tests/RunCMake/GNUInstallDirs/Root-FreeBSD-stderr.txt
+++ b/Tests/RunCMake/GNUInstallDirs/Root-FreeBSD-stderr.txt
@@ -9,7 +9,7 @@ CMAKE_INSTALL_LIBEXECDIR='usr/libexec'
CMAKE_INSTALL_LOCALEDIR='usr/share/locale'
CMAKE_INSTALL_LOCALSTATEDIR='var'
CMAKE_INSTALL_RUNSTATEDIR='var/run'
-CMAKE_INSTALL_MANDIR='usr/man'
+CMAKE_INSTALL_MANDIR='usr/share/man'
CMAKE_INSTALL_SBINDIR='usr/sbin'
CMAKE_INSTALL_SHAREDSTATEDIR='usr/com'
CMAKE_INSTALL_SYSCONFDIR='etc'
@@ -24,7 +24,7 @@ CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec'
CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale'
CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var'
CMAKE_INSTALL_FULL_RUNSTATEDIR='/var/run'
-CMAKE_INSTALL_FULL_MANDIR='/usr/man'
+CMAKE_INSTALL_FULL_MANDIR='/usr/share/man'
CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin'
CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com'
CMAKE_INSTALL_FULL_SYSCONFDIR='/etc'$
diff --git a/Tests/RunCMake/GNUInstallDirs/Usr-FreeBSD-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Usr-FreeBSD-stderr.txt
index 9efc1103ee..a591436bae 100644
--- a/Tests/RunCMake/GNUInstallDirs/Usr-FreeBSD-stderr.txt
+++ b/Tests/RunCMake/GNUInstallDirs/Usr-FreeBSD-stderr.txt
@@ -9,7 +9,7 @@ CMAKE_INSTALL_LIBEXECDIR='libexec'
CMAKE_INSTALL_LOCALEDIR='share/locale'
CMAKE_INSTALL_LOCALSTATEDIR='var'
CMAKE_INSTALL_RUNSTATEDIR='var/run'
-CMAKE_INSTALL_MANDIR='man'
+CMAKE_INSTALL_MANDIR='share/man'
CMAKE_INSTALL_SBINDIR='sbin'
CMAKE_INSTALL_SHAREDSTATEDIR='com'
CMAKE_INSTALL_SYSCONFDIR='etc'
@@ -24,7 +24,7 @@ CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec'
CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale'
CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var'
CMAKE_INSTALL_FULL_RUNSTATEDIR='/var/run'
-CMAKE_INSTALL_FULL_MANDIR='/usr/man'
+CMAKE_INSTALL_FULL_MANDIR='/usr/share/man'
CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin'
CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com'
CMAKE_INSTALL_FULL_SYSCONFDIR='/etc'$
diff --git a/Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt b/Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt
index 30795c8a95..08301380e0 100644
--- a/Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt
+++ b/Tests/RunCMake/GNUInstallDirs/UsrLocal-Debian-stderr.txt
@@ -4,7 +4,7 @@ CMAKE_INSTALL_DATAROOTDIR='share'
CMAKE_INSTALL_DOCDIR='share/doc/UsrLocal'
CMAKE_INSTALL_INCLUDEDIR='include'
CMAKE_INSTALL_INFODIR='share/info'
-CMAKE_INSTALL_LIBDIR='lib'
+CMAKE_INSTALL_LIBDIR='lib/arch'
CMAKE_INSTALL_LIBEXECDIR='libexec'
CMAKE_INSTALL_LOCALEDIR='share/locale'
CMAKE_INSTALL_LOCALSTATEDIR='var'
@@ -19,7 +19,7 @@ CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/local/share'
CMAKE_INSTALL_FULL_DOCDIR='/usr/local/share/doc/UsrLocal'
CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/local/include'
CMAKE_INSTALL_FULL_INFODIR='/usr/local/share/info'
-CMAKE_INSTALL_FULL_LIBDIR='/usr/local/lib'
+CMAKE_INSTALL_FULL_LIBDIR='/usr/local/lib/arch'
CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/local/libexec'
CMAKE_INSTALL_FULL_LOCALEDIR='/usr/local/share/locale'
CMAKE_INSTALL_FULL_LOCALSTATEDIR='/usr/local/var'
diff --git a/Tests/RunCMake/GNUInstallDirs/UsrLocal-FreeBSD-stderr.txt b/Tests/RunCMake/GNUInstallDirs/UsrLocal-FreeBSD-stderr.txt
index 505bf08efc..f957e0e538 100644
--- a/Tests/RunCMake/GNUInstallDirs/UsrLocal-FreeBSD-stderr.txt
+++ b/Tests/RunCMake/GNUInstallDirs/UsrLocal-FreeBSD-stderr.txt
@@ -9,7 +9,7 @@ CMAKE_INSTALL_LIBEXECDIR='libexec'
CMAKE_INSTALL_LOCALEDIR='share/locale'
CMAKE_INSTALL_LOCALSTATEDIR='var'
CMAKE_INSTALL_RUNSTATEDIR='var/run'
-CMAKE_INSTALL_MANDIR='man'
+CMAKE_INSTALL_MANDIR='share/man'
CMAKE_INSTALL_SBINDIR='sbin'
CMAKE_INSTALL_SHAREDSTATEDIR='com'
CMAKE_INSTALL_SYSCONFDIR='etc'
@@ -24,7 +24,7 @@ CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/local/libexec'
CMAKE_INSTALL_FULL_LOCALEDIR='/usr/local/share/locale'
CMAKE_INSTALL_FULL_LOCALSTATEDIR='/usr/local/var'
CMAKE_INSTALL_FULL_RUNSTATEDIR='/usr/local/var/run'
-CMAKE_INSTALL_FULL_MANDIR='/usr/local/man'
+CMAKE_INSTALL_FULL_MANDIR='/usr/local/share/man'
CMAKE_INSTALL_FULL_SBINDIR='/usr/local/sbin'
CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/local/com'
CMAKE_INSTALL_FULL_SYSCONFDIR='/usr/local/etc'$
diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-result.txt b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-result.txt
index d00491fd7e..d00491fd7e 100644
--- a/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-result.txt
+++ b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-result.txt
diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-stderr.txt
new file mode 100644
index 0000000000..ef71404d0b
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Error at CMakeLists.txt:[0-9]+ \(project\):
+ Generator
+
+ Visual Studio [^
+]+
+
+ given instance specification
+
+ Test Instance,version=1\.2\.3\.4,version=1\.2\.3\.4
+
+ that contains duplicate field key 'version'\.$
diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate.cmake b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate.cmake
new file mode 100644
index 0000000000..2fc38e5c59
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-result.txt b/Tests/RunCMake/GeneratorInstance/BadFieldNoComma-result.txt
index d00491fd7e..d00491fd7e 100644
--- a/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-result.txt
+++ b/Tests/RunCMake/GeneratorInstance/BadFieldNoComma-result.txt
diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldNoComma-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadFieldNoComma-stderr.txt
new file mode 100644
index 0000000000..d6c73c82c5
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadFieldNoComma-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Error at CMakeLists.txt:[0-9]+ \(project\):
+ Generator
+
+ Visual Studio [^
+]+
+
+ given instance specification
+
+ Test Instance,nocomma
+
+ that contains a field after the first ',' with no '='\.$
diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldNoComma.cmake b/Tests/RunCMake/GeneratorInstance/BadFieldNoComma.cmake
new file mode 100644
index 0000000000..2fc38e5c59
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadFieldNoComma.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetSources-result.txt b/Tests/RunCMake/GeneratorInstance/BadFieldUnknown-result.txt
index d00491fd7e..d00491fd7e 100644
--- a/Tests/RunCMake/TargetSources/AddCustomTargetSources-result.txt
+++ b/Tests/RunCMake/GeneratorInstance/BadFieldUnknown-result.txt
diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldUnknown-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadFieldUnknown-stderr.txt
new file mode 100644
index 0000000000..ecfe229b4c
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadFieldUnknown-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Error at CMakeLists.txt:[0-9]+ \(project\):
+ Generator
+
+ Visual Studio [^
+]+
+
+ given instance specification
+
+ Test Instance,unknown=
+
+ that contains invalid field 'unknown='\.$
diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldUnknown.cmake b/Tests/RunCMake/GeneratorInstance/BadFieldUnknown.cmake
new file mode 100644
index 0000000000..2fc38e5c59
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadFieldUnknown.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/TargetSources/CMP0076-OLD-result.txt b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-result.txt
index d00491fd7e..d00491fd7e 100644
--- a/Tests/RunCMake/TargetSources/CMP0076-OLD-result.txt
+++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-result.txt
diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-stderr.txt
new file mode 100644
index 0000000000..a0894b62ed
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Error at CMakeLists.txt:[0-9]+ \(project\):
+ Generator
+
+ Visual Studio [^
+]+
+
+ given instance specification
+
+ version=1\.2\.3
+
+ but the version field is not 4 integer components starting in [0-9]+\.$
diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionFormat1.cmake b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1.cmake
new file mode 100644
index 0000000000..2fc38e5c59
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN-result.txt b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-result.txt
index d00491fd7e..d00491fd7e 100644
--- a/Tests/RunCMake/TargetSources/CMP0076-WARN-result.txt
+++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-result.txt
diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-stderr.txt
new file mode 100644
index 0000000000..2b3a23b5d3
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Error at CMakeLists.txt:[0-9]+ \(project\):
+ Generator
+
+ Visual Studio [^
+]+
+
+ given instance specification
+
+ version=1\.2\.3\.x
+
+ but the version field is not 4 integer components starting in [0-9]+\.$
diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionFormat2.cmake b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2.cmake
new file mode 100644
index 0000000000..2fc38e5c59
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/TargetSources/ConfigNotAllowed-result.txt b/Tests/RunCMake/GeneratorInstance/BadVersionNumber-result.txt
index d00491fd7e..d00491fd7e 100644
--- a/Tests/RunCMake/TargetSources/ConfigNotAllowed-result.txt
+++ b/Tests/RunCMake/GeneratorInstance/BadVersionNumber-result.txt
diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionNumber-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadVersionNumber-stderr.txt
new file mode 100644
index 0000000000..3a27341ec5
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadVersionNumber-stderr.txt
@@ -0,0 +1,9 @@
+^CMake Error at CMakeLists.txt:[0-9] \(project\):
+ Generator
+
+ Visual Studio [^
+]+
+
+ could not find specified instance of Visual Studio:
+
+ version=[0-9]+\.999\.99999\.999$
diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionNumber.cmake b/Tests/RunCMake/GeneratorInstance/BadVersionNumber.cmake
new file mode 100644
index 0000000000..2fc38e5c59
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadVersionNumber.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake b/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake
index 7750c2e142..9761f0ccd9 100644
--- a/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake
+++ b/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake
@@ -11,3 +11,4 @@ elseif(NOT IS_DIRECTORY "${CMAKE_GENERATOR_INSTANCE}")
" ${CMAKE_GENERATOR_INSTANCE}\n"
"which is not an existing directory.")
endif()
+file(WRITE "${CMAKE_BINARY_DIR}/instance.txt" "${CMAKE_GENERATOR_INSTANCE}")
diff --git a/Tests/RunCMake/GeneratorInstance/PortableNoVersion-result.txt b/Tests/RunCMake/GeneratorInstance/PortableNoVersion-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/PortableNoVersion-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorInstance/PortableNoVersion-stderr.txt b/Tests/RunCMake/GeneratorInstance/PortableNoVersion-stderr.txt
new file mode 100644
index 0000000000..baa17aad0b
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/PortableNoVersion-stderr.txt
@@ -0,0 +1,13 @@
+^CMake Error at CMakeLists.txt:[0-9]+ \(project\):
+ Generator
+
+ Visual Studio [^
+]+
+
+ could not find specified instance of Visual Studio:
+
+ [^
+]+/Tests/RunCMake/GeneratorInstance
+
+ The directory exists, but the instance is not known to the Visual Studio
+ Installer, and no 'version=' field was given\.$
diff --git a/Tests/RunCMake/GeneratorInstance/PortableNoVersion.cmake b/Tests/RunCMake/GeneratorInstance/PortableNoVersion.cmake
new file mode 100644
index 0000000000..2fc38e5c59
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/PortableNoVersion.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake
index e7f9ccbc40..dfcdcf83df 100644
--- a/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake
@@ -1,14 +1,40 @@
include(RunCMake)
-if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio 1[56789]")
+if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio (1[56789])")
+ set(vs_major "${CMAKE_MATCH_1}")
+
set(RunCMake_GENERATOR_INSTANCE "")
run_cmake(DefaultInstance)
+ set(instance_txt "${RunCMake_BINARY_DIR}/DefaultInstance-build/instance.txt")
+ if(EXISTS "${instance_txt}")
+ file(READ "${instance_txt}" default_instance)
+ endif()
set(RunCMake_GENERATOR_INSTANCE "${RunCMake_SOURCE_DIR}/instance_does_not_exist")
run_cmake(MissingInstance)
set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/MissingInstance-toolchain.cmake)
run_cmake(MissingInstanceToolchain)
unset(RunCMake_TEST_OPTIONS)
+
+ set(RunCMake_GENERATOR_INSTANCE "Test Instance,nocomma")
+ run_cmake(BadFieldNoComma)
+ set(RunCMake_GENERATOR_INSTANCE "Test Instance,unknown=")
+ run_cmake(BadFieldUnknown)
+ set(RunCMake_GENERATOR_INSTANCE "Test Instance,version=1.2.3.4,version=1.2.3.4")
+ run_cmake(BadFieldDuplicate)
+ set(RunCMake_GENERATOR_INSTANCE "version=1.2.3")
+ run_cmake(BadVersionFormat1)
+ set(RunCMake_GENERATOR_INSTANCE "version=1.2.3.x")
+ run_cmake(BadVersionFormat2)
+ set(RunCMake_GENERATOR_INSTANCE "version=${vs_major}.999.99999.999")
+ run_cmake(BadVersionNumber)
+ if(IS_DIRECTORY "${default_instance}")
+ set(RunCMake_GENERATOR_INSTANCE "${default_instance},version=${vs_major}.999.99999.999")
+ run_cmake(WrongVersion)
+ endif()
+
+ set(RunCMake_GENERATOR_INSTANCE "${RunCMake_SOURCE_DIR}")
+ run_cmake(PortableNoVersion)
else()
set(RunCMake_GENERATOR_INSTANCE "")
run_cmake(NoInstance)
diff --git a/Tests/RunCMake/GeneratorInstance/WrongVersion-result.txt b/Tests/RunCMake/GeneratorInstance/WrongVersion-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/WrongVersion-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorInstance/WrongVersion-stderr.txt b/Tests/RunCMake/GeneratorInstance/WrongVersion-stderr.txt
new file mode 100644
index 0000000000..156a9ee5c0
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/WrongVersion-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Error at CMakeLists.txt:[0-9] \(project\):
+ Generator
+
+ Visual Studio [^
+]+
+
+ could not find specified instance of Visual Studio:
+
+ [^,
+]+,version=[0-9]+\.999\.99999\.999$
diff --git a/Tests/RunCMake/GeneratorInstance/WrongVersion.cmake b/Tests/RunCMake/GeneratorInstance/WrongVersion.cmake
new file mode 100644
index 0000000000..2fc38e5c59
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/WrongVersion.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-OLD-stderr.txt b/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-OLD-stderr.txt
new file mode 100644
index 0000000000..3984a780f8
--- /dev/null
+++ b/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0091-OLD.cmake:[0-9] \(cmake_policy\):
+ The OLD behavior for policy CMP0091 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/MSVCWarningFlags/CMP0092-OLD-stderr.txt b/Tests/RunCMake/MSVCWarningFlags/CMP0092-OLD-stderr.txt
new file mode 100644
index 0000000000..535b997737
--- /dev/null
+++ b/Tests/RunCMake/MSVCWarningFlags/CMP0092-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0092-OLD.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0092 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/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
index 4a0c130a1f..919015f792 100644
--- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
@@ -448,7 +448,7 @@ run_cmake_command(NoUnusedVariables ${CMAKE_COMMAND} ${CMAKE_CURRENT_LIST_DIR}
)
# CudaSimple uses separable compilation, which is currently only supported on NVCC.
-if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang")
+if(CMake_TEST_CUDA)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CudaSimple-build)
run_cmake_configure(CudaSimple)
include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
diff --git a/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake b/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake
index 6efa0d4022..468b80a0bf 100644
--- a/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake
+++ b/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake
@@ -26,6 +26,7 @@ if (PIE_SUPPORTED OR NO_PIE_SUPPORTED)
if ((READELF OR OTOOL) AND
(CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
+ OR CMAKE_CXX_COMPILER_ID STREQUAL "LCC"
OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
macro(run_cmake_target test subtest)
diff --git a/Tests/RunCMake/PrecompileHeaders/PchWarnInvalid-check.cmake b/Tests/RunCMake/PrecompileHeaders/PchWarnInvalid-check.cmake
index 3e7fb301b8..ac3bf59f7f 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchWarnInvalid-check.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchWarnInvalid-check.cmake
@@ -1,4 +1,4 @@
-if (NOT CMAKE_C_COMPILER_ID MATCHES "GNU|Intel" OR
+if (NOT CMAKE_C_COMPILER_ID MATCHES "GNU|LCC|Intel" OR
(CMAKE_C_COMPILER_ID STREQUAL "Intel" AND CMAKE_HOST_WIN32))
return()
endif()
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index 3363a579e0..6f79b78e6c 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -92,6 +92,9 @@ function(run_cmake test)
if(APPLE)
list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0025=NEW)
endif()
+ if(NOT RunCMake_TEST_NO_CMP0129 AND CMAKE_C_COMPILER_ID STREQUAL "LCC")
+ list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0129=NEW)
+ endif()
if(RunCMake_MAKE_PROGRAM)
list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}")
endif()
diff --git a/Tests/RunCMake/Swift/RunCMakeTest.cmake b/Tests/RunCMake/Swift/RunCMakeTest.cmake
index 1db202e881..21d5a2520e 100644
--- a/Tests/RunCMake/Swift/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Swift/RunCMakeTest.cmake
@@ -6,11 +6,14 @@ if(RunCMake_GENERATOR STREQUAL Xcode)
endif()
elseif(RunCMake_GENERATOR STREQUAL Ninja)
if(CMAKE_Swift_COMPILER)
- run_cmake(Win32ExecutableDisallowed)
-
- set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Darwin)
- run_cmake(SwiftMultiArch)
- unset(RunCMake_TEST_OPTIONS)
+ if (CMAKE_SYSTEM_NAME MATCHES "Windows")
+ run_cmake_with_options(Win32ExecutableDisallowed)
+ else()
+ run_cmake_with_options(Win32ExecutableIgnored)
+ set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Darwin)
+ run_cmake(SwiftMultiArch)
+ unset(RunCMake_TEST_OPTIONS)
+ endif()
endif()
elseif(RunCMake_GENERATOR STREQUAL "Ninja Multi-Config")
if(CMAKE_Swift_COMPILER)
diff --git a/Tests/RunCMake/Swift/Win32ExecutableIgnored.cmake b/Tests/RunCMake/Swift/Win32ExecutableIgnored.cmake
new file mode 100644
index 0000000000..02d5447497
--- /dev/null
+++ b/Tests/RunCMake/Swift/Win32ExecutableIgnored.cmake
@@ -0,0 +1,4 @@
+enable_language(Swift)
+add_executable(E E.swift)
+set_target_properties(E PROPERTIES
+ WIN32_EXECUTABLE TRUE)
diff --git a/Tests/RunCMake/TargetSources/CMakeLists.txt b/Tests/RunCMake/TargetSources/CMakeLists.txt
deleted file mode 100644
index a06591c31f..0000000000
--- a/Tests/RunCMake/TargetSources/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12)
-project(${RunCMake_TEST} CXX)
-include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt
deleted file mode 100644
index 4581d8a889..0000000000
--- a/Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt
+++ /dev/null
@@ -1 +0,0 @@
--- iface: .*Tests/RunCMake/TargetSources/empty_1.cpp
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt
deleted file mode 100644
index 7f480829f4..0000000000
--- a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt
+++ /dev/null
@@ -1 +0,0 @@
--- genexlib: \$<1:.*Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp>;\$<1:.*Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/../empty_1.cpp>;\$<1:empty_2.cpp>
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt
deleted file mode 100644
index aa4851ffae..0000000000
--- a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt
+++ /dev/null
@@ -1 +0,0 @@
--- privatelib: .*Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp;empty_1.cpp
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt
deleted file mode 100644
index 5990a05996..0000000000
--- a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt
+++ /dev/null
@@ -1 +0,0 @@
--- iface: .*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/../empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/../empty_2.cpp
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt
deleted file mode 100644
index fa5bcbfee1..0000000000
--- a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt
+++ /dev/null
@@ -1 +0,0 @@
--- privatelib: .*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/../empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/../empty_2.cpp
diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
deleted file mode 100644
index b56ee44e87..0000000000
--- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
+++ /dev/null
@@ -1,22 +0,0 @@
-include(RunCMake)
-
-if(RunCMake_GENERATOR STREQUAL "Xcode")
- run_cmake(ConfigNotAllowed)
-endif()
-
-run_cmake(OriginDebug)
-run_cmake(CMP0026-LOCATION)
-run_cmake(CMP0076-OLD)
-run_cmake(CMP0076-WARN)
-run_cmake(RelativePathInInterface)
-run_cmake(RelativePathInSubdirGenEx)
-run_cmake(RelativePathInSubdirInterface)
-run_cmake(RelativePathInSubdirPrivate)
-run_cmake(RelativePathInSubdirInclude)
-run_cmake(ExportBuild)
-run_cmake(AddCustomTargetPublicSources)
-run_cmake(AddCustomTargetPrivateSources)
-run_cmake(AddCustomTargetInterfaceSources)
-run_cmake(AddCustomTargetSources)
-run_cmake(AddCustomTargetCheckProperty)
-run_cmake(AddCustomTargetGenx)
diff --git a/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake b/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake
index c00f78b3dc..e3643c0289 100644
--- a/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake
+++ b/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake
@@ -2,11 +2,9 @@ include(RunCMake)
function(run_build name)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build)
- set(RunCMake_TEST_NO_CLEAN 1)
run_cmake(${name})
+ set(RunCMake_TEST_NO_CLEAN 1)
run_cmake_command(${name}-build ${CMAKE_COMMAND} --build . --config Debug)
- unset(RunCMake_TEST_BINARY_DIR)
- unset(RunCMake_TEST_NO_CLEAN)
endfunction()
run_cmake(unitybuild_c)
@@ -28,14 +26,28 @@ run_build(unitybuild_anon_ns)
run_build(unitybuild_anon_ns_no_unity_build)
run_build(unitybuild_anon_ns_group_mode)
-function(run_test name)
+function(run_per_config name)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build)
+ run_cmake(${name})
set(RunCMake_TEST_NO_CLEAN 1)
+ if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ run_cmake_command(${name}-build-debug ${CMAKE_COMMAND} --build . --config Debug)
+ run_cmake_command(${name}-build-release ${CMAKE_COMMAND} --build . --config Release)
+ else()
+ run_cmake_command(${name}-build ${CMAKE_COMMAND} --build .)
+ endif()
+endfunction()
+
+if(NOT RunCMake_GENERATOR STREQUAL "Xcode")
+ run_per_config(per_config_c)
+endif()
+
+function(run_test name)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build)
run_cmake(${name})
+ set(RunCMake_TEST_NO_CLEAN 1)
run_cmake_command(${name}-build ${CMAKE_COMMAND} --build . --config Debug)
run_cmake_command(${name}-test ${CMAKE_CTEST_COMMAND} -C Debug)
- unset(RunCMake_TEST_BINARY_DIR)
- unset(RunCMake_TEST_NO_CLEAN)
endfunction()
run_test(unitybuild_runtest)
diff --git a/Tests/RunCMake/UnityBuild/per_config_c.c b/Tests/RunCMake/UnityBuild/per_config_c.c
new file mode 100644
index 0000000000..081c7d3c84
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/per_config_c.c
@@ -0,0 +1,16 @@
+#ifdef CFG_DEBUG
+extern void per_config_c_debug(void);
+#endif
+#ifdef CFG_OTHER
+extern void per_config_c_other(void);
+#endif
+int main(void)
+{
+#ifdef CFG_DEBUG
+ per_config_c_debug();
+#endif
+#ifdef CFG_OTHER
+ per_config_c_other();
+#endif
+ return 0;
+}
diff --git a/Tests/RunCMake/UnityBuild/per_config_c.cmake b/Tests/RunCMake/UnityBuild/per_config_c.cmake
new file mode 100644
index 0000000000..9f2ee484d3
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/per_config_c.cmake
@@ -0,0 +1,12 @@
+enable_language(C)
+
+add_executable(per_config_c per_config_c.c
+ "$<$<CONFIG:Debug>:per_config_c_debug.c>"
+ "$<$<NOT:$<CONFIG:Debug>>:per_config_c_other.c>"
+ )
+
+set_target_properties(per_config_c PROPERTIES UNITY_BUILD ON)
+target_compile_definitions(per_config_c PRIVATE
+ "$<$<CONFIG:Debug>:CFG_DEBUG>"
+ "$<$<NOT:$<CONFIG:Debug>>:CFG_OTHER>"
+ )
diff --git a/Tests/RunCMake/UnityBuild/per_config_c_debug.c b/Tests/RunCMake/UnityBuild/per_config_c_debug.c
new file mode 100644
index 0000000000..6d32ead5d4
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/per_config_c_debug.c
@@ -0,0 +1,9 @@
+#ifndef CFG_DEBUG
+# error "per_config_c_debug built without CFG_DEBUG"
+#endif
+#ifdef CFG_OTHER
+# error "per_config_c_debug built with CFG_OTHER"
+#endif
+void per_config_c_debug(void)
+{
+}
diff --git a/Tests/RunCMake/UnityBuild/per_config_c_other.c b/Tests/RunCMake/UnityBuild/per_config_c_other.c
new file mode 100644
index 0000000000..89c7a6be33
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/per_config_c_other.c
@@ -0,0 +1,9 @@
+#ifdef CFG_DEBUG
+# error "per_config_c_other built with CFG_DEBUG"
+#endif
+#ifndef CFG_OTHER
+# error "per_config_c_other built without CFG_OTHER"
+#endif
+void per_config_c_other(void)
+{
+}
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index d5ed136ac1..f945b43592 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -64,6 +64,21 @@ if (RunCMake_GENERATOR MATCHES "Visual Studio 1[0-4] 201[0-5]" OR
else()
run_cmake(UnityBuildNative)
run_cmake(UnityBuildNativeGrouped)
+
+ function(run_UnityBuildPCH)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/UnityBuildPCH-build)
+ run_cmake(UnityBuildPCH)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(vcxproj "${RunCMake_TEST_BINARY_DIR}/UnityBuildPCH.vcxproj")
+ if(EXISTS "${vcxproj}")
+ file(STRINGS ${vcxproj} vcxproj_strings REGEX "ClCompile[^\n]*UnityBuildPCH\\.c")
+ endif()
+ if(vcxproj_strings MATCHES "Include=\"([^\"]+)\"")
+ set(src "${CMAKE_MATCH_1}")
+ run_cmake_command(UnityBuildPCH-build ${CMAKE_COMMAND} --build . --config Debug --target UnityBuildPCH -- -t:ClCompile -p:SelectedFiles=${src})
+ endif()
+ endfunction()
+ run_UnityBuildPCH()
endif()
run_cmake(VsDotnetTargetFramework)
diff --git a/Tests/RunCMake/VS10Project/UnityBuildPCH-build-check.cmake b/Tests/RunCMake/VS10Project/UnityBuildPCH-build-check.cmake
new file mode 100644
index 0000000000..9043bb7804
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/UnityBuildPCH-build-check.cmake
@@ -0,0 +1,10 @@
+set(obj "${RunCMake_TEST_BINARY_DIR}/UnityBuildPCH.dir/Debug/UnityBuildPCH.obj")
+if(NOT EXISTS "${obj}")
+ set(RunCMake_TEST_FAILED "Expected object file does not exist:\n ${obj}")
+ return()
+endif()
+set(lib "${RunCMake_TEST_BINARY_DIR}/Debug/UnityBuildPCH.lib")
+if(EXISTS "${lib}")
+ set(RunCMake_TEST_FAILED "Unexpected library file exists:\n ${lib}")
+ return()
+endif()
diff --git a/Tests/RunCMake/VS10Project/UnityBuildPCH.c b/Tests/RunCMake/VS10Project/UnityBuildPCH.c
new file mode 100644
index 0000000000..b96b068477
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/UnityBuildPCH.c
@@ -0,0 +1,4 @@
+int UnityBuildPCH(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/VS10Project/UnityBuildPCH.cmake b/Tests/RunCMake/VS10Project/UnityBuildPCH.cmake
new file mode 100644
index 0000000000..875ffecf1d
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/UnityBuildPCH.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+add_library(UnityBuildPCH STATIC UnityBuildPCH.c)
+target_precompile_headers(UnityBuildPCH PRIVATE UnityBuildPCH.h)
+set_property(TARGET UnityBuildPCH PROPERTY UNITY_BUILD ON)
diff --git a/Tests/RunCMake/VS10Project/UnityBuildPCH.h b/Tests/RunCMake/VS10Project/UnityBuildPCH.h
new file mode 100644
index 0000000000..fa882cb5b0
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/UnityBuildPCH.h
@@ -0,0 +1 @@
+/* empty file */
diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS-check.cmake
new file mode 100644
index 0000000000..576be11f0a
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS-check.cmake
@@ -0,0 +1,4 @@
+include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake)
+
+findAttribute(${test} "RemoveHeadersOnCopy" TRUE)
+findAttribute(${test} "CodeSignOnCopy" FALSE)
diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS.cmake
new file mode 100644
index 0000000000..57f8fbe97d
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS.cmake
@@ -0,0 +1 @@
+include(${CMAKE_CURRENT_LIST_DIR}/EmbedPlugIns.cmake)
diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns.cmake
new file mode 100644
index 0000000000..1bd1bd0d0a
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns.cmake
@@ -0,0 +1,20 @@
+add_executable(plug_in MACOS_BUNDLE Empty.txt)
+set_target_properties(plug_in PROPERTIES
+ LINKER_LANGUAGE CXX
+ XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO"
+ XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ""
+ XCODE_ATTRIBUTE_ENABLE_BITCODE "NO"
+ MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in"
+ MACOSX_BUNDLE_GUI_IDENTIFIER "com.example.app.plug_in"
+ XCODE_EXPLICIT_FILE_TYPE "wrapper.cfbundle"
+ XCODE_ATTRIBUTE_MACH_O_TYPE "mh_bundle"
+)
+
+add_executable(app MACOSX_BUNDLE main.m)
+add_dependencies(app plug_in)
+set_target_properties(app PROPERTIES
+ XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO"
+ XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ""
+ XCODE_EMBED_PLUGINS plug_in
+ MACOSX_BUNDLE_GUI_IDENTIFIER "com.example.app"
+)
diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
index c742f50b43..be44ecdbba 100644
--- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
@@ -37,6 +37,12 @@ check_property("ZOMBIE_OBJECTS" "NSZombieEnabled")
check_property("MALLOC_STACK" "MallocStackLogging")
check_property("DYNAMIC_LINKER_API_USAGE" "DYLD_PRINT_APIS")
check_property("DYNAMIC_LIBRARY_LOADS" "DYLD_PRINT_LIBRARIES")
+check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_1" "enableGPUFrameCaptureMode=\"1\"")
+check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_3" "enableGPUFrameCaptureMode=\"3\"")
+check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED" "enableGPUFrameCaptureMode=\"3\"")
+check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_METAL" "enableGPUFrameCaptureMode=\"1\"")
+check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED_MIXED_CASE" "enableGPUFrameCaptureMode=\"3\"")
+check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_METAL_MIXED_CASE" "enableGPUFrameCaptureMode=\"1\"")
check_property("EXECUTABLE" "myExecutable")
check_property("ARGUMENTS" [=["--foo"]=])
diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
index ce5c0c9593..126a9fc9d2 100644
--- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
@@ -26,16 +26,22 @@ create_scheme_for_variable(MALLOC_STACK)
create_scheme_for_variable(DYNAMIC_LINKER_API_USAGE)
create_scheme_for_variable(DYNAMIC_LIBRARY_LOADS)
-function(create_scheme_for_property property value)
+function(create_scheme_for_property scheme property value)
set(XCODE_SCHEME_${property} ON)
- add_executable(${property} main.cpp)
- set_target_properties(${property} PROPERTIES XCODE_SCHEME_${property} "${value}")
+ add_executable(${scheme} main.cpp)
+ set_target_properties(${scheme} PROPERTIES XCODE_SCHEME_${property} "${value}")
endfunction()
-create_scheme_for_property(EXECUTABLE myExecutable)
-create_scheme_for_property(ARGUMENTS "--foo;--bar=baz")
-create_scheme_for_property(ENVIRONMENT "FOO=foo;BAR=bar")
-create_scheme_for_property(WORKING_DIRECTORY "/working/dir")
+create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_1 ENABLE_GPU_FRAME_CAPTURE_MODE 1)
+create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_3 ENABLE_GPU_FRAME_CAPTURE_MODE 3)
+create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED ENABLE_GPU_FRAME_CAPTURE_MODE Disabled)
+create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_METAL ENABLE_GPU_FRAME_CAPTURE_MODE Metal)
+create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED_MIXED_CASE ENABLE_GPU_FRAME_CAPTURE_MODE DISAbled)
+create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_METAL_MIXED_CASE ENABLE_GPU_FRAME_CAPTURE_MODE METal)
+create_scheme_for_property(EXECUTABLE EXECUTABLE myExecutable)
+create_scheme_for_property(ARGUMENTS ARGUMENTS "--foo;--bar=baz")
+create_scheme_for_property(ENVIRONMENT ENVIRONMENT "FOO=foo;BAR=bar")
+create_scheme_for_property(WORKING_DIRECTORY WORKING_DIRECTORY "/working/dir")
add_executable(NoSchema main.cpp)
set_target_properties(NoSchema PROPERTIES XCODE_GENERATE_SCHEME OFF)
diff --git a/Tests/RunCMake/find_package/FindRootPathAndPrefixPathAreEqual.cmake b/Tests/RunCMake/find_package/FindRootPathAndPrefixPathAreEqual.cmake
new file mode 100644
index 0000000000..2994fc25b9
--- /dev/null
+++ b/Tests/RunCMake/find_package/FindRootPathAndPrefixPathAreEqual.cmake
@@ -0,0 +1,16 @@
+set(root "${CMAKE_CURRENT_SOURCE_DIR}/FindRootPathAndPrefixPathAreEqual")
+set(CMAKE_FIND_ROOT_PATH "${root}")
+set(CMAKE_PREFIX_PATH "${root}")
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE "ONLY")
+
+find_package(Foo
+ REQUIRED
+ CONFIG
+ NO_CMAKE_ENVIRONMENT_PATH
+ NO_SYSTEM_ENVIRONMENT_PATH
+ # Important because CMAKE_SYSTEM_PREFIX_PATH might contain "/" as a prefix
+ # And when "/" is rerooted onto the root above, the package is found even if
+ # CMAKE_PREFIX_PATH is empty. We want to ensure that we hit
+ # the CMAKE_FIND_ROOT_PATH == CMAKE_PREFIX_PATH code path.
+ NO_CMAKE_SYSTEM_PATH
+ )
diff --git a/Tests/RunCMake/find_package/FindRootPathAndPrefixPathAreEqual/lib/cmake/Foo/FooConfig.cmake b/Tests/RunCMake/find_package/FindRootPathAndPrefixPathAreEqual/lib/cmake/Foo/FooConfig.cmake
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/find_package/FindRootPathAndPrefixPathAreEqual/lib/cmake/Foo/FooConfig.cmake
diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake
index b20a88950c..ad9757dd88 100644
--- a/Tests/RunCMake/find_package/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake
@@ -25,6 +25,7 @@ run_cmake(PackageRootNestedModule)
run_cmake(PolicyPush)
run_cmake(PolicyPop)
run_cmake(RequiredOptionValuesClash)
+run_cmake(FindRootPathAndPrefixPathAreEqual)
run_cmake(SetFoundFALSE)
run_cmake(WrongVersion)
run_cmake(WrongVersionConfig)
diff --git a/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt b/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt
index 1939097040..138a69d09f 100644
--- a/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt
+++ b/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt
@@ -1,2 +1,11 @@
-^INSTALL TARGETS - target lib3 has PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION\.
-INSTALL TARGETS - target lib4 has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION\.$
+^CMake Warning \(dev\) at TARGETS-Defaults-Cache.cmake:[0-9]+ \(install\):
+ Target lib3 has PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\) at TARGETS-Defaults-Cache.cmake:[0-9]+ \(install\):
+ Target lib4 has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt b/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt
index 1939097040..5f5698676c 100644
--- a/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt
+++ b/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt
@@ -1,2 +1,11 @@
-^INSTALL TARGETS - target lib3 has PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION\.
-INSTALL TARGETS - target lib4 has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION\.$
+^CMake Warning \(dev\) at TARGETS-Defaults.cmake:[0-9]+ \(install\):
+ Target lib3 has PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
++
+CMake Warning \(dev\) at TARGETS-Defaults.cmake:[0-9]+ \(install\):
+ Target lib4 has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/target_compile_options/RunCMakeTest.cmake b/Tests/RunCMake/target_compile_options/RunCMakeTest.cmake
index 806ae79b08..f7267599f7 100644
--- a/Tests/RunCMake/target_compile_options/RunCMakeTest.cmake
+++ b/Tests/RunCMake/target_compile_options/RunCMakeTest.cmake
@@ -2,7 +2,7 @@ include(RunCMake)
run_cmake(empty_keyword_args)
-if (CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
+if (CMAKE_C_COMPILER_ID MATCHES "GNU|LCC|Clang")
macro(run_cmake_target test subtest target)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build)
set(RunCMake_TEST_OUTPUT_MERGE 1)
@@ -28,7 +28,7 @@ function(run_Order)
run_cmake_command(Order-build ${CMAKE_COMMAND} --build . --verbose --config Custom)
endfunction()
if(RunCMake_GENERATOR MATCHES "Ninja|Make" AND
- CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$" AND
+ CMAKE_C_COMPILER_ID MATCHES "^(GNU|LCC|Clang|AppleClang)$" AND
NOT CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
run_Order()
endif()
diff --git a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake
index a707383ad7..1a29ecfa3b 100644
--- a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake
+++ b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake
@@ -53,16 +53,13 @@ if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
run_cmake_target(genex_DEVICE_LINK interface LinkOptions_shared_interface --config Release)
run_cmake_target(genex_DEVICE_LINK private LinkOptions_private --config Release)
if (CMake_TEST_CUDA)
- # Separable compilation is only supported on NVCC.
- if(NOT CMake_TEST_CUDA STREQUAL "Clang")
- run_cmake_target(genex_DEVICE_LINK CMP0105_UNSET LinkOptions_CMP0105_UNSET --config Release)
- run_cmake_target(genex_DEVICE_LINK CMP0105_OLD LinkOptions_CMP0105_OLD --config Release)
- run_cmake_target(genex_DEVICE_LINK CMP0105_NEW LinkOptions_CMP0105_NEW --config Release)
- run_cmake_target(genex_DEVICE_LINK device LinkOptions_device --config Release)
-
- if (RunCMake_GENERATOR MATCHES "(Ninja|Unix Makefiles)")
- run_cmake_target(genex_DEVICE_LINK host_link_options LinkOptions_host_link_options --config Release ${VERBOSE})
- endif()
+ run_cmake_target(genex_DEVICE_LINK CMP0105_UNSET LinkOptions_CMP0105_UNSET --config Release)
+ run_cmake_target(genex_DEVICE_LINK CMP0105_OLD LinkOptions_CMP0105_OLD --config Release)
+ run_cmake_target(genex_DEVICE_LINK CMP0105_NEW LinkOptions_CMP0105_NEW --config Release)
+ run_cmake_target(genex_DEVICE_LINK device LinkOptions_device --config Release)
+
+ if (RunCMake_GENERATOR MATCHES "(Ninja|Unix Makefiles)")
+ run_cmake_target(genex_DEVICE_LINK host_link_options LinkOptions_host_link_options --config Release ${VERBOSE})
endif()
run_cmake_target(genex_DEVICE_LINK no_device LinkOptions_no_device --config Release)
diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-check.cmake b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-check.cmake
index 31ffe7ffb8..cc3088afac 100644
--- a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-check.cmake
+++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-check.cmake
@@ -1,4 +1,9 @@
+if(CMake_TEST_CUDA STREQUAL "NVIDIA")
+ set(expected "-Xlinker=OPT1 -Xlinker=OPT2 -Xlinker=OPT3 -Xlinker=OPT4 -Xlinker=OPT5")
+elseif(CMake_TEST_CUDA STREQUAL "Clang")
+ set(expected "-Wl,OPT1 -Xlinker OPT2 -Xlinker OPT3 -Xlinker OPT4")
+endif()
-if (NOT actual_stdout MATCHES "-Xlinker=OPT1 -Xlinker=OPT2 -Xlinker=OPT3 -Xlinker=OPT4 -Xlinker=OPT5")
- set (RunCMake_TEST_FAILED "Not found expected '-Xlinker=OPT1 -Xlinker=OPT2 -Xlinker=OPT3 -Xlinker=OPT4 -Xlinker=OPT5'.")
+if(NOT actual_stdout MATCHES "${expected}")
+ set(RunCMake_TEST_FAILED "Not found expected '${expected}'")
endif()
diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake
index a53ab20cff..b6c9ee67bf 100644
--- a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake
+++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake
@@ -25,32 +25,33 @@ target_link_options (LinkOptions_private PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEV
if (CMake_TEST_CUDA)
enable_language(CUDA)
- # Separable compilation is only supported on NVCC.
- if(NOT CMake_TEST_CUDA STREQUAL "Clang")
- add_executable(LinkOptions_CMP0105_UNSET LinkOptionsDevice.cu)
- set_property(TARGET LinkOptions_CMP0105_UNSET PROPERTY CUDA_SEPARABLE_COMPILATION ON)
- target_link_options(LinkOptions_CMP0105_UNSET PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>)
+ add_executable(LinkOptions_CMP0105_UNSET LinkOptionsDevice.cu)
+ set_property(TARGET LinkOptions_CMP0105_UNSET PROPERTY CUDA_SEPARABLE_COMPILATION ON)
+ target_link_options(LinkOptions_CMP0105_UNSET PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>)
- cmake_policy(SET CMP0105 OLD)
+ cmake_policy(SET CMP0105 OLD)
- add_executable(LinkOptions_CMP0105_OLD LinkOptionsDevice.cu)
- set_property(TARGET LinkOptions_CMP0105_OLD PROPERTY CUDA_SEPARABLE_COMPILATION ON)
- target_link_options(LinkOptions_CMP0105_OLD PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>)
+ add_executable(LinkOptions_CMP0105_OLD LinkOptionsDevice.cu)
+ set_property(TARGET LinkOptions_CMP0105_OLD PROPERTY CUDA_SEPARABLE_COMPILATION ON)
+ target_link_options(LinkOptions_CMP0105_OLD PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>)
- cmake_policy(SET CMP0105 NEW)
+ cmake_policy(SET CMP0105 NEW)
- add_executable(LinkOptions_CMP0105_NEW LinkOptionsDevice.cu)
- set_property(TARGET LinkOptions_CMP0105_NEW PROPERTY CUDA_SEPARABLE_COMPILATION ON)
- target_link_options(LinkOptions_CMP0105_NEW PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>)
+ add_executable(LinkOptions_CMP0105_NEW LinkOptionsDevice.cu)
+ set_property(TARGET LinkOptions_CMP0105_NEW PROPERTY CUDA_SEPARABLE_COMPILATION ON)
+ target_link_options(LinkOptions_CMP0105_NEW PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>)
- add_executable(LinkOptions_device LinkOptionsDevice.cu)
- set_property(TARGET LinkOptions_device PROPERTY CUDA_SEPARABLE_COMPILATION ON)
- target_link_options(LinkOptions_device PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>
- $<HOST_LINK:${pre}BADFLAG_NORMAL_LINK${obj}>)
+ add_executable(LinkOptions_device LinkOptionsDevice.cu)
+ set_property(TARGET LinkOptions_device PROPERTY CUDA_SEPARABLE_COMPILATION ON)
+ target_link_options(LinkOptions_device PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>
+ $<HOST_LINK:${pre}BADFLAG_NORMAL_LINK${obj}>)
- add_executable(LinkOptions_host_link_options LinkOptionsDevice.cu)
- set_property(TARGET LinkOptions_host_link_options PROPERTY CUDA_SEPARABLE_COMPILATION ON)
+ add_executable(LinkOptions_host_link_options LinkOptionsDevice.cu)
+ set_property(TARGET LinkOptions_host_link_options PROPERTY CUDA_SEPARABLE_COMPILATION ON)
+ if(CMake_TEST_CUDA STREQUAL "NVIDIA")
target_link_options(LinkOptions_host_link_options PRIVATE -Wl,OPT1 -Xlinker=OPT2 "SHELL:-Xlinker OPT3" "SHELL:LINKER:OPT4 LINKER:OPT5")
+ elseif(CMake_TEST_CUDA STREQUAL "Clang")
+ target_link_options(LinkOptions_host_link_options PRIVATE -Wl,OPT1 "SHELL:-Xlinker OPT2" "SHELL:LINKER:OPT3 LINKER:OPT4")
endif()
add_executable(LinkOptions_no_device LinkOptionsDevice.cu)
diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetCheckProperty.cmake b/Tests/RunCMake/target_sources/AddCustomTargetCheckProperty.cmake
index 1787e877b2..1787e877b2 100644
--- a/Tests/RunCMake/TargetSources/AddCustomTargetCheckProperty.cmake
+++ b/Tests/RunCMake/target_sources/AddCustomTargetCheckProperty.cmake
diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetGenx.cmake b/Tests/RunCMake/target_sources/AddCustomTargetGenx.cmake
index 0078eab0f9..0078eab0f9 100644
--- a/Tests/RunCMake/TargetSources/AddCustomTargetGenx.cmake
+++ b/Tests/RunCMake/target_sources/AddCustomTargetGenx.cmake
diff --git a/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources-result.txt b/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-stderr.txt b/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources-stderr.txt
index 9334bf6ffe..9334bf6ffe 100644
--- a/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-stderr.txt
+++ b/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources-stderr.txt
diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources.cmake b/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources.cmake
index 42a8ca2f11..42a8ca2f11 100644
--- a/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources.cmake
+++ b/Tests/RunCMake/target_sources/AddCustomTargetInterfaceSources.cmake
diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetPrivateSources.cmake b/Tests/RunCMake/target_sources/AddCustomTargetPrivateSources.cmake
index 11f0258c8e..11f0258c8e 100644
--- a/Tests/RunCMake/TargetSources/AddCustomTargetPrivateSources.cmake
+++ b/Tests/RunCMake/target_sources/AddCustomTargetPrivateSources.cmake
diff --git a/Tests/RunCMake/target_sources/AddCustomTargetPublicSources-result.txt b/Tests/RunCMake/target_sources/AddCustomTargetPublicSources-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/AddCustomTargetPublicSources-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-stderr.txt b/Tests/RunCMake/target_sources/AddCustomTargetPublicSources-stderr.txt
index afba4beed5..afba4beed5 100644
--- a/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-stderr.txt
+++ b/Tests/RunCMake/target_sources/AddCustomTargetPublicSources-stderr.txt
diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources.cmake b/Tests/RunCMake/target_sources/AddCustomTargetPublicSources.cmake
index d9e82c02f5..d9e82c02f5 100644
--- a/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources.cmake
+++ b/Tests/RunCMake/target_sources/AddCustomTargetPublicSources.cmake
diff --git a/Tests/RunCMake/target_sources/AddCustomTargetSources-result.txt b/Tests/RunCMake/target_sources/AddCustomTargetSources-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/AddCustomTargetSources-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetSources-stderr.txt b/Tests/RunCMake/target_sources/AddCustomTargetSources-stderr.txt
index 4a153e9673..4a153e9673 100644
--- a/Tests/RunCMake/TargetSources/AddCustomTargetSources-stderr.txt
+++ b/Tests/RunCMake/target_sources/AddCustomTargetSources-stderr.txt
diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetSources.cmake b/Tests/RunCMake/target_sources/AddCustomTargetSources.cmake
index dd688d30d1..dd688d30d1 100644
--- a/Tests/RunCMake/TargetSources/AddCustomTargetSources.cmake
+++ b/Tests/RunCMake/target_sources/AddCustomTargetSources.cmake
diff --git a/Tests/RunCMake/TargetSources/CMP0026-LOCATION-result.txt b/Tests/RunCMake/target_sources/CMP0026-LOCATION-result.txt
index 573541ac97..573541ac97 100644
--- a/Tests/RunCMake/TargetSources/CMP0026-LOCATION-result.txt
+++ b/Tests/RunCMake/target_sources/CMP0026-LOCATION-result.txt
diff --git a/Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt b/Tests/RunCMake/target_sources/CMP0026-LOCATION-stderr.txt
index d7ccedb1b4..d7ccedb1b4 100644
--- a/Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt
+++ b/Tests/RunCMake/target_sources/CMP0026-LOCATION-stderr.txt
diff --git a/Tests/RunCMake/TargetSources/CMP0026-LOCATION.cmake b/Tests/RunCMake/target_sources/CMP0026-LOCATION.cmake
index 464df36821..642856cde7 100644
--- a/Tests/RunCMake/TargetSources/CMP0026-LOCATION.cmake
+++ b/Tests/RunCMake/target_sources/CMP0026-LOCATION.cmake
@@ -1,5 +1,6 @@
cmake_policy(SET CMP0026 OLD)
+enable_language(CXX)
add_library(objlib OBJECT
empty_1.cpp
diff --git a/Tests/RunCMake/target_sources/CMP0076-OLD-result.txt b/Tests/RunCMake/target_sources/CMP0076-OLD-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/CMP0076-OLD-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetSources/CMP0076-OLD-stderr.txt b/Tests/RunCMake/target_sources/CMP0076-OLD-stderr.txt
index d47dd4de30..d47dd4de30 100644
--- a/Tests/RunCMake/TargetSources/CMP0076-OLD-stderr.txt
+++ b/Tests/RunCMake/target_sources/CMP0076-OLD-stderr.txt
diff --git a/Tests/RunCMake/TargetSources/CMP0076-OLD.cmake b/Tests/RunCMake/target_sources/CMP0076-OLD.cmake
index 4d8c268efa..4d8c268efa 100644
--- a/Tests/RunCMake/TargetSources/CMP0076-OLD.cmake
+++ b/Tests/RunCMake/target_sources/CMP0076-OLD.cmake
diff --git a/Tests/RunCMake/target_sources/CMP0076-WARN-result.txt b/Tests/RunCMake/target_sources/CMP0076-WARN-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/CMP0076-WARN-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN-stderr.txt b/Tests/RunCMake/target_sources/CMP0076-WARN-stderr.txt
index bd888eed55..bd888eed55 100644
--- a/Tests/RunCMake/TargetSources/CMP0076-WARN-stderr.txt
+++ b/Tests/RunCMake/target_sources/CMP0076-WARN-stderr.txt
diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN.cmake b/Tests/RunCMake/target_sources/CMP0076-WARN.cmake
index 2e07331120..2e07331120 100644
--- a/Tests/RunCMake/TargetSources/CMP0076-WARN.cmake
+++ b/Tests/RunCMake/target_sources/CMP0076-WARN.cmake
diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN/CMakeLists.txt b/Tests/RunCMake/target_sources/CMP0076-WARN/CMakeLists.txt
index f9c7d6d5e5..f9c7d6d5e5 100644
--- a/Tests/RunCMake/TargetSources/CMP0076-WARN/CMakeLists.txt
+++ b/Tests/RunCMake/target_sources/CMP0076-WARN/CMakeLists.txt
diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN/subdir_empty_1.cpp b/Tests/RunCMake/target_sources/CMP0076-WARN/subdir_empty_1.cpp
index 11ec041d1e..11ec041d1e 100644
--- a/Tests/RunCMake/TargetSources/CMP0076-WARN/subdir_empty_1.cpp
+++ b/Tests/RunCMake/target_sources/CMP0076-WARN/subdir_empty_1.cpp
diff --git a/Tests/RunCMake/target_sources/CMakeLists.txt b/Tests/RunCMake/target_sources/CMakeLists.txt
index 14ef56e8e8..727f93a925 100644
--- a/Tests/RunCMake/target_sources/CMakeLists.txt
+++ b/Tests/RunCMake/target_sources/CMakeLists.txt
@@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.11)
-
project(${RunCMake_TEST} LANGUAGES NONE)
-
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/target_sources/ConfigNotAllowed-result.txt b/Tests/RunCMake/target_sources/ConfigNotAllowed-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/ConfigNotAllowed-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetSources/ConfigNotAllowed-stderr.txt b/Tests/RunCMake/target_sources/ConfigNotAllowed-stderr.txt
index c6b75fceb6..bc4afb7882 100644
--- a/Tests/RunCMake/TargetSources/ConfigNotAllowed-stderr.txt
+++ b/Tests/RunCMake/target_sources/ConfigNotAllowed-stderr.txt
@@ -4,9 +4,9 @@ CMake Error in CMakeLists.txt:
Config "Debug":
- .*/Tests/RunCMake/TargetSources/empty_1.cpp
- .*/Tests/RunCMake/TargetSources/empty_2.cpp
+ .*/Tests/RunCMake/target_sources/empty_1.cpp
+ .*/Tests/RunCMake/target_sources/empty_2.cpp
Config "Release":
- .*/Tests/RunCMake/TargetSources/empty_1.cpp
+ .*/Tests/RunCMake/target_sources/empty_1.cpp
diff --git a/Tests/RunCMake/TargetSources/ConfigNotAllowed.cmake b/Tests/RunCMake/target_sources/ConfigNotAllowed.cmake
index 02af379722..02af379722 100644
--- a/Tests/RunCMake/TargetSources/ConfigNotAllowed.cmake
+++ b/Tests/RunCMake/target_sources/ConfigNotAllowed.cmake
diff --git a/Tests/RunCMake/target_sources/empty_keyword_args.cmake b/Tests/RunCMake/target_sources/EmptyKeywordArgs.cmake
index 5cee451fdf..5cee451fdf 100644
--- a/Tests/RunCMake/target_sources/empty_keyword_args.cmake
+++ b/Tests/RunCMake/target_sources/EmptyKeywordArgs.cmake
diff --git a/Tests/RunCMake/TargetSources/ExportBuild-result.txt b/Tests/RunCMake/target_sources/ExportBuild-result.txt
index 573541ac97..573541ac97 100644
--- a/Tests/RunCMake/TargetSources/ExportBuild-result.txt
+++ b/Tests/RunCMake/target_sources/ExportBuild-result.txt
diff --git a/Tests/RunCMake/TargetSources/ExportBuild.cmake b/Tests/RunCMake/target_sources/ExportBuild.cmake
index b626aa6cd1..b626aa6cd1 100644
--- a/Tests/RunCMake/TargetSources/ExportBuild.cmake
+++ b/Tests/RunCMake/target_sources/ExportBuild.cmake
diff --git a/Tests/RunCMake/target_sources/FileSetChangeScope-result.txt b/Tests/RunCMake/target_sources/FileSetChangeScope-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetChangeScope-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_sources/FileSetChangeScope-stderr.txt b/Tests/RunCMake/target_sources/FileSetChangeScope-stderr.txt
new file mode 100644
index 0000000000..600d006956
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetChangeScope-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at FileSetChangeScope\.cmake:[0-9]+ \(target_sources\):
+ target_sources Scope PUBLIC for file set "a" does not match original scope
+ INTERFACE
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/target_sources/FileSetChangeScope.cmake b/Tests/RunCMake/target_sources/FileSetChangeScope.cmake
new file mode 100644
index 0000000000..9d835fe9fe
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetChangeScope.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+
+add_library(lib1 STATIC empty.c)
+target_sources(lib1 INTERFACE FILE_SET a TYPE HEADERS)
+target_sources(lib1 PUBLIC FILE_SET a)
diff --git a/Tests/RunCMake/target_sources/FileSetChangeType-result.txt b/Tests/RunCMake/target_sources/FileSetChangeType-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetChangeType-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_sources/FileSetChangeType-stderr.txt b/Tests/RunCMake/target_sources/FileSetChangeType-stderr.txt
new file mode 100644
index 0000000000..85fc71858f
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetChangeType-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at FileSetChangeType\.cmake:[0-9]+ \(target_sources\):
+ target_sources Type "RESOURCES" for file set "a" does not match original
+ type "HEADERS"
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/target_sources/FileSetChangeType.cmake b/Tests/RunCMake/target_sources/FileSetChangeType.cmake
new file mode 100644
index 0000000000..69eb6bc3af
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetChangeType.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+
+add_library(lib1 STATIC empty.c)
+target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS)
+target_sources(lib1 PRIVATE FILE_SET a TYPE RESOURCES)
diff --git a/Tests/RunCMake/target_sources/FileSetDefaultWrongType-result.txt b/Tests/RunCMake/target_sources/FileSetDefaultWrongType-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetDefaultWrongType-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_sources/FileSetDefaultWrongType-stderr.txt b/Tests/RunCMake/target_sources/FileSetDefaultWrongType-stderr.txt
new file mode 100644
index 0000000000..faf0f5a33b
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetDefaultWrongType-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at FileSetDefaultWrongType\.cmake:[0-9]+ \(target_sources\):
+ target_sources File set TYPE may only be "HEADERS"
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/target_sources/FileSetDefaultWrongType.cmake b/Tests/RunCMake/target_sources/FileSetDefaultWrongType.cmake
new file mode 100644
index 0000000000..c810d664f7
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetDefaultWrongType.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+
+add_library(lib1 STATIC empty.c)
+target_sources(lib1 PRIVATE FILE_SET UNKNOWN)
diff --git a/Tests/RunCMake/target_sources/FileSetDirectories.cmake b/Tests/RunCMake/target_sources/FileSetDirectories.cmake
new file mode 100644
index 0000000000..af30b1ece1
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetDirectories.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+
+add_subdirectory(dir3)
+add_subdirectory(dir4)
diff --git a/Tests/RunCMake/target_sources/FileSetExport.cmake b/Tests/RunCMake/target_sources/FileSetExport.cmake
new file mode 100644
index 0000000000..cde826aeb1
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetExport.cmake
@@ -0,0 +1,21 @@
+enable_language(C)
+
+add_library(lib1 STATIC lib1.c)
+target_sources(lib1
+ PUBLIC FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES error.c
+ PRIVATE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h
+ PUBLIC FILE_SET b TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h2.h
+ INTERFACE FILE_SET c TYPE HEADERS BASE_DIRS "$<1:${CMAKE_CURRENT_SOURCE_DIR}/dir>" FILES "$<1:dir/dir.h>"
+ INTERFACE FILE_SET d TYPE HEADERS BASE_DIRS FILES "${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>/empty.h"
+ INTERFACE FILE_SET e TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>" FILES "${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>/empty2.h"
+ INTERFACE FILE_SET f TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES "${CMAKE_CURRENT_SOURCE_DIR}/empty3.h"
+ INTERFACE FILE_SET g TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/dir1" "${CMAKE_CURRENT_SOURCE_DIR}/dir2" FILES "${CMAKE_CURRENT_SOURCE_DIR}/dir1/file1.h" "${CMAKE_CURRENT_SOURCE_DIR}/dir2/file2.h"
+ INTERFACE FILE_SET dir3 TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/dir3" FILES dir3/dir3.h
+ )
+
+install(TARGETS lib1 EXPORT export FILE_SET HEADERS FILE_SET a FILE_SET b FILE_SET c DESTINATION include/dir FILE_SET d FILE_SET e FILE_SET f DESTINATION include/$<IF:$<CONFIG:Debug>,debug,release> FILE_SET g FILE_SET dir3 DESTINATION include/dir3)
+install(EXPORT export FILE export.cmake NAMESPACE install:: DESTINATION lib/cmake)
+export(EXPORT export FILE export.cmake NAMESPACE export::)
+
+add_library(lib2 STATIC lib2.c)
+target_link_libraries(lib2 PRIVATE lib1)
diff --git a/Tests/RunCMake/target_sources/FileSetFileNoExist-result.txt b/Tests/RunCMake/target_sources/FileSetFileNoExist-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetFileNoExist-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_sources/FileSetFileNoExist-stderr.txt b/Tests/RunCMake/target_sources/FileSetFileNoExist-stderr.txt
new file mode 100644
index 0000000000..9a2ca6ae59
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetFileNoExist-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Error at FileSetFileNoExist\.cmake:[0-9]+ \(add_library\):
+ Cannot find source file:
+
+ [^
+]*/Tests/RunCMake/target_sources/noexist\.h
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
+
+
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/target_sources/FileSetFileNoExist.cmake b/Tests/RunCMake/target_sources/FileSetFileNoExist.cmake
new file mode 100644
index 0000000000..0df8186820
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetFileNoExist.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+
+add_library(lib1 STATIC empty.c)
+target_sources(lib1 PRIVATE FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES noexist.h)
diff --git a/Tests/RunCMake/target_sources/FileSetImport.cmake b/Tests/RunCMake/target_sources/FileSetImport.cmake
new file mode 100644
index 0000000000..9c7358a305
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetImport.cmake
@@ -0,0 +1,97 @@
+enable_language(C)
+
+get_property(_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+
+function(assert_prop_eq tgt prop value)
+ unset(actual_value)
+ get_property(actual_value TARGET ${tgt} PROPERTY ${prop})
+ if(NOT actual_value STREQUAL value)
+ message(SEND_ERROR "Expected value of ${prop}:\n ${value}\nActual value:\n ${actual_value}")
+ endif()
+endfunction()
+
+get_filename_component(export_build_dir "${CMAKE_BINARY_DIR}" DIRECTORY)
+string(APPEND export_build_dir "/FileSetExport-build")
+
+include("${export_build_dir}/export.cmake")
+include("${export_build_dir}/install/lib/cmake/export.cmake")
+
+assert_prop_eq(export::lib1 HEADER_SETS "")
+assert_prop_eq(export::lib1 INTERFACE_HEADER_SETS "HEADERS;b;c;d;e;f;g;dir3")
+assert_prop_eq(export::lib1 HEADER_SET "${CMAKE_CURRENT_SOURCE_DIR}/error.c")
+assert_prop_eq(export::lib1 HEADER_DIRS "${CMAKE_CURRENT_SOURCE_DIR}")
+assert_prop_eq(export::lib1 HEADER_SET_b "${CMAKE_CURRENT_SOURCE_DIR}/h2.h")
+assert_prop_eq(export::lib1 HEADER_DIRS_b "${CMAKE_CURRENT_SOURCE_DIR}")
+assert_prop_eq(export::lib1 HEADER_SET_c "$<1:dir/dir.h>")
+assert_prop_eq(export::lib1 HEADER_DIRS_c "$<1:${CMAKE_CURRENT_SOURCE_DIR}/dir>")
+assert_prop_eq(export::lib1 HEADER_SET_d "${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>/empty.h")
+assert_prop_eq(export::lib1 HEADER_DIRS_d "${CMAKE_CURRENT_SOURCE_DIR}")
+assert_prop_eq(export::lib1 HEADER_SET_e "${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>/empty2.h")
+assert_prop_eq(export::lib1 HEADER_DIRS_e "${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>")
+assert_prop_eq(export::lib1 HEADER_SET_f "${CMAKE_CURRENT_SOURCE_DIR}/empty3.h")
+assert_prop_eq(export::lib1 HEADER_DIRS_f "${CMAKE_CURRENT_SOURCE_DIR}")
+assert_prop_eq(export::lib1 HEADER_SET_g "${CMAKE_CURRENT_SOURCE_DIR}/dir1/file1.h;${CMAKE_CURRENT_SOURCE_DIR}/dir2/file2.h")
+assert_prop_eq(export::lib1 HEADER_DIRS_g "${CMAKE_CURRENT_SOURCE_DIR}/dir1;${CMAKE_CURRENT_SOURCE_DIR}/dir2")
+assert_prop_eq(export::lib1 INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR};$<1:${CMAKE_CURRENT_SOURCE_DIR}/dir>;${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>;${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/dir1;${CMAKE_CURRENT_SOURCE_DIR}/dir2;${CMAKE_CURRENT_SOURCE_DIR}/dir3;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:$<1:${CMAKE_CURRENT_SOURCE_DIR}/dir>>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/$<IF:$<CONFIG:Debug>,debug,release>>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir1>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir2>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir3>")
+
+assert_prop_eq(install::lib1 HEADER_SETS "")
+assert_prop_eq(install::lib1 INTERFACE_HEADER_SETS "HEADERS;b;c;d;e;f;g;dir3")
+assert_prop_eq(install::lib1 HEADER_SET "${export_build_dir}/install/include/error.c")
+assert_prop_eq(install::lib1 HEADER_DIRS "${export_build_dir}/install/include")
+assert_prop_eq(install::lib1 HEADER_SET_b "${export_build_dir}/install/include/h2.h")
+assert_prop_eq(install::lib1 HEADER_DIRS_b "${export_build_dir}/install/include")
+assert_prop_eq(install::lib1 HEADER_SET_c "${export_build_dir}/install/include/dir/dir.h")
+assert_prop_eq(install::lib1 HEADER_DIRS_c "${export_build_dir}/install/include/dir")
+if(_multi_config)
+ assert_prop_eq(install::lib1 HEADER_SET_d "$<$<CONFIG:Debug>:${export_build_dir}/install/include/debug/empty.h>;$<$<CONFIG:Release>:${export_build_dir}/install/include/release/empty.h>")
+else()
+ assert_prop_eq(install::lib1 HEADER_SET_d "${export_build_dir}/install/include/debug/empty.h")
+endif()
+assert_prop_eq(install::lib1 HEADER_DIRS_d "${export_build_dir}/install/include")
+if(_multi_config)
+ assert_prop_eq(install::lib1 HEADER_SET_e "$<$<CONFIG:Debug>:${export_build_dir}/install/include/empty2.h>;$<$<CONFIG:Release>:${export_build_dir}/install/include/empty2.h>")
+else()
+ assert_prop_eq(install::lib1 HEADER_SET_e "${export_build_dir}/install/include/empty2.h")
+endif()
+assert_prop_eq(install::lib1 HEADER_DIRS_e "${export_build_dir}/install/include")
+if(_multi_config)
+ assert_prop_eq(install::lib1 HEADER_SET_f "$<$<CONFIG:Debug>:${export_build_dir}/install/include/debug/empty3.h>;$<$<CONFIG:Release>:${export_build_dir}/install/include/release/empty3.h>")
+ assert_prop_eq(install::lib1 HEADER_DIRS_f "$<$<CONFIG:Debug>:${export_build_dir}/install/include/debug>;$<$<CONFIG:Release>:${export_build_dir}/install/include/release>")
+else()
+ assert_prop_eq(install::lib1 HEADER_SET_f "${export_build_dir}/install/include/debug/empty3.h")
+ assert_prop_eq(install::lib1 HEADER_DIRS_f "${export_build_dir}/install/include/debug")
+endif()
+assert_prop_eq(install::lib1 HEADER_SET_g "${export_build_dir}/install/include/file1.h;${export_build_dir}/install/include/file2.h")
+assert_prop_eq(install::lib1 HEADER_DIRS_g "${export_build_dir}/install/include")
+if(_multi_config)
+ assert_prop_eq(install::lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include/dir>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:$<$<CONFIG:Debug>:${export_build_dir}/install/include/debug>>;$<BUILD_INTERFACE:$<$<CONFIG:Release>:${export_build_dir}/install/include/release>>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include/dir3>")
+else()
+ assert_prop_eq(install::lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include/dir>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include/debug>;$<BUILD_INTERFACE:${export_build_dir}/install/include>;$<BUILD_INTERFACE:${export_build_dir}/install/include/dir3>")
+endif()
+
+file(GLOB_RECURSE actual
+ LIST_DIRECTORIES TRUE
+ RELATIVE "${CMAKE_BINARY_DIR}/../FileSetExport-build/install/include"
+ "${CMAKE_BINARY_DIR}/../FileSetExport-build/install/include/*"
+ )
+if(actual)
+ list(SORT actual)
+endif()
+if(_multi_config)
+ set(expect "^debug;debug/empty\\.h;debug/empty3\\.h;dir;dir/dir\\.h;dir3;dir3/dir3\.h;empty2\\.h;error\\.c;file1\\.h;file2\\.h;h2\\.h;release;release/empty\\.h;release/empty3\\.h$")
+else()
+ set(expect "^debug;debug/empty\\.h;debug/empty3\\.h;dir;dir/dir\\.h;dir3;dir3/dir3\.h;empty2\\.h;error\\.c;file1\\.h;file2\\.h;h2\\.h$")
+endif()
+if(NOT "${actual}" MATCHES "${expect}")
+ message(SEND_ERROR "Installed files:
+ ${actual}
+do not match what we expected:
+ ${expect}
+in directory:
+ ${CMAKE_INSTALL_PREFIX}")
+endif()
+
+add_library(lib2_export STATIC lib2.c)
+target_link_libraries(lib2_export PRIVATE export::lib1)
+add_library(lib2_install STATIC lib2.c)
+target_link_libraries(lib2_install PRIVATE install::lib1)
diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface-result.txt b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface-stderr.txt b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface-stderr.txt
new file mode 100644
index 0000000000..694f227cbf
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at FileSetInstallMissingSetsInterface\.cmake:[0-9]+ \(install\):
+ install TARGETS target lib1 is exported but not all of its file sets are
+ installed
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface.cmake b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface.cmake
new file mode 100644
index 0000000000..face69e4ed
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterface.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+
+add_library(lib1 STATIC empty.c)
+target_sources(lib1 INTERFACE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h)
+install(TARGETS lib1 EXPORT a)
diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsPrivate.cmake b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsPrivate.cmake
new file mode 100644
index 0000000000..84778d104c
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsPrivate.cmake
@@ -0,0 +1,9 @@
+enable_language(C)
+
+add_library(lib1 STATIC empty.c)
+target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h)
+install(TARGETS lib1 EXPORT a)
+
+add_library(lib2 STATIC empty.c)
+target_sources(lib2 INTERFACE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h)
+install(TARGETS lib2)
diff --git a/Tests/RunCMake/target_sources/FileSetNoExistInterface-result.txt b/Tests/RunCMake/target_sources/FileSetNoExistInterface-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetNoExistInterface-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_sources/FileSetNoExistInterface-stderr.txt b/Tests/RunCMake/target_sources/FileSetNoExistInterface-stderr.txt
new file mode 100644
index 0000000000..3972c89efe
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetNoExistInterface-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at FileSetNoExistInterface\.cmake:[0-9]+ \(set_property\):
+ Header set "a" has not yet been created\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/target_sources/FileSetNoExistInterface.cmake b/Tests/RunCMake/target_sources/FileSetNoExistInterface.cmake
new file mode 100644
index 0000000000..266bc6161e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetNoExistInterface.cmake
@@ -0,0 +1,7 @@
+enable_language(C)
+
+add_library(lib1 STATIC empty.c)
+set_property(TARGET lib1 PROPERTY INTERFACE_HEADER_SETS "a")
+
+# Error happens at configure-time, so this doesn't help.
+target_sources(lib1 INTERFACE FILE_SET a TYPE HEADERS)
diff --git a/Tests/RunCMake/target_sources/FileSetNoExistPrivate-result.txt b/Tests/RunCMake/target_sources/FileSetNoExistPrivate-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetNoExistPrivate-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_sources/FileSetNoExistPrivate-stderr.txt b/Tests/RunCMake/target_sources/FileSetNoExistPrivate-stderr.txt
new file mode 100644
index 0000000000..336bafe00c
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetNoExistPrivate-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at FileSetNoExistPrivate\.cmake:[0-9]+ \(set_property\):
+ Header set "a" has not yet been created\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/target_sources/FileSetNoExistPrivate.cmake b/Tests/RunCMake/target_sources/FileSetNoExistPrivate.cmake
new file mode 100644
index 0000000000..f501912d1c
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetNoExistPrivate.cmake
@@ -0,0 +1,7 @@
+enable_language(C)
+
+add_library(lib1 STATIC empty.c)
+set_property(TARGET lib1 PROPERTY HEADER_SETS "a")
+
+# Error happens at configure-time, so this doesn't help.
+target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS)
diff --git a/Tests/RunCMake/target_sources/FileSetNoScope-result.txt b/Tests/RunCMake/target_sources/FileSetNoScope-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetNoScope-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_sources/FileSetNoScope-stderr.txt b/Tests/RunCMake/target_sources/FileSetNoScope-stderr.txt
new file mode 100644
index 0000000000..835ffe7b5f
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetNoScope-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at FileSetNoScope\.cmake:[0-9]+ \(target_sources\):
+ target_sources File set "a" is not in HEADER_SETS or INTERFACE_HEADER_SETS
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/target_sources/FileSetNoScope.cmake b/Tests/RunCMake/target_sources/FileSetNoScope.cmake
new file mode 100644
index 0000000000..79ff341500
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetNoScope.cmake
@@ -0,0 +1,6 @@
+enable_language(C)
+
+add_library(lib1 STATIC empty.c)
+target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h)
+set_property(TARGET lib1 PROPERTY HEADER_SETS)
+target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS FILES h2.h)
diff --git a/Tests/RunCMake/target_sources/FileSetNoType-result.txt b/Tests/RunCMake/target_sources/FileSetNoType-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetNoType-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_sources/FileSetNoType-stderr.txt b/Tests/RunCMake/target_sources/FileSetNoType-stderr.txt
new file mode 100644
index 0000000000..5405fdb778
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetNoType-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at FileSetNoType\.cmake:[0-9]+ \(target_sources\):
+ target_sources Must specify a TYPE when creating file set
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/target_sources/FileSetNoType.cmake b/Tests/RunCMake/target_sources/FileSetNoType.cmake
new file mode 100644
index 0000000000..961525d5cb
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetNoType.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+
+add_library(lib1 STATIC empty.c)
+target_sources(lib1 PRIVATE FILE_SET a)
diff --git a/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs-result.txt b/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs-stderr.txt b/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs-stderr.txt
new file mode 100644
index 0000000000..551b9e7cf7
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs-stderr.txt
@@ -0,0 +1,9 @@
+CMake Error at FileSetOverlappingBaseDirs\.cmake:[0-9]+ \(target_sources\):
+ Base directories in file set cannot be subdirectories of each other:
+
+ [^
+]*/Tests/RunCMake/target_sources/\.
+ [^
+]*/Tests/RunCMake/target_sources/dir3
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs.cmake b/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs.cmake
new file mode 100644
index 0000000000..eba4191cbc
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetOverlappingBaseDirs.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+
+add_library(lib1 STATIC empty.c)
+target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS BASE_DIRS $<1:${CMAKE_CURRENT_SOURCE_DIR}/.$<SEMICOLON>${CMAKE_CURRENT_SOURCE_DIR}/dir3> FILES h1.h)
diff --git a/Tests/RunCMake/target_sources/FileSetProperties.cmake b/Tests/RunCMake/target_sources/FileSetProperties.cmake
new file mode 100644
index 0000000000..ce010a30db
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetProperties.cmake
@@ -0,0 +1,67 @@
+enable_language(C)
+
+function(assert_prop_undef tgt prop)
+ unset(actual_value)
+ get_property(actual_value TARGET ${tgt} PROPERTY ${prop})
+ if(DEFINED actual_value)
+ message(SEND_ERROR "${prop} should be undefined, actual value:\n ${actual_value}")
+ endif()
+endfunction()
+
+function(assert_prop_eq tgt prop value)
+ unset(actual_value)
+ get_property(actual_value TARGET ${tgt} PROPERTY ${prop})
+ if(NOT actual_value STREQUAL value)
+ message(SEND_ERROR "Expected value of ${prop}:\n ${value}\nActual value:\n ${actual_value}")
+ endif()
+endfunction()
+
+add_library(lib1 STATIC empty.c)
+assert_prop_eq(lib1 HEADER_SETS "")
+assert_prop_eq(lib1 INTERFACE_HEADER_SETS "")
+assert_prop_undef(lib1 INCLUDE_DIRECTORIES)
+assert_prop_undef(lib1 INTERFACE_INCLUDE_DIRECTORIES)
+
+target_sources(lib1 PUBLIC FILE_SET a TYPE HEADERS BASE_DIRS "." FILES h1.h h2.h)
+assert_prop_eq(lib1 HEADER_SETS "a")
+assert_prop_eq(lib1 INTERFACE_HEADER_SETS "a")
+assert_prop_eq(lib1 HEADER_DIRS_a "${CMAKE_CURRENT_SOURCE_DIR}/.")
+assert_prop_eq(lib1 HEADER_SET_a "${CMAKE_CURRENT_SOURCE_DIR}/h1.h;${CMAKE_CURRENT_SOURCE_DIR}/h2.h")
+assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>")
+assert_prop_eq(lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>")
+
+target_sources(lib1 PUBLIC FILE_SET a FILES h3.h)
+assert_prop_eq(lib1 HEADER_SETS "a")
+assert_prop_eq(lib1 INTERFACE_HEADER_SETS "a")
+assert_prop_eq(lib1 HEADER_DIRS_a "${CMAKE_CURRENT_SOURCE_DIR}/.")
+assert_prop_eq(lib1 HEADER_SET_a "${CMAKE_CURRENT_SOURCE_DIR}/h1.h;${CMAKE_CURRENT_SOURCE_DIR}/h2.h;${CMAKE_CURRENT_SOURCE_DIR}/h3.h")
+assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>")
+assert_prop_eq(lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>")
+
+target_sources(lib1 PRIVATE FILE_SET b TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/dir" FILES dir/dir.h)
+assert_prop_eq(lib1 HEADER_SETS "a;b")
+assert_prop_eq(lib1 INTERFACE_HEADER_SETS "a")
+assert_prop_eq(lib1 HEADER_DIRS_b "${CMAKE_CURRENT_SOURCE_DIR}/dir")
+assert_prop_eq(lib1 HEADER_SET_b "${CMAKE_CURRENT_SOURCE_DIR}/dir/dir.h")
+assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir>")
+assert_prop_eq(lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>")
+
+target_sources(lib1 INTERFACE FILE_SET c TYPE HEADERS)
+assert_prop_eq(lib1 HEADER_SETS "a;b")
+assert_prop_eq(lib1 INTERFACE_HEADER_SETS "a;c")
+assert_prop_eq(lib1 HEADER_DIRS_c "${CMAKE_CURRENT_SOURCE_DIR}")
+assert_prop_eq(lib1 HEADER_SET_c "")
+assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir>")
+assert_prop_eq(lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
+
+target_sources(lib1 PUBLIC FILE_SET HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES h1.h)
+assert_prop_eq(lib1 HEADER_DIRS "${CMAKE_CURRENT_SOURCE_DIR}")
+assert_prop_eq(lib1 HEADER_SET "${CMAKE_CURRENT_SOURCE_DIR}/h1.h")
+assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
+assert_prop_eq(lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
+
+target_sources(lib1 PUBLIC FILE_SET HEADERS FILES h2.h)
+assert_prop_eq(lib1 HEADER_DIRS "${CMAKE_CURRENT_SOURCE_DIR}")
+assert_prop_eq(lib1 HEADER_SET "${CMAKE_CURRENT_SOURCE_DIR}/h1.h;${CMAKE_CURRENT_SOURCE_DIR}/h2.h")
+assert_prop_eq(lib1 INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/dir>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
+assert_prop_eq(lib1 INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/.>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>;$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
diff --git a/Tests/RunCMake/target_sources/FileSetWrongBaseDirs-result.txt b/Tests/RunCMake/target_sources/FileSetWrongBaseDirs-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetWrongBaseDirs-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_sources/FileSetWrongBaseDirs-stderr.txt b/Tests/RunCMake/target_sources/FileSetWrongBaseDirs-stderr.txt
new file mode 100644
index 0000000000..f4bd4471ad
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetWrongBaseDirs-stderr.txt
@@ -0,0 +1,12 @@
+CMake Error at FileSetWrongBaseDirs\.cmake:[0-9]+ \(target_sources\):
+ File:
+
+ [^
+]*/Tests/RunCMake/target_sources/h1\.h
+
+ must be in one of the file set's base directories:
+
+ [^
+]*/Tests/RunCMake/target_sources/dir3
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/target_sources/FileSetWrongBaseDirs.cmake b/Tests/RunCMake/target_sources/FileSetWrongBaseDirs.cmake
new file mode 100644
index 0000000000..38d3abdbb4
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetWrongBaseDirs.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+
+add_library(lib1 STATIC empty.c)
+target_sources(lib1 PRIVATE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/dir3 FILES h1.h)
diff --git a/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative-result.txt b/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative-stderr.txt b/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative-stderr.txt
new file mode 100644
index 0000000000..6bb0ec64aa
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative-stderr.txt
@@ -0,0 +1,10 @@
+CMake Error at reldir/CMakeLists\.txt:[0-9]+ \(target_sources\):
+ File:
+
+ [^
+]*/Tests/RunCMake/target_sources/reldir/\.\./h1\.h
+
+ must be in one of the file set's base directories:
+
+ [^
+]*/Tests/RunCMake/target_sources/reldir/\.
diff --git a/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative.cmake b/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative.cmake
new file mode 100644
index 0000000000..2ca8a8e4d6
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetWrongBaseDirsRelative.cmake
@@ -0,0 +1,3 @@
+enable_language(C)
+
+add_subdirectory(reldir)
diff --git a/Tests/RunCMake/target_sources/FileSetWrongType-result.txt b/Tests/RunCMake/target_sources/FileSetWrongType-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetWrongType-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_sources/FileSetWrongType-stderr.txt b/Tests/RunCMake/target_sources/FileSetWrongType-stderr.txt
new file mode 100644
index 0000000000..8ffa786183
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetWrongType-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at FileSetWrongType\.cmake:[0-9]+ \(target_sources\):
+ target_sources File set TYPE may only be "HEADERS"
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/target_sources/FileSetWrongType.cmake b/Tests/RunCMake/target_sources/FileSetWrongType.cmake
new file mode 100644
index 0000000000..b7dee72e9c
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetWrongType.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+
+add_library(lib1 STATIC empty.c)
+target_sources(lib1 PRIVATE FILE_SET a TYPE UNKNOWN)
diff --git a/Tests/RunCMake/TargetSources/OriginDebug-result.txt b/Tests/RunCMake/target_sources/OriginDebug-result.txt
index 573541ac97..573541ac97 100644
--- a/Tests/RunCMake/TargetSources/OriginDebug-result.txt
+++ b/Tests/RunCMake/target_sources/OriginDebug-result.txt
diff --git a/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt b/Tests/RunCMake/target_sources/OriginDebug-stderr.txt
index a40f463157..502d5f1536 100644
--- a/Tests/RunCMake/TargetSources/OriginDebug-stderr.txt
+++ b/Tests/RunCMake/target_sources/OriginDebug-stderr.txt
@@ -1,7 +1,7 @@
CMake Debug Log at OriginDebug.cmake:13 \(add_library\):
Used sources for target OriginDebug:
- \* .*Tests/RunCMake/TargetSources/empty_2.cpp
+ \* .*Tests/RunCMake/target_sources/empty_2.cpp
Call Stack \(most recent call first\):
CMakeLists\.txt:[0-9]+ \(include\)
@@ -9,7 +9,7 @@ Call Stack \(most recent call first\):
CMake Debug Log at OriginDebug.cmake:16 \(set_property\):
Used sources for target OriginDebug:
- \* .*Tests/RunCMake/TargetSources/empty_3.cpp
+ \* .*Tests/RunCMake/target_sources/empty_3.cpp
Call Stack \(most recent call first\):
CMakeLists\.txt:[0-9]+ \(include\)
@@ -17,7 +17,7 @@ Call Stack \(most recent call first\):
CMake Debug Log at OriginDebug.cmake:20 \(target_sources\):
Used sources for target OriginDebug:
- \* .*Tests/RunCMake/TargetSources/empty_4.cpp
+ \* .*Tests/RunCMake/target_sources/empty_4.cpp
Call Stack \(most recent call first\):
CMakeLists\.txt:[0-9]+ \(include\)
@@ -25,7 +25,7 @@ Call Stack \(most recent call first\):
CMake Debug Log at OriginDebug.cmake:14 \(target_link_libraries\):
Used sources for target OriginDebug:
- \* .*Tests/RunCMake/TargetSources/empty_1.cpp
+ \* .*Tests/RunCMake/target_sources/empty_1.cpp
Call Stack \(most recent call first\):
CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/TargetSources/OriginDebug.cmake b/Tests/RunCMake/target_sources/OriginDebug.cmake
index d40a1d82a9..d40a1d82a9 100644
--- a/Tests/RunCMake/TargetSources/OriginDebug.cmake
+++ b/Tests/RunCMake/target_sources/OriginDebug.cmake
diff --git a/Tests/RunCMake/target_sources/RelativePathInInterface-stdout.txt b/Tests/RunCMake/target_sources/RelativePathInInterface-stdout.txt
new file mode 100644
index 0000000000..19818b8b42
--- /dev/null
+++ b/Tests/RunCMake/target_sources/RelativePathInInterface-stdout.txt
@@ -0,0 +1 @@
+-- iface: .*Tests/RunCMake/target_sources/empty_1.cpp
diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake b/Tests/RunCMake/target_sources/RelativePathInInterface.cmake
index 0d3e9a4564..25b22ddc6a 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake
+++ b/Tests/RunCMake/target_sources/RelativePathInInterface.cmake
@@ -1,4 +1,5 @@
cmake_policy(SET CMP0076 NEW)
+enable_language(CXX)
add_library(iface INTERFACE)
target_sources(iface INTERFACE empty_1.cpp)
diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx-stdout.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx-stdout.txt
new file mode 100644
index 0000000000..a51a792598
--- /dev/null
+++ b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx-stdout.txt
@@ -0,0 +1 @@
+-- genexlib: \$<1:.*Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/subdir_empty_1.cpp>;\$<1:.*Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/../empty_1.cpp>;\$<1:empty_2.cpp>
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx.cmake b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx.cmake
index 1cdc2a7852..9afcea56aa 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx.cmake
+++ b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx.cmake
@@ -1,4 +1,5 @@
cmake_policy(SET CMP0076 NEW)
+enable_language(CXX)
add_library(genexlib)
add_subdirectory(RelativePathInSubdirGenEx)
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/CMakeLists.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/CMakeLists.txt
index 3bcf454da5..3bcf454da5 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/CMakeLists.txt
+++ b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/CMakeLists.txt
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/subdir_empty_1.cpp
index 11ec041d1e..11ec041d1e 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp
+++ b/Tests/RunCMake/target_sources/RelativePathInSubdirGenEx/subdir_empty_1.cpp
diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirInclude-stdout.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude-stdout.txt
new file mode 100644
index 0000000000..c42c88b475
--- /dev/null
+++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude-stdout.txt
@@ -0,0 +1 @@
+-- privatelib: .*Tests/RunCMake/target_sources/RelativePathInSubdirInclude/subdir_empty_1.cpp;empty_1.cpp
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude.cmake b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude.cmake
index 4acbecacc1..f5954c47bc 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude.cmake
+++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude.cmake
@@ -1,4 +1,5 @@
cmake_policy(SET CMP0076 NEW)
+enable_language(CXX)
add_library(privatelib)
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/CMakeLists.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude/CMakeLists.txt
index 3dcb13545a..3dcb13545a 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/CMakeLists.txt
+++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude/CMakeLists.txt
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude/subdir_empty_1.cpp
index 11ec041d1e..11ec041d1e 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp
+++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInclude/subdir_empty_1.cpp
diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirInterface-stdout.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface-stdout.txt
new file mode 100644
index 0000000000..ebbb29fb3c
--- /dev/null
+++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface-stdout.txt
@@ -0,0 +1 @@
+-- iface: .*Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_1.cpp;.*Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_2.cpp;.*Tests/RunCMake/target_sources/RelativePathInSubdirInterface/../empty_1.cpp;.*Tests/RunCMake/target_sources/RelativePathInSubdirInterface/../empty_2.cpp
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface.cmake b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface.cmake
index 3652b4f64b..6a4e2006d2 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface.cmake
+++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface.cmake
@@ -1,4 +1,5 @@
cmake_policy(SET CMP0076 NEW)
+enable_language(CXX)
add_library(iface INTERFACE)
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/CMakeLists.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/CMakeLists.txt
index 02e69669e5..02e69669e5 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/CMakeLists.txt
+++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/CMakeLists.txt
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_1.cpp
index 11ec041d1e..11ec041d1e 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp
+++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_1.cpp
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_2.cpp
index 11ec041d1e..11ec041d1e 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp
+++ b/Tests/RunCMake/target_sources/RelativePathInSubdirInterface/subdir_empty_2.cpp
diff --git a/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate-stdout.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate-stdout.txt
new file mode 100644
index 0000000000..104f1de240
--- /dev/null
+++ b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate-stdout.txt
@@ -0,0 +1 @@
+-- privatelib: .*Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_1.cpp;.*Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_2.cpp;.*Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/../empty_1.cpp;.*Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/../empty_2.cpp
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate.cmake b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate.cmake
index d0d3dc4419..dd16e3f8a0 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate.cmake
+++ b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate.cmake
@@ -1,4 +1,5 @@
cmake_policy(SET CMP0076 NEW)
+enable_language(CXX)
add_library(privatelib)
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/CMakeLists.txt b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/CMakeLists.txt
index 56ee853e1c..56ee853e1c 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/CMakeLists.txt
+++ b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/CMakeLists.txt
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_1.cpp
index 11ec041d1e..11ec041d1e 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp
+++ b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_1.cpp
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_2.cpp
index 11ec041d1e..11ec041d1e 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp
+++ b/Tests/RunCMake/target_sources/RelativePathInSubdirPrivate/subdir_empty_2.cpp
diff --git a/Tests/RunCMake/target_sources/RunCMakeTest.cmake b/Tests/RunCMake/target_sources/RunCMakeTest.cmake
index b67c5983eb..9828fa21bd 100644
--- a/Tests/RunCMake/target_sources/RunCMakeTest.cmake
+++ b/Tests/RunCMake/target_sources/RunCMakeTest.cmake
@@ -1,3 +1,80 @@
include(RunCMake)
-run_cmake(empty_keyword_args)
+if(RunCMake_GENERATOR STREQUAL "Xcode")
+ run_cmake(ConfigNotAllowed)
+endif()
+
+run_cmake(EmptyKeywordArgs)
+run_cmake(OriginDebug)
+run_cmake(CMP0026-LOCATION)
+run_cmake(CMP0076-OLD)
+run_cmake(CMP0076-WARN)
+run_cmake(RelativePathInInterface)
+run_cmake(RelativePathInSubdirGenEx)
+run_cmake(RelativePathInSubdirInterface)
+run_cmake(RelativePathInSubdirPrivate)
+run_cmake(RelativePathInSubdirInclude)
+run_cmake(ExportBuild)
+run_cmake(AddCustomTargetPublicSources)
+run_cmake(AddCustomTargetPrivateSources)
+run_cmake(AddCustomTargetInterfaceSources)
+run_cmake(AddCustomTargetSources)
+run_cmake(AddCustomTargetCheckProperty)
+run_cmake(AddCustomTargetGenx)
+
+run_cmake(FileSetProperties)
+run_cmake(FileSetNoType)
+run_cmake(FileSetWrongType)
+run_cmake(FileSetDefaultWrongType)
+run_cmake(FileSetChangeScope)
+run_cmake(FileSetChangeType)
+run_cmake(FileSetWrongBaseDirs)
+run_cmake(FileSetWrongBaseDirsRelative)
+run_cmake(FileSetOverlappingBaseDirs)
+run_cmake(FileSetInstallMissingSetsPrivate)
+run_cmake(FileSetInstallMissingSetsInterface)
+run_cmake(FileSetNoScope)
+run_cmake(FileSetNoExistPrivate)
+run_cmake(FileSetNoExistInterface)
+run_cmake(FileSetDirectories)
+
+set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0115=NEW)
+run_cmake(FileSetFileNoExist)
+unset(RunCMake_TEST_OPTIONS)
+
+function(run_export_import name)
+ if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(_config_options "-DCMAKE_CONFIGURATION_TYPES=Debug\\\\;Release")
+ else()
+ set(_config_options -DCMAKE_BUILD_TYPE=Debug)
+ endif()
+
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${name}Export-build")
+ set(RunCMake_TEST_OPTIONS "--install-prefix=${RunCMake_TEST_BINARY_DIR}/install" ${_config_options})
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ run_cmake(${name}Export)
+ run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --build . --config Debug)
+ run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --install . --config Debug)
+ if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --build . --config Release)
+ run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --install . --config Release)
+ endif()
+ unset(RunCMake_TEST_OPTIONS)
+
+ set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${name}Import-build")
+ unset(RunCMake_TEST_OPTIONS)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ run_cmake(${name}Import)
+ run_cmake_command(${name}Import-build ${CMAKE_COMMAND} --build . --config Debug)
+ if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ run_cmake_command(${name}Import-build ${CMAKE_COMMAND} --build . --config Release)
+ endif()
+
+ unset(RunCMake_TEST_BINARY_DIR)
+ unset(RunCMake_TEST_NO_CLEAN)
+endfunction()
+
+run_export_import(FileSet)
diff --git a/Tests/RunCMake/target_sources/debug/empty.h b/Tests/RunCMake/target_sources/debug/empty.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/target_sources/debug/empty.h
diff --git a/Tests/RunCMake/target_sources/debug/empty2.h b/Tests/RunCMake/target_sources/debug/empty2.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/target_sources/debug/empty2.h
diff --git a/Tests/RunCMake/target_sources/dir/dir.h b/Tests/RunCMake/target_sources/dir/dir.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/target_sources/dir/dir.h
diff --git a/Tests/RunCMake/target_sources/dir1/file1.h b/Tests/RunCMake/target_sources/dir1/file1.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/target_sources/dir1/file1.h
diff --git a/Tests/RunCMake/target_sources/dir2/file2.h b/Tests/RunCMake/target_sources/dir2/file2.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/target_sources/dir2/file2.h
diff --git a/Tests/RunCMake/target_sources/dir3/CMakeLists.txt b/Tests/RunCMake/target_sources/dir3/CMakeLists.txt
new file mode 100644
index 0000000000..e23ceb8266
--- /dev/null
+++ b/Tests/RunCMake/target_sources/dir3/CMakeLists.txt
@@ -0,0 +1 @@
+add_library(lib1 STATIC ../empty.c)
diff --git a/Tests/RunCMake/target_sources/dir3/dir3.h b/Tests/RunCMake/target_sources/dir3/dir3.h
new file mode 100644
index 0000000000..e45c25a12a
--- /dev/null
+++ b/Tests/RunCMake/target_sources/dir3/dir3.h
@@ -0,0 +1,4 @@
+#ifndef DIR3_H
+#define DIR3_H
+
+#endif
diff --git a/Tests/RunCMake/target_sources/dir4/CMakeLists.txt b/Tests/RunCMake/target_sources/dir4/CMakeLists.txt
new file mode 100644
index 0000000000..6475685c84
--- /dev/null
+++ b/Tests/RunCMake/target_sources/dir4/CMakeLists.txt
@@ -0,0 +1,4 @@
+target_sources(lib1 PRIVATE FILE_SET HEADERS BASE_DIRS ${CMAKE_SOURCE_DIR} FILES
+ $<1:dir3.h>
+ dir4.h
+ )
diff --git a/Tests/RunCMake/target_sources/dir4/dir4.h b/Tests/RunCMake/target_sources/dir4/dir4.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/target_sources/dir4/dir4.h
diff --git a/Tests/RunCMake/target_sources/empty.c b/Tests/RunCMake/target_sources/empty.c
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/target_sources/empty.c
diff --git a/Tests/RunCMake/target_sources/empty3.h b/Tests/RunCMake/target_sources/empty3.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/target_sources/empty3.h
diff --git a/Tests/RunCMake/TargetSources/empty_1.cpp b/Tests/RunCMake/target_sources/empty_1.cpp
index 11ec041d1e..11ec041d1e 100644
--- a/Tests/RunCMake/TargetSources/empty_1.cpp
+++ b/Tests/RunCMake/target_sources/empty_1.cpp
diff --git a/Tests/RunCMake/TargetSources/empty_2.cpp b/Tests/RunCMake/target_sources/empty_2.cpp
index 11ec041d1e..11ec041d1e 100644
--- a/Tests/RunCMake/TargetSources/empty_2.cpp
+++ b/Tests/RunCMake/target_sources/empty_2.cpp
diff --git a/Tests/RunCMake/TargetSources/empty_3.cpp b/Tests/RunCMake/target_sources/empty_3.cpp
index 11ec041d1e..11ec041d1e 100644
--- a/Tests/RunCMake/TargetSources/empty_3.cpp
+++ b/Tests/RunCMake/target_sources/empty_3.cpp
diff --git a/Tests/RunCMake/TargetSources/empty_4.cpp b/Tests/RunCMake/target_sources/empty_4.cpp
index 11ec041d1e..11ec041d1e 100644
--- a/Tests/RunCMake/TargetSources/empty_4.cpp
+++ b/Tests/RunCMake/target_sources/empty_4.cpp
diff --git a/Tests/RunCMake/target_sources/error.c b/Tests/RunCMake/target_sources/error.c
new file mode 100644
index 0000000000..f10e687006
--- /dev/null
+++ b/Tests/RunCMake/target_sources/error.c
@@ -0,0 +1 @@
+#error "This should not be compiled"
diff --git a/Tests/RunCMake/target_sources/h1.h b/Tests/RunCMake/target_sources/h1.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/target_sources/h1.h
diff --git a/Tests/RunCMake/target_sources/h2.h b/Tests/RunCMake/target_sources/h2.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/target_sources/h2.h
diff --git a/Tests/RunCMake/target_sources/h3.h b/Tests/RunCMake/target_sources/h3.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/target_sources/h3.h
diff --git a/Tests/RunCMake/target_sources/lib1.c b/Tests/RunCMake/target_sources/lib1.c
new file mode 100644
index 0000000000..95042def18
--- /dev/null
+++ b/Tests/RunCMake/target_sources/lib1.c
@@ -0,0 +1,6 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ void lib1(void)
+{
+}
diff --git a/Tests/RunCMake/target_sources/lib2.c b/Tests/RunCMake/target_sources/lib2.c
new file mode 100644
index 0000000000..a060dc9c7d
--- /dev/null
+++ b/Tests/RunCMake/target_sources/lib2.c
@@ -0,0 +1,8 @@
+#include <dir3.h>
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ void lib2(void)
+{
+}
diff --git a/Tests/RunCMake/TargetSources/main.cpp b/Tests/RunCMake/target_sources/main.cpp
index 766b7751bf..766b7751bf 100644
--- a/Tests/RunCMake/TargetSources/main.cpp
+++ b/Tests/RunCMake/target_sources/main.cpp
diff --git a/Tests/RunCMake/target_sources/reldir/CMakeLists.txt b/Tests/RunCMake/target_sources/reldir/CMakeLists.txt
new file mode 100644
index 0000000000..df22b25273
--- /dev/null
+++ b/Tests/RunCMake/target_sources/reldir/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(lib1 STATIC ../empty.c)
+target_sources(lib1 PRIVATE FILE_SET HEADERS BASE_DIRS . FILES ../h1.h)
diff --git a/Tests/RunCMake/target_sources/release/empty.h b/Tests/RunCMake/target_sources/release/empty.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/target_sources/release/empty.h
diff --git a/Tests/RunCMake/target_sources/release/empty2.h b/Tests/RunCMake/target_sources/release/empty2.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/target_sources/release/empty2.h
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index b19fd0ee99..dcd37996e5 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -28,7 +28,7 @@ run_cmake(TargetTypeInvalid)
run_cmake(TargetTypeStatic)
if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND
- CMAKE_C_COMPILER_ID MATCHES "^(MSVC|GNU|Clang|AppleClang)$")
+ CMAKE_C_COMPILER_ID MATCHES "^(MSVC|GNU|LCC|Clang|AppleClang)$")
set (RunCMake_TEST_OPTIONS -DRunCMake_C_COMPILER_ID=${CMAKE_C_COMPILER_ID})
run_cmake(LinkOptions)
unset (RunCMake_TEST_OPTIONS)
@@ -62,10 +62,10 @@ if(CMake_TEST_ISPC)
endif()
run_cmake(ISPCDuplicateTarget${ninja})
endif()
-if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
+if((CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) OR CMAKE_C_COMPILER_ID MATCHES "LCC")
run_cmake(CStandardGNU)
endif()
-if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
+if((CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) OR CMAKE_C_COMPILER_ID MATCHES "LCC")
run_cmake(CxxStandardGNU)
endif()
diff --git a/Tests/RunCMake/try_run/RunCMakeTest.cmake b/Tests/RunCMake/try_run/RunCMakeTest.cmake
index fa30eb4929..d74add05ca 100644
--- a/Tests/RunCMake/try_run/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_run/RunCMakeTest.cmake
@@ -3,7 +3,7 @@ include(RunCMake)
run_cmake(BadLinkLibraries)
if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND
- CMAKE_C_COMPILER_ID MATCHES "^(MSVC|GNU|Clang|AppleClang)$")
+ CMAKE_C_COMPILER_ID MATCHES "^(MSVC|GNU|LCC|Clang|AppleClang)$")
set (RunCMake_TEST_OPTIONS -DRunCMake_C_COMPILER_ID=${CMAKE_C_COMPILER_ID})
run_cmake(LinkOptions)
unset (RunCMake_TEST_OPTIONS)
diff --git a/Tests/SetLang/CMakeLists.txt b/Tests/SetLang/CMakeLists.txt
index 80348ab924..14e9d6e602 100644
--- a/Tests/SetLang/CMakeLists.txt
+++ b/Tests/SetLang/CMakeLists.txt
@@ -1,5 +1,8 @@
# test forcing a source file language to c++ from c
cmake_minimum_required (VERSION 2.6)
+if(POLICY CMP0129)
+ cmake_policy(SET CMP0129 NEW)
+endif()
project(SetLang)
# force this to be verbose so I can debug a dashboard entry
set(CMAKE_VERBOSE_MAKEFILE 1)
@@ -20,7 +23,7 @@ if(CMAKE_GENERATOR MATCHES "^Visual Studio" AND "x${CMAKE_C_COMPILER_ID}" STREQU
set_property(TARGET stay PROPERTY COMPILE_OPTIONS "-TP")
endif()
-if((CMAKE_C_COMPILER_ID MATCHES "(GNU|Clang|MSVC|Borland|Embarcadero|Intel|TI|XL)"))
+if((CMAKE_C_COMPILER_ID MATCHES "(GNU|LCC|Clang|MSVC|Borland|Embarcadero|Intel|TI|XL)"))
cmake_policy(SET CMP0119 NEW)
add_library(zoom zoom.zzz)
set_source_files_properties(zoom.zzz PROPERTIES LANGUAGE CXX)
diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt
index d0c413fb12..b1b9d57090 100644
--- a/Tests/TryCompile/CMakeLists.txt
+++ b/Tests/TryCompile/CMakeLists.txt
@@ -1,4 +1,7 @@
cmake_minimum_required (VERSION 2.8.12)
+if(POLICY CMP0129)
+ cmake_policy(SET CMP0129 NEW)
+endif()
project(TryCompile)
macro(TEST_ASSERT value msg)
@@ -321,7 +324,7 @@ if(DEFINED CXX_BOGUS_FLAG)
message(SEND_ERROR "CHECK_CXX_COMPILER_FLAG shouldn't construct CXX_BOGUS_FLAG as a normal variable")
endif()
-if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "LCC")
unset(C_STRICT_PROTOTYPES CACHE)
CHECK_C_COMPILER_FLAG("-Werror;-Wstrict-prototypes" C_STRICT_PROTOTYPES)
TEST_ASSERT(C_STRICT_PROTOTYPES "CHECK_C_COMPILER_FLAG failed -Werror -Wstrict-prototypes")
diff --git a/Tests/X11/CMakeLists.txt b/Tests/X11/CMakeLists.txt
index 76ae58c741..ba45e96be1 100644
--- a/Tests/X11/CMakeLists.txt
+++ b/Tests/X11/CMakeLists.txt
@@ -29,7 +29,6 @@ if(X11_FOUND)
target_link_libraries(HelloWorldX11 ${X11_LIBRARIES})
install(TARGETS HelloWorldX11 DESTINATION bin)
- set(CPACK_BINARY_OSXX11 ON CACHE BOOL "" FORCE)
set(CPACK_BINARY_PACKAGEMAKER OFF CACHE BOOL "" FORCE )
set(CPACK_PACKAGE_NAME HelloWorldX11Package)
set(CPACK_PACKAGE_EXECUTABLES HelloWorldX11 HelloWorldX11)
diff --git a/Utilities/Doxygen/CMakeLists.txt b/Utilities/Doxygen/CMakeLists.txt
index 69b4e2fd4e..72cfc05e45 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.1...3.20 FATAL_ERROR)
+ cmake_minimum_required(VERSION 3.1...3.21 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/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt
index c8a970dcaf..165d5570c5 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.1...3.20 FATAL_ERROR)
+ cmake_minimum_required(VERSION 3.1...3.21 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/cmbzip2/CMakeLists.txt b/Utilities/cmbzip2/CMakeLists.txt
index ff90bb6845..0db470fb5f 100644
--- a/Utilities/cmbzip2/CMakeLists.txt
+++ b/Utilities/cmbzip2/CMakeLists.txt
@@ -2,7 +2,7 @@ project(bzip2)
# Disable warnings to avoid changing 3rd party code.
if(CMAKE_C_COMPILER_ID MATCHES
- "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
+ "^(GNU|LCC|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt
index 9eef01aaf0..cd5d3542a5 100644
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -83,7 +83,7 @@ elseif(APPLE)
)
endif()
if(NOT OSX_VERSION VERSION_LESS 10.6 AND
- CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
+ CMAKE_C_COMPILER_ID MATCHES "GNU|LCC|Clang|AppleClang")
set(CMAKE_USE_SECTRANSP ON CACHE INTERNAL "enable Apple OS native SSL/TLS")
else()
set(CMAKE_USE_SECTRANSP OFF CACHE INTERNAL "enable Apple OS native SSL/TLS")
@@ -112,7 +112,7 @@ endif(APPLE)
# Disable warnings to avoid changing 3rd party code.
if(CMAKE_C_COMPILER_ID MATCHES
- "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
+ "^(GNU|LCC|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
diff --git a/Utilities/cmexpat/CMakeLists.txt b/Utilities/cmexpat/CMakeLists.txt
index ce7292728b..6e49fe4da5 100644
--- a/Utilities/cmexpat/CMakeLists.txt
+++ b/Utilities/cmexpat/CMakeLists.txt
@@ -1,6 +1,6 @@
# Disable warnings to avoid changing 3rd party code.
IF(CMAKE_C_COMPILER_ID MATCHES
- "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
+ "^(GNU|LCC|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
diff --git a/Utilities/cmjsoncpp/CMakeLists.txt b/Utilities/cmjsoncpp/CMakeLists.txt
index 029ae860c4..16613d421b 100644
--- a/Utilities/cmjsoncpp/CMakeLists.txt
+++ b/Utilities/cmjsoncpp/CMakeLists.txt
@@ -2,7 +2,7 @@ project(JsonCpp CXX)
# Disable warnings to avoid changing 3rd party code.
if(CMAKE_CXX_COMPILER_ID MATCHES
- "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
+ "^(GNU|LCC|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "PathScale")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -woffall")
diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt
index ba65470966..c1ac991cf2 100644
--- a/Utilities/cmlibarchive/CMakeLists.txt
+++ b/Utilities/cmlibarchive/CMakeLists.txt
@@ -94,7 +94,7 @@ SET(CMAKE_REQUIRED_FLAGS)
# Disable warnings to avoid changing 3rd party code.
IF(CMAKE_C_COMPILER_ID MATCHES
- "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
+ "^(GNU|LCC|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
@@ -110,7 +110,7 @@ endif ()
# Especially for early development, we want to be a little
# aggressive about diagnosing build problems; this can get
# relaxed somewhat in final shipping versions.
-IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$")
+IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR CMAKE_C_COMPILER_ID MATCHES "^LCC$")
SET(CMAKE_REQUIRED_FLAGS "-Wall -Wformat -Wformat-security")
#################################################################
# Set compile flags for all build types.
@@ -126,7 +126,7 @@ IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wshadow")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wmissing-prototypes")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wcast-qual")
-ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$")
+ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR CMAKE_C_COMPILER_ID MATCHES "^LCC$")
IF (CMAKE_C_COMPILER_ID MATCHES "^Clang$")
SET(CMAKE_REQUIRED_FLAGS "-Wall -Wformat -Wformat-security")
#################################################################
@@ -1038,7 +1038,7 @@ ENDMACRO(CHECK_CRYPTO_WIN CRYPTO_LIST)
MACRO(CHECK_ICONV LIB TRY_ICONV_CONST)
IF(NOT HAVE_ICONV)
CMAKE_PUSH_CHECK_STATE() # Save the state of the variables
- IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR
+ IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR CMAKE_C_COMPILER_ID MATCHES "^LCC$" OR
CMAKE_C_COMPILER_ID MATCHES "^Clang$")
#
# During checking iconv proto type, we should use -Werror to avoid the
@@ -1046,7 +1046,7 @@ MACRO(CHECK_ICONV LIB TRY_ICONV_CONST)
# detection. So this needs for all build mode(even it's a release mode).
#
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror")
- ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR
+ ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR CMAKE_C_COMPILER_ID MATCHES "^LCC$" OR
CMAKE_C_COMPILER_ID MATCHES "^Clang$")
IF (CMAKE_C_COMPILER_ID MATCHES "^XL$")
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -qhalt=w -qflag=w:w")
@@ -1335,7 +1335,7 @@ ENDIF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX
# Check functions
#
CMAKE_PUSH_CHECK_STATE() # Save the state of the variables
-IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR
+IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR CMAKE_C_COMPILER_ID MATCHES "^LCC$" OR
CMAKE_C_COMPILER_ID MATCHES "^Clang$")
#
# During checking functions, we should use -fno-builtin to avoid the
@@ -1343,7 +1343,7 @@ IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR
# types for built-in function" caused by using -Werror option.
#
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-builtin")
-ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR
+ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR CMAKE_C_COMPILER_ID MATCHES "^LCC$" OR
CMAKE_C_COMPILER_ID MATCHES "^Clang$")
CHECK_SYMBOL_EXISTS(_CrtSetReportMode "crtdbg.h" HAVE__CrtSetReportMode)
CHECK_FUNCTION_EXISTS_GLIBC(arc4random_buf HAVE_ARC4RANDOM_BUF)
diff --git a/Utilities/cmliblzma/CMakeLists.txt b/Utilities/cmliblzma/CMakeLists.txt
index 4820a8fd01..c779920749 100644
--- a/Utilities/cmliblzma/CMakeLists.txt
+++ b/Utilities/cmliblzma/CMakeLists.txt
@@ -160,7 +160,7 @@ INCLUDE_DIRECTORIES(
# Disable warnings to avoid changing 3rd party code.
IF(CMAKE_C_COMPILER_ID MATCHES
- "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
+ "^(GNU|LCC|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
@@ -172,7 +172,7 @@ IF(CMAKE_C_COMPILER_ID STREQUAL "XL")
# Disable the XL compiler optimizer because it causes crashes
# and other bad behavior in liblzma code.
SET_PROPERTY(TARGET cmliblzma PROPERTY COMPILE_FLAGS "-qnooptimize")
-ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND
+ELSEIF((CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "LCC") AND
CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
# Disable the old GNU compiler optimizer.
SET_PROPERTY(TARGET cmliblzma PROPERTY COMPILE_FLAGS "-O0")
diff --git a/Utilities/cmlibrhash/CMakeLists.txt b/Utilities/cmlibrhash/CMakeLists.txt
index 1a01165c09..99c76cc38b 100644
--- a/Utilities/cmlibrhash/CMakeLists.txt
+++ b/Utilities/cmlibrhash/CMakeLists.txt
@@ -2,7 +2,7 @@ project(librhash C)
# Disable warnings to avoid changing 3rd party code.
if(CMAKE_C_COMPILER_ID MATCHES
- "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
+ "^(GNU|LCC|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
diff --git a/Utilities/cmlibuv/CMakeLists.txt b/Utilities/cmlibuv/CMakeLists.txt
index 086345c8b9..fd68dd1f47 100644
--- a/Utilities/cmlibuv/CMakeLists.txt
+++ b/Utilities/cmlibuv/CMakeLists.txt
@@ -2,7 +2,7 @@ project(libuv C)
# Disable warnings to avoid changing 3rd party code.
if(CMAKE_C_COMPILER_ID MATCHES
- "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
+ "^(GNU|LCC|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
@@ -202,6 +202,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
)
list(APPEND uv_defines _GNU_SOURCE)
list(APPEND uv_sources
+ src/unix/epoll.c
src/unix/linux-core.c
src/unix/linux-inotify.c
src/unix/linux-syscalls.c
diff --git a/Utilities/cmlibuv/include/uv.h b/Utilities/cmlibuv/include/uv.h
index 11891df8e2..48213e2077 100644
--- a/Utilities/cmlibuv/include/uv.h
+++ b/Utilities/cmlibuv/include/uv.h
@@ -130,6 +130,7 @@ extern "C" {
XX(ENOTEMPTY, "directory not empty") \
XX(ENOTSOCK, "socket operation on non-socket") \
XX(ENOTSUP, "operation not supported on socket") \
+ XX(EOVERFLOW, "value too large for defined data type") \
XX(EPERM, "operation not permitted") \
XX(EPIPE, "broken pipe") \
XX(EPROTO, "protocol error") \
@@ -152,6 +153,7 @@ extern "C" {
XX(ENOTTY, "inappropriate ioctl for device") \
XX(EFTYPE, "inappropriate file type or format") \
XX(EILSEQ, "illegal byte sequence") \
+ XX(ESOCKTNOSUPPORT, "socket type not supported") \
#define UV_HANDLE_TYPE_MAP(XX) \
XX(ASYNC, async) \
@@ -479,6 +481,12 @@ UV_EXTERN int uv_fileno(const uv_handle_t* handle, uv_os_fd_t* fd);
UV_EXTERN uv_buf_t uv_buf_init(char* base, unsigned int len);
+UV_EXTERN int uv_pipe(uv_file fds[2], int read_flags, int write_flags);
+UV_EXTERN int uv_socketpair(int type,
+ int protocol,
+ uv_os_sock_t socket_vector[2],
+ int flags0,
+ int flags1);
#define UV_STREAM_FIELDS \
/* number of bytes queued for writing */ \
@@ -524,6 +532,10 @@ UV_EXTERN int uv_write2(uv_write_t* req,
UV_EXTERN int uv_try_write(uv_stream_t* handle,
const uv_buf_t bufs[],
unsigned int nbufs);
+UV_EXTERN int uv_try_write2(uv_stream_t* handle,
+ const uv_buf_t bufs[],
+ unsigned int nbufs,
+ uv_stream_t* send_handle);
/* uv_write_t is a subclass of uv_req_t. */
struct uv_write_s {
@@ -624,7 +636,14 @@ enum uv_udp_flags {
* in uv_udp_recv_cb, nread will always be 0 and addr will always be NULL.
*/
UV_UDP_MMSG_FREE = 16,
-
+ /*
+ * Indicates if IP_RECVERR/IPV6_RECVERR will be set when binding the handle.
+ * This sets IP_RECVERR for IPv4 and IPV6_RECVERR for IPv6 UDP sockets on
+ * Linux. This stops the Linux kernel from suppressing some ICMP error
+ * messages and enables full ICMP error reporting for faster failover.
+ * This flag is no-op on platforms other than Linux.
+ */
+ UV_UDP_LINUX_RECVERR = 32,
/*
* Indicates that recvmmsg should be used, if available.
*/
@@ -937,10 +956,13 @@ typedef enum {
UV_WRITABLE_PIPE = 0x20,
/*
- * Open the child pipe handle in overlapped mode on Windows.
- * On Unix it is silently ignored.
+ * When UV_CREATE_PIPE is specified, specifying UV_NONBLOCK_PIPE opens the
+ * handle in non-blocking mode in the child. This may cause loss of data,
+ * if the child is not designed to handle to encounter this mode,
+ * but can also be significantly more efficient.
*/
- UV_OVERLAPPED_PIPE = 0x40
+ UV_NONBLOCK_PIPE = 0x40,
+ UV_OVERLAPPED_PIPE = 0x40 /* old name, for compatibility */
} uv_stdio_flags;
typedef struct uv_stdio_container_s {
diff --git a/Utilities/cmlibuv/include/uv/errno.h b/Utilities/cmlibuv/include/uv/errno.h
index 8d4d7686d2..71906b3f5e 100644
--- a/Utilities/cmlibuv/include/uv/errno.h
+++ b/Utilities/cmlibuv/include/uv/errno.h
@@ -317,7 +317,7 @@
#if defined(EPROTO) && !defined(_WIN32)
# define UV__EPROTO UV__ERR(EPROTO)
#else
-# define UV__EPROTO UV__ERR(-4046)
+# define UV__EPROTO (-4046)
#endif
#if defined(EPROTONOSUPPORT) && !defined(_WIN32)
@@ -445,4 +445,16 @@
# define UV__EILSEQ (-4027)
#endif
+#if defined(EOVERFLOW) && !defined(_WIN32)
+# define UV__EOVERFLOW UV__ERR(EOVERFLOW)
+#else
+# define UV__EOVERFLOW (-4026)
+#endif
+
+#if defined(ESOCKTNOSUPPORT) && !defined(_WIN32)
+# define UV__ESOCKTNOSUPPORT UV__ERR(ESOCKTNOSUPPORT)
+#else
+# define UV__ESOCKTNOSUPPORT (-4025)
+#endif
+
#endif /* UV_ERRNO_H_ */
diff --git a/Utilities/cmlibuv/include/uv/tree.h b/Utilities/cmlibuv/include/uv/tree.h
index f936416e3d..2b28835fde 100644
--- a/Utilities/cmlibuv/include/uv/tree.h
+++ b/Utilities/cmlibuv/include/uv/tree.h
@@ -251,7 +251,7 @@ void name##_SPLAY_MINMAX(struct name *head, int __comp) \
SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL; \
__left = __right = &__node; \
\
- while (1) { \
+ for (;;) { \
if (__comp < 0) { \
__tmp = SPLAY_LEFT((head)->sph_root, field); \
if (__tmp == NULL) \
diff --git a/Utilities/cmlibuv/include/uv/unix.h b/Utilities/cmlibuv/include/uv/unix.h
index a59192fa41..7a5a3cb54b 100644
--- a/Utilities/cmlibuv/include/uv/unix.h
+++ b/Utilities/cmlibuv/include/uv/unix.h
@@ -72,12 +72,10 @@
# include "bsd.h"
#elif defined(__CYGWIN__) || \
defined(__MSYS__) || \
+ defined(__HAIKU__) || \
+ defined(__QNX__) || \
defined(__GNU__)
# include "posix.h"
-#elif defined(__HAIKU__)
-# include "posix.h"
-#elif defined(__QNX__)
-# include "posix.h"
#endif
#ifndef NI_MAXHOST
diff --git a/Utilities/cmlibuv/include/uv/version.h b/Utilities/cmlibuv/include/uv/version.h
index 96c1c130f2..ab5ed00954 100644
--- a/Utilities/cmlibuv/include/uv/version.h
+++ b/Utilities/cmlibuv/include/uv/version.h
@@ -31,7 +31,7 @@
*/
#define UV_VERSION_MAJOR 1
-#define UV_VERSION_MINOR 39
+#define UV_VERSION_MINOR 42
#define UV_VERSION_PATCH 1
#define UV_VERSION_IS_RELEASE 0
#define UV_VERSION_SUFFIX "dev"
diff --git a/Utilities/cmlibuv/src/idna.c b/Utilities/cmlibuv/src/idna.c
index 13ffac6be8..b44cb16a1e 100644
--- a/Utilities/cmlibuv/src/idna.c
+++ b/Utilities/cmlibuv/src/idna.c
@@ -19,6 +19,7 @@
#include "uv.h"
#include "idna.h"
+#include <assert.h>
#include <string.h>
static unsigned uv__utf8_decode1_slow(const char** p,
@@ -32,7 +33,7 @@ static unsigned uv__utf8_decode1_slow(const char** p,
if (a > 0xF7)
return -1;
- switch (*p - pe) {
+ switch (pe - *p) {
default:
if (a > 0xEF) {
min = 0x10000;
@@ -62,6 +63,8 @@ static unsigned uv__utf8_decode1_slow(const char** p,
a = 0;
break;
}
+ /* Fall through. */
+ case 0:
return -1; /* Invalid continuation byte. */
}
@@ -88,6 +91,8 @@ static unsigned uv__utf8_decode1_slow(const char** p,
unsigned uv__utf8_decode1(const char** p, const char* pe) {
unsigned a;
+ assert(*p < pe);
+
a = (unsigned char) *(*p)++;
if (a < 128)
@@ -96,9 +101,6 @@ unsigned uv__utf8_decode1(const char** p, const char* pe) {
return uv__utf8_decode1_slow(p, pe, a);
}
-#define foreach_codepoint(c, p, pe) \
- for (; (void) (*p <= pe && (c = uv__utf8_decode1(p, pe))), *p <= pe;)
-
static int uv__idna_toascii_label(const char* s, const char* se,
char** d, char* de) {
static const char alphabet[] = "abcdefghijklmnopqrstuvwxyz0123456789";
@@ -121,15 +123,22 @@ static int uv__idna_toascii_label(const char* s, const char* se,
ss = s;
todo = 0;
- foreach_codepoint(c, &s, se) {
+ /* Note: after this loop we've visited all UTF-8 characters and know
+ * they're legal so we no longer need to check for decode errors.
+ */
+ while (s < se) {
+ c = uv__utf8_decode1(&s, se);
+
+ if (c == -1u)
+ return UV_EINVAL;
+
if (c < 128)
h++;
- else if (c == (unsigned) -1)
- return UV_EINVAL;
else
todo++;
}
+ /* Only write "xn--" when there are non-ASCII characters. */
if (todo > 0) {
if (*d < de) *(*d)++ = 'x';
if (*d < de) *(*d)++ = 'n';
@@ -137,9 +146,13 @@ static int uv__idna_toascii_label(const char* s, const char* se,
if (*d < de) *(*d)++ = '-';
}
+ /* Write ASCII characters. */
x = 0;
s = ss;
- foreach_codepoint(c, &s, se) {
+ while (s < se) {
+ c = uv__utf8_decode1(&s, se);
+ assert(c != -1u);
+
if (c > 127)
continue;
@@ -166,10 +179,15 @@ static int uv__idna_toascii_label(const char* s, const char* se,
while (todo > 0) {
m = -1;
s = ss;
- foreach_codepoint(c, &s, se)
+
+ while (s < se) {
+ c = uv__utf8_decode1(&s, se);
+ assert(c != -1u);
+
if (c >= n)
if (c < m)
m = c;
+ }
x = m - n;
y = h + 1;
@@ -181,7 +199,10 @@ static int uv__idna_toascii_label(const char* s, const char* se,
n = m;
s = ss;
- foreach_codepoint(c, &s, se) {
+ while (s < se) {
+ c = uv__utf8_decode1(&s, se);
+ assert(c != -1u);
+
if (c < n)
if (++delta == 0)
return UV_E2BIG; /* Overflow. */
@@ -245,8 +266,6 @@ static int uv__idna_toascii_label(const char* s, const char* se,
return 0;
}
-#undef foreach_codepoint
-
long uv__idna_toascii(const char* s, const char* se, char* d, char* de) {
const char* si;
const char* st;
@@ -256,10 +275,14 @@ long uv__idna_toascii(const char* s, const char* se, char* d, char* de) {
ds = d;
- for (si = s; si < se; /* empty */) {
+ si = s;
+ while (si < se) {
st = si;
c = uv__utf8_decode1(&si, se);
+ if (c == -1u)
+ return UV_EINVAL;
+
if (c != '.')
if (c != 0x3002) /* 。 */
if (c != 0xFF0E) /* . */
diff --git a/Utilities/cmlibuv/src/inet.c b/Utilities/cmlibuv/src/inet.c
index 58238dcbb6..384c0f7261 100644
--- a/Utilities/cmlibuv/src/inet.c
+++ b/Utilities/cmlibuv/src/inet.c
@@ -141,8 +141,9 @@ static int inet_ntop6(const unsigned char *src, char *dst, size_t size) {
if (best.base != -1 && (best.base + best.len) == ARRAY_SIZE(words))
*tp++ = ':';
*tp++ = '\0';
- if (UV_E2BIG == uv__strscpy(dst, tmp, size))
+ if ((size_t) (tp - tmp) > size)
return UV_ENOSPC;
+ uv__strscpy(dst, tmp, size);
return 0;
}
diff --git a/Utilities/cmlibuv/src/threadpool.c b/Utilities/cmlibuv/src/threadpool.c
index 0998938f3e..869ae95f58 100644
--- a/Utilities/cmlibuv/src/threadpool.c
+++ b/Utilities/cmlibuv/src/threadpool.c
@@ -161,7 +161,6 @@ static void post(QUEUE* q, enum uv__work_kind kind) {
void uv__threadpool_cleanup(void) {
-#ifndef _WIN32
unsigned int i;
if (nthreads == 0)
@@ -181,7 +180,6 @@ void uv__threadpool_cleanup(void) {
threads = NULL;
nthreads = 0;
-#endif
}
diff --git a/Utilities/cmlibuv/src/timer.c b/Utilities/cmlibuv/src/timer.c
index 1bea2a8bd2..bc680e71a9 100644
--- a/Utilities/cmlibuv/src/timer.c
+++ b/Utilities/cmlibuv/src/timer.c
@@ -58,6 +58,7 @@ static int timer_less_than(const struct heap_node* ha,
int uv_timer_init(uv_loop_t* loop, uv_timer_t* handle) {
uv__handle_init(loop, (uv_handle_t*)handle, UV_TIMER);
handle->timer_cb = NULL;
+ handle->timeout = 0;
handle->repeat = 0;
return 0;
}
diff --git a/Utilities/cmlibuv/src/unix/async.c b/Utilities/cmlibuv/src/unix/async.c
index 5f58fb88d6..e1805c3237 100644
--- a/Utilities/cmlibuv/src/unix/async.c
+++ b/Utilities/cmlibuv/src/unix/async.c
@@ -214,7 +214,7 @@ static int uv__async_start(uv_loop_t* loop) {
pipefd[0] = err;
pipefd[1] = -1;
#else
- err = uv__make_pipe(pipefd, UV__F_NONBLOCK);
+ err = uv__make_pipe(pipefd, UV_NONBLOCK_PIPE);
if (err < 0)
return err;
#endif
diff --git a/Utilities/cmlibuv/src/unix/atomic-ops.h b/Utilities/cmlibuv/src/unix/atomic-ops.h
index 2518a0680f..63d8268ab5 100644
--- a/Utilities/cmlibuv/src/unix/atomic-ops.h
+++ b/Utilities/cmlibuv/src/unix/atomic-ops.h
@@ -58,9 +58,11 @@ UV_UNUSED(static int cmpxchgi(int* ptr, int oldval, int newval)) {
UV_UNUSED(static void cpu_relax(void)) {
#if defined(__i386__) || defined(__x86_64__)
- __asm__ __volatile__ ("rep; nop"); /* a.k.a. PAUSE */
+ __asm__ __volatile__ ("rep; nop" ::: "memory"); /* a.k.a. PAUSE */
#elif (defined(__arm__) && __ARM_ARCH >= 7) || defined(__aarch64__)
- __asm__ volatile("yield");
+ __asm__ __volatile__ ("yield" ::: "memory");
+#elif defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__)
+ __asm__ __volatile__ ("or 1,1,1; or 2,2,2" ::: "memory");
#endif
}
diff --git a/Utilities/cmlibuv/src/unix/bsd-ifaddrs.c b/Utilities/cmlibuv/src/unix/bsd-ifaddrs.c
index 5223ab4879..e48934bce2 100644
--- a/Utilities/cmlibuv/src/unix/bsd-ifaddrs.c
+++ b/Utilities/cmlibuv/src/unix/bsd-ifaddrs.c
@@ -42,8 +42,8 @@ static int uv__ifaddr_exclude(struct ifaddrs *ent, int exclude_type) {
return 1;
#if !defined(__CYGWIN__) && !defined(__MSYS__)
/*
- * If `exclude_type` is `UV__EXCLUDE_IFPHYS`, just see whether `sa_family`
- * equals to `AF_LINK` or not. Otherwise, the result depends on the operation
+ * If `exclude_type` is `UV__EXCLUDE_IFPHYS`, return whether `sa_family`
+ * equals `AF_LINK`. Otherwise, the result depends on the operating
* system with `AF_LINK` or `PF_INET`.
*/
if (exclude_type == UV__EXCLUDE_IFPHYS)
@@ -53,7 +53,7 @@ static int uv__ifaddr_exclude(struct ifaddrs *ent, int exclude_type) {
defined(__HAIKU__)
/*
* On BSD getifaddrs returns information related to the raw underlying
- * devices. We're not interested in this information.
+ * devices. We're not interested in this information.
*/
if (ent->ifa_addr->sa_family == AF_LINK)
return 1;
diff --git a/Utilities/cmlibuv/src/unix/bsd-proctitle.c b/Utilities/cmlibuv/src/unix/bsd-proctitle.c
index 723b81c01c..4f4e9e5183 100644
--- a/Utilities/cmlibuv/src/unix/bsd-proctitle.c
+++ b/Utilities/cmlibuv/src/unix/bsd-proctitle.c
@@ -38,9 +38,7 @@ static void init_process_title_mutex_once(void) {
void uv__process_title_cleanup(void) {
- /* TODO(bnoordhuis) uv_mutex_destroy(&process_title_mutex)
- * and reset process_title_mutex_once?
- */
+ uv_mutex_destroy(&process_title_mutex);
}
diff --git a/Utilities/cmlibuv/src/unix/cmake-bootstrap.c b/Utilities/cmlibuv/src/unix/cmake-bootstrap.c
index 054775ece9..0f279d5216 100644
--- a/Utilities/cmlibuv/src/unix/cmake-bootstrap.c
+++ b/Utilities/cmlibuv/src/unix/cmake-bootstrap.c
@@ -7,27 +7,10 @@ void uv__process_title_cleanup(void) {
void uv__threadpool_cleanup(void) {
}
-int uv__tcp_nodelay(int fd, int on) {
- errno = EINVAL;
- return -1;
-}
-
-int uv__tcp_keepalive(int fd, int on, unsigned int delay) {
- errno = EINVAL;
- return -1;
-}
-
-int uv_tcp_listen(uv_tcp_t* tcp, int backlog, uv_connection_cb cb) {
- return -EINVAL;
-}
-
int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock) {
return -EINVAL;
}
-void uv__tcp_close(uv_tcp_t* handle) {
-}
-
void uv__udp_close(uv_udp_t* handle) {
}
@@ -153,8 +136,8 @@ int uv__statx(int dirfd,
return -1;
}
-ssize_t uv__fs_copy_file_range(int fd_in, ssize_t* off_in,
- int fd_out, ssize_t* off_out,
+ssize_t uv__fs_copy_file_range(int fd_in, off_t* off_in,
+ int fd_out, off_t* off_out,
size_t len, unsigned int flags)
{
errno = ENOSYS;
diff --git a/Utilities/cmlibuv/src/unix/core.c b/Utilities/cmlibuv/src/unix/core.c
index 4245e027a6..225f775825 100644
--- a/Utilities/cmlibuv/src/unix/core.c
+++ b/Utilities/cmlibuv/src/unix/core.c
@@ -94,6 +94,10 @@ extern char** environ;
# define uv__accept4 accept4
#endif
+#if defined(__linux__) && defined(__SANITIZE_THREAD__) && defined(__clang__)
+# include <sanitizer/linux_syscall_hooks.h>
+#endif
+
static int uv__run_pending(uv_loop_t* loop);
/* Verify that uv_buf_t is ABI-compatible with struct iovec. */
@@ -545,7 +549,13 @@ int uv__close_nocancel(int fd) {
return close$NOCANCEL$UNIX2003(fd);
#endif
#pragma GCC diagnostic pop
-#elif defined(__linux__)
+#elif defined(__linux__) && defined(__SANITIZE_THREAD__) && defined(__clang__)
+ long rc;
+ __sanitizer_syscall_pre_close(fd);
+ rc = syscall(SYS_close, fd);
+ __sanitizer_syscall_post_close(rc, fd);
+ return rc;
+#elif defined(__linux__) && !defined(__SANITIZE_THREAD__)
return syscall(SYS_close, fd);
#else
return close(fd);
@@ -580,7 +590,7 @@ int uv__close(int fd) {
return uv__close_nocheckstdio(fd);
}
-
+#if UV__NONBLOCK_IS_IOCTL
int uv__nonblock_ioctl(int fd, int set) {
int r;
@@ -595,7 +605,6 @@ int uv__nonblock_ioctl(int fd, int set) {
}
-#if !defined(__hpux) && !defined(__CYGWIN__) && !defined(__MSYS__) && !defined(__HAIKU__)
int uv__cloexec_ioctl(int fd, int set) {
int r;
@@ -931,13 +940,12 @@ void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
if (w->pevents == 0) {
QUEUE_REMOVE(&w->watcher_queue);
QUEUE_INIT(&w->watcher_queue);
+ w->events = 0;
- if (loop->watchers[w->fd] != NULL) {
- assert(loop->watchers[w->fd] == w);
+ if (w == loop->watchers[w->fd]) {
assert(loop->nfds > 0);
loop->watchers[w->fd] = NULL;
loop->nfds--;
- w->events = 0;
}
}
else if (QUEUE_EMPTY(&w->watcher_queue))
@@ -1181,7 +1189,9 @@ int uv__getpwuid_r(uv_passwd_t* pwd) {
if (buf == NULL)
return UV_ENOMEM;
- r = getpwuid_r(uid, &pw, buf, bufsize, &result);
+ do
+ r = getpwuid_r(uid, &pw, buf, bufsize, &result);
+ while (r == EINTR);
if (r != ERANGE)
break;
@@ -1191,7 +1201,7 @@ int uv__getpwuid_r(uv_passwd_t* pwd) {
if (r != 0) {
uv__free(buf);
- return -r;
+ return UV__ERR(r);
}
if (result == NULL) {
@@ -1586,7 +1596,7 @@ int uv__search_path(const char* prog, char* buf, size_t* buflen) {
buf[*buflen] = '\0';
return 0;
- }
+ }
/* Case iii). Search PATH environment variable */
cloned_path = NULL;
diff --git a/Utilities/cmlibuv/src/unix/darwin.c b/Utilities/cmlibuv/src/unix/darwin.c
index d0ecd452d8..a7be0dd2f3 100644
--- a/Utilities/cmlibuv/src/unix/darwin.c
+++ b/Utilities/cmlibuv/src/unix/darwin.c
@@ -33,9 +33,7 @@
#include <sys/sysctl.h>
#include <unistd.h> /* sysconf */
-#if !TARGET_OS_IPHONE
#include "darwin-stub.h"
-#endif
static uv_once_t once = UV_ONCE_INIT;
static uint64_t (*time_func)(void);
@@ -223,10 +221,10 @@ static int uv__get_cpu_speed(uint64_t* speed) {
err = UV_ENOENT;
core_foundation_handle = dlopen("/System/Library/Frameworks/"
"CoreFoundation.framework/"
- "Versions/A/CoreFoundation",
+ "CoreFoundation",
RTLD_LAZY | RTLD_LOCAL);
iokit_handle = dlopen("/System/Library/Frameworks/IOKit.framework/"
- "Versions/A/IOKit",
+ "IOKit",
RTLD_LAZY | RTLD_LOCAL);
if (core_foundation_handle == NULL || iokit_handle == NULL)
@@ -304,6 +302,12 @@ static int uv__get_cpu_speed(uint64_t* speed) {
pIOObjectRelease(it);
err = 0;
+
+ if (device_type_str != NULL)
+ pCFRelease(device_type_str);
+ if (clock_frequency_str != NULL)
+ pCFRelease(clock_frequency_str);
+
out:
if (core_foundation_handle != NULL)
dlclose(core_foundation_handle);
diff --git a/Utilities/cmlibuv/src/unix/epoll.c b/Utilities/cmlibuv/src/unix/epoll.c
new file mode 100644
index 0000000000..97348e254b
--- /dev/null
+++ b/Utilities/cmlibuv/src/unix/epoll.c
@@ -0,0 +1,422 @@
+/* Copyright libuv contributors. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "uv.h"
+#include "internal.h"
+#include <errno.h>
+#include <sys/epoll.h>
+
+int uv__epoll_init(uv_loop_t* loop) {
+ int fd;
+ fd = epoll_create1(O_CLOEXEC);
+
+ /* epoll_create1() can fail either because it's not implemented (old kernel)
+ * or because it doesn't understand the O_CLOEXEC flag.
+ */
+ if (fd == -1 && (errno == ENOSYS || errno == EINVAL)) {
+ fd = epoll_create(256);
+
+ if (fd != -1)
+ uv__cloexec(fd, 1);
+ }
+
+ loop->backend_fd = fd;
+ if (fd == -1)
+ return UV__ERR(errno);
+
+ return 0;
+}
+
+
+void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
+ struct epoll_event* events;
+ struct epoll_event dummy;
+ uintptr_t i;
+ uintptr_t nfds;
+
+ assert(loop->watchers != NULL);
+ assert(fd >= 0);
+
+ events = (struct epoll_event*) loop->watchers[loop->nwatchers];
+ nfds = (uintptr_t) loop->watchers[loop->nwatchers + 1];
+ if (events != NULL)
+ /* Invalidate events with same file descriptor */
+ for (i = 0; i < nfds; i++)
+ if (events[i].data.fd == fd)
+ events[i].data.fd = -1;
+
+ /* Remove the file descriptor from the epoll.
+ * This avoids a problem where the same file description remains open
+ * in another process, causing repeated junk epoll events.
+ *
+ * We pass in a dummy epoll_event, to work around a bug in old kernels.
+ */
+ if (loop->backend_fd >= 0) {
+ /* Work around a bug in kernels 3.10 to 3.19 where passing a struct that
+ * has the EPOLLWAKEUP flag set generates spurious audit syslog warnings.
+ */
+ memset(&dummy, 0, sizeof(dummy));
+ epoll_ctl(loop->backend_fd, EPOLL_CTL_DEL, fd, &dummy);
+ }
+}
+
+
+int uv__io_check_fd(uv_loop_t* loop, int fd) {
+ struct epoll_event e;
+ int rc;
+
+ memset(&e, 0, sizeof(e));
+ e.events = POLLIN;
+ e.data.fd = -1;
+
+ rc = 0;
+ if (epoll_ctl(loop->backend_fd, EPOLL_CTL_ADD, fd, &e))
+ if (errno != EEXIST)
+ rc = UV__ERR(errno);
+
+ if (rc == 0)
+ if (epoll_ctl(loop->backend_fd, EPOLL_CTL_DEL, fd, &e))
+ abort();
+
+ return rc;
+}
+
+
+void uv__io_poll(uv_loop_t* loop, int timeout) {
+ /* A bug in kernels < 2.6.37 makes timeouts larger than ~30 minutes
+ * effectively infinite on 32 bits architectures. To avoid blocking
+ * indefinitely, we cap the timeout and poll again if necessary.
+ *
+ * Note that "30 minutes" is a simplification because it depends on
+ * the value of CONFIG_HZ. The magic constant assumes CONFIG_HZ=1200,
+ * that being the largest value I have seen in the wild (and only once.)
+ */
+ static const int max_safe_timeout = 1789569;
+ static int no_epoll_pwait_cached;
+ static int no_epoll_wait_cached;
+ int no_epoll_pwait;
+ int no_epoll_wait;
+ struct epoll_event events[1024];
+ struct epoll_event* pe;
+ struct epoll_event e;
+ int real_timeout;
+ QUEUE* q;
+ uv__io_t* w;
+ sigset_t sigset;
+ uint64_t sigmask;
+ uint64_t base;
+ int have_signals;
+ int nevents;
+ int count;
+ int nfds;
+ int fd;
+ int op;
+ int i;
+ int user_timeout;
+ int reset_timeout;
+
+ if (loop->nfds == 0) {
+ assert(QUEUE_EMPTY(&loop->watcher_queue));
+ return;
+ }
+
+ memset(&e, 0, sizeof(e));
+
+ while (!QUEUE_EMPTY(&loop->watcher_queue)) {
+ q = QUEUE_HEAD(&loop->watcher_queue);
+ QUEUE_REMOVE(q);
+ QUEUE_INIT(q);
+
+ w = QUEUE_DATA(q, uv__io_t, watcher_queue);
+ assert(w->pevents != 0);
+ assert(w->fd >= 0);
+ assert(w->fd < (int) loop->nwatchers);
+
+ e.events = w->pevents;
+ e.data.fd = w->fd;
+
+ if (w->events == 0)
+ op = EPOLL_CTL_ADD;
+ else
+ op = EPOLL_CTL_MOD;
+
+ /* XXX Future optimization: do EPOLL_CTL_MOD lazily if we stop watching
+ * events, skip the syscall and squelch the events after epoll_wait().
+ */
+ if (epoll_ctl(loop->backend_fd, op, w->fd, &e)) {
+ if (errno != EEXIST)
+ abort();
+
+ assert(op == EPOLL_CTL_ADD);
+
+ /* We've reactivated a file descriptor that's been watched before. */
+ if (epoll_ctl(loop->backend_fd, EPOLL_CTL_MOD, w->fd, &e))
+ abort();
+ }
+
+ w->events = w->pevents;
+ }
+
+ sigmask = 0;
+ if (loop->flags & UV_LOOP_BLOCK_SIGPROF) {
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGPROF);
+ sigmask |= 1 << (SIGPROF - 1);
+ }
+
+ assert(timeout >= -1);
+ base = loop->time;
+ count = 48; /* Benchmarks suggest this gives the best throughput. */
+ real_timeout = timeout;
+
+ if (uv__get_internal_fields(loop)->flags & UV_METRICS_IDLE_TIME) {
+ reset_timeout = 1;
+ user_timeout = timeout;
+ timeout = 0;
+ } else {
+ reset_timeout = 0;
+ user_timeout = 0;
+ }
+
+ /* You could argue there is a dependency between these two but
+ * ultimately we don't care about their ordering with respect
+ * to one another. Worst case, we make a few system calls that
+ * could have been avoided because another thread already knows
+ * they fail with ENOSYS. Hardly the end of the world.
+ */
+ no_epoll_pwait = uv__load_relaxed(&no_epoll_pwait_cached);
+ no_epoll_wait = uv__load_relaxed(&no_epoll_wait_cached);
+
+ for (;;) {
+ /* Only need to set the provider_entry_time if timeout != 0. The function
+ * will return early if the loop isn't configured with UV_METRICS_IDLE_TIME.
+ */
+ if (timeout != 0)
+ uv__metrics_set_provider_entry_time(loop);
+
+ /* See the comment for max_safe_timeout for an explanation of why
+ * this is necessary. Executive summary: kernel bug workaround.
+ */
+ if (sizeof(int32_t) == sizeof(long) && timeout >= max_safe_timeout)
+ timeout = max_safe_timeout;
+
+ if (sigmask != 0 && no_epoll_pwait != 0)
+ if (pthread_sigmask(SIG_BLOCK, &sigset, NULL))
+ abort();
+
+ if (no_epoll_wait != 0 || (sigmask != 0 && no_epoll_pwait == 0)) {
+ nfds = epoll_pwait(loop->backend_fd,
+ events,
+ ARRAY_SIZE(events),
+ timeout,
+ &sigset);
+ if (nfds == -1 && errno == ENOSYS) {
+ uv__store_relaxed(&no_epoll_pwait_cached, 1);
+ no_epoll_pwait = 1;
+ }
+ } else {
+ nfds = epoll_wait(loop->backend_fd,
+ events,
+ ARRAY_SIZE(events),
+ timeout);
+ if (nfds == -1 && errno == ENOSYS) {
+ uv__store_relaxed(&no_epoll_wait_cached, 1);
+ no_epoll_wait = 1;
+ }
+ }
+
+ if (sigmask != 0 && no_epoll_pwait != 0)
+ if (pthread_sigmask(SIG_UNBLOCK, &sigset, NULL))
+ abort();
+
+ /* Update loop->time unconditionally. It's tempting to skip the update when
+ * timeout == 0 (i.e. non-blocking poll) but there is no guarantee that the
+ * operating system didn't reschedule our process while in the syscall.
+ */
+ SAVE_ERRNO(uv__update_time(loop));
+
+ if (nfds == 0) {
+ assert(timeout != -1);
+
+ if (reset_timeout != 0) {
+ timeout = user_timeout;
+ reset_timeout = 0;
+ }
+
+ if (timeout == -1)
+ continue;
+
+ if (timeout == 0)
+ return;
+
+ /* We may have been inside the system call for longer than |timeout|
+ * milliseconds so we need to update the timestamp to avoid drift.
+ */
+ goto update_timeout;
+ }
+
+ if (nfds == -1) {
+ if (errno == ENOSYS) {
+ /* epoll_wait() or epoll_pwait() failed, try the other system call. */
+ assert(no_epoll_wait == 0 || no_epoll_pwait == 0);
+ continue;
+ }
+
+ if (errno != EINTR)
+ abort();
+
+ if (reset_timeout != 0) {
+ timeout = user_timeout;
+ reset_timeout = 0;
+ }
+
+ if (timeout == -1)
+ continue;
+
+ if (timeout == 0)
+ return;
+
+ /* Interrupted by a signal. Update timeout and poll again. */
+ goto update_timeout;
+ }
+
+ have_signals = 0;
+ nevents = 0;
+
+ {
+ /* Squelch a -Waddress-of-packed-member warning with gcc >= 9. */
+ union {
+ struct epoll_event* events;
+ uv__io_t* watchers;
+ } x;
+
+ x.events = events;
+ assert(loop->watchers != NULL);
+ loop->watchers[loop->nwatchers] = x.watchers;
+ loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds;
+ }
+
+ for (i = 0; i < nfds; i++) {
+ pe = events + i;
+ fd = pe->data.fd;
+
+ /* Skip invalidated events, see uv__platform_invalidate_fd */
+ if (fd == -1)
+ continue;
+
+ assert(fd >= 0);
+ assert((unsigned) fd < loop->nwatchers);
+
+ w = loop->watchers[fd];
+
+ if (w == NULL) {
+ /* File descriptor that we've stopped watching, disarm it.
+ *
+ * Ignore all errors because we may be racing with another thread
+ * when the file descriptor is closed.
+ */
+ epoll_ctl(loop->backend_fd, EPOLL_CTL_DEL, fd, pe);
+ continue;
+ }
+
+ /* Give users only events they're interested in. Prevents spurious
+ * callbacks when previous callback invocation in this loop has stopped
+ * the current watcher. Also, filters out events that users has not
+ * requested us to watch.
+ */
+ pe->events &= w->pevents | POLLERR | POLLHUP;
+
+ /* Work around an epoll quirk where it sometimes reports just the
+ * EPOLLERR or EPOLLHUP event. In order to force the event loop to
+ * move forward, we merge in the read/write events that the watcher
+ * is interested in; uv__read() and uv__write() will then deal with
+ * the error or hangup in the usual fashion.
+ *
+ * Note to self: happens when epoll reports EPOLLIN|EPOLLHUP, the user
+ * reads the available data, calls uv_read_stop(), then sometime later
+ * calls uv_read_start() again. By then, libuv has forgotten about the
+ * hangup and the kernel won't report EPOLLIN again because there's
+ * nothing left to read. If anything, libuv is to blame here. The
+ * current hack is just a quick bandaid; to properly fix it, libuv
+ * needs to remember the error/hangup event. We should get that for
+ * free when we switch over to edge-triggered I/O.
+ */
+ if (pe->events == POLLERR || pe->events == POLLHUP)
+ pe->events |=
+ w->pevents & (POLLIN | POLLOUT | UV__POLLRDHUP | UV__POLLPRI);
+
+ if (pe->events != 0) {
+ /* Run signal watchers last. This also affects child process watchers
+ * because those are implemented in terms of signal watchers.
+ */
+ if (w == &loop->signal_io_watcher) {
+ have_signals = 1;
+ } else {
+ uv__metrics_update_idle_time(loop);
+ w->cb(loop, w, pe->events);
+ }
+
+ nevents++;
+ }
+ }
+
+ if (reset_timeout != 0) {
+ timeout = user_timeout;
+ reset_timeout = 0;
+ }
+
+ if (have_signals != 0) {
+ uv__metrics_update_idle_time(loop);
+ loop->signal_io_watcher.cb(loop, &loop->signal_io_watcher, POLLIN);
+ }
+
+ loop->watchers[loop->nwatchers] = NULL;
+ loop->watchers[loop->nwatchers + 1] = NULL;
+
+ if (have_signals != 0)
+ return; /* Event loop should cycle now so don't poll again. */
+
+ if (nevents != 0) {
+ if (nfds == ARRAY_SIZE(events) && --count != 0) {
+ /* Poll for more events but don't block this time. */
+ timeout = 0;
+ continue;
+ }
+ return;
+ }
+
+ if (timeout == 0)
+ return;
+
+ if (timeout == -1)
+ continue;
+
+update_timeout:
+ assert(timeout > 0);
+
+ real_timeout -= (loop->time - base);
+ if (real_timeout <= 0)
+ return;
+
+ timeout = real_timeout;
+ }
+}
+
diff --git a/Utilities/cmlibuv/src/unix/freebsd.c b/Utilities/cmlibuv/src/unix/freebsd.c
index fe795a0e75..170b897e20 100644
--- a/Utilities/cmlibuv/src/unix/freebsd.c
+++ b/Utilities/cmlibuv/src/unix/freebsd.c
@@ -265,8 +265,11 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
int uv__sendmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen) {
-#if __FreeBSD__ >= 11
- return sendmmsg(fd, mmsg, vlen, /* flags */ 0);
+#if __FreeBSD__ >= 11 && !defined(__DragonFly__)
+ return sendmmsg(fd,
+ (struct mmsghdr*) mmsg,
+ vlen,
+ 0 /* flags */);
#else
return errno = ENOSYS, -1;
#endif
@@ -274,8 +277,12 @@ int uv__sendmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen) {
int uv__recvmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen) {
-#if __FreeBSD__ >= 11
- return recvmmsg(fd, mmsg, vlen, 0 /* flags */, NULL /* timeout */);
+#if __FreeBSD__ >= 11 && !defined(__DragonFly__)
+ return recvmmsg(fd,
+ (struct mmsghdr*) mmsg,
+ vlen,
+ 0 /* flags */,
+ NULL /* timeout */);
#else
return errno = ENOSYS, -1;
#endif
diff --git a/Utilities/cmlibuv/src/unix/fs.c b/Utilities/cmlibuv/src/unix/fs.c
index 6d57cee904..40448f1c72 100644
--- a/Utilities/cmlibuv/src/unix/fs.c
+++ b/Utilities/cmlibuv/src/unix/fs.c
@@ -56,8 +56,13 @@
# define HAVE_PREADV 0
#endif
+#if defined(__linux__)
+# include "sys/utsname.h"
+#endif
+
#if defined(__linux__) || defined(__sun)
# include <sys/sendfile.h>
+# include <sys/sysmacros.h>
#endif
#if defined(__APPLE__)
@@ -212,14 +217,30 @@ static ssize_t uv__fs_fdatasync(uv_fs_t* req) {
UV_UNUSED(static struct timespec uv__fs_to_timespec(double time)) {
struct timespec ts;
ts.tv_sec = time;
- ts.tv_nsec = (uint64_t)(time * 1000000) % 1000000 * 1000;
+ ts.tv_nsec = (time - ts.tv_sec) * 1e9;
+
+ /* TODO(bnoordhuis) Remove this. utimesat() has nanosecond resolution but we
+ * stick to microsecond resolution for the sake of consistency with other
+ * platforms. I'm the original author of this compatibility hack but I'm
+ * less convinced it's useful nowadays.
+ */
+ ts.tv_nsec -= ts.tv_nsec % 1000;
+
+ if (ts.tv_nsec < 0) {
+ ts.tv_nsec += 1e9;
+ ts.tv_sec -= 1;
+ }
return ts;
}
UV_UNUSED(static struct timeval uv__fs_to_timeval(double time)) {
struct timeval tv;
tv.tv_sec = time;
- tv.tv_usec = (uint64_t)(time * 1000000) % 1000000;
+ tv.tv_usec = (time - tv.tv_sec) * 1e6;
+ if (tv.tv_usec < 0) {
+ tv.tv_usec += 1e6;
+ tv.tv_sec -= 1;
+ }
return tv;
}
@@ -227,9 +248,6 @@ static ssize_t uv__fs_futime(uv_fs_t* req) {
#if defined(__linux__) \
|| defined(_AIX71) \
|| defined(__HAIKU__)
- /* utimesat() has nanosecond resolution but we stick to microseconds
- * for the sake of consistency with other platforms.
- */
struct timespec ts[2];
ts[0] = uv__fs_to_timespec(req->atime);
ts[1] = uv__fs_to_timespec(req->mtime);
@@ -897,6 +915,115 @@ out:
}
+#ifdef __linux__
+static unsigned uv__kernel_version(void) {
+ static unsigned cached_version;
+ struct utsname u;
+ unsigned version;
+ unsigned major;
+ unsigned minor;
+ unsigned patch;
+
+ version = uv__load_relaxed(&cached_version);
+ if (version != 0)
+ return version;
+
+ if (-1 == uname(&u))
+ return 0;
+
+ if (3 != sscanf(u.release, "%u.%u.%u", &major, &minor, &patch))
+ return 0;
+
+ version = major * 65536 + minor * 256 + patch;
+ uv__store_relaxed(&cached_version, version);
+
+ return version;
+}
+
+
+/* Pre-4.20 kernels have a bug where CephFS uses the RADOS copy-from command
+ * in copy_file_range() when it shouldn't. There is no workaround except to
+ * fall back to a regular copy.
+ */
+static int uv__is_buggy_cephfs(int fd) {
+ struct statfs s;
+
+ if (-1 == fstatfs(fd, &s))
+ return 0;
+
+ if (s.f_type != /* CephFS */ 0xC36400)
+ return 0;
+
+ return uv__kernel_version() < /* 4.20.0 */ 0x041400;
+}
+
+
+static int uv__is_cifs_or_smb(int fd) {
+ struct statfs s;
+
+ if (-1 == fstatfs(fd, &s))
+ return 0;
+
+ switch ((unsigned) s.f_type) {
+ case 0x0000517Bu: /* SMB */
+ case 0xFE534D42u: /* SMB2 */
+ case 0xFF534D42u: /* CIFS */
+ return 1;
+ }
+
+ return 0;
+}
+
+
+static ssize_t uv__fs_try_copy_file_range(int in_fd, off_t* off,
+ int out_fd, size_t len) {
+ static int no_copy_file_range_support;
+ ssize_t r;
+
+ if (uv__load_relaxed(&no_copy_file_range_support)) {
+ errno = ENOSYS;
+ return -1;
+ }
+
+ r = uv__fs_copy_file_range(in_fd, off, out_fd, NULL, len, 0);
+
+ if (r != -1)
+ return r;
+
+ switch (errno) {
+ case EACCES:
+ /* Pre-4.20 kernels have a bug where CephFS uses the RADOS
+ * copy-from command when it shouldn't.
+ */
+ if (uv__is_buggy_cephfs(in_fd))
+ errno = ENOSYS; /* Use fallback. */
+ break;
+ case ENOSYS:
+ uv__store_relaxed(&no_copy_file_range_support, 1);
+ break;
+ case EPERM:
+ /* It's been reported that CIFS spuriously fails.
+ * Consider it a transient error.
+ */
+ if (uv__is_cifs_or_smb(out_fd))
+ errno = ENOSYS; /* Use fallback. */
+ break;
+ case ENOTSUP:
+ case EXDEV:
+ /* ENOTSUP - it could work on another file system type.
+ * EXDEV - it will not work when in_fd and out_fd are not on the same
+ * mounted filesystem (pre Linux 5.3)
+ */
+ errno = ENOSYS; /* Use fallback. */
+ break;
+ }
+
+ return -1;
+}
+
+#endif /* __linux__ */
+
+
static ssize_t uv__fs_sendfile(uv_fs_t* req) {
int in_fd;
int out_fd;
@@ -908,29 +1035,22 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) {
{
off_t off;
ssize_t r;
+ size_t len;
+ int try_sendfile;
off = req->off;
+ len = req->bufsml[0].len;
#ifdef __linux__
- {
- static int copy_file_range_support = 1;
-
- if (copy_file_range_support) {
- r = uv__fs_copy_file_range(in_fd, NULL, out_fd, &off, req->bufsml[0].len, 0);
-
- if (r == -1 && errno == ENOSYS) {
- errno = 0;
- copy_file_range_support = 0;
- } else {
- goto ok;
- }
- }
- }
+ r = uv__fs_try_copy_file_range(in_fd, &off, out_fd, len);
+ try_sendfile = (r == -1 && errno == ENOSYS);
+#else
+ try_sendfile = 1;
#endif
- r = sendfile(out_fd, in_fd, &off, req->bufsml[0].len);
+ if (try_sendfile)
+ r = sendfile(out_fd, in_fd, &off, len);
-ok:
/* sendfile() on SunOS returns EINVAL if the target fd is not a socket but
* it still writes out data. Fortunately, we can detect it by checking if
* the offset has been updated.
@@ -1020,9 +1140,6 @@ static ssize_t uv__fs_utime(uv_fs_t* req) {
|| defined(_AIX71) \
|| defined(__sun) \
|| defined(__HAIKU__)
- /* utimesat() has nanosecond resolution but we stick to microseconds
- * for the sake of consistency with other platforms.
- */
struct timespec ts[2];
ts[0] = uv__fs_to_timespec(req->atime);
ts[1] = uv__fs_to_timespec(req->mtime);
@@ -1217,22 +1334,15 @@ static ssize_t uv__fs_copyfile(uv_fs_t* req) {
if (fchmod(dstfd, src_statsbuf.st_mode) == -1) {
err = UV__ERR(errno);
#ifdef __linux__
+ /* fchmod() on CIFS shares always fails with EPERM unless the share is
+ * mounted with "noperm". As fchmod() is a meaningless operation on such
+ * shares anyway, detect that condition and squelch the error.
+ */
if (err != UV_EPERM)
goto out;
- {
- struct statfs s;
-
- /* fchmod() on CIFS shares always fails with EPERM unless the share is
- * mounted with "noperm". As fchmod() is a meaningless operation on such
- * shares anyway, detect that condition and squelch the error.
- */
- if (fstatfs(dstfd, &s) == -1)
- goto out;
-
- if (s.f_type != /* CIFS */ 0xFF534D42u)
- goto out;
- }
+ if (!uv__is_cifs_or_smb(dstfd))
+ goto out;
err = 0;
#else /* !__linux__ */
@@ -1350,7 +1460,8 @@ static void uv__to_stat(struct stat* src, uv_stat_t* dst) {
dst->st_birthtim.tv_nsec = src->st_ctimensec;
dst->st_flags = 0;
dst->st_gen = 0;
-#elif !defined(_AIX) && ( \
+#elif !defined(_AIX) && \
+ !defined(__MVS__) && ( \
defined(__DragonFly__) || \
defined(__FreeBSD__) || \
defined(__OpenBSD__) || \
@@ -1430,8 +1541,9 @@ static int uv__fs_statx(int fd,
case -1:
/* EPERM happens when a seccomp filter rejects the system call.
* Has been observed with libseccomp < 2.3.3 and docker < 18.04.
+ * EOPNOTSUPP is used on DVS exported filesystems
*/
- if (errno != EINVAL && errno != EPERM && errno != ENOSYS)
+ if (errno != EINVAL && errno != EPERM && errno != ENOSYS && errno != EOPNOTSUPP)
return -1;
/* Fall through. */
default:
@@ -1444,12 +1556,12 @@ static int uv__fs_statx(int fd,
return UV_ENOSYS;
}
- buf->st_dev = 256 * statxbuf.stx_dev_major + statxbuf.stx_dev_minor;
+ buf->st_dev = makedev(statxbuf.stx_dev_major, statxbuf.stx_dev_minor);
buf->st_mode = statxbuf.stx_mode;
buf->st_nlink = statxbuf.stx_nlink;
buf->st_uid = statxbuf.stx_uid;
buf->st_gid = statxbuf.stx_gid;
- buf->st_rdev = statxbuf.stx_rdev_major;
+ buf->st_rdev = makedev(statxbuf.stx_rdev_major, statxbuf.stx_rdev_minor);
buf->st_ino = statxbuf.stx_ino;
buf->st_size = statxbuf.stx_size;
buf->st_blksize = statxbuf.stx_blksize;
diff --git a/Utilities/cmlibuv/src/unix/fsevents.c b/Utilities/cmlibuv/src/unix/fsevents.c
index a51f29b3f6..bf4f1f6a51 100644
--- a/Utilities/cmlibuv/src/unix/fsevents.c
+++ b/Utilities/cmlibuv/src/unix/fsevents.c
@@ -595,8 +595,7 @@ out:
static int uv__fsevents_loop_init(uv_loop_t* loop) {
CFRunLoopSourceContext ctx;
uv__cf_loop_state_t* state;
- pthread_attr_t attr_storage;
- pthread_attr_t* attr;
+ pthread_attr_t attr;
int err;
if (loop->cf_state != NULL)
@@ -641,25 +640,19 @@ static int uv__fsevents_loop_init(uv_loop_t* loop) {
goto fail_signal_source_create;
}
- /* In the unlikely event that pthread_attr_init() fails, create the thread
- * with the default stack size. We'll use a little more address space but
- * that in itself is not a fatal error.
- */
- attr = &attr_storage;
- if (pthread_attr_init(attr))
- attr = NULL;
+ if (pthread_attr_init(&attr))
+ abort();
- if (attr != NULL)
- if (pthread_attr_setstacksize(attr, 4 * PTHREAD_STACK_MIN))
- abort();
+ if (pthread_attr_setstacksize(&attr, uv__thread_stack_size()))
+ abort();
loop->cf_state = state;
/* uv_thread_t is an alias for pthread_t. */
- err = UV__ERR(pthread_create(&loop->cf_thread, attr, uv__cf_loop_runner, loop));
+ err = UV__ERR(pthread_create(&loop->cf_thread, &attr, uv__cf_loop_runner, loop));
- if (attr != NULL)
- pthread_attr_destroy(attr);
+ if (pthread_attr_destroy(&attr))
+ abort();
if (err)
goto fail_thread_create;
diff --git a/Utilities/cmlibuv/src/unix/getaddrinfo.c b/Utilities/cmlibuv/src/unix/getaddrinfo.c
index d7ca7d1a44..77337ace94 100644
--- a/Utilities/cmlibuv/src/unix/getaddrinfo.c
+++ b/Utilities/cmlibuv/src/unix/getaddrinfo.c
@@ -21,9 +21,6 @@
/* Expose glibc-specific EAI_* error codes. Needs to be defined before we
* include any headers.
*/
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE
-#endif
#include "uv.h"
#include "internal.h"
diff --git a/Utilities/cmlibuv/src/unix/ibmi.c b/Utilities/cmlibuv/src/unix/ibmi.c
index 73ab02a7ac..580ea1f3a8 100644
--- a/Utilities/cmlibuv/src/unix/ibmi.c
+++ b/Utilities/cmlibuv/src/unix/ibmi.c
@@ -26,7 +26,6 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
#include <errno.h>
#include <sys/types.h>
@@ -166,7 +165,7 @@ static void iconv_a2e(const char* src, unsigned char dst[], size_t length) {
srclen = strlen(src);
if (srclen > length)
- abort();
+ srclen = length;
for (i = 0; i < srclen; i++)
dst[i] = a2e[src[i]];
/* padding the remaining part with spaces */
@@ -360,6 +359,10 @@ static int get_ibmi_physical_address(const char* line, char (*phys_addr)[6]) {
if (rc != 0)
return rc;
+ if (err.bytes_available > 0) {
+ return -1;
+ }
+
/* convert ebcdic loca_adapter_address to ascii first */
iconv_e2a(rcvr.loca_adapter_address, mac_addr,
sizeof(rcvr.loca_adapter_address));
@@ -443,9 +446,42 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
}
address->is_internal = cur->ifa_flags & IFF_LOOPBACK ? 1 : 0;
if (!address->is_internal) {
- int rc = get_ibmi_physical_address(address->name, &address->phys_addr);
- if (rc != 0)
- r = rc;
+ int rc = -1;
+ size_t name_len = strlen(address->name);
+ /* To get the associated MAC address, we must convert the address to a
+ * line description. Normally, the name field contains the line
+ * description name, but for VLANs it has the VLAN appended with a
+ * period. Since object names can also contain periods and numbers, there
+ * is no way to know if a returned name is for a VLAN or not. eg.
+ * *LIND ETH1.1 and *LIND ETH1, VLAN 1 both have the same name: ETH1.1
+ *
+ * Instead, we apply the same heuristic used by some of the XPF ioctls:
+ * - names > 10 *must* contain a VLAN
+ * - assume names <= 10 do not contain a VLAN and try directly
+ * - if >10 or QDCRLIND returned an error, try to strip off a VLAN
+ * and try again
+ * - if we still get an error or couldn't find a period, leave the MAC as
+ * 00:00:00:00:00:00
+ */
+ if (name_len <= 10) {
+ /* Assume name does not contain a VLAN ID */
+ rc = get_ibmi_physical_address(address->name, &address->phys_addr);
+ }
+
+ if (name_len > 10 || rc != 0) {
+ /* The interface name must contain a VLAN ID suffix. Attempt to strip
+ * it off so we can get the line description to pass to QDCRLIND.
+ */
+ char* temp_name = uv__strdup(address->name);
+ char* dot = strrchr(temp_name, '.');
+ if (dot != NULL) {
+ *dot = '\0';
+ if (strlen(temp_name) <= 10) {
+ rc = get_ibmi_physical_address(temp_name, &address->phys_addr);
+ }
+ }
+ uv__free(temp_name);
+ }
}
address++;
@@ -499,3 +535,4 @@ int uv_get_process_title(char* buffer, size_t size) {
void uv__process_title_cleanup(void) {
}
+
diff --git a/Utilities/cmlibuv/src/unix/internal.h b/Utilities/cmlibuv/src/unix/internal.h
index 444dc85c59..586ae390d3 100644
--- a/Utilities/cmlibuv/src/unix/internal.h
+++ b/Utilities/cmlibuv/src/unix/internal.h
@@ -62,6 +62,17 @@
# include <AvailabilityMacros.h>
#endif
+/*
+ * Define common detection for active Thread Sanitizer
+ * - clang uses __has_feature(thread_sanitizer)
+ * - gcc-7+ uses __SANITIZE_THREAD__
+ */
+#if defined(__has_feature)
+# if __has_feature(thread_sanitizer)
+# define __SANITIZE_THREAD__ 1
+# endif
+#endif
+
#if defined(PATH_MAX)
# define UV__PATH_MAX PATH_MAX
#else
@@ -175,9 +186,11 @@ struct uv__stream_queued_fds_s {
defined(__NetBSD__)
#define uv__cloexec uv__cloexec_ioctl
#define uv__nonblock uv__nonblock_ioctl
+#define UV__NONBLOCK_IS_IOCTL 1
#else
#define uv__cloexec uv__cloexec_fcntl
#define uv__nonblock uv__nonblock_fcntl
+#define UV__NONBLOCK_IS_IOCTL 0
#endif
/* On Linux, uv__nonblock_fcntl() and uv__nonblock_ioctl() do not commute
@@ -256,6 +269,7 @@ int uv__signal_loop_fork(uv_loop_t* loop);
/* platform specific */
uint64_t uv__hrtime(uv_clocktype_t type);
int uv__kqueue_init(uv_loop_t* loop);
+int uv__epoll_init(uv_loop_t* loop);
int uv__platform_loop_init(uv_loop_t* loop);
void uv__platform_loop_delete(uv_loop_t* loop);
void uv__platform_invalidate_fd(uv_loop_t* loop, int fd);
@@ -271,6 +285,7 @@ void uv__prepare_close(uv_prepare_t* handle);
void uv__process_close(uv_process_t* handle);
void uv__stream_close(uv_stream_t* handle);
void uv__tcp_close(uv_tcp_t* handle);
+size_t uv__thread_stack_size(void);
void uv__udp_close(uv_udp_t* handle);
void uv__udp_finish_close(uv_udp_t* handle);
uv_handle_type uv__handle_type(int fd);
@@ -292,12 +307,6 @@ int uv___stream_fd(const uv_stream_t* handle);
#define uv__stream_fd(handle) ((handle)->io_watcher.fd)
#endif /* defined(__APPLE__) */
-#ifdef O_NONBLOCK
-# define UV__F_NONBLOCK O_NONBLOCK
-#else
-# define UV__F_NONBLOCK 1
-#endif
-
int uv__make_pipe(int fds[2], int flags);
#if defined(__APPLE__)
@@ -337,7 +346,8 @@ int uv__getsockpeername(const uv_handle_t* handle,
#if defined(__linux__) || \
defined(__FreeBSD__) || \
- defined(__FreeBSD_kernel__)
+ defined(__FreeBSD_kernel__) || \
+ defined(__DragonFly__)
#define HAVE_MMSG 1
struct uv__mmsghdr {
struct msghdr msg_hdr;
@@ -350,5 +360,11 @@ int uv__sendmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen);
#define HAVE_MMSG 0
#endif
+#if defined(__sun)
+#if !defined(_POSIX_VERSION) || _POSIX_VERSION < 200809L
+size_t strnlen(const char* s, size_t maxlen);
+#endif
+#endif
+
#endif /* UV_UNIX_INTERNAL_H_ */
diff --git a/Utilities/cmlibuv/src/unix/linux-core.c b/Utilities/cmlibuv/src/unix/linux-core.c
index 4db2f05053..8c9bbb75f7 100644
--- a/Utilities/cmlibuv/src/unix/linux-core.c
+++ b/Utilities/cmlibuv/src/unix/linux-core.c
@@ -82,29 +82,12 @@ static int read_times(FILE* statfile_fp,
static void read_speeds(unsigned int numcpus, uv_cpu_info_t* ci);
static uint64_t read_cpufreq(unsigned int cpunum);
-
int uv__platform_loop_init(uv_loop_t* loop) {
- int fd;
- fd = epoll_create1(O_CLOEXEC);
-
- /* epoll_create1() can fail either because it's not implemented (old kernel)
- * or because it doesn't understand the O_CLOEXEC flag.
- */
- if (fd == -1 && (errno == ENOSYS || errno == EINVAL)) {
- fd = epoll_create(256);
-
- if (fd != -1)
- uv__cloexec(fd, 1);
- }
-
- loop->backend_fd = fd;
+
loop->inotify_fd = -1;
loop->inotify_watchers = NULL;
- if (fd == -1)
- return UV__ERR(errno);
-
- return 0;
+ return uv__epoll_init(loop);
}
@@ -134,380 +117,6 @@ void uv__platform_loop_delete(uv_loop_t* loop) {
}
-void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
- struct epoll_event* events;
- struct epoll_event dummy;
- uintptr_t i;
- uintptr_t nfds;
-
- assert(loop->watchers != NULL);
- assert(fd >= 0);
-
- events = (struct epoll_event*) loop->watchers[loop->nwatchers];
- nfds = (uintptr_t) loop->watchers[loop->nwatchers + 1];
- if (events != NULL)
- /* Invalidate events with same file descriptor */
- for (i = 0; i < nfds; i++)
- if (events[i].data.fd == fd)
- events[i].data.fd = -1;
-
- /* Remove the file descriptor from the epoll.
- * This avoids a problem where the same file description remains open
- * in another process, causing repeated junk epoll events.
- *
- * We pass in a dummy epoll_event, to work around a bug in old kernels.
- */
- if (loop->backend_fd >= 0) {
- /* Work around a bug in kernels 3.10 to 3.19 where passing a struct that
- * has the EPOLLWAKEUP flag set generates spurious audit syslog warnings.
- */
- memset(&dummy, 0, sizeof(dummy));
- epoll_ctl(loop->backend_fd, EPOLL_CTL_DEL, fd, &dummy);
- }
-}
-
-
-int uv__io_check_fd(uv_loop_t* loop, int fd) {
- struct epoll_event e;
- int rc;
-
- memset(&e, 0, sizeof(e));
- e.events = POLLIN;
- e.data.fd = -1;
-
- rc = 0;
- if (epoll_ctl(loop->backend_fd, EPOLL_CTL_ADD, fd, &e))
- if (errno != EEXIST)
- rc = UV__ERR(errno);
-
- if (rc == 0)
- if (epoll_ctl(loop->backend_fd, EPOLL_CTL_DEL, fd, &e))
- abort();
-
- return rc;
-}
-
-
-void uv__io_poll(uv_loop_t* loop, int timeout) {
- /* A bug in kernels < 2.6.37 makes timeouts larger than ~30 minutes
- * effectively infinite on 32 bits architectures. To avoid blocking
- * indefinitely, we cap the timeout and poll again if necessary.
- *
- * Note that "30 minutes" is a simplification because it depends on
- * the value of CONFIG_HZ. The magic constant assumes CONFIG_HZ=1200,
- * that being the largest value I have seen in the wild (and only once.)
- */
- static const int max_safe_timeout = 1789569;
- static int no_epoll_pwait_cached;
- static int no_epoll_wait_cached;
- int no_epoll_pwait;
- int no_epoll_wait;
- struct epoll_event events[1024];
- struct epoll_event* pe;
- struct epoll_event e;
- int real_timeout;
- QUEUE* q;
- uv__io_t* w;
- sigset_t sigset;
- uint64_t sigmask;
- uint64_t base;
- int have_signals;
- int nevents;
- int count;
- int nfds;
- int fd;
- int op;
- int i;
- int user_timeout;
- int reset_timeout;
-
- if (loop->nfds == 0) {
- assert(QUEUE_EMPTY(&loop->watcher_queue));
- return;
- }
-
- memset(&e, 0, sizeof(e));
-
- while (!QUEUE_EMPTY(&loop->watcher_queue)) {
- q = QUEUE_HEAD(&loop->watcher_queue);
- QUEUE_REMOVE(q);
- QUEUE_INIT(q);
-
- w = QUEUE_DATA(q, uv__io_t, watcher_queue);
- assert(w->pevents != 0);
- assert(w->fd >= 0);
- assert(w->fd < (int) loop->nwatchers);
-
- e.events = w->pevents;
- e.data.fd = w->fd;
-
- if (w->events == 0)
- op = EPOLL_CTL_ADD;
- else
- op = EPOLL_CTL_MOD;
-
- /* XXX Future optimization: do EPOLL_CTL_MOD lazily if we stop watching
- * events, skip the syscall and squelch the events after epoll_wait().
- */
- if (epoll_ctl(loop->backend_fd, op, w->fd, &e)) {
- if (errno != EEXIST)
- abort();
-
- assert(op == EPOLL_CTL_ADD);
-
- /* We've reactivated a file descriptor that's been watched before. */
- if (epoll_ctl(loop->backend_fd, EPOLL_CTL_MOD, w->fd, &e))
- abort();
- }
-
- w->events = w->pevents;
- }
-
- sigmask = 0;
- if (loop->flags & UV_LOOP_BLOCK_SIGPROF) {
- sigemptyset(&sigset);
- sigaddset(&sigset, SIGPROF);
- sigmask |= 1 << (SIGPROF - 1);
- }
-
- assert(timeout >= -1);
- base = loop->time;
- count = 48; /* Benchmarks suggest this gives the best throughput. */
- real_timeout = timeout;
-
- if (uv__get_internal_fields(loop)->flags & UV_METRICS_IDLE_TIME) {
- reset_timeout = 1;
- user_timeout = timeout;
- timeout = 0;
- } else {
- reset_timeout = 0;
- user_timeout = 0;
- }
-
- /* You could argue there is a dependency between these two but
- * ultimately we don't care about their ordering with respect
- * to one another. Worst case, we make a few system calls that
- * could have been avoided because another thread already knows
- * they fail with ENOSYS. Hardly the end of the world.
- */
- no_epoll_pwait = uv__load_relaxed(&no_epoll_pwait_cached);
- no_epoll_wait = uv__load_relaxed(&no_epoll_wait_cached);
-
- for (;;) {
- /* Only need to set the provider_entry_time if timeout != 0. The function
- * will return early if the loop isn't configured with UV_METRICS_IDLE_TIME.
- */
- if (timeout != 0)
- uv__metrics_set_provider_entry_time(loop);
-
- /* See the comment for max_safe_timeout for an explanation of why
- * this is necessary. Executive summary: kernel bug workaround.
- */
- if (sizeof(int32_t) == sizeof(long) && timeout >= max_safe_timeout)
- timeout = max_safe_timeout;
-
- if (sigmask != 0 && no_epoll_pwait != 0)
- if (pthread_sigmask(SIG_BLOCK, &sigset, NULL))
- abort();
-
- if (no_epoll_wait != 0 || (sigmask != 0 && no_epoll_pwait == 0)) {
- nfds = epoll_pwait(loop->backend_fd,
- events,
- ARRAY_SIZE(events),
- timeout,
- &sigset);
- if (nfds == -1 && errno == ENOSYS) {
- uv__store_relaxed(&no_epoll_pwait_cached, 1);
- no_epoll_pwait = 1;
- }
- } else {
- nfds = epoll_wait(loop->backend_fd,
- events,
- ARRAY_SIZE(events),
- timeout);
- if (nfds == -1 && errno == ENOSYS) {
- uv__store_relaxed(&no_epoll_wait_cached, 1);
- no_epoll_wait = 1;
- }
- }
-
- if (sigmask != 0 && no_epoll_pwait != 0)
- if (pthread_sigmask(SIG_UNBLOCK, &sigset, NULL))
- abort();
-
- /* Update loop->time unconditionally. It's tempting to skip the update when
- * timeout == 0 (i.e. non-blocking poll) but there is no guarantee that the
- * operating system didn't reschedule our process while in the syscall.
- */
- SAVE_ERRNO(uv__update_time(loop));
-
- if (nfds == 0) {
- assert(timeout != -1);
-
- if (reset_timeout != 0) {
- timeout = user_timeout;
- reset_timeout = 0;
- }
-
- if (timeout == -1)
- continue;
-
- if (timeout == 0)
- return;
-
- /* We may have been inside the system call for longer than |timeout|
- * milliseconds so we need to update the timestamp to avoid drift.
- */
- goto update_timeout;
- }
-
- if (nfds == -1) {
- if (errno == ENOSYS) {
- /* epoll_wait() or epoll_pwait() failed, try the other system call. */
- assert(no_epoll_wait == 0 || no_epoll_pwait == 0);
- continue;
- }
-
- if (errno != EINTR)
- abort();
-
- if (reset_timeout != 0) {
- timeout = user_timeout;
- reset_timeout = 0;
- }
-
- if (timeout == -1)
- continue;
-
- if (timeout == 0)
- return;
-
- /* Interrupted by a signal. Update timeout and poll again. */
- goto update_timeout;
- }
-
- have_signals = 0;
- nevents = 0;
-
- {
- /* Squelch a -Waddress-of-packed-member warning with gcc >= 9. */
- union {
- struct epoll_event* events;
- uv__io_t* watchers;
- } x;
-
- x.events = events;
- assert(loop->watchers != NULL);
- loop->watchers[loop->nwatchers] = x.watchers;
- loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds;
- }
-
- for (i = 0; i < nfds; i++) {
- pe = events + i;
- fd = pe->data.fd;
-
- /* Skip invalidated events, see uv__platform_invalidate_fd */
- if (fd == -1)
- continue;
-
- assert(fd >= 0);
- assert((unsigned) fd < loop->nwatchers);
-
- w = loop->watchers[fd];
-
- if (w == NULL) {
- /* File descriptor that we've stopped watching, disarm it.
- *
- * Ignore all errors because we may be racing with another thread
- * when the file descriptor is closed.
- */
- epoll_ctl(loop->backend_fd, EPOLL_CTL_DEL, fd, pe);
- continue;
- }
-
- /* Give users only events they're interested in. Prevents spurious
- * callbacks when previous callback invocation in this loop has stopped
- * the current watcher. Also, filters out events that users has not
- * requested us to watch.
- */
- pe->events &= w->pevents | POLLERR | POLLHUP;
-
- /* Work around an epoll quirk where it sometimes reports just the
- * EPOLLERR or EPOLLHUP event. In order to force the event loop to
- * move forward, we merge in the read/write events that the watcher
- * is interested in; uv__read() and uv__write() will then deal with
- * the error or hangup in the usual fashion.
- *
- * Note to self: happens when epoll reports EPOLLIN|EPOLLHUP, the user
- * reads the available data, calls uv_read_stop(), then sometime later
- * calls uv_read_start() again. By then, libuv has forgotten about the
- * hangup and the kernel won't report EPOLLIN again because there's
- * nothing left to read. If anything, libuv is to blame here. The
- * current hack is just a quick bandaid; to properly fix it, libuv
- * needs to remember the error/hangup event. We should get that for
- * free when we switch over to edge-triggered I/O.
- */
- if (pe->events == POLLERR || pe->events == POLLHUP)
- pe->events |=
- w->pevents & (POLLIN | POLLOUT | UV__POLLRDHUP | UV__POLLPRI);
-
- if (pe->events != 0) {
- /* Run signal watchers last. This also affects child process watchers
- * because those are implemented in terms of signal watchers.
- */
- if (w == &loop->signal_io_watcher) {
- have_signals = 1;
- } else {
- uv__metrics_update_idle_time(loop);
- w->cb(loop, w, pe->events);
- }
-
- nevents++;
- }
- }
-
- if (reset_timeout != 0) {
- timeout = user_timeout;
- reset_timeout = 0;
- }
-
- if (have_signals != 0) {
- uv__metrics_update_idle_time(loop);
- loop->signal_io_watcher.cb(loop, &loop->signal_io_watcher, POLLIN);
- }
-
- loop->watchers[loop->nwatchers] = NULL;
- loop->watchers[loop->nwatchers + 1] = NULL;
-
- if (have_signals != 0)
- return; /* Event loop should cycle now so don't poll again. */
-
- if (nevents != 0) {
- if (nfds == ARRAY_SIZE(events) && --count != 0) {
- /* Poll for more events but don't block this time. */
- timeout = 0;
- continue;
- }
- return;
- }
-
- if (timeout == 0)
- return;
-
- if (timeout == -1)
- continue;
-
-update_timeout:
- assert(timeout > 0);
-
- real_timeout -= (loop->time - base);
- if (real_timeout <= 0)
- return;
-
- timeout = real_timeout;
- }
-}
-
uint64_t uv__hrtime(uv_clocktype_t type) {
static clock_t fast_clock_id = -1;
@@ -602,22 +211,53 @@ err:
return UV_EINVAL;
}
+static int uv__slurp(const char* filename, char* buf, size_t len) {
+ ssize_t n;
+ int fd;
+
+ assert(len > 0);
+
+ fd = uv__open_cloexec(filename, O_RDONLY);
+ if (fd < 0)
+ return fd;
+
+ do
+ n = read(fd, buf, len - 1);
+ while (n == -1 && errno == EINTR);
+
+ if (uv__close_nocheckstdio(fd))
+ abort();
+
+ if (n < 0)
+ return UV__ERR(errno);
+
+ buf[n] = '\0';
+
+ return 0;
+}
int uv_uptime(double* uptime) {
static volatile int no_clock_boottime;
+ char buf[128];
struct timespec now;
int r;
+ /* Try /proc/uptime first, then fallback to clock_gettime(). */
+
+ if (0 == uv__slurp("/proc/uptime", buf, sizeof(buf)))
+ if (1 == sscanf(buf, "%lf", uptime))
+ return 0;
+
/* Try CLOCK_BOOTTIME first, fall back to CLOCK_MONOTONIC if not available
* (pre-2.6.39 kernels). CLOCK_MONOTONIC doesn't increase when the system
* is suspended.
*/
if (no_clock_boottime) {
- retry: r = clock_gettime(CLOCK_MONOTONIC, &now);
+ retry_clock_gettime: r = clock_gettime(CLOCK_MONOTONIC, &now);
}
else if ((r = clock_gettime(CLOCK_BOOTTIME, &now)) && errno == EINVAL) {
no_clock_boottime = 1;
- goto retry;
+ goto retry_clock_gettime;
}
if (r)
@@ -709,35 +349,47 @@ static void read_speeds(unsigned int numcpus, uv_cpu_info_t* ci) {
}
-/* Also reads the CPU frequency on x86. The other architectures only have
- * a BogoMIPS field, which may not be very accurate.
+/* Also reads the CPU frequency on ppc and x86. The other architectures only
+ * have a BogoMIPS field, which may not be very accurate.
*
* Note: Simply returns on error, uv_cpu_info() takes care of the cleanup.
*/
static int read_models(unsigned int numcpus, uv_cpu_info_t* ci) {
+#if defined(__PPC__)
+ static const char model_marker[] = "cpu\t\t: ";
+ static const char speed_marker[] = "clock\t\t: ";
+#else
static const char model_marker[] = "model name\t: ";
static const char speed_marker[] = "cpu MHz\t\t: ";
+#endif
const char* inferred_model;
unsigned int model_idx;
unsigned int speed_idx;
+ unsigned int part_idx;
char buf[1024];
char* model;
FILE* fp;
+ int model_id;
/* Most are unused on non-ARM, non-MIPS and non-x86 architectures. */
(void) &model_marker;
(void) &speed_marker;
(void) &speed_idx;
+ (void) &part_idx;
(void) &model;
(void) &buf;
(void) &fp;
+ (void) &model_id;
model_idx = 0;
speed_idx = 0;
+ part_idx = 0;
#if defined(__arm__) || \
defined(__i386__) || \
defined(__mips__) || \
+ defined(__aarch64__) || \
+ defined(__PPC__) || \
defined(__x86_64__)
fp = uv__open_file("/proc/cpuinfo");
if (fp == NULL)
@@ -756,11 +408,96 @@ static int read_models(unsigned int numcpus, uv_cpu_info_t* ci) {
continue;
}
}
-#if defined(__arm__) || defined(__mips__)
+#if defined(__arm__) || defined(__mips__) || defined(__aarch64__)
if (model_idx < numcpus) {
#if defined(__arm__)
/* Fallback for pre-3.8 kernels. */
static const char model_marker[] = "Processor\t: ";
+#elif defined(__aarch64__)
+ static const char part_marker[] = "CPU part\t: ";
+
+ /* Adapted from: https://github.com/karelzak/util-linux */
+ struct vendor_part {
+ const int id;
+ const char* name;
+ };
+
+ static const struct vendor_part arm_chips[] = {
+ { 0x811, "ARM810" },
+ { 0x920, "ARM920" },
+ { 0x922, "ARM922" },
+ { 0x926, "ARM926" },
+ { 0x940, "ARM940" },
+ { 0x946, "ARM946" },
+ { 0x966, "ARM966" },
+ { 0xa20, "ARM1020" },
+ { 0xa22, "ARM1022" },
+ { 0xa26, "ARM1026" },
+ { 0xb02, "ARM11 MPCore" },
+ { 0xb36, "ARM1136" },
+ { 0xb56, "ARM1156" },
+ { 0xb76, "ARM1176" },
+ { 0xc05, "Cortex-A5" },
+ { 0xc07, "Cortex-A7" },
+ { 0xc08, "Cortex-A8" },
+ { 0xc09, "Cortex-A9" },
+ { 0xc0d, "Cortex-A17" }, /* Originally A12 */
+ { 0xc0f, "Cortex-A15" },
+ { 0xc0e, "Cortex-A17" },
+ { 0xc14, "Cortex-R4" },
+ { 0xc15, "Cortex-R5" },
+ { 0xc17, "Cortex-R7" },
+ { 0xc18, "Cortex-R8" },
+ { 0xc20, "Cortex-M0" },
+ { 0xc21, "Cortex-M1" },
+ { 0xc23, "Cortex-M3" },
+ { 0xc24, "Cortex-M4" },
+ { 0xc27, "Cortex-M7" },
+ { 0xc60, "Cortex-M0+" },
+ { 0xd01, "Cortex-A32" },
+ { 0xd03, "Cortex-A53" },
+ { 0xd04, "Cortex-A35" },
+ { 0xd05, "Cortex-A55" },
+ { 0xd06, "Cortex-A65" },
+ { 0xd07, "Cortex-A57" },
+ { 0xd08, "Cortex-A72" },
+ { 0xd09, "Cortex-A73" },
+ { 0xd0a, "Cortex-A75" },
+ { 0xd0b, "Cortex-A76" },
+ { 0xd0c, "Neoverse-N1" },
+ { 0xd0d, "Cortex-A77" },
+ { 0xd0e, "Cortex-A76AE" },
+ { 0xd13, "Cortex-R52" },
+ { 0xd20, "Cortex-M23" },
+ { 0xd21, "Cortex-M33" },
+ { 0xd41, "Cortex-A78" },
+ { 0xd42, "Cortex-A78AE" },
+ { 0xd4a, "Neoverse-E1" },
+ { 0xd4b, "Cortex-A78C" },
+ };
+
+ if (strncmp(buf, part_marker, sizeof(part_marker) - 1) == 0) {
+ model = buf + sizeof(part_marker) - 1;
+
+ errno = 0;
+ model_id = strtol(model, NULL, 16);
+ if ((errno != 0) || model_id < 0) {
+ fclose(fp);
+ return UV_EINVAL;
+ }
+
+ for (part_idx = 0; part_idx < ARRAY_SIZE(arm_chips); part_idx++) {
+ if (model_id == arm_chips[part_idx].id) {
+ model = uv__strdup(arm_chips[part_idx].name);
+ if (model == NULL) {
+ fclose(fp);
+ return UV_ENOMEM;
+ }
+ ci[model_idx++].model = model;
+ break;
+ }
+ }
+ }
#else /* defined(__mips__) */
static const char model_marker[] = "cpu model\t\t: ";
#endif
@@ -775,18 +512,18 @@ static int read_models(unsigned int numcpus, uv_cpu_info_t* ci) {
continue;
}
}
-#else /* !__arm__ && !__mips__ */
+#else /* !__arm__ && !__mips__ && !__aarch64__ */
if (speed_idx < numcpus) {
if (strncmp(buf, speed_marker, sizeof(speed_marker) - 1) == 0) {
ci[speed_idx++].speed = atoi(buf + sizeof(speed_marker) - 1);
continue;
}
}
-#endif /* __arm__ || __mips__ */
+#endif /* __arm__ || __mips__ || __aarch64__ */
}
fclose(fp);
-#endif /* __arm__ || __i386__ || __mips__ || __x86_64__ */
+#endif /* __arm__ || __i386__ || __mips__ || __PPC__ || __x86_64__ || __aarch__ */
/* Now we want to make sure that all the models contain *something* because
* it's not safe to leave them as null. Copy the last entry unless there
@@ -824,9 +561,9 @@ static int read_times(FILE* statfile_fp,
char buf[1024];
ticks = (unsigned int)sysconf(_SC_CLK_TCK);
- multiplier = ((uint64_t)1000L / ticks);
assert(ticks != (unsigned int) -1);
assert(ticks != 0);
+ multiplier = ((uint64_t)1000L / ticks);
rewind(statfile_fp);
@@ -1025,32 +762,6 @@ void uv__set_process_title(const char* title) {
}
-static int uv__slurp(const char* filename, char* buf, size_t len) {
- ssize_t n;
- int fd;
-
- assert(len > 0);
-
- fd = uv__open_cloexec(filename, O_RDONLY);
- if (fd < 0)
- return fd;
-
- do
- n = read(fd, buf, len - 1);
- while (n == -1 && errno == EINTR);
-
- if (uv__close_nocheckstdio(fd))
- abort();
-
- if (n < 0)
- return UV__ERR(errno);
-
- buf[n] = '\0';
-
- return 0;
-}
-
-
static uint64_t uv__read_proc_meminfo(const char* what) {
uint64_t rc;
char* p;
diff --git a/Utilities/cmlibuv/src/unix/linux-inotify.c b/Utilities/cmlibuv/src/unix/linux-inotify.c
index 42b601adbf..c1bd260e16 100644
--- a/Utilities/cmlibuv/src/unix/linux-inotify.c
+++ b/Utilities/cmlibuv/src/unix/linux-inotify.c
@@ -178,7 +178,7 @@ static void uv__inotify_read(uv_loop_t* loop,
/* needs to be large enough for sizeof(inotify_event) + strlen(path) */
char buf[4096];
- while (1) {
+ for (;;) {
do
size = read(loop->inotify_fd, buf, sizeof(buf));
while (size == -1 && errno == EINTR);
diff --git a/Utilities/cmlibuv/src/unix/linux-syscalls.c b/Utilities/cmlibuv/src/unix/linux-syscalls.c
index 44daaf12d4..5071cd56d1 100644
--- a/Utilities/cmlibuv/src/unix/linux-syscalls.c
+++ b/Utilities/cmlibuv/src/unix/linux-syscalls.c
@@ -194,37 +194,37 @@ int uv__recvmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen) {
ssize_t uv__preadv(int fd, const struct iovec *iov, int iovcnt, int64_t offset) {
-#if defined(__NR_preadv)
- return syscall(__NR_preadv, fd, iov, iovcnt, (long)offset, (long)(offset >> 32));
-#else
+#if !defined(__NR_preadv) || defined(__ANDROID_API__) && __ANDROID_API__ < 24
return errno = ENOSYS, -1;
+#else
+ return syscall(__NR_preadv, fd, iov, iovcnt, (long)offset, (long)(offset >> 32));
#endif
}
ssize_t uv__pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset) {
-#if defined(__NR_pwritev)
- return syscall(__NR_pwritev, fd, iov, iovcnt, (long)offset, (long)(offset >> 32));
-#else
+#if !defined(__NR_pwritev) || defined(__ANDROID_API__) && __ANDROID_API__ < 24
return errno = ENOSYS, -1;
+#else
+ return syscall(__NR_pwritev, fd, iov, iovcnt, (long)offset, (long)(offset >> 32));
#endif
}
int uv__dup3(int oldfd, int newfd, int flags) {
-#if defined(__NR_dup3)
- return syscall(__NR_dup3, oldfd, newfd, flags);
-#else
+#if !defined(__NR_dup3) || defined(__ANDROID_API__) && __ANDROID_API__ < 21
return errno = ENOSYS, -1;
+#else
+ return syscall(__NR_dup3, oldfd, newfd, flags);
#endif
}
ssize_t
uv__fs_copy_file_range(int fd_in,
- ssize_t* off_in,
+ off_t* off_in,
int fd_out,
- ssize_t* off_out,
+ off_t* off_out,
size_t len,
unsigned int flags)
{
@@ -247,21 +247,18 @@ int uv__statx(int dirfd,
int flags,
unsigned int mask,
struct uv__statx* statxbuf) {
- /* __NR_statx make Android box killed by SIGSYS.
- * That looks like a seccomp2 sandbox filter rejecting the system call.
- */
-#if defined(__NR_statx) && !defined(__ANDROID__)
- return syscall(__NR_statx, dirfd, path, flags, mask, statxbuf);
-#else
+#if !defined(__NR_statx) || defined(__ANDROID_API__) && __ANDROID_API__ < 30
return errno = ENOSYS, -1;
+#else
+ return syscall(__NR_statx, dirfd, path, flags, mask, statxbuf);
#endif
}
ssize_t uv__getrandom(void* buf, size_t buflen, unsigned flags) {
-#if defined(__NR_getrandom)
- return syscall(__NR_getrandom, buf, buflen, flags);
-#else
+#if !defined(__NR_getrandom) || defined(__ANDROID_API__) && __ANDROID_API__ < 28
return errno = ENOSYS, -1;
+#else
+ return syscall(__NR_getrandom, buf, buflen, flags);
#endif
}
diff --git a/Utilities/cmlibuv/src/unix/linux-syscalls.h b/Utilities/cmlibuv/src/unix/linux-syscalls.h
index 761ff32e21..b4d9082d46 100644
--- a/Utilities/cmlibuv/src/unix/linux-syscalls.h
+++ b/Utilities/cmlibuv/src/unix/linux-syscalls.h
@@ -22,9 +22,6 @@
#ifndef UV_LINUX_SYSCALL_H_
#define UV_LINUX_SYSCALL_H_
-#undef _GNU_SOURCE
-#define _GNU_SOURCE
-
#include <stdint.h>
#include <signal.h>
#include <sys/types.h>
@@ -66,9 +63,9 @@ ssize_t uv__pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset)
int uv__dup3(int oldfd, int newfd, int flags);
ssize_t
uv__fs_copy_file_range(int fd_in,
- ssize_t* off_in,
+ off_t* off_in,
int fd_out,
- ssize_t* off_out,
+ off_t* off_out,
size_t len,
unsigned int flags);
int uv__statx(int dirfd,
diff --git a/Utilities/cmlibuv/src/unix/os390-proctitle.c b/Utilities/cmlibuv/src/unix/os390-proctitle.c
new file mode 100644
index 0000000000..ccda97c9ac
--- /dev/null
+++ b/Utilities/cmlibuv/src/unix/os390-proctitle.c
@@ -0,0 +1,136 @@
+/* Copyright libuv project contributors. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "uv.h"
+#include "internal.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+static uv_mutex_t process_title_mutex;
+static uv_once_t process_title_mutex_once = UV_ONCE_INIT;
+static char* process_title = NULL;
+static void* args_mem = NULL;
+
+
+static void init_process_title_mutex_once(void) {
+ uv_mutex_init(&process_title_mutex);
+}
+
+
+char** uv_setup_args(int argc, char** argv) {
+ char** new_argv;
+ size_t size;
+ char* s;
+ int i;
+
+ if (argc <= 0)
+ return argv;
+
+ /* Calculate how much memory we need for the argv strings. */
+ size = 0;
+ for (i = 0; i < argc; i++)
+ size += strlen(argv[i]) + 1;
+
+ /* Add space for the argv pointers. */
+ size += (argc + 1) * sizeof(char*);
+
+ new_argv = uv__malloc(size);
+ if (new_argv == NULL)
+ return argv;
+
+ /* Copy over the strings and set up the pointer table. */
+ s = (char*) &new_argv[argc + 1];
+ for (i = 0; i < argc; i++) {
+ size = strlen(argv[i]) + 1;
+ memcpy(s, argv[i], size);
+ new_argv[i] = s;
+ s += size;
+ }
+ new_argv[i] = NULL;
+
+ args_mem = new_argv;
+ process_title = uv__strdup(argv[0]);
+
+ return new_argv;
+}
+
+
+int uv_set_process_title(const char* title) {
+ char* new_title;
+
+ /* If uv_setup_args wasn't called or failed, we can't continue. */
+ if (args_mem == NULL)
+ return UV_ENOBUFS;
+
+ /* We cannot free this pointer when libuv shuts down,
+ * the process may still be using it.
+ */
+ new_title = uv__strdup(title);
+ if (new_title == NULL)
+ return UV_ENOMEM;
+
+ uv_once(&process_title_mutex_once, init_process_title_mutex_once);
+ uv_mutex_lock(&process_title_mutex);
+
+ if (process_title != NULL)
+ uv__free(process_title);
+
+ process_title = new_title;
+
+ uv_mutex_unlock(&process_title_mutex);
+
+ return 0;
+}
+
+
+int uv_get_process_title(char* buffer, size_t size) {
+ size_t len;
+
+ if (buffer == NULL || size == 0)
+ return UV_EINVAL;
+
+ /* If uv_setup_args wasn't called or failed, we can't continue. */
+ if (args_mem == NULL || process_title == NULL)
+ return UV_ENOBUFS;
+
+ uv_once(&process_title_mutex_once, init_process_title_mutex_once);
+ uv_mutex_lock(&process_title_mutex);
+
+ len = strlen(process_title);
+
+ if (size <= len) {
+ uv_mutex_unlock(&process_title_mutex);
+ return UV_ENOBUFS;
+ }
+
+ strcpy(buffer, process_title);
+
+ uv_mutex_unlock(&process_title_mutex);
+
+ return 0;
+}
+
+
+void uv__process_title_cleanup(void) {
+ uv__free(args_mem); /* Keep valgrind happy. */
+ args_mem = NULL;
+}
diff --git a/Utilities/cmlibuv/src/unix/os390-syscalls.c b/Utilities/cmlibuv/src/unix/os390-syscalls.c
index 491e950c50..c19155339c 100644
--- a/Utilities/cmlibuv/src/unix/os390-syscalls.c
+++ b/Utilities/cmlibuv/src/unix/os390-syscalls.c
@@ -27,12 +27,6 @@
#include <termios.h>
#include <sys/msg.h>
-#define CW_INTRPT 1
-#define CW_CONDVAR 32
-
-#pragma linkage(BPX4CTW, OS)
-#pragma linkage(BPX1CTW, OS)
-
static QUEUE global_epoll_queue;
static uv_mutex_t global_epoll_lock;
static uv_once_t once = UV_ONCE_INIT;
@@ -55,7 +49,7 @@ int scandir(const char* maindir, struct dirent*** namelist,
if (!mdir)
return -1;
- while (1) {
+ for (;;) {
dirent = readdir(mdir);
if (!dirent)
break;
@@ -381,46 +375,6 @@ void epoll_queue_close(uv__os390_epoll* lst) {
}
-int nanosleep(const struct timespec* req, struct timespec* rem) {
- unsigned nano;
- unsigned seconds;
- unsigned events;
- unsigned secrem;
- unsigned nanorem;
- int rv;
- int err;
- int rsn;
-
- nano = (int)req->tv_nsec;
- seconds = req->tv_sec;
- events = CW_CONDVAR | CW_INTRPT;
- secrem = 0;
- nanorem = 0;
-
-#if defined(_LP64)
- BPX4CTW(&seconds, &nano, &events, &secrem, &nanorem, &rv, &err, &rsn);
-#else
- BPX1CTW(&seconds, &nano, &events, &secrem, &nanorem, &rv, &err, &rsn);
-#endif
-
- /* Don't clobber errno unless BPX1CTW/BPX4CTW errored.
- * Don't leak EAGAIN, that just means the timeout expired.
- */
- if (rv == -1)
- if (err == EAGAIN)
- rv = 0;
- else
- errno = err;
-
- if (rem != NULL && (rv == 0 || err == EINTR)) {
- rem->tv_nsec = nanorem;
- rem->tv_sec = secrem;
- }
-
- return rv;
-}
-
-
char* mkdtemp(char* path) {
static const char* tempchars =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
@@ -550,15 +504,6 @@ ssize_t os390_readlink(const char* path, char* buf, size_t len) {
}
-size_t strnlen(const char* str, size_t maxlen) {
- char* p = memchr(str, 0, maxlen);
- if (p == NULL)
- return maxlen;
- else
- return p - str;
-}
-
-
int sem_init(UV_PLATFORM_SEM_T* semid, int pshared, unsigned int value) {
UNREACHABLE();
}
diff --git a/Utilities/cmlibuv/src/unix/os390-syscalls.h b/Utilities/cmlibuv/src/unix/os390-syscalls.h
index 86416bbc55..7d59b75e47 100644
--- a/Utilities/cmlibuv/src/unix/os390-syscalls.h
+++ b/Utilities/cmlibuv/src/unix/os390-syscalls.h
@@ -28,6 +28,7 @@
#include <dirent.h>
#include <poll.h>
#include <pthread.h>
+#include "zos-base.h"
#define EPOLL_CTL_ADD 1
#define EPOLL_CTL_DEL 2
@@ -57,7 +58,6 @@ int epoll_wait(uv__os390_epoll* ep, struct epoll_event *events, int maxevents, i
int epoll_file_close(int fd);
/* utility functions */
-int nanosleep(const struct timespec* req, struct timespec* rem);
int scandir(const char* maindir, struct dirent*** namelist,
int (*filter)(const struct dirent *),
int (*compar)(const struct dirent **,
diff --git a/Utilities/cmlibuv/src/unix/os390.c b/Utilities/cmlibuv/src/unix/os390.c
index 3bb44266d9..bf0448b519 100644
--- a/Utilities/cmlibuv/src/unix/os390.c
+++ b/Utilities/cmlibuv/src/unix/os390.c
@@ -28,6 +28,8 @@
#include <builtins.h>
#include <termios.h>
#include <sys/msg.h>
+#include <sys/resource.h>
+#include "zos-base.h"
#if defined(__clang__)
#include "csrsic.h"
#else
@@ -61,12 +63,6 @@
/* Address of the rsm control and enumeration area. */
#define CVTRCEP_OFFSET 0x490
-/*
- Number of frames currently available to system.
- Excluded are frames backing perm storage, frames offline, and bad frames.
-*/
-#define RCEPOOL_OFFSET 0x004
-
/* Total number of frames currently on all available frame queues. */
#define RCEAFC_OFFSET 0x088
@@ -144,102 +140,8 @@ uint64_t uv__hrtime(uv_clocktype_t type) {
}
-/*
- Get the exe path using the thread entry information
- in the address space.
-*/
-static int getexe(const int pid, char* buf, size_t len) {
- struct {
- int pid;
- int thid[2];
- char accesspid;
- char accessthid;
- char asid[2];
- char loginname[8];
- char flag;
- char len;
- } Input_data;
-
- union {
- struct {
- char gthb[4];
- int pid;
- int thid[2];
- char accesspid;
- char accessthid[3];
- int lenused;
- int offsetProcess;
- int offsetConTTY;
- int offsetPath;
- int offsetCommand;
- int offsetFileData;
- int offsetThread;
- } Output_data;
- char buf[2048];
- } Output_buf;
-
- struct Output_path_type {
- char gthe[4];
- short int len;
- char path[1024];
- };
-
- int Input_length;
- int Output_length;
- void* Input_address;
- void* Output_address;
- struct Output_path_type* Output_path;
- int rv;
- int rc;
- int rsn;
-
- Input_length = PGTH_LEN;
- Output_length = sizeof(Output_buf);
- Output_address = &Output_buf;
- Input_address = &Input_data;
- memset(&Input_data, 0, sizeof Input_data);
- Input_data.flag |= PGTHAPATH;
- Input_data.pid = pid;
- Input_data.accesspid = PGTH_CURRENT;
-
-#ifdef _LP64
- BPX4GTH(&Input_length,
- &Input_address,
- &Output_length,
- &Output_address,
- &rv,
- &rc,
- &rsn);
-#else
- BPX1GTH(&Input_length,
- &Input_address,
- &Output_length,
- &Output_address,
- &rv,
- &rc,
- &rsn);
-#endif
-
- if (rv == -1) {
- errno = rc;
- return -1;
- }
-
- /* Check highest byte to ensure data availability */
- assert(((Output_buf.Output_data.offsetPath >>24) & 0xFF) == 'A');
-
- /* Get the offset from the lowest 3 bytes */
- Output_path = (struct Output_path_type*) ((char*) (&Output_buf) +
- (Output_buf.Output_data.offsetPath & 0x00FFFFFF));
-
- if (Output_path->len >= len) {
- errno = ENOBUFS;
- return -1;
- }
-
- uv__strscpy(buf, Output_path->path, len);
-
- return 0;
+static int getexe(char* buf, size_t len) {
+ return uv__strscpy(buf, __getargv()[0], len);
}
@@ -259,8 +161,7 @@ int uv_exepath(char* buffer, size_t* size) {
if (buffer == NULL || size == NULL || *size == 0)
return UV_EINVAL;
- pid = getpid();
- res = getexe(pid, args, sizeof(args));
+ res = getexe(args, sizeof(args));
if (res < 0)
return UV_EINVAL;
@@ -275,25 +176,25 @@ uint64_t uv_get_free_memory(void) {
data_area_ptr rcep = {0};
cvt.assign = *(data_area_ptr_assign_type*)(CVT_PTR);
rcep.assign = *(data_area_ptr_assign_type*)(cvt.deref + CVTRCEP_OFFSET);
- freeram = *((uint64_t*)(rcep.deref + RCEAFC_OFFSET)) * 4;
+ freeram = (uint64_t)*((uint32_t*)(rcep.deref + RCEAFC_OFFSET)) * 4096;
return freeram;
}
uint64_t uv_get_total_memory(void) {
- uint64_t totalram;
-
- data_area_ptr cvt = {0};
- data_area_ptr rcep = {0};
- cvt.assign = *(data_area_ptr_assign_type*)(CVT_PTR);
- rcep.assign = *(data_area_ptr_assign_type*)(cvt.deref + CVTRCEP_OFFSET);
- totalram = *((uint64_t*)(rcep.deref + RCEPOOL_OFFSET)) * 4;
- return totalram;
+ /* Use CVTRLSTG to get the size of actual real storage online at IPL in K. */
+ return (uint64_t)((int)((char *__ptr32 *__ptr32 *)0)[4][214]) * 1024;
}
uint64_t uv_get_constrained_memory(void) {
- return 0; /* Memory constraints are unknown. */
+ struct rlimit rl;
+
+ /* RLIMIT_MEMLIMIT return value is in megabytes rather than bytes. */
+ if (getrlimit(RLIMIT_MEMLIMIT, &rl) == 0)
+ return rl.rlim_cur * 1024 * 1024;
+
+ return 0; /* There is no memory limit set. */
}
@@ -733,6 +634,10 @@ static int os390_message_queue_handler(uv__os390_epoll* ep) {
/* Some event that we are not interested in. */
return 0;
+ /* `__rfim_utok` is treated as text when it should be treated as binary while
+ * running in ASCII mode, resulting in an unwanted autoconversion.
+ */
+ __a2e_l(msg.__rfim_utok, sizeof(msg.__rfim_utok));
handle = *(uv_fs_event_t**)(msg.__rfim_utok);
handle->cb(handle, uv__basename_r(handle->path), events, 0);
return 1;
@@ -959,9 +864,6 @@ update_timeout:
}
}
-void uv__set_process_title(const char* title) {
- /* do nothing */
-}
int uv__io_fork(uv_loop_t* loop) {
/*
diff --git a/Utilities/cmlibuv/src/unix/pipe.c b/Utilities/cmlibuv/src/unix/pipe.c
index 52a8fd52fa..fc7c4eae8d 100644
--- a/Utilities/cmlibuv/src/unix/pipe.c
+++ b/Utilities/cmlibuv/src/unix/pipe.c
@@ -377,3 +377,57 @@ int uv_pipe_chmod(uv_pipe_t* handle, int mode) {
return r != -1 ? 0 : UV__ERR(errno);
}
+
+
+int uv_pipe(uv_os_fd_t fds[2], int read_flags, int write_flags) {
+ uv_os_fd_t temp[2];
+ int err;
+#if defined(__FreeBSD__) || defined(__linux__)
+ int flags = O_CLOEXEC;
+
+ if ((read_flags & UV_NONBLOCK_PIPE) && (write_flags & UV_NONBLOCK_PIPE))
+ flags |= UV_FS_O_NONBLOCK;
+
+ if (pipe2(temp, flags))
+ return UV__ERR(errno);
+
+ if (flags & UV_FS_O_NONBLOCK) {
+ fds[0] = temp[0];
+ fds[1] = temp[1];
+ return 0;
+ }
+#else
+ if (pipe(temp))
+ return UV__ERR(errno);
+
+ if ((err = uv__cloexec(temp[0], 1)))
+ goto fail;
+
+ if ((err = uv__cloexec(temp[1], 1)))
+ goto fail;
+#endif
+
+ if (read_flags & UV_NONBLOCK_PIPE)
+ if ((err = uv__nonblock(temp[0], 1)))
+ goto fail;
+
+ if (write_flags & UV_NONBLOCK_PIPE)
+ if ((err = uv__nonblock(temp[1], 1)))
+ goto fail;
+
+ fds[0] = temp[0];
+ fds[1] = temp[1];
+ return 0;
+
+fail:
+ uv__close(temp[0]);
+ uv__close(temp[1]);
+ return err;
+}
+
+
+int uv__make_pipe(int fds[2], int flags) {
+ return uv_pipe(fds,
+ flags & UV_NONBLOCK_PIPE,
+ flags & UV_NONBLOCK_PIPE);
+}
diff --git a/Utilities/cmlibuv/src/unix/poll.c b/Utilities/cmlibuv/src/unix/poll.c
index 3d5022b22e..7a12e2d148 100644
--- a/Utilities/cmlibuv/src/unix/poll.c
+++ b/Utilities/cmlibuv/src/unix/poll.c
@@ -79,9 +79,10 @@ int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd) {
* Workaround for e.g. kqueue fds not supporting ioctls.
*/
err = uv__nonblock(fd, 1);
+#if UV__NONBLOCK_IS_IOCTL
if (err == UV_ENOTTY)
- if (uv__nonblock == uv__nonblock_ioctl)
- err = uv__nonblock_fcntl(fd, 1);
+ err = uv__nonblock_fcntl(fd, 1);
+#endif
if (err)
return err;
@@ -116,12 +117,21 @@ int uv_poll_stop(uv_poll_t* handle) {
int uv_poll_start(uv_poll_t* handle, int pevents, uv_poll_cb poll_cb) {
+ uv__io_t** watchers;
+ uv__io_t* w;
int events;
assert((pevents & ~(UV_READABLE | UV_WRITABLE | UV_DISCONNECT |
UV_PRIORITIZED)) == 0);
assert(!uv__is_closing(handle));
+ watchers = handle->loop->watchers;
+ w = &handle->io_watcher;
+
+ if (uv__fd_exists(handle->loop, w->fd))
+ if (watchers[w->fd] != w)
+ return UV_EEXIST;
+
uv__poll_stop(handle);
if (pevents == 0)
diff --git a/Utilities/cmlibuv/src/unix/process.c b/Utilities/cmlibuv/src/unix/process.c
index 08aa2f3cc6..2af2088f90 100644
--- a/Utilities/cmlibuv/src/unix/process.c
+++ b/Utilities/cmlibuv/src/unix/process.c
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <assert.h>
#include <errno.h>
+#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
@@ -45,6 +46,10 @@ extern char **environ;
# include <grp.h>
#endif
+#if defined(__MVS__)
+# include "zos-base.h"
+#endif
+
#ifndef CMAKE_BOOTSTRAP
#if defined(__linux__)
# define uv__cpu_set_t cpu_set_t
@@ -122,68 +127,6 @@ static void uv__chld(uv_signal_t* handle, int signum) {
assert(QUEUE_EMPTY(&pending));
}
-
-static int uv__make_socketpair(int fds[2]) {
-#if defined(__FreeBSD__) || defined(__linux__)
- if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, fds))
- return UV__ERR(errno);
-
- return 0;
-#else
- int err;
-
- if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds))
- return UV__ERR(errno);
-
- err = uv__cloexec(fds[0], 1);
- if (err == 0)
- err = uv__cloexec(fds[1], 1);
-
- if (err != 0) {
- uv__close(fds[0]);
- uv__close(fds[1]);
- return UV__ERR(errno);
- }
-
- return 0;
-#endif
-}
-
-
-int uv__make_pipe(int fds[2], int flags) {
-#if defined(__FreeBSD__) || defined(__linux__)
- if (pipe2(fds, flags | O_CLOEXEC))
- return UV__ERR(errno);
-
- return 0;
-#else
- if (pipe(fds))
- return UV__ERR(errno);
-
- if (uv__cloexec(fds[0], 1))
- goto fail;
-
- if (uv__cloexec(fds[1], 1))
- goto fail;
-
- if (flags & UV__F_NONBLOCK) {
- if (uv__nonblock(fds[0], 1))
- goto fail;
-
- if (uv__nonblock(fds[1], 1))
- goto fail;
- }
-
- return 0;
-
-fail:
- uv__close(fds[0]);
- uv__close(fds[1]);
- return UV__ERR(errno);
-#endif
-}
-
-
/*
* Used for initializing stdio streams like options.stdin_stream. Returns
* zero on success. See also the cleanup section in uv_spawn().
@@ -203,7 +146,7 @@ static int uv__process_init_stdio(uv_stdio_container_t* container, int fds[2]) {
if (container->data.stream->type != UV_NAMED_PIPE)
return UV_EINVAL;
else
- return uv__make_socketpair(fds);
+ return uv_socketpair(SOCK_STREAM, 0, fds, 0, 0);
case UV_INHERIT_FD:
case UV_INHERIT_STREAM:
@@ -270,6 +213,12 @@ static void uv__write_int(int fd, int val) {
}
+static void uv__write_errno(int error_fd) {
+ uv__write_int(error_fd, UV__ERR(errno));
+ _exit(127);
+}
+
+
#if !(defined(__APPLE__) && (TARGET_OS_TV || TARGET_OS_WATCH))
/* execvp is marked __WATCHOS_PROHIBITED __TVOS_PROHIBITED, so must be
* avoided. Since this isn't called on those targets, the function
@@ -279,10 +228,9 @@ static void uv__process_child_init(const uv_process_options_t* options,
int stdio_count,
int (*pipes)[2],
int error_fd) {
- sigset_t set;
+ sigset_t signewset;
int close_fd;
int use_fd;
- int err;
int fd;
int n;
#ifndef CMAKE_BOOTSTRAP
@@ -294,6 +242,26 @@ static void uv__process_child_init(const uv_process_options_t* options,
#endif
#endif
+ /* Reset signal disposition first. Use a hard-coded limit because NSIG is not
+ * fixed on Linux: it's either 32, 34 or 64, depending on whether RT signals
+ * are enabled. We are not allowed to touch RT signal handlers, glibc uses
+ * them internally.
+ */
+ for (n = 1; n < 32; n += 1) {
+ if (n == SIGKILL || n == SIGSTOP)
+ continue; /* Can't be changed. */
+
+#if defined(__HAIKU__)
+ if (n == SIGKILLTHR)
+ continue; /* Can't be changed. */
+#endif
+
+ if (SIG_ERR != signal(n, SIG_DFL))
+ continue;
+
+ uv__write_errno(error_fd);
+ }
+
if (options->flags & UV_PROCESS_DETACHED)
setsid();
@@ -306,10 +274,8 @@ static void uv__process_child_init(const uv_process_options_t* options,
if (use_fd < 0 || use_fd >= fd)
continue;
pipes[fd][1] = fcntl(use_fd, F_DUPFD, stdio_count);
- if (pipes[fd][1] == -1) {
- uv__write_int(error_fd, UV__ERR(errno));
- _exit(127);
- }
+ if (pipes[fd][1] == -1)
+ uv__write_errno(error_fd);
}
for (fd = 0; fd < stdio_count; fd++) {
@@ -326,10 +292,8 @@ static void uv__process_child_init(const uv_process_options_t* options,
use_fd = open("/dev/null", fd == 0 ? O_RDONLY : O_RDWR);
close_fd = use_fd;
- if (use_fd < 0) {
- uv__write_int(error_fd, UV__ERR(errno));
- _exit(127);
- }
+ if (use_fd < 0)
+ uv__write_errno(error_fd);
}
}
@@ -338,10 +302,8 @@ static void uv__process_child_init(const uv_process_options_t* options,
else
fd = dup2(use_fd, fd);
- if (fd == -1) {
- uv__write_int(error_fd, UV__ERR(errno));
- _exit(127);
- }
+ if (fd == -1)
+ uv__write_errno(error_fd);
if (fd <= 2)
uv__nonblock_fcntl(fd, 0);
@@ -357,10 +319,8 @@ static void uv__process_child_init(const uv_process_options_t* options,
uv__close(use_fd);
}
- if (options->cwd != NULL && chdir(options->cwd)) {
- uv__write_int(error_fd, UV__ERR(errno));
- _exit(127);
- }
+ if (options->cwd != NULL && chdir(options->cwd))
+ uv__write_errno(error_fd);
if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) {
/* When dropping privileges from root, the `setgroups` call will
@@ -373,15 +333,11 @@ static void uv__process_child_init(const uv_process_options_t* options,
SAVE_ERRNO(setgroups(0, NULL));
}
- if ((options->flags & UV_PROCESS_SETGID) && setgid(options->gid)) {
- uv__write_int(error_fd, UV__ERR(errno));
- _exit(127);
- }
+ if ((options->flags & UV_PROCESS_SETGID) && setgid(options->gid))
+ uv__write_errno(error_fd);
- if ((options->flags & UV_PROCESS_SETUID) && setuid(options->uid)) {
- uv__write_int(error_fd, UV__ERR(errno));
- _exit(127);
- }
+ if ((options->flags & UV_PROCESS_SETUID) && setuid(options->uid))
+ uv__write_errno(error_fd);
#ifndef CMAKE_BOOTSTRAP
#if defined(__linux__) || defined(__FreeBSD__)
@@ -409,39 +365,19 @@ static void uv__process_child_init(const uv_process_options_t* options,
environ = options->env;
}
- /* Reset signal disposition. Use a hard-coded limit because NSIG
- * is not fixed on Linux: it's either 32, 34 or 64, depending on
- * whether RT signals are enabled. We are not allowed to touch
- * RT signal handlers, glibc uses them internally.
- */
- for (n = 1; n < 32; n += 1) {
- if (n == SIGKILL || n == SIGSTOP)
- continue; /* Can't be changed. */
+ /* Reset signal mask just before exec. */
+ sigemptyset(&signewset);
+ if (sigprocmask(SIG_SETMASK, &signewset, NULL) != 0)
+ abort();
-#if defined(__HAIKU__)
- if (n == SIGKILLTHR)
- continue; /* Can't be changed. */
+#ifdef __MVS__
+ execvpe(options->file, options->args, environ);
+#else
+ execvp(options->file, options->args);
#endif
- if (SIG_ERR != signal(n, SIG_DFL))
- continue;
-
- uv__write_int(error_fd, UV__ERR(errno));
- _exit(127);
- }
-
- /* Reset signal mask. */
- sigemptyset(&set);
- err = pthread_sigmask(SIG_SETMASK, &set, NULL);
-
- if (err != 0) {
- uv__write_int(error_fd, UV__ERR(err));
- _exit(127);
- }
-
- execvp(options->file, options->args);
- uv__write_int(error_fd, UV__ERR(errno));
- _exit(127);
+ uv__write_errno(error_fd);
+ abort();
}
#endif
@@ -453,6 +389,8 @@ int uv_spawn(uv_loop_t* loop,
/* fork is marked __WATCHOS_PROHIBITED __TVOS_PROHIBITED. */
return UV_ENOSYS;
#else
+ sigset_t signewset;
+ sigset_t sigoldset;
int signal_pipe[2] = { -1, -1 };
int pipes_storage[8][2];
int (*pipes)[2];
@@ -541,25 +479,41 @@ int uv_spawn(uv_loop_t* loop,
/* Acquire write lock to prevent opening new fds in worker threads */
uv_rwlock_wrlock(&loop->cloexec_lock);
- pid = fork();
- if (pid == -1) {
+ /* Start the child with most signals blocked, to avoid any issues before we
+ * can reset them, but allow program failures to exit (and not hang). */
+ sigfillset(&signewset);
+ sigdelset(&signewset, SIGKILL);
+ sigdelset(&signewset, SIGSTOP);
+ sigdelset(&signewset, SIGTRAP);
+ sigdelset(&signewset, SIGSEGV);
+ sigdelset(&signewset, SIGBUS);
+ sigdelset(&signewset, SIGILL);
+ sigdelset(&signewset, SIGSYS);
+ sigdelset(&signewset, SIGABRT);
+ if (pthread_sigmask(SIG_BLOCK, &signewset, &sigoldset) != 0)
+ abort();
+
+ pid = fork();
+ if (pid == -1)
err = UV__ERR(errno);
- uv_rwlock_wrunlock(&loop->cloexec_lock);
- uv__close(signal_pipe[0]);
- uv__close(signal_pipe[1]);
- goto error;
- }
- if (pid == 0) {
+ if (pid == 0)
uv__process_child_init(options, stdio_count, pipes, signal_pipe[1]);
+
+ if (pthread_sigmask(SIG_SETMASK, &sigoldset, NULL) != 0)
abort();
- }
/* Release lock in parent process */
uv_rwlock_wrunlock(&loop->cloexec_lock);
+
uv__close(signal_pipe[1]);
+ if (pid == -1) {
+ uv__close(signal_pipe[0]);
+ goto error;
+ }
+
process->status = 0;
exec_errorno = 0;
do
diff --git a/Utilities/cmlibuv/src/unix/proctitle.c b/Utilities/cmlibuv/src/unix/proctitle.c
index 9ffe5b629c..9d1f00ddf6 100644
--- a/Utilities/cmlibuv/src/unix/proctitle.c
+++ b/Utilities/cmlibuv/src/unix/proctitle.c
@@ -84,10 +84,7 @@ char** uv_setup_args(int argc, char** argv) {
}
new_argv[i] = NULL;
- /* argv is not adjacent on z/os, we use just argv[0] on that platform. */
-#ifndef __MVS__
pt.cap = argv[i - 1] + size - argv[0];
-#endif
args_mem = new_argv;
process_title = pt;
@@ -119,6 +116,7 @@ int uv_set_process_title(const char* title) {
memcpy(pt->str, title, len);
memset(pt->str + len, '\0', pt->cap - len);
pt->len = len;
+ uv__set_process_title(pt->str);
uv_mutex_unlock(&process_title_mutex);
diff --git a/Utilities/cmlibuv/src/unix/signal.c b/Utilities/cmlibuv/src/unix/signal.c
index f40a3e54eb..1133c73a95 100644
--- a/Utilities/cmlibuv/src/unix/signal.c
+++ b/Utilities/cmlibuv/src/unix/signal.c
@@ -265,7 +265,7 @@ static int uv__signal_loop_once_init(uv_loop_t* loop) {
if (loop->signal_pipefd[0] != -1)
return 0;
- err = uv__make_pipe(loop->signal_pipefd, UV__F_NONBLOCK);
+ err = uv__make_pipe(loop->signal_pipefd, UV_NONBLOCK_PIPE);
if (err)
return err;
diff --git a/Utilities/cmlibuv/src/unix/stream.c b/Utilities/cmlibuv/src/unix/stream.c
index 3b6da8d464..4159cdc360 100644
--- a/Utilities/cmlibuv/src/unix/stream.c
+++ b/Utilities/cmlibuv/src/unix/stream.c
@@ -164,7 +164,7 @@ static void uv__stream_osx_select(void* arg) {
else
max_fd = s->int_fd;
- while (1) {
+ for (;;) {
/* Terminate on semaphore */
if (uv_sem_trywait(&s->close_sem) == 0)
break;
@@ -195,7 +195,7 @@ static void uv__stream_osx_select(void* arg) {
/* Empty socketpair's buffer in case of interruption */
if (FD_ISSET(s->int_fd, s->sread))
- while (1) {
+ for (;;) {
r = read(s->int_fd, buf, sizeof(buf));
if (r == sizeof(buf))
@@ -799,33 +799,21 @@ static int uv__handle_fd(uv_handle_t* handle) {
}
}
-static void uv__write(uv_stream_t* stream) {
+static int uv__try_write(uv_stream_t* stream,
+ const uv_buf_t bufs[],
+ unsigned int nbufs,
+ uv_stream_t* send_handle) {
struct iovec* iov;
- QUEUE* q;
- uv_write_t* req;
int iovmax;
int iovcnt;
ssize_t n;
- int err;
-
-start:
-
- assert(uv__stream_fd(stream) >= 0);
-
- if (QUEUE_EMPTY(&stream->write_queue))
- return;
-
- q = QUEUE_HEAD(&stream->write_queue);
- req = QUEUE_DATA(q, uv_write_t, queue);
- assert(req->handle == stream);
/*
* Cast to iovec. We had to have our own uv_buf_t instead of iovec
* because Windows's WSABUF is not an iovec.
*/
- assert(sizeof(uv_buf_t) == sizeof(struct iovec));
- iov = (struct iovec*) &(req->bufs[req->write_index]);
- iovcnt = req->nbufs - req->write_index;
+ iov = (struct iovec*) bufs;
+ iovcnt = nbufs;
iovmax = uv__getiovmax();
@@ -837,8 +825,7 @@ start:
* Now do the actual writev. Note that we've been updating the pointers
* inside the iov each time we write. So there is no need to offset it.
*/
-
- if (req->send_handle) {
+ if (send_handle != NULL) {
int fd_to_send;
struct msghdr msg;
struct cmsghdr *cmsg;
@@ -847,12 +834,10 @@ start:
struct cmsghdr alias;
} scratch;
- if (uv__is_closing(req->send_handle)) {
- err = UV_EBADF;
- goto error;
- }
+ if (uv__is_closing(send_handle))
+ return UV_EBADF;
- fd_to_send = uv__handle_fd((uv_handle_t*) req->send_handle);
+ fd_to_send = uv__handle_fd((uv_handle_t*) send_handle);
memset(&scratch, 0, sizeof(scratch));
@@ -882,44 +867,68 @@ start:
do
n = sendmsg(uv__stream_fd(stream), &msg, 0);
while (n == -1 && RETRY_ON_WRITE_ERROR(errno));
-
- /* Ensure the handle isn't sent again in case this is a partial write. */
- if (n >= 0)
- req->send_handle = NULL;
} else {
do
n = uv__writev(uv__stream_fd(stream), iov, iovcnt);
while (n == -1 && RETRY_ON_WRITE_ERROR(errno));
}
- if (n == -1 && !IS_TRANSIENT_WRITE_ERROR(errno, req->send_handle)) {
- err = UV__ERR(errno);
- goto error;
- }
+ if (n >= 0)
+ return n;
- if (n >= 0 && uv__write_req_update(stream, req, n)) {
- uv__write_req_finish(req);
- return; /* TODO(bnoordhuis) Start trying to write the next request. */
- }
+ if (IS_TRANSIENT_WRITE_ERROR(errno, send_handle))
+ return UV_EAGAIN;
- /* If this is a blocking stream, try again. */
- if (stream->flags & UV_HANDLE_BLOCKING_WRITES)
- goto start;
+ return UV__ERR(errno);
+}
- /* We're not done. */
- uv__io_start(stream->loop, &stream->io_watcher, POLLOUT);
+static void uv__write(uv_stream_t* stream) {
+ QUEUE* q;
+ uv_write_t* req;
+ ssize_t n;
- /* Notify select() thread about state change */
- uv__stream_osx_interrupt_select(stream);
+ assert(uv__stream_fd(stream) >= 0);
+
+ for (;;) {
+ if (QUEUE_EMPTY(&stream->write_queue))
+ return;
+
+ q = QUEUE_HEAD(&stream->write_queue);
+ req = QUEUE_DATA(q, uv_write_t, queue);
+ assert(req->handle == stream);
+
+ n = uv__try_write(stream,
+ &(req->bufs[req->write_index]),
+ req->nbufs - req->write_index,
+ req->send_handle);
+
+ /* Ensure the handle isn't sent again in case this is a partial write. */
+ if (n >= 0) {
+ req->send_handle = NULL;
+ if (uv__write_req_update(stream, req, n)) {
+ uv__write_req_finish(req);
+ return; /* TODO(bnoordhuis) Start trying to write the next request. */
+ }
+ } else if (n != UV_EAGAIN)
+ break;
+
+ /* If this is a blocking stream, try again. */
+ if (stream->flags & UV_HANDLE_BLOCKING_WRITES)
+ continue;
+
+ /* We're not done. */
+ uv__io_start(stream->loop, &stream->io_watcher, POLLOUT);
- return;
+ /* Notify select() thread about state change */
+ uv__stream_osx_interrupt_select(stream);
+
+ return;
+ }
-error:
- req->error = err;
+ req->error = n;
+ /* XXX(jwn): this must call uv__stream_flush_write_queue(stream, n) here, since we won't generate any more events */
uv__write_req_finish(req);
uv__io_stop(stream->loop, &stream->io_watcher, POLLOUT);
- if (!uv__io_active(&stream->io_watcher, POLLIN))
- uv__handle_stop(stream);
uv__stream_osx_interrupt_select(stream);
}
@@ -1001,9 +1010,9 @@ uv_handle_type uv__handle_type(int fd) {
static void uv__stream_eof(uv_stream_t* stream, const uv_buf_t* buf) {
stream->flags |= UV_HANDLE_READ_EOF;
stream->flags &= ~UV_HANDLE_READING;
+ stream->flags &= ~UV_HANDLE_READABLE;
uv__io_stop(stream->loop, &stream->io_watcher, POLLIN);
- if (!uv__io_active(&stream->io_watcher, POLLOUT))
- uv__handle_stop(stream);
+ uv__handle_stop(stream);
uv__stream_osx_interrupt_select(stream);
stream->read_cb(stream, UV_EOF, buf);
}
@@ -1188,12 +1197,12 @@ static void uv__read(uv_stream_t* stream) {
#endif
} else {
/* Error. User should call uv_close(). */
+ stream->flags &= ~(UV_HANDLE_READABLE | UV_HANDLE_WRITABLE);
stream->read_cb(stream, UV__ERR(errno), &buf);
if (stream->flags & UV_HANDLE_READING) {
stream->flags &= ~UV_HANDLE_READING;
uv__io_stop(stream->loop, &stream->io_watcher, POLLIN);
- if (!uv__io_active(&stream->io_watcher, POLLOUT))
- uv__handle_stop(stream);
+ uv__handle_stop(stream);
uv__stream_osx_interrupt_select(stream);
}
}
@@ -1276,6 +1285,7 @@ int uv_shutdown(uv_shutdown_t* req, uv_stream_t* stream, uv_shutdown_cb cb) {
req->cb = cb;
stream->shutdown_req = req;
stream->flags |= UV_HANDLE_SHUTTING;
+ stream->flags &= ~UV_HANDLE_WRITABLE;
uv__io_start(stream->loop, &stream->io_watcher, POLLOUT);
uv__stream_osx_interrupt_select(stream);
@@ -1390,14 +1400,9 @@ static void uv__stream_connect(uv_stream_t* stream) {
}
-int uv_write2(uv_write_t* req,
- uv_stream_t* stream,
- const uv_buf_t bufs[],
- unsigned int nbufs,
- uv_stream_t* send_handle,
- uv_write_cb cb) {
- int empty_queue;
-
+static int uv__check_before_write(uv_stream_t* stream,
+ unsigned int nbufs,
+ uv_stream_t* send_handle) {
assert(nbufs > 0);
assert((stream->type == UV_TCP ||
stream->type == UV_NAMED_PIPE ||
@@ -1410,7 +1415,7 @@ int uv_write2(uv_write_t* req,
if (!(stream->flags & UV_HANDLE_WRITABLE))
return UV_EPIPE;
- if (send_handle) {
+ if (send_handle != NULL) {
if (stream->type != UV_NAMED_PIPE || !((uv_pipe_t*)stream)->ipc)
return UV_EINVAL;
@@ -1430,6 +1435,22 @@ int uv_write2(uv_write_t* req,
#endif
}
+ return 0;
+}
+
+int uv_write2(uv_write_t* req,
+ uv_stream_t* stream,
+ const uv_buf_t bufs[],
+ unsigned int nbufs,
+ uv_stream_t* send_handle,
+ uv_write_cb cb) {
+ int empty_queue;
+ int err;
+
+ err = uv__check_before_write(stream, nbufs, send_handle);
+ if (err < 0)
+ return err;
+
/* It's legal for write_queue_size > 0 even when the write_queue is empty;
* it means there are error-state requests in the write_completed_queue that
* will touch up write_queue_size later, see also uv__write_req_finish().
@@ -1498,72 +1519,37 @@ int uv_write(uv_write_t* req,
}
-void uv_try_write_cb(uv_write_t* req, int status) {
- /* Should not be called */
- abort();
-}
-
-
int uv_try_write(uv_stream_t* stream,
const uv_buf_t bufs[],
unsigned int nbufs) {
- int r;
- int has_pollout;
- size_t written;
- size_t req_size;
- uv_write_t req;
+ return uv_try_write2(stream, bufs, nbufs, NULL);
+}
+
+
+int uv_try_write2(uv_stream_t* stream,
+ const uv_buf_t bufs[],
+ unsigned int nbufs,
+ uv_stream_t* send_handle) {
+ int err;
/* Connecting or already writing some data */
if (stream->connect_req != NULL || stream->write_queue_size != 0)
return UV_EAGAIN;
- has_pollout = uv__io_active(&stream->io_watcher, POLLOUT);
+ err = uv__check_before_write(stream, nbufs, NULL);
+ if (err < 0)
+ return err;
- r = uv_write(&req, stream, bufs, nbufs, uv_try_write_cb);
- if (r != 0)
- return r;
-
- /* Remove not written bytes from write queue size */
- written = uv__count_bufs(bufs, nbufs);
- if (req.bufs != NULL)
- req_size = uv__write_req_size(&req);
- else
- req_size = 0;
- written -= req_size;
- stream->write_queue_size -= req_size;
-
- /* Unqueue request, regardless of immediateness */
- QUEUE_REMOVE(&req.queue);
- uv__req_unregister(stream->loop, &req);
- if (req.bufs != req.bufsml)
- uv__free(req.bufs);
- req.bufs = NULL;
-
- /* Do not poll for writable, if we wasn't before calling this */
- if (!has_pollout) {
- uv__io_stop(stream->loop, &stream->io_watcher, POLLOUT);
- uv__stream_osx_interrupt_select(stream);
- }
-
- if (written == 0 && req_size != 0)
- return req.error < 0 ? req.error : UV_EAGAIN;
- else
- return written;
+ return uv__try_write(stream, bufs, nbufs, send_handle);
}
-int uv_read_start(uv_stream_t* stream,
- uv_alloc_cb alloc_cb,
- uv_read_cb read_cb) {
+int uv__read_start(uv_stream_t* stream,
+ uv_alloc_cb alloc_cb,
+ uv_read_cb read_cb) {
assert(stream->type == UV_TCP || stream->type == UV_NAMED_PIPE ||
stream->type == UV_TTY);
- if (stream->flags & UV_HANDLE_CLOSING)
- return UV_EINVAL;
-
- if (!(stream->flags & UV_HANDLE_READABLE))
- return UV_ENOTCONN;
-
/* The UV_HANDLE_READING flag is irrelevant of the state of the tcp - it just
* expresses the desired state of the user.
*/
@@ -1593,8 +1579,7 @@ int uv_read_stop(uv_stream_t* stream) {
stream->flags &= ~UV_HANDLE_READING;
uv__io_stop(stream->loop, &stream->io_watcher, POLLIN);
- if (!uv__io_active(&stream->io_watcher, POLLOUT))
- uv__handle_stop(stream);
+ uv__handle_stop(stream);
uv__stream_osx_interrupt_select(stream);
stream->read_cb = NULL;
diff --git a/Utilities/cmlibuv/src/unix/sunos.c b/Utilities/cmlibuv/src/unix/sunos.c
index 2166e8f08e..eab2e40a67 100644
--- a/Utilities/cmlibuv/src/unix/sunos.c
+++ b/Utilities/cmlibuv/src/unix/sunos.c
@@ -869,3 +869,14 @@ void uv_free_interface_addresses(uv_interface_address_t* addresses,
uv__free(addresses);
}
+
+
+#if !defined(_POSIX_VERSION) || _POSIX_VERSION < 200809L
+size_t strnlen(const char* s, size_t maxlen) {
+ const char* end;
+ end = memchr(s, '\0', maxlen);
+ if (end == NULL)
+ return maxlen;
+ return end - s;
+}
+#endif
diff --git a/Utilities/cmlibuv/src/unix/tcp.c b/Utilities/cmlibuv/src/unix/tcp.c
index 18acd20df1..bc0fb661f1 100644
--- a/Utilities/cmlibuv/src/unix/tcp.c
+++ b/Utilities/cmlibuv/src/unix/tcp.c
@@ -214,14 +214,15 @@ int uv__tcp_connect(uv_connect_t* req,
if (handle->connect_req != NULL)
return UV_EALREADY; /* FIXME(bnoordhuis) UV_EINVAL or maybe UV_EBUSY. */
+ if (handle->delayed_error != 0)
+ goto out;
+
err = maybe_new_socket(handle,
addr->sa_family,
UV_HANDLE_READABLE | UV_HANDLE_WRITABLE);
if (err)
return err;
- handle->delayed_error = 0;
-
do {
errno = 0;
r = connect(uv__stream_fd(handle), addr, addrlen);
@@ -249,6 +250,8 @@ int uv__tcp_connect(uv_connect_t* req,
return UV__ERR(errno);
}
+out:
+
uv__req_init(handle->loop, req, UV_CONNECT);
req->cb = cb;
req->handle = (uv_stream_t*) handle;
@@ -459,3 +462,49 @@ int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable) {
void uv__tcp_close(uv_tcp_t* handle) {
uv__stream_close((uv_stream_t*)handle);
}
+
+
+int uv_socketpair(int type, int protocol, uv_os_sock_t fds[2], int flags0, int flags1) {
+ uv_os_sock_t temp[2];
+ int err;
+#if defined(__FreeBSD__) || defined(__linux__)
+ int flags;
+
+ flags = type | SOCK_CLOEXEC;
+ if ((flags0 & UV_NONBLOCK_PIPE) && (flags1 & UV_NONBLOCK_PIPE))
+ flags |= SOCK_NONBLOCK;
+
+ if (socketpair(AF_UNIX, flags, protocol, temp))
+ return UV__ERR(errno);
+
+ if (flags & UV_FS_O_NONBLOCK) {
+ fds[0] = temp[0];
+ fds[1] = temp[1];
+ return 0;
+ }
+#else
+ if (socketpair(AF_UNIX, type, protocol, temp))
+ return UV__ERR(errno);
+
+ if ((err = uv__cloexec(temp[0], 1)))
+ goto fail;
+ if ((err = uv__cloexec(temp[1], 1)))
+ goto fail;
+#endif
+
+ if (flags0 & UV_NONBLOCK_PIPE)
+ if ((err = uv__nonblock(temp[0], 1)))
+ goto fail;
+ if (flags1 & UV_NONBLOCK_PIPE)
+ if ((err = uv__nonblock(temp[1], 1)))
+ goto fail;
+
+ fds[0] = temp[0];
+ fds[1] = temp[1];
+ return 0;
+
+fail:
+ uv__close(temp[0]);
+ uv__close(temp[1]);
+ return err;
+}
diff --git a/Utilities/cmlibuv/src/unix/thread.c b/Utilities/cmlibuv/src/unix/thread.c
index 8aeb0ca382..cbddf173f7 100644
--- a/Utilities/cmlibuv/src/unix/thread.c
+++ b/Utilities/cmlibuv/src/unix/thread.c
@@ -107,8 +107,7 @@ int uv_barrier_wait(uv_barrier_t* barrier) {
}
last = (--b->out == 0);
- if (!last)
- uv_cond_signal(&b->cond); /* Not needed for last thread. */
+ uv_cond_signal(&b->cond);
uv_mutex_unlock(&b->mutex);
return last;
@@ -122,9 +121,10 @@ void uv_barrier_destroy(uv_barrier_t* barrier) {
uv_mutex_lock(&b->mutex);
assert(b->in == 0);
- assert(b->out == 0);
+ while (b->out != 0)
+ uv_cond_wait(&b->cond, &b->mutex);
- if (b->in != 0 || b->out != 0)
+ if (b->in != 0)
abort();
uv_mutex_unlock(&b->mutex);
@@ -168,7 +168,7 @@ void uv_barrier_destroy(uv_barrier_t* barrier) {
* On Linux, threads created by musl have a much smaller stack than threads
* created by glibc (80 vs. 2048 or 4096 kB.) Follow glibc for consistency.
*/
-static size_t thread_stack_size(void) {
+size_t uv__thread_stack_size(void) {
#if defined(__APPLE__) || defined(__linux__)
struct rlimit lim;
@@ -234,7 +234,7 @@ int uv_thread_create_ex(uv_thread_t* tid,
attr = NULL;
if (stack_size == 0) {
- stack_size = thread_stack_size();
+ stack_size = uv__thread_stack_size();
} else {
pagesize = (size_t)getpagesize();
/* Round up to the nearest page boundary. */
diff --git a/Utilities/cmlibuv/src/unix/tty.c b/Utilities/cmlibuv/src/unix/tty.c
index 82cd723d74..8cefc150bb 100644
--- a/Utilities/cmlibuv/src/unix/tty.c
+++ b/Utilities/cmlibuv/src/unix/tty.c
@@ -239,6 +239,24 @@ static void uv__tty_make_raw(struct termios* tio) {
tio->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
tio->c_cflag &= ~(CSIZE | PARENB);
tio->c_cflag |= CS8;
+
+ /*
+ * By default, most software expects a pending read to block until at
+ * least one byte becomes available. As per termio(7I), this requires
+ * setting the MIN and TIME parameters appropriately.
+ *
+ * As a somewhat unfortunate artifact of history, the MIN and TIME slots
+ * in the control character array overlap with the EOF and EOL slots used
+ * for canonical mode processing. Because the EOF character needs to be
+ * the ASCII EOT value (aka Control-D), it has the byte value 4. When
+ * switching to raw mode, this is interpreted as a MIN value of 4; i.e.,
+ * reads will block until at least four bytes have been input.
+ *
+ * Other platforms with a distinct MIN slot like Linux and FreeBSD appear
+ * to default to a MIN value of 1, so we'll force that value here:
+ */
+ tio->c_cc[VMIN] = 1;
+ tio->c_cc[VTIME] = 0;
#else
cfmakeraw(tio);
#endif /* #ifdef __sun */
diff --git a/Utilities/cmlibuv/src/unix/udp.c b/Utilities/cmlibuv/src/unix/udp.c
index 7d699a1675..71bfbf7f79 100644
--- a/Utilities/cmlibuv/src/unix/udp.c
+++ b/Utilities/cmlibuv/src/unix/udp.c
@@ -32,8 +32,6 @@
#endif
#include <sys/un.h>
-#define UV__UDP_DGRAM_MAXSIZE (64 * 1024)
-
#if defined(IPV6_JOIN_GROUP) && !defined(IPV6_ADD_MEMBERSHIP)
# define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
#endif
@@ -377,8 +375,11 @@ write_queue_drain:
return;
}
+ /* Safety: npkts known to be >0 below. Hence cast from ssize_t
+ * to size_t safe.
+ */
for (i = 0, q = QUEUE_HEAD(&handle->write_queue);
- i < pkts && q != &handle->write_queue;
+ i < (size_t)npkts && q != &handle->write_queue;
++i, q = QUEUE_HEAD(&handle->write_queue)) {
assert(q != NULL);
req = QUEUE_DATA(q, uv_udp_send_t, queue);
@@ -504,6 +505,28 @@ static int uv__set_reuse(int fd) {
return 0;
}
+/*
+ * The Linux kernel suppresses some ICMP error messages by default for UDP
+ * sockets. Setting IP_RECVERR/IPV6_RECVERR on the socket enables full ICMP
+ * error reporting, hopefully resulting in faster failover to working name
+ * servers.
+ */
+static int uv__set_recverr(int fd, sa_family_t ss_family) {
+#if defined(__linux__)
+ int yes;
+
+ yes = 1;
+ if (ss_family == AF_INET) {
+ if (setsockopt(fd, IPPROTO_IP, IP_RECVERR, &yes, sizeof(yes)))
+ return UV__ERR(errno);
+ } else if (ss_family == AF_INET6) {
+ if (setsockopt(fd, IPPROTO_IPV6, IPV6_RECVERR, &yes, sizeof(yes)))
+ return UV__ERR(errno);
+ }
+#endif
+ return 0;
+}
+
int uv__udp_bind(uv_udp_t* handle,
const struct sockaddr* addr,
@@ -514,7 +537,7 @@ int uv__udp_bind(uv_udp_t* handle,
int fd;
/* Check for bad flags. */
- if (flags & ~(UV_UDP_IPV6ONLY | UV_UDP_REUSEADDR))
+ if (flags & ~(UV_UDP_IPV6ONLY | UV_UDP_REUSEADDR | UV_UDP_LINUX_RECVERR))
return UV_EINVAL;
/* Cannot set IPv6-only mode on non-IPv6 socket. */
@@ -530,6 +553,12 @@ int uv__udp_bind(uv_udp_t* handle,
handle->io_watcher.fd = fd;
}
+ if (flags & UV_UDP_LINUX_RECVERR) {
+ err = uv__set_recverr(fd, addr->sa_family);
+ if (err)
+ return err;
+ }
+
if (flags & UV_UDP_REUSEADDR) {
err = uv__set_reuse(fd);
if (err)
@@ -854,7 +883,7 @@ static int uv__udp_set_membership6(uv_udp_t* handle,
#if !defined(__OpenBSD__) && \
!defined(__NetBSD__) && \
!defined(__ANDROID__) && \
- !defined(__DragonFly__) & \
+ !defined(__DragonFly__) && \
!defined(__QNX__)
static int uv__udp_set_source_membership4(uv_udp_t* handle,
const struct sockaddr_in* multicast_addr,
diff --git a/Utilities/cmlibuv/src/uv-common.c b/Utilities/cmlibuv/src/uv-common.c
index f986d75270..8bce62edf6 100644
--- a/Utilities/cmlibuv/src/uv-common.c
+++ b/Utilities/cmlibuv/src/uv-common.c
@@ -834,6 +834,25 @@ void uv_loop_delete(uv_loop_t* loop) {
}
+int uv_read_start(uv_stream_t* stream,
+ uv_alloc_cb alloc_cb,
+ uv_read_cb read_cb) {
+ if (stream == NULL || alloc_cb == NULL || read_cb == NULL)
+ return UV_EINVAL;
+
+ if (stream->flags & UV_HANDLE_CLOSING)
+ return UV_EINVAL;
+
+ if (stream->flags & UV_HANDLE_READING)
+ return UV_EALREADY;
+
+ if (!(stream->flags & UV_HANDLE_READABLE))
+ return UV_ENOTCONN;
+
+ return uv__read_start(stream, alloc_cb, read_cb);
+}
+
+
void uv_os_free_environ(uv_env_item_t* envitems, int count) {
int i;
@@ -855,7 +874,11 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) {
}
-#ifdef __GNUC__ /* Also covers __clang__ and __INTEL_COMPILER. */
+/* Also covers __clang__ and __INTEL_COMPILER. Disabled on Windows because
+ * threads have already been forcibly terminated by the operating system
+ * by the time destructors run, ergo, it's not safe to try to clean them up.
+ */
+#if defined(__GNUC__) && !defined(_WIN32)
__attribute__((destructor))
#endif
void uv_library_shutdown(void) {
diff --git a/Utilities/cmlibuv/src/uv-common.h b/Utilities/cmlibuv/src/uv-common.h
index e851291cc0..8a190bf8fa 100644
--- a/Utilities/cmlibuv/src/uv-common.h
+++ b/Utilities/cmlibuv/src/uv-common.h
@@ -68,6 +68,8 @@ extern int snprintf(char*, size_t, const char*, ...);
#define uv__store_relaxed(p, v) do *p = v; while (0)
#endif
+#define UV__UDP_DGRAM_MAXSIZE (64 * 1024)
+
/* Handle flags. Some flags are specific to Windows or UNIX. */
enum {
/* Used by all handles. */
@@ -106,8 +108,7 @@ enum {
UV_HANDLE_TCP_KEEPALIVE = 0x02000000,
UV_HANDLE_TCP_SINGLE_ACCEPT = 0x04000000,
UV_HANDLE_TCP_ACCEPT_STATE_CHANGING = 0x08000000,
- UV_HANDLE_TCP_SOCKET_CLOSED = 0x10000000,
- UV_HANDLE_SHARED_TCP_SOCKET = 0x20000000,
+ UV_HANDLE_SHARED_TCP_SOCKET = 0x10000000,
/* Only used by uv_udp_t handles. */
UV_HANDLE_UDP_PROCESSING = 0x01000000,
@@ -136,6 +137,10 @@ int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap);
void uv__loop_close(uv_loop_t* loop);
+int uv__read_start(uv_stream_t* stream,
+ uv_alloc_cb alloc_cb,
+ uv_read_cb read_cb);
+
int uv__tcp_bind(uv_tcp_t* tcp,
const struct sockaddr* addr,
unsigned int addrlen,
diff --git a/Utilities/cmlibuv/src/win/error.c b/Utilities/cmlibuv/src/win/error.c
index 3ec984c83e..3a269da87a 100644
--- a/Utilities/cmlibuv/src/win/error.c
+++ b/Utilities/cmlibuv/src/win/error.c
@@ -105,7 +105,6 @@ int uv_translate_sys_error(int sys_errno) {
case ERROR_SYMLINK_NOT_SUPPORTED: return UV_EINVAL;
case WSAEINVAL: return UV_EINVAL;
case WSAEPFNOSUPPORT: return UV_EINVAL;
- case WSAESOCKTNOSUPPORT: return UV_EINVAL;
case ERROR_BEGINNING_OF_MEDIA: return UV_EIO;
case ERROR_BUS_RESET: return UV_EIO;
case ERROR_CRC: return UV_EIO;
@@ -168,6 +167,7 @@ int uv_translate_sys_error(int sys_errno) {
case ERROR_NOT_SAME_DEVICE: return UV_EXDEV;
case ERROR_INVALID_FUNCTION: return UV_EISDIR;
case ERROR_META_EXPANSION_TOO_LONG: return UV_E2BIG;
+ case WSAESOCKTNOSUPPORT: return UV_ESOCKTNOSUPPORT;
default: return UV_UNKNOWN;
}
}
diff --git a/Utilities/cmlibuv/src/win/fs-event.c b/Utilities/cmlibuv/src/win/fs-event.c
index 0126c5eded..76da077551 100644
--- a/Utilities/cmlibuv/src/win/fs-event.c
+++ b/Utilities/cmlibuv/src/win/fs-event.c
@@ -574,10 +574,10 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req,
handle->cb(handle, NULL, 0, uv_translate_sys_error(err));
}
- if (!(handle->flags & UV_HANDLE_CLOSING)) {
- uv_fs_event_queue_readdirchanges(loop, handle);
- } else {
+ if (handle->flags & UV_HANDLE_CLOSING) {
uv_want_endgame(loop, (uv_handle_t*)handle);
+ } else if (uv__is_active(handle)) {
+ uv_fs_event_queue_readdirchanges(loop, handle);
}
}
diff --git a/Utilities/cmlibuv/src/win/fs.c b/Utilities/cmlibuv/src/win/fs.c
index d6ff7ed291..903764144f 100644
--- a/Utilities/cmlibuv/src/win/fs.c
+++ b/Utilities/cmlibuv/src/win/fs.c
@@ -92,30 +92,24 @@
return; \
}
-#define MILLIONu (1000U * 1000U)
-#define BILLIONu (1000U * 1000U * 1000U)
+#define MILLION ((int64_t) 1000 * 1000)
+#define BILLION ((int64_t) 1000 * 1000 * 1000)
-#define FILETIME_TO_UINT(filetime) \
- (*((uint64_t*) &(filetime)) - (uint64_t) 116444736 * BILLIONu)
-
-#define FILETIME_TO_TIME_T(filetime) \
- (FILETIME_TO_UINT(filetime) / (10u * MILLIONu))
-
-#define FILETIME_TO_TIME_NS(filetime, secs) \
- ((FILETIME_TO_UINT(filetime) - (secs * (uint64_t) 10 * MILLIONu)) * 100U)
-
-#define FILETIME_TO_TIMESPEC(ts, filetime) \
- do { \
- (ts).tv_sec = (long) FILETIME_TO_TIME_T(filetime); \
- (ts).tv_nsec = (long) FILETIME_TO_TIME_NS(filetime, (ts).tv_sec); \
- } while(0)
+static void uv__filetime_to_timespec(uv_timespec_t *ts, int64_t filetime) {
+ filetime -= 116444736 * BILLION;
+ ts->tv_sec = (long) (filetime / (10 * MILLION));
+ ts->tv_nsec = (long) ((filetime - ts->tv_sec * 10 * MILLION) * 100U);
+ if (ts->tv_nsec < 0) {
+ ts->tv_sec -= 1;
+ ts->tv_nsec += 1e9;
+ }
+}
#define TIME_T_TO_FILETIME(time, filetime_ptr) \
do { \
- uint64_t bigtime = ((uint64_t) ((time) * (uint64_t) 10 * MILLIONu)) + \
- (uint64_t) 116444736 * BILLIONu; \
- (filetime_ptr)->dwLowDateTime = bigtime & 0xFFFFFFFF; \
- (filetime_ptr)->dwHighDateTime = bigtime >> 32; \
+ int64_t bigtime = ((time) * 10 * MILLION + 116444736 * BILLION); \
+ (filetime_ptr)->dwLowDateTime = (uint64_t) bigtime & 0xFFFFFFFF; \
+ (filetime_ptr)->dwHighDateTime = (uint64_t) bigtime >> 32; \
} while(0)
#define IS_SLASH(c) ((c) == L'\\' || (c) == L'/')
@@ -764,7 +758,7 @@ void fs__read_filemap(uv_fs_t* req, struct uv__fd_info_s* fd_info) {
void* view;
if (rw_flags == UV_FS_O_WRONLY) {
- SET_REQ_WIN32_ERROR(req, ERROR_ACCESS_DENIED);
+ SET_REQ_WIN32_ERROR(req, ERROR_INVALID_FLAGS);
return;
}
if (fd_info->is_directory) {
@@ -918,6 +912,11 @@ void fs__read(uv_fs_t* req) {
SET_REQ_RESULT(req, bytes);
} else {
error = GetLastError();
+
+ if (error == ERROR_ACCESS_DENIED) {
+ error = ERROR_INVALID_FLAGS;
+ }
+
if (error == ERROR_HANDLE_EOF) {
SET_REQ_RESULT(req, bytes);
} else {
@@ -942,7 +941,7 @@ void fs__write_filemap(uv_fs_t* req, HANDLE file,
FILETIME ft;
if (rw_flags == UV_FS_O_RDONLY) {
- SET_REQ_WIN32_ERROR(req, ERROR_ACCESS_DENIED);
+ SET_REQ_WIN32_ERROR(req, ERROR_INVALID_FLAGS);
return;
}
if (fd_info->is_directory) {
@@ -1058,6 +1057,7 @@ void fs__write(uv_fs_t* req) {
OVERLAPPED overlapped, *overlapped_ptr;
LARGE_INTEGER offset_;
DWORD bytes;
+ DWORD error;
int result;
unsigned int index;
LARGE_INTEGER original_position;
@@ -1117,7 +1117,13 @@ void fs__write(uv_fs_t* req) {
if (result || bytes > 0) {
SET_REQ_RESULT(req, bytes);
} else {
- SET_REQ_WIN32_ERROR(req, GetLastError());
+ error = GetLastError();
+
+ if (error == ERROR_ACCESS_DENIED) {
+ error = ERROR_INVALID_FLAGS;
+ }
+
+ SET_REQ_WIN32_ERROR(req, error);
}
}
@@ -1224,7 +1230,8 @@ void fs__mkdir(uv_fs_t* req) {
SET_REQ_RESULT(req, 0);
} else {
SET_REQ_WIN32_ERROR(req, GetLastError());
- if (req->sys_errno_ == ERROR_INVALID_NAME)
+ if (req->sys_errno_ == ERROR_INVALID_NAME ||
+ req->sys_errno_ == ERROR_DIRECTORY)
req->result = UV_EINVAL;
}
}
@@ -1791,10 +1798,14 @@ INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf,
statbuf->st_mode |= (_S_IREAD | _S_IWRITE) | ((_S_IREAD | _S_IWRITE) >> 3) |
((_S_IREAD | _S_IWRITE) >> 6);
- FILETIME_TO_TIMESPEC(statbuf->st_atim, file_info.BasicInformation.LastAccessTime);
- FILETIME_TO_TIMESPEC(statbuf->st_ctim, file_info.BasicInformation.ChangeTime);
- FILETIME_TO_TIMESPEC(statbuf->st_mtim, file_info.BasicInformation.LastWriteTime);
- FILETIME_TO_TIMESPEC(statbuf->st_birthtim, file_info.BasicInformation.CreationTime);
+ uv__filetime_to_timespec(&statbuf->st_atim,
+ file_info.BasicInformation.LastAccessTime.QuadPart);
+ uv__filetime_to_timespec(&statbuf->st_ctim,
+ file_info.BasicInformation.ChangeTime.QuadPart);
+ uv__filetime_to_timespec(&statbuf->st_mtim,
+ file_info.BasicInformation.LastWriteTime.QuadPart);
+ uv__filetime_to_timespec(&statbuf->st_birthtim,
+ file_info.BasicInformation.CreationTime.QuadPart);
statbuf->st_ino = file_info.InternalInformation.IndexNumber.QuadPart;
diff --git a/Utilities/cmlibuv/src/win/internal.h b/Utilities/cmlibuv/src/win/internal.h
index 3f56777c61..7e1aef444a 100644
--- a/Utilities/cmlibuv/src/win/internal.h
+++ b/Utilities/cmlibuv/src/win/internal.h
@@ -119,8 +119,8 @@ void uv_udp_endgame(uv_loop_t* loop, uv_udp_t* handle);
/*
* Pipes
*/
-int uv_stdio_pipe_server(uv_loop_t* loop, uv_pipe_t* handle, DWORD access,
- char* name, size_t nameSize);
+int uv__create_stdio_pipe_pair(uv_loop_t* loop,
+ uv_pipe_t* parent_pipe, HANDLE* child_pipe_ptr, unsigned int flags);
int uv_pipe_listen(uv_pipe_t* handle, int backlog, uv_connection_cb cb);
int uv_pipe_accept(uv_pipe_t* server, uv_stream_t* client);
diff --git a/Utilities/cmlibuv/src/win/pipe.c b/Utilities/cmlibuv/src/win/pipe.c
index f81245ec60..912aed9b62 100644
--- a/Utilities/cmlibuv/src/win/pipe.c
+++ b/Utilities/cmlibuv/src/win/pipe.c
@@ -202,17 +202,17 @@ static void close_pipe(uv_pipe_t* pipe) {
}
-int uv_stdio_pipe_server(uv_loop_t* loop, uv_pipe_t* handle, DWORD access,
- char* name, size_t nameSize) {
+static int uv__pipe_server(
+ HANDLE* pipeHandle_ptr, DWORD access,
+ char* name, size_t nameSize, char* random) {
HANDLE pipeHandle;
int err;
- char* ptr = (char*)handle;
for (;;) {
- uv_unique_pipe_name(ptr, name, nameSize);
+ uv_unique_pipe_name(random, name, nameSize);
pipeHandle = CreateNamedPipeA(name,
- access | FILE_FLAG_OVERLAPPED | FILE_FLAG_FIRST_PIPE_INSTANCE | WRITE_DAC,
+ access | FILE_FLAG_FIRST_PIPE_INSTANCE,
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, 1, 65536, 65536, 0,
NULL);
@@ -226,26 +226,225 @@ int uv_stdio_pipe_server(uv_loop_t* loop, uv_pipe_t* handle, DWORD access,
goto error;
}
- /* Pipe name collision. Increment the pointer and try again. */
- ptr++;
+ /* Pipe name collision. Increment the random number and try again. */
+ random++;
}
- if (CreateIoCompletionPort(pipeHandle,
+ *pipeHandle_ptr = pipeHandle;
+
+ return 0;
+
+ error:
+ if (pipeHandle != INVALID_HANDLE_VALUE)
+ CloseHandle(pipeHandle);
+
+ return err;
+}
+
+
+static int uv__create_pipe_pair(
+ HANDLE* server_pipe_ptr, HANDLE* client_pipe_ptr,
+ unsigned int server_flags, unsigned int client_flags,
+ int inherit_client, char* random) {
+ /* allowed flags are: UV_READABLE_PIPE | UV_WRITABLE_PIPE | UV_NONBLOCK_PIPE */
+ char pipe_name[64];
+ SECURITY_ATTRIBUTES sa;
+ DWORD server_access;
+ DWORD client_access;
+ HANDLE server_pipe;
+ HANDLE client_pipe;
+ int err;
+
+ server_pipe = INVALID_HANDLE_VALUE;
+ client_pipe = INVALID_HANDLE_VALUE;
+
+ server_access = 0;
+ if (server_flags & UV_READABLE_PIPE)
+ server_access |= PIPE_ACCESS_INBOUND;
+ if (server_flags & UV_WRITABLE_PIPE)
+ server_access |= PIPE_ACCESS_OUTBOUND;
+ if (server_flags & UV_NONBLOCK_PIPE)
+ server_access |= FILE_FLAG_OVERLAPPED;
+ server_access |= WRITE_DAC;
+
+ client_access = 0;
+ if (client_flags & UV_READABLE_PIPE)
+ client_access |= GENERIC_READ;
+ else
+ client_access |= FILE_READ_ATTRIBUTES;
+ if (client_flags & UV_WRITABLE_PIPE)
+ client_access |= GENERIC_WRITE;
+ else
+ client_access |= FILE_WRITE_ATTRIBUTES;
+ client_access |= WRITE_DAC;
+
+ /* Create server pipe handle. */
+ err = uv__pipe_server(&server_pipe,
+ server_access,
+ pipe_name,
+ sizeof(pipe_name),
+ random);
+ if (err)
+ goto error;
+
+ /* Create client pipe handle. */
+ sa.nLength = sizeof sa;
+ sa.lpSecurityDescriptor = NULL;
+ sa.bInheritHandle = inherit_client;
+
+ client_pipe = CreateFileA(pipe_name,
+ client_access,
+ 0,
+ &sa,
+ OPEN_EXISTING,
+ (client_flags & UV_NONBLOCK_PIPE) ? FILE_FLAG_OVERLAPPED : 0,
+ NULL);
+ if (client_pipe == INVALID_HANDLE_VALUE) {
+ err = GetLastError();
+ goto error;
+ }
+
+#ifndef NDEBUG
+ /* Validate that the pipe was opened in the right mode. */
+ {
+ DWORD mode;
+ BOOL r;
+ r = GetNamedPipeHandleState(client_pipe, &mode, NULL, NULL, NULL, NULL, 0);
+ if (r == TRUE) {
+ assert(mode == (PIPE_READMODE_BYTE | PIPE_WAIT));
+ } else {
+ fprintf(stderr, "libuv assertion failure: GetNamedPipeHandleState failed\n");
+ }
+ }
+#endif
+
+ /* Do a blocking ConnectNamedPipe. This should not block because we have
+ * both ends of the pipe created. */
+ if (!ConnectNamedPipe(server_pipe, NULL)) {
+ if (GetLastError() != ERROR_PIPE_CONNECTED) {
+ err = GetLastError();
+ goto error;
+ }
+ }
+
+ *client_pipe_ptr = client_pipe;
+ *server_pipe_ptr = server_pipe;
+ return 0;
+
+ error:
+ if (server_pipe != INVALID_HANDLE_VALUE)
+ CloseHandle(server_pipe);
+
+ if (client_pipe != INVALID_HANDLE_VALUE)
+ CloseHandle(client_pipe);
+
+ return err;
+}
+
+
+int uv_pipe(uv_file fds[2], int read_flags, int write_flags) {
+ uv_file temp[2];
+ int err;
+ HANDLE readh;
+ HANDLE writeh;
+
+ /* Make the server side the inbound (read) end, */
+ /* so that both ends will have FILE_READ_ATTRIBUTES permission. */
+ /* TODO: better source of local randomness than &fds? */
+ read_flags |= UV_READABLE_PIPE;
+ write_flags |= UV_WRITABLE_PIPE;
+ err = uv__create_pipe_pair(&readh, &writeh, read_flags, write_flags, 0, (char*) &fds[0]);
+ if (err != 0)
+ return err;
+ temp[0] = _open_osfhandle((intptr_t) readh, 0);
+ if (temp[0] == -1) {
+ if (errno == UV_EMFILE)
+ err = UV_EMFILE;
+ else
+ err = UV_UNKNOWN;
+ CloseHandle(readh);
+ CloseHandle(writeh);
+ return err;
+ }
+ temp[1] = _open_osfhandle((intptr_t) writeh, 0);
+ if (temp[1] == -1) {
+ if (errno == UV_EMFILE)
+ err = UV_EMFILE;
+ else
+ err = UV_UNKNOWN;
+ _close(temp[0]);
+ CloseHandle(writeh);
+ return err;
+ }
+ fds[0] = temp[0];
+ fds[1] = temp[1];
+ return 0;
+}
+
+
+int uv__create_stdio_pipe_pair(uv_loop_t* loop,
+ uv_pipe_t* parent_pipe, HANDLE* child_pipe_ptr, unsigned int flags) {
+ /* The parent_pipe is always the server_pipe and kept by libuv.
+ * The child_pipe is always the client_pipe and is passed to the child.
+ * The flags are specified with respect to their usage in the child. */
+ HANDLE server_pipe;
+ HANDLE client_pipe;
+ unsigned int server_flags;
+ unsigned int client_flags;
+ int err;
+
+ server_pipe = INVALID_HANDLE_VALUE;
+ client_pipe = INVALID_HANDLE_VALUE;
+
+ server_flags = 0;
+ client_flags = 0;
+ if (flags & UV_READABLE_PIPE) {
+ /* The server needs inbound (read) access too, otherwise CreateNamedPipe()
+ * won't give us the FILE_READ_ATTRIBUTES permission. We need that to probe
+ * the state of the write buffer when we're trying to shutdown the pipe. */
+ server_flags |= UV_READABLE_PIPE | UV_WRITABLE_PIPE;
+ client_flags |= UV_READABLE_PIPE;
+ }
+ if (flags & UV_WRITABLE_PIPE) {
+ server_flags |= UV_READABLE_PIPE;
+ client_flags |= UV_WRITABLE_PIPE;
+ }
+ server_flags |= UV_NONBLOCK_PIPE;
+ if (flags & UV_NONBLOCK_PIPE || parent_pipe->ipc) {
+ client_flags |= UV_NONBLOCK_PIPE;
+ }
+
+ err = uv__create_pipe_pair(&server_pipe, &client_pipe,
+ server_flags, client_flags, 1, (char*) server_pipe);
+ if (err)
+ goto error;
+
+ if (CreateIoCompletionPort(server_pipe,
loop->iocp,
- (ULONG_PTR)handle,
+ (ULONG_PTR) parent_pipe,
0) == NULL) {
err = GetLastError();
goto error;
}
- uv_pipe_connection_init(handle);
- handle->handle = pipeHandle;
+ uv_pipe_connection_init(parent_pipe);
+ parent_pipe->handle = server_pipe;
+ *child_pipe_ptr = client_pipe;
+
+ /* The server end is now readable and/or writable. */
+ if (flags & UV_READABLE_PIPE)
+ parent_pipe->flags |= UV_HANDLE_WRITABLE;
+ if (flags & UV_WRITABLE_PIPE)
+ parent_pipe->flags |= UV_HANDLE_READABLE;
return 0;
error:
- if (pipeHandle != INVALID_HANDLE_VALUE)
- CloseHandle(pipeHandle);
+ if (server_pipe != INVALID_HANDLE_VALUE)
+ CloseHandle(server_pipe);
+
+ if (client_pipe != INVALID_HANDLE_VALUE)
+ CloseHandle(client_pipe);
return err;
}
@@ -712,9 +911,8 @@ error:
handle->name = NULL;
}
- if (pipeHandle != INVALID_HANDLE_VALUE) {
+ if (pipeHandle != INVALID_HANDLE_VALUE)
CloseHandle(pipeHandle);
- }
/* Make this req pending reporting an error. */
SET_REQ_ERROR(req, err);
@@ -1054,7 +1252,6 @@ static DWORD WINAPI uv_pipe_writefile_thread_proc(void* parameter) {
assert(req != NULL);
assert(req->type == UV_WRITE);
assert(handle->type == UV_NAMED_PIPE);
- assert(req->write_buffer.base);
result = WriteFile(handle->handle,
req->write_buffer.base,
diff --git a/Utilities/cmlibuv/src/win/poll.c b/Utilities/cmlibuv/src/win/poll.c
index 87858590c8..9d37759606 100644
--- a/Utilities/cmlibuv/src/win/poll.c
+++ b/Utilities/cmlibuv/src/win/poll.c
@@ -488,7 +488,8 @@ static int uv__poll_set(uv_poll_t* handle, int events, uv_poll_cb cb) {
assert(handle->type == UV_POLL);
assert(!(handle->flags & UV_HANDLE_CLOSING));
- assert((events & ~(UV_READABLE | UV_WRITABLE | UV_DISCONNECT)) == 0);
+ assert((events & ~(UV_READABLE | UV_WRITABLE | UV_DISCONNECT |
+ UV_PRIORITIZED)) == 0);
handle->events = events;
handle->poll_cb = cb;
diff --git a/Utilities/cmlibuv/src/win/process-stdio.c b/Utilities/cmlibuv/src/win/process-stdio.c
index 355d618808..0db3572373 100644
--- a/Utilities/cmlibuv/src/win/process-stdio.c
+++ b/Utilities/cmlibuv/src/win/process-stdio.c
@@ -95,102 +95,6 @@ void uv_disable_stdio_inheritance(void) {
}
-static int uv__create_stdio_pipe_pair(uv_loop_t* loop,
- uv_pipe_t* server_pipe, HANDLE* child_pipe_ptr, unsigned int flags) {
- char pipe_name[64];
- SECURITY_ATTRIBUTES sa;
- DWORD server_access = 0;
- DWORD client_access = 0;
- HANDLE child_pipe = INVALID_HANDLE_VALUE;
- int err;
- int overlap;
-
- if (flags & UV_READABLE_PIPE) {
- /* The server needs inbound access too, otherwise CreateNamedPipe() won't
- * give us the FILE_READ_ATTRIBUTES permission. We need that to probe the
- * state of the write buffer when we're trying to shutdown the pipe. */
- server_access |= PIPE_ACCESS_OUTBOUND | PIPE_ACCESS_INBOUND;
- client_access |= GENERIC_READ | FILE_WRITE_ATTRIBUTES;
- }
- if (flags & UV_WRITABLE_PIPE) {
- server_access |= PIPE_ACCESS_INBOUND;
- client_access |= GENERIC_WRITE | FILE_READ_ATTRIBUTES;
- }
-
- /* Create server pipe handle. */
- err = uv_stdio_pipe_server(loop,
- server_pipe,
- server_access,
- pipe_name,
- sizeof(pipe_name));
- if (err)
- goto error;
-
- /* Create child pipe handle. */
- sa.nLength = sizeof sa;
- sa.lpSecurityDescriptor = NULL;
- sa.bInheritHandle = TRUE;
-
- overlap = server_pipe->ipc || (flags & UV_OVERLAPPED_PIPE);
- child_pipe = CreateFileA(pipe_name,
- client_access,
- 0,
- &sa,
- OPEN_EXISTING,
- overlap ? FILE_FLAG_OVERLAPPED : 0,
- NULL);
- if (child_pipe == INVALID_HANDLE_VALUE) {
- err = GetLastError();
- goto error;
- }
-
-#ifndef NDEBUG
- /* Validate that the pipe was opened in the right mode. */
- {
- DWORD mode;
- BOOL r = GetNamedPipeHandleState(child_pipe,
- &mode,
- NULL,
- NULL,
- NULL,
- NULL,
- 0);
- assert(r == TRUE);
- assert(mode == (PIPE_READMODE_BYTE | PIPE_WAIT));
- }
-#endif
-
- /* Do a blocking ConnectNamedPipe. This should not block because we have both
- * ends of the pipe created. */
- if (!ConnectNamedPipe(server_pipe->handle, NULL)) {
- if (GetLastError() != ERROR_PIPE_CONNECTED) {
- err = GetLastError();
- goto error;
- }
- }
-
- /* The server end is now readable and/or writable. */
- if (flags & UV_READABLE_PIPE)
- server_pipe->flags |= UV_HANDLE_WRITABLE;
- if (flags & UV_WRITABLE_PIPE)
- server_pipe->flags |= UV_HANDLE_READABLE;
-
- *child_pipe_ptr = child_pipe;
- return 0;
-
- error:
- if (server_pipe->handle != INVALID_HANDLE_VALUE) {
- uv_pipe_cleanup(loop, server_pipe);
- }
-
- if (child_pipe != INVALID_HANDLE_VALUE) {
- CloseHandle(child_pipe);
- }
-
- return err;
-}
-
-
static int uv__duplicate_handle(uv_loop_t* loop, HANDLE handle, HANDLE* dup) {
HANDLE current_process;
diff --git a/Utilities/cmlibuv/src/win/process.c b/Utilities/cmlibuv/src/win/process.c
index aada889e16..9ca4122caa 100644
--- a/Utilities/cmlibuv/src/win/process.c
+++ b/Utilities/cmlibuv/src/win/process.c
@@ -169,10 +169,9 @@ static WCHAR* search_path_join_test(const WCHAR* dir,
size_t cwd_len) {
WCHAR *result, *result_pos;
DWORD attrs;
- if (
- (dir_len > 2 && dir[0] == L'\\' && dir[1] == L'\\') ||
- (dir_len > 2 && dir[0] == L'/' && dir[1] == L'/')
- ) {
+ if (dir_len > 2 &&
+ ((dir[0] == L'\\' || dir[0] == L'/') &&
+ (dir[1] == L'\\' || dir[1] == L'/'))) {
/* It's a UNC path so ignore cwd */
cwd_len = 0;
} else if (dir_len >= 1 && (dir[0] == L'/' || dir[0] == L'\\')) {
@@ -645,7 +644,7 @@ int env_strncmp(const wchar_t* a, int na, const wchar_t* b) {
assert(r==nb);
B[nb] = L'\0';
- while (1) {
+ for (;;) {
wchar_t AA = *A++;
wchar_t BB = *B++;
if (AA < BB) {
diff --git a/Utilities/cmlibuv/src/win/stream.c b/Utilities/cmlibuv/src/win/stream.c
index 46a0709a38..abf477f644 100644
--- a/Utilities/cmlibuv/src/win/stream.c
+++ b/Utilities/cmlibuv/src/win/stream.c
@@ -65,18 +65,11 @@ int uv_accept(uv_stream_t* server, uv_stream_t* client) {
}
-int uv_read_start(uv_stream_t* handle, uv_alloc_cb alloc_cb,
- uv_read_cb read_cb) {
+int uv__read_start(uv_stream_t* handle,
+ uv_alloc_cb alloc_cb,
+ uv_read_cb read_cb) {
int err;
- if (handle->flags & UV_HANDLE_READING) {
- return UV_EALREADY;
- }
-
- if (!(handle->flags & UV_HANDLE_READABLE)) {
- return UV_ENOTCONN;
- }
-
err = ERROR_INVALID_PARAMETER;
switch (handle->type) {
case UV_TCP:
@@ -195,6 +188,16 @@ int uv_try_write(uv_stream_t* stream,
}
+int uv_try_write2(uv_stream_t* stream,
+ const uv_buf_t bufs[],
+ unsigned int nbufs,
+ uv_stream_t* send_handle) {
+ if (send_handle != NULL)
+ return UV_EAGAIN;
+ return uv_try_write(stream, bufs, nbufs);
+}
+
+
int uv_shutdown(uv_shutdown_t* req, uv_stream_t* handle, uv_shutdown_cb cb) {
uv_loop_t* loop = handle->loop;
diff --git a/Utilities/cmlibuv/src/win/tcp.c b/Utilities/cmlibuv/src/win/tcp.c
index 0dcaa97df7..cf2dbd85fd 100644
--- a/Utilities/cmlibuv/src/win/tcp.c
+++ b/Utilities/cmlibuv/src/win/tcp.c
@@ -236,12 +236,7 @@ void uv_tcp_endgame(uv_loop_t* loop, uv_tcp_t* handle) {
if (handle->flags & UV_HANDLE_CLOSING &&
handle->reqs_pending == 0) {
assert(!(handle->flags & UV_HANDLE_CLOSED));
-
- if (!(handle->flags & UV_HANDLE_TCP_SOCKET_CLOSED)) {
- closesocket(handle->socket);
- handle->socket = INVALID_SOCKET;
- handle->flags |= UV_HANDLE_TCP_SOCKET_CLOSED;
- }
+ assert(handle->socket == INVALID_SOCKET);
if (!(handle->flags & UV_HANDLE_CONNECTION) && handle->tcp.serv.accept_reqs) {
if (handle->flags & UV_HANDLE_EMULATE_IOCP) {
@@ -599,6 +594,7 @@ int uv_tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb) {
}
}
+ /* If this flag is set, we already made this listen call in xfer. */
if (!(handle->flags & UV_HANDLE_SHARED_TCP_SOCKET) &&
listen(handle->socket, backlog) == SOCKET_ERROR) {
return WSAGetLastError();
@@ -769,7 +765,7 @@ static int uv__is_loopback(const struct sockaddr_storage* storage) {
}
// Check if Windows version is 10.0.16299 or later
-static int uv__is_fast_loopback_fail_supported() {
+static int uv__is_fast_loopback_fail_supported(void) {
OSVERSIONINFOW os_info;
if (!pRtlGetVersion)
return 0;
@@ -800,9 +796,8 @@ static int uv_tcp_try_connect(uv_connect_t* req,
if (err)
return err;
- if (handle->delayed_error) {
- return handle->delayed_error;
- }
+ if (handle->delayed_error != 0)
+ goto out;
if (!(handle->flags & UV_HANDLE_BOUND)) {
if (addrlen == sizeof(uv_addr_ip4_any_)) {
@@ -815,8 +810,8 @@ static int uv_tcp_try_connect(uv_connect_t* req,
err = uv_tcp_try_bind(handle, bind_addr, addrlen, 0);
if (err)
return err;
- if (handle->delayed_error)
- return handle->delayed_error;
+ if (handle->delayed_error != 0)
+ goto out;
}
if (!handle->tcp.conn.func_connectex) {
@@ -844,11 +839,21 @@ static int uv_tcp_try_connect(uv_connect_t* req,
NULL);
}
+out:
+
UV_REQ_INIT(req, UV_CONNECT);
req->handle = (uv_stream_t*) handle;
req->cb = cb;
memset(&req->u.io.overlapped, 0, sizeof(req->u.io.overlapped));
+ if (handle->delayed_error != 0) {
+ /* Process the req without IOCP. */
+ handle->reqs_pending++;
+ REGISTER_HANDLE_REQ(loop, handle, req);
+ uv_insert_pending_req(loop, (uv_req_t*)req);
+ return 0;
+ }
+
success = handle->tcp.conn.func_connectex(handle->socket,
(const struct sockaddr*) &converted,
addrlen,
@@ -1015,6 +1020,7 @@ void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle,
*/
err = WSAECONNRESET;
}
+ handle->flags &= ~(UV_HANDLE_READABLE | UV_HANDLE_WRITABLE);
handle->read_cb((uv_stream_t*)handle,
uv_translate_sys_error(err),
@@ -1096,6 +1102,7 @@ void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle,
* Unix. */
err = WSAECONNRESET;
}
+ handle->flags &= ~(UV_HANDLE_READABLE | UV_HANDLE_WRITABLE);
handle->read_cb((uv_stream_t*)handle,
uv_translate_sys_error(err),
@@ -1149,9 +1156,14 @@ void uv_process_tcp_write_req(uv_loop_t* loop, uv_tcp_t* handle,
}
handle->stream.conn.write_reqs_pending--;
- if (handle->stream.conn.shutdown_req != NULL &&
- handle->stream.conn.write_reqs_pending == 0) {
- uv_want_endgame(loop, (uv_handle_t*)handle);
+ if (handle->stream.conn.write_reqs_pending == 0) {
+ if (handle->flags & UV_HANDLE_CLOSING) {
+ closesocket(handle->socket);
+ handle->socket = INVALID_SOCKET;
+ }
+ if (handle->stream.conn.shutdown_req != NULL) {
+ uv_want_endgame(loop, (uv_handle_t*)handle);
+ }
}
DECREASE_PENDING_REQ_COUNT(handle);
@@ -1215,7 +1227,14 @@ void uv_process_tcp_connect_req(uv_loop_t* loop, uv_tcp_t* handle,
UNREGISTER_HANDLE_REQ(loop, handle, req);
err = 0;
- if (REQ_SUCCESS(req)) {
+ if (handle->delayed_error) {
+ /* To smooth over the differences between unixes errors that
+ * were reported synchronously on the first connect can be delayed
+ * until the next tick--which is now.
+ */
+ err = handle->delayed_error;
+ handle->delayed_error = 0;
+ } else if (REQ_SUCCESS(req)) {
if (handle->flags & UV_HANDLE_CLOSING) {
/* use UV_ECANCELED for consistency with Unix */
err = ERROR_OPERATION_ABORTED;
@@ -1320,7 +1339,7 @@ int uv_tcp_nodelay(uv_tcp_t* handle, int enable) {
if (handle->socket != INVALID_SOCKET) {
err = uv__tcp_nodelay(handle, handle->socket, enable);
if (err)
- return err;
+ return uv_translate_sys_error(err);
}
if (enable) {
@@ -1339,7 +1358,7 @@ int uv_tcp_keepalive(uv_tcp_t* handle, int enable, unsigned int delay) {
if (handle->socket != INVALID_SOCKET) {
err = uv__tcp_keepalive(handle, handle->socket, enable, delay);
if (err)
- return err;
+ return uv_translate_sys_error(err);
}
if (enable) {
@@ -1386,9 +1405,24 @@ int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable) {
}
-static int uv_tcp_try_cancel_io(uv_tcp_t* tcp) {
- SOCKET socket = tcp->socket;
+static void uv_tcp_try_cancel_reqs(uv_tcp_t* tcp) {
+ SOCKET socket;
int non_ifs_lsp;
+ int reading;
+ int writing;
+
+ socket = tcp->socket;
+ reading = tcp->flags & UV_HANDLE_READING;
+ writing = tcp->stream.conn.write_reqs_pending > 0;
+ if (!reading && !writing)
+ return;
+
+ /* TODO: in libuv v2, keep explicit track of write_reqs, so we can cancel
+ * them each explicitly with CancelIoEx (like unix). */
+ if (reading)
+ CancelIoEx((HANDLE) socket, &tcp->read_req.u.io.overlapped);
+ if (writing)
+ CancelIo((HANDLE) socket);
/* Check if we have any non-IFS LSPs stacked on top of TCP */
non_ifs_lsp = (tcp->flags & UV_HANDLE_IPV6) ? uv_tcp_non_ifs_lsp_ipv6 :
@@ -1408,71 +1442,41 @@ static int uv_tcp_try_cancel_io(uv_tcp_t* tcp) {
NULL,
NULL) != 0) {
/* Failed. We can't do CancelIo. */
- return -1;
+ return;
}
}
assert(socket != 0 && socket != INVALID_SOCKET);
- if (!CancelIo((HANDLE) socket)) {
- return GetLastError();
+ if (socket != tcp->socket) {
+ if (reading)
+ CancelIoEx((HANDLE) socket, &tcp->read_req.u.io.overlapped);
+ if (writing)
+ CancelIo((HANDLE) socket);
}
-
- /* It worked. */
- return 0;
}
void uv_tcp_close(uv_loop_t* loop, uv_tcp_t* tcp) {
- int close_socket = 1;
-
- if (tcp->flags & UV_HANDLE_READ_PENDING) {
- /* In order for winsock to do a graceful close there must not be any any
- * pending reads, or the socket must be shut down for writing */
- if (!(tcp->flags & UV_HANDLE_SHARED_TCP_SOCKET)) {
- /* Just do shutdown on non-shared sockets, which ensures graceful close. */
- shutdown(tcp->socket, SD_SEND);
-
- } else if (uv_tcp_try_cancel_io(tcp) == 0) {
- /* In case of a shared socket, we try to cancel all outstanding I/O,. If
- * that works, don't close the socket yet - wait for the read req to
- * return and close the socket in uv_tcp_endgame. */
- close_socket = 0;
-
- } else {
- /* When cancelling isn't possible - which could happen when an LSP is
- * present on an old Windows version, we will have to close the socket
- * with a read pending. That is not nice because trailing sent bytes may
- * not make it to the other side. */
+ if (tcp->flags & UV_HANDLE_CONNECTION) {
+ uv_tcp_try_cancel_reqs(tcp);
+ if (tcp->flags & UV_HANDLE_READING) {
+ uv_read_stop((uv_stream_t*) tcp);
}
-
- } else if ((tcp->flags & UV_HANDLE_SHARED_TCP_SOCKET) &&
- tcp->tcp.serv.accept_reqs != NULL) {
- /* Under normal circumstances closesocket() will ensure that all pending
- * accept reqs are canceled. However, when the socket is shared the
- * presence of another reference to the socket in another process will keep
- * the accept reqs going, so we have to ensure that these are canceled. */
- if (uv_tcp_try_cancel_io(tcp) != 0) {
- /* When cancellation is not possible, there is another option: we can
- * close the incoming sockets, which will also cancel the accept
- * operations. However this is not cool because we might inadvertently
- * close a socket that just accepted a new connection, which will cause
- * the connection to be aborted. */
+ } else {
+ if (tcp->tcp.serv.accept_reqs != NULL) {
+ /* First close the incoming sockets to cancel the accept operations before
+ * we free their resources. */
unsigned int i;
for (i = 0; i < uv_simultaneous_server_accepts; i++) {
uv_tcp_accept_t* req = &tcp->tcp.serv.accept_reqs[i];
- if (req->accept_socket != INVALID_SOCKET &&
- !HasOverlappedIoCompleted(&req->u.io.overlapped)) {
+ if (req->accept_socket != INVALID_SOCKET) {
closesocket(req->accept_socket);
req->accept_socket = INVALID_SOCKET;
}
}
}
- }
-
- if (tcp->flags & UV_HANDLE_READING) {
- tcp->flags &= ~UV_HANDLE_READING;
- DECREASE_ACTIVE_COUNT(loop, tcp);
+ assert(!(tcp->flags & UV_HANDLE_READING));
}
if (tcp->flags & UV_HANDLE_LISTENING) {
@@ -1480,10 +1484,15 @@ void uv_tcp_close(uv_loop_t* loop, uv_tcp_t* tcp) {
DECREASE_ACTIVE_COUNT(loop, tcp);
}
- if (close_socket) {
+ /* If any overlapped req failed to cancel, calling `closesocket` now would
+ * cause Win32 to send an RST packet. Try to avoid that for writes, if
+ * possibly applicable, by waiting to process the completion notifications
+ * first (which typically should be cancellations). There's not much we can
+ * do about canceled reads, which also will generate an RST packet. */
+ if (!(tcp->flags & UV_HANDLE_CONNECTION) ||
+ tcp->stream.conn.write_reqs_pending == 0) {
closesocket(tcp->socket);
tcp->socket = INVALID_SOCKET;
- tcp->flags |= UV_HANDLE_TCP_SOCKET_CLOSED;
}
tcp->flags &= ~(UV_HANDLE_READABLE | UV_HANDLE_WRITABLE);
@@ -1571,3 +1580,118 @@ int uv__tcp_connect(uv_connect_t* req,
return 0;
}
+
+#ifndef WSA_FLAG_NO_HANDLE_INHERIT
+/* Added in Windows 7 SP1. Specify this to avoid race conditions, */
+/* but also manually clear the inherit flag in case this failed. */
+#define WSA_FLAG_NO_HANDLE_INHERIT 0x80
+#endif
+
+int uv_socketpair(int type, int protocol, uv_os_sock_t fds[2], int flags0, int flags1) {
+ SOCKET server = INVALID_SOCKET;
+ SOCKET client0 = INVALID_SOCKET;
+ SOCKET client1 = INVALID_SOCKET;
+ SOCKADDR_IN name;
+ LPFN_ACCEPTEX func_acceptex;
+ WSAOVERLAPPED overlap;
+ char accept_buffer[sizeof(struct sockaddr_storage) * 2 + 32];
+ int namelen;
+ int err;
+ DWORD bytes;
+ DWORD flags;
+ DWORD client0_flags = WSA_FLAG_NO_HANDLE_INHERIT;
+ DWORD client1_flags = WSA_FLAG_NO_HANDLE_INHERIT;
+
+ if (flags0 & UV_NONBLOCK_PIPE)
+ client0_flags |= WSA_FLAG_OVERLAPPED;
+ if (flags1 & UV_NONBLOCK_PIPE)
+ client1_flags |= WSA_FLAG_OVERLAPPED;
+
+ server = WSASocketW(AF_INET, type, protocol, NULL, 0,
+ WSA_FLAG_OVERLAPPED | WSA_FLAG_NO_HANDLE_INHERIT);
+ if (server == INVALID_SOCKET)
+ goto wsaerror;
+ if (!SetHandleInformation((HANDLE) server, HANDLE_FLAG_INHERIT, 0))
+ goto error;
+ name.sin_family = AF_INET;
+ name.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+ name.sin_port = 0;
+ if (bind(server, (SOCKADDR*) &name, sizeof(name)) != 0)
+ goto wsaerror;
+ if (listen(server, 1) != 0)
+ goto wsaerror;
+ namelen = sizeof(name);
+ if (getsockname(server, (SOCKADDR*) &name, &namelen) != 0)
+ goto wsaerror;
+ client0 = WSASocketW(AF_INET, type, protocol, NULL, 0, client0_flags);
+ if (client0 == INVALID_SOCKET)
+ goto wsaerror;
+ if (!SetHandleInformation((HANDLE) client0, HANDLE_FLAG_INHERIT, 0))
+ goto error;
+ if (connect(client0, (SOCKADDR*) &name, sizeof(name)) != 0)
+ goto wsaerror;
+ client1 = WSASocketW(AF_INET, type, protocol, NULL, 0, client1_flags);
+ if (client1 == INVALID_SOCKET)
+ goto wsaerror;
+ if (!SetHandleInformation((HANDLE) client1, HANDLE_FLAG_INHERIT, 0))
+ goto error;
+ if (!uv_get_acceptex_function(server, &func_acceptex)) {
+ err = WSAEAFNOSUPPORT;
+ goto cleanup;
+ }
+ memset(&overlap, 0, sizeof(overlap));
+ if (!func_acceptex(server,
+ client1,
+ accept_buffer,
+ 0,
+ sizeof(struct sockaddr_storage),
+ sizeof(struct sockaddr_storage),
+ &bytes,
+ &overlap)) {
+ err = WSAGetLastError();
+ if (err == ERROR_IO_PENDING) {
+ /* Result should complete immediately, since we already called connect,
+ * but emperically, we sometimes have to poll the kernel a couple times
+ * until it notices that. */
+ while (!WSAGetOverlappedResult(client1, &overlap, &bytes, FALSE, &flags)) {
+ err = WSAGetLastError();
+ if (err != WSA_IO_INCOMPLETE)
+ goto cleanup;
+ SwitchToThread();
+ }
+ }
+ else {
+ goto cleanup;
+ }
+ }
+ if (setsockopt(client1, SOL_SOCKET, SO_UPDATE_ACCEPT_CONTEXT,
+ (char*) &server, sizeof(server)) != 0) {
+ goto wsaerror;
+ }
+
+ closesocket(server);
+
+ fds[0] = client0;
+ fds[1] = client1;
+
+ return 0;
+
+ wsaerror:
+ err = WSAGetLastError();
+ goto cleanup;
+
+ error:
+ err = GetLastError();
+ goto cleanup;
+
+ cleanup:
+ if (server != INVALID_SOCKET)
+ closesocket(server);
+ if (client0 != INVALID_SOCKET)
+ closesocket(client0);
+ if (client1 != INVALID_SOCKET)
+ closesocket(client1);
+
+ assert(err);
+ return uv_translate_sys_error(err);
+}
diff --git a/Utilities/cmlibuv/src/win/udp.c b/Utilities/cmlibuv/src/win/udp.c
index 68ca728aa5..3043f2da88 100644
--- a/Utilities/cmlibuv/src/win/udp.c
+++ b/Utilities/cmlibuv/src/win/udp.c
@@ -284,7 +284,7 @@ static void uv_udp_queue_recv(uv_loop_t* loop, uv_udp_t* handle) {
handle->flags &= ~UV_HANDLE_ZERO_READ;
handle->recv_buffer = uv_buf_init(NULL, 0);
- handle->alloc_cb((uv_handle_t*) handle, 65536, &handle->recv_buffer);
+ handle->alloc_cb((uv_handle_t*) handle, UV__UDP_DGRAM_MAXSIZE, &handle->recv_buffer);
if (handle->recv_buffer.base == NULL || handle->recv_buffer.len == 0) {
handle->recv_cb(handle, UV_ENOBUFS, &handle->recv_buffer, NULL, 0);
return;
@@ -501,7 +501,7 @@ void uv_process_udp_recv_req(uv_loop_t* loop, uv_udp_t* handle,
/* Do a nonblocking receive.
* TODO: try to read multiple datagrams at once. FIONREAD maybe? */
buf = uv_buf_init(NULL, 0);
- handle->alloc_cb((uv_handle_t*) handle, 65536, &buf);
+ handle->alloc_cb((uv_handle_t*) handle, UV__UDP_DGRAM_MAXSIZE, &buf);
if (buf.base == NULL || buf.len == 0) {
handle->recv_cb(handle, UV_ENOBUFS, &buf, NULL, 0);
goto done;
diff --git a/Utilities/cmlibuv/src/win/util.c b/Utilities/cmlibuv/src/win/util.c
index aad8f1a15e..33e874ac44 100644
--- a/Utilities/cmlibuv/src/win/util.c
+++ b/Utilities/cmlibuv/src/win/util.c
@@ -1664,26 +1664,36 @@ int uv_os_unsetenv(const char* name) {
int uv_os_gethostname(char* buffer, size_t* size) {
- char buf[UV_MAXHOSTNAMESIZE];
+ WCHAR buf[UV_MAXHOSTNAMESIZE];
size_t len;
+ char* utf8_str;
+ int convert_result;
if (buffer == NULL || size == NULL || *size == 0)
return UV_EINVAL;
uv__once_init(); /* Initialize winsock */
- if (gethostname(buf, sizeof(buf)) != 0)
+ if (pGetHostNameW == NULL)
+ return UV_ENOSYS;
+
+ if (pGetHostNameW(buf, UV_MAXHOSTNAMESIZE) != 0)
return uv_translate_sys_error(WSAGetLastError());
- buf[sizeof(buf) - 1] = '\0'; /* Null terminate, just to be safe. */
- len = strlen(buf);
+ convert_result = uv__convert_utf16_to_utf8(buf, -1, &utf8_str);
+
+ if (convert_result != 0)
+ return convert_result;
+ len = strlen(utf8_str);
if (len >= *size) {
*size = len + 1;
+ uv__free(utf8_str);
return UV_ENOBUFS;
}
- memcpy(buffer, buf, len + 1);
+ memcpy(buffer, utf8_str, len + 1);
+ uv__free(utf8_str);
*size = len;
return 0;
}
diff --git a/Utilities/cmlibuv/src/win/winapi.c b/Utilities/cmlibuv/src/win/winapi.c
index bb86ec8cea..bf306cd83b 100644
--- a/Utilities/cmlibuv/src/win/winapi.c
+++ b/Utilities/cmlibuv/src/win/winapi.c
@@ -45,12 +45,15 @@ sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification;
/* User32.dll function pointer */
sSetWinEventHook pSetWinEventHook;
+/* ws2_32.dll function pointer */
+uv_sGetHostNameW pGetHostNameW;
void uv_winapi_init(void) {
HMODULE ntdll_module;
HMODULE powrprof_module;
HMODULE user32_module;
HMODULE kernel32_module;
+ HMODULE ws2_32_module;
ntdll_module = GetModuleHandleA("ntdll.dll");
if (ntdll_module == NULL) {
@@ -134,4 +137,11 @@ void uv_winapi_init(void) {
pSetWinEventHook = (sSetWinEventHook)
GetProcAddress(user32_module, "SetWinEventHook");
}
+
+ ws2_32_module = LoadLibraryA("ws2_32.dll");
+ if (ws2_32_module != NULL) {
+ pGetHostNameW = (uv_sGetHostNameW) GetProcAddress(
+ ws2_32_module,
+ "GetHostNameW");
+ }
}
diff --git a/Utilities/cmlibuv/src/win/winapi.h b/Utilities/cmlibuv/src/win/winapi.h
index 9bc455934a..e815f8f95e 100644
--- a/Utilities/cmlibuv/src/win/winapi.h
+++ b/Utilities/cmlibuv/src/win/winapi.h
@@ -4768,4 +4768,11 @@ extern sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotifi
/* User32.dll function pointer */
extern sSetWinEventHook pSetWinEventHook;
+/* ws2_32.dll function pointer */
+/* mingw doesn't have this definition, so let's declare it here locally */
+typedef int (WINAPI *uv_sGetHostNameW)
+ (PWSTR,
+ int);
+extern uv_sGetHostNameW pGetHostNameW;
+
#endif /* UV_WIN_WINAPI_H_ */
diff --git a/Utilities/cmnghttp2/CMakeLists.txt b/Utilities/cmnghttp2/CMakeLists.txt
index 3bc2778ea9..8b5e8338f8 100644
--- a/Utilities/cmnghttp2/CMakeLists.txt
+++ b/Utilities/cmnghttp2/CMakeLists.txt
@@ -1,6 +1,6 @@
# Disable warnings to avoid changing 3rd party code.
if(CMAKE_C_COMPILER_ID MATCHES
- "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
+ "^(GNU|LCC|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
diff --git a/Utilities/cmzlib/CMakeLists.txt b/Utilities/cmzlib/CMakeLists.txt
index d57cb29a4a..9e10daf13d 100644
--- a/Utilities/cmzlib/CMakeLists.txt
+++ b/Utilities/cmzlib/CMakeLists.txt
@@ -2,7 +2,7 @@ PROJECT(CMZLIB)
# Disable warnings to avoid changing 3rd party code.
if(CMAKE_C_COMPILER_ID MATCHES
- "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
+ "^(GNU|LCC|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
diff --git a/Utilities/cmzstd/CMakeLists.txt b/Utilities/cmzstd/CMakeLists.txt
index 199719553b..1ba263ac72 100644
--- a/Utilities/cmzstd/CMakeLists.txt
+++ b/Utilities/cmzstd/CMakeLists.txt
@@ -2,7 +2,7 @@ project(zstd C)
# Disable warnings to avoid changing 3rd party code.
if(CMAKE_C_COMPILER_ID MATCHES
- "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
+ "^(GNU|LCC|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
diff --git a/bootstrap b/bootstrap
index a487375aec..61dd3ddcf9 100755
--- a/bootstrap
+++ b/bootstrap
@@ -341,6 +341,7 @@ CMAKE_CXX_SOURCES="\
cmFileCommand \
cmFileCopier \
cmFileInstaller \
+ cmFileSet \
cmFileTime \
cmFileTimeCache \
cmFileTimes \
@@ -386,6 +387,7 @@ CMAKE_CXX_SOURCES="\
cmInstallCommandArguments \
cmInstallDirectoryGenerator \
cmInstallExportGenerator \
+ cmInstallFileSetGenerator \
cmInstallFilesCommand \
cmInstallFilesGenerator \
cmInstallGenerator \
@@ -623,6 +625,7 @@ else
src/unix/process.c \
src/unix/signal.c \
src/unix/stream.c \
+ src/unix/tcp.c \
"
fi