[CMake] Assembler and C++ for the same target

Stefan Weber stefan.weber at gmail.com
Thu Sep 25 11:45:54 EDT 2008


Hi,
I am working on a C++ project which is using a single assembler file (among
all the C++ files). In the mailinglist archives I found some hints on how to
use the experimental ASM mode. However, as I only have a single ASM file,
I'm not sure how to handle that: Ideally, I would like to pass it to
add_library with all the other source files (in the same way I can pass it
to C++ which automatically forwards it to the assembler). This is not
working, so my intention was to build a library from the single ASM file
using the ASM mode and then link the other C++ files against that library.
This looks as follows:

cmake_minimum_required(VERSION 2.6)
project(TEST)
enable_language(ASM)
add_library(asmtest MyAsm.S)
set_target_properties(asmtest PROPERTIES LINKER_LANGUAGE ASM)
link_directories(".")
add_executable(test test.cxx)
target_link_libraries(test asmtest)

Unfortunately, this is not working either (the test target does not find the
function defined in MyAsm). As it turns out, the reason is that libasmtest.a
is empty (i.e. ar t libasmtest.a does no return anything). When building the
libasmtest.a manually, it works (i.e. make test succeeds).

Can someone catch my mistake? I would prefer to avoid having to build a
separate library for the assembler file, but at this point, I'm happy with
any solution :-)

Thanks,

Stefan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080925/ad022ae5/attachment.htm>


More information about the CMake mailing list