[CMake] Deriving version number from a header (safely)
Doug Gregor
doug.gregor at gmail.com
Thu May 14 21:31:17 EDT 2009
On Thu, May 14, 2009 at 8:25 AM, Brad King <brad.king at kitware.com> wrote:
> 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.
Works perfectly. Thanks, Brad!
- Doug
More information about the CMake
mailing list