summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Dimov <pdimov@pdimov.com>2017-07-02 03:26:31 +0300
committerPeter Dimov <pdimov@pdimov.com>2017-07-02 03:26:31 +0300
commit504fbcda34fe7fa91c91ef5b26a9e021c338c8f2 (patch)
treeedac5df4a7ca3015ed784198a18e82c9d43cdaaf
parent1d6bfd09902817ed54eb843da51ff781458596bd (diff)
downloadboost-feature/install-cmake-config.tar.gz
Add support for installing more than one MSVC toolsetfeature/install-cmake-config
-rw-r--r--cmake/BoostDetectToolset.cmake35
-rw-r--r--cmake/Jamfile30
2 files changed, 62 insertions, 3 deletions
diff --git a/cmake/BoostDetectToolset.cmake b/cmake/BoostDetectToolset.cmake
new file mode 100644
index 0000000000..7b45d1c53a
--- /dev/null
+++ b/cmake/BoostDetectToolset.cmake
@@ -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()
diff --git a/cmake/Jamfile b/cmake/Jamfile
index b41cd70c26..3f5bf61a52 100644
--- a/cmake/Jamfile
+++ b/cmake/Jamfile
@@ -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 ;