diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:07:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:07:14 +0000 |
commit | a175314c3e5827eb193872241446f2f8f5c9d33c (patch) | |
tree | cd3d60ca99ae00829c52a6ca79150a5b6e62528b /libmariadb/cmake | |
parent | Initial commit. (diff) | |
download | mariadb-10.5-upstream.tar.xz mariadb-10.5-upstream.zip |
Adding upstream version 1:10.5.12.upstream/1%10.5.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libmariadb/cmake')
-rw-r--r-- | libmariadb/cmake/COPYING-CMAKE-SCRIPTS | 22 | ||||
-rw-r--r-- | libmariadb/cmake/CheckFunctions.cmake | 30 | ||||
-rw-r--r-- | libmariadb/cmake/CheckIncludeFiles.cmake | 58 | ||||
-rw-r--r-- | libmariadb/cmake/CheckTypes.cmake | 62 | ||||
-rw-r--r-- | libmariadb/cmake/ConnectorName.cmake | 30 | ||||
-rw-r--r-- | libmariadb/cmake/FindGSSAPI.cmake | 110 | ||||
-rw-r--r-- | libmariadb/cmake/FindIconv.cmake | 82 | ||||
-rw-r--r-- | libmariadb/cmake/SearchLibrary.cmake | 29 | ||||
-rw-r--r-- | libmariadb/cmake/WindowsCache.cmake | 392 | ||||
-rw-r--r-- | libmariadb/cmake/export.cmake | 30 | ||||
-rw-r--r-- | libmariadb/cmake/install.cmake | 152 | ||||
-rw-r--r-- | libmariadb/cmake/install_plugins.cmake | 20 | ||||
-rw-r--r-- | libmariadb/cmake/libressl_version.c | 7 | ||||
-rw-r--r-- | libmariadb/cmake/linux_x86_toolchain.cmake | 18 | ||||
-rw-r--r-- | libmariadb/cmake/misc.cmake | 13 | ||||
-rw-r--r-- | libmariadb/cmake/plugins.cmake | 94 | ||||
-rw-r--r-- | libmariadb/cmake/sign.cmake | 20 | ||||
-rw-r--r-- | libmariadb/cmake/symlink.cmake | 35 | ||||
-rw-r--r-- | libmariadb/cmake/version_info.cmake | 44 |
19 files changed, 1248 insertions, 0 deletions
diff --git a/libmariadb/cmake/COPYING-CMAKE-SCRIPTS b/libmariadb/cmake/COPYING-CMAKE-SCRIPTS new file mode 100644 index 00000000..4b417765 --- /dev/null +++ b/libmariadb/cmake/COPYING-CMAKE-SCRIPTS @@ -0,0 +1,22 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/libmariadb/cmake/CheckFunctions.cmake b/libmariadb/cmake/CheckFunctions.cmake new file mode 100644 index 00000000..5ea949eb --- /dev/null +++ b/libmariadb/cmake/CheckFunctions.cmake @@ -0,0 +1,30 @@ +# +# Copyright (C) 2013-2016 MariaDB Corporation AB +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the COPYING-CMAKE-SCRIPTS file. +# + +# This file is included by CMakeLists.txt and +# checks for various functions. +# You will find the appropriate defines in +# include/my_config.h.in + +INCLUDE(CheckFunctionExists) + +CHECK_FUNCTION_EXISTS (alloca HAVE_ALLOCA) +CHECK_FUNCTION_EXISTS (dlerror HAVE_DLERROR) +CHECK_FUNCTION_EXISTS (dlopen HAVE_DLOPEN) +CHECK_FUNCTION_EXISTS (fcntl HAVE_FCNTL) +CHECK_FUNCTION_EXISTS (memcpy HAVE_MEMCPY) +CHECK_FUNCTION_EXISTS (nl_langinfo HAVE_NL_LANGINFO) +CHECK_FUNCTION_EXISTS (setlocale HAVE_SETLOCALE) +CHECK_FUNCTION_EXISTS (poll HAVE_POLL) +CHECK_FUNCTION_EXISTS (getpwuid HAVE_GETPWUID) + +IF(HAVE_FILE_UCONTEXT_H) + CHECK_FUNCTION_EXISTS (makecontext HAVE_UCONTEXT_H) +ENDIF() + +CHECK_FUNCTION_EXISTS (cuserid HAVE_CUSERID)
\ No newline at end of file diff --git a/libmariadb/cmake/CheckIncludeFiles.cmake b/libmariadb/cmake/CheckIncludeFiles.cmake new file mode 100644 index 00000000..8151dde5 --- /dev/null +++ b/libmariadb/cmake/CheckIncludeFiles.cmake @@ -0,0 +1,58 @@ +# +# Copyright (C) 2013-2016 MariaDB Corporation AB +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the COPYING-CMAKE-SCRIPTS file. +# +# This file is included by CMakeLists.txt and +# checks for various header files. +# You will find the appropriate defines in +# include/my_config.h.in + +INCLUDE(CheckIncludeFiles) + +CHECK_INCLUDE_FILES (alloca.h HAVE_ALLOCA_H) +CHECK_INCLUDE_FILES (arpa/inet.h HAVE_ARPA_INET_H) +CHECK_INCLUDE_FILES (dlfcn.h HAVE_DLFCN_H) +CHECK_INCLUDE_FILES (fcntl.h HAVE_FCNTL_H) +CHECK_INCLUDE_FILES (float.h HAVE_FLOAT_H) +CHECK_INCLUDE_FILES (limits.h HAVE_LIMITS_H) +CHECK_INCLUDE_FILES (linux/limits.h HAVE_LINUX_LIMITS_H) +CHECK_INCLUDE_FILES (pwd.h HAVE_PWD_H) +CHECK_INCLUDE_FILES (sched.h HAVE_SCHED_H) +CHECK_INCLUDE_FILES (select.h HAVE_SELECT_H) + +CHECK_INCLUDE_FILES (signal.h INCLUDE_SIGNAL) +IF(INCLUDE_SIGNAL) + SET(HAVE_SIGNAL 1) + SET(CMAKE_EXTRA_INCLUDE_FILES signal.h) +ENDIF(INCLUDE_SIGNAL) + +CHECK_INCLUDE_FILES (stddef.h HAVE_STDDEF_H) + +CHECK_INCLUDE_FILES (stdint.h HAVE_STDINT_H) +IF(HAVE_STDINT_H) + SET(CMAKE_EXTRA_INCLUDE_FILES stdint.h) +ENDIF(HAVE_STDINT_H) + +CHECK_INCLUDE_FILES (stdlib.h HAVE_STDLIB_H) +CHECK_INCLUDE_FILES (string.h HAVE_STRING_H) +CHECK_INCLUDE_FILES (strings.h HAVE_STRINGS_H) + +CHECK_INCLUDE_FILES (sys/ioctl.h HAVE_SYS_IOCTL_H) +CHECK_INCLUDE_FILES (sys/select.h HAVE_SYS_SELECT_H) +CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H) +CHECK_INCLUDE_FILES (sys/types.h HAVE_SYS_TYPES_H) +CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H) +CHECK_INCLUDE_FILES (sys/un.h HAVE_SYS_UN_H) +CHECK_INCLUDE_FILES (unistd.h HAVE_UNISTD_H) +CHECK_INCLUDE_FILES (utime.h HAVE_UTIME_H) + +IF(APPLE) + SET(CMAKE_REQUIRED_DEFINITIONS -D_XOPEN_SOURCE=600) +ENDIF() +CHECK_INCLUDE_FILES (ucontext.h HAVE_FILE_UCONTEXT_H) +IF(NOT HAVE_FILE_UCONTEXT_H) + CHECK_INCLUDE_FILES (sys/ucontext.h HAVE_FILE_UCONTEXT_H) +ENDIF() diff --git a/libmariadb/cmake/CheckTypes.cmake b/libmariadb/cmake/CheckTypes.cmake new file mode 100644 index 00000000..2a47cc0c --- /dev/null +++ b/libmariadb/cmake/CheckTypes.cmake @@ -0,0 +1,62 @@ +# +# Copyright (C) 2013-2016 MariaDB Corporation AB +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the COPYING-CMAKE-SCRIPTS file. +# +# This file is included by CMakeLists.txt and +# checks for type sizes. +# You will find the appropriate defines in +# include/my_config.h.in +INCLUDE (CheckTypeSize) + +SET(CMAKE_EXTRA_INCLUDE_FILES signal.h) + +CHECK_TYPE_SIZE("char *" SIZEOF_CHARP) +CHECK_TYPE_SIZE(int SIZEOF_INT) +CHECK_TYPE_SIZE(long SIZEOF_LONG) +CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG) +SET(CMAKE_EXTRA_INCLUDE_FILES stdio.h) +CHECK_TYPE_SIZE(size_t SIZEOF_SIZE_T) +SET(CMAKE_EXTRA_INCLUDE_FILES sys/types.h) +CHECK_TYPE_SIZE(uchar SIZEOF_UCHAR) +CHECK_TYPE_SIZE(uint SIZEOF_UINT) +CHECK_TYPE_SIZE(ulong SIZEOF_ULONG) +CHECK_TYPE_SIZE(int8 SIZEOF_INT8) +CHECK_TYPE_SIZE(uint8 SIZEOF_UINT8) +CHECK_TYPE_SIZE(int16 SIZEOF_INT16) +CHECK_TYPE_SIZE(uint16 SIZEOF_UINT16) +CHECK_TYPE_SIZE(int32 SIZEOF_INT32) +CHECK_TYPE_SIZE(uint32 SIZEOF_UINT32) +CHECK_TYPE_SIZE(int64 SIZEOF_INT64) +CHECK_TYPE_SIZE(uint64 SIZEOF_UINT64) +CHECK_TYPE_SIZE(socklen_t SIZEOF_SOCKLEN_T) + +# +# Compile testing +# +INCLUDE (CheckCSourceCompiles) + +# +# SOCKET_SIZE +# +IF(WIN32) + SET(SOCKET_SIZE_TYPE int) +ELSE(WIN32) + FOREACH(CHECK_TYPE "socklen_t" "size_t" "int") + IF (NOT SOCKET_SIZE_TYPE) + CHECK_C_SOURCE_COMPILES(" + #include <sys/socket.h> + int main(int argc, char **argv) + { + getsockname(0, 0, (${CHECK_TYPE} *)0); + return 0; + }" + SOCKET_SIZE_FOUND_${CHECK_TYPE}) + IF(SOCKET_SIZE_FOUND_${CHECK_TYPE}) + SET(SOCKET_SIZE_TYPE ${CHECK_TYPE}) + ENDIF(SOCKET_SIZE_FOUND_${CHECK_TYPE}) + ENDIF (NOT SOCKET_SIZE_TYPE) + ENDFOREACH() +ENDIF(WIN32) diff --git a/libmariadb/cmake/ConnectorName.cmake b/libmariadb/cmake/ConnectorName.cmake new file mode 100644 index 00000000..357b8ac0 --- /dev/null +++ b/libmariadb/cmake/ConnectorName.cmake @@ -0,0 +1,30 @@ +# +# Copyright (C) 2013-2016 MariaDB Corporation AB +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the COPYING-CMAKE-SCRIPTS file. +# +MACRO(GET_CONNECTOR_PACKAGE_NAME name) +# check if we have 64bit +IF(SIZEOF_VOIDP EQUAL 8) + SET(IS64 1) +ENDIF() + +SET (PLAFORM_NAME CMAKE_SYSTEM_NAME) +SET (MACHINE_NAME CMAKE_SYSTEM_PROCESSOR) +SET (CONCAT_SIGN "-") + +IF(CMAKE_SYSTEM_NAME MATCHES "Windows") + SET(PLATFORM_NAME "win") + SET(CONCAT_SIGN "") + IF(IS64) + SET(MACHINE_NAME "x64") + ELSE() + SET(MACHINE_NAME "32") + ENDIF() +ENDIF() + +SET(product_name "mysql-connector-c-${CPACK_PACKAGE_VERSION}-${PLATFORM_NAME}${CONCAT_SIGN}${MACHINE_NAME}") +STRING(TOLOWER ${product_name} ${name}) +ENDMACRO() diff --git a/libmariadb/cmake/FindGSSAPI.cmake b/libmariadb/cmake/FindGSSAPI.cmake new file mode 100644 index 00000000..7941c20e --- /dev/null +++ b/libmariadb/cmake/FindGSSAPI.cmake @@ -0,0 +1,110 @@ +# +# Copyright (C) 2013-2016 MariaDB Corporation AB +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the COPYING-CMAKE-SCRIPTS file. +# +# - Try to detect the GSSAPI support +# Once done this will define +# +# GSSAPI_FOUND - system supports GSSAPI +# GSSAPI_INCS - the GSSAPI include directory +# GSSAPI_LIBS - the libraries needed to use GSSAPI +# GSSAPI_FLAVOR - the type of API - MIT or HEIMDAL + +# Copyright (c) 2006, Pino Toscano, <toscano.pino@tiscali.it> +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +if(GSSAPI_LIBS AND GSSAPI_FLAVOR) + + # in cache already + set(GSSAPI_FOUND TRUE) + +else(GSSAPI_LIBS AND GSSAPI_FLAVOR) + + find_program(KRB5_CONFIG NAMES krb5-config PATHS + /opt/local/bin + /usr/lib/mit/bin/ + ONLY_CMAKE_FIND_ROOT_PATH # this is required when cross compiling with cmake 2.6 and ignored with cmake 2.4, Alex + ) + mark_as_advanced(KRB5_CONFIG) + + #reset vars + set(GSSAPI_INCS) + set(GSSAPI_LIBS) + set(GSSAPI_FLAVOR) + + if(KRB5_CONFIG) + + set(HAVE_KRB5_GSSAPI TRUE) + exec_program(${KRB5_CONFIG} ARGS --libs gssapi RETURN_VALUE _return_VALUE OUTPUT_VARIABLE GSSAPI_LIBS) + if(_return_VALUE) + message(STATUS "GSSAPI configure check failed.") + set(HAVE_KRB5_GSSAPI FALSE) + endif(_return_VALUE) + IF(CMAKE_SYSTEM_NAME MATCHES AIX) + string(REGEX REPLACE "-Wl[A-Za-z0-9_/,:-]*[ $]?" "" GSSAPI_LIBS "${GSSAPI_LIBS}") + string(REGEX REPLACE "-L[A-Za-z0-9_/,:-]*[ $]?" "" GSSAPI_LIBS "${GSSAPI_LIBS}") + ENDIF() + + exec_program(${KRB5_CONFIG} ARGS --cflags gssapi RETURN_VALUE _return_VALUE OUTPUT_VARIABLE GSSAPI_INCS) + string(REGEX REPLACE "(\r?\n)+$" "" GSSAPI_INCS "${GSSAPI_INCS}") + string(REGEX REPLACE " *-I" ";" GSSAPI_INCS "${GSSAPI_INCS}") + + exec_program(${KRB5_CONFIG} ARGS --vendor RETURN_VALUE _return_VALUE OUTPUT_VARIABLE gssapi_flavor_tmp) + set(GSSAPI_FLAVOR_MIT) + if(gssapi_flavor_tmp MATCHES ".*Massachusetts.*") + set(GSSAPI_FLAVOR "MIT") + else(gssapi_flavor_tmp MATCHES ".*Massachusetts.*") + set(GSSAPI_FLAVOR "HEIMDAL") + endif(gssapi_flavor_tmp MATCHES ".*Massachusetts.*") + + if(NOT HAVE_KRB5_GSSAPI) + if (gssapi_flavor_tmp MATCHES "Sun Microsystems.*") + message(STATUS "Solaris Kerberos does not have GSSAPI; this is normal.") + set(GSSAPI_LIBS) + set(GSSAPI_INCS) + else(gssapi_flavor_tmp MATCHES "Sun Microsystems.*") + message(WARNING "${KRB5_CONFIG} failed unexpectedly.") + endif(gssapi_flavor_tmp MATCHES "Sun Microsystems.*") + endif(NOT HAVE_KRB5_GSSAPI) + + if(GSSAPI_LIBS) # GSSAPI_INCS can be also empty, so don't rely on that + set(GSSAPI_FOUND TRUE CACHE STRING "") + message(STATUS "Found GSSAPI: ${GSSAPI_LIBS}") + + set(GSSAPI_INCS ${GSSAPI_INCS} CACHE STRING "") + set(GSSAPI_LIBS ${GSSAPI_LIBS} CACHE STRING "") + set(GSSAPI_FLAVOR ${GSSAPI_FLAVOR} CACHE STRING "") + + mark_as_advanced(GSSAPI_INCS GSSAPI_LIBS GSSAPI_FLAVOR) + + endif(GSSAPI_LIBS) + + endif(KRB5_CONFIG) + +endif(GSSAPI_LIBS AND GSSAPI_FLAVOR) diff --git a/libmariadb/cmake/FindIconv.cmake b/libmariadb/cmake/FindIconv.cmake new file mode 100644 index 00000000..dbc7369b --- /dev/null +++ b/libmariadb/cmake/FindIconv.cmake @@ -0,0 +1,82 @@ +# +# Copyright (C) 2010 Michael Bell <michael.bell@web.de> +# 2015-2016 MariaDB Corporation AB +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the COPYING-CMAKE-SCRIPTS file. +# +# ICONV_EXTERNAL - Iconv is an external library (not libc) +# ICONV_FOUND - system has Iconv +# ICONV_INCLUDE_DIR - the Iconv include directory +# ICONV_LIBRARIES - Link these to use Iconv +# ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const +# ICONV_VERSION - Iconv version string + +if (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + # Already in cache, be silent + set(ICONV_FIND_QUIETLY TRUE) +endif (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + +find_path(ICONV_INCLUDE_DIR iconv.h) + +IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") + # There is some libiconv.so in /usr/local that must + # be avoided, iconv routines are in libc +ELSEIF(APPLE) + find_library(ICONV_LIBRARIES NAMES iconv libiconv PATHS + /usr/lib/ + NO_CMAKE_SYSTEM_PATH) + SET(ICONV_EXTERNAL TRUE) +ELSE() + find_library(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2) + IF(ICONV_LIBRARIES) + SET(ICONV_EXTERNAL TRUE) + ENDIF() +ENDIF() + +if (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + set (ICONV_FOUND TRUE) +endif (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + +set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) +IF(ICONV_EXTERNAL) + set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) +ENDIF() + +if (ICONV_FOUND) + include(CheckCSourceCompiles) + CHECK_C_SOURCE_COMPILES(" + #include <iconv.h> + int main(){ + iconv_t conv = 0; + const char* in = 0; + size_t ilen = 0; + char* out = 0; + size_t olen = 0; + iconv(conv, &in, &ilen, &out, &olen); + return 0; + } +" ICONV_SECOND_ARGUMENT_IS_CONST ) + ADD_DEFINITIONS(-DHAVE_ICONV) +endif (ICONV_FOUND) + +set (CMAKE_REQUIRED_INCLUDES) +set (CMAKE_REQUIRED_LIBRARIES) + +if (ICONV_FOUND) + if (NOT ICONV_FIND_QUIETLY) + message (STATUS "Found Iconv: ${ICONV_LIBRARIES}") + endif (NOT ICONV_FIND_QUIETLY) +else (ICONV_FOUND) + if (Iconv_FIND_REQUIRED) + message (FATAL_ERROR "Could not find Iconv") + endif (Iconv_FIND_REQUIRED) +endif (ICONV_FOUND) + +MARK_AS_ADVANCED( + ICONV_INCLUDE_DIR + ICONV_LIBRARIES + ICONV_EXTERNAL + ICONV_SECOND_ARGUMENT_IS_CONST +) diff --git a/libmariadb/cmake/SearchLibrary.cmake b/libmariadb/cmake/SearchLibrary.cmake new file mode 100644 index 00000000..aa3a240e --- /dev/null +++ b/libmariadb/cmake/SearchLibrary.cmake @@ -0,0 +1,29 @@ +# +# Copyright (C) 2013-2016 MariaDB Corporation AB +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the COPYING-CMAKE-SCRIPTS file. +# +INCLUDE(CheckFunctionExists) +INCLUDE(CheckLibraryExists) + +FUNCTION(SEARCH_LIBRARY library_name function liblist) + IF(${${library_name}}) + RETURN() + ENDIF() + CHECK_FUNCTION_EXISTS(${function} IS_${function}_LIBC_FUNC) + IF(IS_${function}_LIBC_FUNC) + SET(${library_name} "" PARENT_SCOPE) + RETURN() + ENDIF() + FOREACH(lib ${liblist}) + CHECK_LIBRARY_EXISTS(${lib} ${function} "" HAVE_${function}_IN_${lib}) + IF(HAVE_${function}_IN_${lib}) + SET(${library_name} ${lib} PARENT_SCOPE) + SET(HAVE_${library_name} 1 PARENT_SCOPE) + RETURN() + ENDIF() + ENDFOREACH() +ENDFUNCTION() + diff --git a/libmariadb/cmake/WindowsCache.cmake b/libmariadb/cmake/WindowsCache.cmake new file mode 100644 index 00000000..5323f78a --- /dev/null +++ b/libmariadb/cmake/WindowsCache.cmake @@ -0,0 +1,392 @@ +# +# Copyright (C) 2013-2016 MariaDB Corporation AB +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the COPYING-CMAKE-SCRIPTS file. +# +IF(MSVC) +SET(BFD_H_EXISTS 0 CACHE INTERNAL "") +SET(HAVE_ACCESS 1 CACHE INTERNAL "") +SET(HAVE_AIO_H CACHE INTERNAL "") +SET(HAVE_AIO_READ CACHE INTERNAL "") +SET(HAVE_ALARM CACHE INTERNAL "") +SET(HAVE_ALLOCA_H CACHE INTERNAL "") +SET(HAVE_ARPA_INET_H CACHE INTERNAL "") +SET(HAVE_ASM_MSR_H CACHE INTERNAL "") +SET(HAVE_BACKTRACE CACHE INTERNAL "") +SET(HAVE_BACKTRACE_SYMBOLS CACHE INTERNAL "") +SET(HAVE_BACKTRACE_SYMBOLS_FD CACHE INTERNAL "") +SET(HAVE_BFILL CACHE INTERNAL "") +SET(HAVE_BMOVE CACHE INTERNAL "") +SET(HAVE_BSD_SIGNALS CACHE INTERNAL "") +SET(HAVE_BSEARCH 1 CACHE INTERNAL "") +SET(HAVE_BSS_START CACHE INTERNAL "") +SET(HAVE_BZERO CACHE INTERNAL "") +SET(HAVE_CHOWN CACHE INTERNAL "") +SET(HAVE_CLOCK_GETTIME CACHE INTERNAL "") +SET(HAVE_COMPRESS CACHE INTERNAL "") +SET(HAVE_CRYPT CACHE INTERNAL "") +SET(HAVE_CRYPT_H CACHE INTERNAL "") +SET(HAVE_CUSERID CACHE INTERNAL "") +SET(HAVE_CXX_NEW 1 CACHE INTERNAL "") +SET(HAVE_DECL_MADVISE CACHE INTERNAL "") +SET(HAVE_DIRECTIO CACHE INTERNAL "") +SET(HAVE_DIRENT_H CACHE INTERNAL "") +SET(HAVE_DLERROR CACHE INTERNAL "") +SET(HAVE_DLFCN_H CACHE INTERNAL "") +SET(HAVE_DLOPEN CACHE INTERNAL "") +SET(HAVE_DOPRNT CACHE INTERNAL "") +SET(HAVE_EXECINFO_H CACHE INTERNAL "") +SET(HAVE_FCHMOD CACHE INTERNAL "") +SET(HAVE_FCNTL CACHE INTERNAL "") +SET(HAVE_FCNTL_H 1 CACHE INTERNAL "") +SET(HAVE_FCNTL_NONBLOCK CACHE INTERNAL "") +SET(HAVE_FCONVERT CACHE INTERNAL "") +SET(HAVE_FDATASYNC CACHE INTERNAL "") +SET(HAVE_DECL_FDATASYNC CACHE INTERNAL "") +SET(HAVE_FEDISABLEEXCEPT CACHE INTERNAL "") +SET(HAVE_FENV_H CACHE INTERNAL "") +SET(HAVE_FESETROUND CACHE INTERNAL "") +SET(HAVE_FGETLN CACHE INTERNAL "") +SET(HAVE_FINITE CACHE INTERNAL "") +SET(HAVE_FINITE_IN_MATH_H CACHE INTERNAL "") +SET(HAVE_FLOATINGPOINT_H CACHE INTERNAL "") +SET(HAVE_FLOAT_H 1 CACHE INTERNAL "") +SET(HAVE_FLOCKFILE CACHE INTERNAL "") +SET(HAVE_FNMATCH_H CACHE INTERNAL "") +SET(HAVE_FPSETMASK CACHE INTERNAL "") +SET(HAVE_FPU_CONTROL_H CACHE INTERNAL "") +SET(HAVE_FSEEKO CACHE INTERNAL "") +SET(HAVE_FSYNC CACHE INTERNAL "") +SET(HAVE_FTIME 1 CACHE INTERNAL "") +SET(HAVE_FTRUNCATE CACHE INTERNAL "") +SET(HAVE_GETADDRINFO 1 CACHE INTERNAL "") +SET(HAVE_GETCWD 1 CACHE INTERNAL "") +SET(HAVE_GETHOSTBYADDR_R CACHE INTERNAL "") +SET(HAVE_GETHRTIME CACHE INTERNAL "") +SET(HAVE_GETLINE CACHE INTERNAL "") +SET(HAVE_GETNAMEINFO CACHE INTERNAL "") +SET(HAVE_GETPAGESIZE CACHE INTERNAL "") +SET(HAVE_GETPASS CACHE INTERNAL "") +SET(HAVE_GETPASSPHRASE CACHE INTERNAL "") +SET(HAVE_GETPWNAM CACHE INTERNAL "") +SET(HAVE_GETPWUID CACHE INTERNAL "") +SET(HAVE_GETRLIMIT CACHE INTERNAL "") +SET(HAVE_GETRUSAGE CACHE INTERNAL "") +SET(HAVE_GETTIMEOFDAY CACHE INTERNAL "") +SET(HAVE_GETWD CACHE INTERNAL "") +SET(HAVE_GRP_H CACHE INTERNAL "") +SET(HAVE_IA64INTRIN_H CACHE INTERNAL "") +SET(HAVE_IEEEFP_H CACHE INTERNAL "") +SET(HAVE_INDEX CACHE INTERNAL "") +SET(HAVE_INITGROUPS CACHE INTERNAL "") +SET(HAVE_INTTYPES_H CACHE INTERNAL "") +SET(HAVE_IPPROTO_IPV6 CACHE INTERNAL "") +SET(HAVE_IPV6 TRUE CACHE INTERNAL "") +SET(HAVE_IPV6_V6ONLY 1 CACHE INTERNAL "") +SET(HAVE_ISINF CACHE INTERNAL "") +SET(HAVE_ISSETUGID CACHE INTERNAL "") +SET(HAVE_GETUID CACHE INTERNAL "") +SET(HAVE_GETEUID CACHE INTERNAL "") +SET(HAVE_GETGID CACHE INTERNAL "") +SET(HAVE_GETEGID CACHE INTERNAL "") +SET(HAVE_LANGINFO_H CACHE INTERNAL "") +SET(HAVE_LDIV 1 CACHE INTERNAL "") +SET(HAVE_LIMITS_H 1 CACHE INTERNAL "") +SET(HAVE_LOCALE_H 1 CACHE INTERNAL "") +SET(HAVE_LOG2 CACHE INTERNAL "") +SET(HAVE_LONGJMP 1 CACHE INTERNAL "") +SET(HAVE_LRAND48 CACHE INTERNAL "") +SET(HAVE_LSTAT CACHE INTERNAL "") +SET(HAVE_MADVISE CACHE INTERNAL "") +SET(HAVE_MALLINFO CACHE INTERNAL "") +SET(HAVE_MALLOC_H 1 CACHE INTERNAL "") +SET(HAVE_MEMALIGN CACHE INTERNAL "") +SET(HAVE_MEMCPY 1 CACHE INTERNAL "") +SET(HAVE_MEMMOVE 1 CACHE INTERNAL "") +SET(HAVE_MEMORY_H 1 CACHE INTERNAL "") +SET(HAVE_MKSTEMP CACHE INTERNAL "") +SET(HAVE_MLOCK CACHE INTERNAL "") +SET(HAVE_MLOCKALL CACHE INTERNAL "") +SET(HAVE_MMAP CACHE INTERNAL "") +SET(HAVE_MMAP64 CACHE INTERNAL "") +SET(HAVE_NETDB_H CACHE INTERNAL "") +SET(HAVE_NETINET_IN6_H CACHE INTERNAL "") +SET(HAVE_NETINET_IN_H CACHE INTERNAL "") +SET(HAVE_NL_LANGINFO CACHE INTERNAL "") +SET(HAVE_PASE_ENVIRONMENT CACHE INTERNAL "") +SET(HAVE_PATHS_H CACHE INTERNAL "") +SET(HAVE_PCLOSE CACHE INTERNAL "") +SET(HAVE_PERROR 1 CACHE INTERNAL "") +SET(HAVE_PEERCRED CACHE INTERNAL "") +SET(HAVE_PAM_APPL_H CACHE INTERNAL "") +SET(HAVE_POLL_H CACHE INTERNAL "") +SET(HAVE_POPEN CACHE INTERNAL "") +SET(HAVE_POLL CACHE INTERNAL "") +SET(HAVE_PORT_CREATE CACHE INTERNAL "") +SET(HAVE_PORT_H CACHE INTERNAL "") +SET(HAVE_POSIX_FALLOCATE CACHE INTERNAL "") +SET(HAVE_POSIX_SIGNALS CACHE INTERNAL "") +SET(HAVE_PREAD CACHE INTERNAL "") +SET(HAVE_PRINTSTACK CACHE INTERNAL "") +SET(HAVE_PTHREAD_ATTR_CREATE CACHE INTERNAL "") +SET(HAVE_PTHREAD_ATTR_GETSTACKSIZE CACHE INTERNAL "") +SET(HAVE_PTHREAD_ATTR_SETSCOPE CACHE INTERNAL "") +SET(HAVE_PTHREAD_ATTR_SETSTACKSIZE CACHE INTERNAL "") +SET(HAVE_PTHREAD_CONDATTR_CREATE CACHE INTERNAL "") +SET(HAVE_PTHREAD_CONDATTR_SETCLOCK CACHE INTERNAL "") +SET(HAVE_PTHREAD_INIT CACHE INTERNAL "") +SET(HAVE_PTHREAD_KEY_DELETE CACHE INTERNAL "") +SET(HAVE_PTHREAD_RWLOCK_RDLOCK CACHE INTERNAL "") +SET(HAVE_PTHREAD_SIGMASK CACHE INTERNAL "") +SET(HAVE_PTHREAD_THREADMASK CACHE INTERNAL "") +SET(HAVE_PTHREAD_YIELD_NP CACHE INTERNAL "") +SET(HAVE_PTHREAD_YIELD_ZERO_ARG CACHE INTERNAL "") +SET(HAVE_PUTENV 1 CACHE INTERNAL "") +SET(HAVE_PWD_H CACHE INTERNAL "") +SET(HAVE_RDTSCLL CACHE INTERNAL "") +SET(HAVE_READDIR_R CACHE INTERNAL "") +SET(HAVE_READLINK CACHE INTERNAL "") +SET(HAVE_READ_REAL_TIME CACHE INTERNAL "") +SET(HAVE_REALPATH CACHE INTERNAL "") +SET(HAVE_REGCOMP CACHE INTERNAL "") +SET(HAVE_RENAME 1 CACHE INTERNAL "") +SET(HAVE_RE_COMP CACHE INTERNAL "") +SET(HAVE_RINT CACHE INTERNAL "") +SET(HAVE_RWLOCK_INIT CACHE INTERNAL "") +SET(HAVE_SCHED_H CACHE INTERNAL "") +SET(HAVE_SCHED_YIELD CACHE INTERNAL "") +SET(HAVE_SELECT 1 CACHE INTERNAL "") +SET(HAVE_SELECT_H CACHE INTERNAL "") +SET(HAVE_SEMAPHORE_H CACHE INTERNAL "") +SET(HAVE_SETENV CACHE INTERNAL "") +SET(HAVE_SETFD CACHE INTERNAL "") +SET(HAVE_SETLOCALE 1 CACHE INTERNAL "") +SET(HAVE_SHMAT CACHE INTERNAL "") +SET(HAVE_SHMCTL CACHE INTERNAL "") +SET(HAVE_SHMDT CACHE INTERNAL "") +SET(HAVE_SHMGET CACHE INTERNAL "") +SET(HAVE_SIGACTION CACHE INTERNAL "") +SET(HAVE_SIGADDSET CACHE INTERNAL "") +SET(HAVE_SIGEMPTYSET CACHE INTERNAL "") +SET(HAVE_SIGHOLD CACHE INTERNAL "") +SET(HAVE_SIGINT 1 CACHE INTERNAL "") +SET(HAVE_SIGPIPE CACHE INTERNAL "") +SET(HAVE_SIGQUIT CACHE INTERNAL "") +SET(HAVE_SIGSET CACHE INTERNAL "") +SET(HAVE_SIGTERM 1 CACHE INTERNAL "") +SET(HAVE_SIGTHREADMASK CACHE INTERNAL "") +SET(HAVE_SIGWAIT CACHE INTERNAL "") +SET(HAVE_SIZEOF_BOOL FALSE CACHE INTERNAL "") +SET(HAVE_SIZEOF_CHAR TRUE CACHE INTERNAL "") +SET(SIZEOF_CHAR 1 CACHE INTERNAL "") +SET(HAVE_SIZEOF_CHARP TRUE CACHE INTERNAL "") +SET(SIZEOF_CHARP ${CMAKE_SIZEOF_VOID_P} CACHE INTERNAL "") +SET(HAVE_SIZEOF_IN6_ADDR TRUE CACHE INTERNAL "") +SET(HAVE_SIZEOF_INT TRUE CACHE INTERNAL "") +SET(SIZEOF_INT 4 CACHE INTERNAL "") +SET(HAVE_SIZEOF_INT16 FALSE CACHE INTERNAL "") +SET(HAVE_SIZEOF_INT32 FALSE CACHE INTERNAL "") +SET(HAVE_SIZEOF_INT64 FALSE CACHE INTERNAL "") +SET(HAVE_SIZEOF_INT8 FALSE CACHE INTERNAL "") +SET(HAVE_SIZEOF_LONG TRUE CACHE INTERNAL "") +SET(SIZEOF_LONG 4 CACHE INTERNAL "") +SET(HAVE_SIZEOF_LONG_LONG TRUE CACHE INTERNAL "") +SET(SIZEOF_LONG_LONG 8 CACHE INTERNAL "") +SET(HAVE_SIZEOF_MODE_T FALSE CACHE INTERNAL "") +SET(HAVE_SIZEOF_OFF_T TRUE CACHE INTERNAL "") +SET(SIZEOF_OFF_T 4 CACHE INTERNAL "") +SET(HAVE_SIZEOF_SHORT TRUE CACHE INTERNAL "") +SET(SIZEOF_SHORT 2 CACHE INTERNAL "") +SET(HAVE_SIZEOF_SIGSET_T FALSE CACHE INTERNAL "") +SET(HAVE_SIZEOF_SIZE_T TRUE CACHE INTERNAL "") +SET(SIZEOF_SIZE_T ${CMAKE_SIZEOF_VOID_P} CACHE INTERNAL "") +SET(HAVE_SIZEOF_SOCKADDR_IN6 TRUE CACHE INTERNAL "") +SET(HAVE_SIZEOF_SOCKLEN_T FALSE CACHE INTERNAL "") +SET(HAVE_SIZEOF_UCHAR FALSE CACHE INTERNAL "") +SET(HAVE_SIZEOF_UINT FALSE CACHE INTERNAL "") +SET(HAVE_SIZEOF_UINT16 FALSE CACHE INTERNAL "") +SET(HAVE_SIZEOF_UINT32 FALSE CACHE INTERNAL "") +SET(HAVE_SIZEOF_UINT64 FALSE CACHE INTERNAL "") +SET(HAVE_SIZEOF_UINT8 FALSE CACHE INTERNAL "") +SET(HAVE_SIZEOF_ULONG FALSE CACHE INTERNAL "") +SET(HAVE_SIZEOF_U_INT32_T FALSE CACHE INTERNAL "") +SET(HAVE_SIZE_OF_SSIZE_T FALSE CACHE INTERNAL "") +SET(HAVE_SLEEP CACHE INTERNAL "") +SET(HAVE_SOCKADDR_STORAGE_SS_FAMILY 1 CACHE INTERNAL "") +SET(HAVE_SOLARIS_STYLE_GETHOST CACHE INTERNAL "") +SET(STACK_DIRECTION -1 CACHE INTERNAL "") +SET(HAVE_STDARG_H 1 CACHE INTERNAL "") +SET(HAVE_STDDEF_H 1 CACHE INTERNAL "") +SET(HAVE_STDINT_H CACHE INTERNAL "") +SET(HAVE_STDLIB_H 1 CACHE INTERNAL "") +SET(HAVE_STPCPY CACHE INTERNAL "") +SET(HAVE_STRCASECMP CACHE INTERNAL "") +SET(HAVE_STRCOLL 1 CACHE INTERNAL "") +SET(HAVE_STRDUP 1 CACHE INTERNAL "") +SET(HAVE_STRERROR 1 CACHE INTERNAL "") +SET(HAVE_STRINGS_H CACHE INTERNAL "") +SET(HAVE_STRING_H 1 CACHE INTERNAL "") +SET(HAVE_STRLCAT CACHE INTERNAL "") +SET(HAVE_STRLCPY CACHE INTERNAL "") +SET(HAVE_STRNCASECMP CACHE INTERNAL "") +SET(HAVE_STRNDUP CACHE INTERNAL "") +IF(MSVC_VERSION GREATER 1310) +SET(HAVE_STRNLEN 1 CACHE INTERNAL "") +ENDIF() +SET(HAVE_STRPBRK 1 CACHE INTERNAL "") +SET(HAVE_STRSEP CACHE INTERNAL "") +SET(HAVE_STRSIGNAL CACHE INTERNAL "") +SET(HAVE_STRSTR 1 CACHE INTERNAL "") +SET(HAVE_STRTOK_R CACHE INTERNAL "") +SET(HAVE_STRTOL 1 CACHE INTERNAL "") +SET(HAVE_STRTOLL CACHE INTERNAL "") +SET(HAVE_STRTOUL 1 CACHE INTERNAL "") +SET(HAVE_STRTOULL CACHE INTERNAL "") +SET(HAVE_SVR3_SIGNALS CACHE INTERNAL "") +SET(HAVE_SYNCH_H CACHE INTERNAL "") +SET(HAVE_SYSENT_H CACHE INTERNAL "") +SET(HAVE_SYS_CDEFS_H CACHE INTERNAL "") +SET(HAVE_SYS_DIR_H CACHE INTERNAL "") +SET(HAVE_SYS_ERRLIST CACHE INTERNAL "") +SET(HAVE_SYS_FILE_H CACHE INTERNAL "") +SET(HAVE_SYS_FPU_H CACHE INTERNAL "") +SET(HAVE_SYS_IOCTL_H CACHE INTERNAL "") +SET(HAVE_SYS_IPC_H CACHE INTERNAL "") +SET(HAVE_SYS_MALLOC_H CACHE INTERNAL "") +SET(HAVE_SYS_MMAN_H CACHE INTERNAL "") +SET(HAVE_SYS_PARAM_H CACHE INTERNAL "") +SET(HAVE_SYS_PRCTL_H CACHE INTERNAL "") +SET(HAVE_SYS_PTEM_H CACHE INTERNAL "") +SET(HAVE_SYS_PTE_H CACHE INTERNAL "") +SET(HAVE_SYS_RESOURCE_H CACHE INTERNAL "") +SET(HAVE_SYS_SELECT_H CACHE INTERNAL "") +SET(HAVE_SYS_SHM_H CACHE INTERNAL "") +SET(HAVE_SYS_SOCKIO_H CACHE INTERNAL "") +SET(HAVE_SYS_SOCKET_H CACHE INTERNAL "") +SET(HAVE_SYS_STAT_H 1 CACHE INTERNAL "") +SET(HAVE_SYS_STREAM_H CACHE INTERNAL "") +SET(HAVE_SYS_TERMCAP_H CACHE INTERNAL "") +SET(HAVE_SYS_TIMEB_H 1 CACHE INTERNAL "") +SET(HAVE_SYS_TIMES_H CACHE INTERNAL "") +SET(HAVE_SYS_TIME_H CACHE INTERNAL "") +SET(HAVE_SYS_TYPES_H 1 CACHE INTERNAL "") +SET(HAVE_SYS_UN_H CACHE INTERNAL "") +SET(HAVE_SYS_UTIME_H 1 CACHE INTERNAL "") +SET(HAVE_SYS_VADVISE_H CACHE INTERNAL "") +SET(HAVE_SYS_WAIT_H CACHE INTERNAL "") +SET(HAVE_TCGETATTR CACHE INTERNAL "") +SET(HAVE_TELL 1 CACHE INTERNAL "") +SET(HAVE_TEMPNAM 1 CACHE INTERNAL "") +SET(HAVE_TERMCAP_H CACHE INTERNAL "") +SET(HAVE_TERMIOS_H CACHE INTERNAL "") +SET(HAVE_TERMIO_H CACHE INTERNAL "") +SET(HAVE_TERM_H CACHE INTERNAL "") +SET(HAVE_THR_SETCONCURRENCY CACHE INTERNAL "") +SET(HAVE_THR_YIELD CACHE INTERNAL "") +SET(HAVE_TIME 1 CACHE INTERNAL "") +SET(HAVE_TIMES CACHE INTERNAL "") +SET(HAVE_TIMESPEC_TS_SEC CACHE INTERNAL "") +SET(HAVE_TIME_H 1 CACHE INTERNAL "") +SET(HAVE_TZNAME 1 CACHE INTERNAL "") +SET(HAVE_UNISTD_H CACHE INTERNAL "") +SET(HAVE_UTIME_H CACHE INTERNAL "") +SET(HAVE_VALLOC CACHE INTERNAL "") +SET(HAVE_VARARGS_H 1 CACHE INTERNAL "") +SET(HAVE_VASPRINTF CACHE INTERNAL "") +SET(HAVE_VPRINTF 1 CACHE INTERNAL "") +IF(MSVC_VERSION GREATER 1310) +SET(HAVE_VSNPRINTF 1 CACHE INTERNAL "") +ENDIF() +SET(HAVE_WEAK_SYMBOL CACHE INTERNAL "") +SET(HAVE_WORDS_BIGENDIAN TRUE CACHE INTERNAL "") +SET(WORDS_BIGENDIAN CACHE INTERNAL "") +SET(HAVE__S_IFIFO 1 CACHE INTERNAL "") +SET(HAVE__S_IREAD 1 CACHE INTERNAL "") +SET(HAVE__finite 1 CACHE INTERNAL "") +SET(HAVE__pclose 1 CACHE INTERNAL "") +SET(HAVE__popen 1 CACHE INTERNAL "") +SET(HAVE__stricmp 1 CACHE INTERNAL "") +SET(HAVE__strnicmp 1 CACHE INTERNAL "") +SET(HAVE__strtoi64 1 CACHE INTERNAL "") +SET(HAVE__strtoui64 1 CACHE INTERNAL "") +IF(MSVC_VERSION GREATER 1310) + SET(HAVE_strtok_s 1 CACHE INTERNAL "") +ENDIF() +SET(STDC_HEADERS CACHE 1 INTERNAL "") +SET(STRUCT_DIRENT_HAS_D_INO CACHE INTERNAL "") +SET(STRUCT_DIRENT_HAS_D_INO CACHE INTERNAL "") +SET(STRUCT_DIRENT_HAS_D_NAMLEN CACHE INTERNAL "") +SET(TIME_WITH_SYS_TIME CACHE INTERNAL "") +SET(TIME_T_UNSIGNED 1 CACHE INTERNAL "") +SET(TIOCSTAT_IN_SYS_IOCTL CACHE INTERNAL "") +SET(HAVE_S_IROTH CACHE INTERNAL "") +SET(HAVE_S_IFIFO CACHE INTERNAL "") +SET(QSORT_TYPE_IS_VOID 1 CACHE INTERNAL "") +SET(SIGNAL_RETURN_TYPE_IS_VOID 1 CACHE INTERNAL "") +SET(C_HAS_inline CACHE INTERNAL "") +SET(C_HAS___inline 1 CACHE INTERNAL "") +SET(FIONREAD_IN_SYS_IOCTL CACHE INTERNAL "") +SET(FIONREAD_IN_SYS_FILIO CACHE INTERNAL "") +SET(GWINSZ_IN_SYS_IOCTL CACHE INTERNAL "") +SET(HAVE_CXXABI_H CACHE INTERNAL "") +SET(HAVE_NDIR_H CACHE INTERNAL "") +SET(HAVE_SYS_NDIR_H CACHE INTERNAL "") +SET(HAVE_SYS_NDIR_H CACHE INTERNAL "") +SET(HAVE_ASM_TERMBITS_H CACHE INTERNAL "") +SET(HAVE_TERMBITS_H CACHE INTERNAL "") +SET(HAVE_VIS_H CACHE INTERNAL "") +SET(HAVE_WCHAR_H 1 CACHE INTERNAL "") +SET(HAVE_WCTYPE_H 1 CACHE INTERNAL "") +SET(HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP CACHE INTERNAL "") +SET(HAVE_SOCKADDR_IN_SIN_LEN CACHE INTERNAL "") +SET(HAVE_SOCKADDR_IN6_SIN6_LEN CACHE INTERNAL "") +SET(HAVE_VALGRIND CACHE INTERNAL "") +SET(HAVE_EVENT_H CACHE INTERNAL "") +SET(HAVE_LINUX_UNISTD_H CACHE INTERNAL "") +SET(HAVE_SYS_UTSNAME_H CACHE INTERNAL "") +SET(HAVE_PTHREAD_ATTR_GETGUARDSIZE CACHE INTERNAL "") +SET(FIONREAD_IN_SYS_FILIO CACHE INTERNAL "") +SET(FIONREAD_IN_SYS_IOCTL CACHE INTERNAL "") +SET(GWINSZ_IN_SYS_IOCTL CACHE INTERNAL "") +SET(HAVE_ACCESS 1 CACHE INTERNAL "") +SET(HAVE_AIOWAIT CACHE INTERNAL "") +SET(HAVE_AIO_H CACHE INTERNAL "") +SET(HAVE_AIO_READ CACHE INTERNAL "") +SET(HAVE_ALARM CACHE INTERNAL "") +SET(HAVE_ALLOCA CACHE INTERNAL "") +SET(HAVE_ALLOCA_H CACHE INTERNAL "") +SET(HAVE_ARPA_INET_H CACHE INTERNAL "") +SET(HAVE_ASM_MSR_H CACHE INTERNAL "") +SET(HAVE_ASM_TERMBITS_H CACHE INTERNAL "") +SET(HAVE_BACKTRACE CACHE INTERNAL "") +SET(HAVE_BACKTRACE_SYMBOLS CACHE INTERNAL "") +SET(HAVE_BACKTRACE_SYMBOLS_FD CACHE INTERNAL "") +SET(HAVE_BCMP CACHE INTERNAL "") +SET(HAVE_BFILL CACHE INTERNAL "") +SET(HAVE_BMOVE CACHE INTERNAL "") +SET(HAVE_BSD_SIGNALS CACHE INTERNAL "") +SET(HAVE_BSEARCH CACHE INTERNAL "") +SET(HAVE_BSS_START CACHE INTERNAL "") +SET(HAVE_BZERO CACHE INTERNAL "") +SET(HAVE_CHOWN CACHE INTERNAL "") +SET(HAVE_CLOCK_GETTIME CACHE INTERNAL "") +SET(HAVE_COMPRESS CACHE INTERNAL "") +SET(HAVE_CRYPT CACHE INTERNAL "") +SET(HAVE_CRYPT_H CACHE INTERNAL "") +SET(HAVE_CUSERID CACHE INTERNAL "") +SET(HAVE_CXXABI_H CACHE INTERNAL "") +SET(HAVE_DECL_FDATASYNC CACHE INTERNAL "") +SET(HAVE_SIGNAL_H 1 CACHE INTERNAL "") +SET(HAVE_GETHOSTBYNAME_R CACHE INTERNAL "") +SET(HAVE_PTHREAD_ATTR_SETPRIO CACHE INTERNAL "") +SET(HAVE_PTHREAD_ATTR_SETSCHEDPARAM CACHE INTERNAL "") +SET(HAVE_PTHREAD_KILL CACHE INTERNAL "") +SET(HAVE_PTHREAD_SETPRIO_NP CACHE INTERNAL "") +SET(HAVE_PTHREAD_SETSCHEDPARAM CACHE INTERNAL "") +SET(HAVE_SETFILEPOINTER CACHE INTERNAL "") +SET(SIZEOF_U_INT32_T CACHE INTERNAL "") +SET(IS_VOID_SIGNAL 1 CACHE INTERNAL "") +SET(IS_VOID_QSORT 1 CACHE INTERNAL "") +ENDIF() diff --git a/libmariadb/cmake/export.cmake b/libmariadb/cmake/export.cmake new file mode 100644 index 00000000..5ae2b74f --- /dev/null +++ b/libmariadb/cmake/export.cmake @@ -0,0 +1,30 @@ +# +# Copyright (C) 2013-2016 MariaDB Corporation AB +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the COPYING-CMAKE-SCRIPTS file. +# +MACRO(CREATE_EXPORT_FILE op outfile version symbols alias_version) + IF(WIN32) + SET(EXPORT_CONTENT "EXPORTS\n") + FOREACH(exp_symbol ${symbols}) + SET(EXPORT_CONTENT ${EXPORT_CONTENT} "${exp_symbol}\n") + ENDFOREACH() + ELSE() + SET(EXPORT_CONTENT "VERSION {\n${version} {\nglobal:\n") + FOREACH(exp_symbol ${symbols}) + SET(EXPORT_CONTENT "${EXPORT_CONTENT} ${exp_symbol}\\;\n") + ENDFOREACH() + SET(EXPORT_CONTENT "${EXPORT_CONTENT}local:\n *\\;\n}\\;\n") + IF ("${alias_version}" STRGREATER "") + SET(EXPORT_CONTENT "${EXPORT_CONTENT}${alias_version} {\n}\\;\n}\\;\n") + FOREACH(exp_symbol ${symbols}) + SET(EXPORT_CONTENT "${EXPORT_CONTENT}\"${exp_symbol}@${alias_version}\" = ${exp_symbol}\\;\n") + ENDFOREACH() + ELSE() + SET(EXPORT_CONTENT "${EXPORT_CONTENT}}\\;\n") + ENDIF() + ENDIF() + FILE(${op} ${CMAKE_CURRENT_BINARY_DIR}/${outfile} ${EXPORT_CONTENT}) +ENDMACRO() diff --git a/libmariadb/cmake/install.cmake b/libmariadb/cmake/install.cmake new file mode 100644 index 00000000..4a82dd9e --- /dev/null +++ b/libmariadb/cmake/install.cmake @@ -0,0 +1,152 @@ +# +# Copyright (C) 2013-2016 MariaDB Corporation AB +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the COPYING-CMAKE-SCRIPTS file. +# + +# +# This file contains settings for the following layouts: +# +# - RPM +# Built with default prefix=/usr +# +# +# The following va+riables are used and can be overwritten +# +# INSTALL_LAYOUT installation layout (DEFAULT = standard for tar.gz and zip packages +# RPM packages +# +# INSTALL_BINDIR location of binaries (mariadb_config) +# INSTALL_LIBDIR location of libraries +# INSTALL_PLUGINDIR location of plugins + +IF(NOT INSTALL_LAYOUT) + SET(INSTALL_LAYOUT "DEFAULT") +ENDIF() + +SET(INSTALL_LAYOUT ${INSTALL_LAYOUT} CACHE + STRING "Installation layout. Currently supported options are DEFAULT (tar.gz and zip), RPM and DEB") + +# On Windows we only provide zip and .msi. Latter one uses a different packager. +IF(UNIX) + IF(INSTALL_LAYOUT MATCHES "RPM") + SET(libmariadb_prefix "/usr") + ELSEIF(INSTALL_LAYOUT MATCHES "DEFAULT|DEB") + SET(libmariadb_prefix ${CMAKE_INSTALL_PREFIX}) + ENDIF() +ENDIF() + +IF(CMAKE_DEFAULT_PREFIX_INITIALIZED_BY_DEFAULT) + SET(CMAKE_DEFAULT_PREFIX ${libmariadb_prefix} CACHE PATH "Installation prefix" FORCE) +ENDIF() + +# check if the specified installation layout is valid +SET(VALID_INSTALL_LAYOUTS "DEFAULT" "RPM" "DEB") +LIST(FIND VALID_INSTALL_LAYOUTS "${INSTALL_LAYOUT}" layout_no) +IF(layout_no EQUAL -1) + MESSAGE(FATAL_ERROR "Invalid installation layout ${INSTALL_LAYOUT}. Please specify one of the following layouts: ${VALID_INSTALL_LAYOUTS}") +ENDIF() + + + +# +# Todo: We don't generate man pages yet, will fix it +# later (webhelp to man transformation) +# + +# +# DEFAULT layout +# + +SET(INSTALL_BINDIR_DEFAULT "bin") +SET(INSTALL_LIBDIR_DEFAULT "lib/mariadb") +SET(INSTALL_PCDIR_DEFAULT "lib/pkgconfig") +SET(INSTALL_INCLUDEDIR_DEFAULT "include/mariadb") +SET(INSTALL_DOCDIR_DEFAULT "docs") +IF(NOT IS_SUBPROJECT) + SET(INSTALL_PLUGINDIR_DEFAULT "lib/mariadb/plugin") +ELSE() +ENDIF() +SET(LIBMARIADB_STATIC_DEFAULT "mariadbclient") +# +# RPM layout +# +SET(INSTALL_BINDIR_RPM "bin") +IF((CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le" OR CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "s390x") AND CMAKE_SIZEOF_VOID_P EQUAL 8) + SET(INSTALL_LIBDIR_RPM "lib64/mariadb") + SET(INSTALL_PCDIR_RPM "lib64/pkgconfig") + SET(INSTALL_PLUGINDIR_RPM "lib64/mariadb/plugin") +ELSE() + SET(INSTALL_LIBDIR_RPM "lib/mariadb") + SET(INSTALL_PCDIR_RPM "lib/pkgconfig") + SET(INSTALL_PLUGINDIR_RPM "lib/mariadb/plugin") +ENDIF() +SET(INSTALL_INCLUDEDIR_RPM "include") +SET(INSTALL_DOCDIR_RPM "docs") +SET(LIBMARIADB_STATIC_RPM "mariadbclient") + +# +# DEB layout +# +SET(INSTALL_BINDIR_DEB "bin") +SET(INSTALL_LIBDIR_DEB "lib/${CMAKE_LIBRARY_ARCHITECTURE}") +SET(INSTALL_PCDIR_DEB "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig") +SET(INSTALL_PLUGINDIR_DEB "${INSTALL_LIBDIR_DEB}/libmariadb${CPACK_PACKAGE_VERSION_MAJOR}/plugin") +SET(INSTALL_INCLUDEDIR_DEB "include/mariadb") +SET(LIBMARIADB_STATIC_DEB "mariadb") + +IF(INSTALL_LAYOUT MATCHES "DEB") + SET(INSTALL_PLUGINDIR_CLIENT ${INSTALL_PLUGINDIR_DEB}) +ENDIF() + + +# +# Overwrite defaults +# +IF(INSTALL_LIBDIR) + SET(INSTALL_LIBDIR_${INSTALL_LAYOUT} ${INSTALL_LIBDIR}) +ENDIF() + +IF(INSTALL_PCDIR) + SET(INSTALL_PCDIR_${INSTALL_LAYOUT} ${INSTALL_PCDIR}) +ENDIF() + +IF(INSTALL_PLUGINDIR) + SET(INSTALL_PLUGINDIR_${INSTALL_LAYOUT} ${INSTALL_PLUGINDIR}) +ENDIF() + +# Extra INSTALL_PLUGINDIR_CLIENT that overrides any INSTALL_PLUGINDIR override +IF(INSTALL_PLUGINDIR_CLIENT) + SET(INSTALL_PLUGINDIR_${INSTALL_LAYOUT} ${INSTALL_PLUGINDIR_CLIENT}) +ENDIF() + +IF(INSTALL_INCLUDEDIR) + SET(INSTALL_INCLUDEDIR_${INSTALL_LAYOUT} ${INSTALL_INCLUDEDIR}) +ENDIF() + +IF(INSTALL_BINDIR) + SET(INSTALL_BINDIR_${INSTALL_LAYOUT} ${INSTALL_BINDIR}) +ENDIF() + +IF(NOT INSTALL_PREFIXDIR) + SET(INSTALL_PREFIXDIR_${INSTALL_LAYOUT} ${libmariadb_prefix}) +ELSE() + SET(INSTALL_PREFIXDIR_${INSTALL_LAYOUT} ${INSTALL_PREFIXDIR}) +ENDIF() + +IF(DEFINED INSTALL_SUFFIXDIR) + SET(INSTALL_SUFFIXDIR_${INSTALL_LAYOUT} ${INSTALL_SUFFIXDIR}) +ENDIF() + +FOREACH(dir "BIN" "LIB" "PC" "INCLUDE" "DOCS" "PLUGIN") + SET(INSTALL_${dir}DIR ${INSTALL_${dir}DIR_${INSTALL_LAYOUT}}) + MARK_AS_ADVANCED(INSTALL_${dir}DIR) + MESSAGE1(INSTALL_${dir}DIR "MariaDB Connector C: INSTALL_${dir}DIR=${INSTALL_${dir}DIR}") +ENDFOREACH() + +SET(LIBMARIADB_STATIC_NAME ${LIBMARIADB_STATIC_${INSTALL_LAYOUT}}) +MARK_AS_ADVANCED(LIBMARIADB_STATIC_NAME) + +MESSAGE1(LIBMARIADB_STATIC_NAME "MariaDB Connector C: LIBMARIADB_STATIC_NAME ${LIBMARIADB_STATIC_NAME}") diff --git a/libmariadb/cmake/install_plugins.cmake b/libmariadb/cmake/install_plugins.cmake new file mode 100644 index 00000000..b8d15ba1 --- /dev/null +++ b/libmariadb/cmake/install_plugins.cmake @@ -0,0 +1,20 @@ +# +# Copyright (C) 2013-2016 MariaDB Corporation AB +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the COPYING-CMAKE-SCRIPTS file. +# +# plugin installation + +MACRO(INSTALL_PLUGIN name binary_dir) + INSTALL(TARGETS ${name} COMPONENT ClientPlugins DESTINATION ${INSTALL_PLUGINDIR}) + IF(MSVC) + INSTALL(FILES $<TARGET_PDB_FILE:${name}> COMPONENT Debuginfo + DESTINATION symbols CONFIGURATIONS Debug RelWithDebInfo) + ENDIF() + IF(WIN32) + FILE(APPEND ${CC_BINARY_DIR}/win/packaging/plugin.conf "<File Id=\"${name}.dll\" Name=\"${name}.dll\" DiskId=\"1\" Source=\"${binary_dir}/${CMAKE_BUILD_TYPE}/${name}.dll\"/>\n") + FILE(APPEND ${CC_BINARY_DIR}/win/packaging/plugin.conf "<File Id=\"${name}.pdb\" Name=\"${name}.pdb\" DiskId=\"1\" Source=\"${binary_dir}/${CMAKE_BUILD_TYPE}/${name}.pdb\"/>\n") + ENDIF() +ENDMACRO() diff --git a/libmariadb/cmake/libressl_version.c b/libmariadb/cmake/libressl_version.c new file mode 100644 index 00000000..cceac8c3 --- /dev/null +++ b/libmariadb/cmake/libressl_version.c @@ -0,0 +1,7 @@ +#include <openssl/opensslv.h> +#include <stdio.h> + +int main() +{ + printf("%s", LIBRESSL_VERSION_TEXT); +} diff --git a/libmariadb/cmake/linux_x86_toolchain.cmake b/libmariadb/cmake/linux_x86_toolchain.cmake new file mode 100644 index 00000000..13e0b994 --- /dev/null +++ b/libmariadb/cmake/linux_x86_toolchain.cmake @@ -0,0 +1,18 @@ +# +# Copyright (C) 2013-2016 MariaDB Corporation AB +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the COPYING-CMAKE-SCRIPTS file. +# +# toolchain file for building a 32bit version on a 64bit host + +# Usage: +# cmake -DCMAKE_TOOLCHAIN_FILE=linux_86.toolchain.cmake + +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_SYSTEM_PROCESSOR "i686") + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32" CACHE STRING "c++ flags") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32" CACHE STRING "c flags") diff --git a/libmariadb/cmake/misc.cmake b/libmariadb/cmake/misc.cmake new file mode 100644 index 00000000..0b7149b2 --- /dev/null +++ b/libmariadb/cmake/misc.cmake @@ -0,0 +1,13 @@ +IF ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_LESS "2.8.7") + FUNCTION(MESSAGE1 id out) + MESSAGE(STATUS "${out}") + ENDFUNCTION() +ELSE() + FUNCTION(MESSAGE1 id out) + STRING(MD5 hash "${out}") + IF(NOT __msg1_${id} STREQUAL "${hash}") + MESSAGE(STATUS "${out}") + ENDIF() + SET(__msg1_${id} ${hash} CACHE INTERNAL "") + ENDFUNCTION() +ENDIF() diff --git a/libmariadb/cmake/plugins.cmake b/libmariadb/cmake/plugins.cmake new file mode 100644 index 00000000..1f321b14 --- /dev/null +++ b/libmariadb/cmake/plugins.cmake @@ -0,0 +1,94 @@ +# +# Copyright (C) 2013-2018 MariaDB Corporation AB +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the COPYING-CMAKE-SCRIPTS file. +# +# plugin configuration + +include(${CC_SOURCE_DIR}/cmake/install_plugins.cmake) +include(${CC_SOURCE_DIR}/cmake/sign.cmake) + +FUNCTION(REGISTER_PLUGIN) + + SET(one_value_keywords TARGET DEFAULT TYPE) + SET(multi_value_keywords CONFIGURATIONS SOURCES LIBRARIES INCLUDES COMPILE_OPTIONS) + + cmake_parse_arguments(CC_PLUGIN + "${options}" + "${one_value_keywords}" + "${multi_value_keywords}" + ${ARGN}) + + # overwrite default if it was specified with cmake option + string(TOUPPER ${CC_PLUGIN_TARGET} cc_plugin) + if(NOT "${CLIENT_PLUGIN_${cc_plugin}}" STREQUAL "") + SET(CC_PLUGIN_DEFAULT ${CLIENT_PLUGIN_${cc_plugin}}) + endif() + + # use uppercase + string(TOUPPER ${CC_PLUGIN_TARGET} target_name) + string(TOUPPER "${CC_PLUGIN_CONFIGURATIONS}" CC_PLUGIN_CONFIGURATIONS) + + if(NOT ${PLUGIN_${target_name}} STREQUAL "") + string(TOUPPER ${PLUGIN_${target_name}} PLUGIN_${target_name}) + set(CC_PLUGIN_DEFAULT ${PLUGIN_${target_name}}) + endif() + +# check if default value is valid + string(TOUPPER ${CC_PLUGIN_DEFAULT} CC_PLUGIN_DEFAULT) + list(FIND CC_PLUGIN_CONFIGURATIONS ${CC_PLUGIN_DEFAULT} configuration_found) + if(${configuration_found} EQUAL -1) + message(FATAL_ERROR "Invalid plugin type ${CC_PLUGIN_DEFAULT}. Allowed plugin types are ${CC_PLUGIN_CONFIGURATIONS}") + endif() + + if(NOT ${CC_PLUGIN_DEFAULT} STREQUAL "OFF") + set(PLUGIN_${CC_PLUGIN_TARGET}_TYPE ${CC_PLUGIN_TYPE}) + + if(${CC_PLUGIN_DEFAULT} STREQUAL "DYNAMIC") + + set(PLUGINS_DYNAMIC ${PLUGINS_DYNAMIC} ${CC_PLUGIN_TARGET} PARENT_SCOPE) + if(WIN32) + set(target ${CC_PLUGIN_TARGET}) + set(FILE_TYPE "VFT_DLL") + set(FILE_DESCRIPTION "MariaDB client plugin") + set(FILE_VERSION ${CPACK_PACKAGE_VERSION}) + set(ORIGINAL_FILE_NAME "${target}.dll") + configure_file(${CC_SOURCE_DIR}/win/resource.rc.in + ${CC_BINARY_DIR}/win/${target}.rc + @ONLY) + set(CC_PLUGIN_SOURCES ${CC_PLUGIN_SOURCES} ${CC_BINARY_DIR}/win/${target}.rc ${CC_SOURCE_DIR}/plugins/plugin.def) + endif() + add_library(${CC_PLUGIN_TARGET} MODULE ${CC_PLUGIN_SOURCES}) + target_link_libraries(${CC_PLUGIN_TARGET} ${CC_PLUGIN_LIBRARIES}) + set_target_properties(${CC_PLUGIN_TARGET} PROPERTIES PREFIX "") + set_target_properties(${CC_PLUGIN_TARGET} + PROPERTIES COMPILE_FLAGS + "-DPLUGIN_DYNAMIC=1 ${CC_PLUGIN_COMPILE_OPTIONS}") + if (NOT "${CC_PLUGIN_INCLUDES}" STREQUAL "") + if(CMAKE_VERSION VERSION_LESS 2.8.11) + include_directories(${CC_PLUGIN_INCLUDES}) + else() + target_include_directories(${CC_PLUGIN_TARGET} PRIVATE ${CC_PLUGIN_INCLUDES}) + endif() + endif() + if (${CC_TARGET_COMPILE_OPTIONS}) + target_compile_options(${CC_PLUGIN_TARGET} ${CC_TARGET_COMPILE_OPTIONS}) + endif() + + if(WIN32) + SIGN_TARGET(${target}) + endif() + INSTALL_PLUGIN(${CC_PLUGIN_TARGET} ${CMAKE_CURRENT_BINARY_DIR}) + elseif(${CC_PLUGIN_DEFAULT} STREQUAL "STATIC") + set(PLUGINS_STATIC ${PLUGINS_STATIC} ${CC_PLUGIN_TARGET} PARENT_SCOPE) + set(LIBMARIADB_PLUGIN_CFLAGS ${LIBMARIADB_PLUGIN_CFLAGS} ${CC_PLUGIN_COMPILE_OPTIONS} PARENT_SCOPE) + set(LIBMARIADB_PLUGIN_INCLUDES ${LIBMARIADB_PLUGIN_INCLUDES} ${CC_PLUGIN_INCLUDES} PARENT_SCOPE) + set(LIBMARIADB_PLUGIN_SOURCES ${LIBMARIADB_PLUGIN_SOURCES} ${CC_PLUGIN_SOURCES} PARENT_SCOPE) + set(LIBMARIADB_PLUGIN_LIBS ${LIBMARIADB_PLUGIN_LIBS} ${CC_PLUGIN_LIBRARIES} PARENT_SCOPE) + endif() + else() + set(PLUGINS_OFF ${PLUGINS_OFF} ${CC_PLUGIN_TARGET}) + endif() +endfunction() diff --git a/libmariadb/cmake/sign.cmake b/libmariadb/cmake/sign.cmake new file mode 100644 index 00000000..7d694118 --- /dev/null +++ b/libmariadb/cmake/sign.cmake @@ -0,0 +1,20 @@ +# +# Copyright (C) 2013-2016 MariaDB Corporation AB +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the COPYING-CMAKE-SCRIPTS file. +# +IF(COMMAND SIGN_TARGET) + # Do not override server's SIGN_TARGET macro + RETURN() +ENDIF() + +MACRO(SIGN_TARGET target) + IF(WITH_SIGNCODE) + IF(WIN32) + SET(target_file $<TARGET_FILE:${target}>) + ADD_CUSTOM_COMMAND(TARGET ${target} COMMAND signtool ARGS sign ${SIGN_OPTIONS} ${target_file}) + ENDIF() + ENDIF() +ENDMACRO() diff --git a/libmariadb/cmake/symlink.cmake b/libmariadb/cmake/symlink.cmake new file mode 100644 index 00000000..c1c883d1 --- /dev/null +++ b/libmariadb/cmake/symlink.cmake @@ -0,0 +1,35 @@ +# +# Copyright (C) 2013-2016 MariaDB Corporation AB +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the COPYING-CMAKE-SCRIPTS file. +# +MACRO(create_symlink symlink_name target install_path) +# According to cmake documentation symlinks work on unix systems only +IF(UNIX) + # Get target components + ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${symlink_name} + COMMAND ${CMAKE_COMMAND} ARGS -E remove -f ${symlink_name} + COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink $<TARGET_FILE_NAME:${target}> ${symlink_name} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${target} + ) + + ADD_CUSTOM_TARGET(SYM_${symlink_name} + ALL + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${symlink_name}) + SET_TARGET_PROPERTIES(SYM_${symlink_name} PROPERTIES CLEAN_DIRECT_OUTPUT 1) + + IF(CMAKE_GENERATOR MATCHES "Xcode") + # For Xcode, replace project config with install config + STRING(REPLACE "${CMAKE_CFG_INTDIR}" + "\${CMAKE_INSTALL_CONFIG_NAME}" output ${CMAKE_CURRENT_BINARY_DIR}/${symlink_name}) + ENDIF() + + # presumably this will be used for libmysql*.so symlinks + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${symlink_name} DESTINATION ${install_path} + COMPONENT Development) +ENDIF() +ENDMACRO() diff --git a/libmariadb/cmake/version_info.cmake b/libmariadb/cmake/version_info.cmake new file mode 100644 index 00000000..ca0716da --- /dev/null +++ b/libmariadb/cmake/version_info.cmake @@ -0,0 +1,44 @@ +# +# Copyright (C) 2013-2016 MariaDB Corporation AB +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the COPYING-CMAKE-SCRIPTS file. +# +FUNCTION(GET_FILE_VERSION FILE_NAME FILE_VERSION) + + # if we build from a git repository, we calculate the file version: + # Patch number is number of commits for given file + IF(GIT_EXECUTABLE AND EXISTS ${CC_SOURCE_DIR}/.git) + EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} --git-dir=${CC_SOURCE_DIR}/.git --work-tree=${CC_SOURCE_DIR} rev-list HEAD --count -- ${FILE_NAME} + OUTPUT_VARIABLE FV) + STRING(REPLACE "\n" "" FV ${FV}) + SET(${FILE_VERSION} ${FV} PARENT_SCOPE) + ELSE() + SET(${FILE_VERSION} 0) + ENDIF() +ENDFUNCTION() + +MACRO(SET_VERSION_INFO) + SET(FILE_VERSION "0") + FOREACH(PROPERTY ${ARGN}) + IF(${PROPERTY} MATCHES "TARGET:") + STRING(REGEX REPLACE "^[TARGET:\\s]" "" TARGET ${PROPERTY}) + ELSEIF(${PROPERTY} MATCHES "FILE_TYPE:") + STRING(REGEX REPLACE "^[FILE_TYPE:\\s]" "" FILE_TYPE ${PROPERTY}) + ELSEIF(${PROPERTY} MATCHES "ORIGINAL_FILE_NAME:") + STRING(REGEX REPLACE "^[ORIGINAL_FILE_NAME:\\s]" "" ORIGINAL_FILE_NAME ${PROPERTY}) + ELSEIF(${PROPERTY} MATCHES "SOURCE_FILE:") + STRING(REGEX REPLACE "^[SOURCE_FILE:\\s]" "" SOURCE ${PROPERTY}) + GET_FILE_VERSION(${SOURCE} FILE_VERSION) + ELSEIF(${PROPERTY} MATCHES "FILE_DESCRIPTION:") + STRING(REPLACE "FILE_DESCRIPTION:" "" FILE_DESCRIPTION ${PROPERTY}) + ENDIF() + ENDFOREACH() + CONFIGURE_FILE(${CC_SOURCE_DIR}/win/resource.rc.in + ${CC_BINARY_DIR}/win/${TARGET}.rc) + SET(${TARGET}_RC ${CC_BINARY_DIR}/win/${TARGET}.rc) +ENDMACRO() + + + |