mismatched ENDIF()
should be IF(WIN32 AND FREEIMAGE_LIBRARY AND ${PROJECT_NAME}_WITH_FREEIMAGE)