mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 13:20:47 -06:00
CMP0062: Remove support for OLD behavior
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
CMP0062
|
CMP0062
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
|
||||||
|
.. include:: REMOVED_PROLOGUE.txt
|
||||||
|
|
||||||
.. versionadded:: 3.3
|
.. versionadded:: 3.3
|
||||||
|
|
||||||
Disallow :command:`install` of :command:`export` result.
|
Disallow :command:`install` of :command:`export` result.
|
||||||
@@ -24,7 +27,5 @@ an :command:`export()` command. The ``NEW`` behavior for this policy is
|
|||||||
not to allow installing the result of an :command:`export()` command.
|
not to allow installing the result of an :command:`export()` command.
|
||||||
|
|
||||||
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.3
|
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.3
|
||||||
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
|
.. |WARNED_OR_DID_NOT_WARN| replace:: warned
|
||||||
.. include:: STANDARD_ADVICE.txt
|
.. include:: REMOVED_EPILOGUE.txt
|
||||||
|
|
||||||
.. include:: DEPRECATED.txt
|
|
||||||
|
|||||||
@@ -1597,41 +1597,17 @@ bool HandleFilesMode(std::vector<std::string> const& args,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmPolicies::PolicyStatus policyStatus =
|
|
||||||
helper.Makefile->GetPolicyStatus(cmPolicies::CMP0062);
|
|
||||||
|
|
||||||
cmGlobalGenerator* gg = helper.Makefile->GetGlobalGenerator();
|
cmGlobalGenerator* gg = helper.Makefile->GetGlobalGenerator();
|
||||||
for (std::string const& file : filesVector) {
|
for (std::string const& file : filesVector) {
|
||||||
if (gg->IsExportedTargetsFile(file)) {
|
if (gg->IsExportedTargetsFile(file)) {
|
||||||
const char* modal = nullptr;
|
helper.Makefile->IssueMessage(
|
||||||
std::ostringstream e;
|
MessageType::FATAL_ERROR,
|
||||||
MessageType messageType = MessageType::AUTHOR_WARNING;
|
cmStrCat("The file\n ", file, '\n',
|
||||||
|
"was generated by the export() command. "
|
||||||
switch (policyStatus) {
|
"It may not be installed with the install() command. "
|
||||||
case cmPolicies::WARN:
|
"Use the install(EXPORT) mechanism instead. "
|
||||||
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0062) << "\n";
|
"See the cmake-packages(7) manual for more."));
|
||||||
modal = "should";
|
return false;
|
||||||
CM_FALLTHROUGH;
|
|
||||||
case cmPolicies::OLD:
|
|
||||||
break;
|
|
||||||
case cmPolicies::NEW:
|
|
||||||
modal = "may";
|
|
||||||
messageType = MessageType::FATAL_ERROR;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (modal) {
|
|
||||||
e << "The file\n " << file
|
|
||||||
<< "\nwas generated by the export() "
|
|
||||||
"command. It "
|
|
||||||
<< modal
|
|
||||||
<< " not be installed with the "
|
|
||||||
"install() command. Use the install(EXPORT) mechanism "
|
|
||||||
"instead. See the cmake-packages(7) manual for more.\n";
|
|
||||||
helper.Makefile->IssueMessage(messageType, e.str());
|
|
||||||
if (messageType == MessageType::FATAL_ERROR) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ class cmMakefile;
|
|||||||
"CTest does not by default tell make to ignore errors (-i).", 3, 3, \
|
"CTest does not by default tell make to ignore errors (-i).", 3, 3, \
|
||||||
0, NEW) \
|
0, NEW) \
|
||||||
SELECT(POLICY, CMP0062, "Disallow install() of export() result.", 3, 3, 0, \
|
SELECT(POLICY, CMP0062, "Disallow install() of export() result.", 3, 3, 0, \
|
||||||
WARN) \
|
NEW) \
|
||||||
SELECT(POLICY, CMP0063, \
|
SELECT(POLICY, CMP0063, \
|
||||||
"Honor visibility properties for all target types.", 3, 3, 0, WARN) \
|
"Honor visibility properties for all target types.", 3, 3, 0, WARN) \
|
||||||
SELECT(POLICY, CMP0064, "Support new TEST if() operator.", 3, 4, 0, WARN) \
|
SELECT(POLICY, CMP0064, "Support new TEST if() operator.", 3, 4, 0, WARN) \
|
||||||
|
|||||||
@@ -6,6 +6,5 @@ CMake Error at CMP0062-NEW.cmake:[0-9]+ \(install\):
|
|||||||
was generated by the export\(\) command. It may not be installed with the
|
was generated by the export\(\) command. It may not be installed with the
|
||||||
install\(\) command. Use the install\(EXPORT\) mechanism instead. See the
|
install\(\) command. Use the install\(EXPORT\) mechanism instead. See the
|
||||||
cmake-packages\(7\) manual for more.
|
cmake-packages\(7\) manual for more.
|
||||||
|
|
||||||
Call Stack \(most recent call first\):
|
Call Stack \(most recent call first\):
|
||||||
CMakeLists.txt:[0-9]+ \(include\)
|
CMakeLists.txt:[0-9]+ \(include\)
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
cmake_policy(VERSION 3.2)
|
|
||||||
cmake_policy(SET CMP0062 NEW)
|
|
||||||
|
|
||||||
add_library(iface INTERFACE)
|
add_library(iface INTERFACE)
|
||||||
export(TARGETS iface FILE "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake")
|
export(TARGETS iface FILE "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake")
|
||||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake" DESTINATION cmake)
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake" DESTINATION cmake)
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
0
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
^CMake Deprecation Warning at CMP0062-OLD\.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\.
|
|
||||||
Call Stack \(most recent call first\):
|
|
||||||
CMakeLists.txt:[0-9]+ \(include\)
|
|
||||||
+
|
|
||||||
CMake Deprecation Warning at CMP0062-OLD\.cmake:[0-9]+ \(cmake_policy\):
|
|
||||||
The OLD behavior for policy CMP0062 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\)
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
cmake_policy(VERSION 3.2)
|
|
||||||
cmake_policy(SET CMP0062 OLD)
|
|
||||||
|
|
||||||
add_library(iface INTERFACE)
|
|
||||||
export(TARGETS iface FILE "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake")
|
|
||||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake" DESTINATION cmake)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
0
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
CMake Warning \(dev\) at CMP0062-WARN.cmake:[0-9]+ \(install\):
|
|
||||||
Policy CMP0062 is not set: Disallow install\(\) of export\(\) result. Run
|
|
||||||
"cmake --help-policy CMP0062" for policy details. Use the cmake_policy
|
|
||||||
command to set the policy and suppress this warning.
|
|
||||||
|
|
||||||
The file
|
|
||||||
|
|
||||||
.*Tests/RunCMake/install/CMP0062-WARN-build/exported.cmake
|
|
||||||
|
|
||||||
was generated by the export\(\) command. It should not be installed with the
|
|
||||||
install\(\) command. Use the install\(EXPORT\) mechanism instead. See the
|
|
||||||
cmake-packages\(7\) manual for more.
|
|
||||||
|
|
||||||
Call Stack \(most recent call first\):
|
|
||||||
CMakeLists.txt:[0-9]+ \(include\)
|
|
||||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
cmake_policy(VERSION 3.2)
|
|
||||||
|
|
||||||
add_library(iface INTERFACE)
|
|
||||||
export(TARGETS iface FILE "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake")
|
|
||||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake" DESTINATION cmake)
|
|
||||||
@@ -88,9 +88,7 @@ run_cmake(EXPORT-NamelinkOnly)
|
|||||||
run_cmake(EXPORT-SeparateNamelink)
|
run_cmake(EXPORT-SeparateNamelink)
|
||||||
run_cmake(EXPORT-TargetTwice)
|
run_cmake(EXPORT-TargetTwice)
|
||||||
run_cmake(EXPORT-InterfaceLinkNoexist)
|
run_cmake(EXPORT-InterfaceLinkNoexist)
|
||||||
run_cmake(CMP0062-OLD)
|
|
||||||
run_cmake(CMP0062-NEW)
|
run_cmake(CMP0062-NEW)
|
||||||
run_cmake(CMP0062-WARN)
|
|
||||||
run_cmake(CMP0087-OLD)
|
run_cmake(CMP0087-OLD)
|
||||||
run_cmake(CMP0087-NEW)
|
run_cmake(CMP0087-NEW)
|
||||||
run_cmake(CMP0087-WARN)
|
run_cmake(CMP0087-WARN)
|
||||||
|
|||||||
Reference in New Issue
Block a user