From c29643053e2a63ae933214fbda48970a63746e82 Mon Sep 17 00:00:00 2001 From: proller Date: Sun, 5 Aug 2018 20:54:43 +0300 Subject: [PATCH] Allow use system enet --- src/CMakeLists.txt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a3071bc9f..52cd0c1ce 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -762,9 +762,17 @@ else() endif() if(USE_ENET) - add_subdirectory(external/enet) - include_directories(${PROJECT_SOURCE_DIR}/external/enet/include) - set(ENET_LIBRARY enet) + if(NOT ENABLE_SYSTEM_JSONCPP AND EXISTS ${PROJECT_SOURCE_DIR}/external/enet/include/enet/enet.h) + add_subdirectory(external/enet) + set(ENET_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/external/enet/include) + set(ENET_LIBRARY enet) + endif() + if(NOT ENET_LIBRARY) + find_library(ENET_LIBRARY NAMES enet) + find_path(ENET_INCLUDE_DIR enet/enet.h) + endif() + include_directories(${ENET_INCLUDE_DIR}) + message(STATUS "Using enet: ${ENET_INCLUDE_DIR} ${ENET_LIBRARY}") endif() set(FMcommon_SRCS