vcpe/CMakeLists.txt

35 lines
941 B
CMake
Raw Normal View History

2022-05-10 02:59:51 +00:00
CMAKE_MINIMUM_REQUIRED(VERSION 3.14 FATAL_ERROR)
PROJECT(vCPE_project)
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig")
SET(URI_HOME "${CMAKE_SOURCE_DIR}/libs")
#MESSAGE("PKG_CONFIG_PATH = " $ENV{PKG_CONFIG_PATH})
EXECUTE_PROCESS(COMMAND git describe --tags --always --dirty=-dev
OUTPUT_VARIABLE GIT_TAG)
if ("${GIT_TAG}" STREQUAL "")
STRING(TIMESTAMP COMPILE_TIME %Y-%m-%d_%H:%M:%S)
SET(GIT_TAG ${COMPILE_TIME})
else ()
STRING(REGEX REPLACE "\n$" "" GIT_TAG ${GIT_TAG})
endif ()
#
MESSAGE("Version: " ${GIT_TAG})
# 判断依赖库是否存在
FIND_PACKAGE(PkgConfig)
PKG_SEARCH_MODULE(LIBCURL REQUIRED libcurl)
PKG_SEARCH_MODULE(LIBSSL REQUIRED libssl)
PKG_SEARCH_MODULE(LIBCRYPTO REQUIRED libcrypto)
SET(COMMON_LIBS ${LIBCURL_LDFLAGS} ${LIBSSL_LDFLAGS} ${LIBCRYPTO_LDFLAGS})
SET(COMMON_LIBS ${COMMON_LIBS} "-ldl -lpthread -lzlog -lm")
ADD_SUBDIRECTORY(common)
ADD_SUBDIRECTORY(test)