[CMake] cmake skips assembly files

Kishore, Jonnalagadda (IE10) Kishore.Jonnalagadda at honeywell.com
Wed Mar 21 02:09:01 EST 2007


> > Assembly files explicitly given as source files for a target are
> > completely ignored. From google searches, it seems to be a known
issue
> > and the solution lies with adding custom commands.
> >
> > I am not familiar with adding custom commands. And thus have
assembly
> > files assembled before building a target. Is there a wiki or a
> tutorial
> > on this?
> 
> Currently I am trying the macro;
> 
> #Add assembly source files that are not natively supported in cmake
> #Syntax: ADD_ASM_SOURCES(SRC_LST asm1 asm2 asm3 ...)
> MACRO(ADD_ASM_SOURCES SRC_LST)
> 	FOREACH (SOURCE ${ARGN})
> 		GET_FILENAME_COMPONENT(infile ${SOURCE} ABSOLUTE)
> 		GET_FILENAME_COMPONENT(outfile ${infile} NAME_WE)
> 		SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/${outfile}.o)
> 		MESSAGE("SOURCE = ${infile}")
> 		ADD_CUSTOM_COMMAND (OUTPUT ${outfile}
> 			COMMAND echo "Assembling ${infile} to
> ${outfile}"
> 			COMMAND ${CMAKE_C_COMPILER} -c -o ${outfile}
> ${infile}
> 			MAIN_DEPENDENCY ${infile}
> 			)
> 		IF(NOT EXISTS ${outfile})
> #			MESSAGE(FATAL_ERROR "object file ${outfile} is
> not present")
> 		ENDIF(NOT EXISTS ${outfile})
> 		SET(${SRC_LST} ${outfile} ${${SRC_LST}})
> 		MESSAGE("SRC_LST = ${${SRC_LST}}")
> 	ENDFOREACH(SOURCE)
> ENDMACRO(ADD_ASM_SOURCES SRC_LIST)
> 
> I get the MESSAGE prints but not the echo output. Seems like custom
> command is not executed?! What is wrong here?

Anyone who have tried this before? I have read a couple of entries in
the archives from which I derived the above but they are either too old
or do not work.

Can anyone help?

Warm regards,
Kishore


More information about the CMake mailing list