diff --git a/cmake_modules/wolfimuConfig.cmake b/cmake_modules/wolfimuConfig.cmake
index 97662cc09eb78aaf9b2b80e5b32cad9c59579bfc..9234912c0a54ff3e5aff5e1a44a27915cda83558 100644
--- a/cmake_modules/wolfimuConfig.cmake
+++ b/cmake_modules/wolfimuConfig.cmake
@@ -48,7 +48,7 @@ macro(wolf_report_not_found REASON_MSG)
   # FindPackage() use the camelcase library name, not uppercase.
   if (wolfimu_FIND_QUIETLY)
     message(STATUS "Failed to find wolf imu- " ${REASON_MSG} ${ARGN})
-  else (wolfimu_FIND_REQUIRED)
+  elseif(wolfimu_FIND_REQUIRED)
     message(FATAL_ERROR "Failed to find wolf imu - " ${REASON_MSG} ${ARGN})
   else()
     # Neither QUIETLY nor REQUIRED, use SEND_ERROR which emits an error