• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1include(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})
7        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)
15            if(_cl_version)
16                # Call helper function to determine VS version
17                _DetermineVSServicePackFromCompiler(_sp "${_cl_version}")
18
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
34                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()
42