Skip to content

Commit

Permalink
FindJNI: Update for Xcode greater than 12.1 on macOS
Browse files Browse the repository at this point in the history
`JavaVM.framework` was removed from Xcode in version 12.2+.

Fixes: #23364
  • Loading branch information
oyarzun authored and bradking committed Aug 7, 2023
1 parent cbcd297 commit efa0e2d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Modules/FindJNI.cmake
Expand Up @@ -383,6 +383,23 @@ foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}")
endforeach()

if(APPLE)
if(DEFINED XCODE_VERSION)
set(_FindJNI_XCODE_VERSION "${XCODE_VERSION}")
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)
endif()

if(_FindJNI_XCODE_VERSION VERSION_GREATER 12.1)
set(CMAKE_FIND_FRAMEWORK "NEVER")
endif()
unset(_FindJNI_XCODE_VERSION)

if(CMAKE_FIND_FRAMEWORK STREQUAL "ONLY")
set(_JNI_SEARCHES FRAMEWORK)
elseif(CMAKE_FIND_FRAMEWORK STREQUAL "NEVER")
Expand Down

0 comments on commit efa0e2d

Please sign in to comment.