Refine CMake to find boost.

This commit is contained in:
Chunting Gu
2019-07-15 17:24:21 +08:00
parent 46ea52cb90
commit db87f940e0
4 changed files with 22 additions and 9 deletions
+1 -6
View File
@@ -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)
+8 -1
View File
@@ -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})
+6 -1
View File
@@ -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})
+7 -1
View File
@@ -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})