From f8bc8780c1729489dc95666401c29a807a24af09 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 22 Nov 2024 16:56:15 -0500 Subject: [PATCH] CMP0026: Remove support for OLD behavior --- Help/policy/CMP0026.rst | 9 ++-- Source/cmGeneratorTarget.cxx | 39 +++++----------- Source/cmGeneratorTarget.h | 2 +- .../cmGeneratorTarget_IncludeDirectories.cxx | 4 +- Source/cmGeneratorTarget_LinkDirectories.cxx | 5 +-- Source/cmGeneratorTarget_Options.cxx | 21 +++------ Source/cmGeneratorTarget_Sources.cxx | 44 +------------------ Source/cmGlobalGenerator.cxx | 6 +-- Source/cmGlobalGenerator.h | 3 -- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmLinkItemGraphVisitor.cxx | 2 +- Source/cmPolicies.h | 2 +- Source/cmTarget.cxx | 36 ++------------- Source/cmTargetPropertyComputer.cxx | 38 ++++------------ Source/cmTargetPropertyComputer.h | 28 ++++++------ .../CMP0026-CONFIG-LOCATION-OLD-result.txt | 1 - .../CMP0026-CONFIG-LOCATION-OLD-stderr.txt | 10 ----- .../CMP0026/CMP0026-CONFIG-LOCATION-OLD.cmake | 7 --- .../CMP0026-CONFIG-LOCATION-WARN-result.txt | 1 - .../CMP0026-CONFIG-LOCATION-WARN-stderr.txt | 12 ----- .../CMP0026-CONFIG-LOCATION-WARN.cmake | 5 --- .../CMP0026-LOCATION-CONFIG-OLD-result.txt | 1 - .../CMP0026-LOCATION-CONFIG-OLD-stderr.txt | 10 ----- .../CMP0026/CMP0026-LOCATION-CONFIG-OLD.cmake | 7 --- .../CMP0026-LOCATION-CONFIG-WARN-result.txt | 1 - .../CMP0026-LOCATION-CONFIG-WARN-stderr.txt | 12 ----- .../CMP0026-LOCATION-CONFIG-WARN.cmake | 5 --- Tests/RunCMake/CMP0026/CMP0026-OLD-stderr.txt | 10 ----- Tests/RunCMake/CMP0026/CMP0026-OLD.cmake | 12 ----- .../CMP0026/CMP0026-WARN-Dir/CMakeLists.txt | 1 - .../RunCMake/CMP0026/CMP0026-WARN-result.txt | 1 - .../RunCMake/CMP0026/CMP0026-WARN-stderr.txt | 25 ----------- Tests/RunCMake/CMP0026/CMP0026-WARN.cmake | 8 ---- Tests/RunCMake/CMP0026/CMakeLists.txt | 2 +- .../LOCATION-and-TARGET_OBJECTS-result.txt | 1 - .../LOCATION-and-TARGET_OBJECTS-stderr.txt | 12 ----- .../CMP0026/LOCATION-and-TARGET_OBJECTS.cmake | 6 --- .../CMP0026/ObjlibNotDefined-result.txt | 1 - .../CMP0026/ObjlibNotDefined-stderr.txt | 12 ----- Tests/RunCMake/CMP0026/ObjlibNotDefined.cmake | 13 ------ Tests/RunCMake/CMP0026/RunCMakeTest.cmake | 10 ----- .../CMakeLists.txt | 2 - .../clear-cached-information-stderr.txt | 10 ----- .../CMP0026/clear-cached-information.cmake | 14 ------ .../GenEx-TARGET_PROPERTY/CMakeLists.txt | 3 -- .../GenEx-TARGET_PROPERTY/LOCATION-stderr.txt | 16 ------- .../GenEx-TARGET_PROPERTY/LOCATION.cmake | 3 -- .../GenEx-TARGET_PROPERTY/RunCMakeTest.cmake | 1 - .../CMP0026-LOCATION-result.txt | 1 - .../CMP0026-LOCATION-stderr.txt | 10 ----- .../target_sources/CMP0026-LOCATION.cmake | 14 ------ .../target_sources/RunCMakeTest.cmake | 1 - 52 files changed, 54 insertions(+), 448 deletions(-) delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-result.txt delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD.cmake delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN-result.txt delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN-stderr.txt delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN.cmake delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-result.txt delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD.cmake delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN-result.txt delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN-stderr.txt delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN.cmake delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-OLD-stderr.txt delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-OLD.cmake delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-WARN-result.txt delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt delete mode 100644 Tests/RunCMake/CMP0026/CMP0026-WARN.cmake delete mode 100644 Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS-result.txt delete mode 100644 Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS-stderr.txt delete mode 100644 Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS.cmake delete mode 100644 Tests/RunCMake/CMP0026/ObjlibNotDefined-result.txt delete mode 100644 Tests/RunCMake/CMP0026/ObjlibNotDefined-stderr.txt delete mode 100644 Tests/RunCMake/CMP0026/ObjlibNotDefined.cmake delete mode 100644 Tests/RunCMake/CMP0026/clear-cached-information-dir/CMakeLists.txt delete mode 100644 Tests/RunCMake/CMP0026/clear-cached-information-stderr.txt delete mode 100644 Tests/RunCMake/CMP0026/clear-cached-information.cmake delete mode 100644 Tests/RunCMake/GenEx-TARGET_PROPERTY/LOCATION-stderr.txt delete mode 100644 Tests/RunCMake/GenEx-TARGET_PROPERTY/LOCATION.cmake delete mode 100644 Tests/RunCMake/target_sources/CMP0026-LOCATION-result.txt delete mode 100644 Tests/RunCMake/target_sources/CMP0026-LOCATION-stderr.txt delete mode 100644 Tests/RunCMake/target_sources/CMP0026-LOCATION.cmake diff --git a/Help/policy/CMP0026.rst b/Help/policy/CMP0026.rst index b2a5f25d91..06b1dd1943 100644 --- a/Help/policy/CMP0026.rst +++ b/Help/policy/CMP0026.rst @@ -1,6 +1,9 @@ CMP0026 ------- +.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0 +.. include:: REMOVED_PROLOGUE.txt + Disallow use of the LOCATION property for build targets. CMake 2.8.12 and lower allowed reading the :prop_tgt:`LOCATION` target @@ -23,7 +26,5 @@ properties from build-targets. The ``NEW`` behavior for this policy is to not to allow reading the :prop_tgt:`LOCATION` properties from build-targets. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.0 -.. |WARNS_OR_DOES_NOT_WARN| replace:: warns -.. include:: STANDARD_ADVICE.txt - -.. include:: DEPRECATED.txt +.. |WARNED_OR_DID_NOT_WARN| replace:: warned +.. include:: REMOVED_EPILOGUE.txt diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 1a2d47ef61..1e36fa0a0d 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -67,15 +67,7 @@ cmValue cmTargetPropertyComputer::GetSources( template <> const std::string& -cmTargetPropertyComputer::ComputeLocationForBuild( - cmGeneratorTarget const* tgt) -{ - return tgt->GetLocation(""); -} - -template <> -const std::string& -cmTargetPropertyComputer::ComputeLocation( +cmTargetPropertyComputer::ImportedLocation( cmGeneratorTarget const* tgt, const std::string& config) { return tgt->GetLocation(config); @@ -4202,9 +4194,7 @@ void cmGeneratorTarget::ReportPropertyOrigin( bool debugOrigin = !this->DebugCompatiblePropertiesDone[p] && cm::contains(debugProperties, p); - if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { - this->DebugCompatiblePropertiesDone[p] = true; - } + this->DebugCompatiblePropertiesDone[p] = true; if (!debugOrigin) { return; } @@ -4709,14 +4699,15 @@ bool cmGeneratorTarget::GetConfigCommonSourceFilesForXcode( return true; } -void cmGeneratorTarget::GetObjectLibrariesCMP0026( +void cmGeneratorTarget::GetObjectLibrariesInSources( std::vector& objlibs) const { - // At configure-time, this method can be called as part of getting the - // LOCATION property or to export() a file to be include()d. However - // there is no cmGeneratorTarget at configure-time, so search the SOURCES - // for TARGET_OBJECTS instead for backwards compatibility with OLD - // behavior of CMP0026 only. + // FIXME: This searches SOURCES for TARGET_OBJECTS for backwards + // compatibility with the OLD behavior of CMP0026 since this + // could be called at configure time. CMP0026 has been removed, + // so this should now be called only at generate time. + // Therefore we should be able to improve the implementation + // with generate-time information. cmBTStringRange rng = this->Target->GetSourceEntries(); for (auto const& entry : rng) { cmList files{ entry.Value }; @@ -4794,16 +4785,8 @@ void cmGeneratorTarget::GetLanguages(std::set& languages, } } - std::set objectLibraries; - if (!this->GlobalGenerator->GetConfigureDoneCMP0026()) { - std::vector objectTargets; - this->GetObjectLibrariesCMP0026(objectTargets); - for (cmGeneratorTarget* gt : objectTargets) { - objectLibraries.insert(gt); - } - } else { - objectLibraries = this->GetSourceObjectLibraries(config); - } + std::set objectLibraries = + this->GetSourceObjectLibraries(config); for (cmGeneratorTarget const* objLib : objectLibraries) { objLib->GetLanguages(languages, config); } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index b65398e44c..23107a2868 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -489,7 +489,7 @@ public: bool IsDotNetSdkTarget() const; - void GetObjectLibrariesCMP0026( + void GetObjectLibrariesInSources( std::vector& objlibs) const; std::string GetFullNameImported(const std::string& config, diff --git a/Source/cmGeneratorTarget_IncludeDirectories.cxx b/Source/cmGeneratorTarget_IncludeDirectories.cxx index cc6ec0cecd..f77057fa3d 100644 --- a/Source/cmGeneratorTarget_IncludeDirectories.cxx +++ b/Source/cmGeneratorTarget_IncludeDirectories.cxx @@ -247,9 +247,7 @@ std::vector> cmGeneratorTarget::GetIncludeDirectories( bool debugIncludes = !this->DebugIncludesDone && cm::contains(debugProperties, "INCLUDE_DIRECTORIES"); - if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { - this->DebugIncludesDone = true; - } + this->DebugIncludesDone = true; EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries( this, config, lang, &dagChecker, this->IncludeDirectoriesEntries); diff --git a/Source/cmGeneratorTarget_LinkDirectories.cxx b/Source/cmGeneratorTarget_LinkDirectories.cxx index 5882aca4b6..47b4e645ab 100644 --- a/Source/cmGeneratorTarget_LinkDirectories.cxx +++ b/Source/cmGeneratorTarget_LinkDirectories.cxx @@ -15,7 +15,6 @@ #include "cmEvaluatedTargetProperty.h" #include "cmGeneratorExpressionDAGChecker.h" -#include "cmGlobalGenerator.h" #include "cmLinkItem.h" #include "cmList.h" #include "cmListFileCache.h" @@ -131,9 +130,7 @@ std::vector> cmGeneratorTarget::GetLinkDirectories( bool debugDirectories = !this->DebugLinkDirectoriesDone && cm::contains(debugProperties, "LINK_DIRECTORIES"); - if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { - this->DebugLinkDirectoriesDone = true; - } + this->DebugLinkDirectoriesDone = true; EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries( this, config, language, &dagChecker, this->LinkDirectoriesEntries); diff --git a/Source/cmGeneratorTarget_Options.cxx b/Source/cmGeneratorTarget_Options.cxx index d71146da70..656da77645 100644 --- a/Source/cmGeneratorTarget_Options.cxx +++ b/Source/cmGeneratorTarget_Options.cxx @@ -21,7 +21,6 @@ #include "cmEvaluatedTargetProperty.h" #include "cmGeneratorExpressionDAGChecker.h" -#include "cmGlobalGenerator.h" #include "cmList.h" #include "cmListFileCache.h" #include "cmLocalGenerator.h" @@ -241,9 +240,7 @@ std::vector> cmGeneratorTarget::GetCompileOptions( bool debugOptions = !this->DebugCompileOptionsDone && cm::contains(debugProperties, "COMPILE_OPTIONS"); - if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { - this->DebugCompileOptionsDone = true; - } + this->DebugCompileOptionsDone = true; EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries( this, config, language, &dagChecker, this->CompileOptionsEntries); @@ -282,9 +279,7 @@ std::vector> cmGeneratorTarget::GetCompileFeatures( bool debugFeatures = !this->DebugCompileFeaturesDone && cm::contains(debugProperties, "COMPILE_FEATURES"); - if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { - this->DebugCompileFeaturesDone = true; - } + this->DebugCompileFeaturesDone = true; EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries( this, config, std::string(), &dagChecker, this->CompileFeaturesEntries); @@ -333,9 +328,7 @@ std::vector> cmGeneratorTarget::GetCompileDefinitions( bool debugDefines = !this->DebugCompileDefinitionsDone && cm::contains(debugProperties, "COMPILE_DEFINITIONS"); - if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { - this->DebugCompileDefinitionsDone = true; - } + this->DebugCompileDefinitionsDone = true; EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries( this, config, language, &dagChecker, this->CompileDefinitionsEntries); @@ -397,9 +390,7 @@ std::vector> cmGeneratorTarget::GetPrecompileHeaders( std::find(debugProperties.begin(), debugProperties.end(), "PRECOMPILE_HEADERS") != debugProperties.end(); - if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { - this->DebugPrecompileHeadersDone = true; - } + this->DebugPrecompileHeadersDone = true; EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries( this, config, language, &dagChecker, this->PrecompileHeadersEntries); @@ -454,9 +445,7 @@ std::vector> cmGeneratorTarget::GetLinkOptions( bool debugOptions = !this->DebugLinkOptionsDone && cm::contains(debugProperties, "LINK_OPTIONS"); - if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { - this->DebugLinkOptionsDone = true; - } + this->DebugLinkOptionsDone = true; EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries( this, config, language, &dagChecker, this->LinkOptionsEntries); diff --git a/Source/cmGeneratorTarget_Sources.cxx b/Source/cmGeneratorTarget_Sources.cxx index cc553ac40f..866627a06d 100644 --- a/Source/cmGeneratorTarget_Sources.cxx +++ b/Source/cmGeneratorTarget_Sources.cxx @@ -37,7 +37,6 @@ #include "cmSourceFileLocation.h" #include "cmSourceGroup.h" #include "cmStateTypes.h" -#include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cmValue.h" @@ -234,35 +233,12 @@ std::vector> cmGeneratorTarget::GetSourceFilePaths( { std::vector> files; - if (!this->LocalGenerator->GetGlobalGenerator()->GetConfigureDoneCMP0026()) { - // At configure-time, this method can be called as part of getting the - // LOCATION property or to export() a file to be include()d. However - // there is no cmGeneratorTarget at configure-time, so search the SOURCES - // for TARGET_OBJECTS instead for backwards compatibility with OLD - // behavior of CMP0026 only. - - cmBTStringRange sourceEntries = this->Target->GetSourceEntries(); - for (auto const& entry : sourceEntries) { - cmList items{ entry.Value }; - for (auto const& item : items) { - if (cmHasLiteralPrefix(item, "$') { - continue; - } - files.emplace_back(item); - } - } - return files; - } - cmList debugProperties{ this->Makefile->GetDefinition( "CMAKE_DEBUG_TARGET_PROPERTIES") }; bool debugSources = !this->DebugSourcesDone && cm::contains(debugProperties, "SOURCES"); - if (this->LocalGenerator->GetGlobalGenerator()->GetConfigureDoneCMP0026()) { - this->DebugSourcesDone = true; - } + this->DebugSourcesDone = true; cmGeneratorExpressionDAGChecker dagChecker(this, "SOURCES", nullptr, nullptr, this->LocalGenerator, config); @@ -326,24 +302,6 @@ std::vector> cmGeneratorTarget::GetSourceFiles( std::string const& config) const { std::vector> files; - if (!this->GlobalGenerator->GetConfigureDoneCMP0026()) { - // Since we are still configuring not all sources may exist yet, - // so we need to avoid full source classification because that - // requires the absolute paths to all sources to be determined. - // Since this is only for compatibility with old policies that - // projects should not depend on anymore, just compute the files - // without memoizing them. - std::vector> srcs = this->GetSourceFilePaths(config); - std::set emitted; - for (BT const& s : srcs) { - cmSourceFile* sf = this->Makefile->GetOrCreateSource(s.Value); - if (emitted.insert(sf).second) { - files.emplace_back(sf, s.Backtrace); - } - } - return files; - } - KindedSources const& kinded = this->GetKindedSources(config); files.reserve(kinded.Sources.size()); for (SourceAndKind const& si : kinded.Sources) { diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index e1f9540727..1046d939b2 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -129,7 +129,6 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm) this->CurrentConfigureMakefile = nullptr; this->TryCompileOuterMakefile = nullptr; - this->ConfigureDoneCMP0026 = false; this->FirstTimeProgress = 0.0f; cm->GetState()->SetIsGeneratorMultiConfig(false); @@ -1340,12 +1339,9 @@ void cmGlobalGenerator::Configure() } // now do it - this->ConfigureDoneCMP0026 = false; dirMf->Configure(); dirMf->EnforceDirectoryLevelRules(); - this->ConfigureDoneCMP0026 = true; - // Put a copy of each global target in every directory. { std::vector globalTargets; @@ -1371,7 +1367,7 @@ void cmGlobalGenerator::CreateGenerationObjects(TargetTypes targetTypes) { this->CreateLocalGenerators(); // Commit side effects only if we are actually generating - if (this->GetConfigureDoneCMP0026()) { + if (targetTypes == TargetTypes::AllTargets) { this->CheckTargetProperties(); } this->CreateGeneratorTargets(targetTypes); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 17b6fcee6c..8108678bc1 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -639,8 +639,6 @@ public: cmFileLockPool& GetFileLockPool() { return this->FileLockPool; } #endif - bool GetConfigureDoneCMP0026() const { return this->ConfigureDoneCMP0026; } - std::string MakeSilentFlag; size_t RecursionDepth = 0; @@ -941,6 +939,5 @@ protected: bool ForceUnixPaths; bool ToolSupportsColor; bool InstallTargetEnabled; - bool ConfigureDoneCMP0026; bool AllowGlobalTargetCodegen; }; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 9305627ec4..ef5534f25d 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -4910,7 +4910,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( } std::vector objlibs; - gt->GetObjectLibrariesCMP0026(objlibs); + gt->GetObjectLibrariesInSources(objlibs); for (auto* objLib : objlibs) { makefileStream << this->PostBuildMakeTarget(objLib->GetName(), configName) diff --git a/Source/cmLinkItemGraphVisitor.cxx b/Source/cmLinkItemGraphVisitor.cxx index ca574d4a5a..85d53d82dd 100644 --- a/Source/cmLinkItemGraphVisitor.cxx +++ b/Source/cmLinkItemGraphVisitor.cxx @@ -121,7 +121,7 @@ void cmLinkItemGraphVisitor::GetDependencies(cmGeneratorTarget const& target, } std::vector objectLibraries; - target.GetObjectLibrariesCMP0026(objectLibraries); + target.GetObjectLibrariesInSources(objectLibraries); for (auto const& lib : objectLibraries) { auto const& name = lib->GetName(); if (dependencies.find(name) == dependencies.cend()) { diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 2300cf6450..c1be7d3852 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -88,7 +88,7 @@ class cmMakefile; SELECT(POLICY, CMP0025, "Compiler id for Apple Clang is now AppleClang.", \ 3, 0, 0, NEW) \ SELECT(POLICY, CMP0026, "Disallow use of the LOCATION target property.", 3, \ - 0, 0, WARN) \ + 0, 0, NEW) \ SELECT(POLICY, CMP0027, \ "Conditionally linked imported targets with missing include " \ "directories.", \ diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 372ea71108..c1f2146a40 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -23,7 +23,6 @@ #include "cmFileSet.h" #include "cmFindPackageStack.h" #include "cmGeneratorExpression.h" -#include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" #include "cmList.h" #include "cmListFileCache.h" @@ -46,41 +45,12 @@ #include "cmake.h" template <> -const std::string& cmTargetPropertyComputer::ComputeLocationForBuild( - cmTarget const* tgt) -{ - static std::string loc; - if (tgt->IsImported()) { - loc = tgt->ImportedGetFullPath("", cmStateEnums::RuntimeBinaryArtifact); - return loc; - } - - cmGlobalGenerator* gg = tgt->GetGlobalGenerator(); - if (!gg->GetConfigureDoneCMP0026()) { - gg->CreateGenerationObjects(); - } - cmGeneratorTarget* gt = gg->FindGeneratorTarget(tgt->GetName()); - loc = gt->GetLocationForBuild(); - return loc; -} - -template <> -const std::string& cmTargetPropertyComputer::ComputeLocation( +const std::string& cmTargetPropertyComputer::ImportedLocation( cmTarget const* tgt, const std::string& config) { static std::string loc; - if (tgt->IsImported()) { - loc = - tgt->ImportedGetFullPath(config, cmStateEnums::RuntimeBinaryArtifact); - return loc; - } - - cmGlobalGenerator* gg = tgt->GetGlobalGenerator(); - if (!gg->GetConfigureDoneCMP0026()) { - gg->CreateGenerationObjects(); - } - cmGeneratorTarget* gt = gg->FindGeneratorTarget(tgt->GetName()); - loc = gt->GetFullPath(config, cmStateEnums::RuntimeBinaryArtifact); + assert(tgt->IsImported()); + loc = tgt->ImportedGetFullPath(config, cmStateEnums::RuntimeBinaryArtifact); return loc; } diff --git a/Source/cmTargetPropertyComputer.cxx b/Source/cmTargetPropertyComputer.cxx index bf9dddd9e2..73b88b5c6a 100644 --- a/Source/cmTargetPropertyComputer.cxx +++ b/Source/cmTargetPropertyComputer.cxx @@ -3,39 +3,17 @@ #include "cmTargetPropertyComputer.h" -#include - #include "cmMakefile.h" #include "cmMessageType.h" -#include "cmPolicies.h" -bool cmTargetPropertyComputer::HandleLocationPropertyPolicy( +void cmTargetPropertyComputer::IssueLocationPropertyError( std::string const& tgtName, cmMakefile const& mf) { - std::ostringstream e; - const char* modal = nullptr; - MessageType messageType = MessageType::AUTHOR_WARNING; - switch (mf.GetPolicyStatus(cmPolicies::CMP0026)) { - case cmPolicies::WARN: - e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0026) << "\n"; - modal = "should"; - CM_FALLTHROUGH; - case cmPolicies::OLD: - break; - case cmPolicies::NEW: - modal = "may"; - messageType = MessageType::FATAL_ERROR; - break; - } - - if (modal) { - e << "The LOCATION property " << modal << " not be read from target \"" - << tgtName - << "\". Use the target name directly with " - "add_custom_command, or use the generator expression $, " - "as appropriate.\n"; - mf.IssueMessage(messageType, e.str()); - } - - return messageType != MessageType::FATAL_ERROR; + mf.IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat( + "The LOCATION property may not be read from target \"", tgtName, + "\". Use the target name directly with " + "add_custom_command, or use the generator expression $, " + "as appropriate.\n")); } diff --git a/Source/cmTargetPropertyComputer.h b/Source/cmTargetPropertyComputer.h index a14a3f0c28..ea50f290fc 100644 --- a/Source/cmTargetPropertyComputer.h +++ b/Source/cmTargetPropertyComputer.h @@ -33,14 +33,12 @@ public: } private: - static bool HandleLocationPropertyPolicy(std::string const& tgtName, - cmMakefile const& mf); + static void IssueLocationPropertyError(std::string const& tgtName, + cmMakefile const& mf); template - static const std::string& ComputeLocationForBuild(Target const* tgt); - template - static const std::string& ComputeLocation(Target const* tgt, - std::string const& config); + static const std::string& ImportedLocation(Target const* tgt, + std::string const& config); template static cmValue GetLocation(Target const* tgt, std::string const& prop, @@ -56,21 +54,21 @@ private: tgt->GetType() == cmStateEnums::UNKNOWN_LIBRARY) { static const std::string propLOCATION = "LOCATION"; if (prop == propLOCATION) { - if (!tgt->IsImported() && - !HandleLocationPropertyPolicy(tgt->GetName(), mf)) { + if (!tgt->IsImported()) { + IssueLocationPropertyError(tgt->GetName(), mf); return nullptr; } - return cmValue(ComputeLocationForBuild(tgt)); + return cmValue(ImportedLocation(tgt, std::string())); } // Support "LOCATION_". if (cmHasLiteralPrefix(prop, "LOCATION_")) { - if (!tgt->IsImported() && - !HandleLocationPropertyPolicy(tgt->GetName(), mf)) { + if (!tgt->IsImported()) { + IssueLocationPropertyError(tgt->GetName(), mf); return nullptr; } std::string configName = prop.substr(9); - return cmValue(ComputeLocation(tgt, configName)); + return cmValue(ImportedLocation(tgt, configName)); } // Support "_LOCATION". @@ -78,11 +76,11 @@ private: !cmHasLiteralPrefix(prop, "XCODE_ATTRIBUTE_")) { std::string configName(prop.c_str(), prop.size() - 9); if (configName != "IMPORTED") { - if (!tgt->IsImported() && - !HandleLocationPropertyPolicy(tgt->GetName(), mf)) { + if (!tgt->IsImported()) { + IssueLocationPropertyError(tgt->GetName(), mf); return nullptr; } - return cmValue(ComputeLocation(tgt, configName)); + return cmValue(ImportedLocation(tgt, configName)); } } } diff --git a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-result.txt b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-result.txt deleted file mode 100644 index 573541ac97..0000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt deleted file mode 100644 index 84dec32127..0000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD-stderr.txt +++ /dev/null @@ -1,10 +0,0 @@ -^CMake Deprecation Warning at CMP0026-CONFIG-LOCATION-OLD.cmake:[0-9]+ \(cmake_policy\): - The OLD behavior for policy CMP0026 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/CMP0026/CMP0026-CONFIG-LOCATION-OLD.cmake b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD.cmake deleted file mode 100644 index 4166828797..0000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-OLD.cmake +++ /dev/null @@ -1,7 +0,0 @@ - -enable_language(CXX) - -cmake_policy(SET CMP0026 OLD) - -add_library(somelib empty.cpp) -get_target_property(_loc somelib Debug_LOCATION) diff --git a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN-result.txt b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN-result.txt deleted file mode 100644 index 573541ac97..0000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN-stderr.txt deleted file mode 100644 index d2209fdc84..0000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN-stderr.txt +++ /dev/null @@ -1,12 +0,0 @@ -CMake Warning \(dev\) at CMP0026-CONFIG-LOCATION-WARN.cmake:5 \(get_target_property\): - Policy CMP0026 is not set: Disallow use of the LOCATION target property. - Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - - The LOCATION property should not be read from target "somelib". Use the - target name directly with add_custom_command, or use the generator - expression \$, as appropriate. - -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN.cmake b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN.cmake deleted file mode 100644 index 511056fefe..0000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-WARN.cmake +++ /dev/null @@ -1,5 +0,0 @@ - -enable_language(CXX) - -add_library(somelib empty.cpp) -get_target_property(_loc somelib Debug_LOCATION) diff --git a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-result.txt b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-result.txt deleted file mode 100644 index 573541ac97..0000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt deleted file mode 100644 index 1fb4ef6793..0000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD-stderr.txt +++ /dev/null @@ -1,10 +0,0 @@ -^CMake Deprecation Warning at CMP0026-LOCATION-CONFIG-OLD.cmake:[0-9]+ \(cmake_policy\): - The OLD behavior for policy CMP0026 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/CMP0026/CMP0026-LOCATION-CONFIG-OLD.cmake b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD.cmake deleted file mode 100644 index 482373df2d..0000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-OLD.cmake +++ /dev/null @@ -1,7 +0,0 @@ - -enable_language(CXX) - -cmake_policy(SET CMP0026 OLD) - -add_library(somelib empty.cpp) -get_target_property(_loc somelib LOCATION_Debug) diff --git a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN-result.txt b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN-result.txt deleted file mode 100644 index 573541ac97..0000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN-stderr.txt deleted file mode 100644 index 8b4faf011a..0000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN-stderr.txt +++ /dev/null @@ -1,12 +0,0 @@ -CMake Warning \(dev\) at CMP0026-LOCATION-CONFIG-WARN.cmake:5 \(get_target_property\): - Policy CMP0026 is not set: Disallow use of the LOCATION target property. - Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - - The LOCATION property should not be read from target "somelib". Use the - target name directly with add_custom_command, or use the generator - expression \$, as appropriate. - -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN.cmake b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN.cmake deleted file mode 100644 index 85711c34b1..0000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-WARN.cmake +++ /dev/null @@ -1,5 +0,0 @@ - -enable_language(CXX) - -add_library(somelib empty.cpp) -get_target_property(_loc somelib LOCATION_Debug) diff --git a/Tests/RunCMake/CMP0026/CMP0026-OLD-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-OLD-stderr.txt deleted file mode 100644 index b4282f5459..0000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-OLD-stderr.txt +++ /dev/null @@ -1,10 +0,0 @@ -^CMake Deprecation Warning at CMP0026-OLD.cmake:[0-9]+ \(cmake_policy\): - The OLD behavior for policy CMP0026 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/CMP0026/CMP0026-OLD.cmake b/Tests/RunCMake/CMP0026/CMP0026-OLD.cmake deleted file mode 100644 index 80497a304b..0000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-OLD.cmake +++ /dev/null @@ -1,12 +0,0 @@ -enable_language(CXX) - -cmake_policy(SET CMP0026 OLD) - -set(out ${CMAKE_CURRENT_BINARY_DIR}/out.txt) - -add_library(somelib empty.cpp ${out}) -get_target_property(_loc somelib LOCATION) - -file(WRITE "${out}" - "source file written by project code after getting target LOCATION\n" - ) diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt deleted file mode 100644 index 17a7db043a..0000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_library(otherlib ../empty.cpp) diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-result.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-result.txt deleted file mode 100644 index 573541ac97..0000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-WARN-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt deleted file mode 100644 index 0d39596b41..0000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt +++ /dev/null @@ -1,25 +0,0 @@ -CMake Warning \(dev\) at CMP0026-WARN.cmake:5 \(get_target_property\): - Policy CMP0026 is not set: Disallow use of the LOCATION target property. - Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - - The LOCATION property should not be read from target "somelib". Use the - target name directly with add_custom_command, or use the generator - expression \$, as appropriate. - -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. -+ -CMake Warning \(dev\) at CMP0026-WARN.cmake:8 \(get_target_property\): - Policy CMP0026 is not set: Disallow use of the LOCATION target property. - Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - - The LOCATION property should not be read from target "otherlib". Use the - target name directly with add_custom_command, or use the generator - expression \$, as appropriate. - -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake b/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake deleted file mode 100644 index bfc9203af9..0000000000 --- a/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake +++ /dev/null @@ -1,8 +0,0 @@ - -enable_language(CXX) - -add_library(somelib empty.cpp) -get_target_property(_loc somelib LOCATION) - -add_subdirectory(CMP0026-WARN-Dir) -get_target_property(_loc otherlib LOCATION) diff --git a/Tests/RunCMake/CMP0026/CMakeLists.txt b/Tests/RunCMake/CMP0026/CMakeLists.txt index 4b3de84d94..bf2ef1506e 100644 --- a/Tests/RunCMake/CMP0026/CMakeLists.txt +++ b/Tests/RunCMake/CMP0026/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.10) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS-result.txt b/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS-result.txt deleted file mode 100644 index 573541ac97..0000000000 --- a/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS-stderr.txt b/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS-stderr.txt deleted file mode 100644 index 63779219ae..0000000000 --- a/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS-stderr.txt +++ /dev/null @@ -1,12 +0,0 @@ -CMake Warning \(dev\) at LOCATION-and-TARGET_OBJECTS.cmake:[0-9]+ \(get_target_property\): - Policy CMP0026 is not set: Disallow use of the LOCATION target property. - Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - - The LOCATION property should not be read from target "bar". Use the target - name directly with add_custom_command, or use the generator expression - \$, as appropriate. - -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS.cmake b/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS.cmake deleted file mode 100644 index ee5ed5bd4c..0000000000 --- a/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS.cmake +++ /dev/null @@ -1,6 +0,0 @@ -cmake_policy(SET CMP0118 NEW) -enable_language(CXX) - -add_library(foo OBJECT empty.cpp) -add_executable(bar $) -get_target_property(location bar LOCATION) diff --git a/Tests/RunCMake/CMP0026/ObjlibNotDefined-result.txt b/Tests/RunCMake/CMP0026/ObjlibNotDefined-result.txt deleted file mode 100644 index 573541ac97..0000000000 --- a/Tests/RunCMake/CMP0026/ObjlibNotDefined-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0026/ObjlibNotDefined-stderr.txt b/Tests/RunCMake/CMP0026/ObjlibNotDefined-stderr.txt deleted file mode 100644 index 360d987658..0000000000 --- a/Tests/RunCMake/CMP0026/ObjlibNotDefined-stderr.txt +++ /dev/null @@ -1,12 +0,0 @@ -CMake Warning \(dev\) at ObjlibNotDefined.cmake:[0-9]+ \(get_target_property\): - Policy CMP0026 is not set: Disallow use of the LOCATION target property. - Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - - The LOCATION property should not be read from target "objlibuser". Use the - target name directly with add_custom_command, or use the generator - expression \$, as appropriate. - -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0026/ObjlibNotDefined.cmake b/Tests/RunCMake/CMP0026/ObjlibNotDefined.cmake deleted file mode 100644 index 194760cd46..0000000000 --- a/Tests/RunCMake/CMP0026/ObjlibNotDefined.cmake +++ /dev/null @@ -1,13 +0,0 @@ - -enable_language(CXX) - -add_executable(objlibuser - empty.cpp - $ -) - -get_target_property(_location objlibuser LOCATION) - -add_library(bar OBJECT - empty.cpp -) diff --git a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake index 6476176d51..7684eb681b 100644 --- a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake @@ -1,16 +1,6 @@ include(RunCMake) -set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON) -run_cmake(CMP0026-WARN) -run_cmake(CMP0026-OLD) run_cmake(CMP0026-NEW) run_cmake(CMP0026-IMPORTED) run_cmake(CMP0026-CONFIG-LOCATION-NEW) -run_cmake(CMP0026-CONFIG-LOCATION-OLD) -run_cmake(CMP0026-CONFIG-LOCATION-WARN) run_cmake(CMP0026-LOCATION-CONFIG-NEW) -run_cmake(CMP0026-LOCATION-CONFIG-OLD) -run_cmake(CMP0026-LOCATION-CONFIG-WARN) -run_cmake(ObjlibNotDefined) -run_cmake(LOCATION-and-TARGET_OBJECTS) -run_cmake(clear-cached-information) diff --git a/Tests/RunCMake/CMP0026/clear-cached-information-dir/CMakeLists.txt b/Tests/RunCMake/CMP0026/clear-cached-information-dir/CMakeLists.txt deleted file mode 100644 index c51e8837fa..0000000000 --- a/Tests/RunCMake/CMP0026/clear-cached-information-dir/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ - -add_executable(Hello ${CMAKE_CURRENT_BINARY_DIR}/main.c) diff --git a/Tests/RunCMake/CMP0026/clear-cached-information-stderr.txt b/Tests/RunCMake/CMP0026/clear-cached-information-stderr.txt deleted file mode 100644 index 3525704bba..0000000000 --- a/Tests/RunCMake/CMP0026/clear-cached-information-stderr.txt +++ /dev/null @@ -1,10 +0,0 @@ -^CMake Deprecation Warning at clear-cached-information.cmake:[0-9]+ \(cmake_policy\): - The OLD behavior for policy CMP0026 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/CMP0026/clear-cached-information.cmake b/Tests/RunCMake/CMP0026/clear-cached-information.cmake deleted file mode 100644 index 99169482ca..0000000000 --- a/Tests/RunCMake/CMP0026/clear-cached-information.cmake +++ /dev/null @@ -1,14 +0,0 @@ -cmake_policy(SET CMP0118 NEW) -enable_language(C) - -cmake_policy(SET CMP0026 OLD) - -add_subdirectory(clear-cached-information-dir) - -# Critical: this needs to happen in root CMakeLists.txt and not inside -# the subdir. -get_target_property(mypath Hello LOCATION) -# Now we create the file later, so you can see, ultimately no error should -# happen e.g. during generate phase: -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/clear-cached-information-dir/main.c) -set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/clear-cached-information-dir/main.c PROPERTIES GENERATED TRUE) diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/CMakeLists.txt index 5791993893..f453253939 100644 --- a/Tests/RunCMake/GenEx-TARGET_PROPERTY/CMakeLists.txt +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/CMakeLists.txt @@ -1,6 +1,3 @@ cmake_minimum_required(VERSION 3.17) -if(RunCMake_TEST STREQUAL "LOCATION") - cmake_minimum_required(VERSION 2.8.12) # Leave CMP0026 unset. -endif() project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/LOCATION-stderr.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LOCATION-stderr.txt deleted file mode 100644 index 468d2c5500..0000000000 --- a/Tests/RunCMake/GenEx-TARGET_PROPERTY/LOCATION-stderr.txt +++ /dev/null @@ -1,16 +0,0 @@ -^CMake Deprecation Warning at CMakeLists\.txt:3 \(cmake_minimum_required\): - Compatibility with CMake < 3\.10 will be removed from a future version of - CMake\. - - Update the VERSION argument value\. Or, use the \.\.\. syntax - to tell CMake that the project requires at least but has been updated - to work with policies introduced by or earlier\. -+ -CMake Warning \(dev\) in CMakeLists\.txt: - Policy CMP0026 is not set: Disallow use of the LOCATION target property. - Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - - The LOCATION property should not be read from target "foo". Use the target - name directly with add_custom_command, or use the generator expression - \$, as appropriate. diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/LOCATION.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/LOCATION.cmake deleted file mode 100644 index 8929cdb8f9..0000000000 --- a/Tests/RunCMake/GenEx-TARGET_PROPERTY/LOCATION.cmake +++ /dev/null @@ -1,3 +0,0 @@ -enable_language(C) -add_library(foo empty.c) -add_custom_target(drive COMMAND ${CMAKE_COMMAND} -E echo $) diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/RunCMakeTest.cmake index c278831162..d877c52105 100644 --- a/Tests/RunCMake/GenEx-TARGET_PROPERTY/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/RunCMakeTest.cmake @@ -11,7 +11,6 @@ run_cmake(LinkImplementationCycle3) run_cmake(LinkImplementationCycle4) run_cmake(LinkImplementationCycle5) run_cmake(LinkImplementationCycle6) -run_cmake(LOCATION) run_cmake(SOURCES) run_cmake(TransitiveBuild) run_cmake(TransitiveLink-CMP0166-OLD) diff --git a/Tests/RunCMake/target_sources/CMP0026-LOCATION-result.txt b/Tests/RunCMake/target_sources/CMP0026-LOCATION-result.txt deleted file mode 100644 index 573541ac97..0000000000 --- a/Tests/RunCMake/target_sources/CMP0026-LOCATION-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/target_sources/CMP0026-LOCATION-stderr.txt b/Tests/RunCMake/target_sources/CMP0026-LOCATION-stderr.txt deleted file mode 100644 index d7ccedb1b4..0000000000 --- a/Tests/RunCMake/target_sources/CMP0026-LOCATION-stderr.txt +++ /dev/null @@ -1,10 +0,0 @@ -^CMake Deprecation Warning at CMP0026-LOCATION.cmake:[0-9]+ \(cmake_policy\): - The OLD behavior for policy CMP0026 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/target_sources/CMP0026-LOCATION.cmake b/Tests/RunCMake/target_sources/CMP0026-LOCATION.cmake deleted file mode 100644 index 642856cde7..0000000000 --- a/Tests/RunCMake/target_sources/CMP0026-LOCATION.cmake +++ /dev/null @@ -1,14 +0,0 @@ - -cmake_policy(SET CMP0026 OLD) -enable_language(CXX) - -add_library(objlib OBJECT - empty_1.cpp -) - -add_executable(my_exe - empty_2.cpp - $ -) - -get_target_property( loc my_exe LOCATION) diff --git a/Tests/RunCMake/target_sources/RunCMakeTest.cmake b/Tests/RunCMake/target_sources/RunCMakeTest.cmake index 4d3d4fe12c..1fe9427ef3 100644 --- a/Tests/RunCMake/target_sources/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_sources/RunCMakeTest.cmake @@ -6,7 +6,6 @@ endif() run_cmake(EmptyKeywordArgs) run_cmake(OriginDebug) -run_cmake(CMP0026-LOCATION) run_cmake(CMP0076-OLD) run_cmake(CMP0076-WARN) run_cmake(MissingSource)