summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorMikko Sivulainen <mikko.sivulainen@supercell.com>2022-09-14 11:30:41 (GMT)
committerBrad King <brad.king@kitware.com>2022-09-15 14:27:23 (GMT)
commitd4cc39842e9b912f8b25e2c7329f55bf7b53e5f0 (patch)
tree18de254315c7cabb6ef99430505d3089fbb1d8dd /Source
parentc3e68020d61ae306261b4f953947483a960edf32 (diff)
downloadCMake-d4cc39842e9b912f8b25e2c7329f55bf7b53e5f0.zip
CMake-d4cc39842e9b912f8b25e2c7329f55bf7b53e5f0.tar.gz
CMake-d4cc39842e9b912f8b25e2c7329f55bf7b53e5f0.tar.bz2
Xcode: Do not append per-config suffixes to library search paths
Add policy `CMP0142` to remove the automatic addition of the `$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)` suffix in a compatible way. Fixes: #21757
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx10
-rw-r--r--Source/cmPolicies.h9
2 files changed, 15 insertions, 4 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index eb85b47..b4f1279 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3776,14 +3776,20 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
// add the library search paths
{
BuildObjectListOrString libSearchPaths(this, true);
+
std::string linkDirs;
for (auto const& libDir : cli->GetDirectories()) {
if (!libDir.empty() && libDir != "/usr/lib") {
- libSearchPaths.Add(this->XCodeEscapePath(
- libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"));
+ cmPolicies::PolicyStatus cmp0142 =
+ target->GetTarget()->GetPolicyStatusCMP0142();
+ if (cmp0142 == cmPolicies::OLD || cmp0142 == cmPolicies::WARN) {
+ libSearchPaths.Add(this->XCodeEscapePath(
+ libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"));
+ }
libSearchPaths.Add(this->XCodeEscapePath(libDir));
}
}
+
// Add previously collected paths where to look for libraries
// that were added to "Link Binary With Libraries"
for (auto& libDir : linkSearchPaths) {
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index ea25814..4643868 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -427,7 +427,11 @@ class cmMakefile;
SELECT( \
POLICY, CMP0141, \
"MSVC debug information format flags are selected by an abstraction.", 3, \
- 25, 0, cmPolicies::WARN)
+ 25, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0142, \
+ "The Xcode generator does not append per-config suffixes to " \
+ "library search paths.", \
+ 3, 25, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \
@@ -464,7 +468,8 @@ class cmMakefile;
F(CMP0112) \
F(CMP0113) \
F(CMP0119) \
- F(CMP0131)
+ F(CMP0131) \
+ F(CMP0142)
/** \class cmPolicies
* \brief Handles changes in CMake behavior and policies