--- libmysql/authentication_ldap/CMakeLists.txt.orig	2019-02-18 09:11:31.000000000 +0300
+++ libmysql/authentication_ldap/CMakeLists.txt
@@ -47,7 +47,8 @@ IF(NOT WIN32 AND NOT HAVE_LBER_H)
   CROAK_AND_RETURN("Required LBER header is missing.")
 ENDIF()
 
-MYSQL_ADD_PLUGIN(authentication_ldap_sasl_client
+IF (WITH_AUTHENTICATION_LDAP)
+ MYSQL_ADD_PLUGIN(authentication_ldap_sasl_client
   auth_ldap_sasl_client.cc
   log_client.cc
   LINK_LIBRARIES
@@ -57,6 +58,7 @@ MYSQL_ADD_PLUGIN(authentication_ldap_sasl_client
   CLIENT_ONLY
   MODULE_ONLY
   MODULE_OUTPUT_NAME "authentication_ldap_sasl_client")
+ENDIF()
 
 # The plugin may need symbols which are not loaded by the client.
 IF(STATIC_SASL_LIBRARY)
