SET(LIB_PROJECT_TARGET common) PROJECT(${LIB_PROJECT_TARGET} LANGUAGES C VERSION 1.1.0) STRING(REPLACE ";" ", " BUILD_CONFIG_INFO "${COMMON_DEFINE}") CONFIGURE_FILE(lib_config.h.in lib_config.h) IF (USED_SQLITE_CRYPTO) INCLUDE_DIRECTORIES(include/sqlite3) ENDIF () INCLUDE_DIRECTORIES(include ../opendhcp183 mongoose ./ ./include ../lwip/src/include ../lwip/src/arch_linux/include ../include) FILE(GLOB C_HEADS ./include/network/*.h include/*.h include/uthash/*.h include/s2j/*.h vector/*.h ${CMAKE_BINARY_DIR}/*.h ${PROJECT_BINARY_DIR}/*.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(bitset 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(ipaddr C_SRC) IF (USED_ZMQ) AUX_SOURCE_DIRECTORY(mq C_SRC) ENDIF () AUX_SOURCE_DIRECTORY(cmdline C_SRC) AUX_SOURCE_DIRECTORY(crypto C_SRC) AUX_SOURCE_DIRECTORY(hardware C_SRC) AUX_SOURCE_DIRECTORY(protocol C_SRC) AUX_SOURCE_DIRECTORY(fs_watch C_SRC) AUX_SOURCE_DIRECTORY(zlog_module C_SRC) IF (USED_JSON_VALIDATE) ADD_SUBDIRECTORY(./json/json_schema) ENDIF () IF (USED_HTTP_SVR) AUX_SOURCE_DIRECTORY(mongoose C_SRC) ENDIF () IF (USED_SQLITE) LIST(APPEND C_SRC database/database.c) IF (SQLITE_CRYPTO_ON) AUX_SOURCE_DIRECTORY(database/sqlite3 C_SRC) ENDIF () ENDIF () SET(CMAKE_C_STANDARD 99) SET_SOURCE_FILES_PROPERTIES(misc/zvector.c PROPERTIES COMPILE_FLAGS "-Wall -Wextra -flto") SET_SOURCE_FILES_PROPERTIES(mongoose/mongoose.c PROPERTIES COMPILE_FLAGS "-Wall -Wextra -w") IF (USED_SQLITE_CRYPTO) 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(${COMMON_DEFINE}) IF (USED_HTTP_SVR) ADD_DEFINITIONS(-DMG_ARCH=MG_ARCH_UNIX -DMG_ENABLE_OPENSSL=1) ENDIF () ADD_LIBRARY(${LIB_PROJECT_TARGET} ${C_SRC} ${C_HEADS}) TARGET_LINK_LIBRARIES(${LIB_PROJECT_TARGET} ${COMMON_LIBS}) IF (USED_JSON_VALIDATE) TARGET_LINK_LIBRARIES(${LIB_PROJECT_TARGET} jsoncdac) ENDIF () IF (USED_OPENDHCPD) #TARGET_LINK_LIBRARIES(${LIB_PROJECT_TARGET} opendhcpd) TARGET_LINK_LIBRARIES(${LIB_PROJECT_TARGET} dhcpd opendhcpd) ENDIF () TARGET_INCLUDE_DIRECTORIES(${LIB_PROJECT_TARGET} PUBLIC ${PROJECT_BINARY_DIR}/ ${CMAKE_BINARY_DIR}/)