Discussion:
[CMake] cmake 3.0.0 generating VS sln file default target machine type x86 (UNCLASSIFIED)
Su, Simon M CTR USARMY ARL (US)
2014-09-24 16:16:07 UTC
Permalink
Classification: UNCLASSIFIED
Caveats: NONE

Hello,

I am using

https://github.com/rpavlik/cppdom/blob/master/CMakeLists.txt

to generate sln file for cppdom to be compiled on windows x64. I ran cmake
and compile form VS2013 (express) x64 Cross Tools Command Prompt. How can I
change the CMakeLists.txt file so that it will automatically generate target
machine of type x64 and not x86? Or is there like a flag that I can pass to
cmake to have cmake generate sln files with x64 default target machine?

Any help is much appreciated.

Thanks
-simon

Classification: UNCLASSIFIED
Caveats: NONE
Jakub Zakrzewski
2014-09-25 07:34:24 UTC
Permalink
to generate sln file for cppdom to be compiled on windows x64. I ran cmake and compile form VS2013 (express) x64
Cross Tools Command Prompt. How can I change the CMakeLists.txt file so that it will automatically generate target
machine of type x64 and not x86? Or is there like a flag that I can pass to cmake to have cmake generate sln files > with x64 default target machine?
Don't
Su, Simon M CTR USARMY ARL (US)
2014-09-25 13:55:56 UTC
Permalink
Classification: UNCLASSIFIED
Caveats: NONE

I thought so too. What I did in the past was to load the sln file generated in
the IDE GUI and manually added x64 projects by copying from the x86 project. I
was hoping to get the x64 projects also generated automatically that now I
have lost access to the GUI - the network I am attached to is blocking the
registration traffic for some reason and vs2013 Express is not allowing me to
run the IDE after the trial period. I can only compile from msbuild command
line now.

And since I have been using ninja generator to compile ParaView, I just tried
it with ninja generator and it is creating a x64 project/library using the
same CMakeLists.txt file. Not sure why it is doing x64 project for ninja
generator and not VS2013Express generator. Thoughts?

Thanks
-simon

-----Original Message-----
From: Jakub Zakrzewski [mailto:***@e2e.ch]
Sent: Thursday, September 25, 2014 3:34 AM
To: Su, Simon M CTR USARMY ARL (US)
Cc: ***@cmake.org
Subject: RE: cmake 3.0.0 generating VS sln file default target machine type
x86 (UNCLASSIFIED)
Post by Su, Simon M CTR USARMY ARL (US)
to generate sln file for cppdom to be compiled on windows x64. I ran
cmake and compile form VS2013 (express) x64 Cross Tools Command
Prompt. How can I change the CMakeLists.txt file so that it will
automatically generate target machine of type x64 and not x86? Or is there
like a flag that I can pass to cmake to have cmake generate sln files > with
x64 default target machine?
Don't the Visual Studio XX Win64 generators do that?


Classification: UNCLASSIFIED
Caveats: NONE
Su, Simon M CTR USARMY ARL (US)
2014-09-26 14:28:59 UTC
Permalink
Classification: UNCLASSIFIED
Caveats: NONE

For some reason, when running cmake in VS2013 (express) x64 Cross Tools
Command Prompt is not picking up the Visual Studio 12 2013 Win64 generator by
default for this project. But when I added

-G "Visual Studio 12 2013 Win64"

To cmake, it generated x64 project files and I am able to generate 64bit
library from command line with msbuild command.

Thanks
-simon



-----Original Message-----
From: Jakub Zakrzewski [mailto:***@e2e.ch]
Sent: Thursday, September 25, 2014 3:34 AM
To: Su, Simon M CTR USARMY ARL (US)
Cc: ***@cmake.org
Subject: RE: cmake 3.0.0 generating VS sln file default target machine type
x86 (UNCLASSIFIED)
Post by Su, Simon M CTR USARMY ARL (US)
to generate sln file for cppdom to be compiled on windows x64. I ran
cmake and compile form VS2013 (express) x64 Cross Tools Command
Prompt. How can I change the CMakeLists.txt file so that it will
automatically generate target machine of type x64 and not x86? Or is there
like a flag that I can pass to cmake to have cmake generate sln files > with
x64 default target machine?
Don't the Visual Studio XX Win64 generators do that?


