CMP0042: Remove support for OLD behavior

This commit is contained in:
Brad King 2024-11-29 11:44:51 -05:00
parent 7193c2d23d
commit 9b148ed1ac
20 changed files with 8 additions and 89 deletions

View File

@ -1,6 +1,9 @@
CMP0042
-------
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
.. include:: REMOVED_PROLOGUE.txt
:prop_tgt:`MACOSX_RPATH` is enabled by default.
CMake 2.8.12 and newer has support for using ``@rpath`` in a target's install
@ -15,7 +18,5 @@ the :prop_tgt:`INSTALL_NAME_DIR` and :variable:`CMAKE_INSTALL_NAME_DIR`
variables.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
.. include:: STANDARD_ADVICE.txt
.. include:: DEPRECATED.txt
.. |WARNED_OR_DID_NOT_WARN| replace:: warned
.. include:: REMOVED_EPILOGUE.txt

View File

@ -1540,14 +1540,7 @@ bool cmGeneratorTarget::MacOSXRpathInstallNameDirDefault() const
return this->GetPropertyAsBool("MACOSX_RPATH");
}
cmPolicies::PolicyStatus cmp0042 = this->GetPolicyStatusCMP0042();
if (cmp0042 == cmPolicies::WARN) {
this->LocalGenerator->GetGlobalGenerator()->AddCMP0042WarnTarget(
this->GetName());
}
return cmp0042 == cmPolicies::NEW;
return true;
}
bool cmGeneratorTarget::MacOSXUseInstallNameDir() const

View File

@ -1403,11 +1403,6 @@ cmExportBuildFileGenerator* cmGlobalGenerator::GetExportedTargetsFile(
return it == this->BuildExportSets.end() ? nullptr : it->second;
}
void cmGlobalGenerator::AddCMP0042WarnTarget(const std::string& target)
{
this->CMP0042WarnTargets.insert(target);
}
void cmGlobalGenerator::AddCMP0068WarnTarget(const std::string& target)
{
this->CMP0068WarnTargets.insert(target);
@ -1490,8 +1485,6 @@ bool cmGlobalGenerator::Compute()
// Start with an empty vector:
this->FilesReplacedDuringGenerate.clear();
// clear targets to issue warning CMP0042 for
this->CMP0042WarnTargets.clear();
// clear targets to issue warning CMP0068 for
this->CMP0068WarnTargets.clear();
@ -1697,19 +1690,6 @@ void cmGlobalGenerator::Generate()
// Perform validation checks on memoized link structures.
this->CheckTargetLinkLibraries();
if (!this->CMP0042WarnTargets.empty()) {
std::ostringstream w;
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0042)
<< "\n"
"MACOSX_RPATH is not specified for"
" the following targets:\n";
for (std::string const& t : this->CMP0042WarnTargets) {
w << ' ' << t << '\n';
}
this->GetCMakeInstance()->IssueMessage(MessageType::AUTHOR_WARNING,
w.str());
}
if (!this->CMP0068WarnTargets.empty()) {
std::ostringstream w;
/* clang-format off */

View File

@ -623,7 +623,6 @@ public:
bool IsExportedTargetsFile(const std::string& filename) const;
cmExportBuildFileGenerator* GetExportedTargetsFile(
const std::string& filename) const;
void AddCMP0042WarnTarget(const std::string& target);
void AddCMP0068WarnTarget(const std::string& target);
virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
@ -900,8 +899,6 @@ private:
// Set of binary directories on disk.
std::set<std::string> BinaryDirectories;
// track targets to issue CMP0042 warning for.
std::set<std::string> CMP0042WarnTargets;
// track targets to issue CMP0068 warning for.
std::set<std::string> CMP0068WarnTargets;

View File

@ -130,7 +130,7 @@ class cmMakefile;
"Error on relative include with generator expression.", 3, 0, 0, \
NEW) \
SELECT(POLICY, CMP0042, "MACOSX_RPATH is enabled by default.", 3, 0, 0, \
WARN) \
NEW) \
SELECT(POLICY, CMP0043, "Ignore COMPILE_DEFINITIONS_<Config> properties.", \
3, 0, 0, WARN) \
SELECT(POLICY, CMP0044, \

View File

@ -10,8 +10,6 @@ add_library(shared2 SHARED shared.cpp shared.h)
set_target_properties(shared2 PROPERTIES
BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "@rpath")
cmake_policy(SET CMP0042 NEW)
# a framework library
add_library(framework SHARED framework.cpp framework.h)
set_target_properties(framework PROPERTIES FRAMEWORK 1)

View File

@ -1,7 +1,5 @@
enable_language(CXX)
cmake_policy(SET CMP0042 NEW)
add_library(foo SHARED empty_vs6_1.cpp)
add_library(bar SHARED empty_vs6_2.cpp)
target_link_libraries(bar foo)

View File

@ -1 +0,0 @@
0

View File

@ -1,4 +1 @@
cmake_policy(SET CMP0042 NEW)
add_library(foo SHARED empty.cpp)

View File

@ -1,10 +0,0 @@
^CMake Deprecation Warning at CMP0042-OLD.cmake:2 \(cmake_policy\):
The OLD behavior for policy CMP0042 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:3 \(include\)$

View File

@ -1,4 +0,0 @@
cmake_policy(SET CMP0042 OLD)
add_library(foo SHARED empty.cpp)

View File

@ -1,10 +0,0 @@
CMake Warning \(dev\):
Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake
--help-policy CMP0042" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
MACOSX_RPATH is not specified for the following targets:
foo
This warning is for project developers. Use -Wno-dev to suppress it.

View File

@ -1,9 +0,0 @@
add_library(foo SHARED empty.cpp)
add_library(foo-static STATIC empty.cpp)
add_library(foo2 SHARED empty.cpp)
set_target_properties(foo2 PROPERTIES MACOSX_RPATH 1)
add_library(foo3 SHARED empty.cpp)
set_target_properties(foo3 PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "@loader_path")
add_library(foo4 SHARED empty.cpp)
set_target_properties(foo4 PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "@rpath")

View File

@ -1,3 +1,3 @@
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} CXX)
include(${RunCMake_TEST}.cmake)

View File

@ -1,6 +1,3 @@
include(RunCMake)
set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON)
run_cmake(CMP0042-OLD)
run_cmake(CMP0042-NEW)
run_cmake(CMP0042-WARN)

View File

@ -1,6 +1,5 @@
cmake_policy(SET CMP0068 NEW)
cmake_policy(SET CMP0042 NEW)
add_library(foo SHARED empty.cpp)
set_target_properties(foo PROPERTIES INSTALL_NAME_DIR "@rpath" INSTALL_RPATH "@loader_path/" BUILD_WITH_INSTALL_RPATH 1)

View File

@ -1,6 +1,5 @@
cmake_policy(SET CMP0068 OLD)
cmake_policy(SET CMP0042 NEW)
add_library(foo SHARED empty.cpp)
set_target_properties(foo PROPERTIES INSTALL_NAME_DIR "@rpath" INSTALL_RPATH "@loader_path/" BUILD_WITH_INSTALL_RPATH 1)

View File

@ -1,5 +1,3 @@
cmake_policy(SET CMP0042 NEW)
add_library(foo SHARED empty.cpp)
add_library(foo-static STATIC empty.cpp)
add_library(foo2 SHARED empty.cpp)

View File

@ -1,6 +1,3 @@
cmake_policy (SET CMP0042 NEW)
enable_language(C)
add_library(foo SHARED lib.c)