[cmake-developers] Patches for Visual Studio multi-CPU architecture project generation and a Windows-Phone-8 generator

Brad King brad.king at kitware.com
Wed Oct 16 09:06:13 EDT 2013


On 10/16/2013 03:57 AM, Paul Annetts wrote:
> Brad King asked me to refactor out the multi-CPU architecture
> (platform) part
[snip]
> https://github.com/paulannetts/CMake/tree/vs11MultiPlatform
> https://github.com/paulannetts/CMake/tree/windows-phone-8

Great, thanks for working on this!  It looks like a great start.

Why do you need the dedicated multi-platform target generator?
Can't the normal cmVisualStudio10TargetGenerator be taught to
support multiple platforms and just "loop" over a single platform
when needed?

> - It's based off of the July 12 Nightly build so quite old

Patrick, you've touched the relevant generator creation code most
recently.  Please take a look at this topic when you get a chance.
I think you've made changes since July that will conflict with
this topic.

> The current mechanism creates a new CMAKE variable "CMAKE_MSVC_PLATFORMS"
> which specifies the CPU architectures you want to generate for.

We already have CMAKE_GENERATOR_TOOLSET, so perhaps a better name
is CMAKE_GENERATOR_PLATFORMS?  It can be documented and enforced as
not supported by other generators, just like CMAKE_GENERATOR_TOOLSET.

> I've extended the "Visual Studio 11" generator so that the default
> platforms are "Win32;x64".

We cannot change the default platform selection behavior of a generator.
However, we can make the "Visual Studio 11" generator pay attention
to CMAKE_GENERATOR_PLATFORMS if it is set and otherwise fall back to
Win32.  Furthermore, the "Visual Studio 11 Win64" generator should
reject CMAKE_GENERATOR_PLATFORMS because it will be confusing to
specify platforms in two different ways.

Can this work for VS 10 too?

Another approach is to take this as a chance to address the generator
name problem.  People often choose "Visual Studio 12" expecting it to
work with VS 2012 but it is actually 11 for 2012 and 12 for 2013.  We
could create new names like

 Visual Studio 10 2010
 Visual Studio 11 2012
 Visual Studio 12 2013

that pay attention to CMAKE_GENERATOR_PLATFORMS so the old generators
can keep their default behavior.  Unfortunately that will create a
seemingly redundant generator selection choice:

 Visual Studio 11
 Visual Studio 11 Win64
 Visual Studio 11 2012

Perhaps that can be resolved by changing how cmake-gui presents them.

-Brad



More information about the cmake-developers mailing list