10 changed files with 122 additions and 107 deletions
-
1.gitignore
-
10CMakeLists.txt
-
6cmake/cpack_rpm.cmake
-
77cmake/for_clients.cmake
-
1debian/libmariadbclient-dev.files
-
2debian/patches/00list
-
51scripts/CMakeLists.txt
-
55scripts/mysql_config.sh
-
3support-files/CMakeLists.txt
-
23support-files/mariadb.pc.in
@ -0,0 +1,77 @@ |
|||
# |
|||
# Generate LIBS and CFLAGS that third-party clients should use |
|||
# |
|||
|
|||
# Use cmake variables to inspect dependencies for |
|||
# mysqlclient library (add -l stuff) |
|||
SET(CLIENT_LIBS "") |
|||
SET(LIBS "") |
|||
|
|||
# Avoid compatibility warning about lists with empty elements |
|||
IF(POLICY CMP0011) |
|||
CMAKE_POLICY(SET CMP0011 NEW) |
|||
ENDIF() |
|||
IF(POLICY CMP0007) |
|||
CMAKE_POLICY(SET CMP0007 OLD) |
|||
ENDIF() |
|||
|
|||
# Extract dependencies using CMake's internal ${target}_LIB_DEPENDS variable |
|||
# returned string in ${var} is can be passed to linker's command line |
|||
MACRO(EXTRACT_LINK_LIBRARIES target var) |
|||
IF(${target}_LIB_DEPENDS) |
|||
LIST(REMOVE_ITEM ${target}_LIB_DEPENDS "") |
|||
LIST(REMOVE_DUPLICATES ${target}_LIB_DEPENDS) |
|||
FOREACH(lib ${${target}_LIB_DEPENDS}) |
|||
# Filter out "general", it is not a library, just CMake hint |
|||
# Also, remove duplicates |
|||
IF(NOT lib STREQUAL "general" AND NOT ${var} MATCHES "-l${lib} ") |
|||
IF (lib MATCHES "^\\-l") |
|||
SET(${var} "${${var}} ${lib} ") |
|||
ELSEIF(lib MATCHES "^/") |
|||
IF (lib MATCHES "\\.(a|so([0-9.]*)|lib|dll|dylib)$") |
|||
# Full path, convert to just filename, strip "lib" prefix and extension |
|||
GET_FILENAME_COMPONENT(lib "${lib}" NAME_WE) |
|||
STRING(REGEX REPLACE "^lib" "" lib "${lib}") |
|||
SET(${var} "${${var}}-l${lib} " ) |
|||
ENDIF() |
|||
ELSE() |
|||
SET(${var} "${${var}}-l${lib} " ) |
|||
ENDIF() |
|||
ENDIF() |
|||
ENDFOREACH() |
|||
ENDIF() |
|||
IF(MSVC) |
|||
STRING(REPLACE "-l" "" ${var} "${${var}}") |
|||
ENDIF() |
|||
ENDMACRO() |
|||
|
|||
EXTRACT_LINK_LIBRARIES(mysqlclient LIBS) |
|||
EXTRACT_LINK_LIBRARIES(mysqlserver EMB_LIBS) |
|||
|
|||
SET(LIBS "-lmysqlclient ${ZLIB_DEPS} ${LIBS} ${openssl_libs}") |
|||
SET(EMB_LIBS "-lmysqld ${ZLIB_DEPS} ${EMB_LIBS} ${openssl_libs}") |
|||
|
|||
MACRO(REPLACE_FOR_CLIENTS VAR) |
|||
SET(v " ${${VAR}} ") |
|||
FOREACH(del ${ARGN}) |
|||
STRING(REGEX REPLACE " -(${del}) " " " v ${v}) |
|||
ENDFOREACH(del) |
|||
STRING(REGEX REPLACE " +" " " v ${v}) |
|||
STRING(STRIP "${v}" ${VAR}_FOR_CLIENTS) |
|||
ENDMACRO() |
|||
|
|||
# Remove some options that a client doesn't have to care about |
|||
# FIXME until we have a --cxxflags, we need to remove -Xa |
|||
# and -xstrconst to make --cflags usable for Sun Forte C++ |
|||
# FIXME until we have a --cxxflags, we need to remove -AC99 |
|||
# to make --cflags usable for HP C++ (aCC) |
|||
REPLACE_FOR_CLIENTS(CFLAGS "[DU]DBUG_OFF" "[DU]SAFE_MUTEX" "[DU]NDEBUG" |
|||
"[DU]UNIV_MUST_NOT_INLINE" "[DU]FORCE_INIT_OF_VARS" "[DU]EXTRA_DEBUG" "[DU]HAVE_valgrind" |
|||
"O" "O[0-9]" "xO[0-9]" "W[-A-Za-z]*" "mtune=[-A-Za-z0-9]*" "g" "fPIC" |
|||
"mcpu=[-A-Za-z0-9]*" "unroll2" "ip" "mp" "march=[-A-Za-z0-9]*" "Xa" |
|||
"xstrconst" "xc99=none" "AC99" "restrict") |
|||
|
|||
# Same for --libs |
|||
REPLACE_FOR_CLIENTS(LIBS lmtmalloc static-libcxa i-static static-intel) |
|||
REPLACE_FOR_CLIENTS(EMB_LIBS lmtmalloc static-libcxa i-static static-intel) |
|||
|
@ -0,0 +1,23 @@ |
|||
# these four variables are present in almost every .pc file |
|||
prefix=@CMAKE_INSTALL_PREFIX@ |
|||
exec_prefix=${prefix} |
|||
libdir=${prefix}/@INSTALL_LIBDIR@ |
|||
includedir=${prefix}/@INSTALL_INCLUDEDIR@ |
|||
# those are rarely present or not at all, but we export them regardless |
|||
bindir=${prefix}/@INSTALL_BINDIR@ |
|||
sbindir=${prefix}/@INSTALL_SBINDIR@ |
|||
scriptdir=${prefix}/@INSTALL_SCRIPTDIR@ |
|||
plugindir=${prefix}/@INSTALL_PLUGINDIR@ |
|||
docdir=${prefix}/@INSTALL_DOCDIR@ |
|||
mandir=${prefix}/@INSTALL_MANDIR@ |
|||
sharedir=${prefix}/@INSTALL_SHAREDIR@ |
|||
mysqlsharedir=${prefix}/@INSTALL_MYSQLSHAREDIR@ |
|||
mysqltestdir=${prefix}/@INSTALL_MYSQLTESTDIR@ |
|||
socket=@INSTALL_UNIX_ADDRDIR@ |
|||
|
|||
Name: @CPACK_PACKAGE_NAME@ |
|||
Description: @CPACK_PACKAGE_DESCRIPTION_SUMMARY@ |
|||
URL: @CPACK_PACKAGE_URL@ |
|||
Version: @VERSION@ |
|||
Libs: -L${libdir} @LIBS_FOR_CLIENTS@ |
|||
Cflags: -I${includedir} -I${includedir}/.. @CFLAGS_FOR_CLIENTS@ |
Write
Preview
Loading…
Cancel
Save
Reference in new issue