summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml83
-rw-r--r--.gitlab/ci/configure_macos_arm64_ninja.cmake (renamed from .gitlab/ci/configure_macos_ninja.cmake)0
-rw-r--r--.gitlab/ci/configure_macos_arm64_xcode.cmake (renamed from .gitlab/ci/configure_macos_xcode.cmake)0
-rw-r--r--.gitlab/ci/configure_macos_x86_64_makefiles.cmake (renamed from .gitlab/ci/configure_macos_makefiles.cmake)0
-rw-r--r--.gitlab/ci/configure_macos_x86_64_ninja.cmake3
-rw-r--r--.gitlab/ci/configure_macos_x86_64_xcode.cmake2
-rw-r--r--.gitlab/ci/download_qt.cmake82
-rwxr-xr-x.gitlab/ci/sccache.sh17
-rw-r--r--.gitlab/os-macos.yml56
-rw-r--r--Help/cpack_gen/deb.rst2
-rw-r--r--Help/cpack_gen/nsis.rst6
-rw-r--r--Help/manual/cmake-compile-features.7.rst2
-rw-r--r--Help/manual/cmake-generator-expressions.7.rst23
-rw-r--r--Help/manual/cmake-policies.7.rst8
-rw-r--r--Help/manual/cmake-presets.7.rst22
-rw-r--r--Help/manual/cmake.1.rst4
-rw-r--r--Help/manual/ctest.1.rst2
-rw-r--r--Help/manual/presets/example.json18
-rw-r--r--Help/policy/CMP0116.rst5
-rw-r--r--Help/policy/CMP0121.rst21
-rw-r--r--Help/prop_gbl/CMAKE_C_KNOWN_FEATURES.rst6
-rw-r--r--Help/prop_tgt/C_STANDARD.rst2
-rw-r--r--Help/release/3.19.rst9
-rw-r--r--Help/release/dev/c-std.rst6
-rw-r--r--Help/release/dev/cpack-nsis-executable-name.rst6
-rw-r--r--Help/release/dev/list-index-arg-parsing.rst7
-rw-r--r--Help/release/dev/runtime-dll-deps.rst4
-rw-r--r--Modules/CMakeCCompiler.cmake.in2
-rw-r--r--Modules/CMakeCCompilerId.c.in9
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake10
-rw-r--r--Modules/CMakeDetermineCompileFeatures.cmake12
-rw-r--r--Modules/Compiler/CMakeCommonCompilerMacros.cmake6
-rw-r--r--Modules/Compiler/Clang-C.cmake59
-rw-r--r--Modules/Compiler/Clang-CUDA.cmake4
-rw-r--r--Modules/Compiler/GNU-C.cmake12
-rw-r--r--Modules/Compiler/Intel-Fortran.cmake12
-rw-r--r--Modules/Compiler/IntelLLVM-C.cmake10
-rw-r--r--Modules/Compiler/IntelLLVM-Fortran.cmake12
-rw-r--r--Modules/Compiler/NAG-Fortran.cmake1
-rw-r--r--Modules/Compiler/PGI-CXX.cmake2
-rw-r--r--Modules/ExternalProject.cmake26
-rw-r--r--Modules/ExternalProject/gitclone.cmake.in3
-rw-r--r--Modules/ExternalProject/hgclone.cmake.in3
-rw-r--r--Modules/FortranCInterface/Detect.cmake19
-rw-r--r--Modules/GoogleTest.cmake3
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx11
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx4
-rw-r--r--Source/QtDialog/EnvironmentDialog.cxx6
-rw-r--r--Source/QtDialog/QCMakeCacheView.cxx4
-rw-r--r--Source/cmAddCustomCommandCommand.cxx14
-rw-r--r--Source/cmAddCustomTargetCommand.cxx5
-rw-r--r--Source/cmCMakePresetsFile.cxx1
-rw-r--r--Source/cmCPluginAPI.cxx12
-rw-r--r--Source/cmCTest.cxx10
-rw-r--r--Source/cmComputeLinkInformation.cxx19
-rw-r--r--Source/cmComputeLinkInformation.h6
-rw-r--r--Source/cmCreateTestSourceList.cxx11
-rw-r--r--Source/cmCustomCommand.cxx10
-rw-r--r--Source/cmCustomCommand.h6
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx3
-rw-r--r--Source/cmFLTKWrapUICommand.cxx7
-rw-r--r--Source/cmGeneratorExpressionNode.cxx55
-rw-r--r--Source/cmGeneratorTarget.cxx20
-rw-r--r--Source/cmGeneratorTarget.h5
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx19
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx21
-rw-r--r--Source/cmListCommand.cxx68
-rw-r--r--Source/cmLocalGenerator.cxx80
-rw-r--r--Source/cmLocalGenerator.h56
-rw-r--r--Source/cmLocalNinjaGenerator.cxx10
-rw-r--r--Source/cmLocalNinjaGenerator.h6
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx9
-rw-r--r--Source/cmMakefile.cxx52
-rw-r--r--Source/cmMakefile.h34
-rw-r--r--Source/cmMakefileTargetGenerator.cxx6
-rw-r--r--Source/cmNinjaTargetGenerator.cxx14
-rw-r--r--Source/cmPolicies.h5
-rw-r--r--Source/cmQTWrapCPPCommand.cxx7
-rw-r--r--Source/cmQTWrapUICommand.cxx10
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.cxx4
-rw-r--r--Source/cmQtAutoGenInitializer.cxx74
-rw-r--r--Source/cmQtAutoGenInitializer.h2
-rw-r--r--Source/cmQtAutoMocUic.cxx4
-rw-r--r--Source/cmStandardLevelResolver.cxx5
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx18
-rw-r--r--Source/cmake.cxx2
-rw-r--r--Source/cmake.h2
-rw-r--r--Source/cmakemain.cxx5
-rw-r--r--Source/cmcmd.cxx1
-rw-r--r--Source/ctest.cxx3
-rw-r--r--Tests/BundleTest/BundleLib.cxx4
-rw-r--r--Tests/BundleTest/BundleSubDir/CMakeLists.txt8
-rw-r--r--Tests/BundleTest/CMakeLists.txt17
-rw-r--r--Tests/BundleUtilities/CMakeLists.txt9
-rw-r--r--Tests/CMakeLists.txt2
-rw-r--r--Tests/CompileFeatures/CMakeLists.txt2
-rw-r--r--Tests/CompileFeatures/default_dialect.c10
-rw-r--r--Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt102
-rw-r--r--Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in11
-rw-r--r--Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/main.cpp9
-rw-r--r--Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/mainwindow.ui.in7
-rw-r--r--Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/mocwidget.h5
-rw-r--r--Tests/QtAutogen/Tests.cmake1
-rw-r--r--Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt17
-rw-r--r--Tests/RunCMake/CMP0116/CMP0116-Mixed.cmake18
-rw-r--r--Tests/RunCMake/CMP0116/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-ERANGE-Common.cmake8
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW-result.txt1
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW-stderr.txt8
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW.cmake2
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD-result.txt1
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD-stderr.txt8
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD.cmake2
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN-stderr.txt18
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN.cmake2
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-GET-Common.cmake4
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-GET-NEW-result.txt1
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-GET-NEW-stderr.txt8
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-GET-NEW.cmake2
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-GET-OLD-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-GET-OLD.cmake2
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-GET-WARN-stderr.txt11
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-GET-WARN.cmake2
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-INSERT-Common.cmake4
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW-result.txt1
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW-stderr.txt8
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW.cmake2
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-INSERT-OLD-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-INSERT-OLD.cmake2
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-INSERT-WARN-stderr.txt11
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-INSERT-WARN.cmake2
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-Common.cmake4
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW-result.txt1
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW-stderr.txt8
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW.cmake2
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-OLD-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-OLD.cmake2
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-WARN-stderr.txt11
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-WARN.cmake2
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-Common.cmake4
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW-result.txt1
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW-stderr.txt8
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW.cmake2
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-OLD-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-OLD.cmake2
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-WARN-stderr.txt11
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-WARN.cmake2
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-Common.cmake4
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW-result.txt1
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW-stderr.txt8
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW.cmake2
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-OLD-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-OLD.cmake2
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-WARN-stderr.txt11
-rw-r--r--Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-WARN.cmake2
-rw-r--r--Tests/RunCMake/CMP0121/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0121/RunCMakeTest.cmake7
-rw-r--r--Tests/RunCMake/CMakeLists.txt11
-rw-r--r--Tests/RunCMake/CMakePresets/CMakePresets.json.in12
-rw-r--r--Tests/RunCMake/CMakePresets/Comment-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresets/Comment-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresets/Comment.json.in11
-rw-r--r--Tests/RunCMake/CMakePresets/GoodSpaces-stdout.txt3
-rw-r--r--Tests/RunCMake/CMakePresets/GoodSpacesEq-stdout.txt3
-rw-r--r--Tests/RunCMake/CMakePresets/GoodSpacesEq.cmake0
-rw-r--r--Tests/RunCMake/CMakePresets/NoPresetArgumentEq-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresets/NoPresetArgumentEq-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresets/RunCMakeTest.cmake7
-rw-r--r--Tests/RunCMake/CMakePresets/validate_schema.py3
-rw-r--r--Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/CMakePresetsTest/Good.json.in9
-rw-r--r--Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/ExternalProject/CONFIGURE_HANDLED_BY_BUILD.cmake4
-rw-r--r--Tests/RunCMake/FetchContent/RunCMakeTest.cmake30
-rw-r--r--Tests/RunCMake/FetchContent/TimeStamps-stdout.txt2
-rw-r--r--Tests/RunCMake/FetchContent/TimeStamps.cmake14
-rw-r--r--Tests/RunCMake/FetchContent/TimeStampsRerun-check.cmake38
-rw-r--r--Tests/RunCMake/FetchContent/TimeStampsRerun.cmake1
-rw-r--r--Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt4
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/RunCMakeTest.cmake7
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-check.cmake15
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static-result.txt1
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static-stderr.txt9
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static.cmake9
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1-result.txt1
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1-stderr.txt5
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1.cmake4
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2-result.txt1
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2-stderr.txt5
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2.cmake6
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries.cmake5
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS.cmake37
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib1.c12
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib2.c6
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib3.c6
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/main.c4
-rw-r--r--Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/static.c3
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTest.cmake8
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTestDiscoveryMultiConfig.cmake5
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTestDiscoveryTimeout.cmake5
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTestXML.cmake5
-rw-r--r--Tests/RunCMake/GoogleTest/xcode_sign_adhoc.cmake8
-rw-r--r--Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake1
-rw-r--r--Tests/RunCMake/Ninja/QtSubDir3/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt4
-rw-r--r--Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake6
-rw-r--r--Tests/RunCMake/PrecompileHeaders/CXXnotC.cmake15
-rw-r--r--Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/PrecompileHeaders/include/cxx_pch.h1
-rw-r--r--Tests/RunCMake/PrecompileHeaders/no_pch.c7
-rw-r--r--Tests/RunCMake/PrecompileHeaders/use_pch.cxx9
-rw-r--r--Tests/RunCMake/RunCMake.cmake6
-rw-r--r--Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt4
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/func.cxx17
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex.cmake9
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/main.c12
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake4
223 files changed, 1783 insertions, 442 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 672df5a..8e76e41 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -236,62 +236,99 @@ upload:linux-aarch64-package:
# macOS builds
-build:macos-ninja:
+build:macos-x86_64-ninja:
extends:
- - .macos_ninja
+ - .macos_x86_64_ninja
- .cmake_build_macos
- .cmake_build_artifacts
- - .macos_builder_tags
+ - .macos_x86_64_builder_tags
- .run_manually
-test:macos-ninja:
+build:macos-arm64-ninja:
extends:
- - .macos_ninja
+ - .macos_arm64_ninja
+ - .cmake_build_macos
+ - .cmake_build_artifacts
+ - .macos_arm64_builder_tags
+ - .run_manually
+ variables:
+ CMAKE_CI_NO_MR: "true"
+
+test:macos-x86_64-ninja:
+ extends:
+ - .macos_x86_64_ninja
+ - .cmake_test_macos
+ - .cmake_test_artifacts
+ - .macos_x86_64_builder_tags
+ - .run_dependent
+ dependencies:
+ - build:macos-x86_64-ninja
+ needs:
+ - build:macos-x86_64-ninja
+
+test:macos-arm64-ninja:
+ extends:
+ - .macos_arm64_ninja
- .cmake_test_macos
- .cmake_test_artifacts
- - .macos_builder_tags
+ - .macos_arm64_builder_tags
- .run_dependent
dependencies:
- - build:macos-ninja
+ - build:macos-arm64-ninja
needs:
- - build:macos-ninja
+ - build:macos-arm64-ninja
+ variables:
+ CMAKE_CI_NO_MR: "true"
-build:macos-makefiles:
+build:macos-x86_64-makefiles:
extends:
- - .macos_makefiles
+ - .macos_x86_64_makefiles
- .cmake_build_macos
- .cmake_build_artifacts
- - .macos_builder_tags
+ - .macos_x86_64_builder_tags
- .run_manually
-test:macos-makefiles:
+test:macos-x86_64-makefiles:
extends:
- - .macos_makefiles
+ - .macos_x86_64_makefiles
- .cmake_test_macos
- - .macos_builder_tags
+ - .macos_x86_64_builder_tags
+ - .run_dependent
+ dependencies:
+ - build:macos-x86_64-makefiles
+ needs:
+ - build:macos-x86_64-makefiles
+
+test:macos-x86_64-xcode:
+ extends:
+ - .macos_x86_64_xcode
+ - .cmake_test_macos_external
+ - .macos_x86_64_builder_ext_tags
- .run_dependent
dependencies:
- - build:macos-makefiles
+ - test:macos-x86_64-ninja
needs:
- - build:macos-makefiles
+ - test:macos-x86_64-ninja
-test:macos-xcode:
+test:macos-arm64-xcode:
extends:
- - .macos_xcode
+ - .macos_arm64_xcode
- .cmake_test_macos_external
- - .macos_builder_ext_tags
+ - .macos_arm64_builder_ext_tags
- .run_dependent
dependencies:
- - test:macos-ninja
+ - test:macos-arm64-ninja
needs:
- - test:macos-ninja
+ - test:macos-arm64-ninja
+ variables:
+ CMAKE_CI_NO_MR: "true"
build:macos-package:
extends:
- .macos_package
- .cmake_build_macos_package
- .cmake_release_artifacts
- - .macos_builder_tags_package
+ - .macos_x86_64_builder_tags_package
- .run_only_for_package
dependencies:
- prep:doc-package
@@ -314,7 +351,7 @@ build:macos10.10-package:
- .macos10.10_package
- .cmake_build_macos_package
- .cmake_release_artifacts
- - .macos_builder_tags_package
+ - .macos_x86_64_builder_tags_package
- .run_only_for_package
dependencies:
- prep:doc-package
diff --git a/.gitlab/ci/configure_macos_ninja.cmake b/.gitlab/ci/configure_macos_arm64_ninja.cmake
index f657d98..f657d98 100644
--- a/.gitlab/ci/configure_macos_ninja.cmake
+++ b/.gitlab/ci/configure_macos_arm64_ninja.cmake
diff --git a/.gitlab/ci/configure_macos_xcode.cmake b/.gitlab/ci/configure_macos_arm64_xcode.cmake
index 1b976d2..1b976d2 100644
--- a/.gitlab/ci/configure_macos_xcode.cmake
+++ b/.gitlab/ci/configure_macos_arm64_xcode.cmake
diff --git a/.gitlab/ci/configure_macos_makefiles.cmake b/.gitlab/ci/configure_macos_x86_64_makefiles.cmake
index f657d98..f657d98 100644
--- a/.gitlab/ci/configure_macos_makefiles.cmake
+++ b/.gitlab/ci/configure_macos_x86_64_makefiles.cmake
diff --git a/.gitlab/ci/configure_macos_x86_64_ninja.cmake b/.gitlab/ci/configure_macos_x86_64_ninja.cmake
new file mode 100644
index 0000000..f657d98
--- /dev/null
+++ b/.gitlab/ci/configure_macos_x86_64_ninja.cmake
@@ -0,0 +1,3 @@
+set(CMake_TEST_GUI "ON" CACHE BOOL "")
+include("${CMAKE_CURRENT_LIST_DIR}/configure_macos_common.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake")
diff --git a/.gitlab/ci/configure_macos_x86_64_xcode.cmake b/.gitlab/ci/configure_macos_x86_64_xcode.cmake
new file mode 100644
index 0000000..1b976d2
--- /dev/null
+++ b/.gitlab/ci/configure_macos_x86_64_xcode.cmake
@@ -0,0 +1,2 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_macos_common.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/download_qt.cmake b/.gitlab/ci/download_qt.cmake
index 76c693d..3990430 100644
--- a/.gitlab/ci/download_qt.cmake
+++ b/.gitlab/ci/download_qt.cmake
@@ -4,31 +4,6 @@ cmake_minimum_required(VERSION 3.12)
set(qt_version_major "5")
set(qt_version_minor "15")
set(qt_version_patch "1")
-# This URL is only visible inside of Kitware's network. Please use your own Qt
-# Account to obtain these files.
-if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "package")
- set(qt_url_root "https://cmake.org/files/dependencies")
-else ()
- set(qt_url_root "https://paraview.org/files/dependencies/internal/qt")
-endif ()
-
-# Determine the ABI to fetch for Qt.
-if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "vs2015")
- set(qt_platform "windows_x86")
- set(msvc_year "2015")
- set(qt_abi "win64_msvc${msvc_year}_64")
-elseif ("$ENV{CMAKE_CONFIGURATION}" MATCHES "vs2017" OR
- "$ENV{CMAKE_CONFIGURATION}" MATCHES "vs2019")
- set(qt_platform "windows_x86")
- set(msvc_year "2019")
- set(qt_abi "win64_msvc${msvc_year}_64")
-elseif ("$ENV{CMAKE_CONFIGURATION}" MATCHES "macos")
- set(qt_platform "mac_x64")
- set(qt_abi "clang_64")
-else ()
- message(FATAL_ERROR
- "Unknown ABI to use for Qt")
-endif ()
# Combined version variables.
set(qt_version "${qt_version_major}.${qt_version_minor}.${qt_version_patch}")
@@ -36,7 +11,21 @@ set(qt_version_nodot "${qt_version_major}${qt_version_minor}${qt_version_patch}"
# Files needed to download.
set(qt_files)
-if (qt_platform STREQUAL "windows_x86")
+if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "windows")
+ # Determine the ABI to fetch for Qt.
+ if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "vs2015")
+ set(qt_platform "windows_x86")
+ set(msvc_year "2015")
+ set(qt_abi "win64_msvc${msvc_year}_64")
+ elseif ("$ENV{CMAKE_CONFIGURATION}" MATCHES "vs2017" OR
+ "$ENV{CMAKE_CONFIGURATION}" MATCHES "vs2019")
+ set(qt_platform "windows_x86")
+ set(msvc_year "2019")
+ set(qt_abi "win64_msvc${msvc_year}_64")
+ else ()
+ message(FATAL_ERROR "Unknown ABI to use for Qt")
+ endif ()
+
set(qt_build_stamp "202009071110")
set(qt_file_name_prefix "${qt_version}-0-${qt_build_stamp}")
@@ -47,29 +36,23 @@ if (qt_platform STREQUAL "windows_x86")
endforeach ()
set(qt_subdir "${qt_version}/msvc${msvc_year}_64")
-elseif (qt_platform STREQUAL "mac_x64")
- if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "macos_package")
- list(APPEND qt_files
- "qt-5.15.2-macosx10.13-x86_64-arm64.tar.xz")
- set(qt_subdir "qt-5.15.2-macosx10.13-x86_64-arm64")
- elseif ("$ENV{CMAKE_CONFIGURATION}" MATCHES "macos10.10_package")
- list(APPEND qt_files
- "qt-5.9.9-macosx10.10-x86_64-arm64.tar.xz")
+
+ # This URL is only visible inside of Kitware's network.
+ # Please use your own Qt Account to obtain these files.
+ set(qt_url_root "https://paraview.org/files/dependencies/internal/qt")
+ set(qt_url_path "${qt_platform}/desktop/qt5_${qt_version_nodot}/qt.qt5.${qt_version_nodot}.${qt_abi}")
+elseif ("$ENV{CMAKE_CONFIGURATION}" MATCHES "macos")
+ if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "macos10.10_package")
+ list(APPEND qt_files "qt-5.9.9-macosx10.10-x86_64-arm64.tar.xz")
set(qt_subdir "qt-5.9.9-macosx10.10-x86_64-arm64")
else ()
- set(qt_build_stamp "202009071110")
- set(qt_file_name_prefix "${qt_version}-0-${qt_build_stamp}")
-
- foreach (qt_component IN ITEMS qtbase)
- list(APPEND qt_files
- "${qt_file_name_prefix}${qt_component}-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z")
- endforeach ()
-
- set(qt_subdir "${qt_version}/clang_64")
- endif ()
-else ()
- message(FATAL_ERROR
- "Unknown files for ${qt_platform}")
+ list(APPEND qt_files "qt-5.15.2-macosx10.13-x86_64-arm64.tar.xz")
+ set(qt_subdir "qt-5.15.2-macosx10.13-x86_64-arm64")
+ endif()
+ set(qt_url_root "https://cmake.org/files/dependencies")
+ set(qt_url_path "")
+else()
+ message(FATAL_ERROR "Unknown OS to use for Qt")
endif ()
# Verify that we know what directory will be extracted.
@@ -79,11 +62,6 @@ if (NOT qt_subdir)
endif ()
# Build up the path to the file to download.
-if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "package")
- set(qt_url_path "")
-else ()
- set(qt_url_path "${qt_platform}/desktop/qt5_${qt_version_nodot}/qt.qt5.${qt_version_nodot}.${qt_abi}")
-endif ()
set(qt_url_prefix "${qt_url_root}/${qt_url_path}")
# Include the file containing the hashes of the files that matter.
diff --git a/.gitlab/ci/sccache.sh b/.gitlab/ci/sccache.sh
index 77bedaa..12b8f9d 100755
--- a/.gitlab/ci/sccache.sh
+++ b/.gitlab/ci/sccache.sh
@@ -5,17 +5,16 @@ set -e
readonly kernel="$(uname -s)-$(uname -m)"
case $kernel in
Linux-x86_64)
- version="0.2.13"
+ version="v0.2.15"
shatool="sha256sum"
- sha256sum="28a5499e340865b08b632306b435913beb590fbd7b49a3f887a623b459fabdeb"
+ sha256sum="e5d03a9aa3b9fac7e490391bbe22d4f42c840d31ef9eaf127a03101930cbb7ca"
platform="x86_64-unknown-linux-musl"
;;
Linux-aarch64)
- version="g6628e1f"
+ version="v0.2.15"
shatool="sha256sum"
- sha256sum="bb88adbb5a29c166ecaa78d0593493b609a7f84d91d1228502a908f319b513f0"
+ sha256sum="90d91d21a767e3f558196dbd52395f6475c08de5c4951a4c8049575fa6894489"
platform="aarch64-unknown-linux-musl"
- url="https://github.com/hwinit/sccache/releases/download/$version"
;;
Darwin-x86_64)
version="gfe63078"
@@ -24,6 +23,13 @@ case $kernel in
platform="x86_64-apple-darwin"
url="https://paraview.org/files/dependencies"
;;
+ Darwin-arm64)
+ version="0.2.15-1-disk_cache_init"
+ shatool="shasum -a 256"
+ sha256sum="f7c9ff78e701810b8b1dbc2a163c7fda1177fc3f69c71f46e7a38242657a99fd"
+ platform="aarch64-apple-darwin"
+ url="https://cmake.org/files/dependencies/sccache"
+ ;;
*)
echo "Unrecognized platform $kernel"
exit 1
@@ -49,3 +55,4 @@ curl -OL "$url/$tarball"
$shatool --check sccache.sha256sum
tar xf "$tarball"
mv "$filename/sccache" .
+chmod +x sccache
diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml
index 450bae7..810fdca 100644
--- a/.gitlab/os-macos.yml
+++ b/.gitlab/os-macos.yml
@@ -7,7 +7,7 @@
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci ext/$CI_CONCURRENT_ID"
# TODO: Factor this out so that each job selects the Xcode version to
# use so that different versions can be tested in a single pipeline.
- DEVELOPER_DIR: "/Applications/Xcode-12.3.app/Contents/Developer"
+ DEVELOPER_DIR: "/Applications/Xcode-12.4.app/Contents/Developer"
# Avoid conflicting with other projects running on the same machine.
SCCACHE_SERVER_PORT: 4227
@@ -24,18 +24,25 @@
# could run at the same time, so we drop it.
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
-.macos_ninja:
+.macos_x86_64_ninja:
extends: .macos_build
variables:
- CMAKE_CONFIGURATION: macos_ninja
+ CMAKE_CONFIGURATION: macos_x86_64_ninja
CTEST_NO_WARNINGS_ALLOWED: 1
-.macos_makefiles:
+.macos_arm64_ninja:
extends: .macos_build
variables:
- CMAKE_CONFIGURATION: macos_makefiles
+ CMAKE_CONFIGURATION: macos_arm64_ninja
+ CTEST_NO_WARNINGS_ALLOWED: 1
+
+.macos_x86_64_makefiles:
+ extends: .macos_build
+
+ variables:
+ CMAKE_CONFIGURATION: macos_x86_64_makefiles
CTEST_NO_WARNINGS_ALLOWED: 1
CMAKE_GENERATOR: "Unix Makefiles"
@@ -57,38 +64,61 @@
### External testing
-.macos_xcode:
+.macos_x86_64_xcode:
+ extends: .macos
+
+ variables:
+ CMAKE_CONFIGURATION: macos_x86_64_xcode
+ CMAKE_GENERATOR: Xcode
+
+.macos_arm64_xcode:
extends: .macos
variables:
- CMAKE_CONFIGURATION: macos_xcode
+ CMAKE_CONFIGURATION: macos_arm64_xcode
CMAKE_GENERATOR: Xcode
## Tags
-.macos_builder_tags:
+.macos_x86_64_builder_tags:
tags:
- cmake # Since this is a bare runner, pin to a project.
- macos
- shell
- - xcode-12.3
+ - xcode-12.4
- nonconcurrent
-.macos_builder_tags_package:
+.macos_x86_64_builder_tags_package:
tags:
- cmake # Since this is a bare runner, pin to a project.
- macos
- shell
- - xcode-12.3
+ - xcode-12.4
- nonconcurrent
- finder
-.macos_builder_ext_tags:
+.macos_x86_64_builder_ext_tags:
tags:
- cmake # Since this is a bare runner, pin to a project.
- macos
- shell
- - xcode-12.3
+ - xcode-12.4
+ - concurrent
+
+.macos_arm64_builder_tags:
+ tags:
+ - cmake # Since this is a bare runner, pin to a project.
+ - macos-arm64
+ - shell
+ - xcode-12.4
+ - nonconcurrent
+
+.macos_arm64_builder_ext_tags:
+ tags:
+ - cmake # Since this is a bare runner, pin to a project.
+ - macos-arm64
+ - shell
+ - xcode-12.4
- concurrent
## macOS-specific scripts
diff --git a/Help/cpack_gen/deb.rst b/Help/cpack_gen/deb.rst
index 42b8392..03c4ea8 100644
--- a/Help/cpack_gen/deb.rst
+++ b/Help/cpack_gen/deb.rst
@@ -347,7 +347,7 @@ List of CPack DEB generator specific variables:
.. versionadded:: 3.20
May be set to a list of directories that will be given to ``dpkg-shlibdeps``
- via its ``-d`` option. These will be searched by ``dpkg-shlibdeps`` in order
+ via its ``-l`` option. These will be searched by ``dpkg-shlibdeps`` in order
to find private shared library dependencies.
* Mandatory : NO
diff --git a/Help/cpack_gen/nsis.rst b/Help/cpack_gen/nsis.rst
index eaef8ae..964f629 100644
--- a/Help/cpack_gen/nsis.rst
+++ b/Help/cpack_gen/nsis.rst
@@ -193,3 +193,9 @@ on Windows Nullsoft Scriptable Install System.
.. versionadded:: 3.20
If set, trim down the size of the control to the size of the branding text string.
+
+.. variable:: CPACK_NSIS_EXECUTABLE
+
+ .. versionadded:: 3.21
+
+ If set, specify the name of the NSIS executable. Default is ``makensis``.
diff --git a/Help/manual/cmake-compile-features.7.rst b/Help/manual/cmake-compile-features.7.rst
index 96ed5a7..0d15ddf 100644
--- a/Help/manual/cmake-compile-features.7.rst
+++ b/Help/manual/cmake-compile-features.7.rst
@@ -360,6 +360,7 @@ versions specified for each:
* ``Cray``: Cray Compiler Environment version 8.1+.
* ``PGI``: PGI version 12.10+.
+* ``NVHPC``: NVIDIA HPC compilers version 11.0+.
* ``TI``: Texas Instruments compiler.
* ``XL``: IBM XL version 10.1+.
@@ -375,4 +376,5 @@ their associated meta-features (e.g. ``cuda_std_11``) available from the
following :variable:`compiler ids <CMAKE_<LANG>_COMPILER_ID>` as of the
versions specified for each:
+* ``Clang``: Clang compiler 5.0+.
* ``NVIDIA``: NVIDIA nvcc compiler 7.5+.
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index ca4ea3e..e782816 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -938,6 +938,29 @@ which is just the string ``tgt``.
:ref:`Target Usage Requirements` this is the consuming target rather
than the target specifying the requirement.
+.. genex:: $<TARGET_RUNTIME_DLLS:tgt>
+
+ List of DLLs that the target depends on at runtime. This is determined by
+ the locations of all the ``SHARED`` and ``MODULE`` targets in the target's
+ transitive dependencies. Using this generator expression on targets other
+ than executables, ``SHARED`` libraries, and ``MODULE`` libraries is an error.
+ On non-DLL platforms, it evaluates to an empty string.
+
+ This generator expression can be used to copy all of the DLLs that a target
+ depends on into its output directory in a ``POST_BUILD`` custom command. For
+ example:
+
+ .. code-block:: cmake
+
+ find_package(foo REQUIRED)
+
+ add_executable(exe main.c)
+ target_link_libraries(exe PRIVATE foo::foo foo::bar)
+ add_custom_command(TARGET exe POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:exe> $<TARGET_FILE_DIR:exe>
+ COMMAND_EXPAND_LISTS
+ )
+
.. genex:: $<INSTALL_PREFIX>
Content of the install prefix when the target is exported via
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index bd6b2f0..f103c50 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -51,6 +51,14 @@ The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used
to determine whether to report an error on use of deprecated macros or
functions.
+Policies Introduced by CMake 3.21
+=================================
+
+.. toctree::
+ :maxdepth: 1
+
+ CMP0121: The list command detects invalid indicies </policy/CMP0121>
+
Policies Introduced by CMake 3.20
=================================
diff --git a/Help/manual/cmake-presets.7.rst b/Help/manual/cmake-presets.7.rst
index ac3ecf5..467818d 100644
--- a/Help/manual/cmake-presets.7.rst
+++ b/Help/manual/cmake-presets.7.rst
@@ -29,10 +29,7 @@ is using Git, ``CMakePresets.json`` may be tracked, and
Format
======
-The files are JSON documents. C-style comments are allowed using
-line-wise ``//`` syntax or block ``/*...*/`` syntax.
-
-Each document has an object as the root:
+The files are a JSON document with an object as the root:
.. literalinclude:: presets/example.json
:language: json
@@ -95,8 +92,9 @@ that may contain the following fields:
A required string representing the machine-friendly name of the preset.
This identifier is used in the :ref:`cmake --preset <CMake Options>` option.
- There must not be two presets in the union of ``CMakePresets.json`` and
- ``CMakeUserPresets.json`` in the same directory with the same name.
+ There must not be two configure presets in the union of ``CMakePresets.json``
+ and ``CMakeUserPresets.json`` in the same directory with the same name.
+ However, a configure preset may have the same name as a build or test preset.
``hidden``
@@ -314,9 +312,9 @@ that may contain the following fields:
A required string representing the machine-friendly name of the preset.
This identifier is used in the
:ref:`cmake --build --preset <Build Tool Mode>` option.
- There must not be two presets (configure, build, or test) in the union of
- ``CMakePresets.json`` and ``CMakeUserPresets.json`` in the same
- directory with the same name.
+ There must not be two build presets in the union of ``CMakePresets.json``
+ and ``CMakeUserPresets.json`` in the same directory with the same name.
+ However, a build preset may have the same name as a configure or test preset.
``hidden``
@@ -433,9 +431,9 @@ that may contain the following fields:
A required string representing the machine-friendly name of the preset.
This identifier is used in the :ref:`ctest --preset <CTest Options>` option.
- There must not be two presets (configure, build, or test) in the union of
- ``CMakePresets.json`` and ``CMakeUserPresets.json`` in the same
- directory with the same name.
+ There must not be two test presets in the union of ``CMakePresets.json``
+ and ``CMakeUserPresets.json`` in the same directory with the same name.
+ However, a test preset may have the same name as a configure or build preset.
``hidden``
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index b2bd1ed..157ea5f 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -377,7 +377,7 @@ Options
about:tracing tab of Google Chrome or using a plugin for a tool like Trace
Compass.
-``--preset=<preset>``
+``--preset <preset>``, ``--preset=<preset>``
Reads a :manual:`preset <cmake-presets(7)>` from
``<path-to-source>/CMakePresets.json`` and
``<path-to-source>/CMakeUserPresets.json``. The preset specifies the
@@ -416,7 +416,7 @@ following options:
Project binary directory to be built. This is required (unless a preset
is specified) and must be first.
-``--preset <preset>``
+``--preset <preset>``, ``--preset=<preset>``
Use a build preset to specify build options. The project binary directory
is inferred from the ``configurePreset`` key. The current working directory
must contain CMake preset files.
diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst
index 0a3614f..175359d 100644
--- a/Help/manual/ctest.1.rst
+++ b/Help/manual/ctest.1.rst
@@ -30,7 +30,7 @@ This program will run the tests and report results.
Options
=======
-``--preset <preset>``
+``--preset <preset>``, ``--preset=<preset>``
Use a test preset to specify test options. The project binary directory
is inferred from the ``configurePreset`` key. The current working directory
must contain CMake preset files.
diff --git a/Help/manual/presets/example.json b/Help/manual/presets/example.json
index d3b6f4a..dfc2910 100644
--- a/Help/manual/presets/example.json
+++ b/Help/manual/presets/example.json
@@ -1,8 +1,8 @@
{
- "version": 1,
+ "version": 2,
"cmakeMinimumRequired": {
"major": 3,
- "minor": 19,
+ "minor": 20,
"patch": 0
},
"configurePresets": [
@@ -37,6 +37,20 @@
"generator": "Ninja Multi-Config"
}
],
+ "buildPresets": [
+ {
+ "name": "default",
+ "configurePreset": "default"
+ }
+ ],
+ "testPresets": [
+ {
+ "name": "default",
+ "configurePreset": "default",
+ "output": {"outputOnFailure": true},
+ "execution": {"noTestsAction": "error", "stopOnFailure": true}
+ }
+ ],
"vendor": {
"example.com/ExampleIDE/1.0": {
"autoFormat": false
diff --git a/Help/policy/CMP0116.rst b/Help/policy/CMP0116.rst
index 25a14c4..18e5a96 100644
--- a/Help/policy/CMP0116.rst
+++ b/Help/policy/CMP0116.rst
@@ -28,7 +28,10 @@ called from a subdirectory.
The ``OLD`` behavior for this policy is to pass the ``DEPFILE`` to Ninja
unaltered. The ``NEW`` behavior for this policy is to transform the ``DEPFILE``
-after running the custom command.
+after running the custom command. The status of ``CMP0116`` is recorded at the
+time of the custom command's creation, and you can have custom commands in the
+same directory with different values for ``CMP0116`` by setting the policy
+before each custom command.
This policy was introduced in CMake version 3.20. Unlike most policies,
CMake version |release| does *not* warn by default when this policy is not set
diff --git a/Help/policy/CMP0121.rst b/Help/policy/CMP0121.rst
new file mode 100644
index 0000000..5ef2856
--- /dev/null
+++ b/Help/policy/CMP0121.rst
@@ -0,0 +1,21 @@
+CMP0121
+-------
+
+.. versionadded:: 3.21
+
+The :command:`list` command now detects invalid indicies.
+
+Prior to CMake version 3.21, the :command:`list` command's ``GET``,
+``INSERT``, ``SUBLIST``, and ``REMOVE_AT`` subcommands did not detect invalid
+index arguments.
+
+The ``OLD`` behavior of this policy is for invalid indicies to be treated as
+their integer value (if any) at the start of the string. For example,
+``2good4you`` is a ``2`` and ``not_an_integer`` is a ``0``. The ``NEW``
+behavior is for invalid indicies to trigger an error.
+
+This policy was introduced in CMake version 3.21. CMake version |release|
+warns when the policy is not set and uses ``OLD`` behavior. Use the
+:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/prop_gbl/CMAKE_C_KNOWN_FEATURES.rst b/Help/prop_gbl/CMAKE_C_KNOWN_FEATURES.rst
index 7166381..2bd0feb 100644
--- a/Help/prop_gbl/CMAKE_C_KNOWN_FEATURES.rst
+++ b/Help/prop_gbl/CMAKE_C_KNOWN_FEATURES.rst
@@ -24,6 +24,12 @@ The features known to this version of CMake are:
``c_std_11``
Compiler mode is at least C 11.
+``c_std_17``
+ Compiler mode is at least C 17.
+
+``c_std_23``
+ Compiler mode is at least C 23.
+
``c_function_prototypes``
Function prototypes, as defined in ``ISO/IEC 9899:1990``.
diff --git a/Help/prop_tgt/C_STANDARD.rst b/Help/prop_tgt/C_STANDARD.rst
index 3f0d242..e22b775 100644
--- a/Help/prop_tgt/C_STANDARD.rst
+++ b/Help/prop_tgt/C_STANDARD.rst
@@ -11,7 +11,7 @@ flag such as ``-std=gnu11`` to the compile line. For compilers that
have no notion of a C standard level, such as Microsoft Visual C++ before
VS 16.7, this property has no effect.
-Supported values are ``90``, ``99`` and ``11``.
+Supported values are ``90``, ``99``, ``11``, ``17``, ``23``.
If the value requested does not result in a compile flag being added for
the compiler in use, a previous standard flag will be added instead. This
diff --git a/Help/release/3.19.rst b/Help/release/3.19.rst
index d8f4f9d..1d55f1e 100644
--- a/Help/release/3.19.rst
+++ b/Help/release/3.19.rst
@@ -409,7 +409,6 @@ Changes made since CMake 3.19.0 include the following.
:generator:`Visual Studio 14 2015` generator. It has now been fixed to
work with :ref:`Visual Studio Generators` for later VS versions too.
-
3.19.5
------
@@ -425,3 +424,11 @@ Changes made since CMake 3.19.0 include the following.
*Link Binaries With Libraries* build phase broke the ability to switch
between device and simulator builds without reconfiguring. That capability
has now been restored.
+
+3.19.6
+------
+
+* The :manual:`cmake-presets(7)` feature no longer allows comments in
+ ``CMakePresets.json`` or ``CMakeUserPresets.json`` files.
+ This was mistakenly allowed by the implementation in CMake 3.19.0 through
+ CMake 3.19.5, and was not documented.
diff --git a/Help/release/dev/c-std.rst b/Help/release/dev/c-std.rst
new file mode 100644
index 0000000..44daa85
--- /dev/null
+++ b/Help/release/dev/c-std.rst
@@ -0,0 +1,6 @@
+c-std
+-----
+
+* :prop_tgt:`C_STANDARD` and the
+ :manual:`Compile Features <cmake-compile-features(7)>` functionality gained
+ support for C17 and C23.
diff --git a/Help/release/dev/cpack-nsis-executable-name.rst b/Help/release/dev/cpack-nsis-executable-name.rst
new file mode 100644
index 0000000..a3818db
--- /dev/null
+++ b/Help/release/dev/cpack-nsis-executable-name.rst
@@ -0,0 +1,6 @@
+cpack-nsis-executable-name
+--------------------------
+
+* The :cpack_gen:`CPack NSIS Generator` gained a new variable
+ :variable:`CPACK_NSIS_EXECUTABLE` to specify the makensis
+ executable to use instead of the default one.
diff --git a/Help/release/dev/list-index-arg-parsing.rst b/Help/release/dev/list-index-arg-parsing.rst
new file mode 100644
index 0000000..2ea525b
--- /dev/null
+++ b/Help/release/dev/list-index-arg-parsing.rst
@@ -0,0 +1,7 @@
+list-index-arg-parsing
+----------------------
+
+* The :command:`list` command's ``GET``, ``INSERT``, ``SUBLIST``, and
+ ``REMOVE_AT`` subcommands now error with invalid (i.e., non-integer) values
+ are given as any of their index arguments based on the setting of policy
+ :policy:`CMP0121`.
diff --git a/Help/release/dev/runtime-dll-deps.rst b/Help/release/dev/runtime-dll-deps.rst
new file mode 100644
index 0000000..831410f
--- /dev/null
+++ b/Help/release/dev/runtime-dll-deps.rst
@@ -0,0 +1,4 @@
+runtime-dll-deps
+----------------
+
+* A new :genex:`TARGET_RUNTIME_DLLS` generator expression was added.
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
index 7f73891..754f235 100644
--- a/Modules/CMakeCCompiler.cmake.in
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -9,6 +9,8 @@ set(CMAKE_C_COMPILE_FEATURES "@CMAKE_C_COMPILE_FEATURES@")
set(CMAKE_C90_COMPILE_FEATURES "@CMAKE_C90_COMPILE_FEATURES@")
set(CMAKE_C99_COMPILE_FEATURES "@CMAKE_C99_COMPILE_FEATURES@")
set(CMAKE_C11_COMPILE_FEATURES "@CMAKE_C11_COMPILE_FEATURES@")
+set(CMAKE_C17_COMPILE_FEATURES "@CMAKE_C17_COMPILE_FEATURES@")
+set(CMAKE_C23_COMPILE_FEATURES "@CMAKE_C23_COMPILE_FEATURES@")
set(CMAKE_C_PLATFORM_ID "@CMAKE_C_PLATFORM_ID@")
set(CMAKE_C_SIMULATE_ID "@CMAKE_C_SIMULATE_ID@")
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 8ba6abc..716b975 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -33,13 +33,16 @@ char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
@CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
@CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@
-#if !defined(__STDC__)
-# if (defined(_MSC_VER) && !defined(__clang__)) \
- || (defined(__ibmxl__) || defined(__IBMC__))
+#if !defined(__STDC__) && !defined(__clang__)
+# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__)
# define C_DIALECT "90"
# else
# define C_DIALECT
# endif
+#elif __STDC_VERSION__ > 201710L
+# define C_DIALECT "23"
+#elif __STDC_VERSION__ >= 201710L
+# define C_DIALECT "17"
#elif __STDC_VERSION__ >= 201000L
# define C_DIALECT "11"
#elif __STDC_VERSION__ >= 199901L
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index dd539b7..1ba537a 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -69,6 +69,10 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
set(CMAKE_CUDA_COMPILER_ID_VENDOR_REGEX_Clang "(clang version)")
CMAKE_DETERMINE_COMPILER_ID_VENDOR(CUDA "--version")
+ if(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang" AND WIN32)
+ message(FATAL_ERROR "Clang with CUDA is not yet supported on Windows. See CMake issue #20776.")
+ endif()
+
# Find the CUDA toolkit. We store the CMAKE_CUDA_COMPILER_TOOLKIT_ROOT and CMAKE_CUDA_COMPILER_LIBRARY_ROOT
# in CMakeCUDACompiler.cmake, so FindCUDAToolkit can avoid searching on future runs and the toolkit stays the same.
# This is very similar to FindCUDAToolkit, but somewhat simplified since we can issue fatal errors
@@ -167,7 +171,7 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
unset(search_paths)
if(NOT _CUDA_NVCC_EXECUTABLE)
- message(FATAL_ERROR "Could not find nvcc, please set CUDAToolkit_ROOT.")
+ message(FATAL_ERROR "Failed to find nvcc.\nCompiler ${CMAKE_CUDA_COMPILER_ID} requires the CUDA toolkit. Please set the CUDAToolkit_ROOT variable.")
endif()
endif()
endif()
@@ -225,10 +229,6 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
set(CMAKE_CUDA_COMPILER_ID_REQUIRE_SUCCESS ON)
endif()
elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
- if(WIN32)
- message(FATAL_ERROR "Clang with CUDA is not yet supported on Windows. See CMake issue #20776.")
- endif()
-
set(clang_test_flags "--cuda-path=\"${CMAKE_CUDA_COMPILER_LIBRARY_ROOT}\"")
if(CMAKE_CROSSCOMPILING)
# Need to pass the host target and include directories if we're crosscompiling.
diff --git a/Modules/CMakeDetermineCompileFeatures.cmake b/Modules/CMakeDetermineCompileFeatures.cmake
index c03a85f..f767847 100644
--- a/Modules/CMakeDetermineCompileFeatures.cmake
+++ b/Modules/CMakeDetermineCompileFeatures.cmake
@@ -10,6 +10,8 @@ function(cmake_determine_compile_features lang)
set(CMAKE_C90_COMPILE_FEATURES)
set(CMAKE_C99_COMPILE_FEATURES)
set(CMAKE_C11_COMPILE_FEATURES)
+ set(CMAKE_C17_COMPILE_FEATURES)
+ set(CMAKE_C23_COMPILE_FEATURES)
include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
@@ -20,6 +22,12 @@ function(cmake_determine_compile_features lang)
return()
endif()
+ if (CMAKE_C17_COMPILE_FEATURES AND CMAKE_C23_COMPILE_FEATURES)
+ list(REMOVE_ITEM CMAKE_C23_COMPILE_FEATURES ${CMAKE_C17_COMPILE_FEATURES})
+ endif()
+ if (CMAKE_C11_COMPILE_FEATURES AND CMAKE_C17_COMPILE_FEATURES)
+ list(REMOVE_ITEM CMAKE_C17_COMPILE_FEATURES ${CMAKE_C11_COMPILE_FEATURES})
+ endif()
if (CMAKE_C99_COMPILE_FEATURES AND CMAKE_C11_COMPILE_FEATURES)
list(REMOVE_ITEM CMAKE_C11_COMPILE_FEATURES ${CMAKE_C99_COMPILE_FEATURES})
endif()
@@ -32,6 +40,8 @@ function(cmake_determine_compile_features lang)
${CMAKE_C90_COMPILE_FEATURES}
${CMAKE_C99_COMPILE_FEATURES}
${CMAKE_C11_COMPILE_FEATURES}
+ ${CMAKE_C17_COMPILE_FEATURES}
+ ${CMAKE_C23_COMPILE_FEATURES}
)
endif()
@@ -39,6 +49,8 @@ function(cmake_determine_compile_features lang)
set(CMAKE_C90_COMPILE_FEATURES ${CMAKE_C90_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_C99_COMPILE_FEATURES ${CMAKE_C99_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_C11_COMPILE_FEATURES ${CMAKE_C11_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_C17_COMPILE_FEATURES ${CMAKE_C17_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_C23_COMPILE_FEATURES ${CMAKE_C23_COMPILE_FEATURES} PARENT_SCOPE)
message(CHECK_PASS "done")
diff --git a/Modules/Compiler/CMakeCommonCompilerMacros.cmake b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
index cd897c5..29e6730 100644
--- a/Modules/Compiler/CMakeCommonCompilerMacros.cmake
+++ b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
@@ -64,6 +64,12 @@ endmacro()
# Define to allow compile features to be automatically determined
macro(cmake_record_c_compile_features)
set(_result 0)
+ if(_result EQUAL 0 AND DEFINED CMAKE_C23_STANDARD_COMPILE_OPTION)
+ _has_compiler_features_c(23)
+ endif()
+ if(_result EQUAL 0 AND DEFINED CMAKE_C17_STANDARD_COMPILE_OPTION)
+ _has_compiler_features_c(17)
+ endif()
if(_result EQUAL 0 AND DEFINED CMAKE_C11_STANDARD_COMPILE_OPTION)
if(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT)
_has_compiler_features_c(11)
diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake
index 5609abf..cf493d7 100644
--- a/Modules/Compiler/Clang-C.cmake
+++ b/Modules/Compiler/Clang-C.cmake
@@ -25,37 +25,60 @@ elseif("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
endif()
endif()
-if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
- if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
+if("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
+ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 2.1)
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)
+ endif()
+ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.1)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
- set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
- else()
- # clang-cl doesn't have any of these
- set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
- set(CMAKE_C90_EXTENSION_COMPILE_OPTION "")
- set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)
+ elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.0)
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c1x")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x")
+ endif()
+
+ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0)
+ set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
+ set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
+ endif()
+
+ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)
+ set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x")
+ set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x")
+ endif()
+else()
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "")
- set(CMAKE_C99_STANDARD_COMPILE_OPTION "")
- set(CMAKE_C99_EXTENSION_COMPILE_OPTION "")
- set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
+ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "/std:c11")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "/std:c11")
+ set(CMAKE_C17_STANDARD_COMPILE_OPTION "/std:c17")
+ set(CMAKE_C17_EXTENSION_COMPILE_OPTION "/std:c17")
+ else()
set(CMAKE_C11_STANDARD_COMPILE_OPTION "")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "")
- set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
+
+ set(CMAKE_C17_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_C17_EXTENSION_COMPILE_OPTION "")
endif()
endif()
-if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
- __compiler_check_default_language_standard(C 3.4 99 3.6 11)
-else()
- set(CMAKE_C_STANDARD_DEFAULT "")
+if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 2.1)
+ set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
endif()
+
+if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.0)
+ set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
+endif()
+
+__compiler_check_default_language_standard(C 2.1 99 3.5.2 11 11.0 17)
diff --git a/Modules/Compiler/Clang-CUDA.cmake b/Modules/Compiler/Clang-CUDA.cmake
index 37e5e9f..0223081 100644
--- a/Modules/Compiler/Clang-CUDA.cmake
+++ b/Modules/Compiler/Clang-CUDA.cmake
@@ -22,8 +22,8 @@ set(_CMAKE_CUDA_PTX_FLAG "--cuda-device-only -S")
set(_CMAKE_CUDA_DEVICE_CODE "-fgpu-rdc -c")
# 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>")
-set(CMAKE_CUDA_CREATE_SHARED_LIBRARY "<CMAKE_CUDA_COMPILER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
+set(CMAKE_CUDA_LINK_EXECUTABLE "<CMAKE_CUDA_COMPILER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICIT_LINKS}")
+set(CMAKE_CUDA_CREATE_SHARED_LIBRARY "<CMAKE_CUDA_COMPILER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICIT_LINKS}")
set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC")
set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "cudadevrt;cudart_static")
diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake
index 86b4d83..39e9c72 100644
--- a/Modules/Compiler/GNU-C.cmake
+++ b/Modules/Compiler/GNU-C.cmake
@@ -36,4 +36,14 @@ elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x")
endif()
-__compiler_check_default_language_standard(C 3.4 90 5.0 11)
+if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)
+ set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
+ set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
+endif()
+
+if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 9.1)
+ set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c23")
+ set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu23")
+endif()
+
+__compiler_check_default_language_standard(C 3.4 90 5.0 11 8.1 17)
diff --git a/Modules/Compiler/Intel-Fortran.cmake b/Modules/Compiler/Intel-Fortran.cmake
index 71f25f4..9fb6d46 100644
--- a/Modules/Compiler/Intel-Fortran.cmake
+++ b/Modules/Compiler/Intel-Fortran.cmake
@@ -13,7 +13,15 @@ set(CMAKE_Fortran_COMPILE_WITH_DEFINES 1)
set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
-set(CMAKE_Fortran_PREPROCESS_SOURCE
- "<CMAKE_Fortran_COMPILER> -fpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+if(CMAKE_HOST_WIN32)
+ # MSVC-like
+ set(CMAKE_Fortran_PREPROCESS_SOURCE
+ "<CMAKE_Fortran_COMPILER> -fpp <DEFINES> <INCLUDES> <FLAGS> -P <SOURCE> -Fi<PREPROCESSED_SOURCE>")
+else()
+ # GNU-like
+ set(CMAKE_Fortran_PREPROCESS_SOURCE
+ "<CMAKE_Fortran_COMPILER> -fpp <DEFINES> <INCLUDES> <FLAGS> -P <SOURCE> -o <PREPROCESSED_SOURCE>")
+endif()
+
set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-fpp")
set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-nofpp")
diff --git a/Modules/Compiler/IntelLLVM-C.cmake b/Modules/Compiler/IntelLLVM-C.cmake
index fce2971..beb7132 100644
--- a/Modules/Compiler/IntelLLVM-C.cmake
+++ b/Modules/Compiler/IntelLLVM-C.cmake
@@ -37,6 +37,9 @@ if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
+
+ set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
+ set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
else()
# clang-cl doesn't have any of these
set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
@@ -47,12 +50,13 @@ else()
set(CMAKE_C11_STANDARD_COMPILE_OPTION "")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "")
+
+ set(CMAKE_C17_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_C17_EXTENSION_COMPILE_OPTION "")
endif()
if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
- # FIXME: The compiler actually defaults to C17, but
- # CMake does not yet model or detect that standard.
- __compiler_check_default_language_standard(C 2020 11)
+ __compiler_check_default_language_standard(C 2020 17)
else()
set(CMAKE_C_STANDARD_DEFAULT "")
endif()
diff --git a/Modules/Compiler/IntelLLVM-Fortran.cmake b/Modules/Compiler/IntelLLVM-Fortran.cmake
index 3dfa099..710803f 100644
--- a/Modules/Compiler/IntelLLVM-Fortran.cmake
+++ b/Modules/Compiler/IntelLLVM-Fortran.cmake
@@ -13,7 +13,15 @@ set(CMAKE_Fortran_COMPILE_WITH_DEFINES 1)
set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
-set(CMAKE_Fortran_PREPROCESS_SOURCE
- "<CMAKE_Fortran_COMPILER> -fpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+if(CMAKE_HOST_WIN32)
+ # MSVC-like
+ set(CMAKE_Fortran_PREPROCESS_SOURCE
+ "<CMAKE_Fortran_COMPILER> -fpp <DEFINES> <INCLUDES> <FLAGS> -P <SOURCE> -Fi<PREPROCESSED_SOURCE>")
+else()
+ # GNU-like
+ set(CMAKE_Fortran_PREPROCESS_SOURCE
+ "<CMAKE_Fortran_COMPILER> -fpp <DEFINES> <INCLUDES> <FLAGS> -P <SOURCE> -o <PREPROCESSED_SOURCE>")
+endif()
+
set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-fpp")
set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-nofpp")
diff --git a/Modules/Compiler/NAG-Fortran.cmake b/Modules/Compiler/NAG-Fortran.cmake
index ffce97e..a65fd2c 100644
--- a/Modules/Compiler/NAG-Fortran.cmake
+++ b/Modules/Compiler/NAG-Fortran.cmake
@@ -31,6 +31,7 @@ endif()
set(CMAKE_Fortran_SUBMODULE_SEP ".")
set(CMAKE_Fortran_SUBMODULE_EXT ".sub")
set(CMAKE_Fortran_MODDIR_FLAG "-mdir ")
+set(CMAKE_Fortran_MODDIR_INCLUDE_FLAG "-I") # -mdir does not affect search path
set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-PIC")
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free")
diff --git a/Modules/Compiler/PGI-CXX.cmake b/Modules/Compiler/PGI-CXX.cmake
index 3254353..1279c19 100644
--- a/Modules/Compiler/PGI-CXX.cmake
+++ b/Modules/Compiler/PGI-CXX.cmake
@@ -8,6 +8,8 @@ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.10)
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION --gnu_extensions)
set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.10)
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION --c++03)
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION --c++03 --gnu_extensions)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION --c++11)
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION --c++11 --gnu_extensions)
set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 4a9809b..987b69a 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -2579,11 +2579,24 @@ function(_ep_write_command_script
endif()
if(genex_supported)
- # Only written at generation phase
+ # Only written at generation phase. This will only change the file's
+ # timestamp if the contents change.
file(GENERATE OUTPUT "${script_filename}" CONTENT "${script_content}")
else()
- # Written immediately, needed if script has to be invoked in configure phase
- file(WRITE "${script_filename}" "${script_content}")
+ # Update the file immediately, needed if script has to be invoked in the
+ # configure phase (e.g. via FetchContent). We need to be careful to avoid
+ # updating the timestamp if the file contents don't change. The file(WRITE)
+ # command always updates the file, so avoid it if we don't need to call it.
+ set(doWrite TRUE)
+ if(EXISTS "${script_filename}")
+ file(READ "${script_filename}" existing_content)
+ if(existing_content STREQUAL script_content)
+ set(doWrite FALSE)
+ endif()
+ endif()
+ if(doWrite)
+ file(WRITE "${script_filename}" "${script_content}")
+ endif()
endif()
endfunction()
@@ -3916,7 +3929,12 @@ function(_ep_do_preconfigure_steps_now name)
if(NOT need_to_run)
foreach(dep_file ${script_file} ${_EPdepends_${STEP}})
- if(NOT EXISTS ${dep_file} OR ${dep_file} IS_NEWER_THAN ${stamp_file})
+ # IS_NEWER_THAN is also true if the timestamps are the same. On some
+ # file systems, we only have second resolution timestamps and the
+ # likelihood of having the same timestamp is high. Use the negative
+ # form to ensure we actually get a true "is newer than" test.
+ if(NOT EXISTS ${dep_file} OR
+ NOT ${stamp_file} IS_NEWER_THAN ${dep_file})
set(need_to_run TRUE)
break()
endif()
diff --git a/Modules/ExternalProject/gitclone.cmake.in b/Modules/ExternalProject/gitclone.cmake.in
index a2e900c..edbdd72 100644
--- a/Modules/ExternalProject/gitclone.cmake.in
+++ b/Modules/ExternalProject/gitclone.cmake.in
@@ -7,7 +7,8 @@ set(quiet "@quiet@")
set(script_dir "@CMAKE_CURRENT_FUNCTION_LIST_DIR@/ExternalProject")
include(${script_dir}/captured_process_setup.cmake)
-if(NOT "@gitclone_infofile@" IS_NEWER_THAN "@gitclone_stampfile@")
+if(EXISTS "@gitclone_stampfile@" AND EXISTS "@gitclone_infofile@" AND
+ "@gitclone_stampfile@" IS_NEWER_THAN "@gitclone_infofile@")
if(NOT quiet)
message(STATUS
"Avoiding repeated git clone, stamp file is up to date: "
diff --git a/Modules/ExternalProject/hgclone.cmake.in b/Modules/ExternalProject/hgclone.cmake.in
index 5561955..9a574d2 100644
--- a/Modules/ExternalProject/hgclone.cmake.in
+++ b/Modules/ExternalProject/hgclone.cmake.in
@@ -7,7 +7,8 @@ set(quiet "@quiet@")
set(script_dir "@CMAKE_CURRENT_FUNCTION_LIST_DIR@/ExternalProject")
include(${script_dir}/captured_process_setup.cmake)
-if(NOT "@hgclone_infofile@" IS_NEWER_THAN "@hgclone_stampfile@")
+if(EXISTS "@hgclone_stampfile@" AND EXISTS "@hgclone_infofile@" AND
+ "@hgclone_stampfile@" IS_NEWER_THAN "@hgclone_infofile@")
if(NOT quiet)
message(STATUS
"Avoiding repeated hg clone, stamp file is up to date: "
diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake
index 998faf1..9e5726b 100644
--- a/Modules/FortranCInterface/Detect.cmake
+++ b/Modules/FortranCInterface/Detect.cmake
@@ -6,14 +6,17 @@ configure_file(${FortranCInterface_SOURCE_DIR}/Input.cmake.in
# Detect the Fortran/C interface on the first run or when the
# configuration changes.
-if(${FortranCInterface_BINARY_DIR}/Input.cmake
- IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake
- OR ${FortranCInterface_SOURCE_DIR}/Output.cmake.in
- IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake
- OR ${FortranCInterface_SOURCE_DIR}/CMakeLists.txt
- IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake
- OR ${CMAKE_CURRENT_LIST_FILE}
- IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake
+if(NOT EXISTS ${FortranCInterface_BINARY_DIR}/Output.cmake
+ OR NOT EXISTS ${FortranCInterface_BINARY_DIR}/Input.cmake
+ OR NOT EXISTS ${FortranCInterface_BINARY_DIR}/Output.cmake.in
+ OR NOT ${FortranCInterface_BINARY_DIR}/Output.cmake
+ IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Input.cmake
+ OR NOT ${FortranCInterface_SOURCE_DIR}/Output.cmake
+ IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake.in
+ OR NOT ${FortranCInterface_BINARY_DIR}/Output.cmake
+ IS_NEWER_THAN ${FortranCInterface_SOURCE_DIR}/CMakeLists.txt
+ OR NOT ${FortranCInterface_BINARY_DIR}/Output.cmake
+ IS_NEWER_THAN ${CMAKE_CURRENT_LIST_FILE}
)
message(CHECK_START "Detecting Fortran/C Interface")
else()
diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake
index 2ea9e74..80d8e23 100644
--- a/Modules/GoogleTest.cmake
+++ b/Modules/GoogleTest.cmake
@@ -504,7 +504,8 @@ function(gtest_discover_tests TARGET)
string(CONCAT ctest_include_content
"if(EXISTS \"$<TARGET_FILE:${TARGET}>\")" "\n"
- " if(\"$<TARGET_FILE:${TARGET}>\" IS_NEWER_THAN \"${ctest_tests_file}\")" "\n"
+ " if(NOT EXISTS \"${ctest_tests_file}\" OR" "\n"
+ " NOT \"${ctest_tests_file}\" IS_NEWER_THAN \"$<TARGET_FILE:${TARGET}>\")" "\n"
" include(\"${_GOOGLETEST_DISCOVER_TESTS_SCRIPT}\")" "\n"
" gtest_discover_tests_impl(" "\n"
" TEST_EXECUTABLE" " [==[" "$<TARGET_FILE:${TARGET}>" "]==]" "\n"
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index ed91174..b6e7ef2 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 20)
-set(CMake_VERSION_PATCH 20210219)
+set(CMake_VERSION_PATCH 20210227)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index e0dd06b..bf8b457 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -186,13 +186,20 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
this->WizardShowPageList.clear();
}
} else {
+ std::string currentVersionMsg;
+ if (this->Generator) {
+ currentVersionMsg =
+ "QtIFW version " + this->Generator->FrameworkVersion;
+ } else {
+ currentVersionMsg = "an older QtIFW version";
+ }
cmCPackIFWLogger(
WARNING,
"Option CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST is set to \""
<< option
<< "\", but it is only supported with QtIFW version 4.0 or later. "
- "It is being ignored because you are using QtIFW version "
- << this->Generator->FrameworkVersion.data() << std::endl);
+ "It is being ignored because you are using "
+ << currentVersionMsg << std::endl);
}
}
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 263adfd..9b00704 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -430,7 +430,9 @@ int cmCPackNSISGenerator::InitializeInternal()
}
#endif
- nsisPath = cmSystemTools::FindProgram("makensis", path, false);
+ this->SetOptionIfNotSet("CPACK_NSIS_EXECUTABLE", "makensis");
+ nsisPath = cmSystemTools::FindProgram(
+ this->GetOption("CPACK_NSIS_EXECUTABLE"), path, false);
if (nsisPath.empty()) {
cmCPackLogger(
diff --git a/Source/QtDialog/EnvironmentDialog.cxx b/Source/QtDialog/EnvironmentDialog.cxx
index 0339d1d..9c8e892 100644
--- a/Source/QtDialog/EnvironmentDialog.cxx
+++ b/Source/QtDialog/EnvironmentDialog.cxx
@@ -110,8 +110,14 @@ EnvironmentDialog::EnvironmentDialog(const QProcessEnvironment& environment,
&EnvironmentDialog::addEntry);
QObject::connect(this->RemoveEntry, &QAbstractButton::clicked, this,
&EnvironmentDialog::removeSelectedEntries);
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
+ QObject::connect(this->Search, &QLineEdit::textChanged, this->m_filter,
+ QOverload<const QString&>::of(
+ &EnvironmentSearchFilter::setFilterRegularExpression));
+#else
QObject::connect(this->Search, &QLineEdit::textChanged, this->m_filter,
&EnvironmentSearchFilter::setFilterFixedString);
+#endif
QObject::connect(this->Environment->selectionModel(),
&QItemSelectionModel::selectionChanged, this,
&EnvironmentDialog::selectionChanged);
diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx
index 7c9032e..536b92d 100644
--- a/Source/QtDialog/QCMakeCacheView.cxx
+++ b/Source/QtDialog/QCMakeCacheView.cxx
@@ -170,7 +170,11 @@ bool QCMakeCacheView::showAdvanced() const
void QCMakeCacheView::setSearchFilter(const QString& s)
{
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
+ this->SearchFilter->setFilterRegularExpression(s);
+#else
this->SearchFilter->setFilterFixedString(s);
+#endif
}
QCMakeCacheModel::QCMakeCacheModel(QObject* p)
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index ff2cc3e..a7ce3a6 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -320,15 +320,16 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
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(),
- escapeOldStyle, uses_terminal, depfile,
- job_pool, command_expand_lists);
+ 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);
} else if (target.empty()) {
// Target is empty, use the output.
mf.AddCustomCommandToOutput(
output, byproducts, depends, main_dependency, implicit_depends,
- commandLines, comment, working.c_str(), nullptr, false, escapeOldStyle,
+ commandLines, comment, working.c_str(),
+ mf.GetPolicyStatus(cmPolicies::CMP0116), nullptr, false, escapeOldStyle,
uses_terminal, command_expand_lists, depfile, job_pool);
} else if (!byproducts.empty()) {
status.SetError("BYPRODUCTS may not be specified with SOURCE signatures");
@@ -365,7 +366,8 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
// Use the old-style mode for backward compatibility.
mf.AddCustomCommandOldStyle(target, outputs, depends, source, commandLines,
- comment);
+ comment,
+ mf.GetPolicyStatus(cmPolicies::CMP0116));
}
return true;
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index 104065f..2b19aad 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -10,6 +10,7 @@
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmPolicies.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -213,8 +214,8 @@ bool cmAddCustomTargetCommand(std::vector<std::string> const& args,
bool escapeOldStyle = !verbatim;
cmTarget* target = mf.AddUtilityCommand(
targetName, excludeFromAll, working_directory.c_str(), byproducts, depends,
- commandLines, escapeOldStyle, comment, uses_terminal, command_expand_lists,
- job_pool);
+ commandLines, mf.GetPolicyStatus(cmPolicies::CMP0116), escapeOldStyle,
+ comment, uses_terminal, command_expand_lists, job_pool);
// Add additional user-specified source files to the target.
target->AddSources(sources);
diff --git a/Source/cmCMakePresetsFile.cxx b/Source/cmCMakePresetsFile.cxx
index 29d5325..c8d69b8 100644
--- a/Source/cmCMakePresetsFile.cxx
+++ b/Source/cmCMakePresetsFile.cxx
@@ -1519,6 +1519,7 @@ cmCMakePresetsFile::ReadFileResult cmCMakePresetsFile::ReadJSONFile(
Json::Value root;
Json::CharReaderBuilder builder;
+ Json::CharReaderBuilder::strictMode(&builder.settings_);
if (!Json::parseFromStream(builder, fin, &root, nullptr)) {
return ReadFileResult::JSON_PARSE_ERROR;
}
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index 0295b33..438a077 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -222,7 +222,8 @@ 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);
+ commandLines,
+ mf->GetPolicyStatus(cmPolicies::CMP0116));
}
void CCONV cmAddCustomCommand(void* arg, const char* source,
@@ -263,7 +264,8 @@ 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);
+ commandLines, no_comment,
+ mf->GetPolicyStatus(cmPolicies::CMP0116));
}
void CCONV cmAddCustomCommandToOutput(void* arg, const char* output,
@@ -298,7 +300,8 @@ void CCONV cmAddCustomCommandToOutput(void* arg, const char* output,
const char* no_comment = nullptr;
const char* no_working_dir = nullptr;
mf->AddCustomCommandToOutput(output, depends2, main_dependency, commandLines,
- no_comment, no_working_dir);
+ no_comment, no_working_dir,
+ mf->GetPolicyStatus(cmPolicies::CMP0116));
}
void CCONV cmAddCustomCommandToTarget(void* arg, const char* target,
@@ -340,7 +343,8 @@ void CCONV cmAddCustomCommandToTarget(void* arg, const char* target,
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);
+ cctype, no_comment, no_working_dir,
+ mf->GetPolicyStatus(cmPolicies::CMP0116));
}
static void addLinkLibrary(cmMakefile* mf, std::string const& target,
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index e8d7c05..620ba19 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -2574,7 +2574,10 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
bool listPresets =
find(args.begin(), args.end(), "--list-presets") != args.end();
- auto it = find(args.begin(), args.end(), "--preset");
+ auto it =
+ std::find_if(args.begin(), args.end(), [](std::string const& arg) -> bool {
+ return arg == "--preset" || cmHasLiteralPrefix(arg, "--preset=");
+ });
if (listPresets || it != args.end()) {
std::string errormsg;
bool success;
@@ -2583,7 +2586,10 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
// If listing presets we don't need a presetName
success = this->SetArgsFromPreset("", listPresets);
} else {
- if (++it != args.end()) {
+ if (cmHasLiteralPrefix(*it, "--preset=")) {
+ auto presetName = it->substr(9);
+ success = this->SetArgsFromPreset(presetName, listPresets);
+ } else if (++it != args.end()) {
auto presetName = *it;
success = this->SetArgsFromPreset(presetName, listPresets);
} else {
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 6225a4a..5473316 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -701,6 +701,10 @@ void cmComputeLinkInformation::AddItem(BT<std::string> const& item,
this->AddTargetItem(lib, tgt);
this->AddLibraryRuntimeInfo(lib.Value, tgt);
+ if (tgt && tgt->GetType() == cmStateEnums::SHARED_LIBRARY &&
+ this->Target->IsDLLPlatform()) {
+ this->AddRuntimeDLL(tgt);
+ }
}
} else {
// This is not a CMake target. Use the name given.
@@ -728,6 +732,13 @@ void cmComputeLinkInformation::AddItem(BT<std::string> const& item,
void cmComputeLinkInformation::AddSharedDepItem(BT<std::string> const& item,
const cmGeneratorTarget* tgt)
{
+ // Record dependencies on DLLs.
+ if (tgt && tgt->GetType() == cmStateEnums::SHARED_LIBRARY &&
+ this->Target->IsDLLPlatform() &&
+ this->SharedDependencyMode != SharedDepModeLink) {
+ this->AddRuntimeDLL(tgt);
+ }
+
// If dropping shared library dependencies, ignore them.
if (this->SharedDependencyMode == SharedDepModeNone) {
return;
@@ -799,6 +810,14 @@ void cmComputeLinkInformation::AddSharedDepItem(BT<std::string> const& item,
}
}
+void cmComputeLinkInformation::AddRuntimeDLL(cmGeneratorTarget const* tgt)
+{
+ if (std::find(this->RuntimeDLLs.begin(), this->RuntimeDLLs.end(), tgt) ==
+ this->RuntimeDLLs.end()) {
+ this->RuntimeDLLs.emplace_back(tgt);
+ }
+}
+
void cmComputeLinkInformation::ComputeLinkTypeInfo()
{
// Check whether archives may actually be shared libraries.
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index 9fec702..4acb99f 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -64,6 +64,10 @@ public:
std::string GetRPathString(bool for_install) const;
std::string GetChrpathString() const;
std::set<cmGeneratorTarget const*> const& GetSharedLibrariesLinked() const;
+ std::vector<cmGeneratorTarget const*> const& GetRuntimeDLLs() const
+ {
+ return this->RuntimeDLLs;
+ }
std::string const& GetLibLinkFileFlag() const
{
@@ -81,6 +85,7 @@ private:
void AddItem(BT<std::string> const& item, const cmGeneratorTarget* tgt);
void AddSharedDepItem(BT<std::string> const& item,
cmGeneratorTarget const* tgt);
+ void AddRuntimeDLL(cmGeneratorTarget const* tgt);
// Output information.
ItemVector Items;
@@ -89,6 +94,7 @@ private:
std::vector<std::string> FrameworkPaths;
std::vector<std::string> RuntimeSearchPath;
std::set<cmGeneratorTarget const*> SharedLibrariesLinked;
+ std::vector<cmGeneratorTarget const*> RuntimeDLLs;
// Context information.
cmGeneratorTarget const* const Target;
diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx
index 3001ae0..a2fac73 100644
--- a/Source/cmCreateTestSourceList.cxx
+++ b/Source/cmCreateTestSourceList.cxx
@@ -90,10 +90,15 @@ bool cmCreateTestSourceList(std::vector<std::string> const& args,
std::replace(func_name.begin(), func_name.end(), ' ', '_');
std::replace(func_name.begin(), func_name.end(), '/', '_');
std::replace(func_name.begin(), func_name.end(), ':', '_');
+ bool already_declared =
+ std::find(tests_func_name.begin(), tests_func_name.end(), func_name) !=
+ tests_func_name.end();
tests_func_name.push_back(func_name);
- forwardDeclareCode += "int ";
- forwardDeclareCode += func_name;
- forwardDeclareCode += "(int, char*[]);\n";
+ if (!already_declared) {
+ forwardDeclareCode += "int ";
+ forwardDeclareCode += func_name;
+ forwardDeclareCode += "(int, char*[]);\n";
+ }
}
std::string functionMapCode;
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx
index 149f5e9..f6b9989 100644
--- a/Source/cmCustomCommand.cxx
+++ b/Source/cmCustomCommand.cxx
@@ -140,3 +140,13 @@ void cmCustomCommand::SetJobPool(const std::string& job_pool)
{
this->JobPool = job_pool;
}
+
+cmPolicies::PolicyStatus cmCustomCommand::GetCMP0116Status() const
+{
+ return this->CMP0116Status;
+}
+
+void cmCustomCommand::SetCMP0116Status(cmPolicies::PolicyStatus cmp0116)
+{
+ this->CMP0116Status = cmp0116;
+}
diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h
index 2036e90..e22c7a4 100644
--- a/Source/cmCustomCommand.h
+++ b/Source/cmCustomCommand.h
@@ -10,6 +10,7 @@
#include "cmCustomCommandLines.h"
#include "cmListFileCache.h"
+#include "cmPolicies.h"
class cmImplicitDependsList
: public std::vector<std::pair<std::string, std::string>>
@@ -95,6 +96,10 @@ public:
const std::string& GetJobPool() const;
void SetJobPool(const std::string& job_pool);
+ /** Set/Get the CMP0116 status (used by the Ninja generator) */
+ cmPolicies::PolicyStatus GetCMP0116Status() const;
+ void SetCMP0116Status(cmPolicies::PolicyStatus cmp0116);
+
private:
std::vector<std::string> Outputs;
std::vector<std::string> Byproducts;
@@ -112,4 +117,5 @@ private:
bool UsesTerminal = false;
bool CommandExpandLists = false;
bool StdPipesUTF8 = false;
+ cmPolicies::PolicyStatus CMP0116Status = cmPolicies::WARN;
};
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index a92f6e3..52965bb 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -435,7 +435,8 @@ std::string cmExtraSublimeTextGenerator::ComputeIncludes(
lg->GetIncludeDirectories(includes, target, language, config);
std::string includesString =
- lg->GetIncludeFlags(includes, target, language, true, false, config);
+ lg->GetIncludeFlags(includes, target, language, config, false,
+ cmLocalGenerator::IncludePathStyle::Absolute);
return includesString;
}
diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index d88617a..77d5795 100644
--- a/Source/cmFLTKWrapUICommand.cxx
+++ b/Source/cmFLTKWrapUICommand.cxx
@@ -10,6 +10,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmPolicies.h"
#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmStringAlgorithms.h"
@@ -98,9 +99,11 @@ bool cmFLTKWrapUICommand(std::vector<std::string> const& args,
const char* no_comment = nullptr;
const char* no_working_dir = nullptr;
mf.AddCustomCommandToOutput(cxxres, depends, no_main_dependency,
- commandLines, no_comment, no_working_dir);
+ commandLines, no_comment, no_working_dir,
+ mf.GetPolicyStatus(cmPolicies::CMP0116));
mf.AddCustomCommandToOutput(hname, depends, no_main_dependency,
- commandLines, no_comment, no_working_dir);
+ commandLines, no_comment, no_working_dir,
+ mf.GetPolicyStatus(cmPolicies::CMP0116));
cmSourceFile* sf = mf.GetSource(cxxres);
sf->AddDepend(hname);
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index e40316e..7125170 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -14,6 +14,7 @@
#include <utility>
#include <cm/iterator>
+#include <cm/optional>
#include <cm/string_view>
#include <cm/vector>
#include <cmext/algorithm>
@@ -23,6 +24,7 @@
#include "cmsys/String.h"
#include "cmAlgorithms.h"
+#include "cmComputeLinkInformation.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorExpressionContext.h"
#include "cmGeneratorExpressionDAGChecker.h"
@@ -1627,8 +1629,8 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
type != cmStateEnums::OBJECT_LIBRARY) {
std::ostringstream e;
e << "Objects of target \"" << tgtName
- << "\" referenced but is not an allowed library types (EXECUTABLE, "
- << "STATIC, SHARED, MODULE, OBJECT).";
+ << "\" referenced but is not one of the allowed target types "
+ << "(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT).";
reportError(context, content->GetOriginalExpression(), e.str());
return std::string();
}
@@ -1687,6 +1689,54 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
}
} targetObjectsNode;
+static const struct TargetRuntimeDllsNode : public cmGeneratorExpressionNode
+{
+ TargetRuntimeDllsNode() {} // NOLINT(modernize-use-equals-default)
+
+ std::string Evaluate(
+ const std::vector<std::string>& parameters,
+ cmGeneratorExpressionContext* context,
+ const GeneratorExpressionContent* content,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
+ {
+ std::string tgtName = parameters.front();
+ cmGeneratorTarget* gt = context->LG->FindGeneratorTargetToUse(tgtName);
+ if (!gt) {
+ std::ostringstream e;
+ e << "Objects of target \"" << tgtName
+ << "\" referenced but no such target exists.";
+ reportError(context, content->GetOriginalExpression(), e.str());
+ return std::string();
+ }
+ cmStateEnums::TargetType type = gt->GetType();
+ if (type != cmStateEnums::EXECUTABLE &&
+ type != cmStateEnums::SHARED_LIBRARY &&
+ type != cmStateEnums::MODULE_LIBRARY) {
+ std::ostringstream e;
+ e << "Objects of target \"" << tgtName
+ << "\" referenced but is not one of the allowed target types "
+ << "(EXECUTABLE, SHARED, MODULE).";
+ reportError(context, content->GetOriginalExpression(), e.str());
+ return std::string();
+ }
+
+ if (auto* cli = gt->GetLinkInformation(context->Config)) {
+ std::vector<std::string> dllPaths;
+ auto const& dlls = cli->GetRuntimeDLLs();
+
+ for (auto const& dll : dlls) {
+ if (auto loc = dll->MaybeGetLocation(context->Config)) {
+ dllPaths.emplace_back(*loc);
+ }
+ }
+
+ return cmJoin(dllPaths, ";");
+ }
+
+ return "";
+ }
+} targetRuntimeDllsNode;
+
static const struct CompileFeaturesNode : public cmGeneratorExpressionNode
{
CompileFeaturesNode() {} // NOLINT(modernize-use-equals-default)
@@ -2603,6 +2653,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode(
{ "TARGET_EXISTS", &targetExistsNode },
{ "TARGET_NAME_IF_EXISTS", &targetNameIfExistsNode },
{ "TARGET_GENEX_EVAL", &targetGenexEvalNode },
+ { "TARGET_RUNTIME_DLLS", &targetRuntimeDllsNode },
{ "GENEX_EVAL", &genexEvalNode },
{ "BUILD_INTERFACE", &buildInterfaceNode },
{ "INSTALL_INTERFACE", &installInterfaceNode },
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 9235faa..d3c9959 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1062,6 +1062,20 @@ const std::string& cmGeneratorTarget::GetLocation(
return location;
}
+cm::optional<std::string> cmGeneratorTarget::MaybeGetLocation(
+ std::string const& config) const
+{
+ cm::optional<std::string> location;
+ if (cmGeneratorTarget::ImportInfo const* imp = this->GetImportInfo(config)) {
+ if (!imp->Location.empty()) {
+ location = imp->Location;
+ }
+ } else {
+ location = this->GetFullPath(config, cmStateEnums::RuntimeBinaryArtifact);
+ }
+ return location;
+}
+
std::vector<cmCustomCommand> const& cmGeneratorTarget::GetPreBuildCommands()
const
{
@@ -2648,8 +2662,12 @@ void cmGeneratorTarget::ComputeLinkClosure(const std::string& config,
LinkClosure linkClosure;
linkClosure.LinkerLanguage = this->LinkerLanguage;
+ bool hasHardCodedLinkerLanguage = this->Target->GetProperty("HAS_CXX") ||
+ !this->Target->GetSafeProperty("LINKER_LANGUAGE").empty();
+
// Get languages built in this target.
- secondPass = this->ComputeLinkClosure(config, linkClosure, false);
+ secondPass = this->ComputeLinkClosure(config, linkClosure, false) &&
+ !hasHardCodedLinkerLanguage;
this->LinkerLanguage = linkClosure.LinkerLanguage;
if (!secondPass) {
lc = std::move(linkClosure);
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 8fe70ab..2935e0b 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -14,6 +14,8 @@
#include <utility>
#include <vector>
+#include <cm/optional>
+
#include "cmLinkItem.h"
#include "cmListFileCache.h"
#include "cmPolicies.h"
@@ -50,6 +52,9 @@ public:
bool CanCompileSources() const;
const std::string& GetLocation(const std::string& config) const;
+ /** Get the full path to the target's main artifact, if known. */
+ cm::optional<std::string> MaybeGetLocation(std::string const& config) const;
+
std::vector<cmCustomCommand> const& GetPreBuildCommands() const;
std::vector<cmCustomCommand> const& GetPreLinkCommands() const;
std::vector<cmCustomCommand> const& GetPostBuildCommands() const;
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index fcdfc50..b19212e 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -108,9 +108,9 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
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);
+ cmTarget* tgt = lg.AddUtilityCommand(
+ CMAKE_CHECK_BUILD_SYSTEM_TARGET, false, no_working_directory,
+ no_byproducts, no_depends, no_commands, cmPolicies::NEW);
auto ptr = cm::make_unique<cmGeneratorTarget>(tgt, &lg);
auto gt = ptr.get();
@@ -160,10 +160,11 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
std::vector<std::string> byproducts;
byproducts.push_back(cm->GetGlobVerifyStamp());
- lg.AddCustomCommandToTarget(
- CMAKE_CHECK_BUILD_SYSTEM_TARGET, byproducts, no_depends,
- verifyCommandLines, cmCustomCommandType::PRE_BUILD,
- "Checking File Globs", no_working_directory, stdPipesUTF8);
+ lg.AddCustomCommandToTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET, byproducts,
+ no_depends, verifyCommandLines,
+ cmCustomCommandType::PRE_BUILD,
+ "Checking File Globs", no_working_directory,
+ cmPolicies::NEW, stdPipesUTF8);
// Ensure ZERO_CHECK always runs in Visual Studio using MSBuild,
// otherwise the prebuild command will not be run.
@@ -195,8 +196,8 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
if (cmSourceFile* file = lg.AddCustomCommandToOutput(
stamps, no_byproducts, listFiles, no_main_dependency,
no_implicit_depends, commandLines, "Checking Build System",
- no_working_directory, true, false, false, false, "", "",
- stdPipesUTF8)) {
+ no_working_directory, cmPolicies::NEW, true, false, false, false, "",
+ "", stdPipesUTF8)) {
gt->AddSource(file->ResolveFullPath());
} else {
cmSystemTools::Error("Error adding rule for " + stamps[0]);
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 001d876..c23ee94 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -200,7 +200,7 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
// considered always out of date.
cmTarget* allBuild = gen[0]->AddUtilityCommand(
"ALL_BUILD", true, no_working_dir, no_byproducts, no_depends,
- no_commands, false, "Build all projects");
+ no_commands, cmPolicies::NEW, false, "Build all projects");
gen[0]->AddGeneratorTarget(
cm::make_unique<cmGeneratorTarget>(allBuild, gen[0]));
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 891f37b..cc075de 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -620,7 +620,8 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
// Add ALL_BUILD
cmTarget* allbuild = root->AddUtilityCommand(
"ALL_BUILD", true, no_working_directory, no_byproducts, no_depends,
- cmMakeSingleCommandLine({ "echo", "Build all projects" }));
+ cmMakeSingleCommandLine({ "echo", "Build all projects" }),
+ cmPolicies::NEW);
root->AddGeneratorTarget(cm::make_unique<cmGeneratorTarget>(allbuild, root));
@@ -646,10 +647,10 @@ 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 }));
+ cmTarget* check = root->AddUtilityCommand(
+ CMAKE_CHECK_BUILD_SYSTEM_TARGET, true, no_working_directory,
+ no_byproducts, no_depends,
+ cmMakeSingleCommandLine({ "make", "-f", file }), cmPolicies::NEW);
root->AddGeneratorTarget(cm::make_unique<cmGeneratorTarget>(check, root));
}
@@ -678,8 +679,9 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
gen->AddCustomCommandToTarget(
target->GetName(), no_byproducts, no_depends,
legacyDependHelperCommandLines, cmCustomCommandType::POST_BUILD,
- "Depend check for xcode", legacyDependHelperDir.c_str(), true, false,
- "", "", false, cmObjectLibraryCommands::Accept);
+ "Depend check for xcode", legacyDependHelperDir.c_str(),
+ cmPolicies::NEW, true, false, "", "", false,
+ cmObjectLibraryCommands::Accept);
}
if (!this->IsExcluded(gens[0], target.get())) {
@@ -989,7 +991,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
includes, genexInterpreter.Evaluate(*cincludes, INCLUDE_DIRECTORIES),
*sf);
}
- lg->AppendFlags(flags, lg->GetIncludeFlags(includes, gtgt, lang, true));
+ lg->AppendFlags(flags,
+ lg->GetIncludeFlags(includes, gtgt, lang, std::string()));
cmXCodeObject* buildFile =
this->CreateXCodeBuildFileFromPath(sf->ResolveFullPath(), gtgt, lang, sf);
@@ -2693,7 +2696,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// GNU assembly files (#16449)
for (auto const& language : languages) {
std::string includeFlags = this->CurrentLocalGenerator->GetIncludeFlags(
- includes, gtgt, language, true, false, configName);
+ includes, gtgt, language, configName);
if (!includeFlags.empty()) {
cflags[language] += " " + includeFlags;
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index fdddb45..1bafdf7 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -4,9 +4,7 @@
#include <algorithm>
#include <cassert>
-#include <cstddef>
#include <cstdio>
-#include <cstdlib> // required for atoi
#include <functional>
#include <iterator>
#include <set>
@@ -36,6 +34,42 @@
namespace {
+bool GetIndexArg(char const* arg, int* idx, cmMakefile& mf)
+{
+ long value;
+ if (!cmStrToLong(arg, &value)) {
+ switch (mf.GetPolicyStatus(cmPolicies::CMP0121)) {
+ case cmPolicies::WARN: {
+ // Default is to warn and use old behavior OLD behavior is to allow
+ // compatibility, so issue a warning and use the previous behavior.
+ std::string warn =
+ cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0121),
+ " Invalid list index \"", arg, "\".");
+ mf.IssueMessage(MessageType::AUTHOR_WARNING, warn);
+ break;
+ }
+ case cmPolicies::OLD:
+ // OLD behavior is to allow compatibility, so just ignore the
+ // situation.
+ break;
+ case cmPolicies::NEW:
+ return false;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ std::string msg =
+ cmStrCat(cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0121),
+ " Invalid list index \"", arg, "\".");
+ mf.IssueMessage(MessageType::FATAL_ERROR, msg);
+ break;
+ }
+ }
+
+ // Truncation is happening here, but it had always been happening here.
+ *idx = static_cast<int>(value);
+
+ return true;
+}
+
bool FilterRegex(std::vector<std::string> const& args, bool includeMatches,
std::string const& listName,
std::vector<std::string>& varArgsExpanded,
@@ -154,7 +188,11 @@ bool HandleGetCommand(std::vector<std::string> const& args,
const char* sep = "";
size_t nitem = varArgsExpanded.size();
for (cc = 2; cc < args.size() - 1; cc++) {
- int item = atoi(args[cc].c_str());
+ int item;
+ if (!GetIndexArg(args[cc].c_str(), &item, status.GetMakefile())) {
+ status.SetError(cmStrCat("index: ", args[cc], " is not a valid index"));
+ return false;
+ }
value += sep;
sep = ";";
if (item < 0) {
@@ -362,7 +400,11 @@ bool HandleInsertCommand(std::vector<std::string> const& args,
const std::string& listName = args[1];
// expand the variable
- int item = atoi(args[2].c_str());
+ int item;
+ if (!GetIndexArg(args[2].c_str(), &item, status.GetMakefile())) {
+ status.SetError(cmStrCat("index: ", args[2], " is not a valid index"));
+ return false;
+ }
std::vector<std::string> varArgsExpanded;
if ((!GetList(varArgsExpanded, listName, status.GetMakefile()) ||
varArgsExpanded.empty()) &&
@@ -1282,8 +1324,16 @@ bool HandleSublistCommand(std::vector<std::string> const& args,
return true;
}
- const int start = atoi(args[2].c_str());
- const int length = atoi(args[3].c_str());
+ int start;
+ int length;
+ if (!GetIndexArg(args[2].c_str(), &start, status.GetMakefile())) {
+ status.SetError(cmStrCat("index: ", args[2], " is not a valid index"));
+ return false;
+ }
+ if (!GetIndexArg(args[3].c_str(), &length, status.GetMakefile())) {
+ status.SetError(cmStrCat("index: ", args[3], " is not a valid index"));
+ return false;
+ }
using size_type = decltype(varArgsExpanded)::size_type;
@@ -1338,7 +1388,11 @@ bool HandleRemoveAtCommand(std::vector<std::string> const& args,
std::vector<size_t> removed;
size_t nitem = varArgsExpanded.size();
for (cc = 2; cc < args.size(); ++cc) {
- int item = atoi(args[cc].c_str());
+ int item;
+ if (!GetIndexArg(args[cc].c_str(), &item, status.GetMakefile())) {
+ status.SetError(cmStrCat("index: ", args[cc], " is not a valid index"));
+ return false;
+ }
if (item < 0) {
item = static_cast<int>(nitem) + item;
}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 34b9649..79d1de0 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -838,16 +838,16 @@ cmProp cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target,
}
std::string cmLocalGenerator::ConvertToIncludeReference(
- std::string const& path, OutputFormat format, bool forceFullPaths)
+ std::string const& path, IncludePathStyle pathStyle, OutputFormat format)
{
- static_cast<void>(forceFullPaths);
+ static_cast<void>(pathStyle);
return this->ConvertToOutputForExisting(path, format);
}
std::string cmLocalGenerator::GetIncludeFlags(
- const std::vector<std::string>& includeDirs, cmGeneratorTarget* target,
- const std::string& lang, bool forceFullPaths, bool forResponseFile,
- const std::string& config)
+ std::vector<std::string> const& includeDirs, cmGeneratorTarget* target,
+ std::string const& lang, std::string const& config, bool forResponseFile,
+ IncludePathStyle pathStyle)
{
if (lang.empty()) {
return "";
@@ -923,7 +923,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
flagUsed = true;
}
std::string includePath =
- this->ConvertToIncludeReference(i, shellFormat, forceFullPaths);
+ this->ConvertToIncludeReference(i, pathStyle, shellFormat);
if (quotePaths && !includePath.empty() && includePath.front() != '\"') {
includeFlags << "\"";
}
@@ -1056,8 +1056,9 @@ 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, bool escapeOldStyle,
- bool uses_terminal, const std::string& depfile, const std::string& job_pool,
+ 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)
{
@@ -1070,7 +1071,8 @@ cmTarget* cmLocalGenerator::AddCustomCommandToTarget(
detail::AddCustomCommandToTarget(
*this, this->DirectoryBacktrace, cmCommandOrigin::Generator, t, byproducts,
depends, commandLines, type, comment, workingDir, escapeOldStyle,
- uses_terminal, depfile, job_pool, command_expand_lists, stdPipesUTF8);
+ uses_terminal, depfile, job_pool, command_expand_lists, stdPipesUTF8,
+ cmp0116);
return t;
}
@@ -1078,16 +1080,17 @@ cmTarget* cmLocalGenerator::AddCustomCommandToTarget(
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, bool replace,
- bool escapeOldStyle, bool uses_terminal, bool command_expand_lists,
- const std::string& depfile, const std::string& job_pool, bool stdPipesUTF8)
+ 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, replace, escapeOldStyle, uses_terminal,
- command_expand_lists, depfile, job_pool, stdPipesUTF8);
+ commandLines, comment, workingDir, cmp0116, replace, escapeOldStyle,
+ uses_terminal, command_expand_lists, depfile, job_pool, stdPipesUTF8);
}
cmSourceFile* cmLocalGenerator::AddCustomCommandToOutput(
@@ -1096,9 +1099,9 @@ cmSourceFile* cmLocalGenerator::AddCustomCommandToOutput(
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)
+ 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)
{
// Make sure there is at least one output.
if (outputs.empty()) {
@@ -1110,16 +1113,16 @@ cmSourceFile* cmLocalGenerator::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);
+ command_expand_lists, depfile, job_pool, stdPipesUTF8, cmp0116);
}
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, bool escapeOldStyle,
- const char* comment, bool uses_terminal, bool command_expand_lists,
- const std::string& job_pool, bool stdPipesUTF8)
+ 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* target =
this->Makefile->AddNewUtilityTarget(utilityName, excludeFromAll);
@@ -1132,7 +1135,7 @@ cmTarget* cmLocalGenerator::AddUtilityCommand(
detail::AddUtilityCommand(
*this, this->DirectoryBacktrace, cmCommandOrigin::Generator, target,
workingDir, byproducts, depends, commandLines, escapeOldStyle, comment,
- uses_terminal, command_expand_lists, job_pool, stdPipesUTF8);
+ uses_terminal, command_expand_lists, job_pool, stdPipesUTF8, cmp0116);
return target;
}
@@ -2698,8 +2701,9 @@ void cmLocalGenerator::CopyPchCompilePdb(
}
file << "foreach(retry RANGE 1 30)\n";
- file << " if (EXISTS \"" << from_file << "\" AND \"" << from_file
- << " \" IS_NEWER_THAN \"" << dest_file << "\")\n";
+ file << " if (EXISTS \"" << from_file << "\" AND (NOT EXISTS \""
+ << dest_file << "\" OR NOT \"" << dest_file << " \" IS_NEWER_THAN \""
+ << from_file << "\"))\n";
file << " execute_process(COMMAND ${CMAKE_COMMAND} -E copy";
file << " \"" << from_file << "\""
<< " \"" << to_dir << "\" RESULT_VARIABLE result "
@@ -2739,6 +2743,7 @@ void cmLocalGenerator::CopyPchCompilePdb(
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;
@@ -2748,14 +2753,15 @@ void cmLocalGenerator::CopyPchCompilePdb(
if (this->GetGlobalGenerator()->IsVisualStudio()) {
this->AddCustomCommandToTarget(
target->GetName(), outputs, no_deps, commandLines,
- cmCustomCommandType::PRE_BUILD, no_message, no_current_dir, true, false,
- "", "", false, cmObjectLibraryCommands::Accept, stdPipesUTF8);
+ cmCustomCommandType::PRE_BUILD, no_message, no_current_dir, cmp0116_new,
+ true, false, "", "", false, cmObjectLibraryCommands::Accept,
+ stdPipesUTF8);
} 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, false, true, false, false, "",
- "", stdPipesUTF8);
+ commandLines, no_message, no_current_dir, cmp0116_new, false, true,
+ false, false, "", "", stdPipesUTF8);
if (copy_rule) {
target->AddSource(copy_rule->ResolveFullPath());
@@ -3960,7 +3966,8 @@ cmSourceFile* AddCustomCommand(
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)
+ const std::string& job_pool, bool stdPipesUTF8,
+ cmPolicies::PolicyStatus cmp0116)
{
cmMakefile* mf = lg.GetMakefile();
@@ -4032,6 +4039,7 @@ cmSourceFile* AddCustomCommand(
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,
@@ -4076,7 +4084,8 @@ void AddCustomCommandToTarget(cmLocalGenerator& lg,
const char* workingDir, bool escapeOldStyle,
bool uses_terminal, const std::string& depfile,
const std::string& job_pool,
- bool command_expand_lists, bool stdPipesUTF8)
+ bool command_expand_lists, bool stdPipesUTF8,
+ cmPolicies::PolicyStatus cmp0116)
{
// Add the command to the appropriate build step for the target.
std::vector<std::string> no_output;
@@ -4088,6 +4097,7 @@ void AddCustomCommandToTarget(cmLocalGenerator& lg,
cc.SetCommandExpandLists(command_expand_lists);
cc.SetDepfile(depfile);
cc.SetJobPool(job_pool);
+ cc.SetCMP0116Status(cmp0116);
switch (type) {
case cmCustomCommandType::PRE_BUILD:
target->AddPreBuildCommand(std::move(cc));
@@ -4112,13 +4122,14 @@ cmSourceFile* AddCustomCommandToOutput(
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)
+ const std::string& job_pool, bool stdPipesUTF8,
+ cmPolicies::PolicyStatus cmp0116)
{
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);
+ job_pool, stdPipesUTF8, cmp0116);
}
void AppendCustomCommandToOutput(cmLocalGenerator& lg,
@@ -4169,7 +4180,8 @@ void AddUtilityCommand(cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
const cmCustomCommandLines& commandLines,
bool escapeOldStyle, const char* comment,
bool uses_terminal, bool command_expand_lists,
- const std::string& job_pool, bool stdPipesUTF8)
+ const std::string& job_pool, bool stdPipesUTF8,
+ cmPolicies::PolicyStatus cmp0116)
{
// Use an empty comment to avoid generation of default comment.
if (!comment) {
@@ -4186,7 +4198,7 @@ void AddUtilityCommand(cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
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);
+ /*depfile=*/"", job_pool, stdPipesUTF8, cmp0116);
if (rule) {
lg.AddTargetByproducts(target, byproducts, lfbt, origin);
}
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 7105a6f..f597120 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -171,13 +171,19 @@ public:
cmGeneratorTarget* target,
const std::string& config,
const std::string& lang);
+
+ enum class IncludePathStyle
+ {
+ Default,
+ Absolute,
+ };
+
//! Get the include flags for the current makefile and language
- std::string GetIncludeFlags(const std::vector<std::string>& includes,
- cmGeneratorTarget* target,
- const std::string& lang,
- bool forceFullPaths = false,
- bool forResponseFile = false,
- const std::string& config = "");
+ 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);
using GeneratorTargetVector =
std::vector<std::unique_ptr<cmGeneratorTarget>>;
@@ -256,11 +262,6 @@ public:
bool GetRealDependency(const std::string& name, const std::string& config,
std::string& dep);
- virtual std::string ConvertToIncludeReference(
- std::string const& path,
- cmOutputConverter::OutputFormat format = cmOutputConverter::SHELL,
- bool forceFullPaths = false);
-
/** Called from command-line hook to clear dependencies. */
virtual void ClearDependencies(cmMakefile* /* mf */, bool /* verbose */) {}
@@ -324,7 +325,8 @@ public:
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, bool escapeOldStyle = true,
+ 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,
@@ -337,7 +339,8 @@ public:
const std::string& output, const std::vector<std::string>& depends,
const std::string& main_dependency,
const cmCustomCommandLines& commandLines, const char* comment,
- const char* workingDir, bool replace = false, bool escapeOldStyle = true,
+ 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);
@@ -348,7 +351,8 @@ public:
const std::string& main_dependency,
const cmImplicitDependsList& implicit_depends,
const cmCustomCommandLines& commandLines, const char* comment,
- const char* workingDir, bool replace = false, bool escapeOldStyle = true,
+ 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);
@@ -361,10 +365,10 @@ public:
const std::string& utilityName, bool excludeFromAll,
const char* workingDir, const std::vector<std::string>& byproducts,
const std::vector<std::string>& depends,
- const cmCustomCommandLines& commandLines, bool escapeOldStyle = true,
- const char* comment = nullptr, bool uses_terminal = false,
- bool command_expand_lists = false, const std::string& job_pool = "",
- bool stdPipesUTF8 = false);
+ 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);
virtual std::string CreateUtilityOutput(
std::string const& targetName, std::vector<std::string> const& byproducts,
@@ -554,6 +558,13 @@ public:
cmProp 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.
+ virtual std::string ConvertToIncludeReference(
+ std::string const& path, IncludePathStyle pathStyle,
+ cmOutputConverter::OutputFormat format);
+
//! put all the libraries for a target on into the given stream
void OutputLinkLibraries(cmComputeLinkInformation* pcli,
cmLinkLineComputer* linkLineComputer,
@@ -686,7 +697,8 @@ void AddCustomCommandToTarget(cmLocalGenerator& lg,
const char* workingDir, bool escapeOldStyle,
bool uses_terminal, const std::string& depfile,
const std::string& job_pool,
- bool command_expand_lists, bool stdPipesUTF8);
+ bool command_expand_lists, bool stdPipesUTF8,
+ cmPolicies::PolicyStatus cmp0116);
cmSourceFile* AddCustomCommandToOutput(
cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
@@ -697,7 +709,8 @@ cmSourceFile* AddCustomCommandToOutput(
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);
+ const std::string& job_pool, bool stdPipesUTF8,
+ cmPolicies::PolicyStatus cmp0116);
void AppendCustomCommandToOutput(cmLocalGenerator& lg,
const cmListFileBacktrace& lfbt,
@@ -714,7 +727,8 @@ void AddUtilityCommand(cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
const cmCustomCommandLines& commandLines,
bool escapeOldStyle, const char* comment,
bool uses_terminal, bool command_expand_lists,
- const std::string& job_pool, bool stdPipesUTF8);
+ const std::string& job_pool, bool stdPipesUTF8,
+ cmPolicies::PolicyStatus cmp0116);
std::vector<std::string> ComputeISPCObjectSuffixes(cmGeneratorTarget* target);
std::vector<std::string> ComputeISPCExtraObjects(
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index b8ad1a0..64ff579 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -202,10 +202,10 @@ cmGlobalNinjaGenerator* cmLocalNinjaGenerator::GetGlobalNinjaGenerator()
// Virtual protected methods.
std::string cmLocalNinjaGenerator::ConvertToIncludeReference(
- std::string const& path, cmOutputConverter::OutputFormat format,
- bool forceFullPaths)
+ std::string const& path, IncludePathStyle pathStyle,
+ cmOutputConverter::OutputFormat format)
{
- if (forceFullPaths) {
+ if (pathStyle == IncludePathStyle::Absolute) {
return this->ConvertToOutputFormat(
cmSystemTools::CollapseFullPath(path, this->GetCurrentBinaryDirectory()),
format);
@@ -658,7 +658,7 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
std::string depfile = cc->GetDepfile();
if (!depfile.empty()) {
- switch (this->GetPolicyStatus(cmPolicies::CMP0116)) {
+ switch (cc->GetCMP0116Status()) {
case cmPolicies::WARN:
if (this->GetCurrentBinaryDirectory() !=
this->GetBinaryDirectory() ||
@@ -772,7 +772,7 @@ cmLocalNinjaGenerator::MakeCustomCommandGenerators(
cmGlobalNinjaGenerator const* gg = this->GetGlobalNinjaGenerator();
bool transformDepfile = false;
- switch (this->GetPolicyStatus(cmPolicies::CMP0116)) {
+ switch (cc.GetCMP0116Status()) {
case cmPolicies::OLD:
case cmPolicies::WARN:
break;
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index 5b850f3..8b6824f 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -12,6 +12,7 @@
#include "cmListFileCache.h"
#include "cmLocalCommonGenerator.h"
+#include "cmLocalGenerator.h"
#include "cmNinjaTypes.h"
#include "cmOutputConverter.h"
@@ -91,9 +92,8 @@ public:
protected:
std::string ConvertToIncludeReference(
- std::string const& path,
- cmOutputConverter::OutputFormat format = cmOutputConverter::SHELL,
- bool forceFullPaths = false) override;
+ std::string const& path, IncludePathStyle pathStyle,
+ cmOutputConverter::OutputFormat format) override;
private:
cmGeneratedFileStream& GetImplFileStream(const std::string& config) const;
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 97869c2..a3940ea 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -121,7 +121,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
}
if (cmSourceFile* file = this->AddCustomCommandToOutput(
force, no_depends, no_main_dependency, force_commands, " ",
- nullptr, true)) {
+ nullptr, cmPolicies::NEW, true)) {
l->AddSource(file->ResolveFullPath());
}
}
@@ -245,9 +245,10 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
"--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, true, false, false, false, "", "", stdPipesUTF8);
+ this->AddCustomCommandToOutput(stampName, listFiles, makefileIn,
+ commandLines, comment.c_str(),
+ no_working_directory, cmPolicies::NEW, true,
+ false, false, false, "", "", stdPipesUTF8);
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/cmMakefile.cxx b/Source/cmMakefile.cxx
index b3bab04..e156625 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1085,8 +1085,9 @@ 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, bool escapeOldStyle,
- bool uses_terminal, const std::string& depfile, const std::string& job_pool,
+ 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)
{
cmTarget* t = this->GetCustomCommandTarget(
@@ -1112,7 +1113,7 @@ cmTarget* cmMakefile::AddCustomCommandToTarget(
lg, lfbt, cmCommandOrigin::Project, t, byproducts, depends,
commandLines, type, GetCStrOrNull(commentStr),
GetCStrOrNull(workingStr), escapeOldStyle, uses_terminal, depfile,
- job_pool, command_expand_lists, stdPipesUTF8);
+ job_pool, command_expand_lists, stdPipesUTF8, cmp0116);
});
return t;
@@ -1122,16 +1123,18 @@ 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,
- const CommandSourceCallback& callback, bool replace, bool escapeOldStyle,
- bool uses_terminal, bool command_expand_lists, const std::string& depfile,
+ 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, callback, replace, escapeOldStyle,
- uses_terminal, command_expand_lists, depfile, job_pool, stdPipesUTF8);
+ commandLines, comment, workingDir, cmp0116, callback, replace,
+ escapeOldStyle, uses_terminal, command_expand_lists, depfile, job_pool,
+ stdPipesUTF8);
}
void cmMakefile::AddCustomCommandToOutput(
@@ -1140,9 +1143,10 @@ void cmMakefile::AddCustomCommandToOutput(
const std::vector<std::string>& depends, const std::string& main_dependency,
const cmImplicitDependsList& implicit_depends,
const cmCustomCommandLines& commandLines, const char* comment,
- const char* workingDir, 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 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)
{
// Make sure there is at least one output.
if (outputs.empty()) {
@@ -1172,7 +1176,7 @@ void cmMakefile::AddCustomCommandToOutput(
main_dependency, implicit_depends, commandLines,
GetCStrOrNull(commentStr), GetCStrOrNull(workingStr), replace,
escapeOldStyle, uses_terminal, command_expand_lists, depfile, job_pool,
- stdPipesUTF8);
+ stdPipesUTF8, cmp0116);
if (callback && sf) {
callback(sf);
}
@@ -1182,7 +1186,8 @@ 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)
+ const cmCustomCommandLines& commandLines, const char* comment,
+ cmPolicies::PolicyStatus cmp0116)
{
// Translate the old-style signature to one of the new-style
// signatures.
@@ -1193,7 +1198,7 @@ void cmMakefile::AddCustomCommandOldStyle(
std::vector<std::string> no_byproducts;
this->AddCustomCommandToTarget(
target, no_byproducts, depends, commandLines,
- cmCustomCommandType::POST_BUILD, comment, nullptr);
+ cmCustomCommandType::POST_BUILD, comment, nullptr, cmp0116);
return;
}
@@ -1226,7 +1231,8 @@ void cmMakefile::AddCustomCommandOldStyle(
// 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, addRuleFileToTarget);
+ comment, nullptr, cmp0116,
+ addRuleFileToTarget);
}
} else {
std::string no_main_dependency;
@@ -1236,7 +1242,7 @@ void cmMakefile::AddCustomCommandOldStyle(
// 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,
+ commandLines, comment, nullptr, cmp0116,
addRuleFileToTarget);
}
}
@@ -1263,9 +1269,9 @@ 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, bool escapeOldStyle,
- const char* comment, bool uses_terminal, bool command_expand_lists,
- const std::string& job_pool, bool stdPipesUTF8)
+ 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* target = this->AddNewUtilityTarget(utilityName, excludeFromAll);
@@ -1286,11 +1292,11 @@ cmTarget* cmMakefile::AddUtilityCommand(
this->AddGeneratorAction(
[=](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt) {
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);
+ detail::AddUtilityCommand(
+ lg, lfbt, cmCommandOrigin::Project, target, GetCStrOrNull(workingStr),
+ byproducts, depends, commandLines, escapeOldStyle,
+ GetCStrOrNull(commentStr), uses_terminal, command_expand_lists,
+ job_pool, stdPipesUTF8, cmp0116);
});
return target;
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 6341abc..71d765c 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -169,7 +169,8 @@ public:
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, bool escapeOldStyle = true,
+ 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);
@@ -186,11 +187,11 @@ public:
const std::string& output, const std::vector<std::string>& depends,
const std::string& main_dependency,
const cmCustomCommandLines& commandLines, const char* comment,
- const char* workingDir, 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 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,
@@ -198,17 +199,18 @@ public:
const std::string& main_dependency,
const cmImplicitDependsList& implicit_depends,
const cmCustomCommandLines& commandLines, const char* comment,
- const char* workingDir, 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 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 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);
+ const char* comment,
+ cmPolicies::PolicyStatus cmp0116);
void AppendCustomCommandToOutput(
const std::string& output, const std::vector<std::string>& depends,
const cmImplicitDependsList& implicit_depends,
@@ -250,10 +252,10 @@ public:
const std::string& utilityName, bool excludeFromAll,
const char* workingDir, const std::vector<std::string>& byproducts,
const std::vector<std::string>& depends,
- const cmCustomCommandLines& commandLines, bool escapeOldStyle = true,
- const char* comment = nullptr, bool uses_terminal = false,
- bool command_expand_lists = false, const std::string& job_pool = "",
- bool stdPipesUTF8 = false);
+ 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);
/**
* Add a subdirectory to the build.
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 4918bf6..fa469ed 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -854,7 +854,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
vars.Defines = definesString.c_str();
std::string includesString = this->LocalGenerator->GetIncludeFlags(
- includes, this->GeneratorTarget, lang, true, false, config);
+ includes, this->GeneratorTarget, lang, config);
this->LocalGenerator->AppendFlags(includesString,
"$(" + lang + "_INCLUDES)");
vars.Includes = includesString.c_str();
@@ -2195,8 +2195,8 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
lang, this->GetConfigName());
std::string includeFlags = this->LocalGenerator->GetIncludeFlags(
- includes, this->GeneratorTarget, lang, false, useResponseFile,
- this->GetConfigName());
+ includes, this->GeneratorTarget, lang, this->GetConfigName(),
+ useResponseFile);
if (includeFlags.empty()) {
return;
}
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 672b579..2e0ffdb 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -263,9 +263,10 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags,
language, config);
// Add include directory flags.
std::string includeFlags = this->LocalGenerator->GetIncludeFlags(
- includes, this->GeneratorTarget, language,
- language == "RC", // full include paths for RC needed by cmcldeps
- false, config);
+ includes, this->GeneratorTarget, language, config, false,
+ // full include paths for RC needed by cmcldeps
+ language == "RC" ? cmLocalGenerator::IncludePathStyle::Absolute
+ : cmLocalGenerator::IncludePathStyle::Default);
if (this->GetGlobalGenerator()->IsGCCOnWindows()) {
std::replace(includeFlags.begin(), includeFlags.end(), '\\', '/');
}
@@ -324,7 +325,8 @@ std::string cmNinjaTargetGenerator::ComputeIncludes(
}
std::string includesString = this->LocalGenerator->GetIncludeFlags(
- includes, this->GeneratorTarget, language, true, false, config);
+ includes, this->GeneratorTarget, language, config, false,
+ cmLocalGenerator::IncludePathStyle::Absolute);
this->LocalGenerator->AppendFlags(includesString,
this->GetIncludes(language, config));
@@ -1379,8 +1381,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
cmSystemTools::GetParentDirectory(source->GetFullPath()));
std::string sourceDirectoryFlag = this->LocalGenerator->GetIncludeFlags(
- sourceDirectory, this->GeneratorTarget, language, false, false,
- config);
+ sourceDirectory, this->GeneratorTarget, language, config, false,
+ cmLocalGenerator::IncludePathStyle::Default);
vars["INCLUDES"] = cmStrCat(sourceDirectoryFlag, ' ', vars["INCLUDES"]);
}
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 2194b0f..9295a3f 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -359,7 +359,10 @@ class cmMakefile;
3, 20, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0120, \
"The WriteCompilerDetectionHeader module is removed.", 3, 20, 0, \
- cmPolicies::WARN)
+ cmPolicies::WARN) \
+ SELECT(POLICY, CMP0121, \
+ "The list() command now validates parsing of index arguments.", 3, \
+ 21, 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/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx
index e058176..e9670f9 100644
--- a/Source/cmQTWrapCPPCommand.cxx
+++ b/Source/cmQTWrapCPPCommand.cxx
@@ -5,6 +5,7 @@
#include "cmCustomCommandLines.h"
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
+#include "cmPolicies.h"
#include "cmProperty.h"
#include "cmRange.h"
#include "cmSourceFile.h"
@@ -73,9 +74,9 @@ bool cmQTWrapCPPCommand(std::vector<std::string> const& args,
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.AddCustomCommandToOutput(
+ newName, depends, no_main_dependency, commandLines, "Qt Wrapped File",
+ no_working_dir, mf.GetPolicyStatus(cmPolicies::CMP0116));
}
}
diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx
index 66c0228..f98f0b3 100644
--- a/Source/cmQTWrapUICommand.cxx
+++ b/Source/cmQTWrapUICommand.cxx
@@ -5,6 +5,7 @@
#include "cmCustomCommandLines.h"
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
+#include "cmPolicies.h"
#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmStringAlgorithms.h"
@@ -87,16 +88,19 @@ bool cmQTWrapUICommand(std::vector<std::string> const& args,
const char* no_comment = nullptr;
const char* no_working_dir = nullptr;
mf.AddCustomCommandToOutput(hName, depends, no_main_dependency,
- hCommandLines, no_comment, no_working_dir);
+ hCommandLines, no_comment, no_working_dir,
+ mf.GetPolicyStatus(cmPolicies::CMP0116));
depends.push_back(hName);
mf.AddCustomCommandToOutput(cxxName, depends, no_main_dependency,
- cxxCommandLines, no_comment, no_working_dir);
+ cxxCommandLines, no_comment, no_working_dir,
+ mf.GetPolicyStatus(cmPolicies::CMP0116));
depends.clear();
depends.push_back(hName);
mf.AddCustomCommandToOutput(mocName, depends, no_main_dependency,
- mocCommandLines, no_comment, no_working_dir);
+ mocCommandLines, no_comment, no_working_dir,
+ mf.GetPolicyStatus(cmPolicies::CMP0116));
}
}
diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx
index 62b879f..f79ffd4 100644
--- a/Source/cmQtAutoGenGlobalInitializer.cxx
+++ b/Source/cmQtAutoGenGlobalInitializer.cxx
@@ -13,6 +13,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmPolicies.h"
#include "cmProcessOutput.h"
#include "cmProperty.h"
#include "cmQtAutoGen.h"
@@ -167,9 +168,10 @@ void cmQtAutoGenGlobalInitializer::GetOrCreateGlobalTarget(
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, false, comment.c_str());
+ no_depends, no_commands, cmp0116_new, false, comment.c_str());
localGen->AddGeneratorTarget(
cm::make_unique<cmGeneratorTarget>(target, localGen));
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index bfe174c..450a0cd 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -30,7 +30,6 @@
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
-#include "cmGlobalNinjaGenerator.h"
#include "cmLinkItem.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
@@ -939,6 +938,30 @@ bool cmQtAutoGenInitializer::InitScanFiles()
if (!uicOpts.empty()) {
this->Uic.UiFiles.emplace_back(fullPath, cmExpandedList(uicOpts));
}
+
+ auto uiHeaderRelativePath = cmSystemTools::RelativePath(
+ this->LocalGen->GetCurrentSourceDirectory(),
+ cmSystemTools::GetFilenamePath(fullPath));
+
+ auto uiHeaderFilePath = cmStrCat(
+ '/', uiHeaderRelativePath, '/', "ui_"_s,
+ cmSystemTools::GetFilenameWithoutLastExtension(fullPath), ".h"_s);
+
+ ConfigString uiHeader;
+ uiHeader.Default =
+ cmStrCat(this->Dir.Build, "/include"_s, uiHeaderFilePath);
+ auto uiHeaderGenex = uiHeader.Default;
+ if (this->MultiConfig) {
+ uiHeaderGenex = cmStrCat(this->Dir.Build, "/include_$<CONFIG>"_s,
+ uiHeaderFilePath);
+ for (std::string const& cfg : this->ConfigsList) {
+ uiHeader.Config[cfg] = cmStrCat(this->Dir.Build, "/include_"_s,
+ cfg, uiHeaderFilePath);
+ }
+ }
+
+ this->Uic.UiHeaders.emplace_back(
+ std::make_pair(uiHeader, uiHeaderGenex));
} else {
// Register skipped .ui file
this->Uic.SkipUi.insert(fullPath);
@@ -1092,6 +1115,13 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
autogenByproducts.push_back(this->Moc.CompilationFileGenex);
}
+ if (this->Uic.Enabled) {
+ for (const auto& file : this->Uic.UiHeaders) {
+ this->AddGeneratedSource(file.first, this->Uic);
+ autogenByproducts.push_back(file.second);
+ }
+ }
+
// Compose target comment
std::string autogenComment;
{
@@ -1226,7 +1256,8 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
cmTarget* timestampTarget = this->LocalGen->AddUtilityCommand(
timestampTargetName, true, this->Dir.Work.c_str(),
/*byproducts=*/timestampTargetProvides,
- /*depends=*/dependencies, timestampTargetCommandLines, false, nullptr);
+ /*depends=*/dependencies, timestampTargetCommandLines, cmPolicies::NEW,
+ false, nullptr);
this->LocalGen->AddGeneratorTarget(
cm::make_unique<cmGeneratorTarget>(timestampTarget, this->LocalGen));
@@ -1257,27 +1288,8 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
const std::string outputFile =
cmStrCat(this->Dir.Build, "/", timestampFileName);
this->AutogenTarget.DepFile = cmStrCat(this->Dir.Build, "/deps");
- std::string relativeBinaryDir;
- if (dynamic_cast<cmGlobalNinjaGenerator*>(this->GlobalGen)) {
- switch (this->LocalGen->GetPolicyStatus(cmPolicies::CMP0116)) {
- case cmPolicies::OLD:
- case cmPolicies::WARN:
- relativeBinaryDir = cmSystemTools::RelativePath(
- this->LocalGen->GetBinaryDirectory(),
- this->LocalGen->GetCurrentBinaryDirectory());
- if (!relativeBinaryDir.empty()) {
- relativeBinaryDir = cmStrCat(relativeBinaryDir, "/");
- }
- break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- break;
- }
- }
this->AutogenTarget.DepFileRuleName =
- cmStrCat(relativeBinaryDir, this->GenTarget->GetName(), "_autogen/",
- timestampFileName);
+ cmStrCat(this->GenTarget->GetName(), "_autogen/", timestampFileName);
commandLines.push_back(cmMakeCommandLine(
{ cmSystemTools::GetCMakeCommand(), "-E", "touch", outputFile }));
@@ -1285,7 +1297,8 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
const std::string no_main_dependency;
this->LocalGen->AddCustomCommandToOutput(
outputFile, dependencies, no_main_dependency, commandLines,
- autogenComment.c_str(), this->Dir.Work.c_str(), /*replace=*/false,
+ 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, "",
@@ -1303,7 +1316,8 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
cmTarget* autogenTarget = this->LocalGen->AddUtilityCommand(
this->AutogenTarget.Name, true, this->Dir.Work.c_str(),
/*byproducts=*/autogenByproducts,
- /*depends=*/dependencies, commandLines, false, autogenComment.c_str());
+ /*depends=*/dependencies, commandLines, cmPolicies::NEW, false,
+ autogenComment.c_str());
// Create autogen generator target
this->LocalGen->AddGeneratorTarget(
cm::make_unique<cmGeneratorTarget>(autogenTarget, this->LocalGen));
@@ -1389,8 +1403,8 @@ bool cmQtAutoGenInitializer::InitRccTargets()
cmTarget* autoRccTarget = this->LocalGen->AddUtilityCommand(
ccName, true, this->Dir.Work.c_str(), ccOutput, ccDepends,
- commandLines, false, ccComment.c_str(), false, false, "",
- stdPipesUTF8);
+ commandLines, cmPolicies::NEW, false, ccComment.c_str(), false,
+ false, "", stdPipesUTF8);
// Create autogen generator target
this->LocalGen->AddGeneratorTarget(
@@ -1430,8 +1444,8 @@ bool cmQtAutoGenInitializer::InitRccTargets()
this->LocalGen->AddCustomCommandToOutput(
ccOutput, ccByproducts, ccDepends, no_main_dependency,
no_implicit_depends, commandLines, ccComment.c_str(),
- this->Dir.Work.c_str(), false, true, false, false, "", "",
- stdPipesUTF8);
+ this->Dir.Work.c_str(), cmPolicies::NEW, false, true, false, false,
+ "", "", stdPipesUTF8);
}
// Reconfigure when .qrc file changes
this->Makefile->AddCMakeDependFile(qrc.QrcFile);
@@ -1568,8 +1582,8 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
jval[0u] = muf->FullPath;
jval[1u] = cmStrCat(muf->MocIt ? 'M' : 'm',
muf->UicIt ? 'U' : 'u');
- jval[2u] = cfgArray(muf->Configs);
- jval[3u] = this->GetMocBuildPath(*muf);
+ jval[2u] = this->GetMocBuildPath(*muf);
+ jval[3u] = cfgArray(muf->Configs);
});
info.SetArrayArray(
"SOURCES", sources, [&cfgArray](Json::Value& jval, MUFile const* muf) {
diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h
index f7e126d..fdb65d3 100644
--- a/Source/cmQtAutoGenInitializer.h
+++ b/Source/cmQtAutoGenInitializer.h
@@ -239,6 +239,8 @@ private:
std::vector<UiFileT> UiFiles;
ConfigStrings<std::vector<std::string>> Options;
std::vector<std::string> SearchPaths;
+ std::vector<std::pair<ConfigString /*ui header*/, std::string /*genex*/>>
+ UiHeaders;
} Uic;
/** rcc variables. */
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index 75611ac..02b32dd 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -2520,8 +2520,8 @@ bool cmQtAutoMocUicT::InitFromInfo(InfoT const& info)
Json::Value const& entryName = entry[0u];
Json::Value const& entryFlags = entry[1u];
- Json::Value const& entryConfigs = entry[2u];
- Json::Value const& entryBuild = entry[3u];
+ Json::Value const& entryBuild = entry[2u];
+ Json::Value const& entryConfigs = entry[3u];
if (testEntry(entryName.isString(),
"JSON value for name is not a string.") ||
testEntry(entryFlags.isString(),
diff --git a/Source/cmStandardLevelResolver.cxx b/Source/cmStandardLevelResolver.cxx
index bf6925e..280e508 100644
--- a/Source/cmStandardLevelResolver.cxx
+++ b/Source/cmStandardLevelResolver.cxx
@@ -308,8 +308,9 @@ struct StanardLevelComputer
std::unordered_map<std::string, StanardLevelComputer> StandardComputerMapping =
{
{ "C",
- StanardLevelComputer{ "C", std::vector<int>{ 90, 99, 11 },
- std::vector<std::string>{ "90", "99", "11" } } },
+ StanardLevelComputer{
+ "C", std::vector<int>{ 90, 99, 11, 17, 23 },
+ std::vector<std::string>{ "90", "99", "11", "17", "23" } } },
{ "CXX",
StanardLevelComputer{
"CXX", std::vector<int>{ 98, 11, 14, 17, 20, 23 },
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index a93a78a..6a90675 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2413,18 +2413,20 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
// 1. We have SKIP_PRECOMPILE_HEADERS == true
// 2. We are creating the pre-compiled header
// 3. We are a different language than the linker language AND pch is
- // enabled
- const std::string pchSource =
+ // enabled.
+ std::string const& linkLanguage =
+ this->GeneratorTarget->GetLinkerLanguage(config);
+ std::string const& pchSource =
this->GeneratorTarget->GetPchSource(config, lang);
const bool skipPCH =
pchSource.empty() || sf.GetPropertyAsBool("SKIP_PRECOMPILE_HEADERS");
const bool makePCH = (sf.GetFullPath() == pchSource);
- const bool useSharedPCH =
- !skipPCH && (lang == this->GeneratorTarget->GetLinkerLanguage(config));
- const bool useDifferentLangPCH =
- !skipPCH && (lang != this->GeneratorTarget->GetLinkerLanguage(config));
+ const bool useSharedPCH = !skipPCH && (lang == linkLanguage);
+ const bool useDifferentLangPCH = !skipPCH && (lang != linkLanguage);
+ const bool useNoPCH = skipPCH && (lang != linkLanguage) &&
+ !this->GeneratorTarget->GetPchHeader(config, linkLanguage).empty();
const bool needsPCHFlags =
- (makePCH || useSharedPCH || useDifferentLangPCH);
+ (makePCH || useSharedPCH || useDifferentLangPCH || useNoPCH);
// if we have flags or defines for this config then
// use them
@@ -2471,6 +2473,8 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
if (makePCH) {
pchOptions =
this->GeneratorTarget->GetPchCreateCompileOptions(config, lang);
+ } else if (useNoPCH) {
+ clOptions.AddFlag("PrecompiledHeader", "NotUsing");
} else if (useSharedPCH) {
std::string pchHeader =
this->GeneratorTarget->GetPchHeader(config, lang);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 4b57395..7e6d5c3 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -649,7 +649,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
this->GlobalGenerator->CreateGenerationObjects();
const auto& lg = this->GlobalGenerator->LocalGenerators[0];
std::string includeFlags =
- lg->GetIncludeFlags(includeDirs, nullptr, language);
+ lg->GetIncludeFlags(includeDirs, nullptr, language, std::string());
std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS");
printf("%s %s\n", includeFlags.c_str(), definitions.c_str());
diff --git a/Source/cmake.h b/Source/cmake.h
index 82e028c..d6d129f 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -739,6 +739,8 @@ private:
F(c_std_90) \
F(c_std_99) \
F(c_std_11) \
+ F(c_std_17) \
+ F(c_std_23) \
FOR_EACH_C90_FEATURE(F) \
FOR_EACH_C99_FEATURE(F) \
FOR_EACH_C11_FEATURE(F)
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index cd3c955..88ba011 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -64,7 +64,7 @@ const char* cmDocumentationUsageNote[][2] = {
const char* cmDocumentationOptions[][2] = {
CMAKE_STANDARD_OPTIONS_TABLE,
- { "--preset=<preset>", "Specify a configure preset." },
+ { "--preset <preset>,--preset=<preset>", "Specify a configure preset." },
{ "--list-presets", "List available presets." },
{ "-E", "CMake command mode." },
{ "-L[A][H]", "List non-advanced cached variables." },
@@ -511,6 +511,7 @@ int do_build(int ac, char const* const* av)
bool hasPreset = false;
for (int i = 2; i < ac; ++i) {
if (strcmp(av[i], "--list-presets") == 0 ||
+ cmHasLiteralPrefix(av[i], "--preset=") ||
strcmp(av[i], "--preset") == 0) {
hasPreset = true;
break;
@@ -584,7 +585,7 @@ int do_build(int ac, char const* const* av)
"Usage: cmake --build [<dir> | --preset <preset>] [options] [-- [native-options]]\n"
"Options:\n"
" <dir> = Project binary directory to be built.\n"
- " --preset <preset>\n"
+ " --preset <preset>, --preset=<preset>\n"
" = Specify a build preset.\n"
" --list-presets\n"
" = List available build presets.\n"
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 5791c05..6713cc3 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -754,7 +754,6 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args,
std::string const& a = args[4];
if (cmHasLiteralPrefix(a, "--nm=")) {
deffile.SetNmPath(a.substr(5));
- std::cerr << a.substr(5) << "\n";
} else {
std::cerr << "unknown argument: " << a << "\n";
}
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 1404b0c..3c331d3 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -26,7 +26,8 @@ static const char* cmDocumentationUsage[][2] = { { nullptr,
{ nullptr, nullptr } };
static const char* cmDocumentationOptions[][2] = {
- { "--preset <preset>", "Read arguments from a test preset." },
+ { "--preset <preset>, --preset=<preset>",
+ "Read arguments from a test preset." },
{ "--list-presets", "List available test presets." },
{ "-C <cfg>, --build-config <cfg>", "Choose configuration to test." },
{ "--progress", "Enable short progress output from tests." },
diff --git a/Tests/BundleTest/BundleLib.cxx b/Tests/BundleTest/BundleLib.cxx
index b7fd70d..d25ad27 100644
--- a/Tests/BundleTest/BundleLib.cxx
+++ b/Tests/BundleTest/BundleLib.cxx
@@ -52,8 +52,8 @@ int foo(char* exec)
(void)br;
int res1 = findBundleFile(exec, "Resources/randomResourceFile.plist");
- int res2 = findBundleFile(exec, "MacOS/SomeRandomFile.txt");
- int res3 = findBundleFile(exec, "MacOS/README.rst");
+ int res2 = findBundleFile(exec, "Other/SomeRandomFile.txt");
+ int res3 = findBundleFile(exec, "Other/README.rst");
if (!res1 || !res2 || !res3) {
return 1;
}
diff --git a/Tests/BundleTest/BundleSubDir/CMakeLists.txt b/Tests/BundleTest/BundleSubDir/CMakeLists.txt
index 5f91f20..ceb5216 100644
--- a/Tests/BundleTest/BundleSubDir/CMakeLists.txt
+++ b/Tests/BundleTest/BundleSubDir/CMakeLists.txt
@@ -16,7 +16,7 @@ set_source_files_properties(
"${BundleTest_SOURCE_DIR}/SomeRandomFile.txt"
"${BundleTest_SOURCE_DIR}/../../README.rst"
PROPERTIES
- MACOSX_PACKAGE_LOCATION MacOS
+ MACOSX_PACKAGE_LOCATION Other
)
add_executable(SecondBundle
@@ -35,11 +35,7 @@ install(TARGETS SecondBundle DESTINATION Applications)
# installed into a location that uses this output name this will fail if the
# bundle does not respect the name. Also the executable will not be found by
# the test driver if this does not work.
-set_target_properties(SecondBundle PROPERTIES
- OUTPUT_NAME SecondBundleExe
- XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ""
- XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO"
- )
+set_target_properties(SecondBundle PROPERTIES OUTPUT_NAME SecondBundleExe)
# Express one app bundle in terms of another's SOURCES to verify that
# the generators do not expose the Info.plist of one to the other.
diff --git a/Tests/BundleTest/CMakeLists.txt b/Tests/BundleTest/CMakeLists.txt
index 1bedc70..c63461a 100644
--- a/Tests/BundleTest/CMakeLists.txt
+++ b/Tests/BundleTest/CMakeLists.txt
@@ -3,6 +3,15 @@ project(BundleTest)
set(MACOSX_BUNDLE_INFO_STRING "bundle_info_string")
set(CMAKE_MacOSX_Content_COMPILE_OBJECT "\"${CMAKE_COMMAND}\" -E copy_if_different <SOURCE> <OBJECT>")
+if(CMAKE_GENERATOR STREQUAL "Xcode" AND
+ "${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64")
+ # Tell Xcode to pretend the linker signed binaries so that
+ # editing with install_name_tool preserves ad-hoc signatures.
+ # See CMake Issue 21854.
+ # This option is supported by codesign on macOS 11 or higher.
+ set(CMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS "-o linker-signed")
+endif()
+
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist"
COMMAND /bin/cp
@@ -19,7 +28,7 @@ set_source_files_properties(
SomeRandomFile.txt
"${BundleTest_SOURCE_DIR}/../../README.rst"
PROPERTIES
- MACOSX_PACKAGE_LOCATION MacOS
+ MACOSX_PACKAGE_LOCATION Other
)
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/foobar")
@@ -56,11 +65,7 @@ install(TARGETS BundleTest DESTINATION Applications)
# installed into a location that uses this output name this will fail if the
# bundle does not respect the name. Also the executable will not be found by
# the test driver if this does not work.
-set_target_properties(BundleTest PROPERTIES
- OUTPUT_NAME BundleTestExe
- XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ""
- XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO"
- )
+set_target_properties(BundleTest PROPERTIES OUTPUT_NAME BundleTestExe)
# Test executable versioning if it is supported.
if(NOT XCODE)
diff --git a/Tests/BundleUtilities/CMakeLists.txt b/Tests/BundleUtilities/CMakeLists.txt
index 6020644..4a95e2f 100644
--- a/Tests/BundleUtilities/CMakeLists.txt
+++ b/Tests/BundleUtilities/CMakeLists.txt
@@ -1,6 +1,15 @@
cmake_minimum_required(VERSION 2.8.12)
project(BundleUtilities)
+if(CMAKE_GENERATOR STREQUAL "Xcode" AND
+ "${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64")
+ # Tell Xcode to pretend the linker signed binaries so that
+ # editing with install_name_tool preserves ad-hoc signatures.
+ # See CMake Issue 21854.
+ # This option is supported by codesign on macOS 11 or higher.
+ set(CMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS "-o linker-signed")
+endif()
+
###### the various types of dependencies we can have
# a shared library
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 5cb59af..987f54d 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -2955,7 +2955,7 @@ if(BUILD_TESTING)
PASS_REGULAR_EXPRESSION "Failed")
else()
set_tests_properties(CTestTestCrash PROPERTIES
- PASS_REGULAR_EXPRESSION "(Illegal|SegFault|Subprocess aborted)")
+ PASS_REGULAR_EXPRESSION "(Illegal|SegFault|Subprocess aborted|SIGTRAP)")
endif()
configure_file(
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt
index cff98e3..7771967 100644
--- a/Tests/CompileFeatures/CMakeLists.txt
+++ b/Tests/CompileFeatures/CMakeLists.txt
@@ -237,6 +237,8 @@ if (C_expected_features)
if (std_flag_idx EQUAL -1)
add_executable(default_dialect_C default_dialect.c)
target_compile_definitions(default_dialect_C PRIVATE
+ DEFAULT_C23=$<EQUAL:${CMAKE_C_STANDARD_DEFAULT},23>
+ DEFAULT_C17=$<EQUAL:${CMAKE_C_STANDARD_DEFAULT},17>
DEFAULT_C11=$<EQUAL:${CMAKE_C_STANDARD_DEFAULT},11>
DEFAULT_C99=$<EQUAL:${CMAKE_C_STANDARD_DEFAULT},99>
DEFAULT_C90=$<EQUAL:${CMAKE_C_STANDARD_DEFAULT},90>
diff --git a/Tests/CompileFeatures/default_dialect.c b/Tests/CompileFeatures/default_dialect.c
index 6160c2f..b990e53 100644
--- a/Tests/CompileFeatures/default_dialect.c
+++ b/Tests/CompileFeatures/default_dialect.c
@@ -1,5 +1,13 @@
-#if DEFAULT_C11
+#if DEFAULT_C23
+# if __STDC_VERSION__ <= 201710L
+# error Unexpected value for __STDC_VERSION__.
+# endif
+#elif DEFAULT_C17
+# if __STDC_VERSION__ < 201710L
+# error Unexpected value for __STDC_VERSION__.
+# endif
+#elif DEFAULT_C11
# if __STDC_VERSION__ < 201112L
# error Unexpected value for __STDC_VERSION__.
# endif
diff --git a/Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt b/Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt
new file mode 100644
index 0000000..1f636af
--- /dev/null
+++ b/Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt
@@ -0,0 +1,102 @@
+cmake_minimum_required(VERSION 3.17)
+project(RerunUicOnFileChange)
+include("../AutogenGuiTest.cmake")
+
+# Utility variables
+set(testProjectTemplateDir "${CMAKE_CURRENT_SOURCE_DIR}/UicOnFileChange")
+set(testProjectSrc "${CMAKE_CURRENT_BINARY_DIR}/UicOnFileChange")
+set(testProjectBinDir "${CMAKE_CURRENT_BINARY_DIR}/UicOnFileChange-build")
+
+set(TEST_CONFIG "Release")
+
+macro(sleep)
+ message(STATUS "Sleeping for a few seconds.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+endmacro()
+macro(rebuild buildName)
+ message(STATUS "Starting build ${buildName}.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build . --config "${TEST_CONFIG}"
+ WORKING_DIRECTORY "${testProjectBinDir}" RESULT_VARIABLE result
+ )
+ if (result)
+ message(FATAL_ERROR "Build ${buildName} failed.")
+ else()
+ message(STATUS "Build ${buildName} finished.")
+ endif()
+endmacro()
+
+configure_file("${testProjectTemplateDir}/mocwidget.h" "${testProjectSrc}/mocwidget.h" COPYONLY)
+configure_file("${testProjectTemplateDir}/main.cpp" "${testProjectSrc}/main.cpp" COPYONLY)
+configure_file("${testProjectTemplateDir}/CMakeLists.txt.in" "${testProjectSrc}/CMakeLists.txt" @ONLY)
+
+set(Num 1)
+configure_file("${testProjectTemplateDir}/mainwindow.ui.in" "${testProjectSrc}/mainwindow.ui" @ONLY)
+
+if(CMAKE_GENERATOR_INSTANCE)
+ set(_D_CMAKE_GENERATOR_INSTANCE "-DCMAKE_GENERATOR_INSTANCE=${CMAKE_GENERATOR_INSTANCE}")
+else()
+ set(_D_CMAKE_GENERATOR_INSTANCE "")
+endif()
+
+get_property(is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+if(is_multi)
+ set(build_type_extra "-DCMAKE_CONFIGURATION_TYPES=${TEST_CONFIG}")
+ set(extra_bin_path "${TEST_CONFIG}/")
+else()
+ set(build_type_extra "-DCMAKE_BUILD_TYPE=${TEST_CONFIG}")
+endif()
+
+# Set the environment PATH/LD_LIBRARY_PATH variables to run the resulting executable
+if(WIN32 AND TARGET ${QT_QTCORE_TARGET})
+ get_target_property(qtcore_path ${QT_QTCORE_TARGET} LOCATION)
+ if(NOT qtcore_path)
+ get_target_property(qtcore_path ${QT_QTCORE_TARGET} IMPORTED_LOCATION)
+ endif()
+ get_filename_component(qtcore_path "${qtcore_path}" DIRECTORY)
+ set(ENV{PATH} "${qtcore_path};$ENV{PATH}")
+endif()
+
+execute_process(
+ COMMAND "${CMAKE_COMMAND}" -B "${testProjectBinDir}" -S "${testProjectSrc}"
+ -G "${CMAKE_GENERATOR}"
+ -A "${CMAKE_GENERATOR_PLATFORM}"
+ -T "${CMAKE_GENERATOR_TOOLSET}"
+ ${_D_CMAKE_GENERATOR_INSTANCE}
+ "${build_type_extra}"
+ "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
+ "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
+ RESULT_VARIABLE exit_code
+ OUTPUT_VARIABLE output
+ ERROR_VARIABLE output
+)
+if(NOT exit_code EQUAL 0)
+ message(FATAL_ERROR "Initial configuration of UicOnFileChange failed. Output: ${output}")
+endif()
+
+# Initial build
+execute_process(
+ COMMAND "${CMAKE_COMMAND}" --build "${testProjectBinDir}" --config "${TEST_CONFIG}"
+ RESULT_VARIABLE exit_code
+ OUTPUT_VARIABLE output
+ ERROR_VARIABLE output
+)
+if(NOT exit_code EQUAL 0)
+ message(FATAL_ERROR "Initial build of UicOnFileChange failed. Output: ${output}")
+endif()
+
+execute_process(COMMAND "${testProjectBinDir}/${extra_bin_path}UicOnFileChange" RESULT_VARIABLE result)
+if(NOT result EQUAL "1")
+ message(FATAL_ERROR "Initial build of UicOnFileChange test result is: ${result}")
+endif()
+
+sleep()
+
+set(Num 2)
+configure_file("${testProjectTemplateDir}/mainwindow.ui.in" "${testProjectSrc}/mainwindow.ui" @ONLY)
+rebuild(2)
+
+execute_process(COMMAND "${testProjectBinDir}/${extra_bin_path}UicOnFileChange" RESULT_VARIABLE result)
+if(NOT result EQUAL "0")
+ message(FATAL_ERROR "Rebuild of UicOnFileChange test result is: ${result}")
+endif()
diff --git a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in
new file mode 100644
index 0000000..fa9dd6b
--- /dev/null
+++ b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in
@@ -0,0 +1,11 @@
+cmake_minimum_required(VERSION 3.10)
+
+project(UicOnFileChange)
+include("@CMAKE_CURRENT_LIST_DIR@/../AutogenGuiTest.cmake")
+
+# Enable CMAKE_AUTOUIC for all targets
+set(CMAKE_AUTOUIC ON)
+
+add_executable(UicOnFileChange main.cpp mainwindow.ui)
+target_include_directories(UicOnFileChange PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
+target_link_libraries(UicOnFileChange ${QT_QTCORE_TARGET} ${QT_LIBRARIES})
diff --git a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/main.cpp b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/main.cpp
new file mode 100644
index 0000000..fd810fa
--- /dev/null
+++ b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/main.cpp
@@ -0,0 +1,9 @@
+#include "ui_mainwindow.h"
+
+int main(int argc, char* argv[])
+{
+ MocWidget mw;
+ Ui::Widget mwUi;
+ mwUi.setupUi(&mw);
+ return mw.objectName() == "Widget2" ? 0 : 1;
+}
diff --git a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/mainwindow.ui.in b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/mainwindow.ui.in
new file mode 100644
index 0000000..8f39e55
--- /dev/null
+++ b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/mainwindow.ui.in
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Widget</class>
+ <widget class="MocWidget" name="Widget@Num@"/>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/mocwidget.h b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/mocwidget.h
new file mode 100644
index 0000000..87fc177
--- /dev/null
+++ b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/mocwidget.h
@@ -0,0 +1,5 @@
+#include <QtCore/QObject>
+
+class MocWidget : public QObject
+{
+};
diff --git a/Tests/QtAutogen/Tests.cmake b/Tests/QtAutogen/Tests.cmake
index b1337d6..d1edd72 100644
--- a/Tests/QtAutogen/Tests.cmake
+++ b/Tests/QtAutogen/Tests.cmake
@@ -24,6 +24,7 @@ ADD_AUTOGEN_TEST(RerunMocOnAddFile)
ADD_AUTOGEN_TEST(RerunMocOnMissingDependency)
ADD_AUTOGEN_TEST(RerunRccConfigChange)
ADD_AUTOGEN_TEST(RerunRccDepends)
+ADD_AUTOGEN_TEST(RerunUicOnFileChange)
ADD_AUTOGEN_TEST(SameName sameName)
ADD_AUTOGEN_TEST(StaticLibraryCycle slc)
ADD_AUTOGEN_TEST(UicInclude uicInclude)
diff --git a/Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt b/Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt
new file mode 100644
index 0000000..10e83a9
--- /dev/null
+++ b/Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt
@@ -0,0 +1,17 @@
+^CMake Warning \(dev\) at CMP0116-Mixed\.cmake:1 \(add_custom_command\):
+ Policy CMP0116 is not set: Ninja generators transform DEPFILEs from
+ add_custom_command\(\)\. Run "cmake --help-policy CMP0116" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.(
+
+CMake Warning \(dev\) at CMP0116-Mixed\.cmake:1 \(add_custom_command\):
+ Policy CMP0116 is not set: Ninja generators transform DEPFILEs from
+ add_custom_command\(\)\. Run "cmake --help-policy CMP0116" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.)*$
diff --git a/Tests/RunCMake/CMP0116/CMP0116-Mixed.cmake b/Tests/RunCMake/CMP0116/CMP0116-Mixed.cmake
new file mode 100644
index 0000000..6cbbc09
--- /dev/null
+++ b/Tests/RunCMake/CMP0116/CMP0116-Mixed.cmake
@@ -0,0 +1,18 @@
+add_custom_command(
+ OUTPUT warn.txt
+ COMMAND ${CMAKE_COMMAND} -E touch warn.txt
+ DEPFILE warn.d
+ )
+cmake_policy(SET CMP0116 OLD)
+add_custom_command(
+ OUTPUT old.txt
+ COMMAND ${CMAKE_COMMAND} -E touch old.txt
+ DEPFILE old.d
+ )
+cmake_policy(SET CMP0116 NEW)
+add_custom_command(
+ OUTPUT new.txt
+ COMMAND ${CMAKE_COMMAND} -E touch new.txt
+ DEPFILE new.d
+ )
+add_custom_target(cc ALL DEPENDS warn.txt old.txt new.txt)
diff --git a/Tests/RunCMake/CMP0116/RunCMakeTest.cmake b/Tests/RunCMake/CMP0116/RunCMakeTest.cmake
index 8a83cc1..ce3e86a 100644
--- a/Tests/RunCMake/CMP0116/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0116/RunCMakeTest.cmake
@@ -47,3 +47,6 @@ run_cmp0116(NEW OFF)
run_cmp0116(WARN ON)
run_cmp0116(OLD ON)
run_cmp0116(NEW ON)
+
+set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_WARNING_CMP0116:BOOL=TRUE)
+run_cmake(CMP0116-Mixed)
diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-Common.cmake b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-Common.cmake
new file mode 100644
index 0000000..5594be8
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-Common.cmake
@@ -0,0 +1,8 @@
+set(listvar a b c d e)
+
+list(GET listvar
+ 18446744073709551616 # 2^64
+ 2147483648 # 2^31
+ 4294967296 # 2^32; errors out-of-range as -2147483643 due to underflow
+ out)
+message("ERANGE: -->${out}<--")
diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW-result.txt b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW-stderr.txt
new file mode 100644
index 0000000..0166e14
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at CMP0121-ERANGE-Common.cmake:3 \(list\):
+ list index: 18446744073709551616 is not a valid index
+Call Stack \(most recent call first\):
+ CMP0121-ERANGE-NEW.cmake:2 \(include\)
+ CMakeLists.txt:3 \(include\)
+
+
+ERANGE: --><--
diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW.cmake b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW.cmake
new file mode 100644
index 0000000..68e564d
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0121 NEW)
+include(CMP0121-ERANGE-Common.cmake)
diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD-result.txt b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD-stderr.txt
new file mode 100644
index 0000000..5a03559
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at CMP0121-ERANGE-Common.cmake:3 \(list\):
+ list index: (-2147483643|2147483647) out of range \(-5, 4\)
+Call Stack \(most recent call first\):
+ CMP0121-ERANGE-OLD.cmake:2 \(include\)
+ CMakeLists.txt:3 \(include\)
+
+
+ERANGE: --><--
diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD.cmake b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD.cmake
new file mode 100644
index 0000000..32f0b56
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0121 OLD)
+include(CMP0121-ERANGE-Common.cmake)
diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN-result.txt b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN-stderr.txt
new file mode 100644
index 0000000..1e7b127
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN-stderr.txt
@@ -0,0 +1,18 @@
+CMake Warning \(dev\) at CMP0121-ERANGE-Common.cmake:3 \(list\):
+ Policy CMP0121 is not set: The list\(\) command now validates parsing of
+ index arguments. Run "cmake --help-policy CMP0121" for policy details.
+ Use the cmake_policy command to set the policy and suppress this warning.
+ Invalid list index "18446744073709551616".
+Call Stack \(most recent call first\):
+ CMP0121-ERANGE-WARN.cmake:2 \(include\)
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Error at CMP0121-ERANGE-Common.cmake:3 \(list\):
+ list index: (-2147483643|2147483647) out of range \(-5, 4\)
+Call Stack \(most recent call first\):
+ CMP0121-ERANGE-WARN.cmake:2 \(include\)
+ CMakeLists.txt:3 \(include\)
+
+
+ERANGE: --><--
diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN.cmake b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN.cmake
new file mode 100644
index 0000000..9655290
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN.cmake
@@ -0,0 +1,2 @@
+
+include(CMP0121-ERANGE-Common.cmake)
diff --git a/Tests/RunCMake/CMP0121/CMP0121-GET-Common.cmake b/Tests/RunCMake/CMP0121/CMP0121-GET-Common.cmake
new file mode 100644
index 0000000..e4986f0
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-GET-Common.cmake
@@ -0,0 +1,4 @@
+set(listvar a b c d e)
+
+list(GET listvar 0 2junk out)
+message("GET: -->${out}<--")
diff --git a/Tests/RunCMake/CMP0121/CMP0121-GET-NEW-result.txt b/Tests/RunCMake/CMP0121/CMP0121-GET-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-GET-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0121/CMP0121-GET-NEW-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-GET-NEW-stderr.txt
new file mode 100644
index 0000000..d502b86
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-GET-NEW-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at CMP0121-GET-Common.cmake:3 \(list\):
+ list index: 2junk is not a valid index
+Call Stack \(most recent call first\):
+ CMP0121-GET-NEW.cmake:2 \(include\)
+ CMakeLists.txt:3 \(include\)
+
+
+GET: --><--
diff --git a/Tests/RunCMake/CMP0121/CMP0121-GET-NEW.cmake b/Tests/RunCMake/CMP0121/CMP0121-GET-NEW.cmake
new file mode 100644
index 0000000..1ab054d
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-GET-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0121 NEW)
+include(CMP0121-GET-Common.cmake)
diff --git a/Tests/RunCMake/CMP0121/CMP0121-GET-OLD-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-GET-OLD-stderr.txt
new file mode 100644
index 0000000..96375e9
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-GET-OLD-stderr.txt
@@ -0,0 +1 @@
+GET: -->a;c<--
diff --git a/Tests/RunCMake/CMP0121/CMP0121-GET-OLD.cmake b/Tests/RunCMake/CMP0121/CMP0121-GET-OLD.cmake
new file mode 100644
index 0000000..ef4526f
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-GET-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0121 OLD)
+include(CMP0121-GET-Common.cmake)
diff --git a/Tests/RunCMake/CMP0121/CMP0121-GET-WARN-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-GET-WARN-stderr.txt
new file mode 100644
index 0000000..ecfad2c
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-GET-WARN-stderr.txt
@@ -0,0 +1,11 @@
+CMake Warning \(dev\) at CMP0121-GET-Common.cmake:3 \(list\):
+ Policy CMP0121 is not set: The list\(\) command now validates parsing of
+ index arguments. Run "cmake --help-policy CMP0121" for policy details.
+ Use the cmake_policy command to set the policy and suppress this warning.
+ Invalid list index "2junk".
+Call Stack \(most recent call first\):
+ CMP0121-GET-WARN.cmake:2 \(include\)
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+GET: -->a;c<--
diff --git a/Tests/RunCMake/CMP0121/CMP0121-GET-WARN.cmake b/Tests/RunCMake/CMP0121/CMP0121-GET-WARN.cmake
new file mode 100644
index 0000000..b08620b
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-GET-WARN.cmake
@@ -0,0 +1,2 @@
+
+include(CMP0121-GET-Common.cmake)
diff --git a/Tests/RunCMake/CMP0121/CMP0121-INSERT-Common.cmake b/Tests/RunCMake/CMP0121/CMP0121-INSERT-Common.cmake
new file mode 100644
index 0000000..4950881
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-INSERT-Common.cmake
@@ -0,0 +1,4 @@
+set(listvar a b c d e)
+
+list(INSERT listvar junk2 new)
+message("INSERT: -->${listvar}<--")
diff --git a/Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW-result.txt b/Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW-stderr.txt
new file mode 100644
index 0000000..2241962
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at CMP0121-INSERT-Common.cmake:3 \(list\):
+ list index: junk2 is not a valid index
+Call Stack \(most recent call first\):
+ CMP0121-INSERT-NEW.cmake:2 \(include\)
+ CMakeLists.txt:3 \(include\)
+
+
+INSERT: -->a;b;c;d;e<--
diff --git a/Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW.cmake b/Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW.cmake
new file mode 100644
index 0000000..db627d1
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0121 NEW)
+include(CMP0121-INSERT-Common.cmake)
diff --git a/Tests/RunCMake/CMP0121/CMP0121-INSERT-OLD-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-INSERT-OLD-stderr.txt
new file mode 100644
index 0000000..52f34ad
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-INSERT-OLD-stderr.txt
@@ -0,0 +1 @@
+INSERT: -->new;a;b;c;d;e<--
diff --git a/Tests/RunCMake/CMP0121/CMP0121-INSERT-OLD.cmake b/Tests/RunCMake/CMP0121/CMP0121-INSERT-OLD.cmake
new file mode 100644
index 0000000..60364d7
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-INSERT-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0121 OLD)
+include(CMP0121-INSERT-Common.cmake)
diff --git a/Tests/RunCMake/CMP0121/CMP0121-INSERT-WARN-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-INSERT-WARN-stderr.txt
new file mode 100644
index 0000000..5fa7d17
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-INSERT-WARN-stderr.txt
@@ -0,0 +1,11 @@
+CMake Warning \(dev\) at CMP0121-INSERT-Common.cmake:3 \(list\):
+ Policy CMP0121 is not set: The list\(\) command now validates parsing of
+ index arguments. Run "cmake --help-policy CMP0121" for policy details.
+ Use the cmake_policy command to set the policy and suppress this warning.
+ Invalid list index "junk2".
+Call Stack \(most recent call first\):
+ CMP0121-INSERT-WARN.cmake:2 \(include\)
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+INSERT: -->new;a;b;c;d;e<--
diff --git a/Tests/RunCMake/CMP0121/CMP0121-INSERT-WARN.cmake b/Tests/RunCMake/CMP0121/CMP0121-INSERT-WARN.cmake
new file mode 100644
index 0000000..55f13e2
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-INSERT-WARN.cmake
@@ -0,0 +1,2 @@
+
+include(CMP0121-INSERT-Common.cmake)
diff --git a/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-Common.cmake b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-Common.cmake
new file mode 100644
index 0000000..ec92387
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-Common.cmake
@@ -0,0 +1,4 @@
+set(listvar a b c d e)
+
+list(REMOVE_AT listvar 0 invalid)
+message("REMOVE_AT: -->${listvar}<--")
diff --git a/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW-result.txt b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW-stderr.txt
new file mode 100644
index 0000000..f17bafd
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at CMP0121-REMOVE_AT-Common.cmake:3 \(list\):
+ list index: invalid is not a valid index
+Call Stack \(most recent call first\):
+ CMP0121-REMOVE_AT-NEW.cmake:2 \(include\)
+ CMakeLists.txt:3 \(include\)
+
+
+REMOVE_AT: -->a;b;c;d;e<--
diff --git a/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW.cmake b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW.cmake
new file mode 100644
index 0000000..d1f09e3
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0121 NEW)
+include(CMP0121-REMOVE_AT-Common.cmake)
diff --git a/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-OLD-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-OLD-stderr.txt
new file mode 100644
index 0000000..09af1ae
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-OLD-stderr.txt
@@ -0,0 +1 @@
+REMOVE_AT: -->b;c;d;e<--
diff --git a/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-OLD.cmake b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-OLD.cmake
new file mode 100644
index 0000000..ac83226
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0121 OLD)
+include(CMP0121-REMOVE_AT-Common.cmake)
diff --git a/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-WARN-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-WARN-stderr.txt
new file mode 100644
index 0000000..e2d47af
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-WARN-stderr.txt
@@ -0,0 +1,11 @@
+CMake Warning \(dev\) at CMP0121-REMOVE_AT-Common.cmake:3 \(list\):
+ Policy CMP0121 is not set: The list\(\) command now validates parsing of
+ index arguments. Run "cmake --help-policy CMP0121" for policy details.
+ Use the cmake_policy command to set the policy and suppress this warning.
+ Invalid list index "invalid".
+Call Stack \(most recent call first\):
+ CMP0121-REMOVE_AT-WARN.cmake:2 \(include\)
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+REMOVE_AT: -->b;c;d;e<--
diff --git a/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-WARN.cmake b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-WARN.cmake
new file mode 100644
index 0000000..2b4a824
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-WARN.cmake
@@ -0,0 +1,2 @@
+
+include(CMP0121-REMOVE_AT-Common.cmake)
diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-Common.cmake b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-Common.cmake
new file mode 100644
index 0000000..93f46c5
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-Common.cmake
@@ -0,0 +1,4 @@
+set(listvar a b c d e)
+
+list(SUBLIST listvar 0 invalid out)
+message("SUBLIST-length: -->${out}<--")
diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW-result.txt b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW-stderr.txt
new file mode 100644
index 0000000..28bd362
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at CMP0121-SUBLIST-length-Common.cmake:3 \(list\):
+ list index: invalid is not a valid index
+Call Stack \(most recent call first\):
+ CMP0121-SUBLIST-length-NEW.cmake:2 \(include\)
+ CMakeLists.txt:3 \(include\)
+
+
+SUBLIST-length: --><--
diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW.cmake b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW.cmake
new file mode 100644
index 0000000..c7875cb
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0121 NEW)
+include(CMP0121-SUBLIST-length-Common.cmake)
diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-OLD-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-OLD-stderr.txt
new file mode 100644
index 0000000..00fcf07
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-OLD-stderr.txt
@@ -0,0 +1 @@
+SUBLIST-length: --><--
diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-OLD.cmake b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-OLD.cmake
new file mode 100644
index 0000000..e9b78ee
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0121 OLD)
+include(CMP0121-SUBLIST-length-Common.cmake)
diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-WARN-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-WARN-stderr.txt
new file mode 100644
index 0000000..bd06c2f
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-WARN-stderr.txt
@@ -0,0 +1,11 @@
+CMake Warning \(dev\) at CMP0121-SUBLIST-length-Common.cmake:3 \(list\):
+ Policy CMP0121 is not set: The list\(\) command now validates parsing of
+ index arguments. Run "cmake --help-policy CMP0121" for policy details.
+ Use the cmake_policy command to set the policy and suppress this warning.
+ Invalid list index "invalid".
+Call Stack \(most recent call first\):
+ CMP0121-SUBLIST-length-WARN.cmake:2 \(include\)
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+SUBLIST-length: --><--
diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-WARN.cmake b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-WARN.cmake
new file mode 100644
index 0000000..27318bf
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-WARN.cmake
@@ -0,0 +1,2 @@
+
+include(CMP0121-SUBLIST-length-Common.cmake)
diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-Common.cmake b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-Common.cmake
new file mode 100644
index 0000000..33f57a3
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-Common.cmake
@@ -0,0 +1,4 @@
+set(listvar a b c d e)
+
+list(SUBLIST listvar invalid 2 out)
+message("SUBLIST-start: -->${out}<--")
diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW-result.txt b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW-stderr.txt
new file mode 100644
index 0000000..9819f95
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at CMP0121-SUBLIST-start-Common.cmake:3 \(list\):
+ list index: invalid is not a valid index
+Call Stack \(most recent call first\):
+ CMP0121-SUBLIST-start-NEW.cmake:2 \(include\)
+ CMakeLists.txt:3 \(include\)
+
+
+SUBLIST-start: --><--
diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW.cmake b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW.cmake
new file mode 100644
index 0000000..3d676a3
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0121 NEW)
+include(CMP0121-SUBLIST-start-Common.cmake)
diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-OLD-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-OLD-stderr.txt
new file mode 100644
index 0000000..8da2881
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-OLD-stderr.txt
@@ -0,0 +1 @@
+SUBLIST-start: -->a;b<--
diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-OLD.cmake b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-OLD.cmake
new file mode 100644
index 0000000..268f317
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0121 OLD)
+include(CMP0121-SUBLIST-start-Common.cmake)
diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-WARN-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-WARN-stderr.txt
new file mode 100644
index 0000000..39d0e0e
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-WARN-stderr.txt
@@ -0,0 +1,11 @@
+CMake Warning \(dev\) at CMP0121-SUBLIST-start-Common.cmake:3 \(list\):
+ Policy CMP0121 is not set: The list\(\) command now validates parsing of
+ index arguments. Run "cmake --help-policy CMP0121" for policy details.
+ Use the cmake_policy command to set the policy and suppress this warning.
+ Invalid list index "invalid".
+Call Stack \(most recent call first\):
+ CMP0121-SUBLIST-start-WARN.cmake:2 \(include\)
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+SUBLIST-start: -->a;b<--
diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-WARN.cmake b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-WARN.cmake
new file mode 100644
index 0000000..a407879
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-WARN.cmake
@@ -0,0 +1,2 @@
+
+include(CMP0121-SUBLIST-start-Common.cmake)
diff --git a/Tests/RunCMake/CMP0121/CMakeLists.txt b/Tests/RunCMake/CMP0121/CMakeLists.txt
new file mode 100644
index 0000000..7cabeb6
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.20)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0121/RunCMakeTest.cmake b/Tests/RunCMake/CMP0121/RunCMakeTest.cmake
new file mode 100644
index 0000000..1ed5b1a
--- /dev/null
+++ b/Tests/RunCMake/CMP0121/RunCMakeTest.cmake
@@ -0,0 +1,7 @@
+include(RunCMake)
+
+foreach (subcommand IN ITEMS ERANGE GET INSERT REMOVE_AT SUBLIST-length SUBLIST-start)
+ run_cmake(CMP0121-${subcommand}-WARN)
+ run_cmake(CMP0121-${subcommand}-OLD)
+ run_cmake(CMP0121-${subcommand}-NEW)
+endforeach ()
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 91fe6ca..354a04e 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -131,6 +131,7 @@ if(CMAKE_GENERATOR MATCHES "Ninja")
endif()
add_RunCMake_test(CMP0118)
add_RunCMake_test(CMP0119 -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID})
+add_RunCMake_test(CMP0121)
# The test for Policy 65 requires the use of the
# CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode
@@ -257,6 +258,7 @@ add_RunCMake_test(GenEx-HOST_LINK)
add_RunCMake_test(GenEx-DEVICE_LINK)
add_RunCMake_test(GenEx-TARGET_FILE -DLINKER_SUPPORTS_PDB=${LINKER_SUPPORTS_PDB})
add_RunCMake_test(GenEx-GENEX_EVAL)
+add_RunCMake_test(GenEx-TARGET_RUNTIME_DLLS)
add_RunCMake_test(GeneratorExpression)
add_RunCMake_test(GeneratorInstance)
add_RunCMake_test(GeneratorPlatform)
@@ -415,6 +417,15 @@ function(add_RunCMake_test_try_compile)
set(CMAKE_C_STANDARD_DEFAULT "")
endif()
endif()
+ if(CMAKE_VERSION VERSION_LESS 3.20.20210225 AND "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang")
+ # Older CMake versions do not know about Clang MSVC compatibility mode
+ # standards. Approximate the logic from Clang-C.cmake.
+ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0)
+ set(CMAKE_C_STANDARD_DEFAULT 17)
+ elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.5.2)
+ set(CMAKE_C_STANDARD_DEFAULT 11)
+ endif()
+ endif()
foreach(var
CMAKE_SYSTEM_NAME
CMAKE_C_COMPILER_ID
diff --git a/Tests/RunCMake/CMakePresets/CMakePresets.json.in b/Tests/RunCMake/CMakePresets/CMakePresets.json.in
index 54e4140..c6f943c 100644
--- a/Tests/RunCMake/CMakePresets/CMakePresets.json.in
+++ b/Tests/RunCMake/CMakePresets/CMakePresets.json.in
@@ -1,8 +1,4 @@
-/*
- * Block comment
- */
{
- // Inline comment
"version": 1,
"cmakeMinimumRequired": {
"major": 3,
@@ -132,7 +128,13 @@
{
"name": "Good Spaces",
"generator": "@RunCMake_GENERATOR@",
- "binaryDir": "${sourceDir}/build"
+ "binaryDir": "${sourceDir}/build",
+ "cacheVariables": {
+ "GOOD_SPACES": {
+ "type": "STRING",
+ "value": "1"
+ }
+ }
},
{
"name": "GoodWindowsBackslash",
diff --git a/Tests/RunCMake/CMakePresets/Comment-result.txt b/Tests/RunCMake/CMakePresets/Comment-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/Comment-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresets/Comment-stderr.txt b/Tests/RunCMake/CMakePresets/Comment-stderr.txt
new file mode 100644
index 0000000..2f404bc
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/Comment-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresets/Comment: JSON parse error$
diff --git a/Tests/RunCMake/CMakePresets/Comment.json.in b/Tests/RunCMake/CMakePresets/Comment.json.in
new file mode 100644
index 0000000..0f7120c
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/Comment.json.in
@@ -0,0 +1,11 @@
+// Comment
+{
+ "version": 1,
+ "configurePresets": [
+ {
+ "name": "Comment",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build"
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresets/GoodSpaces-stdout.txt b/Tests/RunCMake/CMakePresets/GoodSpaces-stdout.txt
new file mode 100644
index 0000000..d106c45
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/GoodSpaces-stdout.txt
@@ -0,0 +1,3 @@
+Preset CMake variables:
+
+ GOOD_SPACES:STRING="1"
diff --git a/Tests/RunCMake/CMakePresets/GoodSpacesEq-stdout.txt b/Tests/RunCMake/CMakePresets/GoodSpacesEq-stdout.txt
new file mode 100644
index 0000000..d106c45
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/GoodSpacesEq-stdout.txt
@@ -0,0 +1,3 @@
+Preset CMake variables:
+
+ GOOD_SPACES:STRING="1"
diff --git a/Tests/RunCMake/CMakePresets/GoodSpacesEq.cmake b/Tests/RunCMake/CMakePresets/GoodSpacesEq.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/GoodSpacesEq.cmake
diff --git a/Tests/RunCMake/CMakePresets/NoPresetArgumentEq-result.txt b/Tests/RunCMake/CMakePresets/NoPresetArgumentEq-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/NoPresetArgumentEq-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresets/NoPresetArgumentEq-stderr.txt b/Tests/RunCMake/CMakePresets/NoPresetArgumentEq-stderr.txt
new file mode 100644
index 0000000..a53682d
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/NoPresetArgumentEq-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: No preset specified for --preset
+CMake Error: Run 'cmake --help' for all supported options.$
diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
index 25a7f2f..dfc56ee 100644
--- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
@@ -63,6 +63,7 @@ endfunction()
# Test CMakePresets.json errors
set(CMakePresets_SCHEMA_EXPECTED_RESULT 1)
run_cmake_presets(NoCMakePresets)
+run_cmake_presets(Comment)
run_cmake_presets(JSONParseError)
run_cmake_presets(InvalidRoot)
run_cmake_presets(NoVersion)
@@ -143,7 +144,8 @@ run_cmake_presets(GoodBinaryUp)
set(CMakePresets_SOURCE_ARG "../GoodBinaryRelative")
run_cmake_presets(GoodBinaryRelative)
unset(CMakePresets_SOURCE_ARG)
-run_cmake_presets(GoodSpaces "--preset=Good Spaces")
+run_cmake_presets(GoodSpaces "--preset" "Good Spaces")
+run_cmake_presets(GoodSpacesEq "--preset=Good Spaces")
if(WIN32)
run_cmake_presets(GoodWindowsBackslash)
endif()
@@ -206,7 +208,8 @@ endif()
# Test bad command line arguments
run_cmake_presets(NoSuchPreset)
-run_cmake_presets(NoPresetArgument --preset=)
+run_cmake_presets(NoPresetArgument --preset)
+run_cmake_presets(NoPresetArgumentEq --preset= -DA=B)
run_cmake_presets(UseHiddenPreset)
# Test CMakeUserPresets.json
diff --git a/Tests/RunCMake/CMakePresets/validate_schema.py b/Tests/RunCMake/CMakePresets/validate_schema.py
index c9f84ee..b2a67fc 100644
--- a/Tests/RunCMake/CMakePresets/validate_schema.py
+++ b/Tests/RunCMake/CMakePresets/validate_schema.py
@@ -1,4 +1,3 @@
-import jsmin
import json
import jsonschema
import os.path
@@ -6,7 +5,7 @@ import sys
with open(sys.argv[1], "rb") as f:
- contents = json.loads(jsmin.jsmin(f.read().decode("utf-8-sig")))
+ contents = json.loads(f.read().decode("utf-8-sig"))
schema_file = os.path.join(
os.path.dirname(__file__),
diff --git a/Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake
index 9491524..fd95c2c 100644
--- a/Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake
@@ -40,6 +40,7 @@ function(run_cmake_build_presets name CMakePresetsBuild_CONFIGURE_PRESETS CMakeP
endforeach()
endif()
+ set(eq 0)
foreach(BUILD_PRESET ${CMakePresetsBuild_BUILD_PRESETS})
if (EXISTS "${RunCMake_SOURCE_DIR}/${name}-build-${BUILD_PRESET}-check.cmake")
set(RunCMake-check-file "${name}-build-${BUILD_PRESET}-check.cmake")
@@ -47,8 +48,15 @@ function(run_cmake_build_presets name CMakePresetsBuild_CONFIGURE_PRESETS CMakeP
set(RunCMake-check-file "check.cmake")
endif()
- run_cmake_command(${name}-build-${BUILD_PRESET}
- ${CMAKE_COMMAND} "--build" "--preset" "${BUILD_PRESET}" ${ARGN})
+ if(eq)
+ run_cmake_command(${name}-build-${BUILD_PRESET}
+ ${CMAKE_COMMAND} "--build" "--preset=${BUILD_PRESET}" ${ARGN})
+ set(eq 0)
+ else()
+ run_cmake_command(${name}-build-${BUILD_PRESET}
+ ${CMAKE_COMMAND} "--build" "--preset" "${BUILD_PRESET}" ${ARGN})
+ set(eq 1)
+ endif()
endforeach()
endfunction()
diff --git a/Tests/RunCMake/CMakePresetsTest/Good.json.in b/Tests/RunCMake/CMakePresetsTest/Good.json.in
index 791d41f..57be5a5 100644
--- a/Tests/RunCMake/CMakePresetsTest/Good.json.in
+++ b/Tests/RunCMake/CMakePresetsTest/Good.json.in
@@ -49,8 +49,6 @@
"outputLogFile": "",
"labelSummary": true,
"subprojectSummary": true
- // "maxPassedTestOutputSize": 0
- // "maxTestNameWidth": 0
},
"filter": {
"include": {
@@ -58,11 +56,6 @@
"label": "",
"useUnion": false,
"index": ""
- // "index": {
- // "start": 0,
- // "end": 0,
- // "stride": 0
- // }
},
"exclude": {
"name": "",
@@ -79,7 +72,6 @@
"enableFailover": false,
"jobs": 0,
"resourceSpecFile": "",
- // "testLoad": 0,
"showOnly": "human",
"repeat": {
"mode": "until-pass",
@@ -87,7 +79,6 @@
},
"interactiveDebugging": false,
"scheduleRandom": false,
- // "timeout": 0,
"noTestsAction": "default"
}
},
diff --git a/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake
index 6360fc2..4ffdfab 100644
--- a/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake
@@ -51,6 +51,7 @@ function(run_cmake_test_presets name CMakePresetsTest_CONFIGURE_PRESETS CMakePre
endforeach()
endif()
+ set(eq 0)
foreach(TEST_PRESET ${CMakePresetsTest_TEST_PRESETS})
if (EXISTS "${RunCMake_SOURCE_DIR}/${name}-test-${TEST_PRESET}-check.cmake")
set(RunCMake-check-file "${name}-test-${TEST_PRESET}-check.cmake")
@@ -58,8 +59,15 @@ function(run_cmake_test_presets name CMakePresetsTest_CONFIGURE_PRESETS CMakePre
set(RunCMake-check-file "check.cmake")
endif()
- run_cmake_command(${name}-test-${TEST_PRESET}
- ${CMAKE_CTEST_COMMAND} "--preset" "${TEST_PRESET}" ${ARGN})
+ if(eq)
+ run_cmake_command(${name}-test-${TEST_PRESET}
+ ${CMAKE_CTEST_COMMAND} "--preset=${TEST_PRESET}" ${ARGN})
+ set(eq 0)
+ else()
+ run_cmake_command(${name}-test-${TEST_PRESET}
+ ${CMAKE_CTEST_COMMAND} "--preset" "${TEST_PRESET}" ${ARGN})
+ set(eq 1)
+ endif()
endforeach()
endfunction()
diff --git a/Tests/RunCMake/ExternalProject/CONFIGURE_HANDLED_BY_BUILD.cmake b/Tests/RunCMake/ExternalProject/CONFIGURE_HANDLED_BY_BUILD.cmake
index c86a60e..6dbf0f4 100644
--- a/Tests/RunCMake/ExternalProject/CONFIGURE_HANDLED_BY_BUILD.cmake
+++ b/Tests/RunCMake/ExternalProject/CONFIGURE_HANDLED_BY_BUILD.cmake
@@ -11,7 +11,7 @@ ExternalProject_Add(proj1
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E echo "Doing something"
# file(TIMESTAMP) gives back the timestamp in seconds so we sleep a second to
# make sure we get a different timestamp on the stamp file
- BUILD_COMMAND ${CMAKE_COMMAND} -E sleep 1
+ BUILD_COMMAND ${CMAKE_COMMAND} -E sleep 1.125
INSTALL_COMMAND ""
BUILD_ALWAYS ON
STAMP_DIR "stamp"
@@ -20,7 +20,7 @@ ExternalProject_Add(proj2
DOWNLOAD_COMMAND ""
SOURCE_DIR ""
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E echo "Doing something"
- BUILD_COMMAND ${CMAKE_COMMAND} -E sleep 1
+ BUILD_COMMAND ${CMAKE_COMMAND} -E sleep 1.125
INSTALL_COMMAND ""
CONFIGURE_HANDLED_BY_BUILD ON
DEPENDS proj1
diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
index 13013fa..d7fd009 100644
--- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
@@ -27,6 +27,36 @@ run_cmake_with_options(ManualSourceDirectoryRelative
-D "FETCHCONTENT_SOURCE_DIR_WITHPROJECT:STRING=WithProject"
)
+function(run_FetchContent_TimeStamps)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TimeStamps)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
+ # First run should execute the commands
+ run_cmake(TimeStamps)
+
+ # Ensure that the file checks we use in the TimeStampsRerun-check.cmake script
+ # will not be defeated by file systems with only one second resolution.
+ # The IS_NEWER_THAN check returns TRUE if the timestamps of the two files are
+ # the same, which has been observed where filesystems only have one second
+ # resolution.
+ set(cmpTimeStamp ${RunCMake_TEST_BINARY_DIR}/cmpTimeStamp.txt)
+ set(checkTimeStamp ${RunCMake_TEST_BINARY_DIR}/cmpTimeStampCheck.txt)
+ file(TOUCH ${cmpTimeStamp})
+ file(TOUCH ${checkTimeStamp})
+ if("${cmpTimeStamp}" IS_NEWER_THAN "${checkTimeStamp}")
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E sleep 1.125
+ COMMAND_ERROR_IS_FATAL LAST
+ )
+ endif()
+
+ # Run again with no changes, no commands should re-execute
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake(TimeStampsRerun)
+endfunction()
+run_FetchContent_TimeStamps()
+
function(run_FetchContent_DirOverrides)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DirOverrides-build)
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
diff --git a/Tests/RunCMake/FetchContent/TimeStamps-stdout.txt b/Tests/RunCMake/FetchContent/TimeStamps-stdout.txt
new file mode 100644
index 0000000..2ba1ff4
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/TimeStamps-stdout.txt
@@ -0,0 +1,2 @@
+.* *download executed
+.* *patch executed
diff --git a/Tests/RunCMake/FetchContent/TimeStamps.cmake b/Tests/RunCMake/FetchContent/TimeStamps.cmake
new file mode 100644
index 0000000..33874f9
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/TimeStamps.cmake
@@ -0,0 +1,14 @@
+include(FetchContent)
+
+# Do nothing for an update because it would result in always re-running the
+# patch step. We want to test that a patch step that only depends on the
+# download step is not re-run unnecessarily.
+FetchContent_Declare(customCommands
+ PREFIX ${CMAKE_CURRENT_BINARY_DIR}
+ DOWNLOAD_COMMAND "${CMAKE_COMMAND}" -E echo "download executed"
+ UPDATE_COMMAND ""
+ PATCH_COMMAND "${CMAKE_COMMAND}" -E echo "patch executed"
+)
+
+set(FETCHCONTENT_QUIET FALSE)
+FetchContent_MakeAvailable(customCommands)
diff --git a/Tests/RunCMake/FetchContent/TimeStampsRerun-check.cmake b/Tests/RunCMake/FetchContent/TimeStampsRerun-check.cmake
new file mode 100644
index 0000000..c12a5f4
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/TimeStampsRerun-check.cmake
@@ -0,0 +1,38 @@
+set(cmpFile ${RunCMake_TEST_BINARY_DIR}/cmpTimeStamp.txt)
+set(scriptDir ${RunCMake_TEST_BINARY_DIR}/tmp)
+set(stampDir ${RunCMake_TEST_BINARY_DIR}/src/customcommands-stamp)
+
+set(errorMessages)
+if(NOT EXISTS "${cmpFile}")
+ list(APPEND errorMessages " ${cmpFile} is missing")
+else()
+ foreach(script IN ITEMS mkdirs download patch)
+ set(scriptFile "${scriptDir}/customcommands-${script}.cmake")
+ if(NOT EXISTS "${scriptFile}")
+ list(APPEND errorMessages " ${scriptFile} is missing")
+ elseif(NOT "${cmpFile}" IS_NEWER_THAN "${scriptFile}")
+ list(APPEND errorMessages " ${scriptFile} was unexectedly updated")
+ endif()
+ endforeach()
+
+ # special case, not a script, has different extension
+ set(repoInfoFile "${scriptDir}/customcommands-download-repoinfo.txt")
+ if(NOT EXISTS "${repoInfoFile}")
+ list(APPEND errorMessages " ${repoInfoFile} is missing")
+ elseif(NOT "${cmpFile}" IS_NEWER_THAN "${repoInfoFile}")
+ list(APPEND errorMessages " ${repoInfoFile} was unexectedly updated")
+ endif()
+
+ foreach(step IN ITEMS download patch)
+ set(stampFile "${stampDir}/customcommands-${step}")
+ if(NOT EXISTS "${stampFile}")
+ list(APPEND errorMessages " ${stampFile} is missing")
+ elseif(NOT "${cmpFile}" IS_NEWER_THAN "${stampFile}")
+ list(APPEND errorMessages " ${stampFile} was unexectedly updated")
+ endif()
+ endforeach()
+endif()
+
+if(errorMessages)
+ list(JOIN errorMessages "\n" RunCMake_TEST_FAILED)
+endif()
diff --git a/Tests/RunCMake/FetchContent/TimeStampsRerun.cmake b/Tests/RunCMake/FetchContent/TimeStampsRerun.cmake
new file mode 100644
index 0000000..e13667a
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/TimeStampsRerun.cmake
@@ -0,0 +1 @@
+include(${CMAKE_CURRENT_LIST_DIR}/TimeStamps.cmake)
diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt b/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt
index 4c2e35f..4d7370c 100644
--- a/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt
+++ b/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt
@@ -3,7 +3,7 @@ CMake Error at OutputNameMatchesObjects.cmake:[0-9]+ \(file\):
\$<TARGET_OBJECTS:foo>
- Objects of target "foo" referenced but is not an allowed library types
- \(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT\).
+ Objects of target "foo" referenced but is not one of the allowed target
+ types \(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT\).
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/CMakeLists.txt
new file mode 100644
index 0000000..ab1a20c
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.19)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/RunCMakeTest.cmake
new file mode 100644
index 0000000..edc495c
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/RunCMakeTest.cmake
@@ -0,0 +1,7 @@
+include(RunCMake)
+
+run_cmake(TARGET_RUNTIME_DLLS)
+run_cmake(TARGET_RUNTIME_DLLS-static)
+run_cmake(TARGET_RUNTIME_DLLS-target_link_libraries)
+run_cmake(TARGET_RUNTIME_DLLS-target_link_libraries-cycle1)
+run_cmake(TARGET_RUNTIME_DLLS-target_link_libraries-cycle2)
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-check.cmake b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-check.cmake
new file mode 100644
index 0000000..e19598e
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-check.cmake
@@ -0,0 +1,15 @@
+function(check_genex expected actual)
+ if(NOT expected STREQUAL actual)
+ string(APPEND RunCMake_TEST_FAILED "Expected DLLs:\n")
+ foreach(dll IN LISTS expected)
+ string(APPEND RunCMake_TEST_FAILED " ${dll}\n")
+ endforeach()
+ string(APPEND RunCMake_TEST_FAILED "Actual DLLs:\n")
+ foreach(dll IN LISTS actual)
+ string(APPEND RunCMake_TEST_FAILED " ${dll}\n")
+ endforeach()
+ endif()
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
+endfunction()
+
+include("${RunCMake_TEST_BINARY_DIR}/dlls.cmake")
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static-result.txt b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static-stderr.txt b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static-stderr.txt
new file mode 100644
index 0000000..7ce588a
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static-stderr.txt
@@ -0,0 +1,9 @@
+CMake Error at TARGET_RUNTIME_DLLS-static\.cmake:[0-9]+ \(file\):
+ Error evaluating generator expression:
+
+ \$<TARGET_RUNTIME_DLLS:static>
+
+ Objects of target "static" referenced but is not one of the allowed target
+ types \(EXECUTABLE, SHARED, MODULE\)\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static.cmake b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static.cmake
new file mode 100644
index 0000000..dc900dd
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static.cmake
@@ -0,0 +1,9 @@
+enable_language(C)
+
+add_library(static STATIC static.c)
+set(condition)
+get_property(multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+if(multi_config)
+ set(condition CONDITION "$<CONFIG:Debug>")
+endif()
+file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/dlls.txt" CONTENT "$<TARGET_RUNTIME_DLLS:static>" ${condition})
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1-result.txt b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1-stderr.txt b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1-stderr.txt
new file mode 100644
index 0000000..8cfcf7e
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at TARGET_RUNTIME_DLLS-target_link_libraries-cycle1\.cmake:[0-9]+ \(add_library\):
+ The SOURCES of "lib1" use a generator expression that depends on the
+ SOURCES themselves\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1.cmake b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1.cmake
new file mode 100644
index 0000000..f19e9e6
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+
+add_library(lib1 SHARED lib1.c)
+target_link_libraries(lib1 PRIVATE $<TARGET_RUNTIME_DLLS:lib1>)
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2-result.txt b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2-stderr.txt b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2-stderr.txt
new file mode 100644
index 0000000..bacbf63
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at TARGET_RUNTIME_DLLS-target_link_libraries-cycle2\.cmake:[0-9]+ \(add_library\):
+ The SOURCES of "(lib1|lib2)" use a generator expression that depends on the
+ SOURCES themselves\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2.cmake b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2.cmake
new file mode 100644
index 0000000..7d035bd
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2.cmake
@@ -0,0 +1,6 @@
+enable_language(C)
+
+add_library(lib1 SHARED lib1.c)
+add_library(lib2 SHARED lib2.c)
+target_link_libraries(lib1 PRIVATE $<TARGET_RUNTIME_DLLS:lib2>)
+target_link_libraries(lib2 PRIVATE $<TARGET_RUNTIME_DLLS:lib1>)
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries.cmake b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries.cmake
new file mode 100644
index 0000000..f44dbf4
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+
+add_library(lib1 SHARED lib1.c)
+add_library(lib2 SHARED lib2.c)
+target_link_libraries(lib1 PRIVATE $<TARGET_RUNTIME_DLLS:lib2>)
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS.cmake b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS.cmake
new file mode 100644
index 0000000..806f0b6
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS.cmake
@@ -0,0 +1,37 @@
+enable_language(C)
+
+add_executable(exe main.c)
+add_library(lib1 SHARED lib1.c)
+add_library(lib2 SHARED lib2.c)
+add_library(lib3 SHARED lib3.c)
+add_library(static STATIC static.c)
+add_library(imported SHARED IMPORTED)
+set_property(TARGET imported PROPERTY IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/imported.dll")
+set_property(TARGET imported PROPERTY IMPORTED_IMPLIB "${CMAKE_SOURCE_DIR}/imported.lib")
+add_library(imported2 SHARED IMPORTED)
+if(NOT WIN32 AND NOT CYGWIN)
+ set_property(TARGET imported2 PROPERTY IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/imported2.dll")
+endif()
+set_property(TARGET imported2 PROPERTY IMPORTED_IMPLIB "${CMAKE_SOURCE_DIR}/imported2.lib")
+
+target_link_libraries(exe PRIVATE lib1 static imported imported2)
+target_link_libraries(lib1 PRIVATE lib2)
+target_link_libraries(lib1 INTERFACE lib3)
+
+set(expected_dlls "")
+if(WIN32 OR CYGWIN)
+ set(expected_dlls
+ "$<TARGET_FILE:lib1>"
+ "$<TARGET_FILE:imported>"
+ "$<TARGET_FILE:lib3>"
+ "$<TARGET_FILE:lib2>"
+ )
+endif()
+
+set(content "check_genex(\"${expected_dlls}\" \"$<TARGET_RUNTIME_DLLS:exe>\")\n")
+set(condition)
+get_property(multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+if(multi_config)
+ set(condition CONDITION "$<CONFIG:Debug>")
+endif()
+file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/dlls.cmake" CONTENT "${content}" ${condition})
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib1.c b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib1.c
new file mode 100644
index 0000000..524b5b2
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib1.c
@@ -0,0 +1,12 @@
+#ifdef _WIN32
+__declspec(dllimport)
+#endif
+ extern void lib2(void);
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ void lib1(void)
+{
+ lib2();
+}
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib2.c b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib2.c
new file mode 100644
index 0000000..e145117
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib2.c
@@ -0,0 +1,6 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ void lib2(void)
+{
+}
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib3.c b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib3.c
new file mode 100644
index 0000000..5392f7a
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib3.c
@@ -0,0 +1,6 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ void lib3(void)
+{
+}
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/main.c b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/main.c
new file mode 100644
index 0000000..8488f4e
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/main.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/static.c b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/static.c
new file mode 100644
index 0000000..7f5dab5
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/static.c
@@ -0,0 +1,3 @@
+void static_func(void)
+{
+}
diff --git a/Tests/RunCMake/GoogleTest/GoogleTest.cmake b/Tests/RunCMake/GoogleTest/GoogleTest.cmake
index 6aa2658..8efd117 100644
--- a/Tests/RunCMake/GoogleTest/GoogleTest.cmake
+++ b/Tests/RunCMake/GoogleTest/GoogleTest.cmake
@@ -1,9 +1,12 @@
-project(test_include_dirs LANGUAGES CXX)
+enable_language(CXX)
include(GoogleTest)
enable_testing()
+include(xcode_sign_adhoc.cmake)
+
add_executable(fake_gtest fake_gtest.cpp)
+xcode_sign_adhoc(fake_gtest)
gtest_discover_tests(
fake_gtest
@@ -22,6 +25,7 @@ gtest_discover_tests(
)
add_executable(no_tests_defined no_tests_defined.cpp)
+xcode_sign_adhoc(no_tests_defined)
gtest_discover_tests(
no_tests_defined
@@ -33,6 +37,7 @@ gtest_discover_tests(
# 3.10.3 and later behavior, old behavior added in 3.10.1
# is not supported.
add_executable(property_timeout_test timeout_test.cpp)
+xcode_sign_adhoc(property_timeout_test)
target_compile_definitions(property_timeout_test PRIVATE sleepSec=10)
gtest_discover_tests(
@@ -50,6 +55,7 @@ gtest_discover_tests(
)
add_executable(skip_test skip_test.cpp)
+xcode_sign_adhoc(skip_test)
gtest_discover_tests(
skip_test
diff --git a/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryMultiConfig.cmake b/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryMultiConfig.cmake
index df784fe..2fae1e2 100644
--- a/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryMultiConfig.cmake
+++ b/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryMultiConfig.cmake
@@ -1,9 +1,12 @@
-project(test_include_dirs LANGUAGES CXX)
+enable_language(CXX)
include(GoogleTest)
enable_testing()
+include(xcode_sign_adhoc.cmake)
+
add_executable(configuration_gtest configuration_gtest.cpp)
+xcode_sign_adhoc(configuration_gtest)
target_compile_definitions(configuration_gtest PRIVATE $<$<CONFIG:Debug>:DEBUG=1>)
gtest_discover_tests(
diff --git a/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryTimeout.cmake b/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryTimeout.cmake
index 20e9d65..5c24d41 100644
--- a/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryTimeout.cmake
+++ b/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryTimeout.cmake
@@ -1,9 +1,12 @@
-project(test_include_dirs LANGUAGES CXX)
+enable_language(CXX)
include(GoogleTest)
enable_testing()
+include(xcode_sign_adhoc.cmake)
+
add_executable(discovery_timeout_test timeout_test.cpp)
+xcode_sign_adhoc(discovery_timeout_test)
target_compile_definitions(discovery_timeout_test PRIVATE discoverySleepSec=10)
gtest_discover_tests(
discovery_timeout_test
diff --git a/Tests/RunCMake/GoogleTest/GoogleTestXML.cmake b/Tests/RunCMake/GoogleTest/GoogleTestXML.cmake
index fb91c0e..53eedc0 100644
--- a/Tests/RunCMake/GoogleTest/GoogleTestXML.cmake
+++ b/Tests/RunCMake/GoogleTest/GoogleTestXML.cmake
@@ -1,8 +1,10 @@
-project(test_include_dirs LANGUAGES CXX)
+enable_language(CXX)
include(GoogleTest)
enable_testing()
+include(xcode_sign_adhoc.cmake)
+
# This creates the folder structure for the paramterized tests
# to avoid handling missing folders in C++
#
@@ -15,6 +17,7 @@ enable_testing()
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/GoogleTestXMLSpecial/cases.case")
add_executable(xml_output xml_output.cpp)
+xcode_sign_adhoc(xml_output)
gtest_discover_tests(
xml_output
XML_OUTPUT_DIR ${CMAKE_BINARY_DIR}
diff --git a/Tests/RunCMake/GoogleTest/xcode_sign_adhoc.cmake b/Tests/RunCMake/GoogleTest/xcode_sign_adhoc.cmake
new file mode 100644
index 0000000..d2dc530
--- /dev/null
+++ b/Tests/RunCMake/GoogleTest/xcode_sign_adhoc.cmake
@@ -0,0 +1,8 @@
+function(xcode_sign_adhoc target)
+ if(CMAKE_GENERATOR STREQUAL "Xcode" AND
+ "${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64")
+ # Xcode runs POST_BUILD before signing, so let the linker use ad-hoc signing.
+ # See CMake Issue 21845.
+ target_link_options(${target} PRIVATE LINKER:-adhoc_codesign)
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake b/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake
index d314ff3..7456608 100644
--- a/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake
+++ b/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake
@@ -10,3 +10,4 @@ target_link_libraries(app_with_qt PRIVATE simple_lib Qt5::Core)
add_subdirectory(QtSubDir1)
add_subdirectory(QtSubDir2)
+add_subdirectory(QtSubDir3)
diff --git a/Tests/RunCMake/Ninja/QtSubDir3/CMakeLists.txt b/Tests/RunCMake/Ninja/QtSubDir3/CMakeLists.txt
new file mode 100644
index 0000000..d38cfe0
--- /dev/null
+++ b/Tests/RunCMake/Ninja/QtSubDir3/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_executable(sub_exe_3 ../app.cpp)
+target_link_libraries(sub_exe_3 PRIVATE Qt5::Core)
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index b91ab00..1b252cd 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -34,6 +34,7 @@ function(run_NoWorkToDo)
run_cmake(NoWorkToDo)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/NoWorkToDo-build)
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
run_cmake_command(NoWorkToDo-build ${CMAKE_COMMAND} --build .)
run_cmake_command(NoWorkToDo-nowork ${CMAKE_COMMAND} --build . -- -d explain)
endfunction()
@@ -43,6 +44,7 @@ function(run_VerboseBuild)
run_cmake(VerboseBuild)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/VerboseBuild-build)
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
run_cmake_command(VerboseBuild-build ${CMAKE_COMMAND} --build . -v --clean-first)
run_cmake_command(VerboseBuild-nowork ${CMAKE_COMMAND} --build . --verbose)
endfunction()
diff --git a/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt
index 4dbd861..6a7c171 100644
--- a/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt
+++ b/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt
@@ -3,7 +3,7 @@ CMake Error at BadSourceExpression3.cmake:2 \(add_library\):
\$<TARGET_OBJECTS:NotObjLib>
- Objects of target "NotObjLib" referenced but is not an allowed library
- types \(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT\).
+ Objects of target "NotObjLib" referenced but is not one of the allowed
+ target types \(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT\).
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake
index 0a76932..3d60556 100644
--- a/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake
@@ -12,4 +12,10 @@ add_executable(LinkObjLHSShared LinkObjLHSShared.c)
target_link_libraries(LinkObjLHSShared AnObjLib)
# Verify that our dependency on OtherLib generated its versioning symlinks.
+if(CMAKE_GENERATOR STREQUAL "Xcode" AND
+ "${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64")
+ # Xcode runs POST_BUILD before signing, so let the linker use ad-hoc signing.
+ # See CMake Issue 21845.
+ target_link_options(LinkObjLHSShared PRIVATE LINKER:-adhoc_codesign)
+endif()
add_custom_command(TARGET LinkObjLHSShared POST_BUILD COMMAND LinkObjLHSShared)
diff --git a/Tests/RunCMake/PrecompileHeaders/CXXnotC.cmake b/Tests/RunCMake/PrecompileHeaders/CXXnotC.cmake
new file mode 100644
index 0000000..9ec1b36
--- /dev/null
+++ b/Tests/RunCMake/PrecompileHeaders/CXXnotC.cmake
@@ -0,0 +1,15 @@
+enable_language(C)
+enable_language(CXX)
+
+add_executable(main
+ no_pch.c
+ use_pch.cxx
+)
+
+target_include_directories(main PUBLIC include)
+target_precompile_headers(main PRIVATE
+ "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/include/cxx_pch.h>"
+ )
+
+enable_testing()
+add_test(NAME main COMMAND main)
diff --git a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
index a5a3770..8cc59d2 100644
--- a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
@@ -14,6 +14,7 @@ run_cmake(PchDebugGenex)
run_test(PchInterface)
run_cmake(PchPrologueEpilogue)
run_test(SkipPrecompileHeaders)
+run_test(CXXnotC)
run_test(PchReuseFrom)
run_test(PchReuseFromPrefixed)
run_test(PchReuseFromSubdir)
diff --git a/Tests/RunCMake/PrecompileHeaders/include/cxx_pch.h b/Tests/RunCMake/PrecompileHeaders/include/cxx_pch.h
new file mode 100644
index 0000000..3282cec
--- /dev/null
+++ b/Tests/RunCMake/PrecompileHeaders/include/cxx_pch.h
@@ -0,0 +1 @@
+#define CXX_PCH
diff --git a/Tests/RunCMake/PrecompileHeaders/no_pch.c b/Tests/RunCMake/PrecompileHeaders/no_pch.c
new file mode 100644
index 0000000..8d22580
--- /dev/null
+++ b/Tests/RunCMake/PrecompileHeaders/no_pch.c
@@ -0,0 +1,7 @@
+#ifdef CXX_PCH
+# error "CXX PCH included in C source."
+#endif
+int no_pch(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/PrecompileHeaders/use_pch.cxx b/Tests/RunCMake/PrecompileHeaders/use_pch.cxx
new file mode 100644
index 0000000..caf115b
--- /dev/null
+++ b/Tests/RunCMake/PrecompileHeaders/use_pch.cxx
@@ -0,0 +1,9 @@
+#include "cxx_pch.h"
+#ifndef CXX_PCH
+# error "CXX PCH not included in CXX source."
+#endif
+extern "C" int no_pch(void);
+int main()
+{
+ return no_pch();
+}
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index e8fbd6a..a26f632 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -139,6 +139,12 @@ function(run_cmake test)
if(NOT "${actual_result}" MATCHES "${expect_result}")
string(APPEND msg "Result is [${actual_result}], not [${expect_result}].\n")
endif()
+
+ # Special case: remove ninja no-op line from stderr, but not stdout.
+ # Test cases that look for it should use RunCMake_TEST_OUTPUT_MERGE.
+ string(REGEX REPLACE "(^|\r?\n)ninja: no work to do\\.\r?\n" "\\1" actual_stderr "${actual_stderr}")
+
+ # Remove incidental content from both stdout and stderr.
string(CONCAT ignore_line_regex
"(^|\n)((==[0-9]+=="
"|BullseyeCoverage"
diff --git a/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt b/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt
index 77c4afd..9145a56 100644
--- a/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt
+++ b/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt
@@ -3,7 +3,7 @@ CMake Error at NotObjlibTarget.cmake:[0-9]+ \(file\):
\$<TARGET_OBJECTS:IFaceLib>
- Objects of target "IFaceLib" referenced but is not an allowed library types
- \(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT\).
+ Objects of target "IFaceLib" referenced but is not one of the allowed
+ target types \(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT\).
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/RunCMakeTest.cmake
index 0f0e5d8..f43a7c6 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/RunCMakeTest.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/RunCMakeTest.cmake
@@ -34,6 +34,7 @@ if (RunCMake_GENERATOR MATCHES "Makefiles|Ninja|Visual Studio|Xcode|Watcom WMake
run_cmake_target(genex CXX_interface2 LinkLibraries_CXX_interface2 --config Release)
run_cmake_target(genex C_static LinkLibraries_C_static --config Release)
run_cmake_target(genex CXX_static LinkLibraries_CXX_static --config Release)
+ run_cmake_target(genex C_static_CXX LinkLibraries_C_static_CXX --config Release)
unset(RunCMake_TEST_OPTIONS)
unset(RunCMake_TEST_OUTPUT_MERGE)
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/func.cxx b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/func.cxx
index a12caca..ee6811c 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/func.cxx
+++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/func.cxx
@@ -1,7 +1,18 @@
-#if defined(_WIN32)
-__declspec(dllexport)
+#if !defined(BUILD_STATIC) && defined(_WIN32)
+# define EXPORT_SYMBOL __declspec(dllexport)
+#else
+# define EXPORT_SYMBOL
#endif
- void func_cxx()
+
+EXPORT_SYMBOL
+void func_cxx()
{
}
+
+extern "C" {
+EXPORT_SYMBOL
+void func_c_cxx()
+{
+}
+}
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex.cmake b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex.cmake
index f3fe955..22d3df7 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex.cmake
@@ -7,6 +7,8 @@ enable_language(CXX)
add_library(shared_C SHARED func.c)
add_library(shared_CXX SHARED func.cxx)
+add_library(static_cxx STATIC func.cxx)
+target_compile_definitions(static_cxx PRIVATE BUILD_STATIC)
add_library(static1_C STATIC empty.c)
target_link_libraries (static1_C INTERFACE $<$<LINK_LANGUAGE:C>:shared_C>)
@@ -70,3 +72,10 @@ add_executable(LinkLibraries_C_static main.c)
target_link_libraries (LinkLibraries_C_static PRIVATE static3)
add_executable(LinkLibraries_CXX_static main.cxx)
target_link_libraries (LinkLibraries_CXX_static PRIVATE static3)
+
+# $<LINK_LANGUAGE:> change, by default, link language from C to CXX
+# but because LINKER_LANGUAGE property is set, keep C as link language
+add_executable(LinkLibraries_C_static_CXX main.c)
+target_compile_definitions (LinkLibraries_C_static_CXX PRIVATE C_USE_CXX)
+target_link_libraries (LinkLibraries_C_static_CXX PRIVATE $<$<LINK_LANGUAGE:C>:static_cxx>)
+set_property(TARGET LinkLibraries_C_static_CXX PROPERTY LINKER_LANGUAGE C)
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/main.c b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/main.c
index a908dea..689dbd7 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/main.c
+++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/main.c
@@ -1,12 +1,20 @@
-#if defined(_WIN32)
+#if defined(C_USE_CXX)
+void func_c_cxx();
+#else
+# if defined(_WIN32)
__declspec(dllimport)
-#endif
+# endif
void func_c();
+#endif
int main()
{
+#if defined(C_USE_CXX)
+ func_c_cxx();
+#else
func_c();
+#endif
return 0;
}
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index 5b849bf..fffb038 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -93,7 +93,9 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja")
message(STATUS "RerunCMake: first configuration...")
run_cmake(RerunCMake)
if(NOT CMake_TEST_FILESYSTEM_1S)
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
run_cmake_command(RerunCMake-nowork${ninja} ${CMAKE_COMMAND} --build .)
+ unset(RunCMake_TEST_OUTPUT_MERGE)
endif()
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) # handle 1s resolution
@@ -101,7 +103,9 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja")
file(WRITE "${in_tc}" "does-not-compile\n")
run_cmake_command(RerunCMake-rerun${ninja} ${CMAKE_COMMAND} --build .)
if(NOT CMake_TEST_FILESYSTEM_1S)
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
run_cmake_command(RerunCMake-nowork${ninja} ${CMAKE_COMMAND} --build .)
+ unset(RunCMake_TEST_OUTPUT_MERGE)
endif()
unset(RunCMake_TEST_BINARY_DIR)