unable to find Boost in cmake

2019-09-25 09:38发布

问题:

i'm using cmake to build a PCL project. There i have used PCL all in one installer.then boost path is C:/Program Files/PCL 1.5.1/3rdParty/Boost. Please find below my cmake debug version.Any help is appreciated.

[ C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindBoost.cmake:615 ]   BOOST_ROOT = C:/Program Files/PCL 1.5.1/3rdParty/Boost
[ C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindBoost.cmake:617 ]   BOOST_INCLUDEDIR = 
[ C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindBoost.cmake:619 ]   BOOST_LIBRARYDIR = 
[ C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindBoost.cmake:621 ] _boost_TEST_VERSIONS = 1.47;1.47.0;1.59.0;1.59;1.58.0;1.58;1.57.0;1.57;1.56.0;1.56;1.55.0;1.55;1.54.0;1.54;1.53.0;1.53;1.52.0;1.52;1.51.0;1.51;1.50.0;1.50;1.49.0;1.49;1.48.0;1.48;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.0;1.45;1.44.0;1.44;1.43.0;1.43;1.42.0;1.42;1.41.0;1.41;1.40.0;1.40
[ C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindBoost.cmake:690 ] Include debugging info:
[ C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindBoost.cmake:692 ]   _boost_INCLUDE_SEARCH_DIRS = C:/Program Files/PCL 1.5.1/3rdParty/Boost/include;C:/Program Files/PCL 1.5.1/3rdParty/Boost;PATHS;C:/boost/include;C:/boost;/sw/local/include
[ C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindBoost.cmake:694 ]   _boost_PATH_SUFFIXES = boost-1_47;boost_1_47;boost/boost-1_47;boost/boost_1_47;boost-1_47_0;boost_1_47_0;boost/boost-1_47_0;boost/boost_1_47_0;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;boost-1_58_0;boost_1_58_0;boost/boost-1_58_0;boost/boost_1_58_0;boost-1_58;boost_1_58;boost/boost-1_58;boost/boost_1_58;boost-1_57_0;boost_1_57_0;boost/boost-1_57_0;boost/boost_1_57_0;boost-1_57;boost_1_57;boost/boost-1_57;boost/boost_1_57;boost-1_56_0;boost_1_56_0;boost/boost-1_56_0;boost/boost_1_56_0;boost-1_56;boost_1_56;boost/boost-1_56;boost/boost_1_56;boost-1_55_0;boost_1_55_0;boost/boost-1_55_0;boost/boost_1_55_0;boost-1_55;boost_1_55;boost/boost-1_55;boost/boost_1_55;boost-1_54_0;boost_1_54_0;boost/boost-1_54_0;boost/boost_1_54_0;boost-1_54;boost_1_54;boost/boost-1_54;boost/boost_1_54;boost-1_53_0;boost_1_53_0;boost/boost-1_53_0;boost/boost_1_53_0;boost-1_53;boost_1_53;boost/boost-1_53;boost/boost_1_53;boost-1_52_0;boost_1_52_0;boost/boost-1_52_0;boost/boost_1_52_0;boost-1_52;boost_1_52;boost/boost-1_52;boost/boost_1_52;boost-1_51_0;boost_1_51_0;boost/boost-1_51_0;boost/boost_1_51_0;boost-1_51;boost_1_51;boost/boost-1_51;boost/boost_1_51;boost-1_50_0;boost_1_50_0;boost/boost-1_50_0;boost/boost_1_50_0;boost-1_50;boost_1_50;boost/boost-1_50;boost/boost_1_50;boost-1_49_0;boost_1_49_0;boost/boost-1_49_0;boost/boost_1_49_0;boost-1_49;boost_1_49;boost/boost-1_49;boost/boost_1_49;boost-1_48_0;boost_1_48_0;boost/boost-1_48_0;boost/boost_1_48_0;boost-1_48;boost_1_48;boost/boost-1_48;boost/boost_1_48;boost-1_47_0;boost_1_47_0;boost/boost-1_47_0;boost/boost_1_47_0;boost-1_47;boost_1_47;boost/boost-1_47;boost/boost_1_47;boost-1_46_1;boost_1_46_1;boost/boost-1_46_1;boost/boost_1_46_1;boost-1_46_0;boost_1_46_0;boost/boost-1_46_0;boost/boost_1_46_0;boost-1_46;boost_1_46;boost/boost-1_46;boost/boost_1_46;boost-1_45_0;boost_1_45_0;boost/boost-1_45_0;boost/boost_1_45_0;boost-1_45;boost_1_45;boost/boost-1_45;boost/boost_1_45;boost-1_44_0;boost_1_44_0;boost/boost-1_44_0;boost/boost_1_44_0;boost-1_44;boost_1_44;boost/boost-1_44;boost/boost_1_44;boost-1_43_0;boost_1_43_0;boost/boost-1_43_0;boost/boost_1_43_0;boost-1_43;boost_1_43;boost/boost-1_43;boost/boost_1_43;boost-1_42_0;boost_1_42_0;boost/boost-1_42_0;boost/boost_1_42_0;boost-1_42;boost_1_42;boost/boost-1_42;boost/boost_1_42;boost-1_41_0;boost_1_41_0;boost/boost-1_41_0;boost/boost_1_41_0;boost-1_41;boost_1_41;boost/boost-1_41;boost/boost_1_41;boost-1_40_0;boost_1_40_0;boost/boost-1_40_0;boost/boost_1_40_0;boost-1_40;boost_1_40;boost/boost-1_40;boost/boost_1_40
[ C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindBoost.cmake:714 ] location of version.hpp: C:/Program Files/PCL 1.5.1/3rdParty/Boost/include/boost/version.hpp

