Commit Graph

10 Commits

Author SHA1 Message Date
Stephen Kelly 89ba7b0046 Update the Clang pattern to specify compiler options.
In Clang 3.4, the preferred (and new) option pattern is --target=.

 http://thread.gmane.org/gmane.comp.compilers.clang.devel/29975
 http://llvm.org/viewvc/llvm-project?view=revision&revision=184408

Clang 3.4 is not yet released, but there is a release candidate, and
there is a dashboard test of Clang trunk.
2013-11-25 23:01:21 +01:00
Stephen Kelly 5096967ecd 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.
2013-11-19 12:39:34 -05:00
Stephen Kelly 76552d595d 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.
2013-11-19 12:38:53 -05:00
Brad King 3d8356d486 Clang: Support Windows variants for GNU and MSVC (#13035, #14458)
Teach the compiler identification preprocessor tests to report when
Clang simulates MSVC, and what version.  If not MSVC, assume GNU.

Teach compiler information modules Clang-(C|CXX) to recognize when Clang
simulates MSVC and skip loading the GNU information.

Teach the Windows-MSVC platform information to recognize when it is
loaded as the simulated compiler and use that version information
instead of the real compiler's (different) version scheme.

Add platform modules Windows-Clang-(C|CXX) and support module
Windows-Clang to load either Windows-MSVC or Windows-GNU and wrap
the corresponding information macros.
2013-10-04 13:39:22 -04:00
Stephen Kelly b33c9844fa Revert "Add compiler target compile options."
This reverts commit 2d9ec1dadf.
2013-08-09 14:28:43 +02:00
Stephen Kelly 2d9ec1dadf 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.
2013-06-11 14:41:16 +02:00
Stephen Kelly 0e9f4bc00c Introduce target property <LANG>_VISIBILITY_PRESET
This is initialized by CMAKE_<LANG>_VISIBILITY_PRESET. The target
property is used as the operand to the -fvisibility= compile option
with GNU compilers and clang.
2013-06-02 12:00:51 +02:00
Ben Boeckel 4d668f3311 Clang: Add -isystem flag support everywhere
In GNU.cmake, -isystem is not used if APPLE is set. However, Clang has
pretty much always supported -isystem, so we should always use it.

In the future, GNU.cmake should do a version check to see if -isystem is
supported.
2013-03-28 10:32:24 -04:00
Brad King ada9efd3af Clang: All versions know about -fPIE (#13550)
The GNU compiler information file tests for GNU >= 3.4 because earlier
versions do not have the flag.  The version number test is not valid for
Clang compiler versions, but we know Clang supports the flag.
2012-09-19 14:08:45 -04:00
Brad King 6e34aea93c Clang: Split Compiler/Clang* modules out from GNU (#13550)
While Clang presents an almost identical interface to GNU there will be
some differences.  Split the compiler information modules to allow
separate rules for Clang.  Start by loading the GNU rules but leave a
place to add Clang-specific information.
2012-09-19 14:06:28 -04:00