Fix build on Mac

This commit is contained in:
Adam Gu
2019-04-21 12:16:28 +08:00
parent 4721d50363
commit 847a20483f
4 changed files with 20 additions and 14 deletions
+8 -7
View File
@@ -1,4 +1,4 @@
# Auto test
# Automation test
set(AT_SRCS
client_autotest.cc
@@ -7,22 +7,23 @@ set(AT_SRCS
set(AT_TARGET_NAME webcc_autotest)
# Common libraries to link.
set(TEST_LIBS webcc ${Boost_LIBRARIES} "${CMAKE_THREAD_LIBS_INIT}")
set(AT_LIBS webcc ${Boost_LIBRARIES} "${CMAKE_THREAD_LIBS_INIT}")
if(WEBCC_ENABLE_SSL)
set(TEST_LIBS ${TEST_LIBS} ${OPENSSL_LIBRARIES})
set(AT_LIBS ${AT_LIBS} ${OPENSSL_LIBRARIES})
endif()
if(WIN32)
set(TEST_LIBS ${TEST_LIBS} zlibstatic crypt32)
# TODO: crypt32 should be ssl related.
set(AT_LIBS ${AT_LIBS} zlibstatic crypt32)
else()
set(TEST_LIBS ${TEST_LIBS} ${ZLIB_LIBRARIES})
set(AT_LIBS ${AT_LIBS} ${ZLIB_LIBRARIES})
endif()
if(UNIX)
# Add `-ldl` for Linux to avoid "undefined reference to `dlopen'".
set(TEST_LIBS ${TEST_LIBS} ${CMAKE_DL_LIBS})
set(AT_LIBS ${AT_LIBS} ${CMAKE_DL_LIBS})
endif()
add_executable(${AT_TARGET_NAME} ${AT_SRCS})
target_link_libraries(${AT_TARGET_NAME} webcc jsoncpp gtest ${TEST_LIBS})
target_link_libraries(${AT_TARGET_NAME} webcc jsoncpp gtest ${AT_LIBS})