if(NOT DIRECTORY) message(FATAL_ERROR "DIRECTORY variable is undefined") endif() file(MAKE_DIRECTORY "${DIRECTORY}") macro(download URL FILENAME) file(DOWNLOAD "${URL}" "${DIRECTORY}/${FILENAME}" STATUS _status) list(GET _status 0 _result) if(NOT _result EQUAL 0) list(GET _status 1 _log) message(FATAL_ERROR "Download of ${URL} failed: ${_log}") endif() endmacro() macro(add_suffix) cmake_parse_arguments(ARG "" "FILE;SUFFIX" "SYMBOLS" ${ARGN}) if (NOT ARG_SUFFIX) set(ARG_SUFFIX "Iso") endif() file(READ "${DIRECTORY}/${ARG_FILE}" _content) foreach(_symbol IN LISTS ARG_SYMBOLS) string(REPLACE "${_symbol}" "${_symbol}${ARG_SUFFIX}" _content "${_content}") endforeach() file(WRITE "${DIRECTORY}/${ARG_FILE}" "${_content}") endmacro() download("https://standards.iso.org/iso/14816/ISO14816%20ASN.1%20repository/ISO14816_AVIAEINumberingAndDataStructures.asn" "ISO14816.asn") add_suffix(FILE "ISO14816.asn" SYMBOLS IssuerIdentifier) download("https://forge.etsi.org/rep/ITS/asn1/is_ts103301/-/raw/v2.1.1/iso-patched/ISO24534-3_ElectronicRegistrationIdentificationVehicleDataModule-patched.asn" "ISO24534-3.asn") download("https://standards.iso.org/iso/ts/19091/ed-2/en/ISO-TS-19091-addgrp-C-2018.asn" "ISO19091.asn") add_suffix(FILE "ISO19091.asn" SYMBOLS HeadingConfidence Heading SpeedConfidence) download("https://standards.iso.org/iso/ts/19321/ed-2/en/ISO19321IVIv2.asn" "ISO19321.asn") download("https://forge.etsi.org/rep/ITS/asn1/is_ts103301/-/raw/v2.1.1/iso-patched/ISO14906(2018)EfcDsrcGenericv7-patched.asn" "ISO14906-1-7.asn") add_suffix(FILE "ISO14906-1-7.asn" SYMBOLS IssuerIdentifier) download("https://forge.etsi.org/rep/ITS/asn1/is_ts103301/-/raw/v2.1.1/iso-patched/ISO14906(2018)EfcDsrcApplicationv6-patched.asn" "ISO14906-0-6.asn") add_suffix(FILE "ISO14906-0-6.asn" SYMBOLS StationType IssuerIdentifier) download("https://forge.etsi.org/rep/ITS/asn1/is_ts103301/-/raw/v2.1.1/iso-patched/ISO14823-missing.asn" "ISO14823.asn") download("https://forge.etsi.org/rep/LIBS/LibIts/-/raw/798bfce82f199cdfdef4289098bf900832e3932c/asn1/IS/IVI_ISO_TS_17419.asn" "ISO17419.asn")