(ws) #125 / cmake detects an already installed jsoncpp and will try to use this one if present

This commit is contained in:
Benjamin Sergeant
2019-12-03 16:01:46 -08:00
parent 2e1657167f
commit 5c5ea6dec1
16 changed files with 60 additions and 12 deletions

View File

@ -29,10 +29,16 @@ if (UNIX)
set( STATSD_CLIENT_SOURCES ../third_party/statsd-client-cpp/src/statsd_client.cpp)
endif()
find_package(JsonCpp)
if (NOT JSONCPP_FOUND)
include_directories(../third_party/jsoncpp)
set(JSONCPP_SOURCES ../third_party/jsoncpp/jsoncpp.cpp)
endif()
add_executable(ws
../third_party/msgpack11/msgpack11.cpp
../third_party/jsoncpp/jsoncpp.cpp
${STATSD_CLIENT_SOURCES}
${JSONCPP_SOURCES}
ws_http_client.cpp
ws_ping_pong.cpp
@ -74,4 +80,9 @@ if(NOT APPLE AND NOT USE_MBED_TLS)
target_link_libraries(ws ${OPENSSL_LIBRARIES})
endif()
if (JSONCPP_FOUND)
target_include_directories(ws PUBLIC ${JSONCPP_INCLUDE_DIRS})
target_link_libraries(ws ${JSONCPP_LIBRARIES})
endif()
install(TARGETS ws RUNTIME DESTINATION bin)