mirror of
https://github.com/Kitware/CMake.git
synced 2026-08-03 22:30:29 +00:00
CMP0052: Remove support for OLD behavior
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
CMP0052
|
CMP0052
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
|
||||||
|
.. include:: REMOVED_PROLOGUE.txt
|
||||||
|
|
||||||
.. versionadded:: 3.1
|
.. versionadded:: 3.1
|
||||||
|
|
||||||
Reject source and build dirs in installed
|
Reject source and build dirs in installed
|
||||||
@@ -22,7 +25,5 @@ directory. The ``NEW`` behavior for this
|
|||||||
policy is to issue an error if such a directory is used.
|
policy is to issue an error if such a directory is used.
|
||||||
|
|
||||||
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.1
|
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.1
|
||||||
.. |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
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
#include "cmLocalGenerator.h"
|
#include "cmLocalGenerator.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
#include "cmMessageType.h"
|
#include "cmMessageType.h"
|
||||||
#include "cmPolicies.h"
|
|
||||||
#include "cmStringAlgorithms.h"
|
#include "cmStringAlgorithms.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "cmTarget.h"
|
#include "cmTarget.h"
|
||||||
@@ -456,43 +455,11 @@ bool cmExportInstallFileGenerator::CheckInterfaceDirs(
|
|||||||
bool inSource = isSubDirectory(li, topSourceDir);
|
bool inSource = isSubDirectory(li, topSourceDir);
|
||||||
if (isSubDirectory(li, installDir)) {
|
if (isSubDirectory(li, installDir)) {
|
||||||
// The include directory is inside the install tree. If the
|
// The include directory is inside the install tree. If the
|
||||||
// install tree is not inside the source tree or build tree then
|
// install tree is inside the source tree or build tree then do not
|
||||||
// fall through to the checks below that the include directory is not
|
// fall through to the checks below that the include directory is not
|
||||||
// also inside the source tree or build tree.
|
// also inside the source tree or build tree.
|
||||||
bool shouldContinue =
|
if ((!inBinary || isSubDirectory(installDir, topBinaryDir)) &&
|
||||||
(!inBinary || isSubDirectory(installDir, topBinaryDir)) &&
|
(!inSource || isSubDirectory(installDir, topSourceDir))) {
|
||||||
(!inSource || isSubDirectory(installDir, topSourceDir));
|
|
||||||
|
|
||||||
if (prop == "INTERFACE_INCLUDE_DIRECTORIES") {
|
|
||||||
if (!shouldContinue) {
|
|
||||||
switch (target->GetPolicyStatusCMP0052()) {
|
|
||||||
case cmPolicies::WARN: {
|
|
||||||
std::ostringstream s;
|
|
||||||
s << cmPolicies::GetPolicyWarning(cmPolicies::CMP0052) << "\n";
|
|
||||||
s << "Directory:\n \"" << li
|
|
||||||
<< "\"\nin "
|
|
||||||
"INTERFACE_INCLUDE_DIRECTORIES of target \""
|
|
||||||
<< target->GetName()
|
|
||||||
<< "\" is a subdirectory of the install "
|
|
||||||
"directory:\n \""
|
|
||||||
<< installDir
|
|
||||||
<< "\"\nhowever it is also "
|
|
||||||
"a subdirectory of the "
|
|
||||||
<< (inBinary ? "build" : "source") << " tree:\n \""
|
|
||||||
<< (inBinary ? topBinaryDir : topSourceDir) << "\"\n";
|
|
||||||
target->GetLocalGenerator()->IssueMessage(
|
|
||||||
MessageType::AUTHOR_WARNING, s.str());
|
|
||||||
CM_FALLTHROUGH;
|
|
||||||
}
|
|
||||||
case cmPolicies::OLD:
|
|
||||||
shouldContinue = true;
|
|
||||||
break;
|
|
||||||
case cmPolicies::NEW:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (shouldContinue) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ class cmMakefile;
|
|||||||
SELECT(POLICY, CMP0052, \
|
SELECT(POLICY, CMP0052, \
|
||||||
"Reject source and build dirs in installed " \
|
"Reject source and build dirs in installed " \
|
||||||
"INTERFACE_INCLUDE_DIRECTORIES.", \
|
"INTERFACE_INCLUDE_DIRECTORIES.", \
|
||||||
3, 1, 0, WARN) \
|
3, 1, 0, NEW) \
|
||||||
SELECT(POLICY, CMP0053, \
|
SELECT(POLICY, CMP0053, \
|
||||||
"Simplify variable reference and escape sequence evaluation.", 3, 1, \
|
"Simplify variable reference and escape sequence evaluation.", 3, 1, \
|
||||||
0, WARN) \
|
0, WARN) \
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
1
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
0
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
^CMake Deprecation Warning at CMakeLists\.txt:[0-9]+ \(cmake_minimum_required\):
|
|
||||||
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\.
|
|
||||||
+
|
|
||||||
CMake Deprecation Warning at CMakeLists.txt:[0-9]+ \(cmake_minimum_required\):
|
|
||||||
The OLD behavior for policy CMP0052 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.$
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
CMake Warning \(dev\) in CMakeLists.txt:
|
|
||||||
Policy CMP0052 is not set: Reject source and build dirs in installed
|
|
||||||
INTERFACE_INCLUDE_DIRECTORIES. Run "cmake --help-policy CMP0052" for
|
|
||||||
policy details. Use the cmake_policy command to set the policy and
|
|
||||||
suppress this warning.
|
|
||||||
|
|
||||||
Directory:
|
|
||||||
|
|
||||||
".*Tests/RunCMake/IfacePaths_INCDIRS/prefix/BinInInstallPrefix-CMP0052-WARN-build/foo"
|
|
||||||
|
|
||||||
in INTERFACE_INCLUDE_DIRECTORIES of target "testTarget" is a subdirectory
|
|
||||||
of the install directory:
|
|
||||||
|
|
||||||
".*Tests/RunCMake/IfacePaths_INCDIRS/prefix"
|
|
||||||
|
|
||||||
however it is also a subdirectory of the build tree:
|
|
||||||
|
|
||||||
".*Tests/RunCMake/IfacePaths_INCDIRS/prefix/BinInInstallPrefix-CMP0052-WARN-build"
|
|
||||||
|
|
||||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
CMake Error in CMakeLists.txt:
|
CMake Error in CMakeLists.txt:
|
||||||
Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path:
|
Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path:
|
||||||
|
|
||||||
".*Tests/RunCMake/IfacePaths_INCDIRS/prefix/BinInInstallPrefix-CMP0052-NEW-build/foo"
|
".*Tests/RunCMake/IfacePaths_INCDIRS/prefix/BinInInstallPrefix-build/foo"
|
||||||
|
|
||||||
which is prefixed in the build directory.
|
which is prefixed in the build directory.
|
||||||
@@ -1,8 +1,4 @@
|
|||||||
if(RunCMake_TEST MATCHES "-CMP0052")
|
cmake_minimum_required(VERSION 3.10)
|
||||||
cmake_minimum_required(VERSION 3.0) # old enough to not set CMP0052
|
|
||||||
else()
|
|
||||||
cmake_minimum_required(VERSION 3.10)
|
|
||||||
endif()
|
|
||||||
project(${RunCMake_TEST} NONE)
|
project(${RunCMake_TEST} NONE)
|
||||||
if(NOT TEST_FILE)
|
if(NOT TEST_FILE)
|
||||||
set(TEST_FILE ${RunCMake_TEST}.cmake)
|
set(TEST_FILE ${RunCMake_TEST}.cmake)
|
||||||
|
|||||||
@@ -68,40 +68,25 @@ configure_file(
|
|||||||
COPYONLY
|
COPYONLY
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach(policyStatus NEW OLD "")
|
set(RunCMake_TEST_OPTIONS
|
||||||
if (TEST_PROP STREQUAL INCLUDE_DIRECTORIES)
|
"--install-prefix ${RunCMake_BINARY_DIR}/prefix" ${policyOption}
|
||||||
if (NOT "${policyStatus}" STREQUAL "")
|
"-DTEST_FILE=${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface.cmake"
|
||||||
set(policyOption -DCMAKE_POLICY_DEFAULT_CMP0052=${policyStatus})
|
)
|
||||||
else()
|
# Set the RunCMake_TEST_SOURCE_DIR here to the copy too. This is needed to run
|
||||||
unset(policyOption)
|
# the test suite in-source properly. Otherwise the install directory would be
|
||||||
set(policyStatus WARN)
|
# a subdirectory or the source directory, which is allowed and tested separately
|
||||||
endif()
|
# below.
|
||||||
set(policySuffix -CMP0052-${policyStatus})
|
set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/prefix/src")
|
||||||
endif()
|
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/prefix/BinInInstallPrefix-build")
|
||||||
set(RunCMake_TEST_OPTIONS
|
run_cmake(BinInInstallPrefix)
|
||||||
"--install-prefix ${RunCMake_BINARY_DIR}/prefix" ${policyOption}
|
unset(RunCMake_TEST_BINARY_DIR)
|
||||||
"-DTEST_FILE=${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface.cmake"
|
|
||||||
)
|
|
||||||
# Set the RunCMake_TEST_SOURCE_DIR here to the copy too. This is needed to run
|
|
||||||
# the test suite in-source properly. Otherwise the install directory would be
|
|
||||||
# a subdirectory or the source directory, which is allowed and tested separately
|
|
||||||
# below.
|
|
||||||
set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/prefix/src")
|
|
||||||
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/prefix/BinInInstallPrefix${policySuffix}-build")
|
|
||||||
run_cmake(BinInInstallPrefix${policySuffix})
|
|
||||||
unset(RunCMake_TEST_BINARY_DIR)
|
|
||||||
|
|
||||||
set(RunCMake_TEST_OPTIONS
|
set(RunCMake_TEST_OPTIONS
|
||||||
"-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption}
|
"-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption}
|
||||||
"-DTEST_FILE=${RunCMake_BINARY_DIR}/prefix/src/SourceDirectoryInInterface.cmake"
|
"-DTEST_FILE=${RunCMake_BINARY_DIR}/prefix/src/SourceDirectoryInInterface.cmake"
|
||||||
)
|
)
|
||||||
run_cmake(SrcInInstallPrefix${policySuffix})
|
run_cmake(SrcInInstallPrefix)
|
||||||
unset(RunCMake_TEST_SOURCE_DIR)
|
unset(RunCMake_TEST_SOURCE_DIR)
|
||||||
|
|
||||||
if (NOT TEST_PROP STREQUAL INCLUDE_DIRECTORIES)
|
|
||||||
break()
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallPrefixInInterface-build/prefix")
|
set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallPrefixInInterface-build/prefix")
|
||||||
run_cmake(InstallPrefixInInterface)
|
run_cmake(InstallPrefixInInterface)
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
1
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
0
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
^CMake Deprecation Warning at CMakeLists\.txt:[0-9]+ \(cmake_minimum_required\):
|
|
||||||
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\.
|
|
||||||
+
|
|
||||||
CMake Deprecation Warning at CMakeLists\.txt:[0-9]+ \(cmake_minimum_required\):
|
|
||||||
The OLD behavior for policy CMP0052 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.$
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
CMake Warning \(dev\) in CMakeLists.txt:
|
|
||||||
Policy CMP0052 is not set: Reject source and build dirs in installed
|
|
||||||
INTERFACE_INCLUDE_DIRECTORIES. Run "cmake --help-policy CMP0052" for
|
|
||||||
policy details. Use the cmake_policy command to set the policy and
|
|
||||||
suppress this warning.
|
|
||||||
|
|
||||||
Directory:
|
|
||||||
|
|
||||||
".*Tests/RunCMake/IfacePaths_INCDIRS/prefix/src/foo"
|
|
||||||
|
|
||||||
in INTERFACE_INCLUDE_DIRECTORIES of target "testTarget" is a subdirectory
|
|
||||||
of the install directory:
|
|
||||||
|
|
||||||
".*Tests/RunCMake/IfacePaths_INCDIRS/prefix"
|
|
||||||
|
|
||||||
however it is also a subdirectory of the source tree:
|
|
||||||
|
|
||||||
".*Tests/RunCMake/IfacePaths_INCDIRS/prefix/src"
|
|
||||||
|
|
||||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
|
||||||
Reference in New Issue
Block a user