[CMake] CMake not finding boost headers

Zac Bergquist zbergquist99 at gmail.com
Mon Dec 7 13:44:07 EST 2015


I'm stuck on what seems like a rather simple problem.

I've got this in my CMakeLists.txt

    set(BOOST_INCLUDEDIR ${CMAKE_CURRENT_LIST_DIR}/boost_1_59_0)
    set(Boost_DEBUG 1)
    find_package(Boost 1.59.0 EXACT REQUIRED)

The boost_1_59_0 I'm pointing it to contains the Boost source straight from
the 1.59.0 release.

I've tried both CMake 3.3.1 and 3.4.1.  When I run CMake, I get the "Unable
to find the Boost header files" error.  Here's some of the debug output:

-- [ FindBoost.cmake:551 ] _boost_TEST_VERSIONS = 1.59.0;1.59
-- [ FindBoost.cmake:553 ] Boost_USE_MULTITHREADED = TRUE
-- [ FindBoost.cmake:555 ] Boost_USE_STATIC_LIBS =
-- [ FindBoost.cmake:557 ] Boost_USE_STATIC_RUNTIME =
-- [ FindBoost.cmake:559 ] Boost_ADDITIONAL_VERSIONS =
-- [ FindBoost.cmake:561 ] Boost_NO_SYSTEM_PATHS =
-- [ FindBoost.cmake:613 ] Declared as CMake or Environmental Variables:
-- [ FindBoost.cmake:615 ]   BOOST_ROOT =
-- [ FindBoost.cmake:617 ]   BOOST_INCLUDEDIR =
/home/user/thirdparty/boost_1_59_0
-- [ FindBoost.cmake:619 ]   BOOST_LIBRARYDIR =
-- [ FindBoost.cmake:621 ] _boost_TEST_VERSIONS = 1.59.0;1.59
-- [ FindBoost.cmake:690 ] Include debugging info:
-- [ FindBoost.cmake:692 ]   _boost_INCLUDE_SEARCH_DIRS =
/home/user/thirdparty/boost_1_59_0;PATHS;C:/boost/include;C:/boost;/sw/local/include
-- [ FindBoost.cmake:694 ]   _boost_PATH_SUFFIXES =
boost-1_59_0;boost_1_59_0;boost/boost-1_59_0;boost/boost_1_59_0;boost-1_59;boost_1_59;boost/boost-1_59;boost/boost_1_59

So I see that the FindBoost module picked up my BOOST_INCLUDEDIR hint.  I
looked at the source for the FindBoost module, and it comes down to:

    find_path(NAMES boost/config.hpp ...).

The file exists exactly where CMake says it's looking.

    $ ls -l /home/user/thirdparty/boost_1_59_0/boost/config.hpp
    -r--r--r-- 1 user user 2188 Nov 30 16:20
/home/user/thirdparty/boost_1_59_0/boost/config.hpp

Yet CMake is still setting Boost_INCLUDE_DIR-NOTFOUND.

I have tried removing boost_1_59_0 from my BOOST_INCLUDEDIR hint (since I
saw that portion of the path in the suffixes, but it doesn't help).  The
only way I am able to get CMake to locate the boost headers is to install
them into a global location like /usr/local/include (which I'd like to
avoid).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151207/2a5923c4/attachment.html>


More information about the CMake mailing list