|
|
@@ -1043,11 +1043,38 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
|
|
|
// If this is the compiler then look for the extra variable
|
|
|
// _COMPILER_ARG1 which must be the first argument to the compiler
|
|
|
const char* compilerArg1 = 0;
|
|
|
+ const char* compilerTarget = 0;
|
|
|
+ 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";
|
|
|
cmSystemTools::ReplaceString(arg1, "${LANG}", lang);
|
|
|
compilerArg1 = this->Makefile->GetDefinition(arg1.c_str());
|
|
|
+ compilerTarget
|
|
|
+ = this->Makefile->GetDefinition(
|
|
|
+ (std::string("CMAKE_") + lang + "_COMPILER_TARGET").c_str());
|
|
|
+ compilerOptionTarget
|
|
|
+ = this->Makefile->GetDefinition(
|
|
|
+ (std::string("CMAKE_") + lang +
|
|
|
+ "_COMPILE_OPTIONS_TARGET").c_str());
|
|
|
+ compilerExternalToolchain
|
|
|
+ = this->Makefile->GetDefinition(
|
|
|
+ (std::string("CMAKE_") + lang +
|
|
|
+ "_COMPILER_EXTERNAL_TOOLCHAIN").c_str());
|
|
|
+ compilerOptionExternalToolchain
|
|
|
+ = 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)
|
|
|
{
|
|
|
@@ -1068,6 +1095,24 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
|
|
|
ret += " ";
|
|
|
ret += compilerArg1;
|
|
|
}
|
|
|
+ if (compilerTarget && compilerOptionTarget)
|
|
|
+ {
|
|
|
+ ret += " ";
|
|
|
+ ret += compilerOptionTarget;
|
|
|
+ ret += compilerTarget;
|
|
|
+ }
|
|
|
+ if (compilerExternalToolchain && compilerOptionExternalToolchain)
|
|
|
+ {
|
|
|
+ ret += " ";
|
|
|
+ ret += compilerOptionExternalToolchain;
|
|
|
+ ret += this->EscapeForShell(compilerExternalToolchain, true);
|
|
|
+ }
|
|
|
+ if (compilerSysroot && compilerOptionSysroot)
|
|
|
+ {
|
|
|
+ ret += " ";
|
|
|
+ ret += compilerOptionSysroot;
|
|
|
+ ret += this->EscapeForShell(compilerSysroot, true);
|
|
|
+ }
|
|
|
return ret;
|
|
|
}
|
|
|
return replace;
|
|
|
@@ -1462,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_";
|
|
|
@@ -1474,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);
|