--- libmysql/authentication_ldap/CMakeLists.txt.orig	2020-01-16 09:39:09.585385000 +0100
+++ libmysql/authentication_ldap/CMakeLists.txt	2020-01-16 09:41:59.054985000 +0100
@@ -47,6 +47,7 @@ IF(NOT WIN32 AND NOT HAVE_LBER_H)
   CROAK_AND_RETURN("Required LBER header is missing.")
 ENDIF()
 
+IF (WITH_AUTHENTICATION_LDAP)
 MYSQL_ADD_PLUGIN(authentication_ldap_sasl_client
   auth_ldap_sasl_client.cc
   log_client.cc
@@ -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)
