summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-04-13 12:46:57 (GMT)
committerBrad King <brad.king@kitware.com>2013-11-19 17:39:39 (GMT)
commit7cd65c97fabd9f3249739a81dd1260a1e0b59ee1 (patch)
tree27ba5ee0d30c9a59ed288806ca1ce40060dd4f0f /Source/cmLocalGenerator.cxx
parent5096967ecd443f3d7477d823e7ffdffcc15a8ed1 (diff)
downloadCMake-7cd65c97fabd9f3249739a81dd1260a1e0b59ee1.zip
CMake-7cd65c97fabd9f3249739a81dd1260a1e0b59ee1.tar.gz
CMake-7cd65c97fabd9f3249739a81dd1260a1e0b59ee1.tar.bz2
Add CMAKE_SYSROOT variable to set --sysroot when cross compiling.
As CMAKE_ROOT_FIND_PATH can be a list, a new CMAKE_SYSROOT is introduced, which is never a list. The contents of this variable is passed to supporting compilers as --sysroot. It is also accounted for when processing implicit link directories reported by the compiler, and when generating RPATH information.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx20
1 files changed, 19 insertions, 1 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 582ad0e..d2784a9 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1047,6 +1047,8 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
const char* compilerOptionTarget = 0;
const char* compilerExternalToolchain = 0;
const char* compilerOptionExternalToolchain = 0;
+ const char* compilerSysroot = 0;
+ const char* compilerOptionSysroot = 0;
if(actualReplace == "CMAKE_${LANG}_COMPILER")
{
std::string arg1 = actualReplace + "_ARG1";
@@ -1067,6 +1069,12 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
= this->Makefile->GetDefinition(
(std::string("CMAKE_") + lang +
"_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN").c_str());
+ compilerSysroot
+ = this->Makefile->GetDefinition("CMAKE_SYSROOT");
+ compilerOptionSysroot
+ = this->Makefile->GetDefinition(
+ (std::string("CMAKE_") + lang +
+ "_COMPILE_OPTIONS_SYSROOT").c_str());
}
if(actualReplace.find("${LANG}") != actualReplace.npos)
{
@@ -1099,6 +1107,12 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
ret += compilerOptionExternalToolchain;
ret += this->EscapeForShell(compilerExternalToolchain, true);
}
+ if (compilerSysroot && compilerOptionSysroot)
+ {
+ ret += " ";
+ ret += compilerOptionSysroot;
+ ret += this->EscapeForShell(compilerSysroot, true);
+ }
return ret;
}
return replace;
@@ -1493,6 +1507,8 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
return;
}
+ std::string rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
+
std::vector<std::string> implicitDirs;
// Load implicit include directories for this language.
std::string impDirVar = "CMAKE_";
@@ -1505,7 +1521,9 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
for(std::vector<std::string>::const_iterator i = impDirVec.begin();
i != impDirVec.end(); ++i)
{
- emitted.insert(*i);
+ std::string d = rootPath + *i;
+ cmSystemTools::ConvertToUnixSlashes(d);
+ emitted.insert(d);
if (!stripImplicitInclDirs)
{
implicitDirs.push_back(*i);