[CMake] assembler support

Alexander Neundorf a.neundorf-work at gmx.net
Mon Jul 2 16:37:03 EDT 2007


Hi,

since last week cmake cvs has basic support for assembler.
Assembler is different from other languages in that it actually is no single 
language, but there are many different assembler languages. 

There is a generic "ASM" language now and a specialized "ASM-ATT" language. 
You can enable assembler support by doing PROJECT(Foo C C++ ASM/ASM-ATT) or 
using ENABLE_LANGUAGE(ASM/ASM-ATT).
After that you can check using IF(CMAKE_ASM-ATT_COMPILER_WORKS) if an 
assembler was found.
You may have to set the LINKER_LANGUAGE of the targets using 
SET_TARGET_PROPERTIES to C/CXX .
You can then just add .s/.S/.asm files to your targets and they should be 
built.

If you need support for other assemblers, e.g. nasm/yasm, a new "assembler 
dialect" has to be added. Have a look a the files containing ASM-ATT how to 
do it with the least amount of work. Then you could do e.g.
ENABLE_LANGUAGE(ASM-ATT ASM-Intel) 
in your project and support both assemblers in one project. 

If you are using an embedded toolchain, the generic "ASM" language should work 
for you. Preset CMAKE_ASM_COMPILER to your compiler (following the 
instructions at http://www.cmake.org/Wiki/CMake_Cross_Compiling ) and create 
a Generic-<basename_of_the_assembler>.cmake in the Platform directory where 
you set up the rules variables (CMAKE_ASM_COMPILE_OBJECT etc.).

We are waiting for your feedback
Alex


More information about the CMake mailing list