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.
1. On build server, if it overrides it with -D, then it does not set it by hand. If it doesn't override, it will use the fixed version in the file 2. On work machines, it's never defined prior, so it sets it with the fixed version. On Mon, Apr 10, 2017 at 9:15 AM, Bruce Stephens <bruce.r.steph...@gmail.com> wrote: > On Mon, Apr 10, 2017 at 2:36 PM, Bruce Stephens > <bruce.r.steph...@gmail.com> wrote: >> You could do something like >> >> if(NOT "${BUILD_VERSION}") >> set(BUILD_VERSION 1.2.3.4) >> endif() > > > That doesn't work at all, come to think of it. I suspect your best bet > is to handle > the caching yourself (likely using a file in ${CMAKE_BINARY_DIR} and > maybe "include(... OPTIONAL)"). That should allow whatever behaviour > you want. > > I note that llvm's builds have the same sort of problem, so whatever > fix is required > isn't obvious even to obviously bright people. (That is, when the > version switched > from 4.0.0 to 5.0.0 my builds didn't change their version number. I > had to remove the > build directory and build again from clean.) -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake