[cmake-developers] VS10-12 generators deserve much more love

Dan Cristiu moonstorm at gmail.com
Sun Feb 16 20:25:31 EST 2014


Wanted to add a simple change to the VS11 generator to support non-default
toolsets,  but after taking another look through the code for the VS10
generator and above, I decided I wasn't happy with the result. It shows
those files have been the result of years of patches, with much of the code
just copied and pasted.

I've decided to review the code in there and clean it to the point where
the duplication is minimal. Is anyone currently involved in a similar task
in this area?

Little has changed in terms of the basic functionality between these
versions of VS. In essence we're talking about changing versions here and
there. So what I propose is to take VS10 as the base and build on top of
it, with small overrides when it comes to version numbers and features.
When MS moves in a completely different direction, we create a new base. So
far they've been consistent.

Another thing I want to do is to implement a proper detection of platforms
& toolsets via the MSBuid/Microsoft.cpp folder for VS10-12, leaving the
defaults for cross-compilation. The detection will be done in a loose but
efficient way. We don't want to be too smart when it comes to these things.
The generator must only specify the supported toolset versions (VS12
supports V110, V100_xp plus whatever the base generator supports i.e. V100
and so on). The detection will start looking for these toolset versions
inside PlatformToolset and the rest of the folders inside
Microsoft.cpp/{ToolVersion} maching them and then fishes for platforms. I'm
pretty sure this covers WinCE SDKs as well but I'm planning on leaving the
detection mechanisms that were already implemented. NACL makes itself
available in the same fashion.

What bothers me is the toolset selection. Ideally the toolset & the
platform selection should have come together, identifying these critical
parameters from the beginning, problem is the toolset gets set later into
the already initialized generator. I need to investigate why the -T
argument isn't making its way earlier in the whole equation. I don't even
see a field for it in the CMake GUI, in the same dialog where you select
the generator. What am I missing here?

In any case, was there a reason why the toolset is not part of the
generator name? i.e. "Visual Studio 11 Win64 V110". Obviously with a
fallback to the VS preferred set. I know this could potentially create a
huge list of generator names in the GUI.

Also, it's not enough to set the toolset and platform. Less critical are
additional settings which must be part of the project file, otherwise you
end up with defaults or worse. A simple define-like variable can be made
available and set in the generator (e.g.
CMAKE_VS_PLATFORM_OPTIONS="key1=value1;key2=value2" => <key1>value1</key1>
<key2>value2</key2> that gets set by the local generator)

With these additions I hope we can have these generators more future proof
and easier to maintain.

Please give me your thoughts.

Thanks,
Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20140217/822ef48b/attachment.html>


More information about the cmake-developers mailing list