I've got a custom command which mangles a text file so that it can be
linked into the program:

add_custom_command (
  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/schema.sql.inc
  COMMAND xxd -i < ${PROJECT_SOURCE_DIR}/schema.sql > 
${CMAKE_CURRENT_BINARY_DIR}/schema.sql.inc
  DEPENDS schema.sql
)

The generated file is then referenced from a library:

add_library (SymbolDB
  lib/symboldb/database.cpp
  lib/symboldb/download.cpp
  ... (more *.cpp files)
  ${CMAKE_CURRENT_BINARY_DIR}/schema.sql.inc
)

Full CMakeLists.txt is here:
<https://github.com/fweimer/symboldb/blob/master/CMakeLists.txt>

With cmake 2.8.10, this triggers a rebuild of all the the *.cpp files
listed above when schema.sql changes.  But only
lib/symboldb/database.cpp includes schema.sql.inc and therefore needs
rebuilding.

It seems that these unnecessary rebuilds only happen with the Ninja
generator.  I don't see it with the make generator.  Could this be a
bug in the Ninja generator?
--

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

Reply via email to