Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
CMake: Replace generator conditional expressions
Browse files Browse the repository at this point in the history
OPENGL_LIBRARIES may contain multiple paths, separated by semicolons.
In CMake 3.22.1 this results in an improper list of libraries.
  • Loading branch information
SmallJoker committed Jan 21, 2024
1 parent 66786d0 commit ad23dd0
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions source/Irrlicht/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -318,22 +318,37 @@ set(link_libs
"${ZLIB_LIBRARY}"
"${JPEG_LIBRARY}"
"${PNG_LIBRARY}"
"$<$<BOOL:${USE_SDL2}>:${SDL2_LIBRARIES}>"
${SDL2_LIBRARIES}

"$<$<BOOL:${OPENGL_DIRECT_LINK}>:${OPENGL_LIBRARIES}>"
"$<$<BOOL:${OPENGLES_DIRECT_LINK}>:${OPENGLES_LIBRARY}>"
"$<$<BOOL:${OPENGLES2_DIRECT_LINK}>:${OPENGLES2_LIBRARIES}>"
${OPENGL_LIBRARIES}
${OPENGLES_LIBRARY}
${OPENGLES2_LIBRARIES}
${EGL_LIBRARY}

"$<$<PLATFORM_ID:Android>:-landroid -llog>"
${COCOA_LIB}
${IOKIT_LIB}
"$<$<PLATFORM_ID:Windows>:gdi32>"
"$<$<PLATFORM_ID:Windows>:winmm>"
"$<$<BOOL:${USE_X11}>:${X11_X11_LIB}>"
"$<$<BOOL:${USE_X11}>:${X11_Xi_LIB}>"
${X11_X11_LIB}
${X11_Xi_LIB}
)

# Workaround: the CMake generator's conditional expressions leave a stray tailing
# `>` in case of semicolon-separated paths. Affects CMake 3.22.1 and possibly more.
macro(APPEND_LIB condition variable)
if(${${condition}})
list(APPEND link_libs ${${variable}})
endif()
endmacro()

APPEND_LIB(USE_SDL2 SDL2_LIBRARIES)
APPEND_LIB(OPENGL_DIRECT_LINK OPENGL_LIBRARIES)
APPEND_LIB(OPENGLES_DIRECT_LINK OPENGLES_LIBRARY)
APPEND_LIB(OPENGLES2_DIRECT_LINK OPENGLES2_LIBRARIES)
APPEND_LIB(USE_X11 X11_X11_LIB)
APPEND_LIB(USE_X11 X11_Xi_LIB)

# Source files

set(IRRMESHLOADER
Expand Down

0 comments on commit ad23dd0

Please sign in to comment.