Skip to content

Instantly share code, notes, and snippets.

@dakcarto
Last active August 29, 2015 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dakcarto/8789774 to your computer and use it in GitHub Desktop.
Save dakcarto/8789774 to your computer and use it in GitHub Desktop.
CMake FindJNI module patch
diff --git a/Modules/CMakeFindJavaCommon.cmake b/Modules/CMakeFindJavaCommon.cmake
index fcf0389..bd515bd 100644
--- a/Modules/CMakeFindJavaCommon.cmake
+++ b/Modules/CMakeFindJavaCommon.cmake
@@ -39,3 +39,13 @@ else()
endif()
unset(_ENV_JAVA_HOME)
endif()
+
+set(_JAVA_HOME_FW 0)
+if(_JAVA_HOME)
+ if("${_JAVA_HOME}" MATCHES ".*\\.framework.*")
+ set(_JAVA_HOME_FW 1)
+ endif()
+ if(APPLE AND EXISTS "${_JAVA_HOME}/bundle")
+ set(_JAVA_HOME_FW 1)
+ endif()
+endif()
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake
index 669e3e2..c23cdbc 100644
--- a/Modules/FindJNI.cmake
+++ b/Modules/FindJNI.cmake
@@ -103,7 +103,7 @@ else()
unset(_JNI_CMAKE_FIND_FRAMEWORK)
endif()
-if(_JAVA_HOME_EXPLICIT)
+if(_JAVA_HOME_EXPLICIT AND NOT _JAVA_HOME_FW)
set(CMAKE_FIND_FRAMEWORK NEVER)
endif()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment