From 601aec8ca008f56df0e6a31de0da6e4cb2954283 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Thu, 7 May 2020 13:02:54 -0700 Subject: [PATCH] Fix LIBDBI_DRIVERS_DIR generation. Reusing the variable in a get_filename_component call caused the function to recurse to /, not very useful. Also re-do GNC_DBD_DIR with no default but to take its value from the command line or environment. --- CMakeLists.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f8831576bb..ec4facdd46d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,7 +96,9 @@ set(LOCALEDIR ${DATAROOTDIR}/locale CACHE STRING "locale-dependent data") set(GNC_HELPDIR ${DATADIR} CACHE STRING "where to store help files") set(DATADIRNAME share) set(GNC_SYSTEM_XDG_DATA_DIRS /usr/local/share /usr/share) -set(GNC_DBD_DIR ${CMAKE_PREFIX_LIBDIR}/dbd CACHE PATH "specify location of libdbi drivers") +if (NOT DEFINED GNC_DBD_DIR) + set(GNC_DBD_DIR $ENV{GNC_DBD_DIR} CACHE PATH "Hint for location of libdbi-drivers.") +endif() set(PKGLIBDIR ${CMAKE_INSTALL_LIBDIR}/gnucash) set(TEST_MYSQL_URL "" CACHE STRING "MySQL database URL for testing") set(TEST_PGSQL_URL "" CACHE STRING "PgSQL database URL for testing") @@ -470,11 +472,11 @@ set(PKG_CONFIG_EXECUTABLE ${GNC_PKG_CONFIG_EXE}) # libdbi find_path (LIBDBI_INCLUDE_PATH dbi/dbi.h) find_library (LIBDBI_LIBRARY dbi) -find_library (LIBDBI_DRIVERS_DIR +find_library (LIBDBI_DRIVERS NAMES dbdmysql dbdpgsql dbdsqlite3 NAMES_PER_DIR PATH_SUFFIXES dbd libdbi-drivers/dbd - HINTS LIBDBI_LIBRARY - PATHS GNC_DBD_DIR + HINTS ${LIBDBI_LIBRARY} + PATHS ${GNC_DBD_DIR} DOC "Libdbi Drivers Directory") if (WITH_SQL) if (NOT LIBDBI_INCLUDE_PATH) @@ -484,10 +486,10 @@ if (WITH_SQL) message (SEND_ERROR "Library libdbi was not found") endif() set(HAVE_DBI_DBI_H 1) - if (NOT LIBDBI_DRIVERS_DIR) + if (NOT LIBDBI_DRIVERS) message (SEND_ERROR "No libdbi drivers found, SQL tests will fail.") else() - get_filename_component(drivers_dir ${LIBDBI_DRIVERS_DIR} DIRECTORY) + get_filename_component(drivers_dir ${LIBDBI_DRIVERS} DIRECTORY) set(LIBDBI_DRIVERS_DIR ${drivers_dir} CACHE FILEPATH "Directory containing the libdbi driver modules." FORCE) endif() endif()