MantisBT - CMake
View Issue Details
0009793CMakeCMakepublic2009-10-29 12:272009-10-29 13:48
Mathieu Malaterre 
 
normalminoralways
closedfixed 
 
 
0009793: FindJNI.cmake confused in multiple installation.
FindJNI.cmake would pick a jni.h file from one java installation and a jni_md.h from another installation.

Attached patch solved situation.
Testing consisted in running:

http://gdcm.svn.sourceforge.net/svnroot/gdcm/Sandbox/CMakeBug/8/CMakeLists.txt [^]

project(testjni)
# Check that JAVA_HOME setting works with find_package(JNI)

cmake_minimum_required(VERSION 2.8)


macro(CHECK_JNI ref)
  message("working on ${ref}")
  set(ENV{JAVA_HOME} ${ref})
  find_package(JNI)
  message(${JNI_INCLUDE_DIRS})
  message(${JNI_LIBRARIES})
  
  foreach(include ${JNI_INCLUDE_DIRS})
    string(REGEX MATCH ${ref} out ${include})
    if(NOT out)
      message(FATAL_ERROR "problem with ${include} should contains ${ref}")
    endif(NOT out)
  endforeach(include)
endmacro(CHECK_JNI)

# locate jni.h
  # /usr/lib/gcc-snapshot/lib/gcc/x86_64-linux-gnu/4.5.0/include/jni.h
  # /usr/lib/gcc-snapshot/lib/jvm/java-1.5.0-gcj-4.5-snap/include/jni.h
  # /usr/lib/jvm/java-1.5.0-gcj-4.3-1.5.0.0/include/jni.h
  # /usr/lib/jvm/java-1.5.0-gcj-4.4/include/jni.h
  # /usr/lib/jvm/java-6-openjdk/include/jni.h
  # /usr/lib/jvm/java-6-sun-1.6.0.12/include/jni.h

set(java_loc
  #/usr/lib/gcc-snapshot/lib/gcc/x86_64-linux-gnu/4.5.0/
  #/usr/lib/gcc-snapshot/lib/jvm/java-1.5.0-gcj-4.5-snap/ # ok
  #/usr/lib/jvm/java-1.5.0-gcj-4.3-1.5.0.0/
  #/usr/lib/jvm/java-1.5.0-gcj-4.4/
  #/usr/lib/jvm/java-6-openjdk/
  /usr/lib/jvm/java-6-sun-1.6.0.12/
  )

foreach(ref ${java_loc})
  CHECK_JNI(${ref})
endforeach(ref)
No tags attached.
patch jni_include_path.patch (644) 2009-10-29 12:27
https://public.kitware.com/Bug/file/2612/jni_include_path.patch
Issue History
2009-10-29 12:27Mathieu MalaterreNew Issue
2009-10-29 12:27Mathieu MalaterreFile Added: jni_include_path.patch
2009-10-29 13:48Bill HoffmanNote Added: 0018278
2009-10-29 13:48Bill HoffmanStatusnew => closed
2009-10-29 13:48Bill HoffmanResolutionopen => fixed

Notes
(0018278)
Bill Hoffman   
2009-10-29 13:48   
$ cvs commit -m "Fix for bug 0009793 try to make sure jni.h matches jni_md.h " FindJNI.cmake
Committer: Bill Hoffman <bill.hoffman@kitware.com>
/cvsroot/CMake/CMake/Modules/FindJNI.cmake,v <-- FindJNI.cmake
new revision: 1.46; previous revision: 1.45