diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index d1306b804b3073f35c7b30a2bf8d15fbdc816793..42bd6c82d75d83e538f12c39f51749cd6672d7f6 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -33,6 +33,7 @@
 # brief OAI automated build tool that can be used to install, compile, run OAI.
 # author  Navid Nikaein, Lionel GAUTHIER, Laurent Thomas
 
+set -e
 
 ################################
 # include helper functions