diff --git a/Help/policy/CMP0009.rst b/Help/policy/CMP0009.rst index c5545228d8..aeef533ce0 100644 --- a/Help/policy/CMP0009.rst +++ b/Help/policy/CMP0009.rst @@ -1,6 +1,9 @@ CMP0009 ------- +.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0 +.. include:: REMOVED_PROLOGUE.txt + FILE GLOB_RECURSE calls should not follow symlinks by default. 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. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.2 -.. |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 diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake index 055a0ee8df..c8c23e13e4 100644 --- a/Modules/ExternalData.cmake +++ b/Modules/ExternalData.cmake @@ -869,10 +869,7 @@ macro(_ExternalData_arg_series) endmacro() 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}*") - cmake_policy(POP) set(externals_count -1) foreach(entry IN LISTS globbed) if("x${entry}" MATCHES "^x(.*)(\\.(${_ExternalData_REGEX_EXT}))$") diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 99dc7efd7b..9eec090506 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -677,28 +677,14 @@ bool HandleGlobImpl(std::vector const& args, bool recurse, i++; cmsys::Glob g; g.SetRecurse(recurse); - - bool explicitFollowSymlinks = false; - cmPolicies::PolicyStatus policyStatus = - status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0009); if (recurse) { - switch (policyStatus) { - case cmPolicies::NEW: - g.RecurseThroughSymlinksOff(); - break; - case cmPolicies::WARN: - CM_FALLTHROUGH; - case cmPolicies::OLD: - g.RecurseThroughSymlinksOn(); - break; - } + g.RecurseThroughSymlinksOff(); } cmake* cm = status.GetMakefile().GetCMakeInstance(); std::vector files; bool configureDepends = false; bool warnConfigureLate = false; - bool warnFollowedSymlinks = false; const cmake::WorkingMode workingMode = cm->GetWorkingMode(); while (i != args.end()) { if (*i == "LIST_DIRECTORIES") { @@ -722,7 +708,6 @@ bool HandleGlobImpl(std::vector const& args, bool recurse, } else if (*i == "FOLLOW_SYMLINKS") { ++i; // skip FOLLOW_SYMLINKS if (recurse) { - explicitFollowSymlinks = true; g.RecurseThroughSymlinksOn(); if (i == args.end()) { status.SetError( @@ -805,11 +790,6 @@ bool HandleGlobImpl(std::vector const& args, bool recurse, } } - if (recurse && !explicitFollowSymlinks && - g.GetFollowedSymlinkCount() != 0) { - warnFollowedSymlinks = true; - } - std::vector& foundFiles = g.GetFiles(); cm::append(files, foundFiles); @@ -834,24 +814,6 @@ bool HandleGlobImpl(std::vector 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()); files.erase(std::unique(files.begin(), files.end()), files.end()); status.GetMakefile().AddDefinition(variable, cmList::to_string(files)); diff --git a/Source/cmGlobVerificationManager.cxx b/Source/cmGlobVerificationManager.cxx index 73365d2d17..7f160049b4 100644 --- a/Source/cmGlobVerificationManager.cxx +++ b/Source/cmGlobVerificationManager.cxx @@ -42,8 +42,6 @@ bool cmGlobVerificationManager::SaveVerificationScript(const std::string& path, << cmVersion::GetMajorVersion() << "." << cmVersion::GetMinorVersion() << "\n"; - verifyScriptFile << "cmake_policy(SET CMP0009 NEW)\n"; - for (auto const& i : this->Cache) { CacheEntryKey k = std::get<0>(i); CacheEntryValue v = std::get<1>(i); diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 21527fca3d..186ea428e1 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -42,7 +42,7 @@ class cmMakefile; 6, 1, NEW) \ SELECT(POLICY, CMP0009, \ "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, \ 3, WARN) \ SELECT(POLICY, CMP0011, \ diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake index 39a316f426..747144688c 100644 --- a/Tests/RunCMake/CPack/DEB/Helpers.cmake +++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake @@ -70,12 +70,7 @@ function(getMissingShlibsErrorExtra FILE RESULT_VAR) if(err_) set(error_extra " Extra: Could not unpack package content: '${err}'") else() - cmake_policy(PUSH) - # 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) + file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/data_${PREFIX}/*") # get file info so that we can determine if file is executable or not foreach(FILE_ IN LISTS FILE_PATHS_) diff --git a/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake.cmake b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake.cmake index da40534379..0e3cdec690 100644 --- a/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake.cmake +++ b/Tests/RunCMake/file/GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake.cmake @@ -1,4 +1,3 @@ -cmake_policy(SET CMP0009 NEW) message(STATUS "Running CMake on GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake") file(GLOB_RECURSE CONTENT_LIST