diff options
author | Brad King <brad.king@kitware.com> | 2015-04-09 15:32:31 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-04-09 15:32:31 (GMT) |
commit | 1a1bdbfd87ec2dcf3205f062ab8145d5e0189146 (patch) | |
tree | ef720318d0e661ca0c257371f6e40b0859413b3e /Source | |
parent | 3049951b6293486053da2d304737fad42de3b3d8 (diff) | |
parent | 882f48e5ba335a1dbc1750c23e6dea5fa92a3adc (diff) | |
download | CMake-1a1bdbfd87ec2dcf3205f062ab8145d5e0189146.zip CMake-1a1bdbfd87ec2dcf3205f062ab8145d5e0189146.tar.gz CMake-1a1bdbfd87ec2dcf3205f062ab8145d5e0189146.tar.bz2 |
Merge topic 'link-implicit-libs-full-path'
882f48e5 Link libraries by full path even in implicit directories
318cd370 Help: Add link target for Find Modules section of cmake-developer.7
1535dcd8 Tests: Teach RunCMake to optionally merge command output to stdout
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmComputeLinkInformation.cxx | 42 | ||||
-rw-r--r-- | Source/cmComputeLinkInformation.h | 4 | ||||
-rw-r--r-- | Source/cmPolicies.cxx | 5 | ||||
-rw-r--r-- | Source/cmPolicies.h | 1 | ||||
-rw-r--r-- | Source/cmTarget.h | 3 |
5 files changed, 54 insertions, 1 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index b0e0f36..8880667 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -411,6 +411,10 @@ cmComputeLinkInformation std::vector<std::string> const& dirs = this->Target->GetLinkDirectories(); this->OldLinkDirMask.insert(dirs.begin(), dirs.end()); } + + this->CMP0060Warn = + this->Makefile->PolicyOptionalWarningEnabled( + "CMAKE_POLICY_WARNING_CMP0060"); } //---------------------------------------------------------------------------- @@ -548,6 +552,22 @@ bool cmComputeLinkInformation::Compute() // Add implicit language runtime libraries and directories. this->AddImplicitLinkInfo(); + if (!this->CMP0060WarnItems.empty()) + { + std::ostringstream w; + w << (this->Makefile->GetCMakeInstance()->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0060)) << "\n" + "Some library files are in directories implicitly searched by " + "the linker when invoked for " << this->LinkLanguage << ":\n" + " " << cmJoin(this->CMP0060WarnItems, "\n ") << "\n" + "For compatibility with older versions of CMake, the generated " + "link line will ask the linker to search for these by library " + "name." + ; + this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(), + this->Target->GetBacktrace()); + } + return true; } @@ -1190,6 +1210,28 @@ bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item) return false; } + // Check the policy for whether we should use the approach below. + switch (this->Target->GetPolicyStatusCMP0060()) + { + case cmPolicies::WARN: + if (this->CMP0060Warn) + { + // Print the warning at most once for this item. + std::string const& wid = "CMP0060-WARNING-GIVEN-" + item; + if (!this->CMakeInstance->GetPropertyAsBool(wid)) + { + this->CMakeInstance->SetProperty(wid, "1"); + this->CMP0060WarnItems.insert(item); + } + } + case cmPolicies::OLD: + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: + return false; + } + // Many system linkers support multiple architectures by // automatically selecting the implicit linker search path for the // current architecture. If the library appears in an implicit link diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index e5d674a..8847141 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -175,6 +175,10 @@ private: std::vector<std::string> OldUserFlagItems; bool OldLinkDirMode; + // CMP0060 warnings. + bool CMP0060Warn; + std::set<std::string> CMP0060WarnItems; + // Runtime path computation. cmOrderDirectories* OrderRuntimeSearchPath; void AddLibraryRuntimeInfo(std::string const& fullPath, diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 0a61bca..e7678cb 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -390,6 +390,11 @@ cmPolicies::cmPolicies() CMP0059, "CMP0059", "Do no treat DEFINITIONS as a built-in directory property.", 3,3,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0060, "CMP0060", + "Link libraries by full path even in implicit directories.", + 3,3,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index ced9d8c..1d108c1 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -118,6 +118,7 @@ public: CMP0058, ///< Ninja requires custom command byproducts to be explicit CMP0059, ///< Do not treat ``DEFINITIONS`` as a built-in directory /// property. + CMP0060, ///< Link libraries by full path even in implicit directories. /** \brief Always the last entry. * diff --git a/Source/cmTarget.h b/Source/cmTarget.h index a4ef977..55bf234 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -34,7 +34,8 @@ F(CMP0041) \ F(CMP0042) \ F(CMP0046) \ - F(CMP0052) + F(CMP0052) \ + F(CMP0060) class cmake; class cmMakefile; |