Michael Dec
Michael Dec

Reputation: 31

How to target Windows XP with MSVC2017 and CMake?

I wanted to accomplish what other 2 threads are doing, but with latest MSVC to support targetting Windows XP and CMake support.

I keep following the advice given in How can I generate a Visual Studio 2012 project targeting Windows XP with CMake? and How does CMake specify "Platform Toolset" for a Visual Studio 2015 project? but CMake keeps telling me that it configured the source code for Windows 10.foo.bar SDK version which is not going to work. I tried hamfisting v141_xp into the project as CMAKE_GENERATOR_TOOLSET and -T parameter for cmake but it all ultimately fails. How can I accomplish this? And if possible, where can I specify this in CMakeSettings.json?

Bonus points for amd64 support, since the target system I want to make binaries for is Windows XP x64.

For what it's worth, I have tried to open a .sln file and I confirm that v141_xp is available as a platform toolset.

Upvotes: 1

Views: 1273

Answers (1)

Michael Dec
Michael Dec

Reputation: 31

I figured it out on my own. From x64 tools console:

  1. Prepare .sln files
cmake path/to/CMakeLists.txt -G "Visual Studio 15 2017 Win64" -A x64 -T v141_xp
  1. Build from .sln:
msbuild path/to/.sln /p:XPDeprecationWarning=false /p:Platform=x64

Upvotes: 2

Related Questions