diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 6514c4f3c0446b272197e5e45ce588c4cf30aed4..1d27c3923f53441d0ba4a5dfcd0395535a800b1b 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -235,6 +235,7 @@ set(COMPILE_OPTIONS
     -Wundef
     -Wuninitialized
     -Wunreachable-code
+    -O2
     ${BUILD_OPTIONS}
 )