Hi, I use ADD_CUSTOM_COMMAND() to generate a header file in one directory. That header file is included from a source file in another directory, which is then aggregated into a library. The dependency is stated via an OBJECT_DEPENDS property. Like,
in one directory 'generated-headers', ADD_CUSTOM_COMMAND( OUTPUT generated-header.h COMMAND touch generated-header.h ) and, in the library directory, INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/generated-headers) ADD_LIBRARY( library library.c ) SET_PROPERTY( SOURCE library.c PROPERTY OBJECT_DEPENDS ${CMAKE_BINARY_DIR}/generated-headers/generated-header.h) CMake doesn't seem to generate any targets for the generated-headers directory, resulting in Scanning dependencies of target library make[2]: *** No rule to make target `generated-headers/generated-header.h', needed by `library/CMakeFiles/library.dir/library.c.o'. Stop. What am I doing wrong? What I want to express with the above construct is that library.c.o depends on the header which is not yet there, and thus has to be generated before library.c.o is built. This is what 'make' understands when it descends into the 'library' directory. However the dependency appears to point to nowhere. (See the problematic package in the attached problem.tar.bz2 file.) Everything's ok if I put a dummy file and a library in the 'generated-headers' directory, like ADD_CUSTOM_COMMAND( OUTPUT generated-header.h dummy.c COMMAND touch generated-header.h dummy.c ) ADD_LIBRARY( generated generated-header.h dummy.c ) (See the ok package in the attached ok.tar.bz2 file.) Tested with both CMake 2.8.0 as downloaded from cmake.org, and 2.6-patch 4 (?) as available under Gentoo. Thanks in advance, Joerg
problem.tar.bz2
Description: Binary data
ok.tar.bz2
Description: Binary data
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake