[CMake] Assembler files
James Mansion
james at wgold.demon.co.uk
Tue May 30 17:31:24 EDT 2006
I'd like to create a library from a mix of
assembler and C files.
I'm reading the book to try to determine how
to achieve this. There seems to be perhaps two
possible approaches.
(Initially this is for Win32, and I have files for NASM
and MASM with extensions .nasm and .masm)
1) define new languages for NASM and MASM.
The example in the book (Fortran) suggests that I then need to
enable the language in the PROJECT declaration, though the
section on PROJECT suggests that all languages are enabled
by default. (?) Presumably I'm safe if I use ENABLE_LANGUAGE?
Then I would just use ADD_LIBRARY (foo a.c b.nasm c.masm).
Is that right?
2) Define a whole set of custom commands that create an object
file:
SET( MASM_SOURCES b1.masm b2.masm )
FOREACH( SRC ${MASM_SOURCES} )
ADD_CUSTOM_COMMAND(TARGET <obj for ${SRC}>
PRE_LINK
COMMAND masm ${SRC}
)
ENDFOREACH( SRC )
ADD_LIBRARY( foo a.c b1.obj b2.obj )
Is that right?
This actually seems clunky compared to make - what I'd like to
do is to define a command template that will transform a .masm
to a .obj. I guess the language definition does this, but I'd
much prefer it if it could be localised into the particular
project where I'm going to use it in this case.
James
More information about the CMake
mailing list