"Fossies" - the Fresh Open Source Software Archive

Member "mysql-connector-c-6.1.11-src/libmysql/CMakeLists.txt" (13 Jul 2017, 10855 Bytes) of package /linux/misc/old/mysql-connector-c-6.1.11-src.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "CMakeLists.txt": 6.1.10-src_vs_6.1.11-src.

    1 # Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
    2 # 
    3 # This program is free software; you can redistribute it and/or modify
    4 # it under the terms of the GNU General Public License as published by
    5 # the Free Software Foundation; version 2 of the License.
    6 # 
    7 # This program is distributed in the hope that it will be useful,
    8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
    9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   10 # GNU General Public License for more details.
   11 # 
   12 # You should have received a copy of the GNU General Public License
   13 # along with this program; if not, write to the Free Software
   14 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
   15 
   16 INCLUDE_DIRECTORIES(
   17   ${CMAKE_SOURCE_DIR}/include
   18   ${CMAKE_SOURCE_DIR}/libmysql
   19   ${CMAKE_SOURCE_DIR}/regex
   20   ${CMAKE_SOURCE_DIR}/sql
   21   ${CMAKE_SOURCE_DIR}/strings
   22   ${SSL_INCLUDE_DIRS}
   23   ${SSL_INTERNAL_INCLUDE_DIRS}
   24   ${ZLIB_INCLUDE_DIR})
   25 ADD_DEFINITIONS(${SSL_DEFINES})
   26 
   27 SET(CLIENT_API_FUNCTIONS
   28 mysql_thread_end
   29 mysql_thread_init
   30 mysql_affected_rows
   31 mysql_autocommit
   32 mysql_stmt_bind_param
   33 mysql_stmt_bind_result
   34 mysql_change_user
   35 mysql_character_set_name
   36 mysql_close
   37 mysql_commit
   38 mysql_data_seek
   39 mysql_debug
   40 mysql_dump_debug_info
   41 mysql_eof
   42 mysql_errno
   43 mysql_error
   44 mysql_escape_string
   45 mysql_hex_string
   46 mysql_stmt_execute
   47 mysql_stmt_fetch
   48 mysql_stmt_fetch_column
   49 mysql_fetch_field
   50 mysql_fetch_field_direct
   51 mysql_fetch_fields
   52 mysql_fetch_lengths
   53 mysql_fetch_row
   54 mysql_field_count
   55 mysql_field_seek
   56 mysql_field_tell
   57 mysql_free_result
   58 mysql_get_client_info
   59 mysql_get_host_info
   60 mysql_get_proto_info
   61 mysql_get_server_info
   62 mysql_get_client_version
   63 mysql_get_ssl_cipher
   64 mysql_info
   65 mysql_init
   66 mysql_insert_id
   67 mysql_kill
   68 mysql_set_server_option
   69 mysql_list_dbs
   70 mysql_list_fields
   71 mysql_list_processes
   72 mysql_list_tables
   73 mysql_more_results
   74 mysql_next_result
   75 mysql_num_fields
   76 mysql_num_rows
   77 mysql_options
   78 mysql_stmt_param_count
   79 mysql_stmt_param_metadata
   80 mysql_ping
   81 mysql_stmt_result_metadata
   82 mysql_query
   83 # We need to have document for this api
   84 mysql_read_query_result
   85 mysql_real_connect
   86 mysql_real_escape_string
   87 mysql_real_escape_string_quote
   88 mysql_real_query
   89 mysql_refresh
   90 mysql_rollback
   91 mysql_row_seek
   92 mysql_row_tell
   93 mysql_select_db
   94 mysql_stmt_send_long_data
   95 # We need to have document for this api
   96 mysql_send_query
   97 mysql_shutdown
   98 mysql_ssl_set
   99 mysql_stat
  100 mysql_stmt_affected_rows
  101 mysql_stmt_close
  102 mysql_stmt_reset
  103 mysql_stmt_data_seek
  104 mysql_stmt_errno
  105 mysql_stmt_error
  106 mysql_stmt_free_result
  107 mysql_stmt_num_rows
  108 mysql_stmt_row_seek
  109 mysql_stmt_row_tell
  110 mysql_stmt_store_result
  111 mysql_store_result
  112 mysql_thread_id
  113 mysql_thread_safe
  114 mysql_use_result
  115 mysql_warning_count
  116 mysql_stmt_sqlstate
  117 mysql_sqlstate
  118 mysql_get_server_version
  119 mysql_stmt_prepare
  120 mysql_stmt_init
  121 mysql_stmt_insert_id
  122 mysql_stmt_attr_get
  123 mysql_stmt_attr_set
  124 mysql_stmt_field_count
  125 mysql_set_local_infile_default
  126 mysql_set_local_infile_handler
  127 mysql_server_init
  128 mysql_server_end
  129 mysql_set_character_set
  130 mysql_get_character_set_info
  131 mysql_stmt_next_result
  132 # Since its already documented we will keep it. FR will be created to redesign.
  133 my_init
  134 mysql_client_find_plugin
  135 mysql_client_register_plugin
  136 mysql_load_plugin
  137 mysql_load_plugin_v
  138 mysql_options4
  139 mysql_plugin_options
  140 mysql_reset_connection
  141 mysql_get_option
  142 mysql_session_track_get_first
  143 mysql_session_track_get_next
  144 
  145 CACHE INTERNAL "Functions exported by client API"
  146 
  147 )
  148 
  149 # Below lists will have all the undocumented C API symbols but still exported.
  150 # Once the decision is taken to have documentation we need to move them to
  151 # CLIENT_API_FUNCTIONS list.
  152 SET(CLIENT_API_FUNCTIONS_UNDOCUMENTED_20_0
  153 get_tty_password
  154 # my_load_defaults is a wrapper for load_defaults and it is not documented. We
  155 # will have a FR to replace this for decent name/functionality and document it.
  156 my_load_defaults
  157 handle_options
  158 
  159 CACHE INTERNAL "Undocumented functions exported by client API in version 20.0"
  160 
  161 )
  162 
  163 SET(CLIENT_API_FUNCTIONS_UNDOCUMENTED_20_3
  164   # pure-ftpd 1.0.42 needs either my_make_scrambled_password (preferred)
  165   # or make_scrambled_password.
  166   my_make_scrambled_password
  167 
  168   CACHE INTERNAL "Undocumented functions exported by client API in version 20.3"
  169 
  170 )
  171 
  172 SET(CLIENT_API_FUNCTIONS_UNDOCUMENTED
  173   ${CLIENT_API_FUNCTIONS_UNDOCUMENTED_20_0}
  174   ${CLIENT_API_FUNCTIONS_UNDOCUMENTED_20_3}
  175 
  176   CACHE INTERNAL "Undocumented functions exported by client API"
  177 
  178 )
  179 
  180 SET(CLIENT_SOURCES
  181   get_password.c 
  182   libmysql.c
  183   errmsg.c
  184   ../sql-common/client.c 
  185   ../sql-common/my_time.c 
  186   ../sql-common/client_plugin.c 
  187   ../sql-common/client_authentication.cc
  188   ../sql/net_serv.cc
  189   ../sql-common/pack.c 
  190   ../sql/auth/password.c
  191 )
  192 
  193 IF (WIN32 AND OPENSSL_APPLINK_C)
  194   SET_SOURCE_FILES_PROPERTIES(
  195     ../sql-common/client_authentication.cc
  196     PROPERTIES COMPILE_FLAGS "-DHAVE_OPENSSL_APPLINK_C"
  197   )
  198 ENDIF()
  199 
  200 #
  201 # Include protocol tracing infrastructure and the test
  202 # trace plugin if enabled by build options.
  203 #
  204 IF (WITH_CLIENT_PROTOCOL_TRACING)
  205 
  206   LIST(APPEND CLIENT_SOURCES mysql_trace.c)
  207   ADD_DEFINITIONS(-D CLIENT_PROTOCOL_TRACING)
  208 
  209   IF (WITH_TEST_TRACE_PLUGIN)
  210     MESSAGE(STATUS "Client library contains the test trace plugin")
  211     LIST(APPEND CLIENT_SOURCES test_trace_plugin.cc)
  212     ADD_DEFINITIONS(-D TEST_TRACE_PLUGIN)
  213   ENDIF (WITH_TEST_TRACE_PLUGIN)
  214 
  215 ENDIF (WITH_CLIENT_PROTOCOL_TRACING)
  216 
  217 ADD_CONVENIENCE_LIBRARY(clientlib ${CLIENT_SOURCES})
  218 DTRACE_INSTRUMENT(clientlib)
  219 ADD_DEPENDENCIES(clientlib GenError)
  220 
  221 if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
  222   target_compile_options(clientlib PRIVATE
  223     -Wno-unused-variable  # libmysql.c:4517
  224   )
  225 endif()
  226 
  227 SET(LIBS clientlib dbug strings vio mysys mysys_ssl ${ZLIB_LIBRARY} ${SSL_LIBRARIES} ${LIBDL})
  228 
  229 #
  230 # On Windows platform client library includes the client-side 
  231 # Windows Native Authentication plugin.
  232 #
  233 IF(WIN32)
  234   ADD_DEFINITIONS(-DAUTHENTICATION_WIN)
  235   ADD_SUBDIRECTORY(authentication_win)
  236   LIST(APPEND LIBS auth_win_client)
  237 ENDIF()
  238 
  239 # Merge several convenience libraries into one big mysqlclient
  240 IF(STATIC_LIB_SUBDIR)
  241   SET(OLD_INSTALL_LIBDIR ${INSTALL_LIBDIR})
  242   SET(INSTALL_LIBDIR ${INSTALL_LIBDIR}/${STATIC_LIB_SUBDIR})
  243 ENDIF()
  244 IF(DISABLE_STATIC)
  245   MERGE_LIBRARIES(mysqlclient STATIC ${LIBS} COMPONENT Development NOINSTALL)
  246 ELSE()
  247   MERGE_LIBRARIES(mysqlclient STATIC ${LIBS} COMPONENT Development)
  248 ENDIF()
  249 IF(STATIC_LIB_SUBDIR)
  250   SET(INSTALL_LIBDIR ${OLD_INSTALL_LIBDIR})
  251 ENDIF()
  252 
  253 MACRO(GET_TARGET_NAME target out_name)
  254   GET_TARGET_PROPERTY(location ${target} LOCATION)
  255   GET_FILENAME_COMPONENT(name ${location} NAME)
  256   SET(${out_name} ${name})
  257 ENDMACRO()
  258 
  259 IF(UNIX)
  260   MACRO(GET_VERSIONED_LIBNAME LIBNAME EXTENSION VERSION OUTNAME)
  261     SET(DOT_VERSION ".${VERSION}")
  262     IF(DOT_VERSION STREQUAL ".") 
  263       SET(DOT_VERSION "")
  264     ENDIF()
  265     IF(APPLE)
  266       SET(${OUTNAME} ${LIBNAME}${DOT_VERSION}${EXTENSION})
  267     ELSE()
  268       SET(${OUTNAME} ${LIBNAME}${EXTENSION}${DOT_VERSION})
  269     ENDIF() 
  270   ENDMACRO()
  271 ENDIF()
  272 
  273 # In our special "mixed" builds, also install libstlport which will
  274 # be injected into the build tree by the Sun Studio part of the build.
  275 
  276 IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND DEFINED ENV{PB2WORKDIR})
  277   INSTALL(FILES ${CMAKE_BINARY_DIR}/libstlport.so
  278                 ${CMAKE_BINARY_DIR}/libstlport.so.1
  279           DESTINATION ${INSTALL_LIBDIR} COMPONENT SharedLibraries OPTIONAL)
  280 ENDIF()
  281 
  282 IF(NOT DISABLE_SHARED)
  283   # Merge several convenience libraries into one big mysqlclient
  284   # and link them together into shared library.
  285   MERGE_LIBRARIES(libmysql SHARED ${LIBS}
  286     EXPORTS ${CLIENT_API_FUNCTIONS} ${CLIENT_API_FUNCTIONS_UNDOCUMENTED}
  287     COMPONENT SharedLibraries)
  288   IF(UNIX)
  289     # libtool compatability
  290     IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR APPLE)
  291       SET(OS_SHARED_LIB_VERSION "${SHARED_LIB_MAJOR_VERSION}")
  292     ELSE()
  293       SET(OS_SHARED_LIB_VERSION
  294         "${SHARED_LIB_MAJOR_VERSION}.${SHARED_LIB_MINOR_VERSION}.${SHARED_LIB_PATCH_VERSION}")
  295     ENDIF()
  296     # Name of shared library is mysqlclient on Unix
  297     SET_TARGET_PROPERTIES(libmysql PROPERTIES 
  298       OUTPUT_NAME mysqlclient 
  299       VERSION "${OS_SHARED_LIB_VERSION}" 
  300       SOVERSION "${SHARED_LIB_MAJOR_VERSION}")
  301     CONFIGURE_FILE(libmysql.ver.in ${CMAKE_CURRENT_BINARY_DIR}/libmysql.ver)
  302 
  303     IF(APPLE)
  304       SET_TARGET_PROPERTIES(libmysql PROPERTIES
  305         INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBDIR}"
  306       )
  307     ENDIF()
  308 
  309     GET_TARGET_PROPERTY(libmysql_link_flags libmysql LINK_FLAGS)
  310     IF(NOT libmysql_link_flag)
  311       SET(libmysql_link_flags)
  312     ENDIF()
  313     SET(libmysql_link_flags
  314       "${CMAKE_SHARED_LIBRARY_C_FLAGS} ${libmysql_link_flags}")
  315     SET_TARGET_PROPERTIES(libmysql
  316       PROPERTIES LINK_FLAGS "${libmysql_link_flags}")
  317 
  318     IF(LINK_FLAG_NO_UNDEFINED)
  319       SET(libmysql_link_flags
  320         "${libmysql_link_flags} ${LINK_FLAG_NO_UNDEFINED}")
  321       SET(libmysql_link_flags
  322         "${libmysql_link_flags} -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/libmysql.ver")
  323       SET_TARGET_PROPERTIES(libmysql
  324         PROPERTIES LINK_FLAGS "${libmysql_link_flags}")
  325     ENDIF() 
  326     # clean direct output needs to be set several targets have the same name
  327     #(mysqlclient in this case)
  328     SET_TARGET_PROPERTIES(mysqlclient PROPERTIES CLEAN_DIRECT_OUTPUT 1)
  329     SET_TARGET_PROPERTIES(libmysql PROPERTIES CLEAN_DIRECT_OUTPUT 1)
  330 
  331   ENDIF()
  332 ENDIF()
  333 
  334 # Visual Studio users need debug  static library for debug projects
  335 IF(MSVC)
  336   IF(NOT DISABLE_STATIC)
  337     IF(STATIC_LIB_SUBDIR)
  338       INSTALL_DEBUG_TARGET(mysqlclient DESTINATION ${INSTALL_LIBDIR}/${STATIC_LIB_SUBDIR}/debug)
  339     ELSE()
  340       INSTALL_DEBUG_TARGET(mysqlclient DESTINATION ${INSTALL_LIBDIR}/debug)
  341     ENDIF()
  342   ENDIF()
  343   IF(NOT DISABLE_SHARED)
  344     INSTALL_DEBUG_TARGET(libmysql      DESTINATION ${INSTALL_LIBDIR}/debug)
  345   ENDIF()
  346 ENDIF()
  347 
  348 #
  349 #  Basic application for testing linking against dynamic client library.
  350 #
  351 
  352 #
  353 # Generate a comma separated list of C API functions which is used
  354 # to initialize api_calls[] array in api_test.c
  355 #
  356 SET(CLIENT_API_FUNCTION_LIST "")
  357 FOREACH(api ${CLIENT_API_FUNCTIONS})
  358   SET(CLIENT_API_FUNCTION_LIST "${CLIENT_API_FUNCTION_LIST} ${api},")
  359 ENDFOREACH()
  360 
  361 #
  362 # Generate api_test.c source, substituting @CLIENT_API_FUNCTION_LIST@
  363 # with the list of API functions.
  364 #
  365 CONFIGURE_FILE(api_test.c.in ${CMAKE_CURRENT_BINARY_DIR}/api_test.c)
  366 
  367 #
  368 # Note: Compiling this test application will fail if not all symbols
  369 # from @CLIENT_API_FUNCTIONS@ are declared by <mysql.h>. It will fail
  370 # to run if not all of these symbols are exported by the library.
  371 #
  372 ADD_EXECUTABLE(libmysql_api_test ${CMAKE_CURRENT_BINARY_DIR}/api_test.c)
  373 SET_TARGET_PROPERTIES(libmysql_api_test PROPERTIES LINKER_LANGUAGE CXX)
  374 IF(LIBRT)
  375   TARGET_LINK_LIBRARIES(libmysql_api_test ${LIBRT})
  376 ENDIF()
  377 
  378 IF(DISABLE_SHARED)
  379   TARGET_LINK_LIBRARIES(libmysql_api_test ${LIBS})
  380 ELSE()
  381   TARGET_LINK_LIBRARIES(libmysql_api_test libmysql)
  382 ENDIF()