# Reads CMake/release-tarballs.txt by the rules .github/scripts/release-policy.py # and package-cli-tools.sh apply: fields split on blanks, a line whose first # field starts with # is a comment, and each tarball is named once and names # at least one program. function (wsjt_read_release_tarballs tarball_file programs_out) if (NOT EXISTS "${tarball_file}") message (FATAL_ERROR "Release tarball list not found: ${tarball_file}") endif () file (STRINGS "${tarball_file}" _wsjt_tarball_lines ENCODING UTF-8) set (_wsjt_tarball_names) set (_wsjt_tarball_programs) foreach (_wsjt_tarball_line IN LISTS _wsjt_tarball_lines) string (REGEX MATCHALL "[^ \t\r]+" _wsjt_tarball_fields "${_wsjt_tarball_line}") list (LENGTH _wsjt_tarball_fields _wsjt_tarball_field_count) if (_wsjt_tarball_field_count EQUAL 0) continue () endif () list (GET _wsjt_tarball_fields 0 _wsjt_tarball_name) if (_wsjt_tarball_name MATCHES "^#") continue () endif () if (_wsjt_tarball_field_count LESS 2) message (FATAL_ERROR "release tarball ${_wsjt_tarball_name} names no programs in ${tarball_file}") endif () if (_wsjt_tarball_name IN_LIST _wsjt_tarball_names) message (FATAL_ERROR "release tarball ${_wsjt_tarball_name} is named twice in ${tarball_file}") endif () list (APPEND _wsjt_tarball_names "${_wsjt_tarball_name}") list (REMOVE_AT _wsjt_tarball_fields 0) list (APPEND _wsjt_tarball_programs ${_wsjt_tarball_fields}) endforeach () if (NOT _wsjt_tarball_names) message (FATAL_ERROR "no release tarballs named in ${tarball_file}") endif () set (${programs_out} "${_wsjt_tarball_programs}" PARENT_SCOPE) endfunction ()