Make windows resource generation more robust

This is another attempt at https://reviews.llvm.org/D110489.

When build IREE we run into cases where we don't have / need
LLVM_VERSION_* etc set. Compilation fails if it isn't an integer.

Reviewed By: stellaraccident

Differential Revision: https://reviews.llvm.org/D135650
This commit is contained in:
Anush Elangovan 2022-10-11 06:30:15 -07:00 committed by Stella Laurenzo
parent 81832afc04
commit 4d25ba0165

View File

@ -387,19 +387,35 @@ function(set_windows_version_resource_properties name resource_file)
${ARGN})
if (NOT DEFINED ARG_VERSION_MAJOR)
set(ARG_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
if (${LLVM_VERSION_MAJOR})
set(ARG_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
else()
set(ARG_VERSION_MAJOR 0)
endif()
endif()
if (NOT DEFINED ARG_VERSION_MINOR)
set(ARG_VERSION_MINOR ${LLVM_VERSION_MINOR})
if (${LLVM_VERSION_MINOR})
set(ARG_VERSION_MINOR ${LLVM_VERSION_MINOR})
else()
set(ARG_VERSION_MINOR 0)
endif()
endif()
if (NOT DEFINED ARG_VERSION_PATCHLEVEL)
set(ARG_VERSION_PATCHLEVEL ${LLVM_VERSION_PATCH})
if (${LLVM_VERSION_PATCH})
set(ARG_VERSION_PATCHLEVEL ${LLVM_VERSION_PATCH})
else()
set(ARG_VERSION_PATCHLEVEL 0)
endif()
endif()
if (NOT DEFINED ARG_VERSION_STRING)
set(ARG_VERSION_STRING ${PACKAGE_VERSION})
if (${PACKAGE_VERSION})
set(ARG_VERSION_STRING ${PACKAGE_VERSION})
else()
set(ARG_VERSION_STRING 0)
endif()
endif()
if (NOT DEFINED ARG_PRODUCT_NAME)