[CMake] Ninja: Avoiding unnecessary rebuilds with generated files

Miller, Frank FMiller at sjm.com
Mon May 6 10:44:40 EDT 2013


This has been fixed.

http://www.cmake.org/Bug/view.php?id=13592

Frank

> -----Original Message-----
> From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On
> Behalf Of Florian Weimer
> Sent: Sunday, May 05, 2013 7:17 AM
> To: cmake at cmake.org
> Subject: [CMake] Ninja: Avoiding unnecessary rebuilds with generated files
>
> 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

This communication, including any attachments, may contain information that is proprietary, privileged, confidential or legally exempt from disclosure. If you are not a named addressee, you are hereby notified that you are not authorized to read, print, retain a copy of or disseminate any portion of this communication without the consent of the sender and that doing so may be unlawful. If you have received this communication in error, please immediately notify the sender via return e-mail and delete it from your system.


More information about the CMake mailing list