Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop constant relink after cmake #191

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions cmake/export.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,28 @@
# BSD license.
# For details see the COPYING-CMAKE-SCRIPTS file.
#
MACRO(CREATE_EXPORT_FILE op outfile version symbols alias_version)
MACRO(CREATE_EXPORT_FILE export_file_name mysqlclient_version alias_version mariadb_version mysql_symbols mariadb_symbols)
IF(WIN32)
SET(EXPORT_CONTENT "EXPORTS\n")
FOREACH(exp_symbol ${symbols})
SET(EXPORT_CONTENT ${EXPORT_CONTENT} "${exp_symbol}\n")
ENDFOREACH()
STRING(REPLACE ";" "\n" export_file_text "EXPORTS\n${mariadb_symbols}\n${mysql_symbols}\n")
ELSE()
SET(EXPORT_CONTENT "VERSION {\n${version} {\nglobal:\n")
FOREACH(exp_symbol ${symbols})
SET(EXPORT_CONTENT "${EXPORT_CONTENT} ${exp_symbol}\\;\n")
STRING(REPLACE ";" ";\n " mysql_symbol_lines "${mysql_symbols}")
STRING(REPLACE ";" ";\n " mariadb_symbol_lines "${mariadb_symbols}")
SET(mysql_alias_lines "")
FOREACH(exp_symbol ${mysql_symbols})
SET(mysql_alias_lines "${mysql_alias_lines}\"${exp_symbol}@${alias_version}\" = ${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()
STRING(CONCAT export_file_text
"VERSION {\n${mysqlclient_version} {\nglobal:\n ${mysql_symbol_lines};\nlocal:\n *;\n};\n"
"${alias_version} {\n};\n};\n${mysql_alias_lines}"
"VERSION {\n${mariadb_version} {\nglobal:\n ${mariadb_symbol_lines};\nlocal:\n *;\n};\n};\n")
ENDIF()

# Only write output if file contents change.
SET(old_file_contents)
IF(EXISTS "${export_file_name}")
FILE(READ "${export_file_name}" old_file_contents)
ENDIF()
IF(NOT old_file_contents STREQUAL export_file_text)
FILE(WRITE "${export_file_name}" "${export_file_text}")
ENDIF()
FILE(${op} ${CMAKE_CURRENT_BINARY_DIR}/${outfile} ${EXPORT_CONTENT})
ENDMACRO()
20 changes: 5 additions & 15 deletions libmariadb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -347,22 +347,12 @@ SET(LIBMARIADB_SOURCES ${LIBMARIADB_SOURCES} mariadb_async.c ma_context.c)
SET(MARIADB_LIB_SYMBOLS ${MARIADB_LIB_SYMBOLS} ${MARIADB_NONBLOCK_SYMBOLS})

INCLUDE(${CC_SOURCE_DIR}/cmake/export.cmake)
IF(NOT WIN32)
CREATE_EXPORT_FILE(WRITE mariadbclient.def
"libmysqlclient_18"
CREATE_EXPORT_FILE("${CMAKE_CURRENT_BINARY_DIR}/mariadbclient.def"
libmysqlclient_18
libmariadbclient_18
libmariadb_3
"${MYSQL_LIB_SYMBOLS}"
"libmariadbclient_18")
CREATE_EXPORT_FILE(APPEND mariadbclient.def
"libmariadb_3"
"${MARIADB_LIB_SYMBOLS}"
"")
ELSE()
CREATE_EXPORT_FILE(WRITE mariadbclient.def
"libmariadb_3"
"${MARIADB_LIB_SYMBOLS};${MYSQL_LIB_SYMBOLS}"
"")
ENDIF()

"${MARIADB_LIB_SYMBOLS}")

IF((NOT WIN32) AND (CMAKE_VERSION VERSION_GREATER 2.8.7))
# CREATE OBJECT LIBRARY
Expand Down