diff options
author | Justin Goshi <jgoshi@microsoft.com> | 2019-09-03 17:25:44 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-09-10 14:45:41 (GMT) |
commit | 8e973b8e8d6542b5dd15173884bde68a9a390949 (patch) | |
tree | 34346e3b5cc5debb95aa75f65c87c800fd908052 | |
parent | 4d5bbb7704a44e56f43585b3f811f37c5200bdd0 (diff) | |
download | CMake-8e973b8e8d6542b5dd15173884bde68a9a390949.zip CMake-8e973b8e8d6542b5dd15173884bde68a9a390949.tar.gz CMake-8e973b8e8d6542b5dd15173884bde68a9a390949.tar.bz2 |
cmLocalGenerator: Add GetTargetFlags overload with backtraces
-rw-r--r-- | Source/cmLocalGenerator.cxx | 39 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 6 |
2 files changed, 36 insertions, 9 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 36e1115..b73f5d2 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1198,6 +1198,18 @@ void cmLocalGenerator::GetTargetFlags( std::string& linkLibs, std::string& flags, std::string& linkFlags, std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget* target) { + std::vector<BT<std::string>> tmpLinkFlags; + this->GetTargetFlags(linkLineComputer, config, linkLibs, flags, tmpLinkFlags, + frameworkPath, linkPath, target); + this->AppendFlags(linkFlags, tmpLinkFlags); +} + +void cmLocalGenerator::GetTargetFlags( + cmLinkLineComputer* linkLineComputer, const std::string& config, + std::string& linkLibs, std::string& flags, + std::vector<BT<std::string>>& linkFlags, std::string& frameworkPath, + std::string& linkPath, cmGeneratorTarget* target) +{ const std::string buildType = cmSystemTools::UpperCase(config); cmComputeLinkInformation* pcli = target->GetLinkInformation(config); const char* libraryLinkVariable = @@ -1208,7 +1220,7 @@ void cmLocalGenerator::GetTargetFlags( switch (target->GetType()) { case cmStateEnums::STATIC_LIBRARY: - this->GetStaticLibraryFlags(linkFlags, buildType, linkLanguage, target); + linkFlags = this->GetStaticLibraryFlags(buildType, linkLanguage, target); if (pcli && dynamic_cast<cmLinkLineDeviceComputer*>(linkLineComputer)) { // Compute the required cuda device link libraries when // resolving cuda device symbols @@ -1261,10 +1273,12 @@ void cmLocalGenerator::GetTargetFlags( } } - linkFlags = std::move(sharedLibFlags); + if (!sharedLibFlags.empty()) { + linkFlags.emplace_back(std::move(sharedLibFlags)); + } - std::vector<std::string> linkOpts; - target->GetLinkOptions(linkOpts, config, linkLanguage); + std::vector<BT<std::string>> linkOpts = + target->GetLinkOptions(config, linkLanguage); // LINK_OPTIONS are escaped. this->AppendCompileOptions(linkFlags, linkOpts); if (pcli) { @@ -1340,10 +1354,12 @@ void cmLocalGenerator::GetTargetFlags( } } - linkFlags = std::move(exeFlags); + if (!exeFlags.empty()) { + linkFlags.emplace_back(std::move(exeFlags)); + } - std::vector<std::string> linkOpts; - target->GetLinkOptions(linkOpts, config, linkLanguage); + std::vector<BT<std::string>> linkOpts = + target->GetLinkOptions(config, linkLanguage); // LINK_OPTIONS are escaped. this->AppendCompileOptions(linkFlags, linkOpts); } break; @@ -1351,9 +1367,14 @@ void cmLocalGenerator::GetTargetFlags( break; } - this->AppendPositionIndependentLinkerFlags(linkFlags, target, config, + std::string extraLinkFlags; + this->AppendPositionIndependentLinkerFlags(extraLinkFlags, target, config, linkLanguage); - this->AppendIPOLinkerFlags(linkFlags, target, config, linkLanguage); + this->AppendIPOLinkerFlags(extraLinkFlags, target, config, linkLanguage); + + if (!extraLinkFlags.empty()) { + linkFlags.emplace_back(std::move(extraLinkFlags)); + } } void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target, diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 0a41f2a..89472e0 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -382,6 +382,12 @@ public: std::string& flags, std::string& linkFlags, std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget* target); + void GetTargetFlags(cmLinkLineComputer* linkLineComputer, + const std::string& config, std::string& linkLibs, + std::string& flags, + std::vector<BT<std::string>>& linkFlags, + std::string& frameworkPath, std::string& linkPath, + cmGeneratorTarget* target); void GetTargetDefines(cmGeneratorTarget const* target, std::string const& config, std::string const& lang, std::set<std::string>& defines) const; |