[cmake-developers] cmake -E capabilities
Brad King
brad.king at kitware.com
Fri Jul 1 08:59:11 EDT 2016
On 07/01/2016 05:11 AM, Tobias Hunger wrote:
>> For "multiconfig", there is the cmGlobalGenerator::IsMultiConfig method.
> I do not see why this information is need to set up a cmake project. I need two
> directories and a generator. Do I need to know what the generator produces at
> that point?
If we don't foresee a use case for it we don't need to add it now. The
example given in the issue was just a quick demo IIUC and not intended to
be authoritative result of deep design thought.
> * "Visual Studio 10 2010",
> * "Visual Studio 10 2010 Win64" and
> * "Visual Studio 10 2010 IA64"
[snip]
> The cmake command line lets me apparently use "-A platform"
[snip]
> Why can I specify the platform names in two different ways? Why do
> the two ways disagree on the platform name ("Win64" vs. "x64")?
See here:
https://cmake.org/cmake/help/v3.6/generator/Visual%20Studio%2014%202015.html
At one time the generator name was the only way. The names were not
originally chosen to match VS's platform names and were then kept for
compatibility. The -A/CMAKE_GENERATOR_PLATFORM approach was added
more recently to decouple the generator name from the target architecture.
> What is the preferred way to set up a Visual studio project nowadays?
The preferred way is now:
-G "Visual Studio 10 2010" -A x64
Its usage is not widespread because it doesn't make that much difference
for x64 and the feature has only been around for a couple years.
> If "-A" is the way to go, then I would like to try my hand at adding
> a method to retrieve all valid platforms for a generator. CMake has
> a lot of code to find those names (or hardcodes known names), so why
> not pass it on to the user?
If it is reasonably straightforward to do then go for it. That would
be nice to offer.
> So far I only looked into the visual studio generators, so I might
> have missed something that blocks such a method in other generators.
The Xcode generator supports CMAKE_GENERATOR_TOOLSET but not
CMAKE_GENERATOR_PLATFORM. The Makefile and Ninja generators support
neither because they are expected to be run from an environment that
is already configured for a given toolchain/architecture.
-Brad
More information about the cmake-developers
mailing list