I'm trying to port a legacy project to using cmake.  The header files
are needed by the sources.
The header files are generated so that the source file can compile.

The header files are regenerated if its dependency is changed.  This
doesn't cause the source file to be rebuilt, even though it depends on
these header files.

I'm using cmake 2.8.10


SET(SRCS
foo.c
)

ADD_CUSTOM_COMMAND(
  OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/foomsgId.h
${CMAKE_CURRENT_SOURCE_DIR}/foomsgDef.h
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  COMMAND ${MSG_CONVERT}
  ARGS foomessages.txt
  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/foomessages.txt
)

ADD_CUSTOM_TARGET(
  generate_foo_messages
  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/foomsgId.h
${CMAKE_CURRENT_SOURCE_DIR}/foomsgDef.h
)

ADD_LIBRARY(foo SHARED ${SRCS})
SET_TARGET_PROPERTIES(foo PROPERTIES PREFIX "" SUFFIX ".so" OUTPUT_NAME "foo")
ADD_DEPENDENCIES(foo generate_foo_messages)
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to