1

I am trying to build Point Cloud Library on Windows. https://github.com/PointCloudLibrary/pcl

This library requires Boost library and I have installed it properly.

However, when I use CMAKE to build PCL, it complains that

CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.3/Modules/FindBoost.cmake:1245 (message): Unable to find the requested Boost libraries. Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers. Call Stack (most recent call first): cmake/pcl_find_boost.cmake:37 (find_package) CMakeLists.txt:399 (include)

I have BOOST_ROOT set in my environment variables: enter image description here

Furthermore, CMAKE doesn't even show the BOOST_ROOT or BOOST_INCLUDEDIR variables in its variable name list:

enter image description here

Below is the pcl_find_boost.cmake file

# Find and set Boost flags

# If we would like to compile against a dynamically linked Boost
if(PCL_BUILD_WITH_BOOST_DYNAMIC_LINKING_WIN32 AND WIN32)
  set(Boost_USE_STATIC_LIBS OFF)
  set(Boost_USE_STATIC OFF)
  set(Boost_USE_MULTITHREAD ON)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_ALL_DYN_LINK -DBOOST_ALL_NO_LIB")
else(PCL_BUILD_WITH_BOOST_DYNAMIC_LINKING_WIN32 AND WIN32)
  if(NOT PCL_SHARED_LIBS OR WIN32)
    set(Boost_USE_STATIC_LIBS ON)
    set(Boost_USE_STATIC ON)
  endif(NOT PCL_SHARED_LIBS OR WIN32)
endif(PCL_BUILD_WITH_BOOST_DYNAMIC_LINKING_WIN32 AND WIN32)

if(${CMAKE_VERSION} VERSION_LESS 2.8.5)
  SET(Boost_ADDITIONAL_VERSIONS "1.43" "1.43.0" "1.44" "1.44.0" "1.45" "1.45.0" "1.46.1" "1.46.0" "1.46" "1.47" "1.47.0")
else(${CMAKE_VERSION} VERSION_LESS 2.8.5)
  SET(Boost_ADDITIONAL_VERSIONS "1.47" "1.47.0" "1.48" "1.48.0" "1.49" "1.49.0")
endif(${CMAKE_VERSION} VERSION_LESS 2.8.5)

# Disable the config mode of find_package(Boost)
set(Boost_NO_BOOST_CMAKE ON)

# Optional boost modules
find_package(Boost 1.40.0 QUIET COMPONENTS serialization mpi)
if(Boost_SERIALIZATION_FOUND)
  set(BOOST_SERIALIZATION_FOUND TRUE)
endif(Boost_SERIALIZATION_FOUND)

# Required boost modules
if(WITH_OPENNI2)
set(BOOST_REQUIRED_MODULES system filesystem thread date_time iostreams chrono)
find_package(Boost 1.47.0 REQUIRED COMPONENTS ${BOOST_REQUIRED_MODULES})
else()
set(BOOST_REQUIRED_MODULES system filesystem thread date_time iostreams)
find_package(Boost 1.40.0 REQUIRED COMPONENTS ${BOOST_REQUIRED_MODULES})
endif()

if(Boost_FOUND)
  set(BOOST_FOUND TRUE)
  # Obtain diagnostic information about Boost's automatic linking outputted 
  # during compilation time.
  add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
  include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
  link_directories(${Boost_LIBRARY_DIRS})
endif(Boost_FOUND)

Thanks in advance for the help!

foothill
  • 483
  • 3
  • 8
  • 18
  • Have you tried using BOOSTROOT instead? Have you tried moving boost to a directory without space in the path? I never had any issues with this, but this are the first things I would try. – mattiash Nov 26 '15 at 07:45
  • 1
    Try to build with more debug information: set `Boost_DEBUG` *CMake* variable in the cache. – Tsyvarev Nov 26 '15 at 08:09
  • 3
    I think the mentioned variables `BOOST_ROOT` and `BOOST_INCLUDEDIR` are _CMake_ variables, not environmental variables. As such, they should be passed directly to _CMake_. In command line that would be `-DBOOST_INCLUDEDIR="...."`, in GUI you may use "Add Entry" button. – taketwo Nov 26 '15 at 08:44
  • For Boost, I always set Boost_INCLUDE_DIR. Have you looked at the "advance mode" view? That's typically where that variable shows up ( as with all other Boost related vars ). – StAlphonzo Dec 01 '15 at 12:26

0 Answers0