CMP0061: Remove support for OLD behavior

This commit is contained in:
Brad King 2024-12-11 16:42:40 -05:00
parent 3dc19e24cb
commit 789a7d73d4
16 changed files with 13 additions and 104 deletions

View File

@ -15,14 +15,14 @@ This is mainly intended for internal use by the :module:`CTest` module.
Sets the given ``<variable>`` to a command-line string of the form::
<cmake> --build . [--config <config>] [--parallel <parallel>] [--target <target>...] [-- -i]
<cmake> --build . [--config <config>] [--parallel <parallel>] [--target <target>...]
where ``<cmake>`` is the location of the :manual:`cmake(1)` command-line
tool, and ``<config>``, ``<parallel>`` and ``<target>`` are the values
provided to the ``CONFIGURATION``, ``PARALLEL_LEVEL`` and ``TARGET``
options, if any. The trailing ``-- -i`` option is added for
:ref:`Makefile Generators` if policy :policy:`CMP0061` is not set to
``NEW``.
options, if any. In CMake versions prior to 4.0, a trailing ``-- -i``
option was added for :ref:`Makefile Generators` if policy :policy:`CMP0061`
was not set to ``NEW``.
When invoked, this :option:`cmake --build` command line will launch the
underlying build system tool.

View File

@ -1,6 +1,9 @@
CMP0061
-------
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
.. include:: REMOVED_PROLOGUE.txt
.. versionadded:: 3.3
CTest does not by default tell ``make`` to ignore errors (``-i``).
@ -22,7 +25,5 @@ calls in CTest. The ``NEW`` behavior for this policy is to not
add ``-i``.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.3
.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn
.. include:: STANDARD_ADVICE.txt
.. include:: DEPRECATED.txt
.. |WARNED_OR_DID_NOT_WARN| replace:: did *not* warn
.. include:: REMOVED_EPILOGUE.txt

View File

@ -93,7 +93,7 @@ std::unique_ptr<cmCTestGenericHandler> cmCTestBuildCommand::InitializeHandler(
std::string dir = this->CTest->GetCTestConfiguration("BuildDirectory");
std::string buildCommand = globalGenerator->GenerateCMakeBuildCommand(
cmakeBuildTarget, cmakeBuildConfiguration, args.ParallelLevel,
cmakeBuildAdditionalFlags, mf.IgnoreErrorsCMP0061());
cmakeBuildAdditionalFlags, false);
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"SetMakeCommand:" << buildCommand << "\n",
args.Quiet);

View File

@ -84,7 +84,7 @@ bool MainSignature(std::vector<std::string> const& args,
}
std::string makecommand = mf.GetGlobalGenerator()->GenerateCMakeBuildCommand(
target, configuration, parallel, "", mf.IgnoreErrorsCMP0061());
target, configuration, parallel, "", false);
mf.AddDefinition(variable, makecommand);
@ -111,7 +111,7 @@ bool TwoArgsSignature(std::vector<std::string> const& args,
}
std::string makecommand = mf.GetGlobalGenerator()->GenerateCMakeBuildCommand(
"", configType, "", "", mf.IgnoreErrorsCMP0061());
"", configType, "", "", false);
if (cacheValue) {
return true;

View File

@ -4101,22 +4101,6 @@ void cmMakefile::RecordPolicies(cmPolicies::PolicyMap& pm) const
}
}
bool cmMakefile::IgnoreErrorsCMP0061() const
{
bool ignoreErrors = true;
switch (this->GetPolicyStatus(cmPolicies::CMP0061)) {
case cmPolicies::WARN:
// No warning for this policy!
CM_FALLTHROUGH;
case cmPolicies::OLD:
break;
case cmPolicies::NEW:
ignoreErrors = false;
break;
}
return ignoreErrors;
}
cmMakefile::FunctionPushPop::FunctionPushPop(cmMakefile* mf,
const std::string& fileName,
cmPolicies::PolicyMap const& pm)

View File

@ -417,8 +417,6 @@ public:
cmMakefile* Makefile;
};
bool IgnoreErrorsCMP0061() const;
std::string const& GetHomeDirectory() const;
std::string const& GetHomeOutputDirectory() const;

View File

@ -180,7 +180,7 @@ class cmMakefile;
0, NEW) \
SELECT(POLICY, CMP0061, \
"CTest does not by default tell make to ignore errors (-i).", 3, 3, \
0, WARN) \
0, NEW) \
SELECT(POLICY, CMP0062, "Disallow install() of export() result.", 3, 3, 0, \
WARN) \
SELECT(POLICY, CMP0063, \

View File

@ -1,2 +1 @@
cmake_policy(SET CMP0061 NEW)
include(CMP0061Common.cmake)

View File

@ -1,21 +0,0 @@
^CMake Deprecation Warning at CMP0061-OLD-make.cmake:[0-9]+ \(cmake_policy\):
The OLD behavior for policy CMP0061 will be removed from a future version
of CMake.
The cmake-policies\(7\) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)
+
[^
]+ --build \. --config "Release" -- -i
[^
]+ --build \. --config "Release" --target "MyTarget" -- -i
[^
]+ --build \. --config "Debug" -- -i
[^
]+ --build \. --config "Debug" --target "MyTarget" -- -i
[^
]+ --build \. --config "Release" -- -i$

View File

@ -1,2 +0,0 @@
cmake_policy(SET CMP0061 OLD)
include(CMP0061Common.cmake)

View File

@ -1,21 +0,0 @@
^CMake Deprecation Warning at CMP0061-OLD-other.cmake:[0-9]+ \(cmake_policy\):
The OLD behavior for policy CMP0061 will be removed from a future version
of CMake.
The cmake-policies\(7\) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)
+
[^
]+ --build \. --config "Release"
[^
]+ --build \. --config "Release" --target "MyTarget"
[^
]+ --build \. --config "Debug"
[^
]+ --build \. --config "Debug" --target "MyTarget"
[^
]+ --build \. --config "Release"$

View File

@ -1,2 +0,0 @@
cmake_policy(SET CMP0061 OLD)
include(CMP0061Common.cmake)

View File

@ -9,10 +9,5 @@ run_cmake(BeforeProject)
unset(RunCMake_TEST_OPTIONS)
run_cmake(CMP0061-NEW)
if(RunCMake_GENERATOR MATCHES "Make")
run_cmake(CMP0061-OLD-make)
else()
run_cmake(CMP0061-OLD-other)
endif()
run_cmake(ParallelLevel)

View File

@ -1,10 +0,0 @@
^CMake Deprecation Warning at [^
]*/Tests/RunCMake/ctest_build/BuildFailure-CMP0061-OLD/test\.cmake:[0-9]+ \(cmake_policy\):
Compatibility with CMake < 3\.10 will be removed from a future version of
CMake.
Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
to tell CMake that the project requires at least <min> but has been updated
to work with policies introduced by <max> or earlier\.
+(Error\(s\) when building project
)?ctest_build returned zero$

View File

@ -33,17 +33,6 @@ else()
endif()
]])
run_ctest(BuildFailure)
if (RunCMake_GENERATOR MATCHES "Makefiles")
set(LANG NONE)
set(CASE_TEST_PREFIX_CODE [[
cmake_policy(VERSION 3.2)
]])
set(CASE_CMAKELISTS_SUFFIX_CODE [[
add_custom_target(BuildFailure ALL COMMAND command-does-not-exist)
]])
run_ctest(BuildFailure-CMP0061-OLD)
endif()
endblock()
function(run_BuildChangeId)