[CMake] ADD_CUSTOM_COMMAND and dependencies

cedric Cedric.Borgese at loria.fr
Thu Feb 9 09:49:38 EST 2006


Hello,

I'm using cmake in a project and have some trouble with ADD_CUSTOM_COMMAND.
What I need is generate a source file with a binary previously generated by
the project and then add it in the project.

It works with this code :

MACRO(GENERATE directory)
	ADD_CUSTOM_COMMAND(
		OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated.cpp
		DEPENDS ${GENERATOR}
		COMMAND ${GENERATOR}
		ARGS -o generated.cpp ${directory}
	)
	SET(SOURCES ${SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/gomgenerated.cpp)
ENDMACRO(GENERATE)

it works well but it run only when ${GENERATOR} is modified. I canot add
 other dependecies because this macro is run on many directories that change
often.
The generator parse all files in ${directory} to check what it have to
generate and if it need to generate something.
What I need is to run that command every time I run make. I tryed to remove
the DEPENDS line but it doesn't work better.
There is a way to do what I need with CMake (in a portable way if possible) ?
Thanks for your help.



More information about the CMake mailing list