| 1 |
function(cpprest_find_websocketpp) |
| 2 |
if(TARGET cpprestsdk_websocketpp_internal) |
| 3 |
return() |
| 4 |
endif() |
| 5 |
|
| 6 |
find_package(WEBSOCKETPP CONFIG QUIET) |
| 7 |
if(WEBSOCKETPP_FOUND) |
| 8 |
message("-- Found websocketpp version " ${WEBSOCKETPP_VERSION} " on system") |
| 9 |
set(WEBSOCKETPP_INCLUDE_DIR ${WEBSOCKETPP_INCLUDE_DIR} CACHE INTERNAL "") |
| 10 |
elseif(EXISTS ${PROJECT_SOURCE_DIR}/libs/websocketpp/CMakeLists.txt) |
| 11 |
message("-- websocketpp not found, using the embedded version") |
| 12 |
set(WEBSOCKETPP_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/libs/websocketpp CACHE INTERNAL "") |
| 13 |
else() |
| 14 |
message(FATAL_ERROR "-- websocketpp not found and embedded version not present; try `git submodule update --init` and run CMake again") |
| 15 |
endif() |
| 16 |
|
| 17 |
cpprest_find_boost() |
| 18 |
cpprest_find_openssl() |
| 19 |
|
| 20 |
add_library(cpprestsdk_websocketpp_internal INTERFACE) |
| 21 |
target_include_directories(cpprestsdk_websocketpp_internal INTERFACE "$<BUILD_INTERFACE:${WEBSOCKETPP_INCLUDE_DIR}>") |
| 22 |
target_link_libraries(cpprestsdk_websocketpp_internal |
| 23 |
INTERFACE |
| 24 |
cpprestsdk_boost_internal |
| 25 |
cpprestsdk_openssl_internal |
| 26 |
) |
| 27 |
endfunction() |