[CMake] assembler with non standard extension with gcc compiler

Ivan Sergio Borgonovo mail at webthatworks.it
Thu Oct 31 17:08:27 EDT 2013


On Thu, 31 Oct 2013 21:17:11 +0100
Alexander Neundorf <a.neundorf-work at gmx.net> wrote:

> On Thursday 31 October 2013, Ivan Sergio Borgonovo wrote:
> > On Thu, 31 Oct 2013 18:01:29 +0100
> > 
> > Alexander Neundorf <a.neundorf-work at gmx.net> wrote:
> > > 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
> > 
> > Thanks, that made the trick but I ran into another problem:
> > 
> > One of those asm file is somehow being ignored by cmake.
> > 
> > I can find the right commands greping in the build dir but they are
> > not executed during make:
> 
> can you post a bit more from your cmake files, or maybe a complete
> minimal example ?

It was automatically generated by a python script.
The schema is:

main CMakeLists.txt

[list of include_directories()]

[list of add_subdirectory()]

add_executable(project main.c)

target_link_libraries(project [list of targets])

In each dir I've a CMakeLists.txt consisting of:

add_library(target STATIC source)
# for asm source only:
set_source_files_properties(source PROPERTIES LANGUAGE ASM)
SET_TARGET_PROPERTIES(target PROPERTIES LINKER_LANGUAGE ASM)

All asm files get compiled and linked with the exception of one.

The only difference I can spot is that others contains global symbols
that are referenced in C files[1] or in the linker options[2] while the
only one that doesn't get compiled and linked contains symbols that are
referenced just in another ASM file[3].

In all asm file I've a
.global [asymbol]

[1]
extern void [asymbol]

[2]
-Wl,-e,[asymbol]

[3]
lda.w   pc, _stext

[3] causes:

libtrampoline.a(trampoline.s.o): In function `program_start':
(.reset+0x2004): undefined reference to `_stext

where trampoline.a source is an asm file.

My guess is that cmake understand the dependency between a C file or
a linker option and an asm file but it doesn't understand the dependency
between an asm file and another asm file.

-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it



More information about the CMake mailing list