diff options
author | Jonathan Perkin <jonathan.perkin@oracle.com> | 2010-08-10 15:06:04 +0100 |
---|---|---|
committer | Jonathan Perkin <jonathan.perkin@oracle.com> | 2010-08-10 15:06:04 +0100 |
commit | 66972aa2b30a179fa88115fbffae605cadd1a225 (patch) | |
tree | 4ba0b02cb0849caeb732a3c50433b850625e33e1 | |
parent | bd3aa7eb783ea405e8e8b57798273c57e5916da7 (diff) | |
parent | aeea7b6d251fdb78de032bb7c58d33ede6432558 (diff) | |
download | mariadb-git-66972aa2b30a179fa88115fbffae605cadd1a225.tar.gz |
Merge to mysql-5.5-bugfixing
-rw-r--r-- | scripts/CMakeLists.txt | 66 | ||||
-rw-r--r-- | scripts/mysql_config.sh | 2 |
2 files changed, 32 insertions, 36 deletions
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 188bd4bdaa5..5180206c529 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -1,4 +1,3 @@ -# Copyright (C) 2006 MySQL AB # # 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 @@ -252,43 +251,40 @@ IF(POLICY CMP0007) CMAKE_POLICY(SET CMP0007 OLD) ENDIF() -LIST(REMOVE_ITEM mysqlclient_LIB_DEPENDS "") -LIST(REMOVE_DUPLICATES mysqlclient_LIB_DEPENDS) -FOREACH(lib ${mysqlclient_LIB_DEPENDS}) - # Filter out "general", it is not a library, just CMake hint - IF(NOT lib STREQUAL "general" AND NOT CLIENT_LIBS MATCHES "-l${lib} ") - IF (lib MATCHES "^\\-l") - SET(CLIENT_LIBS "${CLIENT_LIBS} ${lib} ") - ELSEIF(lib MATCHES "^/") - # 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(CLIENT_LIBS "${CLIENT_LIBS}-l${lib} " ) - ELSE() - SET(CLIENT_LIBS "${CLIENT_LIBS}-l${lib} " ) - 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 "^/") + # 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} " ) + ELSE() + SET(${var} "${${var}}-l${lib} " ) + ENDIF() + ENDIF() + ENDFOREACH() ENDIF() -ENDFOREACH() - - -IF(LIBDL AND NOT LIBDL MATCHES "-l") - SET(LIBDL "-l${LIBDL}") -ENDIF() - -IF(LIBWRAP) - SET(WRAPLIBS "-lwrap") -ENDIF() - -SET(LIBS "${CLIENT_LIBS}") + IF(MSVC) + STRING(REPLACE "-l" "" ${var} "${${var}}") + ENDIF() +ENDMACRO() -IF(LIBCRYPT) - SET(LIBS "${LIBS} -l${LIBCRYPT}") -ENDIF() +EXTRACT_LINK_LIBRARIES(mysqlclient CLIENT_LIBS) +EXTRACT_LINK_LIBRARIES(mysqlserver LIBS) -IF(MSVC) - STRING(REPLACE "-l" "" CLIENT_LIBS "${CLIENT_LIBS}") - STRING(REPLACE "-l" "" LIBS "${LIBS}" ) -ENDIF() +# mysql_config evaluates ${LIBDL}, we want to avoid it +# as our CLIENT_LIBS and LIBS are already correct +SET(LIBDL) SET(NON_THREADED_LIBS ${CLIENT_LIBS}) SET(mysql_config_COMPONENT COMPONENT Development) diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh index 10755fc698b..69ec88d6724 100644 --- a/scripts/mysql_config.sh +++ b/scripts/mysql_config.sh @@ -108,7 +108,7 @@ fi # We intentionally add a space to the beginning and end of lib strings, simplifies replace later libs=" $ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@" libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@ " -libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@ " +libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @CLIENT_LIBS@ @openssl_libs@ " embedded_libs=" $ldflags -L$pkglibdir -lmysqld @LIBDL@ @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @openssl_libs@ " if [ -r "$pkglibdir/libmygcc.a" ]; then |