diff options
author | Brad King <brad.king@kitware.com> | 2020-04-02 15:19:58 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-04-02 15:20:05 (GMT) |
commit | 525bd2d5e6b6fef64f7eeee0df331e19f94d9298 (patch) | |
tree | 5f24d06f9d5c1fd23306f51354a2a5259ced57ca /Source | |
parent | a8a0564973e7895c1e3fe226ffb40308b07a98da (diff) | |
parent | ff02a592bc56f024ac141586b3345aba080af401 (diff) | |
download | CMake-525bd2d5e6b6fef64f7eeee0df331e19f94d9298.zip CMake-525bd2d5e6b6fef64f7eeee0df331e19f94d9298.tar.gz CMake-525bd2d5e6b6fef64f7eeee0df331e19f94d9298.tar.bz2 |
Merge topic 'config-case'
ff02a592bc cmLocalGenerator: Avoid using upper-case config when not necessary
a4b76c237d cmLocalGenerator: Clarify local variable name in GetTargetFlags
25a920e827 cmLocalGenerator: Convert GetStaticLibraryFlags to take original-case config
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4558
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 35 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 5 | ||||
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 5 |
5 files changed, 24 insertions, 26 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 1c1aaad..e74d618 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1861,7 +1861,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY || gtgt->GetType() == cmStateEnums::STATIC_LIBRARY) { this->CurrentLocalGenerator->GetStaticLibraryFlags( - extraLinkOptions, cmSystemTools::UpperCase(configName), llang, gtgt); + extraLinkOptions, configName, llang, gtgt); } else { const char* targetLinkFlags = gtgt->GetProperty("LINK_FLAGS"); if (targetLinkFlags) { diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 0a78af6..55f61ea 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1293,14 +1293,15 @@ std::vector<BT<std::string>> cmLocalGenerator::GetStaticLibraryFlags( std::string const& config, std::string const& linkLanguage, cmGeneratorTarget* target) { + const std::string configUpper = cmSystemTools::UpperCase(config); std::vector<BT<std::string>> flags; if (linkLanguage != "Swift") { std::string staticLibFlags; this->AppendFlags( staticLibFlags, this->Makefile->GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS")); - if (!config.empty()) { - std::string name = "CMAKE_STATIC_LINKER_FLAGS_" + config; + if (!configUpper.empty()) { + std::string name = "CMAKE_STATIC_LINKER_FLAGS_" + configUpper; this->AppendFlags(staticLibFlags, this->Makefile->GetSafeDefinition(name)); } @@ -1312,8 +1313,8 @@ std::vector<BT<std::string>> cmLocalGenerator::GetStaticLibraryFlags( std::string staticLibFlags; this->AppendFlags(staticLibFlags, target->GetSafeProperty("STATIC_LIBRARY_FLAGS")); - if (!config.empty()) { - std::string name = "STATIC_LIBRARY_FLAGS_" + config; + if (!configUpper.empty()) { + std::string name = "STATIC_LIBRARY_FLAGS_" + configUpper; this->AppendFlags(staticLibFlags, target->GetSafeProperty(name)); } @@ -1350,17 +1351,17 @@ void cmLocalGenerator::GetTargetFlags( std::vector<BT<std::string>>& linkFlags, std::string& frameworkPath, std::vector<BT<std::string>>& linkPath, cmGeneratorTarget* target) { - const std::string buildType = cmSystemTools::UpperCase(config); + const std::string configUpper = cmSystemTools::UpperCase(config); cmComputeLinkInformation* pcli = target->GetLinkInformation(config); const char* libraryLinkVariable = "CMAKE_SHARED_LINKER_FLAGS"; // default to shared library const std::string linkLanguage = - linkLineComputer->GetLinkerLanguage(target, buildType); + linkLineComputer->GetLinkerLanguage(target, config); switch (target->GetType()) { case cmStateEnums::STATIC_LIBRARY: - linkFlags = this->GetStaticLibraryFlags(buildType, linkLanguage, target); + linkFlags = this->GetStaticLibraryFlags(config, linkLanguage, target); if (pcli && dynamic_cast<cmLinkLineDeviceComputer*>(linkLineComputer)) { // Compute the required cuda device link libraries when // resolving cuda device symbols @@ -1376,8 +1377,8 @@ void cmLocalGenerator::GetTargetFlags( if (linkLanguage != "Swift") { sharedLibFlags = cmStrCat( this->Makefile->GetSafeDefinition(libraryLinkVariable), ' '); - if (!buildType.empty()) { - std::string build = cmStrCat(libraryLinkVariable, '_', buildType); + if (!configUpper.empty()) { + std::string build = cmStrCat(libraryLinkVariable, '_', configUpper); sharedLibFlags += this->Makefile->GetSafeDefinition(build); sharedLibFlags += " "; } @@ -1385,7 +1386,7 @@ void cmLocalGenerator::GetTargetFlags( !(this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW"))) { std::vector<cmSourceFile*> sources; - target->GetSourceFiles(sources, buildType); + target->GetSourceFiles(sources, config); std::string defFlag = this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG"); for (cmSourceFile* sf : sources) { @@ -1404,9 +1405,9 @@ void cmLocalGenerator::GetTargetFlags( sharedLibFlags += targetLinkFlags; sharedLibFlags += " "; } - if (!buildType.empty()) { + if (!configUpper.empty()) { targetLinkFlags = - target->GetProperty(cmStrCat("LINK_FLAGS_", buildType)); + target->GetProperty(cmStrCat("LINK_FLAGS_", configUpper)); if (targetLinkFlags) { sharedLibFlags += targetLinkFlags; sharedLibFlags += " "; @@ -1431,9 +1432,9 @@ void cmLocalGenerator::GetTargetFlags( if (linkLanguage != "Swift") { exeFlags = this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS"); exeFlags += " "; - if (!buildType.empty()) { + if (!configUpper.empty()) { exeFlags += this->Makefile->GetSafeDefinition( - cmStrCat("CMAKE_EXE_LINKER_FLAGS_", buildType)); + cmStrCat("CMAKE_EXE_LINKER_FLAGS_", configUpper)); exeFlags += " "; } if (linkLanguage.empty()) { @@ -1460,7 +1461,7 @@ void cmLocalGenerator::GetTargetFlags( } } - this->AddLanguageFlagsForLinking(flags, target, linkLanguage, buildType); + this->AddLanguageFlagsForLinking(flags, target, linkLanguage, config); if (pcli) { this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs, frameworkPath, linkPath); @@ -1485,9 +1486,9 @@ void cmLocalGenerator::GetTargetFlags( exeFlags += targetLinkFlags; exeFlags += " "; } - if (!buildType.empty()) { + if (!configUpper.empty()) { targetLinkFlags = - target->GetProperty(cmStrCat("LINK_FLAGS_", buildType)); + target->GetProperty(cmStrCat("LINK_FLAGS_", configUpper)); if (targetLinkFlags) { exeFlags += targetLinkFlags; exeFlags += " "; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 0c1f0cc..9148b27 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1004,9 +1004,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( } } std::string libflags; - this->GetStaticLibraryFlags(libflags, configTypeUpper, - target->GetLinkerLanguage(configName), - target); + this->GetStaticLibraryFlags( + libflags, configName, target->GetLinkerLanguage(configName), target); if (!libflags.empty()) { fout << "\t\t\t\tAdditionalOptions=\"" << libflags << "\"\n"; } diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 4434f1d..372b43b 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -141,8 +141,7 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() std::string extraFlags; this->LocalGenerator->GetStaticLibraryFlags( - extraFlags, cmSystemTools::UpperCase(this->GetConfigName()), linkLanguage, - this->GeneratorTarget); + extraFlags, this->GetConfigName(), linkLanguage, this->GeneratorTarget); this->WriteLibraryRules(linkRuleVar, extraFlags, false); } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 96543e5..ec7fe96 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -3409,9 +3409,8 @@ void cmVisualStudio10TargetGenerator::WriteLibOptions( this->GeneratorTarget->GetLinkClosure(config)->LinkerLanguage; std::string libflags; - this->LocalGenerator->GetStaticLibraryFlags( - libflags, cmSystemTools::UpperCase(config), linkLanguage, - this->GeneratorTarget); + this->LocalGenerator->GetStaticLibraryFlags(libflags, config, linkLanguage, + this->GeneratorTarget); if (!libflags.empty()) { Elem e2(e1, "Lib"); cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator; |