--- mariadb-10.2.9/sql/CMakeLists.txt	2017-09-25 08:33:25.000000000 +0200
+++ mariadb-10.2.9-patched/sql/CMakeLists.txt	2017-09-29 13:34:35.709895056 +0200
@@ -1,15 +1,15 @@
 # Copyright (c) 2006, 2014, Oracle and/or its affiliates.
 # Copyright (c) 2010, 2016, MariaDB Corporation
-# 
+#
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; version 2 of the License.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
@@ -20,7 +20,7 @@
   SET(WSREP_SOURCES
     wsrep_check_opts.cc
     wsrep_hton.cc
-    wsrep_mysqld.cc 
+    wsrep_mysqld.cc
     wsrep_notify.cc
     wsrep_sst.cc
     wsrep_utils.cc
@@ -36,8 +36,8 @@
 ENDIF()
 
 INCLUDE_DIRECTORIES(
-${CMAKE_SOURCE_DIR}/include 
-${CMAKE_SOURCE_DIR}/sql 
+${CMAKE_SOURCE_DIR}/include
+${CMAKE_SOURCE_DIR}/sql
 ${PCRE_INCLUDES}
 ${ZLIB_INCLUDE_DIR}
 ${SSL_INCLUDE_DIRS}
@@ -46,7 +46,7 @@
 )
 
 SET(GEN_SOURCES
-${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.h 
+${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.h
 ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc
 ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
 ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
@@ -80,9 +80,9 @@
                filesort.cc gstream.cc
                signal_handler.cc
                handler.cc
-               hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc 
-               item_create.cc item_func.cc item_geofunc.cc item_row.cc 
-               item_strfunc.cc item_subselect.cc item_sum.cc item_timefunc.cc 
+               hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc
+               item_create.cc item_func.cc item_geofunc.cc item_row.cc
+               item_strfunc.cc item_subselect.cc item_sum.cc item_timefunc.cc
                key.cc log.cc lock.cc
                log_event.cc rpl_record.cc rpl_reporting.cc
                log_event_old.cc rpl_record_old.cc
@@ -90,31 +90,31 @@
                mysqld.cc net_serv.cc  keycaches.cc
                ../sql-common/client_plugin.c
                opt_range.cc opt_sum.cc
-               ../sql-common/pack.c parse_file.cc password.c procedure.cc 
+               ../sql-common/pack.c parse_file.cc password.c procedure.cc
                protocol.cc records.cc repl_failsafe.cc rpl_filter.cc
                session_tracker.cc
-               set_var.cc 
-               slave.cc sp.cc sp_cache.cc sp_head.cc sp_pcontext.cc 
-               sp_rcontext.cc spatial.cc sql_acl.cc sql_analyse.cc sql_base.cc 
+               set_var.cc
+               slave.cc sp.cc sp_cache.cc sp_head.cc sp_pcontext.cc
+               sp_rcontext.cc spatial.cc sql_acl.cc sql_analyse.cc sql_base.cc
                sql_cache.cc sql_class.cc sql_client.cc sql_crypt.cc
                sql_cursor.cc sql_db.cc sql_delete.cc sql_derived.cc
-               sql_digest.cc sql_do.cc 
+               sql_digest.cc sql_do.cc
                sql_error.cc sql_handler.cc sql_get_diagnostics.cc
-               sql_help.cc sql_insert.cc sql_lex.cc 
+               sql_help.cc sql_insert.cc sql_lex.cc
                sql_list.cc sql_load.cc sql_manager.cc
                sql_parse.cc sql_bootstrap.cc
-               sql_partition.cc sql_plugin.cc sql_prepare.cc sql_rename.cc 
+               sql_partition.cc sql_plugin.cc sql_prepare.cc sql_rename.cc
                debug_sync.cc
                sql_repl.cc sql_select.cc sql_show.cc sql_state.c
                group_by_handler.cc
-               sql_statistics.cc sql_string.cc 
+               sql_statistics.cc sql_string.cc
                sql_table.cc sql_test.cc sql_trigger.cc sql_udf.cc sql_union.cc
-               sql_update.cc sql_view.cc strfunc.cc table.cc thr_malloc.cc 
-               sql_time.cc tztime.cc unireg.cc item_xmlfunc.cc 
+               sql_update.cc sql_view.cc strfunc.cc table.cc thr_malloc.cc
+               sql_time.cc tztime.cc unireg.cc item_xmlfunc.cc
                uniques.cc
                rpl_tblmap.cc sql_binlog.cc event_scheduler.cc event_data_objects.cc
-               event_queue.cc event_db_repository.cc 
-               sql_tablespace.cc events.cc ../sql-common/my_user.c 
+               event_queue.cc event_db_repository.cc
+               sql_tablespace.cc events.cc ../sql-common/my_user.c
                partition_info.cc rpl_utility.cc rpl_injector.cc sql_locale.cc
                rpl_rli.cc rpl_mi.cc sql_servers.cc sql_audit.cc
                sql_connect.cc scheduler.cc sql_partition_admin.cc
@@ -144,7 +144,7 @@
                ${GEN_SOURCES}
                ${MYSYS_LIBWRAP_SOURCE}
 			   )
-  
+
 IF (CMAKE_SYSTEM_NAME MATCHES "Linux" OR
     CMAKE_SYSTEM_NAME MATCHES "Windows" OR
     CMAKE_SYSTEM_NAME MATCHES "SunOS" OR
@@ -163,7 +163,7 @@
 ADD_LIBRARY(sql STATIC ${SQL_SOURCE})
 ADD_DEPENDENCIES(sql GenServerSource)
 DTRACE_INSTRUMENT(sql)
-TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS} 
+TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS}
   mysys mysys_ssl dbug strings vio pcre
   ${LIBWRAP} ${LIBCRYPT} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT}
   ${WSREP_LIB}
@@ -275,18 +275,19 @@
 
 MYSQL_ADD_EXECUTABLE(mysqld ${MYSQLD_SOURCE} DESTINATION ${INSTALL_SBINDIR} COMPONENT Server)
 
-IF(APPLE) 
-  # Add CoreServices framework since some dloadable plugins may need it 
-  FIND_LIBRARY(CORESERVICES NAMES CoreServices) 
-  IF(CORESERVICES) 
-    TARGET_LINK_LIBRARIES(mysqld ${CORESERVICES}) 
-  ENDIF() 
-ENDIF() 
+IF(APPLE)
+  # Add CoreServices framework since some dloadable plugins may need it
+  FIND_LIBRARY(CORESERVICES NAMES CoreServices)
+  IF(CORESERVICES)
+    TARGET_LINK_LIBRARIES(mysqld ${CORESERVICES})
+  ENDIF()
+ENDIF()
 
+
+IF(NOT MSVC)
+  SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE)
+ENDIF()
 IF(NOT WITHOUT_DYNAMIC_PLUGINS)
