Skip to content

Commit 01b8f18

Browse files
committed
cmake/boost.cmake: fixes search path for (linked) boost package if build in sub-directory (take a look into include/boost before include);
otherwise `mkdir Release_x64; cmake -S .. -B .` may fail, because it cannot find linked boost folder.
1 parent 64a995b commit 01b8f18

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmake/boost.cmake

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@ set(BOOST_NO_BOOST_CMAKE ON)
1313

1414
unset(Boost_INCLUDE_DIR CACHE)
1515
# we might have boost in tree, so provide a hint and try again
16-
set(BOOST_INCLUDEDIR "${PROJECT_SOURCE_DIR}/include")
16+
set(BOOST_INCLUDEDIR "${PROJECT_SOURCE_DIR}/include/boost")
1717
find_package(Boost ${BOOST_MINVERSION} QUIET)
1818
if(NOT Boost_FOUND)
19+
set(BOOST_INCLUDEDIR "${PROJECT_SOURCE_DIR}/include")
20+
find_package(Boost ${BOOST_MINVERSION} QUIET)
21+
if(NOT Boost_FOUND)
1922
# otherwise check for Boost installed on the system
2023
unset(BOOST_INCLUDEDIR)
2124
find_package(Boost ${BOOST_MINVERSION} QUIET)
2225
if(NOT Boost_FOUND)
2326
message(FATAL_ERROR "Boost ${BOOST_MINVERSION} or later not found. Either install system packages if available, extract Boost headers to ${CMAKE_SOURCE_DIR}/include, or set the CMake BOOST_ROOT variable.")
2427
endif()
28+
endif()
2529
endif()
2630

2731
message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")

0 commit comments

Comments
 (0)