summaryrefslogtreecommitdiff
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_makefiles.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_ninja.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.yml48
-rw-r--r--Help/manual/cmake-presets.7.rst5
-rw-r--r--Help/policy/CMP0116.rst5
-rw-r--r--Help/release/3.19.rst9
-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/cmCustomCommand.cxx10
-rw-r--r--Source/cmCustomCommand.h6
-rw-r--r--Source/cmFLTKWrapUICommand.cxx7
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx19
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx16
-rw-r--r--Source/cmLocalGenerator.cxx63
-rw-r--r--Source/cmLocalGenerator.h26
-rw-r--r--Source/cmLocalNinjaGenerator.cxx4
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx9
-rw-r--r--Source/cmMakefile.cxx52
-rw-r--r--Source/cmMakefile.h34
-rw-r--r--Source/cmQTWrapCPPCommand.cxx7
-rw-r--r--Source/cmQTWrapUICommand.cxx10
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.cxx4
-rw-r--r--Source/cmQtAutoGenInitializer.cxx39
-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/CMakePresets/CMakePresets.json.in4
-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/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/CMakePresets/validate_schema.py3
-rw-r--r--Tests/RunCMake/CMakePresetsTest/Good.json.in9
-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/RunCMake.cmake6
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake4
47 files changed, 421 insertions, 257 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a322aa6923..d0b3b1e00c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -236,62 +236,99 @@ build: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_makefiles.cmake b/.gitlab/ci/configure_macos_arm64_ninja.cmake
index f657d98fd0..f657d98fd0 100644
--- a/.gitlab/ci/configure_macos_makefiles.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 1b976d261a..1b976d261a 100644
--- a/.gitlab/ci/configure_macos_xcode.cmake
+++ b/.gitlab/ci/configure_macos_arm64_xcode.cmake
diff --git a/.gitlab/ci/configure_macos_ninja.cmake b/.gitlab/ci/configure_macos_x86_64_makefiles.cmake
index f657d98fd0..f657d98fd0 100644
--- a/.gitlab/ci/configure_macos_ninja.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 0000000000..f657d98fd0
--- /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 0000000000..1b976d261a
--- /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 76c693dc5d..3990430135 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 77bedaa2ed..12b8f9d0d3 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 450bae72cd..7fe62775a8 100644
--- a/.gitlab/os-macos.yml
+++ b/.gitlab/os-macos.yml
@@ -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,16 +64,23 @@
### External testing
-.macos_xcode:
+.macos_x86_64_xcode:
extends: .macos
variables:
- CMAKE_CONFIGURATION: macos_xcode
+ CMAKE_CONFIGURATION: macos_x86_64_xcode
+ CMAKE_GENERATOR: Xcode
+
+.macos_arm64_xcode:
+ extends: .macos
+
+ variables:
+ 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
@@ -74,7 +88,7 @@
- xcode-12.3
- nonconcurrent
-.macos_builder_tags_package:
+.macos_x86_64_builder_tags_package:
tags:
- cmake # Since this is a bare runner, pin to a project.
- macos
@@ -83,7 +97,7 @@
- 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
@@ -91,6 +105,22 @@
- xcode-12.3
- concurrent
+.macos_arm64_builder_tags:
+ tags:
+ - cmake # Since this is a bare runner, pin to a project.
+ - macos-arm64
+ - shell
+ - xcode-12.3
+ - nonconcurrent
+
+.macos_arm64_builder_ext_tags:
+ tags:
+ - cmake # Since this is a bare runner, pin to a project.
+ - macos-arm64
+ - shell
+ - xcode-12.3
+ - concurrent
+
## macOS-specific scripts
.before_script_macos: &before_script_macos
diff --git a/Help/manual/cmake-presets.7.rst b/Help/manual/cmake-presets.7.rst
index 55a9947e38..467818dfa6 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
diff --git a/Help/policy/CMP0116.rst b/Help/policy/CMP0116.rst
index 25a14c41ba..18e5a96d6a 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/release/3.19.rst b/Help/release/3.19.rst
index d8f4f9d79a..1d55f1e57f 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/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index ff2cc3eba9..a7ce3a60e5 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 104065f358..2b19aad4fe 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 29d532506c..c8d69b8f73 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 0295b33b2e..438a0779ab 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/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx
index 149f5e99e1..f6b9989848 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 2036e90b7f..e22c7a4064 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/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index d88617a01b..77d57957cd 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/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index fcdfc5064e..b19212e471 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 001d876650..c23ee94511 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 891f37b7bd..8ecebae007 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())) {
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 34b9649cba..73b6fbcf6e 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -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;
}
@@ -2739,6 +2742,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 +2752,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 +3965,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 +4038,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 +4083,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 +4096,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 +4121,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 +4179,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 +4197,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 7105a6f664..e48849a574 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -324,7 +324,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 +338,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 +350,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 +364,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,
@@ -686,7 +689,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 +701,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 +719,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 b8ad1a06d6..8ed411a3ca 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -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/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 97869c2ee2..a3940ead6c 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 e4859864c6..78cae0e986 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 6341abcb86..71d765c71f 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/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx
index e0581764a9..e9670f9c3a 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 66c0228fcc..f98f0b3214 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 62b879f84a..f79ffd4a0f 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 ba6c1c5618..d4138d93f0 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"
@@ -1226,7 +1225,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 +1257,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 +1266,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 +1285,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 +1372,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 +1413,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);
diff --git a/Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt b/Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt
new file mode 100644
index 0000000000..10e83a9058
--- /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 0000000000..6cbbc092f2
--- /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 8a83cc1d3f..ce3e86a699 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/CMakePresets/CMakePresets.json.in b/Tests/RunCMake/CMakePresets/CMakePresets.json.in
index 54e41403e4..e65c1a920e 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,
diff --git a/Tests/RunCMake/CMakePresets/Comment-result.txt b/Tests/RunCMake/CMakePresets/Comment-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /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 0000000000..2f404bc458
--- /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 0000000000..0f7120c119
--- /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/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
index 25a7f2f044..1864ecd1ba 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)
diff --git a/Tests/RunCMake/CMakePresets/validate_schema.py b/Tests/RunCMake/CMakePresets/validate_schema.py
index c9f84ee176..b2a67fc4b9 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/CMakePresetsTest/Good.json.in b/Tests/RunCMake/CMakePresetsTest/Good.json.in
index 791d41f04c..57be5a503b 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/Ninja/Qt5AutoMocDeps.cmake b/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake
index d314ff3355..74566086c6 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 0000000000..d38cfe0763
--- /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 b91ab008d2..1b252cd188 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/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index e8fbd6a7c1..a26f632e0d 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/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index 5b849bf8a9..fffb038196 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)