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. The workaround
is to instead clear library paths that are not supposed to be linked.
  • Loading branch information
SmallJoker committed Jan 20, 2024
1 parent 66786d0 commit 8b6b817
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions source/Irrlicht/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -314,24 +314,38 @@ set(link_includes
"$<$<BOOL:${USE_X11}>:${X11_INCLUDE_DIR}>"
)

macro(MAKE_EMPTY_IF_FALSE condition variable)
if(NOT DEFINED ${condition} OR NOT ${${condition}})
set(${variable} "")
endif()
endmacro()

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

set(link_libs
"${ZLIB_LIBRARY}"
"${JPEG_LIBRARY}"
"${PNG_LIBRARY}"
"$<$<BOOL:${USE_SDL2}>:${SDL2_LIBRARIES}>"
${EGL_LIBRARY}
${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}
)

# Source files
Expand Down

0 comments on commit 8b6b817

Please sign in to comment.