[CMake] errors with add_custom_command and add_custom_target
Vania Joloboff
vania.joloboff at inria.fr
Tue Jan 26 03:36:09 EST 2016
Hi
I have a generator that generates some, but not all of the source files.
My understanding was that I should use add_custom_command for that
When I do
set(EXIST_SOURCES A.cc B.cc C.cc)
set(GEN_SOURCES X.cc Y.cc Z.cc)
add_custom_command(OUTPUT ${GEN_SOURCES}
COMMAND generator
MAIN_DEPENDENCY gendir/generator )
set_property(SOURCE ${GEN_SOURCES} PROPERTY GENERATED )
add_library(mylib OBJECT "${EXIST_SOURCES} ${GEN_SOURCES}" )
I get error "Cannot find source file : X.cc"
So, I tried
set(EXIST_SOURCES A.cc B.cc C.cc)
set(GEN_SOURCES X.cc Y.cc Z.cc)
add_custom_target(generate
COMMAND generator
COMMENT "Generate"
DEPENDS gendir/generator )
set_property(SOURCE ${GEN_SOURCES} PROPERTY GENERATED )
add_library(mylib OBJECT "${EXIST_SOURCES} ${GEN_SOURCES}" )
add_dependencies(mylib generate)
I get same error "Cannot find source file : X.cc"
I just don't get it...
Vania
More information about the CMake
mailing list