[ C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindBoost.cmake:1087 ] Searching for IOSTREAMS_LIBRARY_DEBUG: libboost_iostreams-vc120-mt-gd-1_48;libboost_iostreams-vc120-mt-gd;libboost_iostreams-mt-gd-1_48;libboost_iostreams-mt-gd;libboost_iostreams-mt;libboost_iostreams;libboost_iostreams-vc120-mt-s-gd-1_48;libboost_iostreams-vc120-mt-s-gd;libboost_iostreams-mt-s-gd-1_48;libboost_iostreams-mt-s-gd
[ C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindBoost.cmake:1153 ] Boost_FOUND = 1
Could NOT find Boost
Boost version: 1.48.0
Boost include path: C:/Program Files/PCL 1.5.1/3rdParty/Boost/include
Could not find the following static Boost libraries:
        boost_system
        boost_filesystem
        boost_thread
        boost_date_time
        boost_iostreams
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.

回答1:

Name of library file in Boost encodes information about the target, against which the library has been compiled.

Suffix like -vc120 means the version of the MSVC compiler.

You may use only those Boost libraries, which are suitable for your Visual Studio.

Correspondence between Visual Studio and version of MSVC compiler (From the wiki page about Visual C++):

MSVC++ 5.0  _MSC_VER == 1100
MSVC++ 6.0  _MSC_VER == 1200
MSVC++ 7.0  _MSC_VER == 1300
MSVC++ 7.1  _MSC_VER == 1310 (Visual Studio 2003)
MSVC++ 8.0  _MSC_VER == 1400 (Visual Studio 2005)
MSVC++ 9.0  _MSC_VER == 1500 (Visual Studio 2008)
MSVC++ 10.0 _MSC_VER == 1600 (Visual Studio 2010)
MSVC++ 11.0 _MSC_VER == 1700 (Visual Studio 2012)
MSVC++ 12.0 _MSC_VER == 1800 (Visual Studio 2013)
MSVC++ 14.0 _MSC_VER == 1900 (Visual Studio 2015)

List of available Visual Studio generators for CMake:

Visual Studio 6
Visual Studio 7
Visual Studio 7 .NET 2003
Visual Studio 8 2005
Visual Studio 9 2008
Visual Studio 10 2010
Visual Studio 11 2012
Visual Studio 12 2013
Visual Studio 14 2015
Visual Studio 15 2017

E.g., Boost library with suffix -vc120 can be used only with Visual Studio 12 2013 generator.