summaryrefslogtreecommitdiff
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorMikko Sivulainen <mikko.sivulainen@supercell.com>2022-09-14 14:30:41 +0300
committerBrad King <brad.king@kitware.com>2022-09-15 10:27:23 -0400
commitd4cc39842e9b912f8b25e2c7329f55bf7b53e5f0 (patch)
tree18de254315c7cabb6ef99430505d3089fbb1d8dd /Source/cmGlobalXCodeGenerator.cxx
parentc3e68020d61ae306261b4f953947483a960edf32 (diff)
downloadcmake-d4cc39842e9b912f8b25e2c7329f55bf7b53e5f0.tar.gz
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/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index eb85b47e82..b4f12792fb 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) {