[CMake] How to properly handle build version number in CMake script for project

Bruce Stephens bruce.r.stephens at gmail.com
Mon Apr 10 13:48:24 EDT 2017


On Mon, Apr 10, 2017 at 5:04 PM, Robert Dailey <rcdailey.lists at gmail.com> wrote:
> Actually I think your idea does work. Why do you think it won't? I'm
> using it right now and so far it seems OK.

I assumed (without testing, admittedly) is that it would fail if
someone used -D to set the value,
then changed some CMakeLists.txt file, then executed the build command
again. I'd expect that
to rerun cmake to update the build files and I'd fear that you'd then
get BUILD_VERSION from
the CMakeLists.txt file rather than the value explicitly set.

However, I haven't tried it, and maybe it works fine (with the
generators you care about) even without
caching?


More information about the CMake mailing list