Classification: UNCLASSIFIED
Caveats: NONE
Nils Gladitz
2014-09-26 14:41:25 UTC
Permalink
Post by Su, Simon M CTR USARMY ARL (US)
Classification: UNCLASSIFIED
Caveats: NONE
For some reason, when running cmake in VS2013 (express) x64 Cross Tools
Command Prompt is not picking up the Visual Studio 12 2013 Win64 generator by
default for this project. But when I added
-G "Visual Studio 12 2013 Win64"
To cmake, it generated x64 project files and I am able to generate 64bit
library from command line with msbuild command.
CMake defaults to the newest known and available visual studio generator.

The current visual studio command line environment is neither required
for the visual studio generators nor does it influence which generator
CMake picks.

The environment matters when you are using one of the makefile or ninja
generators though since CMake will then use it to locate the compilers.

Nils
Su, Simon M CTR USARMY ARL (US)
2014-09-26 14:59:05 UTC
Permalink
Classification: UNCLASSIFIED
Caveats: NONE

Thanks Nils. I will double check my environment.
-simon

-----Original Message-----
From: Nils Gladitz [mailto:***@gmail.com]
Sent: Friday, September 26, 2014 10:41 AM
To: Su, Simon M CTR USARMY ARL (US); Jakub Zakrzewski
Cc: ***@cmake.org
Subject: Re: [CMake] cmake 3.0.0 generating VS sln file default target
machine type x86 (UNCLASSIFIED)
Post by Su, Simon M CTR USARMY ARL (US)
Classification: UNCLASSIFIED
Caveats: NONE
For some reason, when running cmake in VS2013 (express) x64 Cross
Tools Command Prompt is not picking up the Visual Studio 12 2013 Win64
generator by default for this project. But when I added
-G "Visual Studio 12 2013 Win64"
To cmake, it generated x64 project files and I am able to generate
64bit library from command line with msbuild command.
CMake defaults to the newest known and available visual studio generator.

The current visual studio command line environment is neither required for
the visual studio generators nor does it influence which generator CMake
picks.

The environment matters when you are using one of the makefile or ninja
generators though since CMake will then use it to locate the compilers.

Nils

