diff --git a/cmake/Modules/DefineCompilerFlags.cmake b/cmake/Modules/DefineCompilerFlags.cmake index 5c6b4431a..550cc09a7 100644 --- a/cmake/Modules/DefineCompilerFlags.cmake +++ b/cmake/Modules/DefineCompilerFlags.cmake @@ -10,7 +10,10 @@ if (UNIX AND NOT WIN32) if (${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)") # add -Wconversion ? - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -pedantic -pedantic-errors") + # cannot be pedantic with sqlite3 directly linked + if (NOT CSYNC_STATIC_COMPILE_DIR) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -pedantic -pedantic-errors") + endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wshadow -Wmissing-prototypes -Wdeclaration-after-statement") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused -Wfloat-equal -Wpointer-arith -Wwrite-strings -Wformat-security") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-format-attribute") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 56ae6b59e..5e291555e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,8 +2,18 @@ project(libcsync C) add_subdirectory(std) -find_package(SQLite3 REQUIRED) -find_package(Iniparser REQUIRED) +# Statically include sqlite and iniparser +if (CSYNC_STATIC_COMPILE_DIR) + set(SQLITE3_INCLUDE_DIRS "") + set(SQLITE3_LIBRARIES "") + set(INIPARSER_LIBRARIES "") + set(INIPARSER_INCLUDE_DIRS "") + include_directories(${CSYNC_STATIC_COMPILE_DIR}) +else (CSYNC_STATIC_COMPILE_DIR) + find_package(SQLite3 REQUIRED) + find_package(Iniparser REQUIRED) +endif() + set(CSYNC_PUBLIC_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} @@ -69,6 +79,11 @@ set(csync_HDRS vio/csync_vio_module.h ) +# Statically include sqlite and iniparser +if (CSYNC_STATIC_COMPILE_DIR) + list(APPEND csync_SRCS ${CSYNC_STATIC_COMPILE_DIR}/dictionary.c ${CSYNC_STATIC_COMPILE_DIR}/iniparser.c ${CSYNC_STATIC_COMPILE_DIR}/sqlite3.c) +endif() + include_directories( ${CSYNC_PUBLIC_INCLUDE_DIRS} ${CSYNC_PRIVATE_INCLUDE_DIRS}