summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2015-06-28 21:13:02 +0200
committerSlávek Banko <slavek.banko@axis.cz>2015-06-28 21:15:40 +0200
commita539938d4b6828063357dbd1e9f3c2808c1629c2 (patch)
tree0786ec4a6e4c3bd0c9540994a1ae641f4c9a9600
parent357bffb17e661ff3e293d38055b10c914e1316d9 (diff)
downloadtdesdk-a539938d4b6828063357dbd1e9f3c2808c1629c2.tar.gz
tdesdk-a539938d4b6828063357dbd1e9f3c2808c1629c2.zip
Improve berkeley db detection with CMake
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r--config.h.cmake3
-rw-r--r--kbabel/kbabeldict/modules/dbsearchengine/CMakeLists.txt2
-rw-r--r--kbabel/kbabeldict/modules/dbsearchengine/ConfigureChecks.cmake13
3 files changed, 13 insertions, 5 deletions
diff --git a/config.h.cmake b/config.h.cmake
index eefae06e..f1ac1ba4 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -2,3 +2,6 @@
// tdecachegrind
#cmakedefine HAVE_MMAP 1
+
+// kbabeldict/modules/dbsearchengine
+#cmakedefine USE_DB_H_PATH <@USE_DB_H_PATH@>
diff --git a/kbabel/kbabeldict/modules/dbsearchengine/CMakeLists.txt b/kbabel/kbabeldict/modules/dbsearchengine/CMakeLists.txt
index feab64f1..f6fa497c 100644
--- a/kbabel/kbabeldict/modules/dbsearchengine/CMakeLists.txt
+++ b/kbabel/kbabeldict/modules/dbsearchengine/CMakeLists.txt
@@ -37,6 +37,6 @@ tde_add_kpart( kbabeldict_dbsearchengine AUTOMOC
SOURCES
KDBSearchEngine.cpp preferenceswidget.cpp dbse_factory.cpp
dbseprefwidget.ui database.cpp dbscan.cpp
- LINK kbabelcommon-shared kbabeldictplugin-shared db
+ LINK kbabelcommon-shared kbabeldictplugin-shared ${BDB_LIBRARY}
DESTINATION ${PLUGIN_INSTALL_DIR}
)
diff --git a/kbabel/kbabeldict/modules/dbsearchengine/ConfigureChecks.cmake b/kbabel/kbabeldict/modules/dbsearchengine/ConfigureChecks.cmake
index 3c03cff1..7dd8a1a9 100644
--- a/kbabel/kbabeldict/modules/dbsearchengine/ConfigureChecks.cmake
+++ b/kbabel/kbabeldict/modules/dbsearchengine/ConfigureChecks.cmake
@@ -9,13 +9,18 @@
#
#################################################
+find_file( USE_DB_H_PATH NAMES "db5/db.h" "db4/db.h" "db.h" )
+
check_c_source_compiles("
- #include <db.h>
- void main() { DB *db; db->open(db, 0, 0, NULL, DB_BTREE, DB_CREATE, 0644); } "
+ #include <${USE_DB_H_PATH}>
+ #include <stddef.h>
+ int main() { DB *db; db->open(db, 0, 0, NULL, DB_BTREE, DB_CREATE, 0644); } "
HAVE_BERKELEY_DB )
if( HAVE_BERKELEY_DB )
- set( BDB_LIBRARY db )
-else( )
+ find_library( BDB_LIBRARY db PATH_SUFFIXES db5 db4 )
+endif( )
+
+if( NOT BDB_LIBRARY )
tde_message_fatal( "berkeley db is required, but was not found on your system" )
endif( )