summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-08-08 15:36:36 (GMT)
committerBrad King <brad.king@kitware.com>2013-11-19 17:39:34 (GMT)
commit5096967ecd443f3d7477d823e7ffdffcc15a8ed1 (patch)
tree3698fa4cad976ec180a879172a8df7dd99a6a721 /Source/cmLocalGenerator.cxx
parent76552d595db509d47e9bf179aac7a00e2f1fcfae (diff)
downloadCMake-5096967ecd443f3d7477d823e7ffdffcc15a8ed1.zip
CMake-5096967ecd443f3d7477d823e7ffdffcc15a8ed1.tar.gz
CMake-5096967ecd443f3d7477d823e7ffdffcc15a8ed1.tar.bz2
Allow toolchain files to specify an external toolchain.
Clang can compile code, but uses the gcc tools for other tasks such as linking. The -gcc-toolchain option can be used for that, but generalize so that other compilers can be treated the same. If such a location is specified, use it as a hint for finding the binutils executables.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index c308ba8..582ad0e 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1045,6 +1045,8 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
const char* compilerArg1 = 0;
const char* compilerTarget = 0;
const char* compilerOptionTarget = 0;
+ const char* compilerExternalToolchain = 0;
+ const char* compilerOptionExternalToolchain = 0;
if(actualReplace == "CMAKE_${LANG}_COMPILER")
{
std::string arg1 = actualReplace + "_ARG1";
@@ -1057,6 +1059,14 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
= 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());
}
if(actualReplace.find("${LANG}") != actualReplace.npos)
{
@@ -1083,6 +1093,12 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
ret += compilerOptionTarget;
ret += compilerTarget;
}
+ if (compilerExternalToolchain && compilerOptionExternalToolchain)
+ {
+ ret += " ";
+ ret += compilerOptionExternalToolchain;
+ ret += this->EscapeForShell(compilerExternalToolchain, true);
+ }
return ret;
}
return replace;