[CMake] assembler with non standard extension with gcc compiler

Alexander Neundorf a.neundorf-work at gmx.net
Thu Oct 31 13:01:29 EDT 2013


On Thursday 31 October 2013, Ivan Sergio Borgonovo wrote:
> Hi,
> 
> I'm cross compiling (avr32) with a gcc compiler under Linux and I'm
> using a framework where asm extensions aren't directly recognized by
> cmake (.x).
> 
> gcc is recognized as a valid C and ASM compiler during cmake
> configuration.
> 
> But still I see cmake running just ar and ranlib on nothing. gcc is not
> invoked at all on asm targets.
> 
> I've read several "solutions" on the net but none works.
> 
> These are the relevant part I've put in my CMakeLists.txt
> 
> project(SAM C ASM)
> 
> set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS x)
> enable_language(C ASM)
> set(ASM_OPTIONS "-x assembler-with-cpp")
> set(CMAKE_ASM_FLAGS "${CFLAGS} ${ASM_OPTIONS}" )
> 
> All asm files are in separate directories with their own CMakeLists.txt
> and they are "added" as
> 
> add_library(targetname STATIC sourcefile)
> SET_TARGET_PROPERTIES(targetname
>    PROPERTIES LINKER_LANGUAGE ASM)
> 
> thanks

Did you try setting the source file property "LANGUAGE" to "ASM" for these 
files ?
http://www.cmake.org/cmake/help/v2.8.12/cmake.html#prop_sf:LANGUAGE

Alex


More information about the CMake mailing list