mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-19 02:17:27 +08:00
CMP0009: Remove support for OLD behavior
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
CMP0009
|
CMP0009
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
|
||||||
|
.. include:: REMOVED_PROLOGUE.txt
|
||||||
|
|
||||||
FILE GLOB_RECURSE calls should not follow symlinks by default.
|
FILE GLOB_RECURSE calls should not follow symlinks by default.
|
||||||
|
|
||||||
In CMake 2.6.1 and below, :command:`file(GLOB_RECURSE)` calls would follow
|
In CMake 2.6.1 and below, :command:`file(GLOB_RECURSE)` calls would follow
|
||||||
@@ -15,7 +18,5 @@ to follow the symlinks by default, but only if ``FOLLOW_SYMLINKS`` is given
|
|||||||
as an additional argument to the ``FILE`` command.
|
as an additional argument to the ``FILE`` command.
|
||||||
|
|
||||||
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.2
|
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.2
|
||||||
.. |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
|
|
||||||
|
@@ -869,10 +869,7 @@ macro(_ExternalData_arg_series)
|
|||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
function(_ExternalData_arg_find_files glob pattern regex)
|
function(_ExternalData_arg_find_files glob pattern regex)
|
||||||
cmake_policy(PUSH)
|
|
||||||
cmake_policy(SET CMP0009 NEW)
|
|
||||||
file(${glob} globbed RELATIVE "${top_src}" "${top_src}/${pattern}*")
|
file(${glob} globbed RELATIVE "${top_src}" "${top_src}/${pattern}*")
|
||||||
cmake_policy(POP)
|
|
||||||
set(externals_count -1)
|
set(externals_count -1)
|
||||||
foreach(entry IN LISTS globbed)
|
foreach(entry IN LISTS globbed)
|
||||||
if("x${entry}" MATCHES "^x(.*)(\\.(${_ExternalData_REGEX_EXT}))$")
|
if("x${entry}" MATCHES "^x(.*)(\\.(${_ExternalData_REGEX_EXT}))$")
|
||||||
|
@@ -677,28 +677,14 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
|
|||||||
i++;
|
i++;
|
||||||
cmsys::Glob g;
|
cmsys::Glob g;
|
||||||
g.SetRecurse(recurse);
|
g.SetRecurse(recurse);
|
||||||
|
|
||||||
bool explicitFollowSymlinks = false;
|
|
||||||
cmPolicies::PolicyStatus policyStatus =
|
|
||||||
status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0009);
|
|
||||||
if (recurse) {
|
if (recurse) {
|
||||||
switch (policyStatus) {
|
g.RecurseThroughSymlinksOff();
|
||||||
case cmPolicies::NEW:
|
|
||||||
g.RecurseThroughSymlinksOff();
|
|
||||||
break;
|
|
||||||
case cmPolicies::WARN:
|
|
||||||
CM_FALLTHROUGH;
|
|
||||||
case cmPolicies::OLD:
|
|
||||||
g.RecurseThroughSymlinksOn();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmake* cm = status.GetMakefile().GetCMakeInstance();
|
cmake* cm = status.GetMakefile().GetCMakeInstance();
|
||||||
std::vector<std::string> files;
|
std::vector<std::string> files;
|
||||||
bool configureDepends = false;
|
bool configureDepends = false;
|
||||||
bool warnConfigureLate = false;
|
bool warnConfigureLate = false;
|
||||||
bool warnFollowedSymlinks = false;
|
|
||||||
const cmake::WorkingMode workingMode = cm->GetWorkingMode();
|
const cmake::WorkingMode workingMode = cm->GetWorkingMode();
|
||||||
while (i != args.end()) {
|
while (i != args.end()) {
|
||||||
if (*i == "LIST_DIRECTORIES") {
|
if (*i == "LIST_DIRECTORIES") {
|
||||||
@@ -722,7 +708,6 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
|
|||||||
} else if (*i == "FOLLOW_SYMLINKS") {
|
} else if (*i == "FOLLOW_SYMLINKS") {
|
||||||
++i; // skip FOLLOW_SYMLINKS
|
++i; // skip FOLLOW_SYMLINKS
|
||||||
if (recurse) {
|
if (recurse) {
|
||||||
explicitFollowSymlinks = true;
|
|
||||||
g.RecurseThroughSymlinksOn();
|
g.RecurseThroughSymlinksOn();
|
||||||
if (i == args.end()) {
|
if (i == args.end()) {
|
||||||
status.SetError(
|
status.SetError(
|
||||||
@@ -805,11 +790,6 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recurse && !explicitFollowSymlinks &&
|
|
||||||
g.GetFollowedSymlinkCount() != 0) {
|
|
||||||
warnFollowedSymlinks = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string>& foundFiles = g.GetFiles();
|
std::vector<std::string>& foundFiles = g.GetFiles();
|
||||||
cm::append(files, foundFiles);
|
cm::append(files, foundFiles);
|
||||||
|
|
||||||
@@ -834,24 +814,6 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (policyStatus) {
|
|
||||||
case cmPolicies::NEW:
|
|
||||||
// Correct behavior, yay!
|
|
||||||
break;
|
|
||||||
case cmPolicies::OLD:
|
|
||||||
// Probably not really the expected behavior, but the author explicitly
|
|
||||||
// asked for the old behavior... no warning.
|
|
||||||
case cmPolicies::WARN:
|
|
||||||
// Possibly unexpected old behavior *and* we actually traversed
|
|
||||||
// symlinks without being explicitly asked to: warn the author.
|
|
||||||
if (warnFollowedSymlinks) {
|
|
||||||
status.GetMakefile().IssueMessage(
|
|
||||||
MessageType::AUTHOR_WARNING,
|
|
||||||
cmPolicies::GetPolicyWarning(cmPolicies::CMP0009));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::sort(files.begin(), files.end());
|
std::sort(files.begin(), files.end());
|
||||||
files.erase(std::unique(files.begin(), files.end()), files.end());
|
files.erase(std::unique(files.begin(), files.end()), files.end());
|
||||||
status.GetMakefile().AddDefinition(variable, cmList::to_string(files));
|
status.GetMakefile().AddDefinition(variable, cmList::to_string(files));
|
||||||
|
@@ -42,8 +42,6 @@ bool cmGlobVerificationManager::SaveVerificationScript(const std::string& path,
|
|||||||
<< cmVersion::GetMajorVersion() << "."
|
<< cmVersion::GetMajorVersion() << "."
|
||||||
<< cmVersion::GetMinorVersion() << "\n";
|
<< cmVersion::GetMinorVersion() << "\n";
|
||||||
|
|
||||||
verifyScriptFile << "cmake_policy(SET CMP0009 NEW)\n";
|
|
||||||
|
|
||||||
for (auto const& i : this->Cache) {
|
for (auto const& i : this->Cache) {
|
||||||
CacheEntryKey k = std::get<0>(i);
|
CacheEntryKey k = std::get<0>(i);
|
||||||
CacheEntryValue v = std::get<1>(i);
|
CacheEntryValue v = std::get<1>(i);
|
||||||
|
@@ -42,7 +42,7 @@ class cmMakefile;
|
|||||||
6, 1, NEW) \
|
6, 1, NEW) \
|
||||||
SELECT(POLICY, CMP0009, \
|
SELECT(POLICY, CMP0009, \
|
||||||
"FILE GLOB_RECURSE calls should not follow symlinks by default.", 2, \
|
"FILE GLOB_RECURSE calls should not follow symlinks by default.", 2, \
|
||||||
6, 2, WARN) \
|
6, 2, NEW) \
|
||||||
SELECT(POLICY, CMP0010, "Bad variable reference syntax is an error.", 2, 6, \
|
SELECT(POLICY, CMP0010, "Bad variable reference syntax is an error.", 2, 6, \
|
||||||
3, WARN) \
|
3, WARN) \
|
||||||
SELECT(POLICY, CMP0011, \
|
SELECT(POLICY, CMP0011, \
|
||||||
|
@@ -70,12 +70,7 @@ function(getMissingShlibsErrorExtra FILE RESULT_VAR)
|
|||||||
if(err_)
|
if(err_)
|
||||||
set(error_extra " Extra: Could not unpack package content: '${err}'")
|
set(error_extra " Extra: Could not unpack package content: '${err}'")
|
||||||
else()
|
else()
|
||||||
cmake_policy(PUSH)
|
file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/data_${PREFIX}/*")
|
||||||
# Tell file(GLOB_RECURSE) not to follow directory symlinks
|
|
||||||
# even if the project does not set this policy to NEW.
|
|
||||||
cmake_policy(SET CMP0009 NEW)
|
|
||||||
file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/data_${PREFIX}/*")
|
|
||||||
cmake_policy(POP)
|
|
||||||
|
|
||||||
# get file info so that we can determine if file is executable or not
|
# get file info so that we can determine if file is executable or not
|
||||||
foreach(FILE_ IN LISTS FILE_PATHS_)
|
foreach(FILE_ IN LISTS FILE_PATHS_)
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
cmake_policy(SET CMP0009 NEW)
|
|
||||||
message(STATUS "Running CMake on GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake")
|
message(STATUS "Running CMake on GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake")
|
||||||
file(GLOB_RECURSE
|
file(GLOB_RECURSE
|
||||||
CONTENT_LIST
|
CONTENT_LIST
|
||||||
|
Reference in New Issue
Block a user