Skip to content

Commit

Permalink
Updated find boost to use MODULE
Browse files Browse the repository at this point in the history
  • Loading branch information
jgaa committed Aug 16, 2024
1 parent c066977 commit 6a9839b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 39 deletions.
56 changes: 18 additions & 38 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,49 +120,29 @@ if(NOT DEFINED USE_BOOST_VERSION)
set(USE_BOOST_VERSION 1.83)
endif()


set(MYSQLPOOL_BOOST_LIBRARIES
${BOOST_LOG_DEP}
Boost::system
Boost::context
Boost::chrono
Boost::json
find_package(Boost ${USE_BOOST_VERSION} REQUIRED MODULE COMPONENTS
system
context
chrono
json
program_options
${BOOST_LOG_LIB}
)

if (Boost_VERSION VERSION_GREATER_EQUAL "1.85.0")
find_package(Boost ${USE_BOOST_VERSION} REQUIRED MODULE COMPONENTS
system
context
chrono
json
charconv
program_options
${BOOST_LOG_LIB}
)

set(MYSQLPOOL_BOOST_PROGRAM_OPTIONS Boost::program_options)

if (MYSQLPOOL_BOOST_ALL)
find_package(Boost ${USE_BOOST_VERSION} REQUIRED ALL)
else()
find_package(Boost ${USE_BOOST_VERSION} REQUIRED COMPONENTS
system
context
chrono
json
program_options
${BOOST_LOG_LIB}
)

if (Boost_VERSION VERSION_GREATER_EQUAL "1.85.0")
find_package(Boost ${USE_BOOST_VERSION} REQUIRED COMPONENTS
system
context
chrono
json
charconv
program_options
${BOOST_LOG_LIB}
)
set(MYSQLPOOL_BOOST_PROGRAM_OPTIONS ${MYSQLPOOL_BOOST_PROGRAM_OPTIONS} Boost::charconv)
endif()
endif()

message("Boost_LIBRARIES: ${Boost_LIBRARIES}")
message(MYSQLPOOL_BOOST_LIBRARIES: ${MYSQLPOOL_BOOST_LIBRARIES})

if (Boost_VERSION VERSION_GREATER "1.84.0")
set(MYSQLPOOL_BOOST_LIBRARIES ${MYSQLPOOL_BOOST_LIBRARIES} Boost::charconv)
endif()

add_library(boost INTERFACE IMPORTED)
set_property(TARGET boost PROPERTY
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if (MYSQLPOOL_LOGDEP)
endif()

target_link_libraries(${PROJECT_NAME}
${MYSQLPOOL_BOOST_LIBRARIES}
${Boost_LIBRARIES}
OpenSSL::SSL
OpenSSL::Crypto
ZLIB::ZLIB
Expand Down

0 comments on commit 6a9839b

Please sign in to comment.