Skip to content

Commit

Permalink
Add switch to build boost without python support
Browse files Browse the repository at this point in the history
  • Loading branch information
koudis committed Jan 11, 2025
1 parent bedb512 commit bef3587
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.18)
PROJECT(CMAKE_BOOST CXX)

OPTION(WITHOUT_PYTHON "If ON Boost is build without Python, If off, with python" OFF)

IF(NOT BOOST_VERSION)
MESSAGE(FATAL_ERROR "Boost version variable BOOST_VERSION not specified!!")
ENDIF()
Expand Down Expand Up @@ -49,10 +51,15 @@ EXECUTE_PROCESS(
COMMAND ${CMAKE_COMMAND} -E tar xjf ${archive_path}
WORKING_DIRECTORY ${extracted_archive_path}
)
SET(boost_sources "${extracted_archive_path}/boost_${BOOST_VERSION_UNDERSCORE}")
SET(boost_sources "${extracted_archive_path}/boost_${BOOST_VERSION_UNDERSCORE}")

MESSAGE(STATUS ${boost_sources})

SET(extra_b2_args)
IF(WITHOUT_PYTHON)
LIST(APPEND extra_b2_args "--without-python")
ENDIF()

ADD_CUSTOM_COMMAND(OUTPUT "${boost_sources}/b2"
MAIN_DEPENDENCY "${boost_sources}"
COMMAND ./bootstrap.sh
Expand All @@ -64,8 +71,9 @@ ADD_CUSTOM_COMMAND(
OUTPUT "${BOOST_INSTALL_DIR}"
MAIN_DEPENDENCY "${boost_sources}"
DEPENDS "${boost_sources}/b2"
COMMAND ./b2 --prefix="${BOOST_INSTALL_DIR}"
--without-python
COMMAND ./b2
${extra_b2_args}
--prefix="${BOOST_INSTALL_DIR}"
runtime-link=shared,static
link=shared,static
variant=$<$<CONFIG:Debug>:debug>$<$<CONFIG:Release>:release>
Expand Down

0 comments on commit bef3587

Please sign in to comment.