For me, with something similar, I just use :
add_custom_command(TARGET ${PROJECT_NAME}
PRE_BUILD
COMMAND odb -o /home/david/dev/ --std c++11 -I/home/david/dev/ -d sqlite --generate- query --generate-schema ${PROMOTER_LIB_PREFIX}/entities/person.hpp
)
We don't use DEPENDS
or VERBATIM
.
The DEPENDS
option specify that the command must be executed only after that the project you gave to this option is built.
EDIT :
Note that the PRE_BUILD option is only supported on Visual Studio 7 or later. For all other generators PRE_BUILD will be treated as PRE_LINK.
Maybe that's why it doesn't work for you.
A work around could be (a bit ugly) :
- Create a fake project
- Add your custom command on it as POST_BUILD
- Make you current project dependent on the fake one