[CMake] Specify as in the toolchain

Andrea Galeazzi galeazzi at korg.it
Fri Dec 3 09:03:46 EST 2010


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)


# this one is important
SET(CMAKE_SYSTEM_NAME Generic)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
#this one not so much
SET(CMAKE_SYSTEM_PROCESSOR MX1)

# specify the cross compiler
SET(CMAKE_C_COMPILER   "C:/Programmi/development/GCCARM/bin/gcc.exe")
SET(CMAKE_CXX_COMPILER "C:/Programmi/development/GCCARM/bin/gcc.exe")

# where is the target environment
SET(CMAKE_FIND_ROOT_PATH "C:/Programmi/development/GCCARM/bin")

# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)

I'd like, when I use this toolchian, the as.exe used in makefile is 
under C:/Programmi/development/GCCARM/bin (which is an ARM assembler) 
instead of in the environment variable %PATH% (which is a x86 assembler)



More information about the CMake mailing list