[CMake] Some Visual Studio/CMake questions

Jakob van Bethlehem jsvanbethlehem at gmail.com
Tue Mar 8 11:03:52 EST 2016


Dear users,

Since about a year I work on a project that uses CMake in combination with
Visual Studio. This works kind of oke, but over time some questions have
emerged. Hopefully I can get an answer on this list:

* Our build infrastructure creates a Release and a Debug configuration by
setting the CMAKE_CONFIGURATION_TYPES variable. However, when switching
between these configurations, Visual Studio almost kills itself, and
becomes unresponding for quite some time. Is this a known issue with Visual
Studio and CMake-generated solutions? Or is there something we can do to
improve this?

* The generated solution file makes sure that CMake is ran again if any
change in one of the CMakeLists.txt file is detected. What we typically see
however, is that afterwards Visual Studio recompiles loads of files that
were not changed, and that were already compiled before. It seems that the
CMake run someone makes Visual Studio believe that all, or at least way too
many, files are out of date and need to be recompiled. We make use of a
Visual Studio plugin that provides a bunch of smart functions, which scans
the files in the solution in order to do its job. This plugin has the same
behaviour, so it seems like CMake is the common denominator causing
behaviour one wouldn't expect or want.
Same question: known issue, or something we can improve somehow?

* Over time I have seen a view times that it was mentioned that it is
possible to call the 'project()' function multiple times, and that this
will produce separate Visual Studio solution files. Interestingly, this is
documented absolutely nowhere. As a matter of fact, the documentation of
the 'project()' function clearly states that you should call that function
only once, and exactly once.

What about it? Is this some undocumented feature we can rely on? Or is this
a serious bug, that many people incidentally have come to rely upon. If
this is considered a feature, will this feature remain working for the
foreseeable future? If yes is the answer to these questions, what *exactly*
does this feature contain, so where *can* I get documentation? My main
question is whether it is possible to create dependencies between projects,
i.e. solution files, and will CMake generate calls to msbuild that will
automatically take care that dependencies between solution files are
handled properly?

Hopefully someone can help me out a bit here!

Sincerely,
Jakob van Bethlehem
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160308/26d1b45a/attachment.html>


More information about the CMake mailing list