vcpe/srcs/libs/CMakeLists.txt

56 lines
1.8 KiB
CMake

SET(LIB_PROJECT_TARGET common)
PROJECT(${LIB_PROJECT_TARGET})
INCLUDE_DIRECTORIES(include
./ ./include ../lwip/src/include ../lwip/src/arch_linux/include ../include
../httpserver/include ../httpserver/src/haywire ../httpserver/src/haywire/configuration)
FILE(GLOB C_HEADS include/*.h include/uthash/*.h include/s2j/*.h vector/*.h)
AUX_SOURCE_DIRECTORY(json C_SRC)
AUX_SOURCE_DIRECTORY(args C_SRC)
AUX_SOURCE_DIRECTORY(init C_SRC)
AUX_SOURCE_DIRECTORY(misc C_SRC)
AUX_SOURCE_DIRECTORY(banner C_SRC)
AUX_SOURCE_DIRECTORY(configure C_SRC)
AUX_SOURCE_DIRECTORY(network C_SRC)
AUX_SOURCE_DIRECTORY(task C_SRC)
AUX_SOURCE_DIRECTORY(mq C_SRC)
AUX_SOURCE_DIRECTORY(cmdline C_SRC)
AUX_SOURCE_DIRECTORY(crypto C_SRC)
AUX_SOURCE_DIRECTORY(hardware C_SRC)
IF (USED_REDIS)
ADD_DEFINITIONS(-DUSED_REDIS)
ENDIF ()
IF (USED_SQLITE)
ADD_DEFINITIONS(-DUSED_SQLITE)
AUX_SOURCE_DIRECTORY(database/sqlite3 C_SRC)
ENDIF ()
IF (USED_MYSQL)
ADD_DEFINITIONS(-DUSED_MYSQL)
ENDIF ()
SET(CMAKE_C_STANDARD 99)
SET_SOURCE_FILES_PROPERTIES(misc/zvector.c PROPERTIES COMPILE_FLAGS "-Wall -Wextra -flto")
IF (USED_SQLITE)
SET_SOURCE_FILES_PROPERTIES(database/sqlite3/sqlite3.c PROPERTIES
COMPILE_FLAGS "-DSQLITE_HAS_CODEC \
-DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_OS_UNIX=1 \
-D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -DSQLITE_THREADSAFE=1 \
-DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT \
-DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT \
-DSQLITE_HAVE_ZLIB=1 -DSQLITE_TEMP_STORE=2")
ENDIF ()
ADD_DEFINITIONS(-DBUILD_VERSION="${GIT_VERSION}" ${COMMON_DEFINE})
LINK_LIBRARIES(${COMMON_LIBS})
ADD_LIBRARY(${LIB_PROJECT_TARGET} ${C_SRC} ${C_HEADS})
TARGET_LINK_LIBRARIES(${LIB_PROJECT_TARGET} haywire)
TARGET_LINK_LIBRARIES(${LIB_PROJECT_TARGET} opendhcpd)