Reputation: 3171
Basically what I want to accomplish is to have a dependancy between a library and a custom command to generate SRC if SRC files are called (to be compiled for example.) but if they are called afterwards and were already generated, I don't want the Gen target to be triggered again. This is what I have but it's giving and error that SRC files are not found which is true as they are not generated yet!
add_custom_command(
TARGET Gen
COMMAND gen ${FILES} -o SRC
)
add_library(OBJS OBJECT ${SRC})
add_dependencies(OBJS Gen)
Upvotes: 1
Views: 1169
Reputation: 10961
To do this, you need to:
Something like this:
add_custom_command(
OUTPUT ${SRC}
COMMAND gen ${FILES} -o ${SRC})
add_custom_target(GENSRC
DEPENDS ${SRC})
add_library(OBJS OBJECT ${SRC})
add_dependencies(OBJS GENSRC)
Upvotes: 3