mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-23 22:58:37 -05:00
9ce00caee3
Test was failing in case dist macro contained a + symbol which is valid but must be escaped for using the string as a regex. Fixes #17328
17 lines
657 B
CMake
17 lines
657 B
CMake
execute_process(COMMAND ${RPMBUILD_EXECUTABLE} -E %{?dist}
|
|
OUTPUT_VARIABLE DIST_TAG
|
|
ERROR_QUIET
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
set(whitespaces_ "[\t\n\r ]*")
|
|
|
|
# since we have no control over dist tag value we should try to escape
|
|
# the content for use as a regular expression
|
|
string(REPLACE "+" "\\+" DIST_TAG "${DIST_TAG}")
|
|
string(REPLACE "." "\\." DIST_TAG "${DIST_TAG}")
|
|
|
|
getPackageInfo("${FOUND_FILE_1}" "FILE_INFO_")
|
|
if(NOT FILE_INFO_ MATCHES ".*Release${whitespaces_}:${whitespaces_}1${DIST_TAG}")
|
|
message(FATAL_ERROR "Unexpected Release in '${FOUND_FILE_1}'; file info: '${FILE_INFO_}'")
|
|
endif()
|