diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h index 88fe66a36d..0586363ad2 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h @@ -606,9 +606,9 @@ public: : "NDEBUG;%(PreprocessorDefinitions)"); } - auto externalLibraries = getExternalLibraries (config, getOwner().getExternalLibrariesString()); - auto additionalDependencies = type != SharedCodeTarget && externalLibraries.isNotEmpty() - ? msBuildEscape (getOwner().replacePreprocessorTokens (config, externalLibraries).trim()) + ";%(AdditionalDependencies)" + auto externalLibraries = getExternalLibraries (config, getOwner().getExternalLibrariesStringArray()); + auto additionalDependencies = type != SharedCodeTarget && ! externalLibraries.isEmpty() + ? externalLibraries.joinIntoString (";") + ";%(AdditionalDependencies)" : String(); auto librarySearchPaths = config.getLibrarySearchPaths(); @@ -1332,22 +1332,25 @@ public: return librarySearchPaths; } - String getExternalLibraries (const MSVCBuildConfiguration& config, const String& otherLibs) const + StringArray getExternalLibraries (const MSVCBuildConfiguration& config, const StringArray& otherLibs) const { - StringArray libraries; + const auto sharedCodeLib = [&]() -> StringArray + { + if (type != SharedCodeTarget) + if (auto* shared = getOwner().getSharedCodeTarget()) + return { shared->getBinaryNameWithSuffix (config, false) }; - if (otherLibs.isNotEmpty()) - libraries.add (otherLibs); + return {}; + }(); - auto moduleLibs = getOwner().getModuleLibs(); - if (! moduleLibs.isEmpty()) - libraries.addArray (moduleLibs); + auto result = otherLibs; + result.addArray (getOwner().getModuleLibs()); + result.addArray (sharedCodeLib); - if (type != SharedCodeTarget) - if (auto* shared = getOwner().getSharedCodeTarget()) - libraries.add (shared->getBinaryNameWithSuffix (config, false)); + for (auto& i : result) + i = msBuildEscape (getOwner().replacePreprocessorTokens (config, i).trim()); - return libraries.joinIntoString (";"); + return result; } String getDelayLoadedDLLs() const diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h index 9cc77b8174..8c6af9be4d 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h @@ -144,7 +144,8 @@ public: String getExtraCompilerFlagsString() const { return extraCompilerFlagsValue.get().toString().replaceCharacters ("\r\n", " "); } String getExtraLinkerFlagsString() const { return extraLinkerFlagsValue.get().toString().replaceCharacters ("\r\n", " "); } - String getExternalLibrariesString() const { return getSearchPathsFromString (externalLibrariesValue.get().toString()).joinIntoString (";"); } + StringArray getExternalLibrariesStringArray() const { return getSearchPathsFromString (externalLibrariesValue.get().toString()); } + String getExternalLibrariesString() const { return getExternalLibrariesStringArray().joinIntoString (";"); } bool shouldUseGNUExtensions() const { return gnuExtensionsValue.get(); }