mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-26 02:38:37 -06:00
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.
When cross-compiling with clang, use the CMAKE_${lang}_COMPILER_TARGET
as the _CMAKE_TOOLCHAIN_PREFIX to find the appropriate binutils.
When cross-compiling with QNX qcc, use the CMAKE_${lang}_COMPILER_TARGET
to set the appropriate _CMAKE_TOOLCHAIN_PREFIX.
This commit is contained in:
11
Help/variable/CMAKE_LANG_COMPILER_TARGET.rst
Normal file
11
Help/variable/CMAKE_LANG_COMPILER_TARGET.rst
Normal file
@@ -0,0 +1,11 @@
|
||||
CMAKE_<LANG>_COMPILER_TARGET
|
||||
----------------------------
|
||||
|
||||
The target for cross-compiling, if supported.
|
||||
|
||||
Some compiler drivers are inherently cross-compilers, such as clang and
|
||||
QNX qcc. These compiler drivers support a command-line argument to specify
|
||||
the target to cross-compile for.
|
||||
|
||||
This variable may only be set in a toolchain file specified by
|
||||
the ``CMAKE_TOOLCHAIN_FILE`` variable.
|
||||
Reference in New Issue
Block a user