summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-05-19 17:18:01 (GMT)
committerStephen Kelly <steveire@gmail.com>2013-06-11 12:41:16 (GMT)
commit2d9ec1dadfdd10043a98d425abb25d0aef117699 (patch)
tree863ad302599233aa97f85f845cb59cf75a69afdf /Modules
parenta2021e578c6b6c944b1d1442cfb76c3f9543c839 (diff)
downloadCMake-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 'Modules')
-rw-r--r--Modules/CMakeDetermineCompilerABI.cmake3
-rw-r--r--Modules/Compiler/Clang.cmake1
-rw-r--r--Modules/Platform/QNX.cmake3
3 files changed, 7 insertions, 0 deletions
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
index 25d6bbe..44cc04a 100644
--- a/Modules/CMakeDetermineCompilerABI.cmake
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -28,6 +28,9 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
if(DEFINED CMAKE_${lang}_VERBOSE_FLAG)
set(CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}")
endif()
+ if(CMAKE_${lang}_COMPILER_TARGET)
+ set(CMAKE_FLAGS "${CMAKE_FLAGS} -DCMAKE_${lang}_COMPILER_TARGET=${CMAKE_${lang}_COMPILER_TARGET}")
+ endif()
try_compile(CMAKE_${lang}_ABI_COMPILED
${CMAKE_BINARY_DIR} ${src}
CMAKE_FLAGS "${CMAKE_FLAGS}"
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index ec4562a..66b00bd 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -25,4 +25,5 @@ macro(__compiler_clang lang)
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
+ set(CMAKE_${lang}_COMPILE_OPTION_TARGET "-target ")
endmacro()
diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake
index 2598411..315f721 100644
--- a/Modules/Platform/QNX.cmake
+++ b/Modules/Platform/QNX.cmake
@@ -13,6 +13,9 @@ set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
+# http://www.qnx.com/developers/docs/6.4.0/neutrino/utilities/q/qcc.html#examples
+set(CMAKE_C_COMPILE_OPTION_TARGET "-V")
+set(CMAKE_CXX_COMPILE_OPTION_TARGET "-V")
# Shared libraries with no builtin soname may not be linked safely by
# specifying the file path.