summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoseph Donofry <red.sky@nheko.im>2019-11-01 21:30:56 +0000
committerJoseph Donofry <red.sky@nheko.im>2019-11-01 21:30:56 +0000
commitbdf6e2b0280d0825aa36394d1fb08f3cc30f8a0c (patch)
tree2263bbf960872474e296bf3fb92c410ac405694d
parentTry to fix slow macos build (diff)
downloadnheko-bdf6e2b0280d0825aa36394d1fb08f3cc30f8a0c.tar.xz
Fix boost build in FreeBSD
-rw-r--r--deps/cmake/Boost.cmake5
-rw-r--r--deps/cmake/BoostToolsetId.cmake35
2 files changed, 40 insertions, 0 deletions
diff --git a/deps/cmake/Boost.cmake b/deps/cmake/Boost.cmake
index 47eb723b..5d11fd93 100644
--- a/deps/cmake/Boost.cmake
+++ b/deps/cmake/Boost.cmake
@@ -3,6 +3,10 @@ if(WIN32)
   return()
 endif()
 
+include(BoostToolsetId)
+set(BOOST_TOOLSET "gcc")
+Boost_Get_ToolsetId(BOOST_TOOLSET)
+
 ExternalProject_Add(
   Boost
 
@@ -16,6 +20,7 @@ ExternalProject_Add(
   CONFIGURE_COMMAND ${DEPS_BUILD_DIR}/boost/bootstrap.sh
     --with-libraries=random,thread,system,iostreams,atomic,chrono,date_time,regex
     --prefix=${DEPS_INSTALL_DIR}
+    --with-toolset=${BOOST_TOOLSET}
   BUILD_COMMAND ${DEPS_BUILD_DIR}/boost/b2 -d0 cxxstd=14 variant=release link=shared runtime-link=shared threading=multi --layout=system
   INSTALL_COMMAND ${DEPS_BUILD_DIR}/boost/b2 -d0 install
 )
diff --git a/deps/cmake/BoostToolsetId.cmake b/deps/cmake/BoostToolsetId.cmake
new file mode 100644
index 00000000..f6c231a5
--- /dev/null
+++ b/deps/cmake/BoostToolsetId.cmake
@@ -0,0 +1,35 @@
+# - Translate CMake compilers to the Boost.Build toolset equivalents
+# To build Boost reliably when a non-system compiler may be used, we
+# need to both specify the toolset when running bootstrap.sh *and* in
+# the user-config.jam file.
+#
+# This module provides the following functions to help translate between
+# the systems:
+#
+#  function Boost_Get_ToolsetId(<var>)
+#           Set var equal to Boost's name for the CXX toolchain picked
+#           up by CMake. Only supports GNU and Clang families at present.
+#           Intel support is provisional
+#
+# downloaded from https://github.com/drbenmorgan/BoostBuilder/blob/master/BoostToolsetId.cmake
+
+function(Boost_Get_ToolsetId _var)
+  set(BOOST_TOOLSET)
+
+  if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+    if(APPLE)
+      set(BOOST_TOOLSET "darwin")
+    else()
+      set(BOOST_TOOLSET "gcc")
+    endif()
+  elseif(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
+    set(BOOST_TOOLSET "clang")
+  elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
+    set(BOOST_TOOLSET "intel")
+  elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
+    set(BOOST_TOOLSET "msvc")
+  endif()
+
+  set(${_var} ${BOOST_TOOLSET} PARENT_SCOPE)
+endfunction()
+