From 4299ee21d8c0e4fb361e1042bda1a0a9ddbeb60e Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Mon, 22 Jan 2024 09:50:29 +0100 Subject: [PATCH] CMake: Move generator conditional expressions (#281) --- source/Irrlicht/CMakeLists.txt | 42 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/source/Irrlicht/CMakeLists.txt b/source/Irrlicht/CMakeLists.txt index f90728bc..1a0ce7ac 100644 --- a/source/Irrlicht/CMakeLists.txt +++ b/source/Irrlicht/CMakeLists.txt @@ -314,26 +314,6 @@ set(link_includes "$<$:${X11_INCLUDE_DIR}>" ) -set(link_libs - "${ZLIB_LIBRARY}" - "${JPEG_LIBRARY}" - "${PNG_LIBRARY}" - "$<$:${SDL2_LIBRARIES}>" - - "$<$:${OPENGL_LIBRARIES}>" - "$<$:${OPENGLES_LIBRARY}>" - "$<$:${OPENGLES2_LIBRARIES}>" - ${EGL_LIBRARY} - - "$<$:-landroid -llog>" - ${COCOA_LIB} - ${IOKIT_LIB} - "$<$:gdi32>" - "$<$:winmm>" - "$<$:${X11_X11_LIB}>" - "$<$:${X11_Xi_LIB}>" -) - # Source files set(IRRMESHLOADER @@ -533,7 +513,27 @@ target_include_directories(IrrlichtMt ${link_includes} ) -target_link_libraries(IrrlichtMt PRIVATE ${link_libs}) +# this needs to be here and not in a variable (like link_includes) due to issues +# with the generator expressions on at least CMake 3.22, but not 3.28 or later +target_link_libraries(IrrlichtMt PRIVATE + ${ZLIB_LIBRARY} + ${JPEG_LIBRARY} + ${PNG_LIBRARY} + "$<$:${SDL2_LIBRARIES}>" + + "$<$:${OPENGL_LIBRARIES}>" + "$<$:${OPENGLES_LIBRARY}>" + "$<$:${OPENGLES2_LIBRARIES}>" + ${EGL_LIBRARY} + + "$<$:-landroid -llog>" + ${COCOA_LIB} + ${IOKIT_LIB} + "$<$:gdi32>" + "$<$:winmm>" + "$<$:${X11_X11_LIB}>" + "$<$:${X11_Xi_LIB}>" +) if(WIN32) target_compile_definitions(IrrlichtMt INTERFACE _IRR_WINDOWS_API_) # used in _IRR_DEBUG_BREAK_IF definition in a public header