Skip to content

Commit

Permalink
Fix for static windows library (mariadbclient):
Browse files Browse the repository at this point in the history
For static library don't build internal zlib as library, but
add sources to object library.
  • Loading branch information
9EOR9 committed Feb 10, 2022
1 parent 39d1913 commit 340f920
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,6 @@ IF(WITH_EXTERNAL_ZLIB)
ENDIF()
ELSE()
SET(ZLIB_INCLUDE_DIR "${CC_SOURCE_DIR}/external/zlib")
ADD_SUBDIRECTORY(external/zlib)
SET(ZLIB_LIBRARY zlib)
ENDIF()
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})

Expand Down
6 changes: 0 additions & 6 deletions external/zlib/CMakeLists.txt

This file was deleted.

29 changes: 27 additions & 2 deletions libmariadb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,30 @@ IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_BUILD_TYPE MATCHES "Release")
SET_SOURCE_FILES_PROPERTIES(my_context.c PROPERTIES COMPILE_FLAGS -g)
ENDIF()

IF(ZLIB_FOUND AND WITH_EXTERNAL_ZLIB)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
ELSE()
SET(ZLIB_SOURCES
${CC_SOURCE_DIR}/external/zlib/adler32.c
${CC_SOURCE_DIR}/external/zlib/compress.c
${CC_SOURCE_DIR}/external/zlib/crc32.c
${CC_SOURCE_DIR}/external/zlib/deflate.c
${CC_SOURCE_DIR}/external/zlib/gzclose.c
${CC_SOURCE_DIR}/external/zlib/gzlib.c
${CC_SOURCE_DIR}/external/zlib/gzread.c
${CC_SOURCE_DIR}/external/zlib/gzwrite.c
${CC_SOURCE_DIR}/external/zlib/infback.c
${CC_SOURCE_DIR}/external/zlib/inffast.c
${CC_SOURCE_DIR}/external/zlib/inflate.c
${CC_SOURCE_DIR}/external/zlib/inftrees.c
${CC_SOURCE_DIR}/external/zlib/trees.c
${CC_SOURCE_DIR}/external/zlib/uncompr.c
${CC_SOURCE_DIR}/external/zlib/zutil.c
)
INCLUDE_DIRECTORIES(${CC_SOURCE_DIR}/external/zlib)
ENDIF()


SET(MARIADB_DYNCOL_SYMBOLS
mariadb_dyncol_check
mariadb_dyncol_column_cmp_named
Expand Down Expand Up @@ -259,8 +283,8 @@ SET(MARIADB_NONBLOCK_SYMBOLS
)

# handle static plugins
SET(LIBMARIADB_SOURCES ${LIBMARIADB_PLUGIN_SOURCES})
SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBMARIADB_PLUGIN_LIBS} ${INTERNAL_ZLIB_LIBRARY} ${ZSTD_LIBRARY} ${ZLIB_LIBRARY})
SET(LIBMARIADB_SOURCES ${LIBMARIADB_SOURCES} ${LIBMARIADB_PLUGIN_SOURCES})
SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBMARIADB_PLUGIN_LIBS} ${ZSTD_LIBRARY} ${ZLIB_LIBRARY})
MESSAGE(STATUS "SYSTEM_LIBS: ${SYSTEM_LIBS}")
ADD_DEFINITIONS(${LIBMARIADB_PLUGIN_DEFS})
FOREACH(plugin ${PLUGINS_STATIC})
Expand Down Expand Up @@ -324,6 +348,7 @@ ENDIF()
IF(ZLIB_FOUND AND WITH_EXTERNAL_ZLIB)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
ELSE()
SET(LIBMARIADB_SOURCES ${LIBMARIADB_SOURCES} ${ZLIB_SOURCES})
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/external/zlib)
ENDIF()

Expand Down

0 comments on commit 340f920

Please sign in to comment.