From 0168b96b79db2627fdba77a8712956408aa081d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Wed, 4 Oct 2017 21:28:18 +0200 Subject: Add postgresql support --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 7752382..f7dd534 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,6 +130,12 @@ elseif(NOT WITHOUT_SQLITE3) find_package(SQLITE3) endif() +if(WITH_POSTGRESQL) + find_package(PQ REQUIRED) +elseif(NOT WITHOUT_POSTGRESQL) + find_package(PQ) +endif() + # ## Set all the include directories, depending on what libraries are used # @@ -193,6 +199,7 @@ if(SQLITE3_FOUND) add_library(database OBJECT ${source_database}) include_directories(database ${SQLITE3_INCLUDE_DIRS}) + include_directories(database ${PQ_INCLUDE_DIRS}) set(USE_DATABASE TRUE) else() add_library(database OBJECT "") @@ -261,7 +268,9 @@ if(LIBIDN_FOUND) endif() if(USE_DATABASE) target_link_libraries(${PROJECT_NAME} ${SQLITE3_LIBRARIES}) + target_link_libraries(${PROJECT_NAME} ${PQ_LIBRARIES}) target_link_libraries(test_suite ${SQLITE3_LIBRARIES}) + target_link_libraries(test_suite ${PQ_LIBRARIES}) endif() # Define a __FILENAME__ macro with the relative path (from the base project directory) -- cgit v1.2.3 From 414bbca0bc2bf20c4f424c2368997a46129b32cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Fri, 1 Dec 2017 14:59:22 +0100 Subject: Handle postgresql and sqlite3 libs properly Do not fail to compile when one of them is missing but the other one is not. Raise an error when trying to open a database with the missing library. see #3237 --- CMakeLists.txt | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index f7dd534..ba11aa6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -193,13 +193,17 @@ file(GLOB source_network src/network/*.[hc]pp) add_library(network OBJECT ${source_network}) -if(SQLITE3_FOUND) +if(SQLITE3_FOUND OR PQ_FOUND) file(GLOB source_database src/database/*.[hc]pp) add_library(database OBJECT ${source_database}) - include_directories(database ${SQLITE3_INCLUDE_DIRS}) - include_directories(database ${PQ_INCLUDE_DIRS}) + if(SQLITE3_FOUND) + include_directories(database ${SQLITE3_INCLUDE_DIRS}) + endif() + if(PQ_FOUND) + include_directories(database ${PQ_INCLUDE_DIRS}) + endif() set(USE_DATABASE TRUE) else() add_library(database OBJECT "") @@ -267,10 +271,14 @@ if(LIBIDN_FOUND) target_link_libraries(test_suite ${LIBIDN_LIBRARIES}) endif() if(USE_DATABASE) - target_link_libraries(${PROJECT_NAME} ${SQLITE3_LIBRARIES}) - target_link_libraries(${PROJECT_NAME} ${PQ_LIBRARIES}) - target_link_libraries(test_suite ${SQLITE3_LIBRARIES}) - target_link_libraries(test_suite ${PQ_LIBRARIES}) + if(SQLITE3_FOUND) + target_link_libraries(${PROJECT_NAME} ${SQLITE3_LIBRARIES}) + target_link_libraries(test_suite ${SQLITE3_LIBRARIES}) + endif() + if(PQ_FOUND) + target_link_libraries(${PROJECT_NAME} ${PQ_LIBRARIES}) + target_link_libraries(test_suite ${PQ_LIBRARIES}) +endif() endif() # Define a __FILENAME__ macro with the relative path (from the base project directory) -- cgit v1.2.3 From 24dc05dd979264143223e166faa032e75f986b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sun, 3 Dec 2017 16:28:38 +0100 Subject: Run some of the ci tests against a postgresql docker container --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index ba11aa6..155b73a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ endif() # ## Find optional instrumentation libraries that will be used in debug only # -find_library(LIBASAN NAMES asan libasan.so.3 libasan.so.2 libasan.so.1) +find_library(LIBASAN NAMES asan libasan.so.4 libasan.so.3 libasan.so.2 libasan.so.1) find_library(LIBUBSAN NAMES ubsan libubsan.so.0) # -- cgit v1.2.3