Skip to content

Commit

Permalink
Refine CMake to find boost.
Browse files Browse the repository at this point in the history
  • Loading branch information
sprinfall committed Jul 15, 2019
1 parent 46ea52c commit db87f94
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
7 changes: 1 addition & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,10 @@ find_package(Threads REQUIRED)
# Boost 1.66+ required.
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
if(WIN32)
find_package(Boost REQUIRED)
else()
find_package(Boost REQUIRED COMPONENTS system filesystem date_time)
endif()
find_package(Boost 1.66.0 REQUIRED COMPONENTS system filesystem date_time)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
message(STATUS ${Boost_LIBRARIES})
endif()

if(WEBCC_ENABLE_SSL)
Expand Down
9 changes: 8 additions & 1 deletion autotest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ set(AT_SRCS
set(AT_TARGET_NAME webcc_autotest)

# Common libraries to link.
set(AT_LIBS webcc jsoncpp gtest ${Boost_LIBRARIES} "${CMAKE_THREAD_LIBS_INIT}")
set(AT_LIBS
webcc
jsoncpp
gtest
Boost::filesystem
Boost::system
Boost::date_time
"${CMAKE_THREAD_LIBS_INIT}")

if(WEBCC_ENABLE_SSL)
set(AT_LIBS ${AT_LIBS} ${OPENSSL_LIBRARIES})
Expand Down
7 changes: 6 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Examples

# Common libraries to link for examples.
set(EXAMPLE_LIBS webcc ${Boost_LIBRARIES} "${CMAKE_THREAD_LIBS_INIT}")
set(EXAMPLE_LIBS
webcc
Boost::filesystem
Boost::system
Boost::date_time
"${CMAKE_THREAD_LIBS_INIT}")

if(WEBCC_ENABLE_SSL)
set(EXAMPLE_LIBS ${EXAMPLE_LIBS} ${OPENSSL_LIBRARIES})
Expand Down
8 changes: 7 additions & 1 deletion unittest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ set(UT_SRCS
set(UT_TARGET_NAME webcc_unittest)

# Common libraries to link.
set(UT_LIBS webcc gtest ${Boost_LIBRARIES} "${CMAKE_THREAD_LIBS_INIT}")
set(UT_LIBS
webcc
gtest
Boost::filesystem
Boost::system
Boost::date_time
"${CMAKE_THREAD_LIBS_INIT}")

if(WEBCC_ENABLE_SSL)
set(UT_LIBS ${UT_LIBS} ${OPENSSL_LIBRARIES})
Expand Down

0 comments on commit db87f94

Please sign in to comment.