diff --git a/FindBoost.cmake b/FindBoost.cmake index 89c62ff63fddb216eda49c293951cded534cb738..be99c60ad5cb0cd8459efa663584a2548d78c208 100644 --- a/FindBoost.cmake +++ b/FindBoost.cmake @@ -45,16 +45,28 @@ find_path( $ENV{BOOST_INCLUDEDIR} ${CMAKE_CURRENT_LIST_DIR}/external_dependencies/boost - PATHS /usr/include - /home/boost PATH_SUFFIXES boost include ) +# Add path without "boost" include sub-directory to include path, +# as Boost headers are supposed to be included like +# #include<boost/...> according to the documentation +set(TMP "") +if(WIN32) + string(REPLACE "\\boost\\boost" "\\boost" TMP ${Boost_INCLUDE_DIRS}) + list(APPEND Boost_INCLUDE_DIRS ${TMP}) +else() + string(REPLACE "/boost/boost" "/boost" TMP ${Boost_INCLUDE_DIRS}) + list(APPEND Boost_INCLUDE_DIRS ${TMP}) +endif() + +message("Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}") + if(NOT Boost_INCLUDE_DIRS) message(FATAL_ERROR "Boost include directory was not found! Please, set variable BOOST_INCLUDEDIR to the correct path.") endif() @@ -95,17 +107,23 @@ find_path( ${BOOST_LIBRARYDIR} $ENV{BOOST_LIBRARYDIR} ${CMAKE_CURRENT_LIST_DIR}/external_dependencies/boost + ${CMAKE_CURRENT_LIST_DIR}/external_dependencies/boost/stage + ${CMAKE_CURRENT_LIST_DIR}/external_dependencies/boost/stage/lib + PATHS /usr/lib/boost /usr/lib/x86_64-linux-gnu PATH_SUFFIXES - stage/lib lib ) -# Construct list of libraries' names and make them +if(NOT Boost_LIBRARY_DIRS) + message(FATAL_ERROR "Boost library directory was not found! Please, set variable BOOST_LIBRARYDIR to the correct path.") +endif() + + # Construct list of libraries' names and make them # targets, so they may be linked set(Boost_LIBRARIES "") foreach(LIBNAME ${REQUESTED_BOOST_LIBS})