-  IF(NOT MSVC)
-    SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE)
-  ENDIF()
   GET_TARGET_PROPERTY(mysqld_link_flags mysqld LINK_FLAGS)
   IF(NOT mysqld_link_flags)
     SET(mysqld_link_flags)
@@ -305,37 +306,37 @@
 # Provide plugins with minimal set of libraries
 SET(INTERFACE_LIBS ${LIBRT})
 IF(INTERFACE_LIBS)
- SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_INTERFACE_LIBRARIES 
+ SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_INTERFACE_LIBRARIES
   "${INTERFACE_LIBS}")
 ENDIF()
 
 # On Solaris, some extra effort is required in order to get dtrace probes
 # from static libraries
-DTRACE_INSTRUMENT_STATIC_LIBS(mysqld 
+DTRACE_INSTRUMENT_STATIC_LIBS(mysqld
  "sql;mysys;mysys_ssl;${MYSQLD_STATIC_PLUGIN_LIBS}")
- 
+
 
 SET(WITH_MYSQLD_LDFLAGS "" CACHE STRING "Additional linker flags for mysqld")
 MARK_AS_ADVANCED(WITH_MYSQLD_LDFLAGS)
 IF(WITH_MYSQLD_LDFLAGS)
   GET_TARGET_PROPERTY(mysqld LINK_FLAGS MYSQLD_LINK_FLAGS)
   IF(NOT MYSQLD_LINK_FLAGS)
-    SET(MYSQLD_LINK_FLAGS) 
-  ENDIF() 
-  SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS 
+    SET(MYSQLD_LINK_FLAGS)
+  ENDIF()
+  SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS
      "${MYSQLD_LINK_FLAGS} ${WITH_MYSQLD_LDFLAGS}")
 ENDIF()
 
 INCLUDE(${CMAKE_SOURCE_DIR}/cmake/bison.cmake)
 
-# Handle out-of-source build from source package with possibly broken 
-# bison. Copy bison output to from source to build directory, if not already 
+# Handle out-of-source build from source package with possibly broken
+# bison. Copy bison output to from source to build directory, if not already
 # there
 IF (NOT BISON_USABLE)
 IF (NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
   IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.cc)
     IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc)
-      CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.cc 
+      CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.cc
         ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc COPYONLY)
       CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.h
         ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.h COPYONLY)
