[CMake] MSBuild and automatic project file regenation

Michael Hertling mhertling at online.de
Mon Jan 9 09:39:46 EST 2012


On 01/09/2012 02:34 PM, David Cole wrote:
> On Sun, Jan 8, 2012 at 11:59 PM, Óscar Fuentes <ofv at wanadoo.es> wrote:
>> When MSBuild.exe is used (typically by "cmake --build") for building a
>> VS2010 project generated by cmake, it correctly invokes cmake for
>> regenerating the project files if changes to the CMakeLists.txt files
>> are detected. However, the build does not restart nor abort, so MSBuild
>> continues using the outdated project files that it previously read,
>> ending some time later with lots of error messages from the compiler or
>> linker, hence wasting time, causing confusion and making difficult to
>> notice that a regeneration had happened.
>>
>> Is there any trick for stopping MSBuild as soon as cmake ends
>> regenerating the project files?
>>
>> --
>>
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
> 
> No trick, but to avoid this, perhaps we should change the "--build"
> handler to run the cmake configure & generate step before calling out
> to MSBuild. You can easily do this yourself from the command line by
> adopting the pattern:
> 
>   cmake . && cmake --build . --config Release
> 
> This is a good idea for a feature request. Not sure if we should just
> always do that by default and provide a way to turn off with a
> "--no-regenerate", or vice-versa with a "--please-generate-first" ...
> :-)
> 
> 
> HTH,
> David

Just out of curiosity: In [1], item (1), I reported on the fact that
one can modify a project's CMakeLists.txt, and "cmake --build" will
reconfigure/regenerate, but not rebuild. Is this the same issue the
OP asks about? If so, I would strongly support a feature request in
this respect since, IMO, it's actually quite confusing that CMake's
"--build" command does anything but rebuilding.

Regards,

Michael

[1] http://www.mail-archive.com/cmake@cmake.org/msg39596.html


More information about the CMake mailing list