diff options
author | Brad King <brad.king@kitware.com> | 2023-08-11 14:15:44 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-08-11 14:15:44 (GMT) |
commit | 597139b853f2f14c71047e41a3244a397c6ee728 (patch) | |
tree | 393ba47acd75a38b7767002b3692f3539743782c | |
parent | f3d9a8211042c3df043d886f2217a705a62168a8 (diff) | |
download | CMake-597139b853f2f14c71047e41a3244a397c6ee728.zip CMake-597139b853f2f14c71047e41a3244a397c6ee728.tar.gz CMake-597139b853f2f14c71047e41a3244a397c6ee728.tar.bz2 |
FindJNI: Restore support for macOS without Xcode
Fix logic added by commit efa0e2ddaf (FindJNI: Update for Xcode greater than
12.1 on macOS, 2023-08-06, v3.27.2~5^2) to tolerate missing `xcodebuild`.
Fixes: #25181
-rw-r--r-- | Modules/FindJNI.cmake | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index c6d7b09..e7050a3 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -388,11 +388,15 @@ if(APPLE) else() # get xcode version execute_process( - COMMAND xcodebuild -version - OUTPUT_VARIABLE _xcode_version - ) - string(REGEX REPLACE "Xcode ([0-9]+(\\.[0-9]+)*)" "\\1" _FindJNI_XCODE_VERSION ${_xcode_version}) - unset(_xcode_version) + COMMAND xcodebuild -version + OUTPUT_VARIABLE _FindJNI_XCODEBUILD_VERSION + ) + if(_FindJNI_XCODEBUILD_VERSION MATCHES "Xcode ([0-9]+(\\.[0-9]+)*)") + set(_FindJNI_XCODE_VERSION "${CMAKE_MATCH_1}") + else() + set(_FindJNI_XCODE_VERSION "") + endif() + unset(_FindJNI_XCODEBUILD_VERSION) endif() if(_FindJNI_XCODE_VERSION VERSION_GREATER 12.1) |