From 1af75f2c4e8058f5f64a045a81008c40a3faba65 Mon Sep 17 00:00:00 2001
From: Christopher Chavez <chrischavez@gmx.us>
Date: Thu, 4 Nov 2021 16:07:20 -0500
Subject: [PATCH] Fix configure on macOS x.y.z when y is 0
The "Could not run sw_vers" error is output when building on macOS x.y.z
when y is 0 (example: macOS 12.0.1) because CMAKE_MATCH_2 is set to "0",
which when used as a condition evaluates to false.
Check `CMAKE_MATCH_COUNT EQUAL 2` instead to know whether CMAKE_MATCH_1
and CMAKE_MATCH_2 are properly set.
---
cmake/package_name.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmake/package_name.cmake b/cmake/package_name.cmake
index 058b0bcbd8cb..be1af896d515 100644
a
|
b
|
MACRO(GET_PACKAGE_FILE_NAME Var) |
88 | 88 | |
89 | 89 | STRING(REGEX MATCH |
90 | 90 | "ProductVersion:[\n\t ]*([0-9]+)\\.([0-9]+)" UNUSED ${SW_VERS_PRODUCTVERSION}) |
91 | | IF(NOT CMAKE_MATCH_1 OR NOT CMAKE_MATCH_2) |
| 91 | IF(NOT CMAKE_MATCH_COUNT EQUAL 2) |
92 | 92 | MESSAGE(FATAL_ERROR "Could not run sw_vers") |
93 | 93 | ENDIF() |
94 | 94 | |