diff --git a/modules/gfx/tests/CMakeLists.txt b/modules/gfx/tests/CMakeLists.txt
index 8d6fa15afec93cbb0cb90b600b42c2f743857dae..a055e099ec3cae573fbd508a1b7c453b4a25b056 100644
--- a/modules/gfx/tests/CMakeLists.txt
+++ b/modules/gfx/tests/CMakeLists.txt
@@ -4,9 +4,10 @@ set(OST_GFX_UNIT_TESTS
 )
 if (ENABLE_IMG)
   list(APPEND OST_GFX_UNIT_TESTS test_map_octree.cc)
-endif()
 
-ost_unittest(gfx "${OST_GFX_UNIT_TESTS}")
+	ost_unittest(gfx "${OST_GFX_UNIT_TESTS}")
+
+	target_link_libraries(gfx_tests ost_io)
+endif()
 
-target_link_libraries(gfx_tests ost_io)