[CMake] Generator-independent incremental CMake run

Bill Hoffman bill.hoffman at kitware.com
Thu Aug 14 11:42:50 EDT 2014


On 8/14/2014 11:26 AM, Nagger wrote:
>
> So ZERO_CHECK is 34 times faster. Why shouldn't I take advantage of that.
If CMake does not need to re-run, then ZERO_CHECK will always be faster 
than cmake build_dir.  cmake build_dir will run a full configure and 
generate no matter what.   That said, a cmake --build all, should do the 
same thing.  Going back to your original question:

>
> For our Continuous Integration tests we need fast incremental builds (only build what has changed).
> This also includes that CMake only has to run if necessary (some CMakeLists.txt changed).
> It seems there is no beautiful/portable/generator-independent way to do this?!

The way to do this is to use a ctest script.  You can basically do all 
the stuff in your batch script.  It would be something like this:

if(NOT EXISTS ${BULD_TREE)
     do_configure_and_build()
endif()

function(do_configure_and_build)
   ctest_update()
   ctest_configure()
   ctest_build()
endfunction()

Usually, it should be enough to have your version control system tell 
you if something has really changed.  If so, you will want to do a 
configure/build.

-Bill



More information about the CMake mailing list