diff options
Diffstat (limited to 'libmysql/CMakeLists.txt')
-rw-r--r-- | libmysql/CMakeLists.txt | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index 962ab529de1..33de97d198b 100644 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. # # 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 @@ -174,6 +174,12 @@ IF(MSVC) INSTALL_DEBUG_TARGET(clientlib DESTINATION ${INSTALL_LIBDIR}/debug) ENDIF() +MACRO(GET_TARGET_NAME target out_name) + GET_TARGET_PROPERTY(location ${target} LOCATION) + GET_FILENAME_COMPONENT(name ${location} NAME) + SET(${out_name} ${name}) +ENDMACRO() + IF(UNIX) MACRO(GET_VERSIONED_LIBNAME LIBNAME EXTENSION VERSION OUTNAME) SET(DOT_VERSION ".${VERSION}") @@ -186,11 +192,19 @@ IF(UNIX) SET(${OUTNAME} ${LIBNAME}${EXTENSION}${DOT_VERSION}) ENDIF() ENDMACRO() - INSTALL_SYMLINK(${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r.a mysqlclient ${INSTALL_LIBDIR} Development) +ENDIF() + +IF(UNIX) + GET_TARGET_NAME(mysqlclient lib_name) + INSTALL_SYMLINK(mysqlclient + ${lib_name} ${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r.a + ${INSTALL_LIBDIR} Development) ENDIF() IF(NOT DISABLE_SHARED) - MERGE_LIBRARIES(libmysql SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS} COMPONENT SharedLibraries) + MERGE_LIBRARIES(libmysql SHARED ${LIBS} + EXPORTS ${CLIENT_API_FUNCTIONS} + COMPONENT SharedLibraries) IF(UNIX) # libtool compatability IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR APPLE) @@ -198,7 +212,8 @@ IF(NOT DISABLE_SHARED) ELSEIF(CMAKE_SYSTEM_NAME MATCHES "HP-UX") SET(OS_SHARED_LIB_VERSION "${SHARED_LIB_MAJOR_VERSION}.0") ELSE() - SET(OS_SHARED_LIB_VERSION "${SHARED_LIB_MAJOR_VERSION}.0.0") + SET(OS_SHARED_LIB_VERSION + "${SHARED_LIB_MAJOR_VERSION}.${SHARED_LIB_MINOR_VERSION}.0") ENDIF() # Name of shared library is mysqlclient on Unix SET_TARGET_PROPERTIES(libmysql PROPERTIES @@ -224,8 +239,13 @@ IF(NOT DISABLE_SHARED) "${CMAKE_SHARED_LIBRARY_SUFFIX}" "" linkname) - INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} SharedLibraries) - SET(OS_SHARED_LIB_SYMLINKS "${SHARED_LIB_MAJOR_VERSION}" "${OS_SHARED_LIB_VERSION}") + GET_TARGET_NAME(libmysql lib_name) + GET_FILENAME_COMPONENT(lib_name_we ${lib_name} NAME_WE) + INSTALL_SYMLINK(libmysql + ${lib_name} ${linkname} + ${INSTALL_LIBDIR} SharedLibraries) + SET(OS_SHARED_LIB_SYMLINKS + "${SHARED_LIB_MAJOR_VERSION}" "${OS_SHARED_LIB_VERSION}") LIST(REMOVE_DUPLICATES OS_SHARED_LIB_SYMLINKS) FOREACH(ver ${OS_SHARED_LIB_SYMLINKS}) GET_VERSIONED_LIBNAME( @@ -233,7 +253,11 @@ IF(NOT DISABLE_SHARED) "${CMAKE_SHARED_LIBRARY_SUFFIX}" "${ver}" linkname) - INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} SharedLibraries) + GET_VERSIONED_LIBNAME( + ${lib_name_we} "${CMAKE_SHARED_LIBRARY_SUFFIX}" "${ver}" lib_name_ver) + INSTALL_SYMLINK(libmysql + ${lib_name_ver} ${linkname} + ${INSTALL_LIBDIR} SharedLibraries) ENDFOREACH() ENDIF() ENDIF() |