2 years ago
#53873

Mojomoko
Boost with conan + CMake not found
I tried to use conan to integrate boost into my cpp Projekt. While it seems conan does install the boost libraries, CMake says
-- Could NOT find Boost (missing: Boost_INCLUDE_DIR) (Required is at least version "1.78.0")
For the basic setup I tried to follow: https://codetrips.com/2020/03/20/1198/
And I found the question CMake not finding boost libraries from conan, but since the setup seems to be a bit different (and no solution was found), I would like to present my problem and project.
My project layout is:
- ${project_root}/CMakeLists.txt
- ${project_root}/conanfile.txt
- ${project_root}/main.cpp
- ${project_root}/build
With CMakeLists.txt:
cmake_minimum_required(VERSION 3.16)
project(boost_process_test)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
find_package(Boost 1.78.0)
add_executable(test main.cpp)
target_link_libraries(test PRIVATE Boost)
and with conanfile.txt
[requires]
boost/1.78.0
[generators]
cmake
and with main.cpp
#include <boost/process.hpp>
int main() {
return 0;
}
Within the build directory I called
$ conan install ..
yielding the output:
Configuration: [settings] ... build_type=Release ... boost/1.78.0 from 'conancenter' - Cache
When calling
$ cmake -DCMAKE_BUILD_TYPE=Release ..
the above stated output is yielded.
c++
boost
cmake
conan
0 Answers
Your Answer