blob: fed78194d2faea19f50f2dabc0157f419d6e45d3 [file] [log] [blame]
Brian Silverman72890c22015-09-19 14:37:37 -04001include(CMakeDetermineVSServicePack)
2
3# The code is almost identical to the CMake version. The only difference is that we remove
4# _DetermineVSServicePack_FastCheckVersionWithCompiler which lead to errors on some systems.
5function(EigenDetermineVSServicePack _pack)
6 if(NOT DETERMINED_VS_SERVICE_PACK OR NOT ${_pack})
Brian Silverman72890c22015-09-19 14:37:37 -04007 if(NOT DETERMINED_VS_SERVICE_PACK)
8 _DetermineVSServicePack_CheckVersionWithTryCompile(DETERMINED_VS_SERVICE_PACK _cl_version)
9 if(NOT DETERMINED_VS_SERVICE_PACK)
10 _DetermineVSServicePack_CheckVersionWithTryRun(DETERMINED_VS_SERVICE_PACK _cl_version)
11 endif()
12 endif()
13
14 if(DETERMINED_VS_SERVICE_PACK)
Brian Silverman72890c22015-09-19 14:37:37 -040015 if(_cl_version)
16 # Call helper function to determine VS version
17 _DetermineVSServicePackFromCompiler(_sp "${_cl_version}")
Austin Schuh189376f2018-12-20 22:11:15 +110018
19 # temporary fix, until CMake catches up
20 if (NOT _sp)
21 if(${_cl_version} VERSION_EQUAL "17.00.50727.1")
22 set(_sp "vc110")
23 elseif(${_cl_version} VERSION_EQUAL "17.00.51106.1")
24 set(_sp "vc110sp1")
25 elseif(${_cl_version} VERSION_EQUAL "17.00.60315.1")
26 set(_sp "vc110sp2")
27 elseif(${_cl_version} VERSION_EQUAL "17.00.60610.1")
28 set(_sp "vc110sp3")
29 else()
30 set(_sp ${CMAKE_CXX_COMPILER_VERSION})
31 endif()
32 endif()
33
Brian Silverman72890c22015-09-19 14:37:37 -040034 if(_sp)
35 set(${_pack} ${_sp} CACHE INTERNAL
36 "The Visual Studio Release with Service Pack")
37 endif()
38 endif()
39 endif()
40 endif()
41endfunction()