$NetBSD: patch-libmysql_CMakeLists.txt,v 1.3 2023/05/23 21:01:12 adam Exp $

Do not install libmysqlclient with the server.
Generate versioned lib symlinks on FreeBSD to supress PLIST divergence.
authentication_ldap and libmysql_api_test require libmysqld.
Don't bother with libmysql_api_test - requires libmysqlclient installed.

--- libmysql/CMakeLists.txt.orig	2023-03-16 17:22:37.000000000 +0000
+++ libmysql/CMakeLists.txt
@@ -289,8 +289,14 @@ ADD_SUBDIRECTORY(authentication_kerberos
 # authentication IAM client plug-in
 ADD_SUBDIRECTORY(authentication_oci_client)
 
+IF(WITHOUT_SERVER)
+  SET(SERVER_SKIP_INSTALL "")
+ELSE()
+  SET(SERVER_SKIP_INSTALL SKIP_INSTALL)
+ENDIF()
+
 # Merge several convenience libraries into one big mysqlclient
-MERGE_CONVENIENCE_LIBRARIES(mysqlclient ${LIBS_TO_MERGE}
+MERGE_CONVENIENCE_LIBRARIES(mysqlclient ${SERVER_SKIP_INSTALL} ${LIBS_TO_MERGE}
   COMPONENT Development
   LINK_LIBRARIES ${LIBS_TO_LINK}
   )
@@ -328,7 +334,7 @@ ENDIF()
 
 IF(UNIX)
   SET(OS_SHARED_LIB_VERSION "${SHARED_LIB_MAJOR_VERSION}")
-  IF(NOT FREEBSD AND NOT APPLE)
+  IF(NOT APPLE)
     STRING_APPEND(OS_SHARED_LIB_VERSION
       ".${SHARED_LIB_MINOR_VERSION}.${SHARED_LIB_PATCH_VERSION}")
   ENDIF()
@@ -340,7 +346,7 @@ ENDIF()
 
 # Merge several convenience libraries into one big mysqlclient
 # and link them together into shared library.
-MERGE_LIBRARIES_SHARED(libmysql ${LIBS_TO_MERGE}
+MERGE_LIBRARIES_SHARED(libmysql ${SERVER_SKIP_INSTALL} ${LIBS_TO_MERGE}
   EXPORTS
   ${CLIENT_API_FUNCTIONS}
   ${CLIENT_API_FUNCTIONS_UNDOCUMENTED}
@@ -406,6 +412,7 @@ CONFIGURE_FILE(api_test.c.in ${CMAKE_CUR
 # from @CLIENT_API_FUNCTIONS@ are declared by <mysql.h>. It will fail
 # to run if not all of these symbols are exported by the library.
 #
+IF(FALSE)
 MYSQL_ADD_EXECUTABLE(libmysql_api_test
   ${CMAKE_CURRENT_BINARY_DIR}/api_test.c
   LINK_LIBRARIES libmysql ${LIBRT}
@@ -439,3 +446,4 @@ ADD_CUSTOM_COMMAND(
 MY_ADD_CUSTOM_TARGET(run_libmysql_api_test ALL
   DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libmysql_api_test.out
   )
+ENDIF()
