3

I'm trying to generate the VS project for a cpp program but CMake is failing with the errors:

CMake Error at C:/Users/fabio.rezende/Documents/cmake-3.13.3-win64-x64/share/cmake-3.13/Modules/FindBoost.cmake:2100 (message): Unable to find the requested Boost libraries.

Boost version: 1.67.0

Boost include path: C:/boost_1_67_0/include/boost-1_67

Could not find the following Boost libraries:

      boost_program_options
      boost_system

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. Call Stack (most recent call first):
CMakeLists.txt:9 (find_package)

I've already tried the solutions proposed here and here and none worked so now I'm literally clueless of what may be happening here. I've downloaded boost 1.67.0 from the official website compiled (with bootstrap.bat + b2 commands) installed with bjam as in the second link was proposed and placed it under C:\. The Cmake file is:

cmake_minimum_required(VERSION 3.13)
project(BlockChainChat VERSION 1.0.0) 

set (CMAKE_CXX_STANDARD 17)

set(BOOST_ROOT "C:\\boost_1_67_0")
set(BOOST_LIBRARYDIR "${BOOST_ROOT}\\stage\\lib")

find_package(Boost 1.67.0 COMPONENTS program_options REQUIRED system)
include_directories( ${Boost_INCLUDE_DIR} )

add_subdirectory(util)

add_executable(BlockChainChat main.cpp)

target_link_libraries(BlockChainChat LINK_PUBLIC ${Boost_LIBRARIES} )
target_link_libraries(BlockChainChat PRIVATE util)

Note: without the SET BOOST_ROOT and BOOST_LIBRARYDIR I can easily build it under a linux machine.

Fnr
  • 2,096
  • 7
  • 41
  • 76
  • I had a detailed answer that didn't required changing the cmake file at all. Here's how I did it: https://stackoverflow.com/a/54585302/2104697 – Guillaume Racicot Mar 21 '19 at 19:34
  • 1
    Rerun CMake with `Boost_DEBUG` set, as described in that [comment](https://stackoverflow.com/questions/13280823/cmake-not-finding-boost#comment18105824_13280823). It will show exact directories and files, which are searched for Boost. Check that you have these files in your Boost installation. – Tsyvarev Mar 21 '19 at 21:37

0 Answers0