$NetBSD: patch-CMakeLists.txt,v 1.1 2021/05/08 19:47:16 jdolecek Exp $

Allow building a server-only configuration.

--- CMakeLists.txt.orig	2021-02-18 23:22:28.000000000 +0000
+++ CMakeLists.txt
@@ -405,8 +405,6 @@ ENDIF()
 
 SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "")
 
-INCLUDE(mariadb_connector_c) # this does ADD_SUBDIRECTORY(libmariadb)
-
 INCLUDE(cpack_rpm)
 INCLUDE(cpack_deb)
 
@@ -416,19 +414,26 @@ MARK_AS_ADVANCED(PYTHON_SHEBANG)
 # Add storage engines and plugins.
 CONFIGURE_PLUGINS()
 
-ADD_SUBDIRECTORY(include)
+INCLUDE(cmake/abi_check.cmake)
+INCLUDE(cmake/tags.cmake)
+INCLUDE(for_clients)
+
 ADD_SUBDIRECTORY(dbug)
 ADD_SUBDIRECTORY(strings)
 ADD_SUBDIRECTORY(vio)
 ADD_SUBDIRECTORY(mysys)
 ADD_SUBDIRECTORY(mysys_ssl)
-ADD_SUBDIRECTORY(client)
 ADD_SUBDIRECTORY(extra)
 ADD_SUBDIRECTORY(libservices)
 ADD_SUBDIRECTORY(sql/share)
 
-IF(NOT WITHOUT_SERVER)
+IF(WITHOUT_SERVER)
+  INCLUDE(mariadb_connector_c) # this does ADD_SUBDIRECTORY(libmariadb)
+  ADD_SUBDIRECTORY(include)
+  ADD_SUBDIRECTORY(client)
+  ADD_SUBDIRECTORY(man)
   ADD_SUBDIRECTORY(tests)
+ELSE()
   ADD_SUBDIRECTORY(sql)
   OPTION (WITH_EMBEDDED_SERVER "Compile MySQL with embedded server" OFF)
   IF(WITH_EMBEDDED_SERVER) 
@@ -446,21 +451,15 @@ IF(NOT WITHOUT_SERVER)
   ENDIF()
 ENDIF()
 
-IF(UNIX)
-  ADD_SUBDIRECTORY(man)
-ENDIF()
-
-INCLUDE(cmake/abi_check.cmake)
-INCLUDE(cmake/tags.cmake)
-INCLUDE(for_clients)
 ADD_SUBDIRECTORY(scripts)
-ADD_SUBDIRECTORY(support-files)
 ADD_SUBDIRECTORY(extra/aws_sdk)
 
 IF(NOT CMAKE_CROSSCOMPILING)
-  SET(EXPORTED comp_err comp_sql factorial)
+  SET(EXPORTED comp_err factorial)
   IF(NOT WITHOUT_SERVER)
     SET(EXPORTED ${EXPORTED} gen_lex_hash gen_lex_token)
+  ELSE()
+    SET(EXPORTED ${EXPORTED} comp_sql)
   ENDIF()
   # minimal target to build only binaries for export
   ADD_CUSTOM_TARGET(import_executables DEPENDS ${EXPORTED})
