Improve berkeley db detection with CMake

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/1/head
Slávek Banko 10 years ago
parent 357bffb17e
commit a539938d4b

@ -2,3 +2,6 @@
// tdecachegrind // tdecachegrind
#cmakedefine HAVE_MMAP 1 #cmakedefine HAVE_MMAP 1
// kbabeldict/modules/dbsearchengine
#cmakedefine USE_DB_H_PATH <@USE_DB_H_PATH@>

@ -37,6 +37,6 @@ tde_add_kpart( kbabeldict_dbsearchengine AUTOMOC
SOURCES SOURCES
KDBSearchEngine.cpp preferenceswidget.cpp dbse_factory.cpp KDBSearchEngine.cpp preferenceswidget.cpp dbse_factory.cpp
dbseprefwidget.ui database.cpp dbscan.cpp dbseprefwidget.ui database.cpp dbscan.cpp
LINK kbabelcommon-shared kbabeldictplugin-shared db LINK kbabelcommon-shared kbabeldictplugin-shared ${BDB_LIBRARY}
DESTINATION ${PLUGIN_INSTALL_DIR} DESTINATION ${PLUGIN_INSTALL_DIR}
) )

@ -9,13 +9,18 @@
# #
################################################# #################################################
find_file( USE_DB_H_PATH NAMES "db5/db.h" "db4/db.h" "db.h" )
check_c_source_compiles(" check_c_source_compiles("
#include <db.h> #include <${USE_DB_H_PATH}>
void main() { DB *db; db->open(db, 0, 0, NULL, DB_BTREE, DB_CREATE, 0644); } " #include <stddef.h>
int main() { DB *db; db->open(db, 0, 0, NULL, DB_BTREE, DB_CREATE, 0644); } "
HAVE_BERKELEY_DB ) HAVE_BERKELEY_DB )
if( HAVE_BERKELEY_DB ) if( HAVE_BERKELEY_DB )
set( BDB_LIBRARY db ) find_library( BDB_LIBRARY db PATH_SUFFIXES db5 db4 )
else( ) endif( )
if( NOT BDB_LIBRARY )
tde_message_fatal( "berkeley db is required, but was not found on your system" ) tde_message_fatal( "berkeley db is required, but was not found on your system" )
endif( ) endif( )

Loading…
Cancel
Save