summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2018-07-25 10:11:58 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2018-07-25 10:20:56 (GMT)
commit3713dc9b8e0662279e7f84133d5953998dcfe254 (patch)
treec46cf5119aa3729850d895676bf8fe10cff4186e
parentd1077c1ce6310f02c93962cbb89e82dc57a6dd31 (diff)
downloadCMake-3713dc9b8e0662279e7f84133d5953998dcfe254.zip
CMake-3713dc9b8e0662279e7f84133d5953998dcfe254.tar.gz
CMake-3713dc9b8e0662279e7f84133d5953998dcfe254.tar.bz2
cmLocalGenerator: Style change: Wrap temporary strings and code in braces
Code style change in ``cmLocalGenerator::GetIncludeDirectories``. Embrace ``{}`` temporary strings and code that uses them to minimize their lifetime.
-rw-r--r--Source/cmLocalGenerator.cxx45
1 files changed, 24 insertions, 21 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index f0db28d..0c50759 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -879,28 +879,31 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
return;
}
- std::string rootPath;
- if (const char* sysrootCompile =
- this->Makefile->GetDefinition("CMAKE_SYSROOT_COMPILE")) {
- rootPath = sysrootCompile;
- } else {
- rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
- }
-
+ // Implicit include directories
std::vector<std::string> implicitDirs;
- // Load implicit include directories for this language.
- std::string impDirVar = "CMAKE_";
- impDirVar += lang;
- impDirVar += "_IMPLICIT_INCLUDE_DIRECTORIES";
- if (const char* value = this->Makefile->GetDefinition(impDirVar)) {
- std::vector<std::string> impDirVec;
- cmSystemTools::ExpandListArgument(value, impDirVec);
- for (std::string const& i : impDirVec) {
- std::string d = rootPath + i;
- cmSystemTools::ConvertToUnixSlashes(d);
- emitted.insert(std::move(d));
- if (!stripImplicitInclDirs) {
- implicitDirs.push_back(i);
+ {
+ std::string rootPath;
+ if (const char* sysrootCompile =
+ this->Makefile->GetDefinition("CMAKE_SYSROOT_COMPILE")) {
+ rootPath = sysrootCompile;
+ } else {
+ rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
+ }
+
+ // Load implicit include directories for this language.
+ std::string key = "CMAKE_";
+ key += lang;
+ key += "_IMPLICIT_INCLUDE_DIRECTORIES";
+ if (const char* value = this->Makefile->GetDefinition(key)) {
+ std::vector<std::string> impDirVec;
+ cmSystemTools::ExpandListArgument(value, impDirVec);
+ for (std::string const& i : impDirVec) {
+ std::string d = rootPath + i;
+ cmSystemTools::ConvertToUnixSlashes(d);
+ emitted.insert(std::move(d));
+ if (!stripImplicitInclDirs) {
+ implicitDirs.push_back(i);
+ }
}
}
}