This is an automated email from the ASF dual-hosted git repository. swebb2066 pushed a commit to branch fix_find_odbc in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
commit 84e4d1588c8ac1fb055f56f2eab0e9eb58f5becc Author: Stephen Webb <[email protected]> AuthorDate: Thu Feb 1 15:16:41 2024 +1100 Improve build messages when ODBCAppender is enabled --- src/cmake/FindODBC.cmake | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/cmake/FindODBC.cmake b/src/cmake/FindODBC.cmake index 95bb5952..5d3d3b3d 100644 --- a/src/cmake/FindODBC.cmake +++ b/src/cmake/FindODBC.cmake @@ -4,7 +4,8 @@ include(FindPackageHandleStandardArgs) # This module defines # ODBC_INCLUDE_DIR, where to find odbc.h, etc. # ODBC_LIBRARIES, the libraries to link against to use odbc. -# ODBC_FOUND, set to 'yes' if found +# ODBC_FOUND, set to 1 if found +set(ODBC_FOUND 0) if(WIN32) set(ODBC_LIBRARIES odbc32.lib user32.lib) try_compile(ODBC_FOUND "${CMAKE_BINARY_DIR}/find-odbc" @@ -15,15 +16,17 @@ else() if(NOT ODBC_STATIC) # 'pkg-config --static odbc' does not provide libodbc.a file path find_package(PkgConfig) pkg_check_modules(odbc odbc) - else() - set(odbc_FOUND 0) + set(ODBC_FOUND ${odbc_FOUND}) endif() - #message("odbc_FOUND=${odbc_FOUND}") + #message("ODBC_FOUND=${ODBC_FOUND}") - if(odbc_FOUND) + if(ODBC_FOUND) + #message("odbc_INCLUDE_DIRS=${odbc_INCLUDE_DIRS}") + #message("odbc_LINK_LIBRARIES=${odbc_LINK_LIBRARIES}") + #message("odbc_STATIC_LINK_LIBRARIES=${odbc_STATIC_LINK_LIBRARIES}") find_path(ODBC_INCLUDE_DIR NAMES odbcinst.h - HINTS ${ODBC_INCLUDE_DIRS} + HINTS ${odbc_INCLUDE_DIRS} PATH_SUFFIXES odbc) if (ODBC_STATIC OR NOT BUILD_SHARED_LIBS) set(ODBC_LIBRARIES ${odbc_STATIC_LINK_LIBRARIES}) @@ -37,6 +40,9 @@ else() else() find_library(ODBC_LIBRARIES NAMES odbc HINTS ${ODBC_LIBRARY_DIRS} ) endif() + if(ODBC_INCLUDE_DIR AND ODBC_LIBRARIES) + set(ODBC_FOUND 1) + endif() endif() #message("ODBC_INCLUDE_DIR=${ODBC_INCLUDE_DIR}")
