Skip to content

Commit c8583f9

Browse files
committedJan 23, 2020
Organize and sort out some library dependency issues
1 parent a1da9ca commit c8583f9

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed
 

Diff for: ‎src/CMakeLists.txt

+20-13
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ if(BUILD_CLIENT)
108108
if(ENABLE_GLES)
109109
find_package(OpenGLES2 REQUIRED)
110110
else()
111-
if(NOT WIN32) # Unix probably
111+
# transitive dependency from Irrlicht (see longer explanation below)
112+
if(NOT WIN32)
112113
set(OPENGL_GL_PREFERENCE "LEGACY" CACHE STRING
113114
"See CMake Policy CMP0072 for reference. GLVND is broken on some nvidia setups")
114115
set(OpenGL_GL_PREFERENCE ${OPENGL_GL_PREFERENCE})
@@ -281,25 +282,38 @@ if(WIN32)
281282
else()
282283
# Unix probably
283284
if(BUILD_CLIENT)
284-
if(NOT HAIKU)
285+
if(NOT HAIKU AND NOT APPLE)
285286
find_package(X11 REQUIRED)
286-
endif(NOT HAIKU)
287+
endif(NOT HAIKU AND NOT APPLE)
288+
289+
##
290+
# The following dependencies are transitive dependencies from Irrlicht.
291+
# Minetest itself does not use them, but we link them so that statically
292+
# linking Irrlicht works.
293+
if(NOT HAIKU AND NOT APPLE)
294+
# This way Xxf86vm is found on OpenBSD too
295+
find_library(XXF86VM_LIBRARY Xxf86vm)
296+
mark_as_advanced(XXF86VM_LIBRARY)
297+
set(CLIENT_PLATFORM_LIBS ${CLIENT_PLATFORM_LIBS} ${XXF86VM_LIBRARY})
298+
endif(NOT HAIKU AND NOT APPLE)
287299

288300
find_package(JPEG REQUIRED)
289301
find_package(BZip2 REQUIRED)
290302
find_package(PNG REQUIRED)
291303
if(APPLE)
292-
find_library(CARBON_LIB Carbon)
293-
find_library(COCOA_LIB Cocoa)
294-
find_library(IOKIT_LIB IOKit)
304+
find_library(CARBON_LIB Carbon REQUIRED)
305+
find_library(COCOA_LIB Cocoa REQUIRED)
306+
find_library(IOKIT_LIB IOKit REQUIRED)
295307
mark_as_advanced(
296308
CARBON_LIB
297309
COCOA_LIB
298310
IOKIT_LIB
299311
)
300312
SET(CLIENT_PLATFORM_LIBS ${CLIENT_PLATFORM_LIBS} ${CARBON_LIB} ${COCOA_LIB} ${IOKIT_LIB})
301313
endif(APPLE)
314+
##
302315
endif(BUILD_CLIENT)
316+
303317
find_package(ZLIB REQUIRED)
304318
set(PLATFORM_LIBS -lpthread ${CMAKE_DL_LIBS})
305319
if(APPLE)
@@ -311,13 +325,6 @@ else()
311325
endif(HAVE_LIBRT)
312326
endif(APPLE)
313327

314-
if(NOT HAIKU AND NOT APPLE)
315-
# This way Xxf86vm is found on OpenBSD too
316-
find_library(XXF86VM_LIBRARY Xxf86vm)
317-
mark_as_advanced(XXF86VM_LIBRARY)
318-
set(CLIENT_PLATFORM_LIBS ${CLIENT_PLATFORM_LIBS} ${XXF86VM_LIBRARY})
319-
endif(NOT HAIKU AND NOT APPLE)
320-
321328
# Prefer local iconv if installed
322329
find_library(ICONV_LIBRARY iconv)
323330
mark_as_advanced(ICONV_LIBRARY)

0 commit comments

Comments
 (0)
Please sign in to comment.