$NetBSD: patch-scripts_CMakeLists.txt,v 1.2 2023/05/28 16:44:25 wiz Exp $

Split configuration between mysql-client and mysql-server.

--- scripts/CMakeLists.txt.orig	2023-03-16 17:22:37.000000000 +0000
+++ scripts/CMakeLists.txt
@@ -315,6 +315,10 @@ MACRO(EXTRACT_LINK_LIBRARIES target var)
     FOREACH(lib ${TARGET_LIB_DEPENDS})
       IF (lib MATCHES "^\\-l")
         SET(${var} "${${var}} ${lib} ")
+      ELSEIF (lib MATCHES "^ext::zlib")
+        STRING(REGEX MATCH "ext::([a-z]+)" MATCH_LIB "${lib}")
+        SET(SYSTEM_LIB z)
+        SET(${var} "${${var}} -lz ")
       ELSEIF (lib MATCHES "^ext::")
         STRING(REGEX MATCH "ext::([a-z]+)" MATCH_LIB "${lib}")
         SET(SYSTEM_LIB ${CMAKE_MATCH_1})
@@ -409,7 +413,7 @@ ELSE()
     ${CMAKE_CURRENT_BINARY_DIR}/${PKGCONFIG_FILE}
     ESCAPE_QUOTES @ONLY)
 
-  IF(INSTALL_PKGCONFIGDIR)
+  IF(INSTALL_PKGCONFIGDIR AND WITHOUT_SERVER)
     MESSAGE(STATUS "INSTALL ${PKGCONFIG_FILE} ${INSTALL_PKGCONFIGDIR}")
     INSTALL(FILES
       ${CMAKE_CURRENT_BINARY_DIR}/${PKGCONFIG_FILE}
@@ -422,19 +426,24 @@ ELSE()
   # mysqld_safe used in mtr even for systemd platforms
   IF(WITH_SYSTEMD)
     SET(BIN_SCRIPTS
-      mysql_config
       mysqldumpslow
       mysqld_safe
       )
   ELSE()
     SET(BIN_SCRIPTS
-      mysql_config
       mysqldumpslow
       mysqld_multi
       mysqld_safe
       )
   ENDIF()
 
+  IF(NOT WITHOUT_CLIENTLIBS)
+    SET(BIN_SCRIPTS
+      ${BIN_SCRIPTS}
+      mysql_config
+    )
+  ENDIF(NOT WITHOUT_CLIENTLIBS)
+
   FOREACH(file ${BIN_SCRIPTS})
     IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh)
       CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh
