xref: /aosp_15_r20/external/eigen/cmake/EigenDetermineVSServicePack.cmake (revision bf2c37156dfe67e5dfebd6d394bad8b2ab5804d4)
1*bf2c3715SXin Liinclude(CMakeDetermineVSServicePack)
2*bf2c3715SXin Li
3*bf2c3715SXin Li# The code is almost identical to the CMake version. The only difference is that we remove
4*bf2c3715SXin Li# _DetermineVSServicePack_FastCheckVersionWithCompiler which lead to errors on some systems.
5*bf2c3715SXin Lifunction(EigenDetermineVSServicePack _pack)
6*bf2c3715SXin Li    if(NOT DETERMINED_VS_SERVICE_PACK OR NOT ${_pack})
7*bf2c3715SXin Li        if(NOT DETERMINED_VS_SERVICE_PACK)
8*bf2c3715SXin Li            _DetermineVSServicePack_CheckVersionWithTryCompile(DETERMINED_VS_SERVICE_PACK _cl_version)
9*bf2c3715SXin Li            if(NOT DETERMINED_VS_SERVICE_PACK)
10*bf2c3715SXin Li                _DetermineVSServicePack_CheckVersionWithTryRun(DETERMINED_VS_SERVICE_PACK _cl_version)
11*bf2c3715SXin Li            endif()
12*bf2c3715SXin Li        endif()
13*bf2c3715SXin Li
14*bf2c3715SXin Li        if(DETERMINED_VS_SERVICE_PACK)
15*bf2c3715SXin Li            if(_cl_version)
16*bf2c3715SXin Li                # Call helper function to determine VS version
17*bf2c3715SXin Li                _DetermineVSServicePackFromCompiler(_sp "${_cl_version}")
18*bf2c3715SXin Li
19*bf2c3715SXin Li                # temporary fix, until CMake catches up
20*bf2c3715SXin Li                if (NOT _sp)
21*bf2c3715SXin Li                    if(${_cl_version} VERSION_EQUAL "17.00.50727.1")
22*bf2c3715SXin Li                        set(_sp "vc110")
23*bf2c3715SXin Li                    elseif(${_cl_version} VERSION_EQUAL "17.00.51106.1")
24*bf2c3715SXin Li                        set(_sp "vc110sp1")
25*bf2c3715SXin Li                    elseif(${_cl_version} VERSION_EQUAL "17.00.60315.1")
26*bf2c3715SXin Li                        set(_sp "vc110sp2")
27*bf2c3715SXin Li                    elseif(${_cl_version} VERSION_EQUAL "17.00.60610.1")
28*bf2c3715SXin Li                        set(_sp "vc110sp3")
29*bf2c3715SXin Li                    else()
30*bf2c3715SXin Li                        set(_sp ${CMAKE_CXX_COMPILER_VERSION})
31*bf2c3715SXin Li                    endif()
32*bf2c3715SXin Li                endif()
33*bf2c3715SXin Li
34*bf2c3715SXin Li                if(_sp)
35*bf2c3715SXin Li                    set(${_pack} ${_sp} CACHE INTERNAL
36*bf2c3715SXin Li                        "The Visual Studio Release with Service Pack")
37*bf2c3715SXin Li                endif()
38*bf2c3715SXin Li            endif()
39*bf2c3715SXin Li        endif()
40*bf2c3715SXin Li    endif()
41*bf2c3715SXin Liendfunction()
42