Browse Source

cmake: Improve OBS_VERSION undefined failure

If someone tries to build without git they need to set
OBS_VERSION_OVERRIDE, this makes the error message occur before things
like string parsing on the OBS_VERSION which look like missing
parameters.
Kurt Kartaltepe 4 years ago
parent
commit
058f009746
1 changed files with 3 additions and 0 deletions
  1. 3 0
      cmake/Modules/ObsCpack.cmake

+ 3 - 0
cmake/Modules/ObsCpack.cmake

@@ -28,6 +28,9 @@ else()
 	set(OBS_VERSION "${OBS_VERSION_OVERRIDE}")
 endif()
 
+if("${OBS_VERSION}" STREQUAL "")
+	message(FATAL_ERROR "Failed to configure OBS_VERSION. Either set OBS_VERSION_OVERRIDE or ensure `git describe` succeeds.")
+endif()
 MESSAGE(STATUS "OBS_VERSION: ${OBS_VERSION}")
 
 if(INSTALLER_RUN)