Created
June 22, 2021 14:57
-
-
Save santalex/b9fac282dcc55da5a33b2ee8cfa7ec92 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
copied from :https://github.com/spmfilter/spmfilter/blob/master/cmake/Modules/FindZdb.cmake | |
# find zdb database library | |
# | |
find_library(HAVE_ZDB zdb) | |
if(HAVE_ZDB) | |
message(STATUS " found zdb library ${HAVE_ZDB}") | |
find_path(ZDB_HEADER_DIR NAMES | |
"zdb/URL.h" | |
"zdb/ResultSet.h" | |
"zdb/PreparedStatement.h" | |
"zdb/Connection.h" | |
"zdb/ConnectionPool.h" | |
"zdb/SQLException.h" | |
"zdb/Exception.h") | |
string(REGEX REPLACE "include" "include/zdb" ZDB_INCLUDE_DIR ${ZDB_HEADER_DIR}) | |
message(STATUS " found zdb include path ${ZDB_INCLUDE_DIR}") | |
else(HAVE_ZDB) | |
message(STATUS " zdb library could not be found, disabling sql backend.") | |
endif(HAVE_ZDB) | |
CMakeLists.txt | |
if(NOT WITHOUT_ZDB) | |
message(STATUS "checking for one of the modules 'libzdb'") | |
find_package(Zdb) | |
include_directories(${ZDB_INCLUDE_DIR}) | |
link_directories(${ZDB_PATH}) | |
endif(NOT WITHOUT_ZDB) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# - Find zdb | |
# Find the native zdb includes and library | |
# | |
# ZDB_INCLUDE_DIR - where to find zdb.h, etc. | |
# ZDB_LIBRARIES - List of libraries when using zdb. | |
# ZDB_FOUND - True if zdb found. | |
IF (ZDB_INCLUDE_DIR) | |
# Already in cache, be silent | |
SET(ZDB_FIND_QUIETLY TRUE) | |
ENDIF (ZDB_INCLUDE_DIR) | |
FIND_PATH(ZDB_INCLUDE_DIR zdb.h | |
/usr/local/include/zdb | |
/usr/include/zdb | |
) | |
SET(ZDB_NAMES zdb) | |
FIND_LIBRARY(ZDB_LIBRARY | |
NAMES ${ZDB_NAMES} | |
PATHS /usr/lib /usr/local/lib | |
PATH_SUFFIXES zdb | |
) | |
IF (ZDB_INCLUDE_DIR AND ZDB_LIBRARY) | |
SET(ZDB_FOUND TRUE) | |
SET( ZDB_LIBRARIES ${ZDB_LIBRARY} ) | |
ELSE (ZDB_INCLUDE_DIR AND ZDB_LIBRARY) | |
SET(ZDB_FOUND FALSE) | |
SET( ZDB_LIBRARIES ) | |
ENDIF (ZDB_INCLUDE_DIR AND ZDB_LIBRARY) | |
IF (ZDB_FOUND) | |
IF (NOT ZDB_FIND_QUIETLY) | |
MESSAGE(STATUS "Found ZDB: ${ZDB_LIBRARY}") | |
ENDIF (NOT ZDB_FIND_QUIETLY) | |
ELSE (ZDB_FOUND) | |
IF (ZDB_FIND_REQUIRED) | |
MESSAGE(STATUS "Looked for ZDB libraries named ${ZDB_NAMES}.") | |
MESSAGE(FATAL_ERROR "Could NOT find ZDB library") | |
ENDIF (ZDB_FIND_REQUIRED) | |
ENDIF (ZDB_FOUND) | |
MARK_AS_ADVANCED( | |
ZDB_LIBRARY | |
ZDB_INCLUDE_DIR | |
) | |
CMakeLists.txt | |
option(ENABLE_ZDB "Build with ZDB support" ON) | |
if(ENABLE_ZDB) | |
find_package(Zdb REQUIRED) | |
target_include_directories(project PRIVATE ${ZDB_INCLUDE_DIR}) | |
target_link_libraries(project ${ZDB_LIBRARIES}) | |
add_definitions(-DENABLE_ZDB) | |
endif(ENABLE_ZDB) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment