[CMake] multiple custom commands and multiple OBJECT_DEPENDS

Brad King brad.king at kitware.com
Thu Oct 21 09:37:55 EDT 2004


Clinton Stimpson wrote:

> Here's another possible problem I have...
> 
> I have two generated .h files.  They both get included into the same 
> .cpp file.
> So I add this to my CMakeLists.txt file.
> SET_SOURCE_FILES_PROPERTIES(CommandHandler.cpp PROPERTIES
>                               OBJECT_DEPENDS ${cubit_BINARY_DIR}/allwords.h
>                               OBJECT_DEPENDS 
> ${cubit_BINARY_DIR}/keywords.h)
> 
> But in my windows project file, only the custom build rule for kewords.h 
> shows up.
> And when I go to build CommandHandler.cpp, allwords.h isn't generated.
> If I switch the order that I specify the depends, it'll get allwords.h 
> but not keywords.h.
> In other words, it'll only pick up the last dependency I specify.

There is only one OBJECT_DEPENDS property.  Each time you specify it you 
overwrite the previous time.  To add more than one dependency, list them 
together:

SET(CommandHelper_DEPS
   ${cubit_BINARY_DIR}/allwords.h
   ${cubit_BINARY_DIR}/keywords.h
   )
SET_SOURCE_FILES_PROPERTIES(CommandHandler.cpp PROPERTIES
   OBJECT_DEPENDS "${CommandHelper_DEPS")

-Brad



More information about the CMake mailing list