diff options
author | Brad King <brad.king@kitware.com> | 2019-01-22 16:37:12 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-01-22 16:37:49 (GMT) |
commit | fa5bf870df1ce5d9cbcf61be736beb0b1e87b85b (patch) | |
tree | c07fe06038855289fbedd074307acb621a66826f /Source | |
parent | a1f65014a30c7e9da15c87e3cca1d86b480c5339 (diff) | |
parent | 5990ecb74133e1a9c885fc0ea62896b501d37fef (diff) | |
download | CMake-fa5bf870df1ce5d9cbcf61be736beb0b1e87b85b.zip CMake-fa5bf870df1ce5d9cbcf61be736beb0b1e87b85b.tar.gz CMake-fa5bf870df1ce5d9cbcf61be736beb0b1e87b85b.tar.bz2 |
Merge topic 'implicit-includes'
5990ecb741 Compute implicit include directories from compiler output
d751d2d2ed CMakeDetermineCompilerABI: set locale to C for try_compile()
c765ae495a CMakeDetermineCompilerABI: pass verbose flag during compilation
8c5221fb1f try_compile: Preserve special characters in COMPILE_DEFINITIONS
15ad830062 Refactor exclusion of -I/usr/include to avoid per-language values
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2716
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCoreTryCompile.cxx | 4 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 24 |
2 files changed, 19 insertions, 9 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index fcb27b4..272535d 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -599,7 +599,9 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, fprintf(fout, "link_directories(${LINK_DIRECTORIES})\n"); // handle any compile flags we need to pass on if (!compileDefs.empty()) { - fprintf(fout, "add_definitions(%s)\n", cmJoin(compileDefs, " ").c_str()); + // Pass using bracket arguments to preserve content. + fprintf(fout, "add_definitions([==[%s]==])\n", + cmJoin(compileDefs, "]==] [==[").c_str()); } /* Use a random file name to avoid rapid creation and deletion diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 97e684b..23afbd0 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -947,21 +947,29 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectories( rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"); } + std::vector<std::string> impDirVec; + + // Get platform-wide implicit directories. + if (const char* implicitIncludes = (this->Makefile->GetDefinition( + "CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES"))) { + cmSystemTools::ExpandListArgument(implicitIncludes, impDirVec); + } + // 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)); - } - implicitDirs.push_back(i); + } + + for (std::string const& i : impDirVec) { + { + std::string d = rootPath + i; + cmSystemTools::ConvertToUnixSlashes(d); + emitted.insert(std::move(d)); } + implicitDirs.push_back(i); } } |