From 4d5bbb7704a44e56f43585b3f811f37c5200bdd0 Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Tue, 3 Sep 2019 10:25:44 -0700 Subject: cmLocalGenerator: Add GetStaticLibraryFlags overload with backtraces --- Source/cmLocalGenerator.cxx | 27 +++++++++++++++++++++++---- Source/cmLocalGenerator.h | 3 +++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 44ba79a..36e1115 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1148,8 +1148,18 @@ void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags, std::string const& linkLanguage, cmGeneratorTarget* target) { - std::string staticLibFlags; + std::vector> tmpFlags = + this->GetStaticLibraryFlags(config, linkLanguage, target); + this->AppendFlags(flags, tmpFlags); +} + +std::vector> cmLocalGenerator::GetStaticLibraryFlags( + std::string const& config, std::string const& linkLanguage, + cmGeneratorTarget* target) +{ + std::vector> flags; if (linkLanguage != "Swift") { + std::string staticLibFlags; this->AppendFlags( staticLibFlags, this->Makefile->GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS")); @@ -1158,7 +1168,12 @@ void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags, this->AppendFlags(staticLibFlags, this->Makefile->GetSafeDefinition(name)); } + if (!staticLibFlags.empty()) { + flags.emplace_back(std::move(staticLibFlags)); + } } + + std::string staticLibFlags; this->AppendFlags(staticLibFlags, target->GetSafeProperty("STATIC_LIBRARY_FLAGS")); if (!config.empty()) { @@ -1166,12 +1181,16 @@ void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags, this->AppendFlags(staticLibFlags, target->GetSafeProperty(name)); } - flags = std::move(staticLibFlags); + if (!staticLibFlags.empty()) { + flags.emplace_back(std::move(staticLibFlags)); + } - std::vector staticLibOpts; - target->GetStaticLibraryLinkOptions(staticLibOpts, config, linkLanguage); + std::vector> staticLibOpts = + target->GetStaticLibraryLinkOptions(config, linkLanguage); // STATIC_LIBRARY_OPTIONS are escaped. this->AppendCompileOptions(flags, staticLibOpts); + + return flags; } void cmLocalGenerator::GetTargetFlags( diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 52f8ac8..0a41f2a 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -371,6 +371,9 @@ public: void GetStaticLibraryFlags(std::string& flags, std::string const& config, std::string const& linkLanguage, cmGeneratorTarget* target); + std::vector> GetStaticLibraryFlags( + std::string const& config, std::string const& linkLanguage, + cmGeneratorTarget* target); /** Fill out these strings for the given target. Libraries to link, * flags, and linkflags. */ -- cgit v0.12