From 2cf77c7053db4a14d924573613b6969d8fc51719 Mon Sep 17 00:00:00 2001 From: Jaeseung Ha Date: Tue, 6 Sep 2016 09:40:55 +0900 Subject: [PATCH] Skip building SSL example if OpenSSL is not found --- CMakeLists.txt | 4 ++++ examples/CMakeLists.txt | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f4db2cf2a..e2d3bc7dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,10 @@ project (crow_all) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") find_package(Tcmalloc) find_package(Threads) +find_package(OpenSSL) +if(OPENSSL_FOUND) + include_directories(${OPENSSL_INCLUDE_DIR}) +endif() if (NOT CMAKE_BUILD_TYPE) message(STATUS "No build type selected, default to Release") diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 1e96dea22..ef65f026c 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -11,9 +11,11 @@ add_executable(helloworld helloworld.cpp) target_link_libraries(helloworld ${Boost_LIBRARIES}) target_link_libraries(helloworld ${CMAKE_THREAD_LIBS_INIT}) +if (OPENSSL_FOUND) add_executable(example_ssl ssl/example_ssl.cpp) target_link_libraries(example_ssl ${Boost_LIBRARIES}) -target_link_libraries(example_ssl ${CMAKE_THREAD_LIBS_INIT} ssl crypto) +target_link_libraries(example_ssl ${CMAKE_THREAD_LIBS_INIT} ${OPENSSL_LIBRARIES}) +endif() add_executable(example_websocket websocket/example_ws.cpp) target_link_libraries(example_websocket ${Boost_LIBRARIES})