I try to include the current version of the Boost library into my cmake file. But I 'm struggle with the full include. I have already included the boost::filesystem library. So I hope this is not a big change in the code.
Here my Cmake include that works for me:
#include boost
#===========================================================================
set(Boost_INCLUDE_DIR "/Volumes/Code/boost_1_79_0")
set(Boost_LIBRARY_DIR "/Volumes/Code/boost_1_79_0/stage/lib")
find_package(Boost
1.79.0 REQUIRED
COMPONENTS
filesystem
)
if(NOT Boost_FOUND)
message(FATAL_ERROR "Boost Not found")
else()
message(STATUS "Boost version ${Boost_VERSION} found")
endif()
include_directories(include)
include_directories(${Boost_INCLUDE_DIR})
target_link_libraries(${EXECUTABLE}
PUBLIC
Boost::filesystem)
#===========================================================================
Then I tried that and it failed:
#include boost
#===========================================================================
set(Boost_INCLUDE_DIR "/Volumes/Code/boost_1_79_0")
set(Boost_LIBRARY_DIR "/Volumes/Code/boost_1_79_0/stage/lib")
find_package(Boost
1.79.0 REQUIRED
COMPONENTS
filesystem
optional
)
if(NOT Boost_FOUND)
message(FATAL_ERROR "Boost Not found")
else()
message(STATUS "Boost version ${Boost_VERSION} found")
endif()
include_directories(include)
include_directories(${Boost_INCLUDE_DIR})
target_link_libraries(${EXECUTABLE}
PUBLIC
Boost::filesystem
Boost::optional)
#===========================================================================
Does anyone know a way to integrate all Boost Libraries without listing them or sees my mistake? If someone has suggestions for improvements, feel free to teaching me.