Classification: UNCLASSIFIED
Caveats: NONE
Eric Wing
2014-09-27 04:57:03 UTC
Permalink
Post by Su, Simon M CTR USARMY ARL (US)
Classification: UNCLASSIFIED
Caveats: NONE
For some reason, when running cmake in VS2013 (express) x64 Cross Tools
Command Prompt is not picking up the Visual Studio 12 2013 Win64 generator by
default for this project. But when I added
-G "Visual Studio 12 2013 Win64"
To cmake, it generated x64 project files and I am able to generate 64bit
library from command line with msbuild command.
Thanks
-simon
In my experience, CMake always generates the 32-bit version by default
(and the generator doesn't let you switch in the project). I consider
this extremely annoying. I only have 1 Visual Studio version installed
so it can't be picking up other versions.
Post by Su, Simon M CTR USARMY ARL (US)
-G "Visual Studio 12 2013 Win64"
I always have to use that switch. Aside from picking 64-bit by default
or getting a project generator that correctly allows switching within
the project, I wish there was a way I could just request 64-bit with a
command line switch independently of the Visual Studio version. In the
case where I am working with people with different versions of Visual
Studio and we share build scripts, I have no easy way of controlling
64-bit without knowing exactly which Visual Studio version is
installed.


Thanks,
Eric
--
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
Su, Simon M CTR USARMY ARL (US)
2014-09-29 13:46:01 UTC
Permalink
Classification: UNCLASSIFIED
Caveats: NONE

Thanks for sharing. I guess I originally wanted to ask if there is a switch
to cmake that will allow picking 64-bit by default if 64-bit version is
available.

My understanding is that (for VS2013 Express), if you run things from a
VS2013 x64 Cross Tools Command Prompt, you will get environment setup for
doing all things 64-bit and you will get "Visual Studio 12 2013 Win64" as
default generator when you run cmake from that command prompt. And if you
run from within "Developer Command Prompt for VS2013" command prompt, you
will get all the 32-bit environment setup and get "Visual Studio 12 2013" as
default generator.

However, for CMakeLists.txt in the openmpi-1.4.4 project, it is not picking
up "Visual Studio 12 2013 Win64" generator by default even if you run cmake
from a VS2013 x64 Cross Tools Command Prompt. Most of my other cmakefied
projects will pick "Visual Studio 12 2013 Win64" as default generator when
ran from within VS2013 x64 Cross Tools Command Prompt.

But if I have to specifically include the switch -G "Visual Studio 12 2013
Win64" to get the 64-bit project, I am also ok with it.

Thanks
-simon


-----Original Message-----
From: Eric Wing [mailto:***@gmail.com]
Sent: Saturday, September 27, 2014 12:57 AM
To: Su, Simon M CTR USARMY ARL (US)
Cc: Jakub Zakrzewski; ***@cmake.org
Subject: Re: [CMake] cmake 3.0.0 generating VS sln file default target
machine type x86 (UNCLASSIFIED)
Post by Su, Simon M CTR USARMY ARL (US)
Classification: UNCLASSIFIED
Caveats: NONE
For some reason, when running cmake in VS2013 (express) x64 Cross
Tools Command Prompt is not picking up the Visual Studio 12 2013 Win64
generator by default for this project. But when I added
-G "Visual Studio 12 2013 Win64"
To cmake, it generated x64 project files and I am able to generate
64bit library from command line with msbuild command.
Thanks
-simon
In my experience, CMake always generates the 32-bit version by default (and
the generator doesn't let you switch in the project). I consider this
extremely annoying. I only have 1 Visual Studio version installed so it
can't be picking up other versions.
Post by Su, Simon M CTR USARMY ARL (US)
-G "Visual Studio 12 2013 Win64"
I always have to use that switch. Aside from picking 64-bit by default or
getting a project generator that correctly allows switching within the
project, I wish there was a way I could just request 64-bit with a command
line switch independently of the Visual Studio version. In the case where I
am working with people with different versions of Visual Studio and we share
build scripts, I have no easy way of controlling 64-bit without knowing
exactly which Visual Studio version is installed.


Thanks,
Eric
--
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/

Classification: UNCLASSIFIED
Caveats: NONE
Nils Gladitz
2014-09-29 13:54:11 UTC
Permalink
Post by Su, Simon M CTR USARMY ARL (US)
Classification: UNCLASSIFIED
Caveats: NONE
Thanks for sharing. I guess I originally wanted to ask if there is a switch
to cmake that will allow picking 64-bit by default if 64-bit version is
available.
My understanding is that (for VS2013 Express), if you run things from a
VS2013 x64 Cross Tools Command Prompt, you will get environment setup for
doing all things 64-bit and you will get "Visual Studio 12 2013 Win64" as
default generator when you run cmake from that command prompt. And if you
run from within "Developer Command Prompt for VS2013" command prompt, you
will get all the 32-bit environment setup and get "Visual Studio 12 2013" as
default generator.
Like I tried to explain this is not the case.

The command line environment doesn't have any effect on which generator
CMake will pick.

When you run CMake from a plain "cmd" or a "Visual Studio 8 2005"
command prompt you will still end up with the "Visual Studio 12 2013"
generator by default (assuming 2013 is the newest available and known
visual studio installation).

Nils
Su, Simon M CTR USARMY ARL (US)
2014-09-29 14:02:34 UTC
Permalink
Classification: UNCLASSIFIED
Caveats: NONE

You are right Nils. I just tried cmake vtk projects with VS2013 x64 Cross
Tools Command Prompt and it is not picking the "Visual Studio 12 2013
Win64" generator. But why some of them do? Actually out of 10 cmake projects
I build, 8 of them actually picked "Visual Studio 12 2013 Win64" generator
by default. Or have I just been lucky so far. I guess using the switch -G
"Visual Studio 12 2013 Win64" won't hurt.

Thanks
-simon

-----Original Message-----
From: Nils Gladitz [mailto:***@gmail.com]
Sent: Monday, September 29, 2014 9:54 AM
To: Su, Simon M CTR USARMY ARL (US); Eric Wing
Cc: ***@cmake.org
Subject: Re: [CMake] cmake 3.0.0 generating VS sln file default target
machine type x86 (UNCLASSIFIED)
Post by Su, Simon M CTR USARMY ARL (US)
Classification: UNCLASSIFIED
Caveats: NONE
Thanks for sharing. I guess I originally wanted to ask if there is a
switch to cmake that will allow picking 64-bit by default if 64-bit
version is available.
My understanding is that (for VS2013 Express), if you run things from a
VS2013 x64 Cross Tools Command Prompt, you will get environment setup
for doing all things 64-bit and you will get "Visual Studio 12 2013
Win64" as default generator when you run cmake from that command
prompt. And if you run from within "Developer Command Prompt for
VS2013" command prompt, you will get all the 32-bit environment setup
and get "Visual Studio 12 2013" as default generator.
Like I tried to explain this is not the case.

The command line environment doesn't have any effect on which generator
CMake will pick.

When you run CMake from a plain "cmd" or a "Visual Studio 8 2005"
command prompt you will still end up with the "Visual Studio 12 2013"
generator by default (assuming 2013 is the newest available and known visual
studio installation).

Nils

Classification: UNCLASSIFIED
Caveats: NONE
Nils Gladitz
2014-09-29 14:10:19 UTC
Permalink
Post by Su, Simon M CTR USARMY ARL (US)
Classification: UNCLASSIFIED
Caveats: NONE
You are right Nils. I just tried cmake vtk projects with VS2013 x64 Cross
Tools Command Prompt and it is not picking the "Visual Studio 12 2013
Win64" generator. But why some of them do? Actually out of 10 cmake projects
I build, 8 of them actually picked "Visual Studio 12 2013 Win64" generator
by default. Or have I just been lucky so far. I guess using the switch -G
"Visual Studio 12 2013 Win64" won't hurt.
The only thing I can think of is that you either are looking at build
directories which are already configured (you can not change the
generator of an existing build directory and rerunning cmake without -G
will not change the generator currently in use)

or

You aren't invoking CMake yourself and whatever invokes CMake is picking
the generator for you (might also be the case when you've got CMake
invoking another CMake instance e.g. in context of an ExternalProject).

Nils
Su, Simon M CTR USARMY ARL (US)
2014-09-29 14:19:44 UTC
Permalink
Classification: UNCLASSIFIED
Caveats: NONE

Thanks
-simon

-----Original Message-----
From: Nils Gladitz [mailto:***@gmail.com]
Sent: Monday, September 29, 2014 10:10 AM
To: Su, Simon M CTR USARMY ARL (US); Eric Wing
Cc: ***@cmake.org
Subject: Re: [CMake] cmake 3.0.0 generating VS sln file default target
machine type x86 (UNCLASSIFIED)
Post by Su, Simon M CTR USARMY ARL (US)
Classification: UNCLASSIFIED
Caveats: NONE
You are right Nils. I just tried cmake vtk projects with VS2013 x64
Cross Tools Command Prompt and it is not picking the "Visual Studio
12 2013 Win64" generator. But why some of them do? Actually out of 10
cmake projects I build, 8 of them actually picked "Visual Studio 12
2013 Win64" generator by default. Or have I just been lucky so far. I
guess using the switch -G "Visual Studio 12 2013 Win64" won't hurt.
The only thing I can think of is that you either are looking at build
directories which are already configured (you can not change the generator
of an existing build directory and rerunning cmake without -G will not
change the generator currently in use)

or

You aren't invoking CMake yourself and whatever invokes CMake is picking
the generator for you (might also be the case when you've got CMake
invoking another CMake instance e.g. in context of an ExternalProject).

Nils

Classification: UNCLASSIFIED
Caveats: NONE
David Cole
2014-09-29 14:22:38 UTC
Permalink
Also, the default in cmake-gui is to prompt the user with "the same
generator you used last time" as the default value for 2nd and
subsequent runs of cmake-gui on any given machine by a given user...

So if you choose Win64 once in cmake-gui, and you always use
cmake-gui... you'll get it as the default combo-box choice for any new
build trees after that.
Post by Nils Gladitz
Post by Su, Simon M CTR USARMY ARL (US)
Classification: UNCLASSIFIED
Caveats: NONE
You are right Nils. I just tried cmake vtk projects with VS2013 x64 Cross
Tools Command Prompt and it is not picking the "Visual Studio 12 2013
Win64" generator. But why some of them do? Actually out of 10 cmake projects
I build, 8 of them actually picked "Visual Studio 12 2013 Win64" generator
by default. Or have I just been lucky so far. I guess using the switch -G
"Visual Studio 12 2013 Win64" won't hurt.
The only thing I can think of is that you either are looking at build
directories which are already configured (you can not change the generator
of an existing build directory and rerunning cmake without -G will not
change the generator currently in use)
or
You aren't invoking CMake yourself and whatever invokes CMake is picking the
generator for you (might also be the case when you've got CMake invoking
another CMake instance e.g. in context of an ExternalProject).
Nils
--
Powered by www.kitware.com
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://public.kitware.com/mailman/listinfo/cmake
J Decker
2014-09-29 14:43:03 UTC
Permalink
automatic selection
1) use a batch file and test things like %PROCESSOR_ARCHITECTURE% and
generate a cmake -g "<appropriate environment>"
2) write a cmake script that does the test. and runs an appropraite cmake
command specifying the generator

instead of using msbuild, you can use 'cmake --build . --config Debug
--target INSTALL -- /m:4 /v:m' (for instance)

while I find it annoying that VS tests come from the registry, and
therefore are always available, pre-empting that you have gcc in the path
and not devenv... it has to default to something.

Loading...