[CMake] MSBuild and automatic project file regenation

Óscar Fuentes ofv at wanadoo.es
Tue Jan 10 13:09:56 EST 2012


Michael Hertling <mhertling at online.de>
writes:

> But aren't the issues related at least?

Dunno.

> If I understand
> correctly, "cmake --build" invokes MSBuild which
>
> - loads the solution file and the project files,
> - reinvokes CMake via the ZERO_CHECK project/target
>   to regenerate them if CMakeLists.txt has been modified,
> - does *not* use the regenerated ones for building, so the
>   affected projects/targets are left inherently out-of-date.

Yep.

> Moreover, even an additional subsequent "cmake --build" command doesn't
> rebuild; in fact, it does nothing, as though there is no dependency of
> a project/target on its own project file.

That doesn't happen here. The next "cmake --build" works fine (cmake
2.8.4, VS 10)

> AFAICS for now, it's solely
> David's hint, i.e. "cmake . && cmake --build .", that results in the
> project being actually rebuilt after CMakeLists.txt has changed,
> unless one uses the "--clean-first" option.
>
>>> 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.
>> 
>> I agree.
>
> Do you file a feature request / bug report?

Nope.

> Personally, I'd like to be
> sure that after a "cmake --build" command, everything is up-to-date as
> it is with Makefiles, provided it can be realized with MSBuild at all.

Obviously, how MSBuild works when the project files are regenerated on
the fly is a bug. I have no idea about how hard is to fix it, though.

> Try <http://www.cmake.org/pipermail/cmake/2011-November/047802.html>.

Hmmm... After reading your example, I can't say for sure that when
`cmake --build' worked the second time here it didn't cointain changes
on the source files too.

CMake with VS 10 and/or MSBuild is pesky, apart from the problems
MSBuild has on its own. I'm looking at using other generators that
support parallel builds. JOM is not truly parallel (it only builds a
toplevel target at once). Ninja looks like the right thing, but doesn't
work on MS Windows.



More information about the CMake mailing list