[CMake] Generating Source Files

Bill Hoffman bill.hoffman at kitware.com
Wed Apr 8 17:43:16 EDT 2009



OK, wait, you left something out....  Here is my original post:

# only run if parser.e is newer than source.cmake
if(parser.e IS_NEWER_THAN source.cmake)
    execute_process(COMMAND myparser  parser.e --sources sources.cmake)
endif()
# include source.cmake, this file should set some vars
# something like set(SOURCES a.c b.c d.c)
include(sources.cmake)

********  This is what you left out **********
********  We have to make sure cmake re-runs when
********  input files to this change, the only way
********  to do that is to use them as an input to cmake
# now make parser.e an input to cmake, so that cmake will
# re-run when make is run and parser.e changes
configure_file(parser.e parser.e.flagfile)

add_custom_command(  # add the custom command to run the full parser here)

-Bill



More information about the CMake mailing list