From 7db8b9eb7310cbbc305a2dafef1c763058f580a2 Mon Sep 17 00:00:00 2001 From: Lorenzo Fontana Date: Thu, 12 Dec 2019 19:04:55 +0100 Subject: [PATCH] build(CMakeLists): include external dependencies from file Co-Authored-By: Leonardo Di Donato Signed-off-by: Lorenzo Fontana --- CMakeLists.txt | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fe34ffa..afe4b89d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,14 +111,9 @@ else() endif() # jq -find_path(JQ_INCLUDE jq.h PATH_SUFFIXES jq) -find_library(JQ_LIB NAMES jq) -if(JQ_INCLUDE AND JQ_LIB) - message(STATUS "Found jq: include: ${JQ_INCLUDE}, lib: ${JQ_LIB}") -else() - message(FATAL_ERROR "Couldn't find system jq") -endif() +include(FindJQ) +# jsoncpp set(JSONCPP_SRC "${SYSDIG_DIR}/userspace/libsinsp/third-party/jsoncpp") set(JSONCPP_INCLUDE "${JSONCPP_SRC}") set(JSONCPP_LIB_SRC "${JSONCPP_SRC}/jsoncpp.cpp") @@ -155,13 +150,7 @@ ExternalProject_Add(b64 INSTALL_COMMAND "") # yamlcpp -find_path(YAMLCPP_INCLUDE_DIR NAMES yaml-cpp/yaml.h) -find_library(YAMLCPP_LIB NAMES yaml-cpp) -if(YAMLCPP_INCLUDE_DIR AND YAMLCPP_LIB) - message(STATUS "Found yamlcpp: include: ${YAMLCPP_INCLUDE_DIR}, lib: ${YAMLCPP_LIB}") -else() - message(FATAL_ERROR "Couldn't find system yamlcpp") -endif() +include(FindYamlCpp) # OpenSSL find_package(OpenSSL REQUIRED) @@ -275,14 +264,7 @@ endif() # protobuf -find_program(PROTOC NAMES protoc) -find_path(PROTOBUF_INCLUDE NAMES google/protobuf/message.h) -find_library(PROTOBUF_LIB NAMES libprotobuf.so) -if(PROTOC AND PROTOBUF_INCLUDE AND PROTOBUF_LIB) - message(STATUS "Found protobuf: compiler: ${PROTOC}, include: ${PROTOBUF_INCLUDE}, lib: ${PROTOBUF_LIB}") -else() - message(FATAL_ERROR "Couldn't find system protobuf") -endif() +include(FindProtobuf) # gRPC include(FindGRPC)