diff --git a/source/ArmarXGui/applications/ArmarXGui/CMakeLists.txt b/source/ArmarXGui/applications/ArmarXGui/CMakeLists.txt
index 8fbbc25929025a09424afed9cec1226887e01561..a060898531cd9d9de8c35d087a99bfa395f0ba96 100644
--- a/source/ArmarXGui/applications/ArmarXGui/CMakeLists.txt
+++ b/source/ArmarXGui/applications/ArmarXGui/CMakeLists.txt
@@ -41,7 +41,12 @@ set(HEADERS ArmarXGuiApp.h
 )
 
 if ( CMAKE_COMPILER_IS_GNUCC )
-    set(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -Wno-error=deprecated-enum-enum-conversion")
+    # old gcc 8.4.0 on ubuntu 18.04 does not support this flag
+    check_cxx_compiler_flag("-Wno-error=deprecated-enum-enum-conversion" SUPPORTS_DEPRECATED_ENUM_ENUM_CONVERSION)
+
+    if (SUPPORTS_DEPRECATED_ENUM_ENUM_CONVERSION)
+        set(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -Wno-error=deprecated-enum-enum-conversion")
+    endif()
 endif()
 
 find_package(OpenMP)