diff options
author | Brad King <brad.king@kitware.com> | 2017-05-09 18:08:15 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-05-09 18:21:54 (GMT) |
commit | 53e89b6ab0cae7b9ba0316b3806abd986794a22c (patch) | |
tree | 45529a1a882e354379d151e88132be00a7286c99 /Source/cmLocalGenerator.cxx | |
parent | b69e061b8073efbd2c356f4508ea401c85e8dae3 (diff) | |
download | CMake-53e89b6ab0cae7b9ba0316b3806abd986794a22c.zip CMake-53e89b6ab0cae7b9ba0316b3806abd986794a22c.tar.gz CMake-53e89b6ab0cae7b9ba0316b3806abd986794a22c.tar.bz2 |
Add options for separate compile and link sysroots
Add `CMAKE_SYSROOT_COMPILE` and `CMAKE_SYSROOT_LINK` variables to as
operation-specific alternatives to `CMAKE_SYSROOT`. This will be useful
for Android NDKs that compile and link with different sysroot values
(e.g. `r14` with unified headers).
Co-Author: Florent Castelli <florent.castelli@gmail.com>
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 0ab6e89..f584753 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -88,7 +88,19 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile) std::vector<std::string> enabledLanguages = this->GetState()->GetEnabledLanguages(); - this->CompilerSysroot = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"); + if (const char* sysrootCompile = + this->Makefile->GetDefinition("CMAKE_SYSROOT_COMPILE")) { + this->CompilerSysroot = sysrootCompile; + } else { + this->CompilerSysroot = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"); + } + + if (const char* sysrootLink = + this->Makefile->GetDefinition("CMAKE_SYSROOT_LINK")) { + this->LinkerSysroot = sysrootLink; + } else { + this->LinkerSysroot = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"); + } for (std::vector<std::string>::iterator i = enabledLanguages.begin(); i != enabledLanguages.end(); ++i) { @@ -142,7 +154,8 @@ cmRulePlaceholderExpander* cmLocalGenerator::CreateRulePlaceholderExpander() const { return new cmRulePlaceholderExpander(this->Compilers, this->VariableMappings, - this->CompilerSysroot); + this->CompilerSysroot, + this->LinkerSysroot); } cmLocalGenerator::~cmLocalGenerator() @@ -843,7 +856,13 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs, return; } - std::string rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"); + std::string rootPath; + if (const char* sysrootCompile = + this->Makefile->GetDefinition("CMAKE_SYSROOT_COMPILE")) { + rootPath = sysrootCompile; + } else { + rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"); + } std::vector<std::string> implicitDirs; // Load implicit include directories for this language. |