From d13498efa773c3123e858ea6c6178f2ee21830f0 Mon Sep 17 00:00:00 2001 From: Vladimir Davydov <vdavydov@tarantool.org> Date: Fri, 3 Nov 2023 21:00:27 +0300 Subject: [PATCH] cmake: don't reexport static library API functions There's no need in it because we closed Tarantool symbols long ago and now export only those symbols that are specified in exports files. Let's remove the useless code. Needed for #9242 NO_DOC=build NO_TEST=build NO_CHANGELOG=build (cherry picked from commit 707ff97f2d738595f28f65a046f0e965e401932e) --- src/CMakeLists.txt | 40 +++++----------------------------------- 1 file changed, 5 insertions(+), 35 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8b70dcf599..0731b314e8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -338,40 +338,11 @@ include_directories(${EXTRA_BOX_INCLUDE_DIRS}) set(TARANTOOL_C_FLAGS ${CMAKE_C_FLAGS} PARENT_SCOPE) set(TARANTOOL_CXX_FLAGS ${CMAKE_CXX_FLAGS} PARENT_SCOPE) -set(EXPORT_LIST) -if(BUILD_STATIC) - # for each static library we should find a corresponding shared library to - # parse and reexport library api functions - foreach(libstatic - ${READLINE_LIBRARIES} - ${CURL_LIBRARIES} - ${OPENSSL_LIBRARIES} - ${ICU_LIBRARIES}) - if (${libstatic} MATCHES "lib[^/]+.a") - string(REGEX MATCH "lib[^/]+.a" libname ${libstatic}) - string(REGEX REPLACE "\\.a$" "" libname ${libname}) - string(REGEX REPLACE "^lib" "" libname ${libname}) - find_library(SYMBOLS_LIB NAMES ${libname}) - # add found library to export list - list(APPEND EXPORT_LIST ${SYMBOLS_LIB}) - # set variable to allow rescan (CMake depended) - set(SYMBOLS_LIB "SYMBOLS_LIB-NOTFOUND") - elseif (${libstatic} STREQUAL bundled-libcurl OR - ${libstatic} STREQUAL bundled-ares OR - ${libstatic} STREQUAL bundled-nghttp2) - message("We don't need to export symbols from statically linked ${libstatic}, skipped") - else() - message(WARNING "${libstatic} should be a static") - endif() - endforeach(libstatic) - string(REPLACE ";" " " EXPORT_LIST "${EXPORT_LIST}") - - if (HAVE_OPENMP) - # Link libgomp explicitly to make it static. Avoid linking - # against DSO version of libgomp, which implied by -fopenmp - set (common_libraries ${common_libraries} "libgomp.a") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-openmp") - endif() +if(BUILD_STATIC AND HAVE_OPENMP) + # Link libgomp explicitly to make it static. Avoid linking + # against DSO version of libgomp, which implied by -fopenmp + set (common_libraries ${common_libraries} "libgomp.a") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-openmp") endif() set(exports_file_sources @@ -393,7 +364,6 @@ add_custom_command( COMMAND ${PROJECT_SOURCE_DIR}/extra/mkexports ${exports_file_sources_str} ${exports_file} ${CMAKE_SYSTEM_NAME} - ${EXPORT_LIST} ) add_executable( -- GitLab