Skip to content

Commit d388d1a

Browse files
committed
build: use zlib as a shared library
1 parent 858f1be commit d388d1a

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

CMakeLists.txt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,6 @@ endfunction(enable_unity_build)
120120
#############################################################
121121

122122
if(NOT EMSCRIPTEN)
123-
# TODO: can't use prebuilt zlib on Ubuntu, else get linker errors.
124-
# Error from building gme:
125-
# /usr/bin/ld: _deps/zlib-build/Release/libz.a(trees.c.o): relocation R_X86_64_PC32 against
126-
# symbol `_length_code' can not be used when making a shared object; recompile with -fPIC
127-
if(LINUX)
128-
set(FETCHCONTENT_TRY_FIND_PACKAGE_MODE NEVER)
129-
endif()
130-
131123
FetchContent_Declare(
132124
zlib
133125
GIT_REPOSITORY
@@ -136,10 +128,8 @@ if(NOT EMSCRIPTEN)
136128
19d7d6b32ee3af4ed4bdec415f42f518c93b5025
137129
FIND_PACKAGE_ARGS NAMES ZLIB
138130
)
131+
set(BUILD_SHARED_LIBS ON)
139132
FetchContent_MakeAvailable(zlib)
140-
if(LINUX)
141-
set(FETCHCONTENT_TRY_FIND_PACKAGE_MODE OPT_IN)
142-
endif()
143133

144134
if(NOT ZLIB_LIBRARIES)
145135
set(ZLIB_INCLUDE_DIR ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR})

0 commit comments

Comments
 (0)