Add support for installing more than one MSVC toolset

This commit is contained in:
Peter Dimov 2017-07-02 03:26:31 +03:00
parent 1d6bfd0990
commit 504fbcda34
2 changed files with 62 additions and 3 deletions

View file

@ -0,0 +1,35 @@
#
# BoostDetectToolset: defines BOOST_DETECTED_TOOLSET
#
# Copyright 2017 Peter Dimov
#
# Distributed under the Boost Software License 1.0
#
set(BOOST_DETECTED_TOOLSET "")
if(MSVC)
if(MSVC_VERSION EQUAL 1910)
set(BOOST_DETECTED_TOOLSET "vc141")
elseif(MSVC_VERSION EQUAL 1900)
set(BOOST_DETECTED_TOOLSET "vc140")
elseif(MSVC_VERSION EQUAL 1800)
set(BOOST_DETECTED_TOOLSET "vc120")
elseif(MSVC_VERSION EQUAL 1700)
set(BOOST_DETECTED_TOOLSET "vc110")
elseif(MSVC_VERSION EQUAL 1600)
set(BOOST_DETECTED_TOOLSET "vc100")
elseif(MSVC_VERSION EQUAL 1500)
set(BOOST_DETECTED_TOOLSET "vc90")
elseif(MSVC_VERSION EQUAL 1400)
set(BOOST_DETECTED_TOOLSET "vc80")
elseif(MSVC_VERSION EQUAL 1310)
set(BOOST_DETECTED_TOOLSET "vc71")
elseif(MSVC_VERSION EQUAL 1300)
set(BOOST_DETECTED_TOOLSET "vc7")
elseif(MSVC_VERSION EQUAL 1200)
set(BOOST_DETECTED_TOOLSET "vc6")
endif()
elseif(MINGW)
set(BOOST_DETECTED_TOOLSET "mgw")
endif()

View file

@ -17,6 +17,7 @@ import "class" : new ;
import feature ;
import toolset ;
import regex ;
import common ;
if "--debug-cmake" in [ modules.peek : ARGV ]
{
@ -117,6 +118,9 @@ local rule generate-config ( target type )
")"
""
"get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)"
""
"include(${_DIR}/../BoostDetectToolset-$(BOOST_VERSION).cmake)"
""
"file(GLOB CONFIG_FILES "${_DIR}/libboost_$(name)-config-variant*.cmake")"
"foreach(f ${CONFIG_FILES})"
" include(${f})"
@ -275,11 +279,23 @@ rule generate-config-variant- ( target : sources * : properties * )
print.text "# runtime-debugging=$(runtime-debugging)" "" : true ;
local toolset = [ $(ps).get <toolset> ] ;
local toolset = [ MATCH ^-(.*) : [ common.format-name <toolset> : "" : "" : $(ps) ] ] ;
.info generate-config-variant-: toolset is $(toolset) ;
print.text "# toolset=$(toolset)" "" : true ;
print.text
"if(NOT \"${BOOST_TOOLSET}\" STREQUAL \"\")"
" if(NOT \"${BOOST_TOOLSET}\" STREQUAL \"$(toolset)\")"
" return()"
" endif()"
"elseif(NOT \"${BOOST_DETECTED_TOOLSET}\" STREQUAL \"\" AND NOT \"${BOOST_DETECTED_TOOLSET}\" STREQUAL \"$(toolset)\")"
" return()"
"endif()"
""
: true ;
local name = [ MATCH boost_(.*)-config-variant-.*cmake : $(target) ] ;
.info generate-config-variant-: name is $(name) ;
@ -445,12 +461,20 @@ for dir in $(library-dirs)
explicit $(dir)-install ;
}
# BoostDetectToolset.cmake
install BoostDetectToolset-stage : BoostDetectToolset.cmake : <name>BoostDetectToolset-$(BOOST_VERSION).cmake <location>$(BOOST_STAGE_LOCATE)/lib/cmake ;
explicit BoostDetectToolset-stage ;
install BoostDetectToolset-install : BoostDetectToolset.cmake : <name>BoostDetectToolset-$(BOOST_VERSION).cmake <location>$(libdir)/cmake ;
explicit BoostDetectToolset-install ;
# stage
alias stage : $(library-dirs)-stage ;
alias stage : BoostDetectToolset-stage $(library-dirs)-stage ;
explicit stage ;
# install
alias install : $(library-dirs)-install ;
alias install : BoostDetectToolset-install $(library-dirs)-install ;
explicit install ;