CMP0017: Remove support for OLD behavior

This commit is contained in:
Brad King
2024-11-17 10:40:02 -05:00
parent ae13e27225
commit d74210a8bd
4 changed files with 8 additions and 39 deletions

View File

@@ -1,6 +1,9 @@
CMP0017
-------
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
.. include:: REMOVED_PROLOGUE.txt
Prefer files from the CMake module directory when including from there.
Starting with CMake 2.8.4, if a cmake-module shipped with CMake (i.e.
@@ -15,7 +18,5 @@ behavior is to always prefer files from CMAKE_MODULE_PATH over files
from the CMake modules directory.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.4
.. |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

@@ -3737,16 +3737,6 @@ std::string cmMakefile::GetModulesFile(cm::string_view filename, bool& system,
{
std::string result;
// We search the module always in CMAKE_ROOT and in CMAKE_MODULE_PATH,
// and then decide based on the policy setting which one to return.
// See CMP0017 for more details.
// The specific problem was that KDE 4.5.0 installs a
// FindPackageHandleStandardArgs.cmake which doesn't have the new features
// of FPHSA.cmake introduced in CMake 2.8.3 yet, and by setting
// CMAKE_MODULE_PATH also e.g. FindZLIB.cmake from cmake included
// FPHSA.cmake from kdelibs and not from CMake, and tried to use the
// new features, which were not there in the version from kdelibs, and so
// failed ("
std::string moduleInCMakeRoot;
std::string moduleInCMakeModulePath;
@@ -3795,25 +3785,8 @@ std::string cmMakefile::GetModulesFile(cm::string_view filename, bool& system,
cmValue currentFile = this->GetDefinition("CMAKE_CURRENT_LIST_FILE");
std::string mods = cmStrCat(cmSystemTools::GetCMakeRoot(), "/Modules/");
if (currentFile && cmSystemTools::IsSubDirectory(*currentFile, mods)) {
switch (this->GetPolicyStatus(cmPolicies::CMP0017)) {
case cmPolicies::WARN: {
auto e = cmStrCat(
"File ", *currentFile, " includes ", moduleInCMakeModulePath,
" (found via CMAKE_MODULE_PATH) which shadows ", moduleInCMakeRoot,
". This may cause errors later on .\n",
cmPolicies::GetPolicyWarning(cmPolicies::CMP0017));
this->IssueMessage(MessageType::AUTHOR_WARNING, e);
CM_FALLTHROUGH;
}
case cmPolicies::OLD:
system = false;
result = moduleInCMakeModulePath;
break;
case cmPolicies::NEW:
system = true;
result = moduleInCMakeRoot;
break;
}
system = true;
result = moduleInCMakeRoot;
}
}

View File

@@ -64,7 +64,7 @@ class cmMakefile;
SELECT(POLICY, CMP0017, \
"Prefer files from the CMake module directory when including from " \
"there.", \
2, 8, 4, WARN) \
2, 8, 4, NEW) \
SELECT(POLICY, CMP0018, \
"Ignore CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.", 2, 8, 9, WARN) \
SELECT(POLICY, CMP0019, \

View File

@@ -12,11 +12,6 @@ set(CMAKE_FIND_USE_INSTALL_PREFIX OFF)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
# Look for a package which uses FindPackageHandleStandardArgs.cmake with the
# new (as of cmake 2.8.3) syntax. This works only if CMP0017 is set to NEW,
# because otherwise FindPackageHandleStandardArgs.cmake from the current
# directory is included (via CMAKE_MODULE_PATH).
cmake_policy(SET CMP0017 NEW)
find_package(ZLIB QUIET)
# Look for a package that has a find module and may be found.