[CMake] Default Generator to use

Sarnath K - ERS, HCLTech k_sarnath at hcl.com
Tue Feb 7 03:42:18 EST 2012


Hello Eric,

We have a case where 2 teams are working on a common source tree.
One team is using "Visual Studio 9 2008" and the other "Visual Studio 10"
Our platform is Windows7 64-bit.

We have a "tool" in our project that gets added as an "External Project" to the main CMAKE project.
This tool needs to be compiled _only_ as a 32-bit windows executable.
I use a configure.bat to configure this external project and build.

This batch-file has to invoke CMAKE with either Visual Studio 9 2008" or "Visual Studio 10".
But I would like this batch file to use the latest Visual Studio installed in the system in 32-bit mode.
I am on Win64 Command Prompt.
The main project is generated using "NMake Makefiles".
How do I do this?

Thanks,
Best Regards,
Sarnath

-----Original Message-----
From: Eric Noulard [mailto:eric.noulard at gmail.com]
Sent: Tuesday, February 07, 2012 1:36 PM
To: Sarnath K - ERS, HCLTech
Cc: cmake at cmake.org
Subject: Re: [CMake] Default Generator to use

2012/2/7 Sarnath K - ERS, HCLTech <k_sarnath at hcl.com>:
> Hello Friends,
>
> How do I specify the default generator that CMAKE should use when invoked
> without the "-G" option?
>
> I am on Windows.
>
> I saw an old thread on this. But I am not sure if any support was added
> later on.
>
>
> Is there a REGISTRY entry in Windows that we can set to make so that CMAKE
> can check it?

When starting with an empty build tree (or more precisely with empty cache)
the logic of the "default generator" is implement in:

Source/cmake.cxx::int cmake::ActualConfigure()

There is some system dependent macro logic and in
the Windows case the code comment says
(if not in Borland or Cygwin or Mingw case):
// Try to find the newest VS installed on the computer and
// use that as a default if -G is not specified

So no, as far as I understand the code,
there is no registry entry that could possibly be set to force a
particular default.

I guess it shouldn't be that hard to implement but it is not there.
(I'm not willing to try myself because I'm not a Windows user/developer)

Nevertheless, may be you can explain us why you would like to setup a default?
Is it too painful to add the extra -G argument?

--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org

::DISCLAIMER::
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------


More information about the CMake mailing list