The function would basically do this. We should replace all the other cases were we check the flags directly.
function(hal_check_env VAR_NAME)
if(NOT DEFINED ENV{${VAR_NAME}})
message(FATAL_ERROR "Build environment variable ${VAR_NAME} is required for this project.")
endif()
endfunction()
check_env(LIBHAL_PLATFORM_LIBRARY)
check_env(LIBHAL_PLATFORM)
The function would basically do this. We should replace all the other cases were we check the flags directly.