[CMake] Specify as in the toolchain

Alexander Neundorf a.neundorf-work at gmx.net
Thu Jan 20 13:34:09 EST 2011


On Friday 03 December 2010, Andrea Galeazzi wrote:
> Il 03/12/2010 13.15, Michael Wild ha scritto:
> > On 12/03/2010 01:06 PM, Andrea Galeazzi wrote:
> >> How can I specify the "as" command like I do for gcc or g++ compiler in
> >> a toolchain?
> >> SET(CMAKE_C_COMPILER   "C:/Programmi/development/GCCARM/bin/gcc.exe")
> >> ............
> >
> > *NEVER* set the compiler like this AFTER you executed the PROJECT or
> > ENABLE_LANGUAGE commands. This will cause all kinds of failures. In
> > fact, consider these variables to be read-only. Usually which compiler
> > to use is either determined by the user running CMake or by CMake itself
> > if the user didn't specify anything.
> >
> > If you must override the compiler (really, you shouldn't), have a look
> > at the CMakeForceCompiler module.
> >
> > The assembler is in the CMAKE_ASM${DIALECT}_COMPILER variable, but
> > again, consider this to be read-only. Read
> > http://www.cmake.org/Wiki/CMake/Assembler for more information.
> >
> > Michael
> >
> > __________ Informazioni da ESET NOD32 Antivirus, versione del database
> > delle firme digitali 5670 (20101203) __________
> >
> > Il messaggio è stato controllato da ESET NOD32 Antivirus.
> >
> > www.nod32.it
>
> Probably my problem is simpler; that's my toolchain file for cross compile:
> INCLUDE (CMakeForceCompiler)
> CMAKE_FORCE_C_COMPILER   (gcc.exe GNU)
> CMAKE_FORCE_CXX_COMPILER (gcc.exe GNU)

Is this really necessary ?
Can't you link a basic main.c without any special flags ?
This should be the only case where the force() macros should be used.

Alex


More information about the CMake mailing list