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
8        if(NOT DETERMINED_VS_SERVICE_PACK)
9            _DetermineVSServicePack_CheckVersionWithTryCompile(DETERMINED_VS_SERVICE_PACK _cl_version)
10            if(NOT DETERMINED_VS_SERVICE_PACK)
11                _DetermineVSServicePack_CheckVersionWithTryRun(DETERMINED_VS_SERVICE_PACK _cl_version)
12            endif()
13        endif()
14
15        if(DETERMINED_VS_SERVICE_PACK)
16
17            if(_cl_version)
18                # Call helper function to determine VS version
19                _DetermineVSServicePackFromCompiler(_sp "${_cl_version}")
20                if(_sp)
21                    set(${_pack} ${_sp} CACHE INTERNAL
22                        "The Visual Studio Release with Service Pack")
23                endif()
24            endif()
25        endif()
26    endif()
27endfunction()
28