I've build boost with c++17 standard with clang on macOS Mojave when compiling my playground program that uses beast and asio I get the following error:
This is my make file:
cmake_minimum_required (VERSION 3.13.1)
project (Playground)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USER_MULITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
set(BOOST_ROOT "/usr/local/boost-1.68.0")
set(Boost_INLCUDE_DIR "/usr/local/boost-1.68.0/include")
set(Boost_LIBRARY_DIR_RELEASE "/usr/local/boost-1.68.0/lib")
find_package(Boost 1.68.0 REQUIRED COMPONENTS system filesystem)
set(SOURCES
src/main.cpp
src/http_client/http_client.hpp
src/http_client/http_client.cpp)
if(Boost_FOUND)
include_directories("/usr/local/boost-1.68.0/include")
add_executable (Playground ${SOURCES})
set_property(TARGET Playground PROPERTY CXX_STANDARD 17)
target_include_directories(Playground PRIVATE ${BOOST_INCLUDE_DIRS})
target_link_libraries(Playground ${BOOST_FILESYSTEM_LIBRARIES}
${BOOST_SYSTEM_LIBRARIES})
endif()
I've compiled boost with steps described in this tutorial: Compiling Boost with Clang.
Clang version:
Apple LLVM version 10.0.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.2.0
Is there anything else I've to take into account? I've read a lot of posts, etc. where it's suggested to compile boost in the same c++ standard that should be used in the project itself.
EDIT:
Matthieu Brucher's hint with the variable names (Boost_ vs. BOOST_) did the trick. Now it's working.
@Matthieu Brucher's hint with the variable names (Boost_ vs. BOOST_) did the trick:
target_link_libraries(Playground ${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY})