--- a/CMake/Dependencies.cmake
+++ b/CMake/Dependencies.cmake
@@ -199,6 +199,11 @@
 # Find zlib
 find_package(ZLIB)
 macro_log_feature(ZLIB_FOUND "zlib" "Simple data compression library" "http://www.zlib.net" FALSE "" "")
+# replace optimized/debug keyword with generator expression
+unset(ZLIB_LIBRARY)
+set(ZLIB_LIBRARY $<$<CONFIG:Release>:${ZLIB_LIBRARY_RELEASE}> $<$<CONFIG:Debug>:${ZLIB_LIBRARY_DEBUG}>)
+unset(ZLIB_LIBRARIES)
+set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
 
 if (ZLIB_FOUND)
   # Find zziplib
@@ -213,6 +218,11 @@
 # Find FreeType
 find_package(Freetype)
 macro_log_feature(FREETYPE_FOUND "freetype" "Portable font engine" "http://www.freetype.org" FALSE "" "")
+# replace optimized/debug keyword with generator expression
+unset(FREETYPE_LIBRARY)
+set(FREETYPE_LIBRARY $<$<CONFIG:Release>:${FREETYPE_LIBRARY_RELEASE}> $<$<CONFIG:Debug>:${FREETYPE_LIBRARY_DEBUG}>)
+unset(FREETYPE_LIBRARIES)
+set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY})
 
 # Find X11
 if (UNIX AND NOT APPLE AND NOT ANDROID AND NOT EMSCRIPTEN)
--- src.orig/CMake/Utils/FindPkgMacros.cmake
+++ src.new/CMake/Utils/FindPkgMacros.cmake
@@ -82,7 +82,7 @@
   if (${PREFIX}_FWK)
     set(${PREFIX} ${${PREFIX}_FWK})
   elseif (${PREFIX}_REL AND ${PREFIX}_DBG)
-    set(${PREFIX} optimized ${${PREFIX}_REL} debug ${${PREFIX}_DBG})
+    set(${PREFIX} $<$<CONFIG:Release>:${${PREFIX}_REL}> $<$<CONFIG:Debug>:${${PREFIX}_DBG}>)
   elseif (${PREFIX}_REL)
     set(${PREFIX} ${${PREFIX}_REL})
   elseif (${PREFIX}_DBG)
