From a43470b9ba829671131faf68539164de0d118dd6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Sun, 17 Nov 2024 10:29:29 -0500 Subject: [PATCH 01/13] CMP0015: Remove support for OLD behavior --- Help/policy/CMP0015.rst | 9 ++++--- Source/cmLinkDirectoriesCommand.cxx | 28 +-------------------- Source/cmPolicies.h | 2 +- Tests/LinkDirectory/External/CMakeLists.txt | 6 ----- 4 files changed, 7 insertions(+), 38 deletions(-) diff --git a/Help/policy/CMP0015.rst b/Help/policy/CMP0015.rst index 2e185069c9..6fbe833601 100644 --- a/Help/policy/CMP0015.rst +++ b/Help/policy/CMP0015.rst @@ -1,6 +1,9 @@ CMP0015 ------- +.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0 +.. include:: REMOVED_PROLOGUE.txt + :command:`link_directories` treats paths relative to the source dir. In CMake 2.8.0 and lower the :command:`link_directories` command passed @@ -13,7 +16,5 @@ this policy is to use relative paths verbatim in the linker command. The paths by appending the relative path to ``CMAKE_CURRENT_SOURCE_DIR``. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.1 -.. |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/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx index 395f7ceb5d..d45d495b5b 100644 --- a/Source/cmLinkDirectoriesCommand.cxx +++ b/Source/cmLinkDirectoriesCommand.cxx @@ -2,14 +2,10 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmLinkDirectoriesCommand.h" -#include - #include "cmExecutionStatus.h" #include "cmGeneratorExpression.h" #include "cmList.h" #include "cmMakefile.h" -#include "cmMessageType.h" -#include "cmPolicies.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" @@ -52,29 +48,7 @@ static void AddLinkDir(cmMakefile& mf, std::string const& dir, cmSystemTools::ConvertToUnixSlashes(unixPath); if (!cmSystemTools::FileIsFullPath(unixPath) && !cmGeneratorExpression::StartsWithGeneratorExpression(unixPath)) { - bool convertToAbsolute = false; - std::ostringstream e; - /* clang-format off */ - e << "This command specifies the relative path\n" - << " " << unixPath << "\n" - << "as a link directory.\n"; - /* clang-format on */ - switch (mf.GetPolicyStatus(cmPolicies::CMP0015)) { - case cmPolicies::WARN: - e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0015); - mf.IssueMessage(MessageType::AUTHOR_WARNING, e.str()); - CM_FALLTHROUGH; - case cmPolicies::OLD: - // OLD behavior does not convert - break; - case cmPolicies::NEW: - // NEW behavior converts - convertToAbsolute = true; - break; - } - if (convertToAbsolute) { - unixPath = cmStrCat(mf.GetCurrentSourceDirectory(), '/', unixPath); - } + unixPath = cmStrCat(mf.GetCurrentSourceDirectory(), '/', unixPath); } directories.push_back(unixPath); } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 13e09c3a48..841cc8270f 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -56,7 +56,7 @@ class cmMakefile; 8, 0, NEW) \ SELECT(POLICY, CMP0015, \ "link_directories() treats paths relative to the source dir.", 2, 8, \ - 1, WARN) \ + 1, NEW) \ SELECT(POLICY, CMP0016, \ "target_link_libraries() reports error if its only argument " \ "is not a target.", \ diff --git a/Tests/LinkDirectory/External/CMakeLists.txt b/Tests/LinkDirectory/External/CMakeLists.txt index b85e351a04..d2d37228f7 100644 --- a/Tests/LinkDirectory/External/CMakeLists.txt +++ b/Tests/LinkDirectory/External/CMakeLists.txt @@ -20,13 +20,7 @@ add_executable(myexe3 myexe.c) set_property(TARGET myexe3 PROPERTY OUTPUT_NAME LinkDirectory3) target_link_libraries(myexe3 PRIVATE mylibs) - -# Test CMP0015 OLD behavior: -L../lib -cmake_policy(SET CMP0015 OLD) link_directories(../lib${cfg_dir}) - -# Test CMP0015 NEW behavior: -L${CMAKE_CURRENT_SOURCE_DIR}/lib -cmake_policy(SET CMP0015 NEW) link_directories(lib${cfg_dir}) add_executable(myexe myexe.c) From ae13e27225532f44042b2ad744d8c0da76c48eb2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Sun, 17 Nov 2024 10:36:08 -0500 Subject: [PATCH 02/13] CMP0016: Remove support for OLD behavior --- Help/policy/CMP0016.rst | 9 +++--- Source/cmPolicies.h | 2 +- Source/cmTargetLinkLibrariesCommand.cxx | 41 +++---------------------- 3 files changed, 11 insertions(+), 41 deletions(-) diff --git a/Help/policy/CMP0016.rst b/Help/policy/CMP0016.rst index 960361dec1..2e5ac53f7a 100644 --- a/Help/policy/CMP0016.rst +++ b/Help/policy/CMP0016.rst @@ -1,6 +1,9 @@ CMP0016 ------- +.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0 +.. include:: REMOVED_PROLOGUE.txt + :command:`target_link_libraries` reports error if its only argument is not a target. @@ -10,7 +13,5 @@ wasn't a valid target. In CMake 2.8.3 and above it reports an error in this case. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.3 -.. |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/Source/cmPolicies.h b/Source/cmPolicies.h index 841cc8270f..5a6c4a1b20 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -60,7 +60,7 @@ class cmMakefile; SELECT(POLICY, CMP0016, \ "target_link_libraries() reports error if its only argument " \ "is not a target.", \ - 2, 8, 3, WARN) \ + 2, 8, 3, NEW) \ SELECT(POLICY, CMP0017, \ "Prefer files from the CMake module directory when including from " \ "there.", \ diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 48f4d4f047..c4527a43e3 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -95,42 +95,11 @@ bool cmTargetLinkLibrariesCommand(std::vector const& args, } } if (!target) { - MessageType t = MessageType::FATAL_ERROR; // fail by default - std::ostringstream e; - e << "Cannot specify link libraries for target \"" << args[0] - << "\" which is not built by this project."; - // The bad target is the only argument. Check how policy CMP0016 is set, - // and accept, warn or fail respectively: - if (args.size() < 2) { - switch (mf.GetPolicyStatus(cmPolicies::CMP0016)) { - case cmPolicies::WARN: - t = MessageType::AUTHOR_WARNING; - // Print the warning. - e << "\n" - "CMake does not support this but it used to work accidentally " - "and is being allowed for compatibility." - "\n" - << cmPolicies::GetPolicyWarning(cmPolicies::CMP0016); - break; - case cmPolicies::OLD: // OLD behavior does not warn. - t = MessageType::MESSAGE; - break; - case cmPolicies::NEW: // NEW behavior prints the error. - break; - } - } - // Now actually print the message. - switch (t) { - case MessageType::AUTHOR_WARNING: - mf.IssueMessage(MessageType::AUTHOR_WARNING, e.str()); - break; - case MessageType::FATAL_ERROR: - mf.IssueMessage(MessageType::FATAL_ERROR, e.str()); - cmSystemTools::SetFatalErrorOccurred(); - break; - default: - break; - } + mf.IssueMessage(MessageType::FATAL_ERROR, + cmStrCat("Cannot specify link libraries for target \"", + args[0], + "\" which is not built by this project.")); + cmSystemTools::SetFatalErrorOccurred(); return true; } From d74210a8bdd34e11929c291872a718ce1b8d159e Mon Sep 17 00:00:00 2001 From: Brad King Date: Sun, 17 Nov 2024 10:40:02 -0500 Subject: [PATCH 03/13] CMP0017: Remove support for OLD behavior --- Help/policy/CMP0017.rst | 9 ++++--- Source/cmMakefile.cxx | 31 ++--------------------- Source/cmPolicies.h | 2 +- Tests/FindPackageCMakeTest/CMakeLists.txt | 5 ---- 4 files changed, 8 insertions(+), 39 deletions(-) diff --git a/Help/policy/CMP0017.rst b/Help/policy/CMP0017.rst index d06ad137e1..7bac8a69c0 100644 --- a/Help/policy/CMP0017.rst +++ b/Help/policy/CMP0017.rst @@ -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 diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 88d3c0c041..1a0ec22ada 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -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; } } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 5a6c4a1b20..bd2071290a 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -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__FLAGS variable.", 2, 8, 9, WARN) \ SELECT(POLICY, CMP0019, \ diff --git a/Tests/FindPackageCMakeTest/CMakeLists.txt b/Tests/FindPackageCMakeTest/CMakeLists.txt index 4153437c56..3e010292a7 100644 --- a/Tests/FindPackageCMakeTest/CMakeLists.txt +++ b/Tests/FindPackageCMakeTest/CMakeLists.txt @@ -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. From b6930d24f8aeccfb2eb54002902f9efe396e3541 Mon Sep 17 00:00:00 2001 From: Brad King Date: Sun, 17 Nov 2024 10:52:21 -0500 Subject: [PATCH 04/13] cmMakefile: Simplify GetModulesFile decision logic After removing CMP0017, the logic can be simpler. --- Source/cmMakefile.cxx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 1a0ec22ada..b22d9b23a3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3774,20 +3774,22 @@ std::string cmMakefile::GetModulesFile(cm::string_view filename, bool& system, // Normally, prefer the files found in CMAKE_MODULE_PATH. Only when the file // from which we are being called is located itself in CMAKE_ROOT, then // prefer results from CMAKE_ROOT depending on the policy setting. - system = false; - result = moduleInCMakeModulePath; - if (result.empty()) { - system = true; - result = moduleInCMakeRoot; - } - if (!moduleInCMakeModulePath.empty() && !moduleInCMakeRoot.empty()) { cmValue currentFile = this->GetDefinition("CMAKE_CURRENT_LIST_FILE"); std::string mods = cmStrCat(cmSystemTools::GetCMakeRoot(), "/Modules/"); if (currentFile && cmSystemTools::IsSubDirectory(*currentFile, mods)) { system = true; result = moduleInCMakeRoot; + } else { + system = false; + result = moduleInCMakeModulePath; } + } else if (!moduleInCMakeModulePath.empty()) { + system = false; + result = moduleInCMakeModulePath; + } else { + system = true; + result = moduleInCMakeRoot; } return result; From 41a7a0119f4d87b4ddda59f63117c8202bf82bdf Mon Sep 17 00:00:00 2001 From: Brad King Date: Sun, 17 Nov 2024 10:53:57 -0500 Subject: [PATCH 05/13] CMP0018: Remove support for OLD behavior --- Help/policy/CMP0018.rst | 9 ++-- Source/cmGhsMultiTargetGenerator.cxx | 2 +- Source/cmGlobalGenerator.cxx | 16 ------- Source/cmGlobalGenerator.h | 3 -- Source/cmGlobalXCodeGenerator.cxx | 3 +- Source/cmLocalGenerator.cxx | 66 +++------------------------- Source/cmLocalGenerator.h | 5 +-- Source/cmPolicies.h | 2 +- 8 files changed, 15 insertions(+), 91 deletions(-) diff --git a/Help/policy/CMP0018.rst b/Help/policy/CMP0018.rst index e4cd1849bb..c3ae66fc84 100644 --- a/Help/policy/CMP0018.rst +++ b/Help/policy/CMP0018.rst @@ -1,6 +1,9 @@ CMP0018 ------- +.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0 +.. include:: REMOVED_PROLOGUE.txt + Ignore ``CMAKE_SHARED_LIBRARY__FLAGS`` variable. CMake 2.8.8 and lower compiled sources in ``SHARED`` and ``MODULE`` libraries @@ -28,7 +31,5 @@ The ``NEW`` behavior for this policy is to ignore honor the :prop_tgt:`POSITION_INDEPENDENT_CODE` target property. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.9 -.. |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/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 60679baea7..4b1e8959b4 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -203,7 +203,7 @@ void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config, std::string flags; this->LocalGenerator->AddLanguageFlags( flags, this->GeneratorTarget, cmBuildStep::Compile, language, config); - this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, + this->LocalGenerator->AddFeatureFlags(flags, this->GeneratorTarget, language, config); this->LocalGenerator->AddVisibilityPresetFlags( flags, this->GeneratorTarget, language); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index eed22d331f..5b02484476 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -981,12 +981,6 @@ void cmGlobalGenerator::EnableLanguage( } } - // Store the shared library flags so that we can satisfy CMP0018 - std::string sharedLibFlagsVar = - cmStrCat("CMAKE_SHARED_LIBRARY_", lang, "_FLAGS"); - this->LanguageToOriginalSharedLibFlags[lang] = - mf->GetSafeDefinition(sharedLibFlagsVar); - // Translate compiler ids for compatibility. this->CheckCompilerIdCompatibility(mf, lang); } // end for each language @@ -3475,16 +3469,6 @@ bool cmGlobalGenerator::ShouldStripResourcePath(cmMakefile* mf) const return mf->PlatformIsAppleEmbedded(); } -std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage( - std::string const& l) const -{ - auto const it = this->LanguageToOriginalSharedLibFlags.find(l); - if (it != this->LanguageToOriginalSharedLibFlags.end()) { - return it->second; - } - return ""; -} - void cmGlobalGenerator::AppendDirectoryForConfig(const std::string& /*unused*/, const std::string& /*unused*/, const std::string& /*unused*/, diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index c0f0fdf998..d4be86d642 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -591,8 +591,6 @@ public: virtual bool SupportsLinkerDependencyFile() const { return false; } - std::string GetSharedLibFlagsForLanguage(std::string const& lang) const; - /** Generate an .rule file path for a given command output. */ virtual std::string GenerateRuleFile(std::string const& output) const; @@ -826,7 +824,6 @@ private: std::map LanguageToOutputExtension; std::map ExtensionToLanguage; std::map LanguageToLinkerPreference; - std::map LanguageToOriginalSharedLibFlags; #if !defined(CMAKE_BOOTSTRAP) std::unique_ptr JsonWriter; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index daef82163b..9305627ec4 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2421,8 +2421,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->CurrentLocalGenerator->AppendFeatureOptions(flags, lang, "IPO"); } - // Add shared-library flags if needed. - this->CurrentLocalGenerator->AddCMP0018Flags(flags, gtgt, lang, + this->CurrentLocalGenerator->AddFeatureFlags(flags, gtgt, lang, configName); this->CurrentLocalGenerator->AddVisibilityPresetFlags(flags, gtgt, lang); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f2a65da1c1..861210c4d5 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1749,7 +1749,7 @@ std::vector> cmLocalGenerator::GetTargetCompileFlags( } } - this->AddCMP0018Flags(compileFlags, target, lang, config); + this->AddFeatureFlags(compileFlags, target, lang, config); this->AddVisibilityPresetFlags(compileFlags, target, lang); this->AddColorDiagnosticsFlags(compileFlags, lang); this->AppendFlags(compileFlags, mf->GetDefineFlags()); @@ -2423,19 +2423,6 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName, return true; } -void cmLocalGenerator::AddSharedFlags(std::string& flags, - const std::string& lang, bool shared) -{ - std::string flagsVar; - - // Add flags for dealing with shared libraries for this language. - if (shared) { - this->AppendFlags(flags, - this->Makefile->GetSafeDefinition( - cmStrCat("CMAKE_SHARED_LIBRARY_", lang, "_FLAGS"))); - } -} - static void AddVisibilityCompileOption(std::string& flags, cmGeneratorTarget const* target, cmLocalGenerator* lg, @@ -2540,7 +2527,7 @@ void cmLocalGenerator::AddVisibilityPresetFlags( } } -void cmLocalGenerator::AddCMP0018Flags(std::string& flags, +void cmLocalGenerator::AddFeatureFlags(std::string& flags, cmGeneratorTarget const* target, std::string const& lang, const std::string& config) @@ -2550,54 +2537,13 @@ void cmLocalGenerator::AddCMP0018Flags(std::string& flags, bool shared = ((targetType == cmStateEnums::SHARED_LIBRARY) || (targetType == cmStateEnums::MODULE_LIBRARY)); - if (this->GetShouldUseOldFlags(shared, lang)) { - this->AddSharedFlags(flags, lang, shared); - } else { - if (target->GetLinkInterfaceDependentBoolProperty( - "POSITION_INDEPENDENT_CODE", config)) { - this->AddPositionIndependentFlags(flags, lang, targetType); - } - if (shared) { - this->AppendFeatureOptions(flags, lang, "DLL"); - } + if (target->GetLinkInterfaceDependentBoolProperty( + "POSITION_INDEPENDENT_CODE", config)) { + this->AddPositionIndependentFlags(flags, lang, targetType); } -} - -bool cmLocalGenerator::GetShouldUseOldFlags(bool shared, - const std::string& lang) const -{ - std::string originalFlags = - this->GlobalGenerator->GetSharedLibFlagsForLanguage(lang); if (shared) { - std::string flagsVar = cmStrCat("CMAKE_SHARED_LIBRARY_", lang, "_FLAGS"); - std::string const& flags = this->Makefile->GetSafeDefinition(flagsVar); - - if (flags != originalFlags) { - switch (this->GetPolicyStatus(cmPolicies::CMP0018)) { - case cmPolicies::WARN: { - std::ostringstream e; - e << "Variable " << flagsVar - << " has been modified. CMake " - "will ignore the POSITION_INDEPENDENT_CODE target property " - "for " - "shared libraries and will use the " - << flagsVar - << " variable " - "instead. This may cause errors if the original content of " - << flagsVar << " was removed.\n" - << cmPolicies::GetPolicyWarning(cmPolicies::CMP0018); - - this->IssueMessage(MessageType::AUTHOR_WARNING, e.str()); - CM_FALLTHROUGH; - } - case cmPolicies::OLD: - return true; - case cmPolicies::NEW: - return false; - } - } + this->AppendFeatureOptions(flags, lang, "DLL"); } - return false; } void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags, diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index f51b298e5e..3382675775 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -141,7 +141,7 @@ public: cmGeneratorTarget const* target, const std::string& lang, const std::string& config); - void AddCMP0018Flags(std::string& flags, cmGeneratorTarget const* target, + void AddFeatureFlags(std::string& flags, cmGeneratorTarget const* target, std::string const& lang, const std::string& config); void AddVisibilityPresetFlags(std::string& flags, cmGeneratorTarget const* target, @@ -629,9 +629,6 @@ private: OutputRole role, cmListFileBacktrace const& bt, cmCommandOrigin origin); - void AddSharedFlags(std::string& flags, const std::string& lang, - bool shared); - bool GetShouldUseOldFlags(bool shared, const std::string& lang) const; void AddPositionIndependentFlags(std::string& flags, std::string const& l, int targetType); diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index bd2071290a..1a840ad7bd 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -66,7 +66,7 @@ class cmMakefile; "there.", \ 2, 8, 4, NEW) \ SELECT(POLICY, CMP0018, \ - "Ignore CMAKE_SHARED_LIBRARY__FLAGS variable.", 2, 8, 9, WARN) \ + "Ignore CMAKE_SHARED_LIBRARY__FLAGS variable.", 2, 8, 9, NEW) \ SELECT(POLICY, CMP0019, \ "Do not re-expand variables in include and link information.", 2, 8, \ 11, WARN) \ From 092d6de4be5f57aa81a220ff8108e409cba94309 Mon Sep 17 00:00:00 2001 From: Brad King Date: Sun, 17 Nov 2024 11:14:26 -0500 Subject: [PATCH 06/13] CMP0019: Remove support for OLD behavior --- Help/policy/CMP0019.rst | 9 +- Source/cmMakefile.cxx | 91 ------------------- Source/cmMakefile.h | 5 - Source/cmPolicies.h | 2 +- Tests/RunCMake/CMP0019/CMP0019-NEW.cmake | 1 - Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt | 10 -- Tests/RunCMake/CMP0019/CMP0019-OLD.cmake | 2 - .../RunCMake/CMP0019/CMP0019-WARN-stderr.txt | 40 -------- Tests/RunCMake/CMP0019/CMP0019-WARN.cmake | 1 - Tests/RunCMake/CMP0019/CMakeLists.txt | 4 +- Tests/RunCMake/CMP0019/RunCMakeTest.cmake | 3 - 11 files changed, 8 insertions(+), 160 deletions(-) delete mode 100644 Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt delete mode 100644 Tests/RunCMake/CMP0019/CMP0019-OLD.cmake delete mode 100644 Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt delete mode 100644 Tests/RunCMake/CMP0019/CMP0019-WARN.cmake diff --git a/Help/policy/CMP0019.rst b/Help/policy/CMP0019.rst index f3fa46ac0a..004316f74e 100644 --- a/Help/policy/CMP0019.rst +++ b/Help/policy/CMP0019.rst @@ -1,6 +1,9 @@ CMP0019 ------- +.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0 +.. include:: REMOVED_PROLOGUE.txt + Do not re-expand variables in include and link information. CMake 2.8.10 and lower re-evaluated values given to the @@ -16,7 +19,5 @@ strict compatibility. The ``NEW`` behavior for this policy is to leave the values untouched. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.11 -.. |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/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b22d9b23a3..50ef9458bb 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1007,9 +1007,6 @@ void cmMakefile::GeneratorAction::operator()(cmLocalGenerator& lg, void cmMakefile::DoGenerate(cmLocalGenerator& lg) { - // do all the variable expansions here - this->ExpandVariablesCMP0019(); - // give all the commands a chance to do something // after the file has been parsed before generation for (auto& action : this->GeneratorActions) { @@ -2303,94 +2300,6 @@ cmSourceGroup* cmMakefile::FindSourceGroup( } #endif -static bool mightExpandVariablesCMP0019(const char* s) -{ - return s && *s && strstr(s, "${") && strchr(s, '}'); -} - -void cmMakefile::ExpandVariablesCMP0019() -{ - // Drop this ancient compatibility behavior with a policy. - cmPolicies::PolicyStatus pol = this->GetPolicyStatus(cmPolicies::CMP0019); - if (pol != cmPolicies::OLD && pol != cmPolicies::WARN) { - return; - } - - std::string e; - - cmValue includeDirs = this->GetProperty("INCLUDE_DIRECTORIES"); - if (includeDirs && mightExpandVariablesCMP0019(includeDirs->c_str())) { - std::string dirs = *includeDirs; - this->ExpandVariablesInString(dirs, true, true); - if (pol == cmPolicies::WARN && dirs != *includeDirs) { - e = cmStrCat("Evaluated directory INCLUDE_DIRECTORIES\n ", *includeDirs, - "\nas\n ", dirs, '\n'); - } - this->SetProperty("INCLUDE_DIRECTORIES", dirs); - } - - // Also for each target's INCLUDE_DIRECTORIES property: - for (auto& target : this->Targets) { - cmTarget& t = target.second; - if (t.GetType() == cmStateEnums::INTERFACE_LIBRARY || - t.GetType() == cmStateEnums::GLOBAL_TARGET) { - continue; - } - includeDirs = t.GetProperty("INCLUDE_DIRECTORIES"); - if (includeDirs && mightExpandVariablesCMP0019(includeDirs->c_str())) { - std::string dirs = *includeDirs; - this->ExpandVariablesInString(dirs, true, true); - if (pol == cmPolicies::WARN && dirs != *includeDirs) { - e += cmStrCat("Evaluated target ", t.GetName(), - " INCLUDE_DIRECTORIES\n ", *includeDirs, "\nas\n ", - dirs, '\n'); - } - t.SetProperty("INCLUDE_DIRECTORIES", dirs); - } - } - - if (cmValue linkDirsProp = this->GetProperty("LINK_DIRECTORIES")) { - if (mightExpandVariablesCMP0019(linkDirsProp->c_str())) { - std::string d = *linkDirsProp; - const std::string orig = d; - this->ExpandVariablesInString(d, true, true); - if (pol == cmPolicies::WARN && d != orig) { - e += cmStrCat("Evaluated link directories\n ", orig, "\nas\n ", d, - '\n'); - } - } - } - - if (cmValue linkLibsProp = this->GetProperty("LINK_LIBRARIES")) { - cmList linkLibs{ *linkLibsProp }; - - for (auto l = linkLibs.begin(); l != linkLibs.end(); ++l) { - std::string libName = *l; - if (libName == "optimized"_s || libName == "debug"_s) { - ++l; - libName = *l; - } - if (mightExpandVariablesCMP0019(libName.c_str())) { - const std::string orig = libName; - this->ExpandVariablesInString(libName, true, true); - if (pol == cmPolicies::WARN && libName != orig) { - e += cmStrCat("Evaluated link library\n ", orig, "\nas\n ", - libName, '\n'); - } - } - } - } - - if (!e.empty()) { - auto m = cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0019), - "\n" - "The following variable evaluations were encountered:\n", - e); - this->GetCMakeInstance()->IssueMessage(MessageType::AUTHOR_WARNING, m, - this->Backtrace); - } -} - bool cmMakefile::IsOn(const std::string& name) const { return this->GetDefinition(name).IsOn(); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 620917f2c4..4a7650b0b0 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -717,11 +717,6 @@ public: */ void RemoveVariablesInString(std::string& source, bool atOnly = false) const; - /** - * Expand variables in the makefiles ivars such as link directories etc - */ - void ExpandVariablesCMP0019(); - /** * Replace variables and #cmakedefine lines in the given string. * See cmConfigureFileCommand for details. diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 1a840ad7bd..0f4275ad43 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -69,7 +69,7 @@ class cmMakefile; "Ignore CMAKE_SHARED_LIBRARY__FLAGS variable.", 2, 8, 9, NEW) \ SELECT(POLICY, CMP0019, \ "Do not re-expand variables in include and link information.", 2, 8, \ - 11, WARN) \ + 11, NEW) \ SELECT(POLICY, CMP0020, \ "Automatically link Qt executables to qtmain target on Windows.", 2, \ 8, 11, WARN) \ diff --git a/Tests/RunCMake/CMP0019/CMP0019-NEW.cmake b/Tests/RunCMake/CMP0019/CMP0019-NEW.cmake index 3091e66ac7..a419f309e3 100644 --- a/Tests/RunCMake/CMP0019/CMP0019-NEW.cmake +++ b/Tests/RunCMake/CMP0019/CMP0019-NEW.cmake @@ -1,2 +1 @@ -cmake_policy(SET CMP0019 NEW) include(CMP0019-code.cmake) diff --git a/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt b/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt deleted file mode 100644 index dc0341453a..0000000000 --- a/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt +++ /dev/null @@ -1,10 +0,0 @@ -^CMake Deprecation Warning at CMP0019-OLD\.cmake:[0-9]+ \(cmake_policy\): - The OLD behavior for policy CMP0019 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:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMP0019/CMP0019-OLD.cmake b/Tests/RunCMake/CMP0019/CMP0019-OLD.cmake deleted file mode 100644 index 0f02f9ce57..0000000000 --- a/Tests/RunCMake/CMP0019/CMP0019-OLD.cmake +++ /dev/null @@ -1,2 +0,0 @@ -cmake_policy(SET CMP0019 OLD) -include(CMP0019-code.cmake) diff --git a/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt b/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt deleted file mode 100644 index 6eee437b2e..0000000000 --- a/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt +++ /dev/null @@ -1,40 +0,0 @@ -^CMake Warning \(dev\) in CMakeLists\.txt: - Policy CMP0019 is not set: Do not re-expand variables in include and link - information. Run "cmake --help-policy CMP0019" for policy details. Use - the cmake_policy command to set the policy and suppress this warning. - - The following variable evaluations were encountered: - - Evaluated directory INCLUDE_DIRECTORIES - - /usr/include/\${VAR_INCLUDE};/usr/include/normal - - as - - /usr/include/VAL_INCLUDE;/usr/include/normal - - Evaluated target some_target INCLUDE_DIRECTORIES - - /usr/include/\${VAR_INCLUDE};/usr/include/normal - - as - - /usr/include/VAL_INCLUDE;/usr/include/normal - - Evaluated link directories - - /usr/lib/\${VAR_LINK_DIRS};/usr/lib/normal - - as - - /usr/lib/VAL_LINK_DIRS;/usr/lib/normal - - Evaluated link library - - \${VAR_LINK_LIBS} - - as - - VAL_LINK_LIBS - -This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/CMP0019/CMP0019-WARN.cmake b/Tests/RunCMake/CMP0019/CMP0019-WARN.cmake deleted file mode 100644 index a419f309e3..0000000000 --- a/Tests/RunCMake/CMP0019/CMP0019-WARN.cmake +++ /dev/null @@ -1 +0,0 @@ -include(CMP0019-code.cmake) diff --git a/Tests/RunCMake/CMP0019/CMakeLists.txt b/Tests/RunCMake/CMP0019/CMakeLists.txt index 129b75c0ab..bf2ef1506e 100644 --- a/Tests/RunCMake/CMP0019/CMakeLists.txt +++ b/Tests/RunCMake/CMP0019/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.10) +cmake_minimum_required(VERSION 3.10) project(${RunCMake_TEST} NONE) -include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0019/RunCMakeTest.cmake b/Tests/RunCMake/CMP0019/RunCMakeTest.cmake index fcd080ff4a..a6b4527c44 100644 --- a/Tests/RunCMake/CMP0019/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0019/RunCMakeTest.cmake @@ -1,6 +1,3 @@ include(RunCMake) -set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON) -run_cmake(CMP0019-WARN) -run_cmake(CMP0019-OLD) run_cmake(CMP0019-NEW) From 094b42b6432650e3fbdfb803cf5f3dd94fd409fb Mon Sep 17 00:00:00 2001 From: Brad King Date: Sun, 17 Nov 2024 12:04:08 -0500 Subject: [PATCH 07/13] CMP0020: Remove support for OLD behavior --- Help/policy/CMP0020.rst | 9 +++++---- Modules/FindQt4.cmake | 6 ++---- Source/cmPolicies.h | 2 +- Tests/Qt4Targets/CMakeLists.txt | 2 -- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Help/policy/CMP0020.rst b/Help/policy/CMP0020.rst index 0a4de5cc67..ceace31be3 100644 --- a/Help/policy/CMP0020.rst +++ b/Help/policy/CMP0020.rst @@ -1,6 +1,9 @@ CMP0020 ------- +.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0 +.. include:: REMOVED_PROLOGUE.txt + Automatically link Qt executables to ``qtmain`` target on Windows. CMake 2.8.10 and lower required users of Qt to always specify a link @@ -21,7 +24,5 @@ The ``NEW`` behavior for this policy is to link executables to ``qtmain.lib`` automatically when they link to QtCore ``IMPORTED`` target. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.11 -.. |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/FindQt4.cmake b/Modules/FindQt4.cmake index 91b83c8465..6e1ffbcd85 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -1080,23 +1080,21 @@ if (QT_QMAKE_EXECUTABLE AND set(_isExe $,EXECUTABLE>) set(_isWin32 $>) set(_isNotExcluded $>>) - set(_isPolicyNEW $) get_target_property(_configs Qt4::QtCore IMPORTED_CONFIGURATIONS) set_property(TARGET Qt4::QtCore APPEND PROPERTY INTERFACE_LINK_LIBRARIES - $<$:Qt4::qtmain> + $<$:Qt4::qtmain> ) foreach(_config ${_configs}) set_property(TARGET Qt4::QtCore APPEND PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} - $<$:Qt4::qtmain> + $<$:Qt4::qtmain> ) endforeach() unset(_configs) unset(_isExe) unset(_isWin32) unset(_isNotExcluded) - unset(_isPolicyNEW) endif() ####################################### diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 0f4275ad43..55c977e301 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -72,7 +72,7 @@ class cmMakefile; 11, NEW) \ SELECT(POLICY, CMP0020, \ "Automatically link Qt executables to qtmain target on Windows.", 2, \ - 8, 11, WARN) \ + 8, 11, NEW) \ SELECT( \ POLICY, CMP0021, \ "Fatal error on relative paths in INCLUDE_DIRECTORIES target property.", \ diff --git a/Tests/Qt4Targets/CMakeLists.txt b/Tests/Qt4Targets/CMakeLists.txt index 47a640812d..6d5e34be34 100644 --- a/Tests/Qt4Targets/CMakeLists.txt +++ b/Tests/Qt4Targets/CMakeLists.txt @@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 3.10) project(Qt4Targets) -cmake_policy(SET CMP0020 NEW) - find_package(Qt4 REQUIRED) set(CMAKE_AUTOMOC ON) From e31d1c7600082768942284febc68c08b48a2b997 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 18 Nov 2024 18:22:24 -0500 Subject: [PATCH 08/13] CMP0021: Remove support for OLD behavior --- Help/policy/CMP0021.rst | 9 ++++---- .../cmGeneratorTarget_IncludeDirectories.cxx | 21 +++---------------- Source/cmPolicies.h | 2 +- .../IncludeDirectories/CMP0021/CMakeLists.txt | 14 ------------- .../CMP0021/includes/cmp0021/cmp0021.h | 2 -- Tests/IncludeDirectories/CMP0021/main.cpp | 11 ---------- Tests/IncludeDirectories/CMakeLists.txt | 4 ---- .../include_directories/CMP0021.cmake | 2 -- 8 files changed, 9 insertions(+), 56 deletions(-) delete mode 100644 Tests/IncludeDirectories/CMP0021/CMakeLists.txt delete mode 100644 Tests/IncludeDirectories/CMP0021/includes/cmp0021/cmp0021.h delete mode 100644 Tests/IncludeDirectories/CMP0021/main.cpp diff --git a/Help/policy/CMP0021.rst b/Help/policy/CMP0021.rst index 2c49c33cb1..b9074ab156 100644 --- a/Help/policy/CMP0021.rst +++ b/Help/policy/CMP0021.rst @@ -1,6 +1,9 @@ CMP0021 ------- +.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0 +.. include:: REMOVED_PROLOGUE.txt + Fatal error on relative paths in :prop_tgt:`INCLUDE_DIRECTORIES` target property. @@ -15,7 +18,5 @@ policy is to issue a ``FATAL_ERROR`` if ``INCLUDE_DIRECTORIES`` contains a relative path. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.12 -.. |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/Source/cmGeneratorTarget_IncludeDirectories.cxx b/Source/cmGeneratorTarget_IncludeDirectories.cxx index fc89331bef..cc6ec0cecd 100644 --- a/Source/cmGeneratorTarget_IncludeDirectories.cxx +++ b/Source/cmGeneratorTarget_IncludeDirectories.cxx @@ -185,7 +185,6 @@ void processIncludeDirectories(cmGeneratorTarget const* tgt, if (!cmSystemTools::FileIsFullPath(entryInclude)) { std::ostringstream e; - bool noMessage = false; MessageType messageType = MessageType::FATAL_ERROR; if (!targetName.empty()) { /* clang-format off */ @@ -194,27 +193,13 @@ void processIncludeDirectories(cmGeneratorTarget const* tgt, " \"" << entryInclude << "\""; /* clang-format on */ } else { - switch (tgt->GetPolicyStatusCMP0021()) { - case cmPolicies::WARN: { - e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0021) << "\n"; - messageType = MessageType::AUTHOR_WARNING; - } break; - case cmPolicies::OLD: - noMessage = true; - break; - case cmPolicies::NEW: - // Issue the fatal message. - break; - } e << "Found relative path while evaluating include directories of " "\"" << tgt->GetName() << "\":\n \"" << entryInclude << "\"\n"; } - if (!noMessage) { - tgt->GetLocalGenerator()->IssueMessage(messageType, e.str()); - if (messageType == MessageType::FATAL_ERROR) { - return; - } + tgt->GetLocalGenerator()->IssueMessage(messageType, e.str()); + if (messageType == MessageType::FATAL_ERROR) { + return; } } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 55c977e301..51e9333576 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -76,7 +76,7 @@ class cmMakefile; SELECT( \ POLICY, CMP0021, \ "Fatal error on relative paths in INCLUDE_DIRECTORIES target property.", \ - 2, 8, 12, WARN) \ + 2, 8, 12, NEW) \ SELECT(POLICY, CMP0022, \ "INTERFACE_LINK_LIBRARIES defines the link interface.", 2, 8, 12, \ WARN) \ diff --git a/Tests/IncludeDirectories/CMP0021/CMakeLists.txt b/Tests/IncludeDirectories/CMP0021/CMakeLists.txt deleted file mode 100644 index 0b9aee899a..0000000000 --- a/Tests/IncludeDirectories/CMP0021/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ - -cmake_policy(SET CMP0021 OLD) -add_executable(cmp0021exe main.cpp) - -if(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) - file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/includes") - execute_process(COMMAND ${CMAKE_COMMAND} -E - copy_directory - "${CMAKE_CURRENT_SOURCE_DIR}/includes" - "${CMAKE_CURRENT_BINARY_DIR}/includes" - ) -endif() -set_property(TARGET cmp0021exe PROPERTY - INCLUDE_DIRECTORIES includes/cmp0021) diff --git a/Tests/IncludeDirectories/CMP0021/includes/cmp0021/cmp0021.h b/Tests/IncludeDirectories/CMP0021/includes/cmp0021/cmp0021.h deleted file mode 100644 index 3d49b31d57..0000000000 --- a/Tests/IncludeDirectories/CMP0021/includes/cmp0021/cmp0021.h +++ /dev/null @@ -1,2 +0,0 @@ - -#define CMP0021_DEFINE diff --git a/Tests/IncludeDirectories/CMP0021/main.cpp b/Tests/IncludeDirectories/CMP0021/main.cpp deleted file mode 100644 index 0f87dd9970..0000000000 --- a/Tests/IncludeDirectories/CMP0021/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -#include "cmp0021.h" - -#ifndef CMP0021_DEFINE -# error Expected CMP0021_DEFINE -#endif - -int main(int, char**) -{ - return 0; -} diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt index e9c1c63637..854a42a103 100644 --- a/Tests/IncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/CMakeLists.txt @@ -206,7 +206,3 @@ get_target_property(incs empty_entry_test INCLUDE_DIRECTORIES) if (NOT incs STREQUAL ";/one/two") message(SEND_ERROR "Empty include_directories entry was not ignored.") endif() - -if(NOT CMAKE_GENERATOR STREQUAL "Xcode" AND NOT CMAKE_GENERATOR MATCHES "Ninja") - add_subdirectory(CMP0021) -endif() diff --git a/Tests/RunCMake/include_directories/CMP0021.cmake b/Tests/RunCMake/include_directories/CMP0021.cmake index f18666b076..63b1930e17 100644 --- a/Tests/RunCMake/include_directories/CMP0021.cmake +++ b/Tests/RunCMake/include_directories/CMP0021.cmake @@ -1,7 +1,5 @@ enable_language(CXX) -cmake_policy(SET CMP0021 NEW) - add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<1:foo>") From 888259c894ea019c4c281895b5277eafc4198b2c Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 18 Nov 2024 18:30:50 -0500 Subject: [PATCH 09/13] CMP0022: Remove support for OLD behavior --- Help/policy/CMP0022.rst | 9 +- Source/cmExportAndroidMKGenerator.cxx | 18 -- Source/cmExportBuildAndroidMKGenerator.cxx | 10 +- Source/cmExportBuildCMakeConfigGenerator.cxx | 10 +- Source/cmExportCMakeConfigGenerator.cxx | 7 +- Source/cmExportInstallAndroidMKGenerator.cxx | 10 +- .../cmExportInstallCMakeConfigGenerator.cxx | 14 +- Source/cmGeneratorTarget.h | 1 - Source/cmGeneratorTarget_Link.cxx | 160 +++--------------- Source/cmInstallCommand.cxx | 17 -- Source/cmPolicies.h | 2 +- Source/cmTarget.cxx | 8 - Source/cmTargetLinkLibrariesCommand.cxx | 65 ------- .../target_link_libraries/CMakeLists.txt | 23 ++- Tests/ExportImport/Export/CMakeLists.txt | 101 ++++------- Tests/ExportImport/Import/A/CMakeLists.txt | 24 +-- .../ExportImport/Import/A/cmp0022OLD_test.cpp | 12 -- .../Import/A/cmp0022OLD_test_vs6_1.cpp | 1 - .../Import/A/cmp0022OLD_test_vs6_2.cpp | 1 - Tests/InterfaceLinkLibraries/CMakeLists.txt | 2 - .../RunCMake/CMP0022/CMP0022-NOWARN-exe.cmake | 7 - .../CMP0022/CMP0022-NOWARN-static-NEW.cmake | 2 - .../CMP0022/CMP0022-WARN-empty-old-result.txt | 1 - .../CMP0022/CMP0022-WARN-empty-old-stderr.txt | 19 --- .../CMP0022/CMP0022-WARN-empty-old.cmake | 10 -- .../CMP0022/CMP0022-WARN-static-result.txt | 1 - .../CMP0022/CMP0022-WARN-static-stderr.txt | 19 --- .../CMP0022/CMP0022-WARN-static.cmake | 11 -- .../RunCMake/CMP0022/CMP0022-WARN-stderr.txt | 17 -- .../CMP0022/CMP0022-WARN-tll-result.txt | 1 - .../CMP0022/CMP0022-WARN-tll-stderr.txt | 17 -- Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake | 13 -- Tests/RunCMake/CMP0022/CMP0022-WARN.cmake | 18 -- .../RunCMake/CMP0022/CMP0022-export-exe.cmake | 2 - Tests/RunCMake/CMP0022/CMP0022-export.cmake | 2 - .../CMP0022/CMP0022-install-export.cmake | 2 - Tests/RunCMake/CMP0022/CMakeLists.txt | 2 +- Tests/RunCMake/CMP0022/RunCMakeTest.cmake | 6 - .../ObjectLibrary/LinkObjRHSObject.cmake | 2 - .../ObjectLibrary/LinkObjRHSObject2.cmake | 2 - .../incomplete-genex.cmake | 1 - 41 files changed, 84 insertions(+), 566 deletions(-) delete mode 100644 Tests/ExportImport/Import/A/cmp0022OLD_test.cpp delete mode 100644 Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_1.cpp delete mode 100644 Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_2.cpp delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe.cmake delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-result.txt delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old.cmake delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-WARN-static-result.txt delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-WARN-static.cmake delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-WARN-tll-result.txt delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-WARN.cmake diff --git a/Help/policy/CMP0022.rst b/Help/policy/CMP0022.rst index c82a76808e..91e7aa3acd 100644 --- a/Help/policy/CMP0022.rst +++ b/Help/policy/CMP0022.rst @@ -1,6 +1,9 @@ CMP0022 ------- +.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0 +.. include:: REMOVED_PROLOGUE.txt + :prop_tgt:`INTERFACE_LINK_LIBRARIES` defines the link interface. CMake 2.8.11 constructed the 'link interface' of a target from @@ -33,7 +36,5 @@ property for in-build targets, and ignore the old properties matching ``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_)?``. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.12 -.. |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/Source/cmExportAndroidMKGenerator.cxx b/Source/cmExportAndroidMKGenerator.cxx index 34dc1a7921..4db5e3bb33 100644 --- a/Source/cmExportAndroidMKGenerator.cxx +++ b/Source/cmExportAndroidMKGenerator.cxx @@ -12,13 +12,9 @@ #include "cmGeneratorTarget.h" #include "cmLinkItem.h" #include "cmList.h" -#include "cmMakefile.h" -#include "cmMessageType.h" -#include "cmPolicies.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -#include "cmTarget.h" cmExportAndroidMKGenerator::cmExportAndroidMKGenerator() = default; @@ -52,20 +48,6 @@ void cmExportAndroidMKGenerator::GenerateInterfaceProperties( (this->Configurations.empty() ? std::string{} : this->Configurations[0]); GenerateType const type = this->GetGenerateType(); - bool const newCMP0022Behavior = - target->GetPolicyStatusCMP0022() != cmPolicies::WARN && - target->GetPolicyStatusCMP0022() != cmPolicies::OLD; - if (!newCMP0022Behavior) { - std::ostringstream w; - if (type == BUILD) { - w << "export(TARGETS ... ANDROID_MK) called with policy CMP0022"; - } else { - w << "install( EXPORT_ANDROID_MK ...) called with policy CMP0022"; - } - w << " set to OLD for target " << target->Target->GetName() << ". " - << "The export will only work with CMP0022 set to NEW."; - target->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); - } if (!properties.empty()) { os << "LOCAL_CPP_FEATURES := rtti exceptions\n"; for (auto const& property : properties) { diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx index a5f6ca39da..ad9ec04bbc 100644 --- a/Source/cmExportBuildAndroidMKGenerator.cxx +++ b/Source/cmExportBuildAndroidMKGenerator.cxx @@ -7,7 +7,6 @@ #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" -#include "cmPolicies.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" @@ -34,13 +33,8 @@ bool cmExportBuildAndroidMKGenerator::GenerateMainFile(std::ostream& os) return false; } - bool const newCMP0022Behavior = - gte->GetPolicyStatusCMP0022() != cmPolicies::WARN && - gte->GetPolicyStatusCMP0022() != cmPolicies::OLD; - if (newCMP0022Behavior) { - this->PopulateInterfaceLinkLibrariesProperty( - gte, cmGeneratorExpression::BuildInterface, properties); - } + this->PopulateInterfaceLinkLibrariesProperty( + gte, cmGeneratorExpression::BuildInterface, properties); this->GenerateInterfaceProperties(gte, os, properties); } diff --git a/Source/cmExportBuildCMakeConfigGenerator.cxx b/Source/cmExportBuildCMakeConfigGenerator.cxx index 87aeb3cbb9..b8ed7126d7 100644 --- a/Source/cmExportBuildCMakeConfigGenerator.cxx +++ b/Source/cmExportBuildCMakeConfigGenerator.cxx @@ -24,7 +24,6 @@ #include "cmMakefile.h" #include "cmMessageType.h" #include "cmOutputConverter.h" -#include "cmPolicies.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" @@ -72,13 +71,8 @@ bool cmExportBuildCMakeConfigGenerator::GenerateMainFile(std::ostream& os) return false; } - bool const newCMP0022Behavior = - gte->GetPolicyStatusCMP0022() != cmPolicies::WARN && - gte->GetPolicyStatusCMP0022() != cmPolicies::OLD; - if (newCMP0022Behavior) { - this->PopulateInterfaceLinkLibrariesProperty( - gte, cmGeneratorExpression::BuildInterface, properties); - } + this->PopulateInterfaceLinkLibrariesProperty( + gte, cmGeneratorExpression::BuildInterface, properties); this->GenerateInterfaceProperties(gte, os, properties); diff --git a/Source/cmExportCMakeConfigGenerator.cxx b/Source/cmExportCMakeConfigGenerator.cxx index 79844d54ba..bcd97712f9 100644 --- a/Source/cmExportCMakeConfigGenerator.cxx +++ b/Source/cmExportCMakeConfigGenerator.cxx @@ -22,7 +22,6 @@ #include "cmMakefile.h" #include "cmMessageType.h" #include "cmOutputConverter.h" -#include "cmPolicies.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" @@ -130,11 +129,7 @@ void cmExportCMakeConfigGenerator::SetImportLinkInterface( return; } - bool const newCMP0022Behavior = - target->GetPolicyStatusCMP0022() != cmPolicies::WARN && - target->GetPolicyStatusCMP0022() != cmPolicies::OLD; - - if (newCMP0022Behavior && !this->ExportOld) { + if (!this->ExportOld) { cmLocalGenerator* lg = target->GetLocalGenerator(); std::ostringstream e; e << "Target \"" << target->GetName() diff --git a/Source/cmExportInstallAndroidMKGenerator.cxx b/Source/cmExportInstallAndroidMKGenerator.cxx index c9c2f4e529..3b529664b5 100644 --- a/Source/cmExportInstallAndroidMKGenerator.cxx +++ b/Source/cmExportInstallAndroidMKGenerator.cxx @@ -12,7 +12,6 @@ #include "cmGeneratorTarget.h" #include "cmInstallExportGenerator.h" #include "cmInstallTargetGenerator.h" -#include "cmPolicies.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" @@ -58,13 +57,8 @@ bool cmExportInstallAndroidMKGenerator::GenerateMainFile(std::ostream& os) return false; } - bool const newCMP0022Behavior = - gt->GetPolicyStatusCMP0022() != cmPolicies::WARN && - gt->GetPolicyStatusCMP0022() != cmPolicies::OLD; - if (newCMP0022Behavior) { - this->PopulateInterfaceLinkLibrariesProperty( - gt, cmGeneratorExpression::InstallInterface, properties); - } + this->PopulateInterfaceLinkLibrariesProperty( + gt, cmGeneratorExpression::InstallInterface, properties); this->GenerateInterfaceProperties(gt, os, properties); } diff --git a/Source/cmExportInstallCMakeConfigGenerator.cxx b/Source/cmExportInstallCMakeConfigGenerator.cxx index e1b22854d2..4b37bcac0d 100644 --- a/Source/cmExportInstallCMakeConfigGenerator.cxx +++ b/Source/cmExportInstallCMakeConfigGenerator.cxx @@ -25,7 +25,6 @@ #include "cmMakefile.h" #include "cmMessageType.h" #include "cmOutputConverter.h" -#include "cmPolicies.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" @@ -83,15 +82,10 @@ bool cmExportInstallCMakeConfigGenerator::GenerateMainFile(std::ostream& os) return false; } - bool const newCMP0022Behavior = - gt->GetPolicyStatusCMP0022() != cmPolicies::WARN && - gt->GetPolicyStatusCMP0022() != cmPolicies::OLD; - if (newCMP0022Behavior) { - if (this->PopulateInterfaceLinkLibrariesProperty( - gt, cmGeneratorExpression::InstallInterface, properties) && - !this->ExportOld) { - this->SetRequiredCMakeVersion(2, 8, 12); - } + if (this->PopulateInterfaceLinkLibrariesProperty( + gt, cmGeneratorExpression::InstallInterface, properties) && + !this->ExportOld) { + this->SetRequiredCMakeVersion(2, 8, 12); } if (targetType == cmStateEnums::INTERFACE_LIBRARY) { this->SetRequiredCMakeVersion(3, 0, 0); diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index bd8f8f3d78..9db0527318 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -1394,7 +1394,6 @@ private: mutable OutputNameMapType OutputNameMap; mutable std::set UtilityItems; cmPolicies::PolicyMap PolicyMap; - mutable bool PolicyWarnedCMP0022 = false; mutable bool PolicyReportedCMP0069 = false; mutable bool DebugIncludesDone = false; mutable bool DebugCompileOptionsDone = false; diff --git a/Source/cmGeneratorTarget_Link.cxx b/Source/cmGeneratorTarget_Link.cxx index 607cc25048..10e83a3563 100644 --- a/Source/cmGeneratorTarget_Link.cxx +++ b/Source/cmGeneratorTarget_Link.cxx @@ -718,10 +718,6 @@ void cmGeneratorTarget::ComputeLinkInterface(const std::string& config, } } } - } else if (this->GetPolicyStatusCMP0022() == cmPolicies::WARN || - this->GetPolicyStatusCMP0022() == cmPolicies::OLD) { - // The link implementation is the default link interface. - iface.ImplementationIsInterface = true; } if (this->LinkLanguagePropagatesToDependents()) { @@ -804,62 +800,10 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries( // An explicit list of interface libraries may be set for shared // libraries and executables that export symbols. - bool haveExplicitLibraries = false; - cmValue explicitLibrariesCMP0022OLD; - std::string linkIfacePropCMP0022OLD; - bool const cmp0022NEW = (this->GetPolicyStatusCMP0022() != cmPolicies::OLD && - this->GetPolicyStatusCMP0022() != cmPolicies::WARN); - if (cmp0022NEW) { - // CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES. - haveExplicitLibraries = !this->Target->GetLinkInterfaceEntries().empty() || - !this->Target->GetLinkInterfaceDirectEntries().empty() || - !this->Target->GetLinkInterfaceDirectExcludeEntries().empty(); - } else { - // CMP0022 OLD behavior is to use LINK_INTERFACE_LIBRARIES if set on a - // shared lib or executable. - if (this->GetType() == cmStateEnums::SHARED_LIBRARY || - this->IsExecutableWithExports()) { - // Lookup the per-configuration property. - linkIfacePropCMP0022OLD = cmStrCat("LINK_INTERFACE_LIBRARIES", suffix); - explicitLibrariesCMP0022OLD = this->GetProperty(linkIfacePropCMP0022OLD); - - // If not set, try the generic property. - if (!explicitLibrariesCMP0022OLD) { - linkIfacePropCMP0022OLD = "LINK_INTERFACE_LIBRARIES"; - explicitLibrariesCMP0022OLD = - this->GetProperty(linkIfacePropCMP0022OLD); - } - } - - if (explicitLibrariesCMP0022OLD && - this->GetPolicyStatusCMP0022() == cmPolicies::WARN && - !this->PolicyWarnedCMP0022) { - // Compare the explicitly set old link interface properties to the - // preferred new link interface property one and warn if different. - cmValue newExplicitLibraries = - this->GetProperty("INTERFACE_LINK_LIBRARIES"); - if (newExplicitLibraries && - (*newExplicitLibraries != *explicitLibrariesCMP0022OLD)) { - std::ostringstream w; - /* clang-format off */ - w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n" - "Target \"" << this->GetName() << "\" has an " - "INTERFACE_LINK_LIBRARIES property which differs from its " << - linkIfacePropCMP0022OLD << " properties." - "\n" - "INTERFACE_LINK_LIBRARIES:\n" - " " << *newExplicitLibraries << "\n" << - linkIfacePropCMP0022OLD << ":\n" - " " << *explicitLibrariesCMP0022OLD << "\n"; - /* clang-format on */ - this->LocalGenerator->IssueMessage(MessageType::AUTHOR_WARNING, - w.str()); - this->PolicyWarnedCMP0022 = true; - } - } - - haveExplicitLibraries = static_cast(explicitLibrariesCMP0022OLD); - } + bool const haveExplicitLibraries = + !this->Target->GetLinkInterfaceEntries().empty() || + !this->Target->GetLinkInterfaceDirectEntries().empty() || + !this->Target->GetLinkInterfaceDirectExcludeEntries().empty(); // There is no implicit link interface for executables or modules // so if none was explicitly set then there is no link interface. @@ -869,85 +813,21 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries( return; } iface.Exists = true; + iface.Explicit = true; - // If CMP0022 is NEW then the plain tll signature sets the - // INTERFACE_LINK_LIBRARIES property. Even if the project - // clears it, the link interface is still explicit. - iface.Explicit = cmp0022NEW || explicitLibrariesCMP0022OLD; - - if (cmp0022NEW) { - // The interface libraries are specified by INTERFACE_LINK_LIBRARIES. - // Use its special representation directly to get backtraces. - this->ExpandLinkItems( - kINTERFACE_LINK_LIBRARIES, this->Target->GetLinkInterfaceEntries(), - config, headTarget, usage, LinkInterfaceField::Libraries, iface); - this->ExpandLinkItems(kINTERFACE_LINK_LIBRARIES_DIRECT, - this->Target->GetLinkInterfaceDirectEntries(), - config, headTarget, usage, - LinkInterfaceField::HeadInclude, iface); - this->ExpandLinkItems(kINTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE, - this->Target->GetLinkInterfaceDirectExcludeEntries(), - config, headTarget, usage, - LinkInterfaceField::HeadExclude, iface); - } else if (explicitLibrariesCMP0022OLD) { - // The interface libraries have been explicitly set in pre-CMP0022 style. - std::vector> entries; - entries.emplace_back(*explicitLibrariesCMP0022OLD); - this->ExpandLinkItems(linkIfacePropCMP0022OLD, cmMakeRange(entries), - config, headTarget, usage, - LinkInterfaceField::Libraries, iface); - } - - // If the link interface is explicit, do not fall back to the link impl. - if (iface.Explicit) { - return; - } - - // The link implementation is the default link interface. - if (cmLinkImplementationLibraries const* impl = - this->GetLinkImplementationLibrariesInternal(config, headTarget, - usage)) { - iface.Libraries.insert(iface.Libraries.end(), impl->Libraries.begin(), - impl->Libraries.end()); - if (this->GetPolicyStatusCMP0022() == cmPolicies::WARN && - !this->PolicyWarnedCMP0022 && usage == UseTo::Link) { - // Compare the link implementation fallback link interface to the - // preferred new link interface property and warn if different. - cmLinkInterface ifaceNew; - this->ExpandLinkItems( - kINTERFACE_LINK_LIBRARIES, this->Target->GetLinkInterfaceEntries(), - config, headTarget, usage, LinkInterfaceField::Libraries, ifaceNew); - if (ifaceNew.Libraries != iface.Libraries) { - std::string oldLibraries = cmJoin(impl->Libraries, ";"); - std::string newLibraries = cmJoin(ifaceNew.Libraries, ";"); - if (oldLibraries.empty()) { - oldLibraries = "(empty)"; - } - if (newLibraries.empty()) { - newLibraries = "(empty)"; - } - - std::ostringstream w; - /* clang-format off */ - w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n" - "Target \"" << this->GetName() << "\" has an " - "INTERFACE_LINK_LIBRARIES property. " - "This should be preferred as the source of the link interface " - "for this library but because CMP0022 is not set CMake is " - "ignoring the property and using the link implementation " - "as the link interface instead." - "\n" - "INTERFACE_LINK_LIBRARIES:\n" - " " << newLibraries << "\n" - "Link implementation:\n" - " " << oldLibraries << "\n"; - /* clang-format on */ - this->LocalGenerator->IssueMessage(MessageType::AUTHOR_WARNING, - w.str()); - this->PolicyWarnedCMP0022 = true; - } - } - } + // The interface libraries are specified by INTERFACE_LINK_LIBRARIES. + // Use its special representation directly to get backtraces. + this->ExpandLinkItems( + kINTERFACE_LINK_LIBRARIES, this->Target->GetLinkInterfaceEntries(), config, + headTarget, usage, LinkInterfaceField::Libraries, iface); + this->ExpandLinkItems(kINTERFACE_LINK_LIBRARIES_DIRECT, + this->Target->GetLinkInterfaceDirectEntries(), config, + headTarget, usage, LinkInterfaceField::HeadInclude, + iface); + this->ExpandLinkItems(kINTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE, + this->Target->GetLinkInterfaceDirectExcludeEntries(), + config, headTarget, usage, + LinkInterfaceField::HeadExclude, iface); } namespace { @@ -1218,9 +1098,7 @@ public: void TransitiveLinkImpl::Follow(cmGeneratorTarget const* target) { - if (!target || !this->Followed.insert(target).second || - target->GetPolicyStatusCMP0022() == cmPolicies::OLD || - target->GetPolicyStatusCMP0022() == cmPolicies::WARN) { + if (!target || !this->Followed.insert(target).second) { return; } diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 9103b82e2a..04634ab820 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -2156,23 +2156,6 @@ bool HandleExportMode(std::vector const& args, cmExportSet& exportSet = helper.Makefile->GetGlobalGenerator()->GetExportSets()[exp]; - if (exportOld) { - for (auto const& te : exportSet.GetTargetExports()) { - cmTarget* tgt = - helper.Makefile->GetGlobalGenerator()->FindTarget(te->TargetName); - const bool newCMP0022Behavior = - (tgt && tgt->GetPolicyStatusCMP0022() != cmPolicies::WARN && - tgt->GetPolicyStatusCMP0022() != cmPolicies::OLD); - - if (!newCMP0022Behavior) { - status.SetError(cmStrCat( - "INSTALL(EXPORT) given keyword \"" - "EXPORT_LINK_INTERFACE_LIBRARIES\", but target \"", - te->TargetName, "\" does not have policy CMP0022 set to NEW.")); - return false; - } - } - } cmInstallGenerator::MessageLevel message = cmInstallGenerator::SelectMessageLevel(helper.Makefile); diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 51e9333576..08f020b2b3 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -79,7 +79,7 @@ class cmMakefile; 2, 8, 12, NEW) \ SELECT(POLICY, CMP0022, \ "INTERFACE_LINK_LIBRARIES defines the link interface.", 2, 8, 12, \ - WARN) \ + NEW) \ SELECT( \ POLICY, CMP0023, \ "Plain and keyword target_link_libraries signatures cannot be mixed.", 2, \ diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a0088e1116..372ea71108 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -999,14 +999,6 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, // Record current policies for later use. this->impl->Makefile->RecordPolicies(this->impl->PolicyMap); - if (this->impl->TargetType == cmStateEnums::INTERFACE_LIBRARY) { - // This policy is checked in a few conditions. The properties relevant - // to the policy are always ignored for cmStateEnums::INTERFACE_LIBRARY - // targets, - // so ensure that the conditions don't lead to nonsense. - this->impl->PolicyMap.Set(cmPolicies::CMP0022, cmPolicies::NEW); - } - std::set metConditions; metConditions.insert(TargetProperty::InitCondition::Always); if (this->CanCompileSources()) { diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index c4527a43e3..73939de5e8 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -25,8 +25,6 @@ #include "cmSystemTools.h" #include "cmTarget.h" #include "cmTargetLinkLibraryType.h" -#include "cmValue.h" -#include "cmake.h" namespace { @@ -327,21 +325,6 @@ bool cmTargetLinkLibrariesCommand(std::vector const& args, cmSystemTools::SetFatalErrorOccurred(); } - const cmPolicies::PolicyStatus policy22Status = - target->GetPolicyStatusCMP0022(); - - // If any of the LINK_ options were given, make sure the - // LINK_INTERFACE_LIBRARIES target property exists. - // Use of any of the new keywords implies awareness of - // this property. And if no libraries are named, it should - // result in an empty link interface. - if ((policy22Status == cmPolicies::OLD || - policy22Status == cmPolicies::WARN) && - currentProcessingState != ProcessingLinkLibraries && - !target->GetProperty("LINK_INTERFACE_LIBRARIES")) { - target->SetProperty("LINK_INTERFACE_LIBRARIES", ""); - } - return true; } @@ -528,54 +511,6 @@ bool TLL::HandleLibrary(ProcessingState currentProcessingState, // property of the target on the LHS shall be populated.) this->AppendProperty("INTERFACE_LINK_LIBRARIES", this->Target->GetDebugGeneratorExpressions(lib, llt)); - - // Stop processing if called without any keyword. - if (currentProcessingState == ProcessingLinkLibraries) { - return true; - } - // Stop processing if policy CMP0022 is set to NEW. - const cmPolicies::PolicyStatus policy22Status = - this->Target->GetPolicyStatusCMP0022(); - if (policy22Status != cmPolicies::OLD && - policy22Status != cmPolicies::WARN) { - return true; - } - // Stop processing if called with an INTERFACE library on the LHS. - if (this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { - return true; - } - - // Handle (additional) backward-compatibility case where the command was - // called with PUBLIC / INTERFACE / LINK_PUBLIC / LINK_INTERFACE_LIBRARIES. - // (The policy CMP0022 is not set to NEW.) - { - // Get the list of configurations considered to be DEBUG. - std::vector debugConfigs = - this->Makefile.GetCMakeInstance()->GetDebugConfigs(); - std::string prop; - - // Include this library in the link interface for the target. - if (llt == DEBUG_LibraryType || llt == GENERAL_LibraryType) { - // Put in the DEBUG configuration interfaces. - for (std::string const& dc : debugConfigs) { - prop = cmStrCat("LINK_INTERFACE_LIBRARIES_", dc); - this->AppendProperty(prop, lib); - } - } - if (llt == OPTIMIZED_LibraryType || llt == GENERAL_LibraryType) { - // Put in the non-DEBUG configuration interfaces. - this->AppendProperty("LINK_INTERFACE_LIBRARIES", lib); - - // Make sure the DEBUG configuration interfaces exist so that the - // general one will not be used as a fall-back. - for (std::string const& dc : debugConfigs) { - prop = cmStrCat("LINK_INTERFACE_LIBRARIES_", dc); - if (!this->Target->GetProperty(prop)) { - this->Target->SetProperty(prop, ""); - } - } - } - } return true; } diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt index 341b135660..1e76ab6c3c 100644 --- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt @@ -1,7 +1,4 @@ -# Using 2.8 will trigger a deprecation warning. In this case it's explicitly -# intentional since the tests checks various policy implementations prior to -# 3.10 -cmake_minimum_required(VERSION 2.8.11) # old enough to not set CMP0022 +cmake_minimum_required(VERSION 3.10) if(POLICY CMP0129) cmake_policy(SET CMP0129 NEW) @@ -53,38 +50,38 @@ generate_export_header(depC) target_link_libraries(depC LINK_PUBLIC depA LINK_PUBLIC depA) -assert_property(depA LINK_INTERFACE_LIBRARIES "") -assert_property(depB LINK_INTERFACE_LIBRARIES "") -assert_property(depC LINK_INTERFACE_LIBRARIES "depA;depA") +assert_property(depA INTERFACE_LINK_LIBRARIES "") +assert_property(depB INTERFACE_LINK_LIBRARIES "") +assert_property(depC INTERFACE_LINK_LIBRARIES "depA;depA") add_executable(targetA targetA.cpp) target_link_libraries(targetA LINK_INTERFACE_LIBRARIES depA depB) -assert_property(targetA LINK_INTERFACE_LIBRARIES "depA;depB") +assert_property(targetA INTERFACE_LINK_LIBRARIES "depA;depB") -set_target_properties(targetA PROPERTIES LINK_INTERFACE_LIBRARIES "") +set_target_properties(targetA PROPERTIES INTERFACE_LINK_LIBRARIES "") -assert_property(targetA LINK_INTERFACE_LIBRARIES "") +assert_property(targetA INTERFACE_LINK_LIBRARIES "") add_subdirectory(subdir) target_link_libraries(targetA subdirlib) target_link_libraries(targetA depB depC) -assert_property(targetA LINK_INTERFACE_LIBRARIES "") +assert_property(targetA INTERFACE_LINK_LIBRARIES ";subdirlib;depB;depC") # Exclude depIfaceOnly from ALL so that it will only be built if something # depends on it. As it is in the link interface of depB, targetA # will depend on it. That dependency is what is being tested here. add_library(depIfaceOnly SHARED EXCLUDE_FROM_ALL depIfaceOnly.cpp) generate_export_header(depIfaceOnly) -set_property(TARGET depB APPEND PROPERTY LINK_INTERFACE_LIBRARIES depIfaceOnly) +set_property(TARGET depB APPEND PROPERTY INTERFACE_LINK_LIBRARIES depIfaceOnly) add_library(depD SHARED depD.cpp) generate_export_header(depD) set_property(TARGET depD APPEND PROPERTY - LINK_INTERFACE_LIBRARIES + INTERFACE_LINK_LIBRARIES $<$,EXECUTABLE>:depA> ) diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index f6d32b8dd2..3a6a0eb016 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -1,5 +1,5 @@ set(CMAKE_EXPERIMENTAL_EXPORT_PACKAGE_DEPENDENCIES "1942b4fa-b2c5-4546-9385-83f254070067") -cmake_minimum_required(VERSION 2.8.11) # old enough to not set CMP0022 +cmake_minimum_required(VERSION 3.10) if(POLICY CMP0129) cmake_policy(SET CMP0129 NEW) endif() @@ -22,10 +22,9 @@ add_library(testExe2libImp SHARED testExe2libImp.c) set_property(TARGET testExe2libImp PROPERTY LIBRARY_OUTPUT_DIRECTORY impl) add_library(testExe2lib SHARED testExe2lib.c) target_link_libraries(testExe2lib testExe2libImp) -set_property(TARGET testExe2lib PROPERTY LINK_INTERFACE_LIBRARIES "") add_executable(testExe2 testExe2.c) set_property(TARGET testExe2 PROPERTY ENABLE_EXPORTS 1) -set_property(TARGET testExe2 PROPERTY LINK_INTERFACE_LIBRARIES testExe2lib) +set_property(TARGET testExe2 PROPERTY INTERFACE_LINK_LIBRARIES testExe2lib) add_library(compileOnly INTERFACE) target_compile_definitions(compileOnly INTERFACE FROM_compileOnly) @@ -36,7 +35,6 @@ target_link_libraries(noUses INTERFACE this::target_does_not_exist) add_library(testLib1 STATIC testLib1.c) add_library(testLib2 STATIC testLib2.c) -target_link_libraries(testLib2 testLib1) target_link_libraries(testLib2 PRIVATE testLib1 @@ -68,7 +66,6 @@ set_property(TARGET testLib3Imp PROPERTY LIBRARY_OUTPUT_DIRECTORY impl) target_link_libraries(testLib3Imp testLib3ImpDep) add_library(testLib3 SHARED testLib3.c) target_link_libraries(testLib3 testLib3Imp) -set_property(TARGET testLib3 PROPERTY LINK_INTERFACE_LIBRARIES "") set_property(TARGET testLib3 PROPERTY VERSION 1.2) set_property(TARGET testLib3 PROPERTY SOVERSION 3) @@ -108,8 +105,6 @@ else() set(maybe_OBJECTS_DESTINATION "") endif() -cmake_policy(PUSH) -cmake_policy(SET CMP0022 NEW) add_library(testLib9ObjPub OBJECT testLib9ObjPub.c) target_compile_definitions(testLib9ObjPub INTERFACE testLib9ObjPub_USED) add_library(testLib9ObjPriv OBJECT testLib9ObjPriv.c) @@ -119,41 +114,37 @@ target_compile_definitions(testLib9ObjIface INTERFACE testLib9ObjIface_USED) add_library(testLib9 STATIC testLib9.c) target_link_libraries(testLib9 INTERFACE testLib9ObjIface PUBLIC testLib9ObjPub PRIVATE testLib9ObjPriv) target_link_libraries(testLib9 PUBLIC Foo::Foo) -cmake_policy(POP) -block() - cmake_policy(SET CMP0022 NEW) - add_library(testLib10 STATIC testLib10.c) - set_target_properties(testLib10 PROPERTIES - TRANSITIVE_COMPILE_PROPERTIES "CUSTOM_C" - TRANSITIVE_LINK_PROPERTIES "CUSTOM_L" - INTERFACE_CUSTOM_C "TESTLIB10_INTERFACE_CUSTOM_C" - INTERFACE_CUSTOM_L "TESTLIB10_INTERFACE_CUSTOM_L" - ) - target_compile_definitions(testLib10 INTERFACE - "$" - "$" - ) - add_library(testLib11 STATIC testLib11.c) - target_link_libraries(testLib11 PRIVATE testLib10) - set_target_properties(testLib11 PROPERTIES - INTERFACE_CUSTOM_C "TESTLIB11_INTERFACE_CUSTOM_C" - INTERFACE_CUSTOM_L "TESTLIB11_INTERFACE_CUSTOM_L" - TRANSITIVE_COMPILE_PROPERTIES "CUSTOM_D" - TRANSITIVE_LINK_PROPERTIES "CUSTOM_M" - INTERFACE_CUSTOM_D "TESTLIB11_INTERFACE_CUSTOM_D" - INTERFACE_CUSTOM_M "TESTLIB11_INTERFACE_CUSTOM_M" - ) - target_compile_definitions(testLib11 INTERFACE - "$" - "$" - "$" - "$" - ) -endblock() +add_library(testLib10 STATIC testLib10.c) +set_target_properties(testLib10 PROPERTIES + TRANSITIVE_COMPILE_PROPERTIES "CUSTOM_C" + TRANSITIVE_LINK_PROPERTIES "CUSTOM_L" + INTERFACE_CUSTOM_C "TESTLIB10_INTERFACE_CUSTOM_C" + INTERFACE_CUSTOM_L "TESTLIB10_INTERFACE_CUSTOM_L" + ) +target_compile_definitions(testLib10 INTERFACE + "$" + "$" + ) +add_library(testLib11 STATIC testLib11.c) +target_link_libraries(testLib11 PRIVATE testLib10) +set_target_properties(testLib11 PROPERTIES + INTERFACE_CUSTOM_C "TESTLIB11_INTERFACE_CUSTOM_C" + INTERFACE_CUSTOM_L "TESTLIB11_INTERFACE_CUSTOM_L" + TRANSITIVE_COMPILE_PROPERTIES "CUSTOM_D" + TRANSITIVE_LINK_PROPERTIES "CUSTOM_M" + INTERFACE_CUSTOM_D "TESTLIB11_INTERFACE_CUSTOM_D" + INTERFACE_CUSTOM_M "TESTLIB11_INTERFACE_CUSTOM_M" + ) +target_compile_definitions(testLib11 INTERFACE + "$" + "$" + "$" + "$" + ) # Test using the target_link_libraries command to set the -# LINK_INTERFACE_LIBRARIES* properties. We construct two libraries +# INTERFACE_LINK_LIBRARIES properties. We construct two libraries # providing the same two symbols. In each library one of the symbols # will work and the other one will fail to link. The import part of # this test will try to use the symbol corresponding to the @@ -166,7 +157,7 @@ set_property(TARGET testLib4libdbg PROPERTY COMPILE_DEFINITIONS LIB_DBG) set_property(TARGET testLib4libopt PROPERTY COMPILE_DEFINITIONS LIB_OPT) target_link_libraries(testLib4 LINK_INTERFACE_LIBRARIES - testLib4lib debug testLib4libdbg optimized testLib4libopt + testLib4lib debug $ optimized $ ) add_executable(testExe3 testExe3.c) @@ -219,9 +210,6 @@ install( DESTINATION include/testInterfaceIncludeUser ) -cmake_policy(PUSH) -cmake_policy(SET CMP0022 NEW) - # Test control over direct linking. include(../../InterfaceLinkLibrariesDirect/testStaticLibPlugin.cmake) include(../../InterfaceLinkLibrariesDirect/testSharedLibWithHelper.cmake) @@ -237,10 +225,8 @@ add_library(testLibDepends testLibDepends.c) target_link_libraries(testLibDepends LINK_PUBLIC testLibRequired) add_library(testStaticLibRequiredPrivate testStaticLibRequiredPrivate.c) target_link_libraries(testLibDepends PRIVATE testStaticLibRequiredPrivate) -cmake_policy(POP) cmake_policy(PUSH) -cmake_policy(SET CMP0022 NEW) cmake_policy(SET CMP0079 NEW) add_library(TopDirLib STATIC testTopDirLib.c) add_subdirectory(SubDirLinkA) @@ -387,8 +373,6 @@ install(FILES DESTINATION include/testSharedLibRequiredUser ) -cmake_policy(PUSH) -cmake_policy(SET CMP0022 NEW) add_library(testSharedLibRequiredUser2 SHARED testSharedLibRequiredUser2.cpp) generate_export_header(testSharedLibRequiredUser2) set_property(TARGET testSharedLibRequiredUser2 APPEND PROPERTY @@ -401,7 +385,6 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/testsharedlibrequireduser2_export.h" DESTINATION include/testSharedLibRequiredUser2 ) -cmake_policy(POP) cmake_policy(PUSH) cmake_policy(SET CMP0041 NEW) @@ -426,28 +409,17 @@ set_property(TARGET testSharedLibDepends APPEND PROPERTY ) cmake_policy(POP) -# LINK_PRIVATE because the LINK_INTERFACE_LIBRARIES is specified above. target_link_libraries(testSharedLibDepends LINK_PRIVATE testSharedLibRequired) target_link_libraries(testSharedLibDepends LINK_PUBLIC renamed_on_export) -target_link_libraries(testSharedLibDepends LINK_INTERFACE_LIBRARIES +target_link_libraries(testSharedLibDepends INTERFACE $<$,EXECUTABLE>:$>) -cmake_policy(PUSH) -cmake_policy(SET CMP0022 OLD) -add_library(cmp0022OLD SHARED cmp0022_vs6_1.cpp) -generate_export_header(cmp0022OLD BASE_NAME cmp0022) -target_include_directories(cmp0022OLD PUBLIC - "$" - "$/include/cmp0022>" -) -cmake_policy(SET CMP0022 NEW) add_library(cmp0022NEW SHARED cmp0022_vs6_1.cpp) -set_property(TARGET cmp0022NEW PROPERTY DEFINE_SYMBOL cmp0022OLD_EXPORTS) +generate_export_header(cmp0022NEW BASE_NAME cmp0022) target_include_directories(cmp0022NEW PUBLIC "$" "$/include/cmp0022>" ) -cmake_policy(POP) install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmp0022.h" "${CMAKE_CURRENT_BINARY_DIR}/cmp0022_export.h" @@ -466,9 +438,6 @@ set_property(TARGET testLib4 PROPERTY EXPORT_PROPERTIES EXPORTED_PROPERTY2 EXPORTED_PROPERTY3) set_property(TARGET cmp0022NEW APPEND PROPERTY INTERFACE_LINK_LIBRARIES testLib2) -# set_property(TARGET cmp0022NEW APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLibIncludeRequired2) # TODO: Test for error -set_property(TARGET cmp0022OLD APPEND PROPERTY INTERFACE_LINK_LIBRARIES testLib2) -set_property(TARGET cmp0022OLD APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLib3) add_library(noIncludesInterface empty.cpp) @@ -622,7 +591,7 @@ install( testSharedLibWithHelper testSharedLibHelperObj testExeWithPluginHelper testExePluginHelperObj testMod1 testMod2 - cmp0022NEW cmp0022OLD + cmp0022NEW TopDirLib SubDirLinkA systemlib testInterfaceIncludeUser @@ -684,7 +653,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3 testExe2libImp testLib3Imp testLib3ImpDep subdirlib testSharedLibRequired testSharedLibRequiredUser testSharedLibRequiredUser2 testSharedLibDepends renamed_on_export - cmp0022NEW cmp0022OLD + cmp0022NEW TopDirLib SubDirLinkA systemlib noUses testInterfaceIncludeUser diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index 7d933a4d50..fa139978d7 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -186,13 +186,9 @@ if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG AND endforeach() endif() -add_executable(cmp0022OLD_test cmp0022OLD_test_vs6_1.cpp) -target_link_libraries(cmp0022OLD_test bld_cmp0022OLD) add_executable(cmp0022NEW_test cmp0022NEW_test_vs6_1.cpp) target_link_libraries(cmp0022NEW_test bld_cmp0022NEW) -add_executable(cmp0022OLD_exp_test cmp0022OLD_test_vs6_2.cpp) -target_link_libraries(cmp0022OLD_exp_test exp_cmp0022OLD) add_executable(cmp0022NEW_exp_test cmp0022NEW_test_vs6_2.cpp) target_link_libraries(cmp0022NEW_exp_test exp_cmp0022NEW) @@ -427,32 +423,16 @@ target_link_libraries(iface_test_bld bld_testSharedLibDepends) set_property(TARGET iface_test_bld PROPERTY NO_SYSTEM_FROM_IMPORTED 1) set_property(TARGET bld_testSharedLibRequired APPEND PROPERTY - LINK_INTERFACE_LIBRARIES + INTERFACE_LINK_LIBRARIES excludedFromAll ) -get_target_property(_configs bld_testSharedLibRequired IMPORTED_CONFIGURATIONS) -foreach(_config ${_configs}) - set_property(TARGET bld_testSharedLibRequired APPEND PROPERTY - IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} - excludedFromAll - ) -endforeach() -unset(_configs) add_executable(iface_test_exp iface_test.cpp) target_link_libraries(iface_test_exp testSharedLibDepends) set_property(TARGET testSharedLibDepends APPEND PROPERTY - LINK_INTERFACE_LIBRARIES + INTERFACE_LINK_LIBRARIES excludedFromAll ) -get_target_property(_configs testSharedLibDepends IMPORTED_CONFIGURATIONS) -foreach(_config ${_configs}) - set_property(TARGET testSharedLibDepends APPEND PROPERTY - IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} - excludedFromAll - ) -endforeach() -unset(_configs) if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.4) OR CMAKE_C_COMPILER_ID MATCHES "LCC" diff --git a/Tests/ExportImport/Import/A/cmp0022OLD_test.cpp b/Tests/ExportImport/Import/A/cmp0022OLD_test.cpp deleted file mode 100644 index 9eaaee9b4b..0000000000 --- a/Tests/ExportImport/Import/A/cmp0022OLD_test.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -#ifdef USING_TESTLIB2 -# error Unexpected USING_TESTLIB2 -#endif -#ifndef USING_TESTLIB3 -# error Expected USING_TESTLIB3 -#endif - -int main(void) -{ - return 0; -} diff --git a/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_1.cpp b/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_1.cpp deleted file mode 100644 index 90d804ce79..0000000000 --- a/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_1.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "cmp0022OLD_test.cpp" diff --git a/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_2.cpp b/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_2.cpp deleted file mode 100644 index 90d804ce79..0000000000 --- a/Tests/ExportImport/Import/A/cmp0022OLD_test_vs6_2.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "cmp0022OLD_test.cpp" diff --git a/Tests/InterfaceLinkLibraries/CMakeLists.txt b/Tests/InterfaceLinkLibraries/CMakeLists.txt index 5b83b14bbe..709005746a 100644 --- a/Tests/InterfaceLinkLibraries/CMakeLists.txt +++ b/Tests/InterfaceLinkLibraries/CMakeLists.txt @@ -1,7 +1,5 @@ cmake_minimum_required(VERSION 3.10) -cmake_policy(SET CMP0022 NEW) - project(InterfaceLinkLibraries) add_library(foo_shared SHARED foo_vs6_1.cpp) diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe.cmake b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe.cmake deleted file mode 100644 index b0268c8428..0000000000 --- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe.cmake +++ /dev/null @@ -1,7 +0,0 @@ -enable_language(CXX) - -add_library(testLib empty_vs6_1.cpp) -add_executable(testExe empty_vs6_2.cpp) -target_link_libraries(testExe testLib) - -export(TARGETS testExe FILE "${CMAKE_CURRENT_BINARY_DIR}/cmp0022NOWARN-exe.cmake") diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW.cmake b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW.cmake index 308980c59c..8ad16879bc 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW.cmake +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW.cmake @@ -1,8 +1,6 @@ enable_language(CXX) -cmake_policy(SET CMP0022 NEW) - add_library(foo STATIC empty_vs6_1.cpp) add_library(bar STATIC empty_vs6_2.cpp) add_library(bat STATIC empty_vs6_3.cpp) diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-result.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-result.txt deleted file mode 100644 index 573541ac97..0000000000 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt deleted file mode 100644 index c84a289c15..0000000000 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt +++ /dev/null @@ -1,19 +0,0 @@ -^CMake Warning \(dev\) in CMakeLists\.txt: - Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link - interface. Run "cmake --help-policy CMP0022" for policy details. Use the - cmake_policy command to set the policy and suppress this warning. - - Target "bar" has an INTERFACE_LINK_LIBRARIES property. This should be - preferred as the source of the link interface for this library but because - CMP0022 is not set CMake is ignoring the property and using the link - implementation as the link interface instead. - - INTERFACE_LINK_LIBRARIES: - - foo - - Link implementation: - - \(empty\) - -This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old.cmake b/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old.cmake deleted file mode 100644 index 7356e29d34..0000000000 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old.cmake +++ /dev/null @@ -1,10 +0,0 @@ - -enable_language(CXX) - -add_library(foo SHARED empty_vs6_1.cpp) -add_library(bar SHARED empty_vs6_2.cpp) - -set_property(TARGET bar PROPERTY INTERFACE_LINK_LIBRARIES foo) - -add_library(user empty.cpp) -target_link_libraries(user bar) diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-static-result.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-static-result.txt deleted file mode 100644 index 573541ac97..0000000000 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-static-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt deleted file mode 100644 index 1370c5ebe7..0000000000 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-static-stderr.txt +++ /dev/null @@ -1,19 +0,0 @@ -CMake Warning \(dev\) in CMakeLists.txt: - Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link - interface. Run "cmake --help-policy CMP0022" for policy details. Use the - cmake_policy command to set the policy and suppress this warning. - - Target "bar" has an INTERFACE_LINK_LIBRARIES property. This should be - preferred as the source of the link interface for this library but because - CMP0022 is not set CMake is ignoring the property and using the link - implementation as the link interface instead. - - INTERFACE_LINK_LIBRARIES: - - foo - - Link implementation: - - bat - -This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-static.cmake b/Tests/RunCMake/CMP0022/CMP0022-WARN-static.cmake deleted file mode 100644 index 0ea4fe5a50..0000000000 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-static.cmake +++ /dev/null @@ -1,11 +0,0 @@ - -enable_language(CXX) - -add_library(foo STATIC empty_vs6_1.cpp) -add_library(bar STATIC empty_vs6_2.cpp) -add_library(bat STATIC empty_vs6_3.cpp) -set_property(TARGET bar PROPERTY INTERFACE_LINK_LIBRARIES foo) -set_property(TARGET bar PROPERTY LINK_LIBRARIES bat) - -add_library(user empty.cpp) -target_link_libraries(user bar) diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt deleted file mode 100644 index 39a9511844..0000000000 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt +++ /dev/null @@ -1,17 +0,0 @@ -^CMake Warning \(dev\) in CMakeLists\.txt: - Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link - interface. Run "cmake --help-policy CMP0022" for policy details. Use the - cmake_policy command to set the policy and suppress this warning. - - Target "bar" has an INTERFACE_LINK_LIBRARIES property which differs from - its LINK_INTERFACE_LIBRARIES properties. - - INTERFACE_LINK_LIBRARIES: - - foo - - LINK_INTERFACE_LIBRARIES: - - bat - -This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-result.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-result.txt deleted file mode 100644 index 573541ac97..0000000000 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt deleted file mode 100644 index 5d39214f4e..0000000000 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt +++ /dev/null @@ -1,17 +0,0 @@ -CMake Warning \(dev\) in CMakeLists.txt: - Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link - interface. Run "cmake --help-policy CMP0022" for policy details. Use the - cmake_policy command to set the policy and suppress this warning. - - Target "bar" has an INTERFACE_LINK_LIBRARIES property which differs from - its LINK_INTERFACE_LIBRARIES(_DEBUG)? properties. - - INTERFACE_LINK_LIBRARIES: - - foo - - LINK_INTERFACE_LIBRARIES(_DEBUG)?: - - bat - -This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake deleted file mode 100644 index ba207db78a..0000000000 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake +++ /dev/null @@ -1,13 +0,0 @@ - -enable_language(CXX) - -add_library(foo SHARED empty_vs6_1.cpp) -add_library(bar SHARED empty_vs6_2.cpp) -add_library(bat SHARED empty_vs6_3.cpp) -target_link_libraries(bar LINK_PUBLIC foo) -# Replace the compatibility values set by target_link_libraries -set_property(TARGET bar PROPERTY LINK_INTERFACE_LIBRARIES bat) -set_property(TARGET bar PROPERTY LINK_INTERFACE_LIBRARIES_DEBUG bat) - -add_library(user SHARED empty.cpp) -target_link_libraries(user bar) diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake b/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake deleted file mode 100644 index 38adccaef5..0000000000 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake +++ /dev/null @@ -1,18 +0,0 @@ - -enable_language(CXX) - -cmake_policy(SET CMP0042 NEW) - -add_library(foo SHARED empty_vs6_1.cpp) -add_library(bar SHARED empty_vs6_2.cpp) -add_library(bat SHARED empty_vs6_3.cpp) -set_property(TARGET bar PROPERTY INTERFACE_LINK_LIBRARIES foo) -set_property(TARGET bar PROPERTY LINK_INTERFACE_LIBRARIES bat) - -add_library(user empty.cpp) -target_link_libraries(user bar) - -# Use "bar" again with a different "head" target to check -# that the warning does not appear again. -add_library(user2 empty_vs6_3.cpp) -target_link_libraries(user2 bar) diff --git a/Tests/RunCMake/CMP0022/CMP0022-export-exe.cmake b/Tests/RunCMake/CMP0022/CMP0022-export-exe.cmake index d832faceb5..70dc6fa344 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-export-exe.cmake +++ b/Tests/RunCMake/CMP0022/CMP0022-export-exe.cmake @@ -1,7 +1,5 @@ enable_language(CXX) -cmake_policy(SET CMP0022 NEW) - add_library(testLib empty_vs6_1.cpp) add_executable(testExe empty_vs6_2.cpp) target_link_libraries(testExe testLib) diff --git a/Tests/RunCMake/CMP0022/CMP0022-export.cmake b/Tests/RunCMake/CMP0022/CMP0022-export.cmake index e121b53626..5a61a8937c 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-export.cmake +++ b/Tests/RunCMake/CMP0022/CMP0022-export.cmake @@ -1,8 +1,6 @@ enable_language(CXX) -cmake_policy(SET CMP0022 NEW) - add_library(cmp0022NEW SHARED empty_vs6_1.cpp) add_library(testLib SHARED empty_vs6_2.cpp) diff --git a/Tests/RunCMake/CMP0022/CMP0022-install-export.cmake b/Tests/RunCMake/CMP0022/CMP0022-install-export.cmake index 532e204b8f..f9eca0486b 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-install-export.cmake +++ b/Tests/RunCMake/CMP0022/CMP0022-install-export.cmake @@ -1,8 +1,6 @@ enable_language(CXX) -cmake_policy(SET CMP0022 NEW) - add_library(cmp0022NEW SHARED empty_vs6_1.cpp) add_library(testLib SHARED empty_vs6_2.cpp) diff --git a/Tests/RunCMake/CMP0022/CMakeLists.txt b/Tests/RunCMake/CMP0022/CMakeLists.txt index 72abfc8099..bf2ef1506e 100644 --- a/Tests/RunCMake/CMP0022/CMakeLists.txt +++ b/Tests/RunCMake/CMP0022/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 3.10) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0022/RunCMakeTest.cmake b/Tests/RunCMake/CMP0022/RunCMakeTest.cmake index ea956fc70d..4af82d0dba 100644 --- a/Tests/RunCMake/CMP0022/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0022/RunCMakeTest.cmake @@ -1,11 +1,5 @@ include(RunCMake) -set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON) -run_cmake(CMP0022-WARN) -run_cmake(CMP0022-WARN-tll) -run_cmake(CMP0022-WARN-static) -run_cmake(CMP0022-WARN-empty-old) -run_cmake(CMP0022-NOWARN-exe) run_cmake(CMP0022-NOWARN-shared) run_cmake(CMP0022-NOWARN-static) run_cmake(CMP0022-NOWARN-static-NEW) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake index db571a3ca0..d9e9dde1b7 100644 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake @@ -1,5 +1,3 @@ -cmake_policy(SET CMP0022 NEW) - enable_language(C) add_library(AnObjLib OBJECT a.c) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake index 6bb8d5e7a2..4c0842bc2b 100644 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake @@ -1,5 +1,3 @@ -cmake_policy(SET CMP0022 NEW) - enable_language(C) add_library(AnObjLib OBJECT a.c) diff --git a/Tests/RunCMake/include_directories/incomplete-genex.cmake b/Tests/RunCMake/include_directories/incomplete-genex.cmake index 976695a648..dd05bfb34a 100644 --- a/Tests/RunCMake/include_directories/incomplete-genex.cmake +++ b/Tests/RunCMake/include_directories/incomplete-genex.cmake @@ -1,6 +1,5 @@ enable_language(CXX) -cmake_policy(SET CMP0022 NEW) cmake_policy(SET CMP0023 NEW) add_library(somelib empty.cpp) From c965856a1d9372fa63a446601af6e74c7966ceae Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 18 Nov 2024 19:09:32 -0500 Subject: [PATCH 10/13] cmGeneratorTarget: Simplify storage of link implementation With CMP0022 removed, the link implementation is now computed only for the target itself, and never for a dependent head target. --- Source/cmGeneratorTarget.cxx | 2 +- Source/cmGeneratorTarget.h | 15 +------ Source/cmGeneratorTarget_Link.cxx | 69 +++++++------------------------ 3 files changed, 17 insertions(+), 69 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 5a3d68b810..b52f67efec 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -5012,7 +5012,7 @@ bool cmGeneratorTarget::DiscoverSyntheticTargets(cmSyntheticTargetCache& cache, std::vector allConfigs = this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig); cmOptionalLinkImplementation impl; - this->ComputeLinkImplementationLibraries(config, impl, this, UseTo::Link); + this->ComputeLinkImplementationLibraries(config, impl, UseTo::Link); cmCxxModuleUsageEffects usage(this); diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 9db0527318..b65398e44c 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -449,7 +449,6 @@ public: void ComputeLinkImplementationLibraries(const std::string& config, cmOptionalLinkImplementation& impl, - const cmGeneratorTarget* head, UseTo usage) const; struct TargetOrString @@ -1360,22 +1359,10 @@ private: void GetSourceFilesWithoutObjectLibraries(std::vector& files, const std::string& config) const; - struct HeadToLinkImplementationMap - : public std::map - { - }; - using LinkImplMapType = std::map; + using LinkImplMapType = std::map; mutable LinkImplMapType LinkImplMap; mutable LinkImplMapType LinkImplUsageRequirementsOnlyMap; - HeadToLinkImplementationMap& GetHeadToLinkImplementationMap( - std::string const& config) const; - HeadToLinkImplementationMap& GetHeadToLinkImplementationUsageRequirementsMap( - std::string const& config) const; - - cmLinkImplementationLibraries const* GetLinkImplementationLibrariesInternal( - const std::string& config, const cmGeneratorTarget* head, - UseTo usage) const; bool ComputeOutputDir(const std::string& config, cmStateEnums::ArtifactType artifact, std::string& out) const; diff --git a/Source/cmGeneratorTarget_Link.cxx b/Source/cmGeneratorTarget_Link.cxx index 10e83a3563..be837e1010 100644 --- a/Source/cmGeneratorTarget_Link.cxx +++ b/Source/cmGeneratorTarget_Link.cxx @@ -382,16 +382,8 @@ void cmGeneratorTarget::CheckLinkLibraries() const } // Check link the implementation for each generated configuration. - for (auto const& hmp : this->LinkImplMap) { - HeadToLinkImplementationMap const& hm = hmp.second; - // There could be several entries used when computing the pre-CMP0022 - // default link interface. Check only the entry for our own link impl. - auto const hmi = hm.find(this); - if (hmi == hm.end() || !hmi->second.LibrariesDone || - !hmi->second.CheckLinkLibraries) { - continue; - } - for (cmLinkImplItem const& item : hmi->second.Libraries) { + for (auto const& impl : this->LinkImplMap) { + for (cmLinkImplItem const& item : impl.second.Libraries) { if (!this->VerifyLinkItemColons(LinkItemRole::Implementation, item)) { return; } @@ -996,18 +988,18 @@ const cmLinkImplementation* cmGeneratorTarget::GetLinkImplementation( return nullptr; } - HeadToLinkImplementationMap& hm = + cmOptionalLinkImplementation& impl = (usage == UseTo::Compile - ? this->GetHeadToLinkImplementationUsageRequirementsMap(config) - : this->GetHeadToLinkImplementationMap(config)); - cmOptionalLinkImplementation& impl = hm[this]; + ? this + ->LinkImplUsageRequirementsOnlyMap[cmSystemTools::UpperCase(config)] + : this->LinkImplMap[cmSystemTools::UpperCase(config)]); if (secondPass) { impl = cmOptionalLinkImplementation(); } MaybeEnableCheckLinkLibraries(impl); if (!impl.LibrariesDone) { impl.LibrariesDone = true; - this->ComputeLinkImplementationLibraries(config, impl, this, usage); + this->ComputeLinkImplementationLibraries(config, impl, usage); } if (!impl.LanguagesDone) { impl.LanguagesDone = true; @@ -1017,31 +1009,9 @@ const cmLinkImplementation* cmGeneratorTarget::GetLinkImplementation( return &impl; } -cmGeneratorTarget::HeadToLinkImplementationMap& -cmGeneratorTarget::GetHeadToLinkImplementationMap( - std::string const& config) const -{ - return this->LinkImplMap[cmSystemTools::UpperCase(config)]; -} - -cmGeneratorTarget::HeadToLinkImplementationMap& -cmGeneratorTarget::GetHeadToLinkImplementationUsageRequirementsMap( - std::string const& config) const -{ - return this - ->LinkImplUsageRequirementsOnlyMap[cmSystemTools::UpperCase(config)]; -} - cmLinkImplementationLibraries const* cmGeneratorTarget::GetLinkImplementationLibraries(const std::string& config, UseTo usage) const -{ - return this->GetLinkImplementationLibrariesInternal(config, this, usage); -} - -cmLinkImplementationLibraries const* -cmGeneratorTarget::GetLinkImplementationLibrariesInternal( - const std::string& config, cmGeneratorTarget const* head, UseTo usage) const { // There is no link implementation for targets that cannot compile sources. if (!this->CanCompileSources()) { @@ -1049,22 +1019,15 @@ cmGeneratorTarget::GetLinkImplementationLibrariesInternal( } // Populate the link implementation libraries for this configuration. - HeadToLinkImplementationMap& hm = + cmOptionalLinkImplementation& impl = (usage == UseTo::Compile - ? this->GetHeadToLinkImplementationUsageRequirementsMap(config) - : this->GetHeadToLinkImplementationMap(config)); - - // If the link implementation does not depend on the head target - // then reuse the one from the head we computed first. - if (!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition) { - head = hm.begin()->first; - } - - cmOptionalLinkImplementation& impl = hm[head]; + ? this + ->LinkImplUsageRequirementsOnlyMap[cmSystemTools::UpperCase(config)] + : this->LinkImplMap[cmSystemTools::UpperCase(config)]); MaybeEnableCheckLinkLibraries(impl); if (!impl.LibrariesDone) { impl.LibrariesDone = true; - this->ComputeLinkImplementationLibraries(config, impl, head, usage); + this->ComputeLinkImplementationLibraries(config, impl, usage); } return &impl; } @@ -1177,7 +1140,7 @@ void ComputeLinkImplTransitive(cmGeneratorTarget const* self, void cmGeneratorTarget::ComputeLinkImplementationLibraries( const std::string& config, cmOptionalLinkImplementation& impl, - cmGeneratorTarget const* head, UseTo usage) const + UseTo usage) const { cmLocalGenerator const* lg = this->LocalGenerator; cmMakefile const* mf = lg->GetMakefile(); @@ -1207,7 +1170,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries( ge.Parse(entry.Value); cge->SetEvaluateForBuildsystem(true); std::string const& evaluated = - cge->Evaluate(this->LocalGenerator, config, head, &dagChecker, nullptr, + cge->Evaluate(this->LocalGenerator, config, this, &dagChecker, nullptr, this->LinkerLanguage); bool const checkCMP0027 = evaluated != entry.Value; cmList llibs(evaluated); @@ -1309,9 +1272,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries( } // Update the list of direct link dependencies from usage requirements. - if (head == this) { - ComputeLinkImplTransitive(this, config, usage, impl); - } + ComputeLinkImplTransitive(this, config, usage, impl); // Get the list of configurations considered to be DEBUG. std::vector debugConfigs = From 033a2dc0009162579bd0402685323a3acb7e0b9a Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 18 Nov 2024 19:31:55 -0500 Subject: [PATCH 11/13] cmLinkItem: Remove now-unused fields from link interfaces With CMP0022 removed, a link interface is now always explicit if it exists. It is also never derived from the link implementation. --- Source/cmExportCMakeConfigGenerator.cxx | 11 +----- Source/cmGeneratorTarget_Link.cxx | 49 ++++++++++++------------- Source/cmLinkItem.h | 3 -- 3 files changed, 25 insertions(+), 38 deletions(-) diff --git a/Source/cmExportCMakeConfigGenerator.cxx b/Source/cmExportCMakeConfigGenerator.cxx index bcd97712f9..bb9de54f26 100644 --- a/Source/cmExportCMakeConfigGenerator.cxx +++ b/Source/cmExportCMakeConfigGenerator.cxx @@ -17,7 +17,6 @@ #include "cmFindPackageStack.h" #include "cmGeneratedFileStream.h" #include "cmGeneratorTarget.h" -#include "cmLinkItem.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmMessageType.h" @@ -29,6 +28,8 @@ #include "cmValue.h" #include "cmVersion.h" +struct cmLinkInterface; + static std::string cmExportFileGeneratorEscape(std::string const& str) { // Escape a property value for writing into a .cmake file. @@ -110,14 +111,6 @@ void cmExportCMakeConfigGenerator::SetImportLinkInterface( return; } - if (iface->ImplementationIsInterface) { - // Policy CMP0022 must not be NEW. - this->SetImportLinkProperty( - suffix, target, "IMPORTED_LINK_INTERFACE_LIBRARIES", iface->Libraries, - properties, ImportLinkPropertyTargetNames::Yes); - return; - } - cmValue propContent; if (cmValue prop_suffixed = diff --git a/Source/cmGeneratorTarget_Link.cxx b/Source/cmGeneratorTarget_Link.cxx index be837e1010..5e00ace72d 100644 --- a/Source/cmGeneratorTarget_Link.cxx +++ b/Source/cmGeneratorTarget_Link.cxx @@ -680,32 +680,30 @@ void cmGeneratorTarget::ComputeLinkInterface(const std::string& config, cmOptionalLinkInterface& iface, bool secondPass) const { - if (iface.Explicit) { - if (this->GetType() == cmStateEnums::SHARED_LIBRARY || - this->GetType() == cmStateEnums::STATIC_LIBRARY || - this->GetType() == cmStateEnums::INTERFACE_LIBRARY) { - // Shared libraries may have runtime implementation dependencies - // on other shared libraries that are not in the interface. - std::set emitted; - for (cmLinkItem const& lib : iface.Libraries) { - emitted.insert(lib); - } - if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) { - cmLinkImplementation const* impl = - this->GetLinkImplementation(config, UseTo::Link, secondPass); - for (cmLinkImplItem const& lib : impl->Libraries) { - if (emitted.insert(lib).second) { - if (lib.Target) { - // This is a runtime dependency on another shared library. - if (lib.Target->GetType() == cmStateEnums::SHARED_LIBRARY) { - iface.SharedDeps.push_back(lib); - } - } else { - // TODO: Recognize shared library file names. Perhaps this - // should be moved to cmComputeLinkInformation, but that - // creates a chicken-and-egg problem since this list is needed - // for its construction. + if (this->GetType() == cmStateEnums::SHARED_LIBRARY || + this->GetType() == cmStateEnums::STATIC_LIBRARY || + this->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + // Shared libraries may have runtime implementation dependencies + // on other shared libraries that are not in the interface. + std::set emitted; + for (cmLinkItem const& lib : iface.Libraries) { + emitted.insert(lib); + } + if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) { + cmLinkImplementation const* impl = + this->GetLinkImplementation(config, UseTo::Link, secondPass); + for (cmLinkImplItem const& lib : impl->Libraries) { + if (emitted.insert(lib).second) { + if (lib.Target) { + // This is a runtime dependency on another shared library. + if (lib.Target->GetType() == cmStateEnums::SHARED_LIBRARY) { + iface.SharedDeps.push_back(lib); } + } else { + // TODO: Recognize shared library file names. Perhaps this + // should be moved to cmComputeLinkInformation, but that + // creates a chicken-and-egg problem since this list is needed + // for its construction. } } } @@ -805,7 +803,6 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries( return; } iface.Exists = true; - iface.Explicit = true; // The interface libraries are specified by INTERFACE_LINK_LIBRARIES. // Use its special representation directly to get backtraces. diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h index 733c4a994b..6750fed7c0 100644 --- a/Source/cmLinkItem.h +++ b/Source/cmLinkItem.h @@ -104,8 +104,6 @@ struct cmLinkInterface : public cmLinkInterfaceLibraries // or more static libraries. unsigned int Multiplicity = 0; - bool ImplementationIsInterface = false; - // Whether the list depends on a link language genex. bool HadLinkLanguageSensitiveCondition = false; }; @@ -115,7 +113,6 @@ struct cmOptionalLinkInterface : public cmLinkInterface bool LibrariesDone = false; bool AllDone = false; bool Exists = false; - bool Explicit = false; bool CheckLinkLibraries = false; }; From 0453f70400fa4e756824dbcf9903698f3cf6fa3d Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 19 Nov 2024 14:32:14 -0500 Subject: [PATCH 12/13] CMP0023: Remove support for OLD behavior --- Help/policy/CMP0023.rst | 9 ++-- Source/cmPolicies.h | 2 +- Source/cmTargetLinkLibrariesCommand.cxx | 51 ++++++------------- .../incomplete-genex.cmake | 2 - .../CMP0023-NEW-2-stderr.txt | 4 +- .../target_link_libraries/CMP0023-NEW-2.cmake | 2 - .../CMP0023-NEW-stderr.txt | 4 +- .../target_link_libraries/CMP0023-NEW.cmake | 2 - .../CMP0023-WARN-2-stderr.txt | 16 ------ .../CMP0023-WARN-2.cmake | 9 ---- .../CMP0023-WARN-stderr.txt | 16 ------ .../target_link_libraries/CMP0023-WARN.cmake | 9 ---- .../target_link_libraries/RunCMakeTest.cmake | 2 - 13 files changed, 26 insertions(+), 102 deletions(-) delete mode 100644 Tests/RunCMake/target_link_libraries/CMP0023-WARN-2-stderr.txt delete mode 100644 Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake delete mode 100644 Tests/RunCMake/target_link_libraries/CMP0023-WARN-stderr.txt delete mode 100644 Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake diff --git a/Help/policy/CMP0023.rst b/Help/policy/CMP0023.rst index c863a91fe2..265136f390 100644 --- a/Help/policy/CMP0023.rst +++ b/Help/policy/CMP0023.rst @@ -1,6 +1,9 @@ CMP0023 ------- +.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0 +.. include:: REMOVED_PROLOGUE.txt + Plain and keyword :command:`target_link_libraries` signatures cannot be mixed. CMake 2.8.12 introduced the :command:`target_link_libraries` signature using @@ -29,7 +32,5 @@ this policy is to not to allow mixing of the keyword and plain signatures. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.12 -.. |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/Source/cmPolicies.h b/Source/cmPolicies.h index 08f020b2b3..7dbcd8db7d 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -83,7 +83,7 @@ class cmMakefile; SELECT( \ POLICY, CMP0023, \ "Plain and keyword target_link_libraries signatures cannot be mixed.", 2, \ - 8, 12, WARN) \ + 8, 12, NEW) \ SELECT(POLICY, CMP0024, "Disallow include export result.", 3, 0, 0, WARN) \ SELECT(POLICY, CMP0025, "Compiler id for Apple Clang is now AppleClang.", \ 3, 0, 0, WARN) \ diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 73939de5e8..6b1d3187c7 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -396,41 +396,22 @@ bool TLL::HandleLibrary(ProcessingState currentProcessingState, if (!this->Target->PushTLLCommandTrace( sig, this->Makefile.GetBacktrace().Top())) { std::ostringstream e; - const char* modal = nullptr; - MessageType messageType = MessageType::AUTHOR_WARNING; - switch (this->Makefile.GetPolicyStatus(cmPolicies::CMP0023)) { - case cmPolicies::WARN: - e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0023) << '\n'; - modal = "should"; - CM_FALLTHROUGH; - case cmPolicies::OLD: - break; - case cmPolicies::NEW: - modal = "must"; - messageType = MessageType::FATAL_ERROR; - break; - } - - if (modal) { - // If the sig is a keyword form and there is a conflict, the existing - // form must be the plain form. - const char* existingSig = - (sig == cmTarget::KeywordTLLSignature ? "plain" : "keyword"); - e << "The " << existingSig - << " signature for target_link_libraries has " - "already been used with the target \"" - << this->Target->GetName() - << "\". All uses of target_link_libraries with a target " << modal - << " be either all-keyword or all-plain.\n"; - this->Target->GetTllSignatureTraces(e, - sig == cmTarget::KeywordTLLSignature - ? cmTarget::PlainTLLSignature - : cmTarget::KeywordTLLSignature); - this->Makefile.IssueMessage(messageType, e.str()); - if (messageType == MessageType::FATAL_ERROR) { - return false; - } - } + // If the sig is a keyword form and there is a conflict, the existing + // form must be the plain form. + const char* existingSig = + (sig == cmTarget::KeywordTLLSignature ? "plain" : "keyword"); + e << "The " << existingSig + << " signature for target_link_libraries has " + "already been used with the target \"" + << this->Target->GetName() + << "\". All uses of target_link_libraries with a target must " + << " be either all-keyword or all-plain.\n"; + this->Target->GetTllSignatureTraces(e, + sig == cmTarget::KeywordTLLSignature + ? cmTarget::PlainTLLSignature + : cmTarget::KeywordTLLSignature); + this->Makefile.IssueMessage(MessageType::FATAL_ERROR, e.str()); + return false; } // Handle normal case where the command was called with another keyword than diff --git a/Tests/RunCMake/include_directories/incomplete-genex.cmake b/Tests/RunCMake/include_directories/incomplete-genex.cmake index dd05bfb34a..525cf445b3 100644 --- a/Tests/RunCMake/include_directories/incomplete-genex.cmake +++ b/Tests/RunCMake/include_directories/incomplete-genex.cmake @@ -1,7 +1,5 @@ enable_language(CXX) -cmake_policy(SET CMP0023 NEW) - add_library(somelib empty.cpp) # This test ensures that some internal mechanisms of cmGeneratorExpression diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt index 12c00fb01f..02c2870d6a 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt @@ -1,11 +1,11 @@ -CMake Error at CMP0023-NEW-2.cmake:11 \(target_link_libraries\): +CMake Error at CMP0023-NEW-2.cmake:9 \(target_link_libraries\): The plain signature for target_link_libraries has already been used with the target "foo". All uses of target_link_libraries with a target must be either all-keyword or all-plain. The uses of the plain signature are here: - \* CMP0023-NEW-2.cmake:10 \(target_link_libraries\) + \* CMP0023-NEW-2.cmake:8 \(target_link_libraries\) Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2.cmake b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2.cmake index f87a684991..0f50eb6f64 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2.cmake +++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2.cmake @@ -1,8 +1,6 @@ enable_language(CXX) -cmake_policy(SET CMP0023 NEW) - add_library(foo SHARED empty_vs6_1.cpp) add_library(bar SHARED empty_vs6_2.cpp) add_library(bat SHARED empty_vs6_3.cpp) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt index 117c806143..7c5869ac84 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt @@ -1,11 +1,11 @@ -CMake Error at CMP0023-NEW.cmake:11 \(target_link_libraries\): +CMake Error at CMP0023-NEW.cmake:9 \(target_link_libraries\): The plain signature for target_link_libraries has already been used with the target "foo". All uses of target_link_libraries with a target must be either all-keyword or all-plain. The uses of the plain signature are here: - \* CMP0023-NEW.cmake:10 \(target_link_libraries\) + \* CMP0023-NEW.cmake:8 \(target_link_libraries\) Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW.cmake b/Tests/RunCMake/target_link_libraries/CMP0023-NEW.cmake index 211029bf93..45ea41e244 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0023-NEW.cmake +++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW.cmake @@ -1,8 +1,6 @@ enable_language(CXX) -cmake_policy(SET CMP0023 NEW) - add_library(foo SHARED empty_vs6_1.cpp) add_library(bar SHARED empty_vs6_2.cpp) add_library(bat SHARED empty_vs6_3.cpp) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2-stderr.txt deleted file mode 100644 index 7e49d525e1..0000000000 --- a/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2-stderr.txt +++ /dev/null @@ -1,16 +0,0 @@ -CMake Warning \(dev\) at CMP0023-WARN-2.cmake:9 \(target_link_libraries\): - Policy CMP0023 is not set: Plain and keyword target_link_libraries - signatures cannot be mixed. Run "cmake --help-policy CMP0023" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - - The plain signature for target_link_libraries has already been used with - the target "foo". All uses of target_link_libraries with a target should - be either all-keyword or all-plain. - - The uses of the plain signature are here: - - \* CMP0023-WARN-2.cmake:8 \(target_link_libraries\) - -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake deleted file mode 100644 index a175a6118c..0000000000 --- a/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake +++ /dev/null @@ -1,9 +0,0 @@ -cmake_policy(VERSION 2.8.11) -enable_language(CXX) - -add_library(foo SHARED empty_vs6_1.cpp) -add_library(bar SHARED empty_vs6_2.cpp) -add_library(bat SHARED empty_vs6_3.cpp) - -target_link_libraries(foo bar) -target_link_libraries(foo LINK_PRIVATE bat) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-WARN-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-stderr.txt deleted file mode 100644 index df1288e353..0000000000 --- a/Tests/RunCMake/target_link_libraries/CMP0023-WARN-stderr.txt +++ /dev/null @@ -1,16 +0,0 @@ -CMake Warning \(dev\) at CMP0023-WARN.cmake:9 \(target_link_libraries\): - Policy CMP0023 is not set: Plain and keyword target_link_libraries - signatures cannot be mixed. Run "cmake --help-policy CMP0023" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - - The plain signature for target_link_libraries has already been used with - the target "foo". All uses of target_link_libraries with a target should - be either all-keyword or all-plain. - - The uses of the plain signature are here: - - \* CMP0023-WARN.cmake:8 \(target_link_libraries\) - -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake b/Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake deleted file mode 100644 index 7fbb70e3bb..0000000000 --- a/Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake +++ /dev/null @@ -1,9 +0,0 @@ -cmake_policy(VERSION 2.8.11) -enable_language(CXX) - -add_library(foo SHARED empty_vs6_1.cpp) -add_library(bar SHARED empty_vs6_2.cpp) -add_library(bat SHARED empty_vs6_3.cpp) - -target_link_libraries(foo bar) -target_link_libraries(foo PRIVATE bat) diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake index 80be69237f..76c06f1e64 100644 --- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake @@ -8,9 +8,7 @@ endif() run_cmake(ConfigCase) unset(RunCMake_TEST_OPTIONS) -run_cmake(CMP0023-WARN) run_cmake(CMP0023-NEW) -run_cmake(CMP0023-WARN-2) run_cmake(CMP0023-NEW-2) run_cmake(CMP0079-iface-WARN) run_cmake(CMP0079-iface-OLD) From 3c4afba8cc2244d6128ffa866e7fcde49681e6f9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 19 Nov 2024 14:37:00 -0500 Subject: [PATCH 13/13] Remove compatibility with CMake versions older than 2.8.12 This compatibility has been deprecated since commit 5845c218d7 (Deprecate compatibility with CMake versions older than 2.8.12, 2020-06-12, v3.19.0-rc1~629^2). The behavior itself has been deprecated since CMake 2.8.12. Issue: #26613 --- Help/command/DEPRECATED_POLICY_VERSIONS.txt | 4 ++-- Help/release/dev/remove-old-compatibility.rst | 2 +- Source/cmMakefile.cxx | 2 +- Source/cmPolicies.cxx | 7 ++++--- .../cmake_minimum_required/BeforeVersionRemoved-stderr.txt | 2 +- .../cmake_minimum_required/BeforeVersionRemoved.cmake | 2 +- .../PolicyBeforeVersionRemoved-stderr.txt | 2 +- .../PolicyBeforeVersionRemoved.cmake | 2 +- 8 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Help/command/DEPRECATED_POLICY_VERSIONS.txt b/Help/command/DEPRECATED_POLICY_VERSIONS.txt index dbcbfc404c..92cdaeb11a 100644 --- a/Help/command/DEPRECATED_POLICY_VERSIONS.txt +++ b/Help/command/DEPRECATED_POLICY_VERSIONS.txt @@ -1,9 +1,9 @@ .. versionchanged:: 4.0 - Compatibility with versions of CMake older than 2.8.0 is removed. + Compatibility with versions of CMake older than 2.8.12 is removed. Calls to :command:`cmake_minimum_required(VERSION)` or :command:`cmake_policy(VERSION)` that do not specify at least - 2.8.0 as their policy version (optionally via ``...``) + 2.8.12 as their policy version (optionally via ``...``) will produce an error in CMake 4.0 and above. .. versionchanged:: 3.31 diff --git a/Help/release/dev/remove-old-compatibility.rst b/Help/release/dev/remove-old-compatibility.rst index 2d828977d8..a02da41104 100644 --- a/Help/release/dev/remove-old-compatibility.rst +++ b/Help/release/dev/remove-old-compatibility.rst @@ -1,7 +1,7 @@ remove-old-compatibility ------------------------ -* Compatibility with versions of CMake older than 2.8.0 has been removed. +* Compatibility with versions of CMake older than 2.8.12 has been removed. Calls to :command:`cmake_minimum_required` or :command:`cmake_policy` that set the policy version to an older value now issue an error. Note that calls to those commands can still support older versions of diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 50ef9458bb..e8f4454dc7 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1741,7 +1741,7 @@ void cmMakefile::Configure() this->SetCheckCMP0000(true); // Implicitly set the version for the user. - cmPolicies::ApplyPolicyVersion(this, 2, 8, 0, + cmPolicies::ApplyPolicyVersion(this, 2, 8, 12, cmPolicies::WarnCompat::Off); } } diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index f506f09b98..206d4ffbfa 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -295,16 +295,17 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, unsigned int majorVer, WarnCompat warnCompat) { // Error on policy versions for which support has been removed. - if (majorVer < 2 || (majorVer == 2 && minorVer < 8)) { + if (majorVer < 2 || + (majorVer == 2 && (minorVer < 8 || (minorVer == 8 && patchVer < 12)))) { if (IsFromLegacyInstallEXPORT(mf, majorVer, minorVer, patchVer)) { // Silently tolerate cmake_policy calls generated by install(EXPORT) // in CMake versions prior to 3.18. majorVer = 2; minorVer = 8; - patchVer = 0; + patchVer = 12; } else { mf->IssueMessage(MessageType::FATAL_ERROR, - "Compatibility with CMake < 2.8.0 has been removed " + "Compatibility with CMake < 2.8.12 has been removed " "from CMake.\n" ADVICE_UPDATE_VERSION_ARGUMENT); cmSystemTools::SetFatalErrorOccurred(); return false; diff --git a/Tests/RunCMake/cmake_minimum_required/BeforeVersionRemoved-stderr.txt b/Tests/RunCMake/cmake_minimum_required/BeforeVersionRemoved-stderr.txt index 040a7c32c1..e20bf5b337 100644 --- a/Tests/RunCMake/cmake_minimum_required/BeforeVersionRemoved-stderr.txt +++ b/Tests/RunCMake/cmake_minimum_required/BeforeVersionRemoved-stderr.txt @@ -1,5 +1,5 @@ ^CMake Error at BeforeVersionRemoved\.cmake:1 \(cmake_minimum_required\): - Compatibility with CMake < 2\.8\.0 has been removed from CMake\. + Compatibility with CMake < 2\.8\.12 has been removed from CMake\. Update the VERSION argument value\. Or, use the \.\.\. syntax to tell CMake that the project requires at least but has been updated diff --git a/Tests/RunCMake/cmake_minimum_required/BeforeVersionRemoved.cmake b/Tests/RunCMake/cmake_minimum_required/BeforeVersionRemoved.cmake index d20c1c8d5f..851745b4c8 100644 --- a/Tests/RunCMake/cmake_minimum_required/BeforeVersionRemoved.cmake +++ b/Tests/RunCMake/cmake_minimum_required/BeforeVersionRemoved.cmake @@ -1 +1 @@ -cmake_minimum_required(VERSION 2.6.4) +cmake_minimum_required(VERSION 2.8.11) diff --git a/Tests/RunCMake/cmake_minimum_required/PolicyBeforeVersionRemoved-stderr.txt b/Tests/RunCMake/cmake_minimum_required/PolicyBeforeVersionRemoved-stderr.txt index 6824d8f203..273f103533 100644 --- a/Tests/RunCMake/cmake_minimum_required/PolicyBeforeVersionRemoved-stderr.txt +++ b/Tests/RunCMake/cmake_minimum_required/PolicyBeforeVersionRemoved-stderr.txt @@ -1,5 +1,5 @@ ^CMake Error at PolicyBeforeVersionRemoved\.cmake:1 \(cmake_policy\): - Compatibility with CMake < 2\.8\.0 has been removed from CMake\. + Compatibility with CMake < 2\.8\.12 has been removed from CMake\. Update the VERSION argument value\. Or, use the \.\.\. syntax to tell CMake that the project requires at least but has been updated diff --git a/Tests/RunCMake/cmake_minimum_required/PolicyBeforeVersionRemoved.cmake b/Tests/RunCMake/cmake_minimum_required/PolicyBeforeVersionRemoved.cmake index 1a41499365..0e2c8fe788 100644 --- a/Tests/RunCMake/cmake_minimum_required/PolicyBeforeVersionRemoved.cmake +++ b/Tests/RunCMake/cmake_minimum_required/PolicyBeforeVersionRemoved.cmake @@ -1 +1 @@ -cmake_policy(VERSION 2.6.4) +cmake_policy(VERSION 2.8.11)