@@ -345,7 +346,7 @@
 ENDIF()
 
 RUN_BISON(
-  ${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.yy 
+  ${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.yy
   ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc
   ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.h
 )
@@ -365,7 +366,7 @@
 SET_TARGET_PROPERTIES(mysql_tzinfo_to_sql PROPERTIES COMPILE_FLAGS "-DTZINFO2SQL")
 TARGET_LINK_LIBRARIES(mysql_tzinfo_to_sql mysys mysys_ssl)
 
-ADD_CUSTOM_TARGET( 
+ADD_CUSTOM_TARGET(
         GenServerSource
         DEPENDS ${GEN_SOURCES}
 )
@@ -376,7 +377,7 @@
 IF(WIN32 OR HAVE_DLOPEN AND NOT DISABLE_SHARED)
   ADD_LIBRARY(udf_example MODULE udf_example.c)
   SET_TARGET_PROPERTIES(udf_example PROPERTIES PREFIX "")
-  # udf_example depends on strings 
+  # udf_example depends on strings
   IF(WIN32)
     IF(MSVC)
      SET_TARGET_PROPERTIES(udf_example PROPERTIES LINK_FLAGS "/DEF:${CMAKE_CURRENT_SOURCE_DIR}/udf_example.def")
@@ -392,7 +393,7 @@
   ${CMAKE_SOURCE_DIR}/cmake/make_dist.cmake.in
   ${CMAKE_BINARY_DIR}/make_dist.cmake @ONLY)
 
-ADD_CUSTOM_TARGET(dist 
+ADD_CUSTOM_TARGET(dist
   COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/make_dist.cmake
   DEPENDS ${CMAKE_BINARY_DIR}/sql/sql_yacc.cc ${CMAKE_BINARY_DIR}/sql/sql_yacc.h
   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
@@ -407,7 +408,7 @@
 IF(INSTALL_LAYOUT STREQUAL "STANDALONE")
 
 # Copy db.opt into data/test/
-SET(DBOPT_FILE ${CMAKE_SOURCE_DIR}/support-files/db.opt ) 
+SET(DBOPT_FILE ${CMAKE_SOURCE_DIR}/support-files/db.opt )
 INSTALL(FILES ${DBOPT_FILE} DESTINATION data/test COMPONENT DataFiles)
 
 # Install initial database on windows
@@ -420,7 +421,7 @@
     ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake
     @ONLY
   )
-  
+
   IF(MSVC_IDE OR CMAKE_GENERATOR MATCHES "Xcode")
     SET (CONFIG_PARAM -DCONFIG=${CMAKE_CFG_INTDIR})
   ENDIF()
@@ -432,13 +433,13 @@
      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data
      DEPENDS mysqld
   )
-  ADD_CUSTOM_TARGET(initial_database  
+  ADD_CUSTOM_TARGET(initial_database
     ALL
     DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep
   )
-  INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data DESTINATION . 
-  COMPONENT DataFiles 
-  PATTERN "initdb.dep" EXCLUDE  
+  INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data DESTINATION .
+  COMPONENT DataFiles
+  PATTERN "initdb.dep" EXCLUDE
   PATTERN "bootstrap.sql" EXCLUDE
   PATTERN "aria*" EXCLUDE
   )
@@ -453,7 +454,7 @@
   FILE(TO_NATIVE_PATH ${my_bootstrap_sql} native_outfile)
 
   # Create bootstrapper SQL script
-  ADD_CUSTOM_COMMAND(OUTPUT    
+  ADD_CUSTOM_COMMAND(OUTPUT
     ${my_bootstrap_sql}
     COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_SOURCE_DIR}/scripts
     cmd /c copy mysql_system_tables.sql+mysql_system_tables_data.sql+fill_help_tables.sql+mysql_performance_tables.sql ${native_outfile}
@@ -474,7 +475,7 @@
     DEPENDS comp_sql ${my_bootstrap_sql}
   )
 
-  MYSQL_ADD_EXECUTABLE(mysql_install_db 
+  MYSQL_ADD_EXECUTABLE(mysql_install_db
     mysql_install_db.cc
     ${CMAKE_CURRENT_BINARY_DIR}/mysql_bootstrap_sql.c
     COMPONENT Server
@@ -486,7 +487,7 @@
   TARGET_LINK_LIBRARIES(winservice shell32)
   MYSQL_ADD_EXECUTABLE(mysql_upgrade_service
     mysql_upgrade_service.cc
-    COMPONENT Server)	
+    COMPONENT Server)
   TARGET_LINK_LIBRARIES(mysql_upgrade_service mysys winservice)
 ENDIF(WIN32)
 
