"Fossies" - the Fresh Open Source Software Archive

Member "mariadb-connector-c-3.0.8-src/CMakeLists.txt" (18 Dec 2018, 16219 Bytes) of package /linux/misc/mariadb-connector-c-3.0.8-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 latest Fossies "Diffs" side-by-side code changes report for "CMakeLists.txt": 3.0.7_vs_3.0.8.

    1 # CMakeLists.txt
    2 
    3 # This is the LGPL libmariadb project.
    4 
    5 CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
    6 INCLUDE(CheckFunctionExists)
    7 IF(COMMAND CMAKE_POLICY)
    8   SET(NEW_POLICIES CMP0003 CMP0022 CMP0023)
    9   FOREACH(TYPE OLD NEW)
   10     FOREACH(P ${${TYPE}_POLICIES})
   11       IF(POLICY ${P})
   12         CMAKE_POLICY(SET ${P} ${TYPE})
   13       ENDIF()
   14     ENDFOREACH()
   15   ENDFOREACH()
   16 ENDIF()
   17 
   18 
   19 PROJECT(mariadb-connector-c C)
   20 
   21 # Is C/C built as subproject?
   22 get_directory_property(IS_SUBPROJECT PARENT_DIRECTORY)
   23 
   24 # do not inherit include directories from the parent project
   25 SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
   26 FOREACH(V WITH_MYSQLCOMPAT WITH_MSI WITH_SIGNCODE WITH_RTC WITH_UNIT_TESTS
   27     WITH_DYNCOL WITH_EXTERNAL_ZLIB WITH_CURL WITH_SQLITE WITH_SSL
   28     INSTALL_LAYOUT WITH_TEST_SRCPKG)
   29   SET(${V} ${${OPT}${V}})
   30 ENDFOREACH()
   31 
   32 #SET(PACKAGE_STATUS_SUFFIX "beta")
   33 
   34 SET(CC_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
   35 SET(CC_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
   36 
   37 SET(CPACK_PACKAGE_VERSION_MAJOR 3)
   38 SET(CPACK_PACKAGE_VERSION_MINOR 0)
   39 SET(CPACK_PACKAGE_VERSION_PATCH 8)
   40 SET(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
   41 MATH(EXPR MARIADB_PACKAGE_VERSION_ID "${CPACK_PACKAGE_VERSION_MAJOR} * 10000 +
   42                             ${CPACK_PACKAGE_VERSION_MINOR} * 100   +
   43                             ${CPACK_PACKAGE_VERSION_PATCH}")
   44 
   45 MACRO(ADD_OPTION _name _text _default)
   46   IF(NOT DEFINED ${_name})
   47     SET(${_name} ${_default})
   48   ENDIF()
   49   OPTION(${OPT}${_name} "${_text}" "${${_name}}")
   50 ENDMACRO()
   51 
   52 ### Options ###
   53 IF(NOT WIN32)
   54   ADD_OPTION(WITH_MYSQLCOMPAT "creates libmysql* symbolic links" OFF)
   55 ELSE()
   56   ADD_OPTION(WITH_MSI "Build MSI installation package" OFF)
   57   ADD_OPTION(WITH_SIGNCODE "digitally sign files" OFF)
   58   ADD_OPTION(WITH_RTC "enables run time checks for debug builds" OFF)
   59 ENDIF()
   60 
   61 ADD_OPTION(WITH_UNIT_TESTS "build test suite" ON)
   62 ADD_OPTION(WITH_DYNCOL "Enables support of dynamic coluumns" ON)
   63 ADD_OPTION(WITH_EXTERNAL_ZLIB "Enables use of external zlib" OFF)
   64 ADD_OPTION(WITH_CURL "Enables use of curl" ON)
   65 ADD_OPTION(WITH_SSL "Enables use of TLS/SSL library" ON)
   66 ###############
   67 
   68 INCLUDE(${CC_SOURCE_DIR}/cmake/misc.cmake)
   69 
   70 IF(WITH_SIGNCODE)
   71   IF(WIN32 AND NOT SIGN_OPTIONS)
   72     SET(SIGN_OPTIONS /a /t http://timestamp.verisign.com/scripts/timstamp.dll)
   73   ELSE()
   74     SEPARATE_ARGUMENTS(SIGN_OPTIONS)
   75   ENDIF()
   76   MARK_AS_ADVANCED(SIGN_OPTIONS)
   77 ENDIF()
   78 
   79 SET(MARIADB_CONNECTOR_C_COPYRIGHT "2013-2017 MariaDB Corporation Ab")
   80 
   81 IF(WITH_RTC)
   82   SET(RTC_OPTIONS "/RTC1 /RTCc")
   83 ENDIF()
   84 
   85 IF(NOT WIN32)
   86   INCLUDE(${CC_SOURCE_DIR}/cmake/FindGSSAPI.cmake)
   87   IF(GSSAPI_FOUND)
   88     INCLUDE_DIRECTORIES(${GSSAPI_INCS})
   89   ENDIF()
   90 ENDIF()
   91 
   92 INCLUDE(${CC_SOURCE_DIR}/cmake/plugins.cmake)
   93 
   94 IF(AUTH_GSSAPI_PLUGIN_TYPE MATCHES "STATIC")
   95   SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${GSSAPI_LIBS})
   96 ENDIF()
   97 
   98 
   99 IF(WIN32)
  100   FILE(REMOVE ${CC_BINARY_DIR}/win/packaging/plugin.conf)
  101   INCLUDE(${CC_SOURCE_DIR}/cmake/version_info.cmake)
  102 ENDIF()
  103 
  104 IF(NOT IS_SUBPROJECT)
  105 IF(MSVC)
  106   # Speedup system tests
  107   INCLUDE(${CC_SOURCE_DIR}/cmake/WindowsCache.cmake)
  108   IF (MSVC)
  109     SET(CONFIG_TYPES "DEBUG" "RELEASE" "RELWITHDEBINFO")
  110     FOREACH(BUILD_TYPE ${CONFIG_TYPES})
  111       FOREACH(COMPILER CXX C)
  112         SET(COMPILER_FLAGS "${CMAKE_${COMPILER}_FLAGS_${BUILD_TYPE}}")
  113         IF (NOT COMPILER_FLAGS STREQUAL "")
  114           STRING(REPLACE "/MD" "/MT" COMPILER_FLAGS ${COMPILER_FLAGS})
  115           IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
  116             SET(COMPILER_FLAGS "${COMPILER_FLAGS} ${RTC_OPTIONS}")
  117             STRING(REPLACE "/Zi" "/ZI" COMPILER_FLAGS ${COMPILER_FLAGS})
  118           ELSE()
  119             STRING(REPLACE "/Zi" "/Z7" COMPILER_FLAGS ${COMPILER_FLAGS})
  120           ENDIF()
  121           MESSAGE (STATUS "CMAKE_${COMPILER}_FLAGS_${BUILD_TYPE}= ${COMPILER_FLAGS}")
  122           SET(CMAKE_${COMPILER}_FLAGS_${BUILD_TYPE} ${COMPILER_FLAGS})
  123         ENDIF()
  124       ENDFOREACH()
  125     ENDFOREACH()
  126   ENDIF()
  127 ENDIF()
  128 ENDIF(NOT IS_SUBPROJECT)
  129 
  130 # Disable dbug information for release builds
  131 SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DDBUG_OFF")
  132 SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDBUG_OFF")
  133 SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DDBUG_OFF")
  134 SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDBUG_OFF")
  135 
  136 IF(CMAKE_COMPILER_IS_GNUCC)
  137   INCLUDE(CheckCCompilerFlag)
  138   SET(GCC_FLAGS -Wunused -Wlogical-op -Wno-uninitialized  -Wall -Wextra -Wformat-security -Wno-init-self -Wwrite-strings -Wshift-count-overflow -Wdeclaration-after-statement -Wno-undef -Wno-unknown-pragmas)
  139   FOREACH(GCC_FLAG ${GCC_FLAGS})
  140     CHECK_C_COMPILER_FLAG("${GCC_FLAG}" HAS_${GCC_FLAG}_FLAG)
  141     IF(${HAS_${GCC_FLAG}_FLAG})
  142       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GCC_FLAG}")
  143     ENDIF()
  144   ENDFOREACH()
  145 ENDIF()
  146 
  147 # If the build type isn't specified, set to Relwithdebinfo as default.
  148 IF(NOT CMAKE_BUILD_TYPE)
  149   SET(CMAKE_BUILD_TYPE "RelWithDebInfo")
  150 ENDIF()
  151 
  152 # various defines for generating include/mysql_version.h
  153 INCLUDE(FindGit)
  154 IF(GIT_EXECUTABLE AND EXISTS ${CC_SOURCE_DIR}/.git)
  155   EXECUTE_PROCESS(
  156     COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
  157       WORKING_DIRECTORY ${CC_SOURCE_DIR}
  158        OUTPUT_VARIABLE OUT RESULT_VARIABLE RES)
  159    IF(RES EQUAL 0)
  160     STRING(REGEX REPLACE "\n$" "" CC_SOURCE_REVISION "${OUT}")
  161   ENDIF()
  162 ENDIF()
  163 SET(PROTOCOL_VERSION 10) # we adapted new password option from PHP's mysqlnd !
  164 
  165 # if C/C is build as subproject inside MariaDB server tree we will
  166 # use the version defined by server
  167 IF(MAJOR_VERSION)
  168   SET(MARIADB_CLIENT_VERSION_MAJOR ${MAJOR_VERSION})
  169   SET(MARIADB_CLIENT_VERSION_MINOR ${MINOR_VERSION})
  170   SET(MARIADB_CLIENT_VERSION_PATCH ${PATCH_VERSION})
  171 ELSE()
  172   SET(MARIADB_CLIENT_VERSION_MAJOR "10")
  173   SET(MARIADB_CLIENT_VERSION_MINOR "3")
  174   SET(MARIADB_CLIENT_VERSION_PATCH "6")
  175 ENDIF()
  176 SET(MARIADB_CLIENT_VERSION "${MARIADB_CLIENT_VERSION_MAJOR}.${MARIADB_CLIENT_VERSION_MINOR}.${MARIADB_CLIENT_VERSION_PATCH}")
  177 SET(MARIADB_BASE_VERSION "mariadb-${MARIADB_CLIENT_VERSION_MAJOR}.${MARIADB_CLIENT_VERSION_MINOR}")
  178 MATH(EXPR MARIADB_VERSION_ID "${MARIADB_CLIENT_VERSION_MAJOR} * 10000 +
  179                               ${MARIADB_CLIENT_VERSION_MINOR} * 100   +
  180                               ${MARIADB_CLIENT_VERSION_PATCH}")
  181 
  182 IF (NOT MARIADB_PORT)
  183   SET(MARIADB_PORT 3306)
  184 ENDIF ()
  185 IF(NOT MARIADB_UNIX_ADDR)
  186   SET(MARIADB_UNIX_ADDR "/tmp/mysql.sock")
  187 ENDIF()
  188 
  189 INCLUDE("${CC_SOURCE_DIR}/cmake/install.cmake")
  190 IF(NOT PLUGINDIR)
  191   SET(PLUGINDIR "${INSTALL_PLUGINDIR}")
  192 ENDIF()
  193 
  194 # todo: we don't character sets in share - all is compiled in
  195 SET(SHAREDIR "share")
  196 SET(DEFAULT_CHARSET_HOME "${CMAKE_INSTALL_PREFIX}")
  197 
  198 INCLUDE(${CC_SOURCE_DIR}/cmake/SearchLibrary.cmake)
  199 
  200 IF(WITH_EXTERNAL_ZLIB)
  201   IF(NOT ZLIB_FOUND)
  202     FIND_PACKAGE(ZLIB)
  203   ENDIF()
  204   IF(ZLIB_FOUND)
  205     INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
  206     SET(LIBZ ${ZLIB_LIBRARY})
  207   ENDIF()
  208 ENDIF()
  209 
  210 IF(NOT WIN32)
  211   INCLUDE(TestBigEndian)
  212   TEST_BIG_ENDIAN(HAVE_BIGENDIAN)
  213 ENDIF()
  214 
  215 IF(UNIX)
  216   SEARCH_LIBRARY(LIBDL dlopen "dl")
  217   IF(NOT ${LIBDL})
  218     SEARCH_LIBRARY(LIBDL dlsym "dl")
  219   ENDIF()
  220   SEARCH_LIBRARY(LIBM floor m)
  221   SEARCH_LIBRARY(LIBPTHREAD pthread_getspecific "pthread;pthreads")
  222   SEARCH_LIBRARY(LIBNSL gethostbyname_r "nsl_r;nsl")
  223   SEARCH_LIBRARY(LIBSOCKET setsockopt socket)
  224   FIND_PACKAGE(Threads)
  225   SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LIBNSL} ${LIBBIND} ${LIBICONV} ${LIBZ}
  226     ${LIBSOCKET} ${LIBDL} ${LIBM} ${LIBPTHREAD})
  227   SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBNSL} ${LIBBIND} ${LIBICONV} ${LIBZ}
  228     ${LIBSOCKET} ${LIBDL} ${LIBM} ${LIBPTHREAD})
  229   #remove possible dups from required libraries
  230   LIST(LENGTH CMAKE_REQUIRED_LIBRARIES rllength)
  231   IF(${rllength} GREATER 0)
  232     LIST(REMOVE_DUPLICATES CMAKE_REQUIRED_LIBRARIES)
  233   ENDIF()
  234 ENDIF()
  235 
  236 
  237 IF(CMAKE_HAVE_PTHREAD_H)
  238   SET(CMAKE_REQUIRED_INCLUDES pthread.h)
  239 ENDIF()
  240 
  241 IF(DBUG_OFF)
  242   ADD_DEFINITIONS(-DDBUG_OFF=1)
  243 ENDIF()
  244 
  245 ADD_DEFINITIONS(-DMARIADB_SYSTEM_TYPE="${CMAKE_SYSTEM_NAME}")
  246 ADD_DEFINITIONS(-DMARIADB_MACHINE_TYPE="${CMAKE_SYSTEM_PROCESSOR}")
  247 
  248 IF(WIN32)
  249   SET(HAVE_THREADS 1)
  250   ADD_DEFINITIONS(-DHAVE_DLOPEN)
  251   ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
  252   IF(MSVC)
  253      SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996" )
  254   ENDIF()
  255 ELSEIF()
  256   SET(HAVE_THREADS ${CMAKE_USE_PTHREADS})
  257 ENDIF()
  258 
  259 # check for various include files
  260 INCLUDE(${CC_SOURCE_DIR}/cmake/CheckIncludeFiles.cmake)
  261 # check for various functions
  262 INCLUDE(${CC_SOURCE_DIR}/cmake/CheckFunctions.cmake)
  263 # check for various types
  264 INCLUDE(${CC_SOURCE_DIR}/cmake/CheckTypes.cmake)
  265 
  266 IF(NOT DEFAULT_CHARSET)
  267   SET(DEFAULT_CHARSET "latin1")
  268 ENDIF()
  269 
  270 
  271 # convert SSL options to uppercase
  272 IF(WITH_SSL)
  273   STRING(TOUPPER ${WITH_SSL} WITH_SSL)
  274 ENDIF()
  275 IF(WITH_SSL STREQUAL "ON")
  276   IF(WIN32)
  277     SET(WITH_SSL "SCHANNEL")
  278   ELSE()
  279     SET(WITH_SSL "OPENSSL")
  280   ENDIF()
  281 ENDIF()
  282 
  283 IF(NOT WITH_SSL STREQUAL "OFF")
  284   IF(WITH_SSL STREQUAL "OPENSSL")
  285     IF (NOT OPENSSL_FOUND)
  286       FIND_PACKAGE(OpenSSL)
  287     ENDIF()
  288     IF(OPENSSL_FOUND)
  289       ADD_DEFINITIONS(-DHAVE_OPENSSL -DHAVE_TLS)
  290       SET(SSL_SOURCES "${CC_SOURCE_DIR}/libmariadb/secure/openssl.c")
  291       SET(SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
  292       INCLUDE_DIRECTORIES(BEFORE ${OPENSSL_INCLUDE_DIR})
  293 
  294       TRY_RUN(LIBRESSL_RESULT HAVE_LIBRESSL
  295               ${CMAKE_BINARY_DIR}
  296               ${CC_SOURCE_DIR}/cmake/libressl_version.c
  297               COMPILE_DEFINITIONS "-I${OPENSSL_INCLUDE_DIR}"
  298               RUN_OUTPUT_VARIABLE LIBRESSL_VERSION)
  299       IF(HAVE_LIBRESSL)
  300         ADD_DEFINITIONS(-DHAVE_LIBRESSL)
  301         SET(TLS_LIBRARY_VERSION ${LIBRESSL_VERSION})
  302       ELSE()
  303         SET(TLS_LIBRARY_VERSION "OpenSSL ${OPENSSL_VERSION}")
  304       ENDIF()
  305     ELSE()
  306       MESSAGE1(TLS_LIBRARY_VERSION "OpenSSL/LibreSSL not found")
  307     ENDIF()
  308   ENDIF()
  309   IF(WITH_SSL STREQUAL "GNUTLS")
  310     FIND_PACKAGE(GnuTLS "3.3.24" REQUIRED)
  311     IF(GNUTLS_FOUND)
  312       ADD_DEFINITIONS(-DHAVE_GNUTLS -DHAVE_TLS)
  313       SET(SSL_SOURCES "${CC_SOURCE_DIR}/libmariadb/secure/gnutls.c")
  314       SET(SSL_LIBRARIES ${GNUTLS_LIBRARY})
  315       SET(TLS_LIBRARY_VERSION "GnuTLS ${GNUTLS_VERSION_STRING}")
  316       INCLUDE_DIRECTORIES(${GNUTLS_INCLUDE_DIR})
  317     ELSE()
  318       MESSAGE(FATAL_ERROR "GnuTLS not found")
  319     ENDIF()
  320   ENDIF()
  321   IF(WIN32)
  322     IF(WITH_SSL STREQUAL "SCHANNEL")
  323       ADD_DEFINITIONS(-DHAVE_SCHANNEL -DHAVE_TLS)
  324       SET(SSL_SOURCES "${CC_SOURCE_DIR}/libmariadb/secure/schannel.c"
  325                       "${CC_SOURCE_DIR}/libmariadb/secure/ma_schannel.c")
  326       INCLUDE_DIRECTORIES("${CC_SOURCE_DIR}/plugins/pvio/")
  327       SET(SSL_LIBRARIES secur32)
  328       SET(TLS_LIBRARY_VERSION "Schannel ${CMAKE_SYSTEM_VERSION}")
  329     ENDIF()
  330   ENDIF()
  331   MESSAGE1(TLS_LIBRARY_VERSION "TLS library/version: ${TLS_LIBRARY_VERSION}")
  332 
  333   MARK_AS_ADVANCED(SSL_SOURCES)
  334 ENDIF()
  335 
  336 IF(NOT WIN32)
  337   INCLUDE(${CC_SOURCE_DIR}/cmake/FindIconv.cmake)
  338 ENDIF()
  339 
  340 CONFIGURE_FILE(${CC_SOURCE_DIR}/include/ma_config.h.in
  341                ${CC_BINARY_DIR}/include/ma_config.h)
  342 CONFIGURE_FILE(${CC_SOURCE_DIR}/include/ma_config.h.in
  343                ${CC_BINARY_DIR}/include/config.h)
  344 CONFIGURE_FILE(${CC_SOURCE_DIR}/include/mariadb_version.h.in
  345                ${CC_BINARY_DIR}/include/mariadb_version.h)
  346 
  347 INCLUDE_DIRECTORIES(${CC_BINARY_DIR}/include)
  348 
  349 IF(WIN32)
  350   SET(SYSTEM_LIBS ws2_32 advapi32 kernel32 shlwapi crypt32 ${LIBZ})
  351 ELSE()
  352   SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBPTHREAD} ${LIBDL} ${LIBM})
  353   IF(ICONV_EXTERNAL)
  354     SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${ICONV_LIBRARIES})
  355   ENDIF()
  356 ENDIF()
  357 IF(WITH_SSL)
  358   SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${SSL_LIBRARIES})
  359 ENDIF()
  360 MESSAGE1(SYSTEM_LIBS "SYSTEM_LIBS ${SYSTEM_LIBS}")
  361 MARK_AS_ADVANCED(SYSTEM_LIBS)
  362 
  363 IF(NOT REMOTEIO_PLUGIN_TYPE MATCHES "OFF")
  364   IF(CURL_FOUND)
  365     INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS})
  366     IF(REMOTEIO_PLUGIN_TYPE MATCHES "STATIC")
  367       SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${CURL_LIBRARIES})
  368     ENDIF()
  369     ADD_DEFINITIONS("-DHAVE_REMOTEIO=1")
  370   ENDIF()
  371 ENDIF()
  372 IF(NOT WIN32)
  373   IF(NOT AUTH_GSSAPI_PLUGIN_TYPE MATCHES "OFF")
  374     INCLUDE(${CC_SOURCE_DIR}/cmake/FindGSSAPI.cmake)
  375     IF(GSSAPI_FOUND)
  376       INCLUDE_DIRECTORIES(${GSSAPI_INCS})
  377       IF(AUTH_GSSAPI_PLUGIN_TYPE MATCHES "STATIC")
  378         SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${GSSAPI_LIBS})
  379       ENDIF()
  380     ENDIF()
  381   ENDIF()
  382 ENDIF()
  383 INCLUDE(${CC_SOURCE_DIR}/plugins/CMakeLists.txt)
  384 ADD_SUBDIRECTORY(include)
  385 ADD_SUBDIRECTORY(libmariadb)
  386 IF(NOT WIN32)
  387   ADD_SUBDIRECTORY(mariadb_config)
  388 ENDIF()
  389 
  390 IF(IS_DIRECTORY ${CC_SOURCE_DIR}/unittest)
  391   IF(WITH_UNIT_TESTS)
  392     ADD_SUBDIRECTORY(unittest/mytap)
  393     ADD_SUBDIRECTORY(unittest/libmariadb)
  394   ENDIF()
  395 ENDIF()
  396 
  397 IF(CLIENT_DOCS)
  398   INSTALL(DIRECTORY ${CLIENT_DOCS}
  399           DESTINATION ${DOCS_INSTALL_DIR_${INSTALL_LAYOUT}}
  400           COMPONENT SharedLibraries)
  401 ENDIF()
  402 
  403 
  404 IF(WIN32 AND WITH_MSI AND CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
  405   ADD_SUBDIRECTORY(win/packaging)
  406 ENDIF()
  407 MESSAGE1(SYSTEM_PROCESSOR "SYSTEM processor: ${CMAKE_SYSTEM_PROCESSOR}")
  408 SET(CPACK_PACKAGE_VENDOR "MariaDB Corporation Ab")
  409 SET(CPACK_PACKAGE_DESCRIPTION "MariaDB Connector/C. A library for connecting to MariaDB and MySQL servers")
  410 SET(CPACK_PACKAGE_NAME "mariadb_connector_c")
  411 STRING(TOLOWER ${CMAKE_SYSTEM_NAME} system_name)
  412 SET(CPACK_RESOURCE_FILE_LICENSE "${CC_SOURCE_DIR}/COPYING.LIB")
  413 SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CC_SOURCE_DIR}/README")
  414 INCLUDE(cmake/ConnectorName.cmake)
  415 IF(NOT PACKAGE_STATUS_SUFFIX)
  416   SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mariadb-connector-c-${CPACK_PACKAGE_VERSION}-src")
  417   SET(CPACK_PACKAGE_FILE_NAME "mariadb-connector-c-${CPACK_PACKAGE_VERSION}-${system_name}-${CMAKE_SYSTEM_PROCESSOR}")
  418 ELSE()
  419   SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mariadb-connector-c-${CPACK_PACKAGE_VERSION}-${PACKAGE_STATUS_SUFFIX}-src")
  420   SET(CPACK_PACKAGE_FILE_NAME "mariadb-connector-c-${CPACK_PACKAGE_VERSION}-${PACKAGE_STATUS_SUFFIX}-${system_name}-${CMAKE_SYSTEM_PROCESSOR}")
  421 ENDIF()
  422 # Build source packages
  423 IF(GIT_BUILD_SRCPKG)
  424   # get branch name
  425   EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} show-branch OUTPUT_VARIABLE git_branch)
  426   STRING(REGEX MATCH "\\[([^]]+)\\]" git_branch ${git_branch})
  427   STRING(REGEX REPLACE "\\[|\\]" "" GIT_BRANCH ${git_branch})
  428   MESSAGE1(GIT_BRANCH "${GIT_BRANCH}")
  429   IF(WIN32)
  430     EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} archive ${GIT_BRANCH} --format=zip --prefix=${CPACK_SOURCE_PACKAGE_FILE_NAME}/ --output=${CPACK_SOURCE_PACKAGE_FILE_NAME}.zip)
  431   ELSE()
  432     EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} archive ${GIT_BRANCH} --format=zip --prefix=${CPACK_SOURCE_PACKAGE_FILE_NAME}/ --output=${CPACK_SOURCE_PACKAGE_FILE_NAME}.zip)
  433     EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} archive ${GIT_BRANCH} --format=tar --prefix=${CPACK_SOURCE_PACKAGE_FILE_NAME}/ --output=${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar)
  434     EXECUTE_PROCESS(COMMAND gzip -9 -f ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar)
  435   ENDIF()
  436 ENDIF()
  437 
  438 SET(CPACK_SOURCE_IGNORE_FILES
  439 \\\\.git/
  440 \\\\.gitignore
  441 \\\\.gitattributes
  442 CMakeCache\\\\.txt
  443 cmake_dist\\\\.cmake
  444 CPackConfig\\\\.cmake
  445 mariadb_config\\\\.c$
  446 \\\\.build/
  447 html/
  448 unittest
  449 /cmake_install.cmake
  450 /CTestTestfile.cmake
  451 /CPackSourceConfig.cmake
  452 /CMakeFiles/
  453 /version_resources/
  454 /_CPack_Packages/
  455 \\\\.gz$
  456 \\\\.zip$
  457 mariadb_config/mariadb_config$
  458 /CMakeFiles/
  459 /version_resources/
  460 /_CPack_Packages/
  461 Makefile$
  462 include/my_config\\\\.h$
  463 )
  464 
  465 IF(WITH_TEST_SRCPKG)
  466   SET(PACKAGE_FILE ${CC_SOURCE_DIR}/package.name)
  467   FILE(REMOVE ${PACKAGE_FILE})
  468   FILE(WRITE ${PACKAGE_FILE} ${CPACK_SOURCE_PACKAGE_FILE_NAME})
  469 ENDIF()
  470 
  471 IF(WIN32)
  472   SET(CPACK_GENERATOR "ZIP")
  473   SET(CPACK_SOURCE_GENERATOR "ZIP")
  474 ELSE()
  475   SET(CPACK_GENERATOR "TGZ")
  476   SET(CPACK_SOURCE_GENERATOR "TGZ")
  477 ENDIF()
  478 INCLUDE(CPack)
  479 
  480 IF(WITH_EXTERNAL_ZLIB)
  481   SET(zlib_status ${WITH_EXTERNAL_ZLIB})
  482 ELSE()
  483   SET(zlib_status "yes (using bundled zlib)")
  484 ENDIF()
  485 
  486 MESSAGE1(STATUS "MariaDB Connector/c configuration:
  487 -- Static PLUGINS ${PLUGINS_STATIC}
  488 -- Dynamic PLUGINS ${PLUGINS_DYNAMIC}
  489 -- CPack generation: ${CPACK_GENERATOR}
  490 -- SSL support: ${WITH_SSL} Libs: ${SSL_LIBRARIES}
  491 -- Zlib support: ${zlib_status}
  492 -- Installation layout: ${INSTALL_LAYOUT}
  493 -- Include files will be installed in ${INSTALL_INCLUDEDIR}
  494 -- Libraries will be installed in ${INSTALL_LIBDIR}
  495 -- Binaries will be installed in ${INSTALL_BINDIR}
  496 -- Documentation included from ${CLIENT_DOCS}
  497 -- Required: ${CMAKE_REQUIRED_LIBRARIES}")