The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14143 
====================================================================== 
Reported By:                vitaut
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14143
Category:                   Modules
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-05-15 16:18 EDT
Last Modified:              2013-05-15 16:18 EDT
====================================================================== 
Summary:                    FindJNI cannot find JDK installed
Description: 
FindJNI cannot find JDK installed in C:\Program Files\Java\jdk1.7.0_21 on
Windows XP Professional x64 Edition with SP2.

It seems that the problem is find_library not resolving registry references in
PATHS which is illustrated by the following CMakeLists.txt:

cmake_minimum_required(VERSION 2.8)
project(TEST)

get_filename_component(java_install_version
  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development
Kit;CurrentVersion]" NAME)
message("java_install_version: ${java_install_version}")

find_library(JAVA_AWT_LIBRARY jawt
  PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development
Kit\\${java_install_version};JavaHome]/lib")
message("JAVA_AWT_LIBRARY: ${JAVA_AWT_LIBRARY}")

get_filename_component(java_library_path
  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development
Kit\\${java_install_version};JavaHome]/lib" ABSOLUTE)
message("java_library_path: ${java_library_path}")
find_library(JAVA_AWT_LIBRARY2 jawt
  PATHS "${java_library_path}")
message("JAVA_AWT_LIBRARY2: ${JAVA_AWT_LIBRARY2}")

CMake gives the following output on it:

java_install_version: 1.7
JAVA_AWT_LIBRARY: JAVA_AWT_LIBRARY-NOTFOUND
java_library_path: C:/Program Files/Java/jdk1.7.0_21/lib
JAVA_AWT_LIBRARY2: C:/Program Files/Java/jdk1.7.0_21/lib/jawt.lib
-- Configuring done
-- Generating done
-- Build files have been written to: C:/temp/test

Note that JAVA_AWT_LIBRARY is not found, while the JAVA_AWT_LIBRARY2 where PATHS
don't contain registry references is found. The find_library code for
JAVA_AWT_LIBRARY is similar to what FindJNI.cmake uses.

Steps to Reproduce: 
1. Install JDK.
2. Run CMake using the following CMakeLists.txt:

cmake_minimum_required(VERSION 2.8)
project(TEST)
find_package(JNI)

3. Observe that CMake reports
-- Could NOT find JNI (missing:  JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY
JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-05-15 16:18 vitaut         New Issue                                    
======================================================================

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to