blob: fed78194d2faea19f50f2dabc0157f419d6e45d3 [file] [log] [blame]
Carlos Hernandez7faaa9f2014-08-05 17:53:32 -07001include(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})
Carlos Hernandez7faaa9f2014-08-05 17:53:32 -07007 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)
Carlos Hernandez7faaa9f2014-08-05 17:53:32 -070015 if(_cl_version)
16 # Call helper function to determine VS version
17 _DetermineVSServicePackFromCompiler(_sp "${_cl_version}")
Miao Wang2b8756b2017-03-06 13:45:08 -080018
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
Carlos Hernandez7faaa9f2014-08-05 17:53:32 -070034 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()