diff --git a/CMakeLists.txt b/CMakeLists.txt
index 623579e2804343274b4bcfe70f58c5c49d84063a..439416a51bf27bff5d7a95ea0cb611f8c416ee4a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,12 +32,14 @@ FIND_PACKAGE(Boost COMPONENTS unit_test_framework REQUIRED)
 add_compile_options(-Wall)
 add_compile_options(-Wextra)
 add_compile_options(-Wpedantic)
-#turn warnings about dangerous stuff into errors
-add_compile_options(-Werror)
-add_compile_options(-Wno-error=unused-but-set-variable)
-add_compile_options(-Wno-error=unused-variable)
-add_compile_options(-Wno-error=unused-parameter)
-
+message(STATUS "Compiler version: ${CMAKE_CXX_COMPILER_VERSION}")
+if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
+    #turn warnings about dangerous stuff into errors
+    add_compile_options(-Werror)
+    add_compile_options(-Wno-error=unused-but-set-variable)
+    add_compile_options(-Wno-error=unused-variable)
+    add_compile_options(-Wno-error=unused-parameter)
+endif()
 
 #######################################################################################
 #options