[CMake] file depending on a target
Brandon J. Van Every
bvanevery at gmail.com
Sun May 14 02:50:34 EDT 2006
How can I make a file depend on a target? I have a lexer SILEX.EXE that
I generate. I need other files to depend on the existence of SILEX.EXE,
so that I can lex and create new output. It seems like
target-depends-on-target is dealt with, and file-depends-on-file, and
even target-depends-on-file. But not file-depends-on-target.
My current headscratching code:
EXE_C_TARGET(silex) # Generates silex.c from silex.scm
ADD_EXECUTABLE(silex ${Chicken_BINARY_DIR}/silex.c)
SET_TARGET_PROPERTIES(silex PROPERTIES COMPILE_FLAGS "${STATIC_FLAGS}")
TARGET_LINK_LIBRARIES(silex libchicken-static)
ADD_CUSTOM_COMMAND(
OUTPUT ${Chicken_BINARY_DIR}/easyffi.l.silex
MAIN_DEPENDENCY ${Chicken_SOURCE_DIR}/easyffi.l
DEPENDS silex
COMMAND silex ${Chicken_SOURCE_DIR}/easyffi.l
${Chicken_BINARY_DIR}/easyffi.l.silex
)
ADD_FILE_DEPENDENCIES(${Chicken_BINARY_DIR}/easyffi.c
${Chicken_BINARY_DIR}/easyffi.l.silex
)
It seems that "DEPENDS silex" will not refer to the SILEX.EXE target.
Rather, it thinks it's an ordinary file level dependency.
Cheers,
Brandon Van Every
More information about the CMake
mailing list