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

Kranar picture Kranar · Nov 28, 2012 · Viewed 10.6k times · Source

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).

Answer

Jesper Hedlund picture Jesper Hedlund · Apr 8, 2013

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.