FindBoost: Test `CMAKE_CXX_COMPILER_{ID,VERSION}` instead of `MSVC*`

This commit is contained in:
Alex Turbov 2016-06-03 13:29:42 +07:00 committed by Brad King
parent cf12e4abcd
commit 3720d5f4a3
1 changed files with 22 additions and 19 deletions

View File

@ -442,24 +442,26 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret)
endif() endif()
elseif (GHSMULTI) elseif (GHSMULTI)
set(_boost_COMPILER "-ghs") set(_boost_COMPILER "-ghs")
elseif (MSVC14) elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19)
set(_boost_COMPILER "-vc140") set(_boost_COMPILER "-vc140")
elseif (MSVC12) elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18)
set(_boost_COMPILER "-vc120") set(_boost_COMPILER "-vc120")
elseif (MSVC11) elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17)
set(_boost_COMPILER "-vc110") set(_boost_COMPILER "-vc110")
elseif (MSVC10) elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
set(_boost_COMPILER "-vc100") set(_boost_COMPILER "-vc100")
elseif (MSVC90) elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15)
set(_boost_COMPILER "-vc90") set(_boost_COMPILER "-vc90")
elseif (MSVC80) elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
set(_boost_COMPILER "-vc80") set(_boost_COMPILER "-vc80")
elseif (MSVC71) elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.10)
set(_boost_COMPILER "-vc71") set(_boost_COMPILER "-vc71")
elseif (MSVC70) # Good luck! elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) # Good luck!
set(_boost_COMPILER "-vc7") # yes, this is correct set(_boost_COMPILER "-vc7") # yes, this is correct
elseif (MSVC60) # Good luck! else() # MSVC60 Good luck!
set(_boost_COMPILER "-vc6") # yes, this is correct set(_boost_COMPILER "-vc6") # yes, this is correct
endif()
elseif (BORLAND) elseif (BORLAND)
set(_boost_COMPILER "-bcb") set(_boost_COMPILER "-bcb")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
@ -1261,7 +1263,8 @@ endif()
# g using debug versions of the standard and runtime # g using debug versions of the standard and runtime
# support libraries # support libraries
if(WIN32 AND Boost_USE_DEBUG_RUNTIME) if(WIN32 AND Boost_USE_DEBUG_RUNTIME)
if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC"
OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g") set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g")
endif() endif()