78 lines
2.6 KiB
CMake
78 lines
2.6 KiB
CMake
CMAKE_MINIMUM_REQUIRED(VERSION 3.14 FATAL_ERROR)
|
|
INCLUDE(FetchContent)
|
|
|
|
PKG_SEARCH_MODULE(LIBUV QUIET libuv)
|
|
PKG_SEARCH_MODULE(LIBCONFIG QUIET libconfig)
|
|
FIND_LIBRARY(LIBZLOG zlog PATHS "/usr/local/lib")
|
|
|
|
IF (NOT LIBUV_FOUND)
|
|
FETCHCONTENT_DECLARE(libuv
|
|
URL file://${CMAKE_SOURCE_DIR}/depend/libuv-v1.44.2.tar.gz
|
|
URL_MD5 0addbddcb1098e2c1c99f03f0108e1e7)
|
|
ENDIF ()
|
|
|
|
IF (NOT LIBCONFIG_FOUND)
|
|
FETCHCONTENT_DECLARE(libconfig
|
|
URL file://${CMAKE_SOURCE_DIR}/depend/libconfig-1.7.3.tar.gz
|
|
URL_MD5 8f96910eee26118258ac8d4cd128a0b2)
|
|
ENDIF ()
|
|
|
|
IF (LIBZLOG STREQUAL "LIBZLOG-NOTFOUND")
|
|
FETCHCONTENT_DECLARE(zlog
|
|
URL file://${CMAKE_SOURCE_DIR}/depend/zlog-1.2.16.tar.gz
|
|
URL_MD5 74ebc6fc119d756a13e692b734642ea6)
|
|
ENDIF ()
|
|
|
|
IF (NOT LIBUV_FOUND)
|
|
FETCHCONTENT_MAKEAVAILABLE(libuv)
|
|
ENDIF ()
|
|
|
|
IF (NOT LIBCONFIG_FOUND)
|
|
FETCHCONTENT_MAKEAVAILABLE(libconfig)
|
|
ENDIF ()
|
|
|
|
IF (LIBZLOG STREQUAL "LIBZLOG-NOTFOUND")
|
|
FETCHCONTENT_MAKEAVAILABLE(zlog)
|
|
ENDIF ()
|
|
|
|
IF (NOT LIBUV_FOUND)
|
|
MESSAGE(STATUS "libuv not found, will be used source code to build it ...")
|
|
FETCHCONTENT_GETPROPERTIES(libuv)
|
|
IF (NOT libuv_POPULATED)
|
|
FETCHCONTENT_POPULATE(libuv)
|
|
ADD_SUBDIRECTORY(${libuv_SOURCE_DIR} ${libuv_BINARY_DIR})
|
|
ENDIF ()
|
|
INCLUDE_DIRECTORIES(${libuv_SOURCE_DIR}/include)
|
|
LIST(APPEND COMMON_LIBS "uv_a")
|
|
ELSE ()
|
|
MESSAGE(STATUS "libuv found ${LIBUV_VERSION} at ${LIBUV_LIBRARY_DIRS}")
|
|
LIST(APPEND COMMON_LIBS "${LIBUV_LDFLAGS}")
|
|
ENDIF ()
|
|
|
|
IF (NOT LIBCONFIG_FOUND)
|
|
MESSAGE(STATUS "libconfig not found, will be used source code to build it ...")
|
|
FETCHCONTENT_GETPROPERTIES(libconfig)
|
|
IF (NOT libconfig_POPULATED)
|
|
FETCHCONTENT_POPULATE(libconfig)
|
|
ADD_SUBDIRECTORY(${libconfig_SOURCE_DIR} ${libconfig_BINARY_DIR})
|
|
ENDIF ()
|
|
INCLUDE_DIRECTORIES(${libconfig_SOURCE_DIR}/lib)
|
|
LIST(APPEND COMMON_LIBS "config")
|
|
ELSE ()
|
|
MESSAGE(STATUS "libconfig found ${LIBCONFIG_VERSION} at ${LIBCONFIG_LIBRARY_DIRS}")
|
|
LIST(APPEND COMMON_LIBS "${LIBCONFIG_LDFLAGS}")
|
|
ENDIF ()
|
|
|
|
IF (LIBZLOG STREQUAL "LIBZLOG-NOTFOUND")
|
|
MESSAGE(STATUS "zlog not found, will be used source code to build it ...")
|
|
FETCHCONTENT_GETPROPERTIES(zlog)
|
|
IF (NOT zlog_POPULATED)
|
|
FETCHCONTENT_POPULATE(zlog)
|
|
ADD_SUBDIRECTORY(${zlog_SOURCE_DIR} ${zlog_BINARY_DIR})
|
|
ENDIF ()
|
|
INCLUDE_DIRECTORIES(${zlog_SOURCE_DIR}/src)
|
|
LIST(APPEND COMMON_LIBS "zlog")
|
|
ELSE ()
|
|
MESSAGE(STATUS "zlog found of ${LIBZLOG}")
|
|
LIST(APPEND COMMON_LIBS "${LIBZLOG}")
|
|
ENDIF () |