diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-09-04 13:26:30 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-09-12 17:46:35 +0200 |
commit | 1fc49d3d1a2771bbf55146e458465b2b116edfd4 (patch) | |
tree | 83a92bc88afe1b935d6c46f45f955c27ee140dbd /libmariadb | |
parent | ca02ad4fb075db525431d700ff86b5ead6d9b7fd (diff) | |
download | mariadb-git-1fc49d3d1a2771bbf55146e458465b2b116edfd4.tar.gz |
Add C/C as a submodule in libmariadb/
also
* fix includes
* rename cmake macros and targets to avoid name clashes
Diffstat (limited to 'libmariadb')
-rw-r--r-- | libmariadb/CMakeLists.txt | 127 |
1 files changed, 0 insertions, 127 deletions
diff --git a/libmariadb/CMakeLists.txt b/libmariadb/CMakeLists.txt deleted file mode 100644 index 1f6b299d4d8..00000000000 --- a/libmariadb/CMakeLists.txt +++ /dev/null @@ -1,127 +0,0 @@ -INCLUDE(${CMAKE_SOURCE_DIR}/cmake/mariadb_connector_c.cmake) - -SET(CONNECTOR_C_INSTALLDIR "${CMAKE_CURRENT_BINARY_DIR}/mariadb-connector-c/${CMAKE_CFG_INTDIR}" CACHE STRING "") -SET(CONNECTOR_C_INSTALL_PREFIX ${CONNECTOR_C_INSTALLDIR}) - - -IF(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".") - STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${BUILD_TYPE}" CONNECTOR_C_INSTALL_PREFIX "${CONNECTOR_C_INSTALLDIR}") -ENDIF() - -SET(CONNECTOR_C_GIT_TAG "v3.0-cc-server-integ-0" CACHE STRING "Git tag or branch for connector/c") -IF(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/mariadb-connector-c) - # Building from source package - SET(CONNECTOR_C_SOURCE_DIR ${CMAKE_SOURCE_DIR}/mariadb-connector-c) - SET(GIT_PARAMS) -ELSE() - # Building from git, use git to get Connector/C - SET(GIT_PARAMS - GIT_REPOSITORY "https://github.com/MariaDB/mariadb-connector-c/" - GIT_TAG ${CONNECTOR_C_GIT_TAG} - ) - SET(CONNECTOR_C_SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/mariadb-connector-c-src) -ENDIF() - -IF(TARGET zlib) - GET_PROPERTY(ZLIB_LIBRARY_LOCATION TARGET zlib PROPERTY LOCATION) -ELSE() - SET(ZLIB_LIBRARY_LOCATION ${ZLIB_LIBRARY}) -ENDIF() - - -INCLUDE(ExternalProject) -ExternalProject_Add( - mariadb_connector_c - ${GIT_PARAMS} - UPDATE_COMMAND "" - PATCH_COMMAND "" - SOURCE_DIR ${CONNECTOR_C_SOURCE_DIR} - INSTALL_DIR ${CONNECTOR_C_INSTALLDIR} - CMAKE_ARGS ${CC_CMAKE_OPTS} - -DCMAKE_INSTALL_PREFIX=${CONNECTOR_C_INSTALL_PREFIX} - -DWITH_EXTERNAL_ZLIB=1 - -DZLIB_FOUND=1 - -DZLIB_LIBRARY=${ZLIB_LIBRARY_LOCATION} - -DZLIB_INCLUDE_DIR=${ZLIB_INCLUDE_DIR} - -DSKIP_TESTS=1 - -DMARIADB_PORT=${MYSQL_TCP_PORT} - -DMARIADB_UNIX_ADDR=${MYSQL_UNIX_ADDR} - -DSHARED_LIB_MAJOR_VERSION=${SHARED_LIB_MAJOR_VERSION} - -DPLUGINDIR=${INSTALL_PLUGINDIR} - -DFOR_SERVER=1 - TEST_COMMAND "" -) - -IF(TARGET zlib) - ADD_DEPENDENCIES(mariadb_connector_c zlib) -ENDIF() - -SET(STATIC_LIB_LOCATION "${CONNECTOR_C_INSTALLDIR}/lib/mariadb/${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient${CMAKE_STATIC_LIBRARY_SUFFIX}") - -IF(WIN32) - SET(SHARED_LIB_LOCATION "${CONNECTOR_C_INSTALLDIR}/lib/mariadb/libmysql${CMAKE_SHARED_LIBRARY_SUFFIX}") -ELSE() - SET(SHARED_LIB_LOCATION "${CONNECTOR_C_INSTALLDIR}/lib/mariadb/libmysqlclient${CMAKE_SHARED_LIBRARY_SUFFIX}") -ENDIF() -IF(WIN32) - # On Windows, we need to install import library. We also install PDB for debugging - STRING(REPLACE ".dll" ".lib" IMPORT_LIB_LOCATION ${SHARED_LIB_LOCATION}) - STRING(REPLACE ".dll" ".pdb" PDB_LOCATION ${SHARED_LIB_LOCATION}) -ENDIF() - -ADD_LIBRARY(mariadbclient STATIC IMPORTED GLOBAL) -SET_TARGET_PROPERTIES(mariadbclient PROPERTIES IMPORTED_LOCATION ${STATIC_LIB_LOCATION}) -ADD_DEPENDENCIES(mariadbclient mariadb_connector_c GenError) - -ADD_LIBRARY(libmariadb SHARED IMPORTED GLOBAL) -SET_TARGET_PROPERTIES(libmariadb PROPERTIES IMPORTED_LOCATION ${SHARED_LIB_LOCATION}) -ADD_DEPENDENCIES(libmariadb mariadb_connector_c GenError) - -SET(CONNECTOR_C_LIBS ${STATIC_LIB_LOCATION} ${CC_LIBS} ${ZLIB_LIBRARY} PARENT_SCOPE) - - -# INSTALL Connector/C files - -# For multiconfig generators (Visual Studio and Xcode) -# we need to replace CMAKE_CFG_INTDIR in filepath with CMAKE_INSTALL_CONFIG_NAME -# for cpack. -FUNCTION(GET_INSTALL_LOCATION LOC VARNAME) - SET(val ${LOC}) - IF (NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".") - STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" val ${val}) - ENDIF() - SET(${VARNAME} ${val} PARENT_SCOPE) -ENDFUNCTION() - -GET_INSTALL_LOCATION(${STATIC_LIB_LOCATION} STATIC_LIB_INSTALL_LOCATION) -INSTALL(FILES ${STATIC_LIB_INSTALL_LOCATION} DESTINATION ${INSTALL_LIBDIR} COMPONENT Development) - -IF(UNIX) - STRING(REPLACE "mysqlclient" "mysqlclient_r" - STATIC_LIB_R_INSTALL_LOCATION "${STATIC_LIB_INSTALL_LOCATION}") - INSTALL(FILES ${STATIC_LIB_R_INSTALL_LOCATION} OPTIONAL DESTINATION ${INSTALL_LIBDIR} COMPONENT Development) -ENDIF() - -# Install shared library -IF(WIN32) - # On Windows, we need to install import library. We also install PDB for debugging - SET(SHARED_LIB_FILES ${SHARED_LIB_LOCATION} ${IMPLIB_LOCATION} ${PDB_LOCATION}) -ELSE() - STRING(REPLACE "mysqlclient" "mysqlclient_r" SHARED_LIB_R_LOCATION ${SHARED_LIB_LOCATION}) - STRING(REPLACE "mysqlclient.so" "mysqlclient.so.${SHARED_LIB_MAJOR_VERSION}" - SHARED_LIB_LINK1_LOCATION ${SHARED_LIB_LOCATION}) - STRING(REPLACE "mysqlclient.so" "mysqlclient.so.${SHARED_LIB_MAJOR_VERSION}.0.0" - SHARED_LIB_LINK2_LOCATION ${SHARED_LIB_LOCATION}) - - SET(SHARED_LIB_FILES ${SHARED_LIB_LOCATION} ${SHARED_LIB_R_LOCATION} - ${SHARED_LIB_LINK1_LOCATION} ${SHARED_LIB_LINK2_LOCATION}) - LIST(REMOVE_DUPLICATES SHARED_LIB_FILES) -ENDIF() - -FOREACH(file ${SHARED_LIB_FILES}) - GET_INSTALL_LOCATION(${file} loc) - IF(loc) - INSTALL(FILES ${loc} DESTINATION ${INSTALL_LIBDIR} COMPONENT SharedLibraries OPTIONAL) - ENDIF() -ENDFOREACH() - |