summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-12-01 14:59:22 +0100
committerlouiz’ <louiz@louiz.org>2017-12-02 20:08:50 +0100
commit414bbca0bc2bf20c4f424c2368997a46129b32cc (patch)
treec9e67c8eedee84963ecc920d8158738770f9238e /CMakeLists.txt
parent923cf31ba62ebfd2369a9594a60020477730b649 (diff)
downloadbiboumi-414bbca0bc2bf20c4f424c2368997a46129b32cc.tar.gz
biboumi-414bbca0bc2bf20c4f424c2368997a46129b32cc.tar.bz2
biboumi-414bbca0bc2bf20c4f424c2368997a46129b32cc.tar.xz
biboumi-414bbca0bc2bf20c4f424c2368997a46129b32cc.zip
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
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt22
1 files changed, 15 insertions, 7 deletions
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)