Skip to content

Commit 860a78f

Browse files
committed
fix: enhance Boost CMake configuration for environment variable support
- Added a check in bin/CMakeLists.txt to set Boost_ROOT from the BOOSTROOT environment variable if not already defined. - Corrected the setting of the BOOSTROOT environment variable in lib/boost/CMakeLists.txt to ensure proper usage.
1 parent a30d3f7 commit 860a78f

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

bin/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ set(Boost_USE_STATIC_LIBS ON)
44
set(Boost_USE_STATIC_RUNTIME ON)
55
set(BOOST_ALL_DYN_LINK OFF)
66

7+
if (NOT Boost_ROOT AND EXISTS $ENV{BOOSTROOT})
8+
set(Boost_ROOT $ENV{BOOSTROOT})
9+
endif()
10+
711
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
812
find_package(Boost REQUIRED)
913

lib/boost/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ set(BOOST_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/boost_${BOOST_VERSION_UNDERSCO
1212
# b2 stage (default) puts libs in <source>/stage/lib or stage/lib/<variant>/, headers stay in <source>
1313
set(BOOST_STAGE_DIR "${BOOST_SOURCE_DIR}/stage")
1414
set(BOOST_STAGE_LIB_DIR "${BOOST_SOURCE_DIR}/stage/lib")
15-
set($ENV{BOOSTROOT} ${BOOST_SOURCE_DIR})
15+
set(ENV{BOOSTROOT} ${BOOST_SOURCE_DIR})
1616

1717
# If we already built Boost here (stage), use it directly and skip find_package/build
1818
if(EXISTS "${BOOST_SOURCE_DIR}/boost/version.hpp")
@@ -63,7 +63,7 @@ if(NOT Boost_FOUND)
6363
WORKING_DIRECTORY ${BOOST_SOURCE_DIR}
6464
)
6565

66-
set(Boost_INCLUDE_DIRS "${BOOST_SOURCE_DIR}")
66+
set(Boost_ROOT "${BOOST_SOURCE_DIR}")
6767
find_package(Boost 1.83 QUIET)
6868
else()
6969
message(STATUS "Boost found in the system.")

0 commit comments

Comments
 (0)