diff --git a/cmake_modules/wolfgnssConfig.cmake b/cmake_modules/wolfgnssConfig.cmake
index 43a786472f1ee81eb0292f6fd1c6b780a1713534..e55f091a2ce3b7150072fae7ab9fe018a5b49c19 100644
--- a/cmake_modules/wolfgnssConfig.cmake
+++ b/cmake_modules/wolfgnssConfig.cmake
@@ -48,7 +48,7 @@ macro(wolf_report_not_found REASON_MSG)
   # FindPackage() use the camelcase library name, not uppercase.
   if (wolfgnss_FIND_QUIETLY)
     message(STATUS "Failed to find wolf gnss- " ${REASON_MSG} ${ARGN})
-  else (wolfgnss_FIND_REQUIRED)
+  elseif(wolfgnss_FIND_REQUIRED)
     message(FATAL_ERROR "Failed to find wolf gnss - " ${REASON_MSG} ${ARGN})
   else()
     # Neither QUIETLY nor REQUIRED, use SEND_ERROR which emits an error