Brian Silverman | 72890c2 | 2015-09-19 14:37:37 -0400 | [diff] [blame] | 1 | include(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. |
| 5 | function(EigenDetermineVSServicePack _pack) |
| 6 | if(NOT DETERMINED_VS_SERVICE_PACK OR NOT ${_pack}) |
Brian Silverman | 72890c2 | 2015-09-19 14:37:37 -0400 | [diff] [blame] | 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) |
Brian Silverman | 72890c2 | 2015-09-19 14:37:37 -0400 | [diff] [blame] | 15 | if(_cl_version) |
| 16 | # Call helper function to determine VS version |
| 17 | _DetermineVSServicePackFromCompiler(_sp "${_cl_version}") |
Austin Schuh | 189376f | 2018-12-20 22:11:15 +1100 | [diff] [blame] | 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 | |
Brian Silverman | 72890c2 | 2015-09-19 14:37:37 -0400 | [diff] [blame] | 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() |
| 41 | endfunction() |