diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-05-19 17:18:01 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-06-11 12:41:16 (GMT) |
commit | 2d9ec1dadfdd10043a98d425abb25d0aef117699 (patch) | |
tree | 863ad302599233aa97f85f845cb59cf75a69afdf /Source | |
parent | a2021e578c6b6c944b1d1442cfb76c3f9543c839 (diff) | |
download | CMake-2d9ec1dadfdd10043a98d425abb25d0aef117699.zip CMake-2d9ec1dadfdd10043a98d425abb25d0aef117699.tar.gz CMake-2d9ec1dadfdd10043a98d425abb25d0aef117699.tar.bz2 |
Add compiler target compile options.
For clang, this allows passing -target <triple> to the compiler, and
for qcc, -V<arch> using toolchain files containing something like
set(triple arm-linux-gnueabihf)
set(CMAKE_C_COMPILER "/usr/bin/clang")
set(CMAKE_C_COMPILER_TARGET ${triple})
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
set(CMAKE_CXX_COMPILER_TARGET ${triple})
or
set(arch gcc_ntoarmv7le)
set(CMAKE_C_COMPILER /opt/qnx650/host/linux/x86/usr/bin/qcc)
set(CMAKE_C_COMPILER_TARGET ${arch})
set(CMAKE_CXX_COMPILER /opt/qnx650/host/linux/x86/usr/bin/QCC)
set(CMAKE_CXX_COMPILER_TARGET ${arch})
Both clang and qcc are inherently cross compiler( driver)s.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index c2da4a9..b57a54e 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1044,11 +1044,20 @@ 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; 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_OPTION_TARGET").c_str()); } if(actualReplace.find("${LANG}") != actualReplace.npos) { @@ -1069,6 +1078,11 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable, ret += " "; ret += compilerArg1; } + if (compilerTarget && compilerOptionTarget) + { + ret += compilerOptionTarget; + ret += compilerTarget; + } return ret; } return replace; |