Browse Source

CLion: Fixed an issue when linking shared library code with spaces in the library name

tags/2021-05-28
tpoole 7 years ago
parent
commit
73573ede91
1 changed files with 12 additions and 9 deletions
  1. +12
    -9
      extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CLion.h

+ 12
- 9
extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CLion.h View File

@@ -754,16 +754,19 @@ private:
out << ")" << newLine << newLine;
String linkerFlags;
StringArray linkerFlags;
if (targetAttributeKeys.contains ("OTHER_LDFLAGS"))
{
// CMake adds its own SHARED_CODE library linking flags
linkerFlags = targetAttributes["OTHER_LDFLAGS"]
.unquoted()
.replace ("-bundle", {})
.replace ("-l" + binaryName, {})
.trim();
auto flagsWithReplacedSpaces = targetAttributes["OTHER_LDFLAGS"].unquoted().replace ("\\\\ ", "^^%%^^");
linkerFlags.addTokens (flagsWithReplacedSpaces, true);
linkerFlags.removeString ("-bundle");
linkerFlags.removeString ("-l" + binaryName.replace (" ", "^^%%^^"));
for (auto& flag : linkerFlags)
flag = flag.replace ("^^%%^^", " ");
targetAttributeKeys.removeString ("OTHER_LDFLAGS");
}
@@ -886,10 +889,10 @@ private:
out << " SHARED_CODE" << newLine;
for (auto& path : libSearchPaths)
out << " -L" << path.quoted() << newLine;
out << " \"-L" << path << "\"" << newLine;
if (linkerFlags.isNotEmpty())
out << " " << linkerFlags << newLine;
for (auto& flag : linkerFlags)
out << " " << flag.quoted() << newLine;
for (auto& framework : target->frameworkNames)
out << " \"-framework " << framework << "\"" << newLine;


Loading…
Cancel
Save