Files
gentoo/dev-db/soci/files/FindMySQL.cmake
Jan-Espen Oversand f54a845b49 dev-db/soci: fix relying on backend auto magic
Parameters SOCI_* disables/enables backends. This is straight forward
for most of the backends. The mysql backend can either use
mysql-connector-c or mariadb-connector-c. Which one of them is decided
by the find_package mysql script provided by upstream. That does not
work since we need to respect the use flags by the user and declare a
dependency to the correct connector. Most of the complexity of this is
due to mysql/mariadb and that is solved by providing a FindMySQL.cmake
that takes parameters for mysql libs and headers. The cmake scripts do
not call find_package for disabled backends, passing
CMAKE_DISABLE_FIND_PACKAGE_*=TRUE in addition to SOCI_*=off will
therefore produce cmake warnings.

Signed-off-by: Jan-Espen Oversand <sigsegv@radiotube.org>
Closes: https://bugs.gentoo.org/968287
Part-of: https://github.com/gentoo/gentoo/pull/45248
Closes: https://github.com/gentoo/gentoo/pull/45248
Signed-off-by: Kenton Groombridge <concord@gentoo.org>
2026-01-06 13:08:21 -05:00

9 lines
268 B
CMake

if (NOT TARGET MySQL::MySQL)
set(MySQL_FOUND TRUE)
add_library(MySQL INTERFACE)
target_link_libraries(MySQL INTERFACE ${MySQL_LIBRARIES})
target_include_directories(MySQL SYSTEM INTERFACE ${MySQL_INCLUDE_DIRS})
add_library(MySQL::MySQL ALIAS MySQL)
endif()