Ticket #63726: patch-package_name.cmake.diff

File patch-package_name.cmake.diff, 1.1 KB (added by chrstphrchvz (Christopher Chavez), 3 years ago)

Patch with possible fix

  • cmake/package_name.cmake

    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) 
    8888
    8989      STRING(REGEX MATCH
    9090        "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)
    9292        MESSAGE(FATAL_ERROR "Could not run sw_vers")
    9393      ENDIF()
    9494