From 8306d2fc67b31aa36df2cb3e4fde3f9907330b9e Mon Sep 17 00:00:00 2001 From: "Sergey G. Brester" Date: Fri, 15 Oct 2021 14:49:24 +0200 Subject: [PATCH] cmake/boost.cmake: fixes search path for (linked) boost package if build in sub-directory (take a look into `include/boost` before `include`); otherwise `cd build/Release_x64; cmake -S ../.. -B .` may fail, because it cannot find linked boost folder. --- cmake/boost.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/boost.cmake b/cmake/boost.cmake index 44b4e8ba6..bb239a7fc 100644 --- a/cmake/boost.cmake +++ b/cmake/boost.cmake @@ -13,15 +13,19 @@ set(BOOST_NO_BOOST_CMAKE ON) unset(Boost_INCLUDE_DIR CACHE) # we might have boost in tree, so provide a hint and try again -set(BOOST_INCLUDEDIR "${PROJECT_SOURCE_DIR}/include") +set(BOOST_INCLUDEDIR "${PROJECT_SOURCE_DIR}/include/boost") find_package(Boost ${BOOST_MINVERSION} QUIET) if(NOT Boost_FOUND) + set(BOOST_INCLUDEDIR "${PROJECT_SOURCE_DIR}/include") + find_package(Boost ${BOOST_MINVERSION} QUIET) + if(NOT Boost_FOUND) # otherwise check for Boost installed on the system unset(BOOST_INCLUDEDIR) find_package(Boost ${BOOST_MINVERSION} QUIET) if(NOT Boost_FOUND) 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.") endif() + endif() endif() message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")