[CMake] Boost library directory not found unless I explicitly set BOOST_LIBRARYDIR ?

Glenn Coombs glenn.coombs at gmail.com
Fri Nov 14 07:56:53 EST 2014


Hi,

I have installed Boost on Windows 7 for Visual Studio 2013 by running these
installers:

boost_1_56_0-msvc-12.0-32.exe
boost_1_56_0-msvc-12.0-64.exe

downloaded from
http://sourceforge.net/projects/boost/files/boost-binaries/1.56.0/.

I'm using CMake 2.8.12.1 and when I try to build a simple Boost example
using the filesystem library my cmake configuration step fails to find the
required libraries unless I use the BOOST_LIBRARYDIR variable to tell it
where the libraries are:

set(BOOST_VERSION_NEEDED 1.53.0)

if (MSVC)
    set(Boost_USE_STATIC_LIBS       ON)
    set(Boost_USE_MULTITHREADED     ON)
    set(Boost_USE_STATIC_RUNTIME    ON)
#   set(BOOST_LIBRARYDIR            /Boost/boost_1_56_0/lib64-msvc-12.0)
endif()

find_package(Boost ${BOOST_VERSION_NEEDED} REQUIRED COMPONENTS system
filesystem)

Given that the library directory is where the official Boost installer put
it shouldn't the FindBoost.cmake package be checking that directory by
default ?

This is the output from CMake:

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:476 ] _boost_TEST_VERSIONS =
1.56.0;1.56;1.55.0;1.55;1.54.0;1.54;1.53.0;1.53

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:478 ] Boost_USE_MULTITHREADED =
ON

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:480 ] Boost_USE_STATIC_LIBS = ON

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:482 ] Boost_USE_STATIC_RUNTIME
= ON

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:484 ] Boost_ADDITIONAL_VERSIONS
=

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:486 ] Boost_NO_SYSTEM_PATHS =

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:538 ] Declared as CMake or
Environmental Variables:

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:540 ] BOOST_ROOT =

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:542 ] BOOST_INCLUDEDIR =

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:544 ] BOOST_LIBRARYDIR =

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:546 ] _boost_TEST_VERSIONS =
1.56.0;1.56;1.55.0;1.55;1.54.0;1.54;1.53.0;1.53

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:639 ] location of version.hpp:
C:/Boost/boost_1_56_0/boost/version.hpp

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:663 ] version.hpp reveals boost
1.56.0

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:739 ] guessed _boost_COMPILER =
-vc120

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:749 ] _boost_MULTITHREADED = -mt

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:792 ] _boost_RELEASE_ABI_TAG =
-s

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:794 ] _boost_DEBUG_ABI_TAG =
-sgd

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:842 ]
_boost_LIBRARY_SEARCH_DIRS =
C:/Boost/boost_1_56_0/lib;C:/Boost/boost_1_56_0/../lib;C:/Boost/boost_1_56_0/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:930 ] Searching for
SYSTEM_LIBRARY_RELEASE:
libboost_system-vc120-mt-s-1_56;libboost_system-vc120-mt-s;libboost_system-mt-s-1_56;libboost_system-mt-s;libboost_system

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:966 ] Searching for
SYSTEM_LIBRARY_DEBUG:
libboost_system-vc120-mt-sgd-1_56;libboost_system-vc120-mt-sgd;libboost_system-mt-sgd-1_56;libboost_system-mt-sgd;libboost_system-mt;libboost_system

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:930 ] Searching for
FILESYSTEM_LIBRARY_RELEASE:
libboost_filesystem-vc120-mt-s-1_56;libboost_filesystem-vc120-mt-s;libboost_filesystem-mt-s-1_56;libboost_filesystem-mt-s;libboost_filesystem

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:966 ] Searching for
FILESYSTEM_LIBRARY_DEBUG:
libboost_filesystem-vc120-mt-sgd-1_56;libboost_filesystem-vc120-mt-sgd;libboost_filesystem-mt-sgd-1_56;libboost_filesystem-mt-sgd;libboost_filesystem-mt;libboost_filesystem

[ C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:1017 ] Boost_FOUND = 1

Could NOT find Boost

Boost version: 1.56.0

Boost include path: C:/Boost/boost_1_56_0

Could not find the following static Boost libraries:

boost_system

boost_filesystem

No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of Boost.


As you can see it is looking for a directory called lib rather than
lib64-msvc-12.0.

--
Glenn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20141114/5c8d2e03/attachment.html>


More information about the CMake mailing list