[vcpkg-from-github] Improve argument handling

This commit is contained in:
Robert Schumacher 2017-11-25 12:47:49 -08:00
parent dbe732fd8a
commit 89983fe102

View File

@ -54,19 +54,19 @@ function(vcpkg_from_github)
set(multipleValuesArgs)
cmake_parse_arguments(_vdud "" "${oneValueArgs}" "${multipleValuesArgs}" ${ARGN})
if(NOT _vdud_OUT_SOURCE_PATH)
if(NOT DEFINED _vdud_OUT_SOURCE_PATH)
message(FATAL_ERROR "OUT_SOURCE_PATH must be specified.")
endif()
if((_vdud_REF AND NOT _vdud_SHA512) OR (NOT _vdud_REF AND _vdud_SHA512))
if((DEFINED _vdud_REF AND NOT DEFINED _vdud_SHA512) OR (NOT DEFINED _vdud_REF AND DEFINED _vdud_SHA512))
message(FATAL_ERROR "SHA512 must be specified if REF is specified.")
endif()
if(NOT _vdud_REPO)
if(NOT DEFINED _vdud_REPO)
message(FATAL_ERROR "The GitHub repository must be specified.")
endif()
if(NOT _vdud_REF AND NOT _vdud_HEAD_REF)
if(NOT DEFINED _vdud_REF AND NOT DEFINED _vdud_HEAD_REF)
message(FATAL_ERROR "At least one of REF and HEAD_REF must be specified.")
endif()
@ -90,7 +90,7 @@ function(vcpkg_from_github)
endif()
endmacro()
if(VCPKG_USE_HEAD_VERSION AND NOT _vdud_HEAD_REF)
if(VCPKG_USE_HEAD_VERSION AND NOT DEFINED _vdud_HEAD_REF)
message(STATUS "Package does not specify HEAD_REF. Falling back to non-HEAD version.")
set(VCPKG_USE_HEAD_VERSION OFF)
endif()