[CMake] Cmake 2.8 and cross compilation

Alexander Neundorf a.neundorf-work at gmx.net
Mon Nov 16 16:26:41 EST 2009


On Monday 16 November 2009, Emmanuel Blot wrote:
> > Can you create a bug entry for this?
>
> Sure,  I'll do it
>
> > As a quick fix I think if you set CMAKE_OSX_DEPLOYMENT_TARGET to empty it
> > will stop CMake form doing this.  You should be able to do that either in
> > the cache or in your project.
>
> Ok, it seems to work, thanks for the workaround.
>
> Now the actual issue, as I'm able to reproduce the original Linux host
> error: Assembly support seems broken, or at least not compatible with ATT
> mode from 2.5/2.6:
>
> Here is a CMake snippet of what we've been using up to now to build
> assembly source files:
> ENABLE_LANGUAGE (ASM-ATT OPTIONAL)
> SET (CMAKE_ASM-ATT_COMPILER ${xcc})
> SET (CMAKE_ASM-ATT_COMPILE_OBJECT
>      "<CMAKE_ASM-ATT_COMPILER> <FLAGS> -c -o <OBJECT> <SOURCE>")
> SET (CMAKE_ASM-ATT_FLAGS "${ARCH} -Wall")
> SET (CMAKE_ASM-ATT_FLAGS_DEBUG "-DDEBUG")
> SET (CMAKE_ASM-ATT_FLAGS_RELEASE "-DNDEBUG")
>
> then, to create an executable from mixed sources (.S and .c), we use
> the following syntax:
> ADD_EXECUTABLE(myapp myc.c myasm.S)

*.S (uppercase S) files are supposed to be run through the preprocessor. The 
ASM-ATT support does not involve the preprocessor, that's why *.S is not 
anymore considered to be an ASM-ATT file.
So, you can rename it to foo.s (lowercase s), then it will be processed by 
ASM-ATT, but without preprocessing.
Or you can set the LANGUAGE source file property to ASM-ATT, then it should 
also work.
If the file needs to be preprocessed, set the LANGUAGE source file property to 
C, this should work in most cases for now.

Alex


More information about the CMake mailing list