Hello,

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?!

Fortunately we mainly use the VisualStudio2010 x64 Generator, so I wrote this hard-coded batch script:

echo ===  %DATE% == %TIME% ========= CMake...
set BUILD_DIR=build
set SOURCE_DIR=%CD%

if not exist %BUILD_DIR% goto generate
if not exist %BUILD_DIR%\CMakeCache.txt goto generate
if not exist %BUILD_DIR%\*.sln goto generate

:update
echo Solution exists, only updating...
cmake --build %BUILD_DIR% --target ZERO_CHECK
if %errorlevel% == 0 goto build

:generate
if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%"
pushd %BUILD_DIR%
echo Generating Solution...
cmake -G "Visual Studio 10 Win64" "%SOURCE_DIR%"
set el=%ERRORLEVEL%
popd
if %el% neq 0 exit /b %el%

:build
echo ===  %DATE% == %TIME% ========= Building...
cmake --build %BUILD_DIR% --config Release
exit /b %ERRORLEVEL%


This script works well, but I'm looking for a generator-independent way for this script! Does anyone already came up with a good solution? Isn't this a common problem?


Some of my thoughts:

"cmake --build" returns "1" on every kind of error (no binary dir, no solution, real build errors, ...). It would be nice to have a different return value for cmake internal errors (every error prior starting the actual build).

But what I really miss is an "--update" option for CMake which is doing all the work (updating if possible, configuring if necessary) internally. It would use the implementation of 'cmake --build' to trigger a re-configure and if that is not possible it would start a fresh configure&generate.
Any thoughts about that?

Thanks,
Marc

--

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

Reply via email to