[Cmake] Generating header files and dependencies
Bradley Lowekamp
blowekamp at mail.nih.gov
Thu Jun 17 10:46:15 EDT 2004
I am needed to use a script to generate some source and header files
in my project. I was able to get the generation of the source code to
work well and all of the dependencies to be correct with the
SET_SOURCE_FILES_PROPERTIES and the GENERATED option.
However with generated header files I can not seem to get the
dependencies to work correctly. The SET_SOURCE_FILES_PROPERTIES with
the GENERATED option appears to have no affect. When CMake tries to
make the dependencies for the source files, the header files do not
exist and so they are not implicitly added as dependent for anything,
so they will not get generated. I had to resort to adding them as a
dependency to all source files, which results in an unacceptable
amount of building needing to be done when any generated header file is
modified, but it does work. (I have what I am doing at the end of this
e-mail.) So how can I get the dependencies to work correctly for the
header files?
I just had a thought as I was righting up this e-mail. If I could add
a dependency to the make_depends or what ever target it is, I could
some how make the make depends target dependent on the generated header
files or something? Any suggestions about how to get this to work would
be good and very much appreciated I am actually not sure what versions
of CMake I have tried these things with.
Thanks!
Brad
FOREACH(file ${GENERATED_PLAWARE_LIB_HEADER})
ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/${file}
COMMAND ${TCL_TCLSH}
ARGS ${PLAWARE_SOURCE_DIR}/varexpand.tcl
${CMAKE_CURRENT_SOURCE_DIR}/include/${file}.in ${CMAKE_CUR
RENT_BINARY_DIR}/include/${file}
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/include/${file}.in
DEPENDS ${PLAWARE_SOURCE_DIR}/varexpand.tcl
${CMAKE_CURRENT_SOURCE_DIR}/include/${file}.in )
SET(GENERATED_HEADER_FILES ${GENERATED_HEADER_FILES}
${CMAKE_CURRENT_BINARY_DIR}/include/${file} )
ENDFOREACH(file)
SET_SOURCE_FILES_PROPERTIES(${PLAWARE_LIB_SRC} PROPERTIES
OBJECT_DEPENDS "${GENERATED_HEADER_FILES}" )
========================================================
Bradley Lowekamp
Management Systems Designers Contractor for
Office of High Performance Computing and Communications
National Library of Medicine
'blowekamp at mail.nih.gov
More information about the Cmake
mailing list