View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013942CMakeCCMakepublic2013-02-21 17:502016-06-10 14:31
ReporterCarlton Henderson 
Assigned ToKitware Robot 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionmoved 
PlatformsparcOSsolarisOS Version10
Product VersionCMake 2.8.10.2 
Target VersionFixed in Version 
Summary0013942: FindJNI.cmake will not respect JAVA_HOME when setting JAVA_INCLUDE_PATH if jni.h exists in CMAKE_SYSTEM_PREFIX_PATH
DescriptionI have multiple JDKs installed on my machine. Also, I have gcc and its java support installed. So, to instruct CMake which java to use, I set the environment variable JAVA_HOME=/opt/java6 before running cmake. CMake set most of the java-related variables correctly except JAVA_INCLUDE_PATH which it set to /usr/local/include.
Steps To Reproduce- touch /usr/local/include/jni.h # or install libgcj using the SMCgcc package from sunfreeware
- install java6 in /opt/java6
- JAVA_HOME=/opt/java6
- export JAVA_HOME
- construct a CMakeLists.txt file which uses
- cmake /path/to/sources
- grep JAVA_INCLUDE_PATH: CMakeCache.txt
=>actual> JAVA_INCLUDE_PATH:PATH=/usr/local/include
=>expected> JAVA_INCLUDE_PATH:PATH=/opt/java6/include
- We didn't notice it until we went to make something that builds against jni.h
=> "/usr/local/include/jni.h", line 81: Error: #error jni.h not ported to this platform.
- The above error happens because the c++ compiler finds /usr/local/include/jni.h instead of /opt/java6/include/jni.h
Additional InformationA minimalist fix might be to just add HINTS right after "find_path(JAVA_INCLUDE_PATH jni.h" in FindJNI.cmake. That is, add HINTS right before ${JAVA_AWT_INCLUDE_DIRECTORIES} so these directories are searched before each path in CMAKE_SYSTEM_PREFIX_PATH.

However, CMake users such as myself would love to see FindJNI.cmake test the variables to make sure that all the JAVA and JNI-related variables point to the same JVM (like how CMake smartly checks to make sure the C compiler works).

Thanks,

-Carl
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0032380)
Carlton Henderson (reporter)
2013-02-25 12:25

Category should not be 'CCMake'.
(I must have made a mistake setting that field when I first submitted this Issue.)
(0042232)
Kitware Robot (administrator)
2016-06-10 14:28

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2013-02-21 17:50 Carlton Henderson New Issue
2013-02-25 12:25 Carlton Henderson Note Added: 0032380
2016-06-10 14:28 Kitware Robot Note Added: 0042232
2016-06-10 14:28 Kitware Robot Status new => resolved
2016-06-10 14:28 Kitware Robot Resolution open => moved
2016-06-10 14:28 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team