Skip to content

Commit

Permalink
Fix LIBDBI_DRIVERS_DIR generation.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jralls committed May 7, 2020
1 parent dc8f105 commit 601aec8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions CMakeLists.txt
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand Down

0 comments on commit 601aec8

Please sign in to comment.