diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0e57ef70e9594f08af749bb575bf66e2cc72d32e..384eb58798739aa1409a429cf7fd2b6f9c3b4f15 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,6 +58,9 @@ OPTION(OGS_NO_EXTERNAL_LIBS "Builds OGS without any external dependencies." OFF)
 # Logging
 OPTION(OGS_DISABLE_LOGGING "Disables all logog messages." OFF)
 
+# Compiler flags
+SET(OGS_CXX_FLAGS "" CACHE STRING "Additional C++ compiler flags.")
+
 # Search paths
 SET(OGS_LIBS_DIR "" CACHE PATH "The path to the compiled third party libs (mainly used for Windows).")
 
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 2d42842d1dfe2824f0cfa994cd5e1347a5649a4c..be2627dea1dfa4bc84baf0cd6f7b19a23cbff050 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -22,7 +22,7 @@ TARGET_LINK_LIBRARIES(testrunner
 	BaseLib
 	GeoLib
 	${Boost_LIBRARIES}
-    ${CMAKE_THREAD_LIBS_INIT}
+	${CMAKE_THREAD_LIBS_INIT}
 )
 
 # Add make-target test which runs the testrunner
diff --git a/scripts/cmake/CompilerSetup.cmake b/scripts/cmake/CompilerSetup.cmake
index aa433404e0c9e2d68447048adab1a2cfed3b17b8..34af36a230b72722891aff9bcc93d32026726e26 100644
--- a/scripts/cmake/CompilerSetup.cmake
+++ b/scripts/cmake/CompilerSetup.cmake
@@ -15,6 +15,9 @@ ELSEIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
     SET(COMPILER_IS_MSVC TRUE)
 ENDIF () # CMAKE_CXX_COMPILER_ID
 
+# Set additional user-given compiler flags
+SET(CMAKE_CXX_FLAGS ${OGS_CXX_FLAGS})
+
 ### GNU C/CXX compiler
 IF(COMPILER_IS_GCC)
 		get_gcc_version(GCC_VERSION)