2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-22 09:57:21 +01:00

Force XP toolchain in newer Visual Studio

This commit is contained in:
Alibek Omarov 2018-03-04 00:12:44 +03:00
parent ccbc147c90
commit 4538ba1c19
2 changed files with 35 additions and 0 deletions

View File

@ -21,6 +21,12 @@
# #
cmake_minimum_required(VERSION 2.6.0) cmake_minimum_required(VERSION 2.6.0)
# Install custom module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
include(VSForceXPToolchain) # Force XP toolchain for Visual Studio
project (HLSDK-XASH3D) project (HLSDK-XASH3D)
#-------------- #--------------

View File

@ -0,0 +1,29 @@
if(WIN32)
# Windows XP compatible platform toolset. Must be set before project(),
# otherwise change of CMAKE_*_TOOLSET will take no effect.
# We get VS version from the generator name because neither MSVC* nor other
# variables that describe the compiler aren't available before project().
if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([0-9]+)")
if(${CMAKE_MATCH_1} LESS 11)
# Nothing. Older VS does support XP by default.
elseif(${CMAKE_MATCH_1} EQUAL 11)
# Visual Studio 11 2012
set(CMAKE_GENERATOR_TOOLSET "v110_xp" CACHE STRING "CMAKE_GENERATOR_TOOLSET" FORCE)
set(CMAK_VS_PLATFORM_TOOLSET "v110_xp" CACHE STRING "CMAKE_VS_PLATFORM_TOOLSET" FORCE)
elseif (${CMAKE_MATCH_1} EQUAL 12)
# Visual Studio 12 2013
set(CMAKE_GENERATOR_TOOLSET "v120_xp" CACHE STRING "CMAKE_GENERATOR_TOOLSET" FORCE)
set(CMAKE_VS_PLATFORM_TOOLSET "v120_xp" CACHE STRING "CMAKE_VS_PLATFORM_TOOLSET" FORCE)
elseif (${CMAKE_MATCH_1} EQUAL 14)
# Visual Studio 14 2015
set(CMAKE_GENERATOR_TOOLSET "v140_xp" CACHE STRING "CMAKE_GENERATOR_TOOLSET" FORCE)
set(CMAKE_VS_PLATFORM_TOOLSET "v140_xp" CACHE STRING "CMAKE_VS_PLATFORM_TOOLSET" FORCE)
elseif (${CMAKE_MATCH_1} EQUAL 15)
# Visual Studio 15 2017
set(CMAKE_GENERATOR_TOOLSET "v141_xp" CACHE STRING "CMAKE_GENERATOR_TOOLSET" FORCE)
set(CMAKE_VS_PLATFORM_TOOLSET "v141_xp" CACHE STRING "CMAKE_VS_PLATFORM_TOOLSET" FORCE)
else()
message(WARNING "WARNING: You maybe building without Windows XP compability. See which toolchain version Visual Studio provides, and say cmake to use it: cmake -G \"Visual Studio XX\" -T \"vXXX_xp\"")
endif()
endif()
endif()