Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I generate a Visual Studio 2012 project targeting Windows XP with CMake?

With Visual Studio 2012 Update 1 released, I am hoping to build a C++ project to support Windows XP. Is there a way to use CMake to generate a project that targets Windows XP? Basically CMake would need to generate a project file that uses Platform Toolset = Visual Studio 2012 - Windows XP (v110_xp).

like image 415
Kranar Avatar asked Nov 28 '12 02:11

Kranar


People also ask

How do I create a CMake project in Visual Studio?

Building CMake projects Select the preferred configuration and press F5, or choose the Run (green triangle) button on the toolbar. The project automatically builds first, just like a Visual Studio solution. Right-click on CMakeLists. txt in Solution Explorer and select Build from the context menu.

Is Visual Studio compatible with Windows XP?

The toolset supplied in Visual Studio 2019 and later doesn't include support for creating code for Windows XP. Support for Windows XP development is available by using the Visual Studio 2017 v141_xp toolset. You can install the v141_xp toolset as an individual component option in the Visual Studio Installer.

Do I need CMake with Visual Studio?

CMake is a build tool in a special way. It can create makefiles and build them but you can also tell cmake to create a visual studio solution if you like. The same goes with external programs. They are the choice of the maintainer of the library you use and there are no standards for things like code generation.

Can Visual Studio 2019 run on Windows XP?

Visual Studio 2019 and later versions don't include current toolset support for creating code for Windows XP. Support for Windows XP development by using the v141_xp toolset that shipped in Visual Studio 2017 is still available as an optional component in the Visual Studio Installer.


4 Answers

According to http://www.cmake.org/Bug/view.php?id=10722 the answer is now (soon) yes.

Fixed in Version CMake 2.8.11

A new "generator toolset" feature has been added here:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7dab9977 [^]

One may now run CMake from the command line with

-G "Visual Studio 10" -T "v90"

in order to build with a specific toolset. We've not yet added a first-class interface to cmake-gui for this, but one may add the cache entry "CMAKE_GENERATOR_TOOLSET" to contain the "-T" value before configuring.

like image 198
Jesper Hedlund Avatar answered Oct 21 '22 13:10

Jesper Hedlund


According to http://www.cmake.org/Bug/view.php?id=10722 the answer is no yes.

Update: The bug mentioned above has been resolved with the following comment:

Fixed in Version CMake 2.8.11

A new "generator toolset" feature has been added here:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7dab9977 [^]

One may now run CMake from the command line with

-G "Visual Studio 10" -T "v90"

in order to build with a specific toolset. We've not yet added a first-class interface to cmake-gui for this, but one may add the cache entry "CMAKE_GENERATOR_TOOLSET" to contain the "-T" value before configuring.

You might also look at the comments made to the other answers.

like image 36
Philipp Avatar answered Oct 21 '22 14:10

Philipp


I think you can just generate a Solution for Visual Studio 2010/2012. Open this solution, open the solution/project in visual Studio, open the properties and reconfigure the Platform toolset to v110_xp.

Then you should be fine. But I'm still searching for the solution how to setupo the command line to build v110_xp programs...

like image 1
Torben Dannhauer Avatar answered Oct 21 '22 13:10

Torben Dannhauer


I think the best way to address this problem is use CMake to build your project for Visual Studio 2010 and then open the project with Visual Studio 2012. When you do this the toolset used will be vs2010, which works for WinXP.

like image 1
McLeary Avatar answered Oct 21 '22 14:10

McLeary