[CMake] Deriving version number from a header (safely)

Brad King brad.king at kitware.com
Thu May 14 11:25:05 EDT 2009


Doug Gregor wrote:
> However, we'd also like to force CMake to reconfigure when
> boost/version.hpp changes. Is there some top-level target that we can
> attach such a dependency to?

This has come up several times recently.  We need to add a feature to
let projects specify their own files on which the generated build system
depends.

Currently it is possible to do this by abusing configure_file.  We already
re-run CMake when the input to a configured file changes.  Something like

   configure_file(boost/version.hpp
     ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/version.stamp)

should work.

-Brad


More information about the CMake mailing list