message: Apparently dependent target odesn't have to be defined *before* if in the same file!
diff: @@ -35,6 +35,17 @@ option(BUILD_EXECUTABLES "jpeg" OFF)
  option(BUILD_TESTS "jpeg" OFF)
  add_subdirectory(libjpeg libjpeg EXCLUDE_FROM_ALL)
  +#manipulating libpng cmake options from within cmake script
  +option(PNG_BUILD_ZLIB "Custom zlib Location, else find_package is used" OFF)
  +set(PNG_BUILD_ZLIB ON)
  +set(ZLIB_INCLUDE_DIR ${THIRD_PARTY_SOURCE_DIR}/zlib) #for pnglib
  +set(ZLIB_LIBRARY "$<TARGET_OBJECTS:zlib>") #for pnglib
  +option(PNG_SHARED "Build shared lib" OFF)
  +option(PNG_TESTS "Build libpng tests" OFF)
  +add_subdirectory(libpng libpng EXCLUDE_FROM_ALL)
  +
  +irr_adjust_flags()
  +
  add_library(zlib OBJECT
  zlib/adler32.c
  zlib/crc32.c
  @@ -48,18 +59,6 @@ add_library(zlib OBJECT
  #zlib/zcompress.c
  zlib/zutil.c
  )
  -
  -#manipulating libpng cmake options from within cmake script
  -option(PNG_BUILD_ZLIB "Custom zlib Location, else find_package is used" OFF)
  -set(PNG_BUILD_ZLIB ON)
  -set(ZLIB_INCLUDE_DIR ${THIRD_PARTY_SOURCE_DIR}/zlib) #for pnglib
  -set(ZLIB_LIBRARY "$<TARGET_OBJECTS:zlib>") #for pnglib
  -option(PNG_SHARED "Build shared lib" OFF)
  -option(PNG_TESTS "Build libpng tests" OFF)
  -add_subdirectory(libpng libpng EXCLUDE_FROM_ALL)
  -
  -irr_adjust_flags()
  -
  add_library(lzma OBJECT
  lzma/C/Alloc.c
  lzma/C/LzFind.c
  