Skip to content

Commit

Permalink
update MSVC cmake variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinat M authored Jun 25, 2019
1 parent ad45169 commit e96788d
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions SuperBuild/External_Boost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,28 +59,34 @@ if(NOT ( DEFINED "USE_SYSTEM_${extProjName}" AND "${USE_SYSTEM_${extProjName}}"
endif()
endif()

if(MSVC10)
list(APPEND Boost_b2_Command toolset=msvc-10.0)
elseif(MSVC11)
list(APPEND Boost_b2_Command toolset=msvc-11.0)
elseif(MSVC12)
list(APPEND Boost_b2_Command toolset=msvc-12.0)
elseif(MSVC14)
list(APPEND Boost_b2_Command toolset=msvc-14.0)
elseif(XCODE_VERSION)
list(APPEND Boost_b2_Command toolset=clang)
if(NOT MSVC_VERSION VERSION_LESS 1400 AND MSVC_VERSION VERSION_LESS 1500)
list(APPEND Boost_b2_Command toolset=msvc-8.0)
elseif(NOT MSVC_VERSION VERSION_LESS 1500 AND MSVC_VERSION VERSION_LESS 1600)
list(APPEND Boost_b2_Command toolset=msvc-9.0)
elseif(NOT MSVC_VERSION VERSION_LESS 1600 AND MSVC_VERSION VERSION_LESS 1700)
list(APPEND Boost_b2_Command toolset=msvc-10.0)
elseif(NOT MSVC_VERSION VERSION_LESS 1700 AND MSVC_VERSION VERSION_LESS 1800)
list(APPEND Boost_b2_Command toolset=msvc-11.0)
elseif(NOT MSVC_VERSION VERSION_LESS 1800 AND MSVC_VERSION VERSION_LESS 1900)
list(APPEND Boost_b2_Command toolset=msvc-12.0)
elseif(NOT MSVC_VERSION VERSION_LESS 1900 AND MSVC_VERSION VERSION_LESS 1910)
list(APPEND Boost_b2_Command toolset=msvc-14.0)
elseif(NOT MSVC_VERSION VERSION_LESS 1910 AND MSVC_VERSION VERSION_LESS 1920)
list(APPEND Boost_b2_Command toolset=msvc-14.1)
elseif(ENV{CC})

This comment has been minimized.

Copy link
@tashrifbillah

tashrifbillah Jun 25, 2019

Collaborator

This is a better approach for LESS/GREATER comparison, more concise and easy to read.

# CMake apprarently puts the full path of the compiler into CC
# The user might specify a non-default gcc compiler through ENV
message(STATUS "ENV{CC}=$ENV{CC}")
get_filename_component( gccToolset "$ENV{CC}" NAME )

# see: https://svn.boost.org/trac/boost/ticket/5917
string(TOLOWER ${gccToolset} gccToolset)
if(gccToolset STREQUAL "cc")
set(gccToolset "gcc")
endif()
list(APPEND Boost_b2_Command toolset=${gccToolset})
message(STATUS "ENV{CC}=$ENV{CC}")
get_filename_component( gccToolset "$ENV{CC}" NAME )

# see: https://svn.boost.org/trac/boost/ticket/5917
string(TOLOWER ${gccToolset} gccToolset)
if(gccToolset STREQUAL "cc")
set(gccToolset "gcc")
endif()
list(APPEND Boost_b2_Command toolset=${gccToolset})
else()
message(FATAL_ERROR "Unknown MSVC compiler version [${MSVC_VERSION}]")
endif()

This comment has been minimized.

Copy link
@tashrifbillah

tashrifbillah Jun 25, 2019

Collaborator

Has anything been done here other than aligning the code segment?


if(CMAKE_SIZEOF_VOID_P EQUAL 8)
Expand Down Expand Up @@ -126,4 +132,3 @@ mark_as_superbuild(
LABELS
"FIND_PACKAGE"
)

0 comments on commit e96788d

Please sign in to comment.