Skip to content

Commit

Permalink
Add debbug output
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzmbrzl committed Feb 27, 2025
1 parent 8b2cc35 commit b4ce574
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmake/find_modules/FindMySQL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ if (NOT TARGET MySQL::MySQL)
pkg_check_modules(MySQL IMPORTED_TARGET QUIET mysqlclient)

if (TARGET PkgConfig::MySQL)
message(STATUS "Found MySQL via PkgConf")
add_library(MySQL::MySQL ALIAS PkgConfig::MySQL)
endif()
endif()
Expand All @@ -62,6 +63,7 @@ if (NOT TARGET MySQL::MySQL)
if (CONFIG_EXE)
if (NOT MySQL_INCLUDE_DIRS)
execute_process(COMMAND ${CONFIG_EXE} --include OUTPUT_VARIABLE MySQL_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Found MySQL include dirs via ${CONFIG_EXE}: '${MySQL_INCLUDE_DIRS}'")
endif()
if (NOT MySQL_LIBRARIES)
execute_process(COMMAND ${CONFIG_EXE} --libs OUTPUT_VARIABLE MySQL_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
Expand Down Expand Up @@ -195,6 +197,10 @@ if (TARGET MySQL::MySQL)
# To prevent printing a weird xyz-NOTFOUND as the version number
unset(MySQL_VERSION)
endif()
else()
set(FLAG_REGEX "(^| )-[a-zA-Z]")
string(REGEX REPLACE "${FLAG_REGEX}" "" MySQL_INCLUDE_DIRS "${MySQL_INCLUDE_DIRS}")
string(REGEX REPLACE "${FLAG_REGEX}" "" MySQL_LIBRARIES "${MySQL_LIBRARIES}")
endif()

include(FindPackageHandleStandardArgs)
Expand All @@ -205,8 +211,13 @@ find_package_handle_standard_args(MySQL

if (MySQL_FOUND AND NOT TARGET MySQL::MySQL)
add_library(MySQL INTERFACE)
get_target_property(DIRS MySQL INTERFACE_SYSTEM_INCLUDE_DIRECTORIES)
message(STATUS "Previous include dirs are '${DIRS}'")
target_link_libraries(MySQL INTERFACE ${MySQL_LIBRARIES})
message(STATUS "Setting MySQL include dirs to '${MySQL_INCLUDE_DIRS}'")
target_include_directories(MySQL SYSTEM INTERFACE ${MySQL_INCLUDE_DIRS})
get_target_property(DIRS MySQL INTERFACE_SYSTEM_INCLUDE_DIRECTORIES)
message(STATUS "Configured include dirs are '${DIRS}'")
target_compile_options(MySQL INTERFACE ${MySQL_CFLAGS})
target_link_options(MySQL INTERFACE ${MySQL_LDFLAGS})
target_compile_definitions(MySQL INTERFACE ${MySQL_COMPILE_DEFINITIONS})
Expand Down

0 comments on commit b4ce574

Please sign in to comment.