diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index 379c9b5cfb678bcfe28f756541aa6302963eda17..f7981650e46ba0a97ff47f71e6bb6ee19c5ec46b 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -537,6 +537,11 @@ function main() {
     echo_info "Erased all previously producted files"
   fi
 
+  # for historical reasons we build in a subdirectory cmake_targets/XYZ/build,
+  # e.g., cmake_targets/ran_build/build, hence the ../../..
+  CMAKE_CMD="$CMAKE_CMD ../../.."
+  echo_info "CMAKE_CMD=$CMAKE_CMD"
+
   dbin=$OPENAIR_DIR/targets/bin
   dlog=$OPENAIR_DIR/cmake_targets/log
   mkdir -p $dbin $dlog