MantisBT - CMake
View Issue Details
0009686CMakeCMakepublic2009-10-09 03:422009-10-22 06:57
Timi Tuohenmaa 
Bill Hoffman 
normalminoralways
closedfixed 
CMake-2-8 
 
0009686: Warning from FindJNI in Windows
I get this warning message when using FindJNI using CMake 2.8 rc2:

---------------cut-----------------------
CMake Warning (dev) at C:/cmake-2.8.0-rc2/share/cmake-2.8/Modules/FindJNI.cmake:50 (FOREACH):
  Syntax error in cmake code at

    C:/cmake-2.8.0-rc2/share/cmake-2.8/Modules/FindJNI.cmake:50

  when parsing string

    C:\Program Files\Java\jdk1.6.0_12/jre/lib/{libarch};C:\Program Files\Java\jdk1.6.0_12/jre/lib;C:\Program Files\Java\jdk1.6.0_12/lib;C:\Program Files\Java\jdk1.6.0_12;/usr/lib;/usr/local/lib;/usr/lib/jvm/java/lib;/usr/lib/java/jre/lib/{libarch};/usr/local/lib/java/jre/lib/{libarch};/usr/local/share/java/jre/lib/{libarch};/usr/lib/j2sdk1.4-sun/jre/lib/{libarch};/usr/lib/j2sdk1.5-sun/jre/lib/{libarch};/opt/sun-jdk-1.5.0.04/jre/lib/{libarch};/usr/lib/jvm/java-6-sun/jre/lib/{libarch};/usr/lib/jvm/java-1.5.0-sun/jre/lib/{libarch};/usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/{libarch};/usr/lib/jvm/java-6-openjdk/jre/lib/{libarch};/usr/lib/jvm/default-java/jre/lib/{libarch};/usr/lib/jvm/default-java/jre/lib;/usr/lib/jvm/default-java/lib

  Invalid escape sequence \P

  Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
  "cmake --help-policy CMP0010" for policy details. Use the cmake_policy
  command to set the policy and suppress this warning.
Call Stack (most recent call first):
  C:/cmake-2.8.0-rc2/share/cmake-2.8/Modules/FindJNI.cmake:70 (JAVA_APPEND_LIBRARY_DIRECTORIES)
  CMakeLists.txt:21 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.


Ogre home: c:/libs/Ogre3d/ogrenew

-- Configuring done

-- Generating done

-- Build files have been written to: D:/timi/XXXXXXXXXXXXXXXXX
-------------------------cut-----------------------------

Still compiling does not fail.
No tags attached.
? FindJNI.cmake (8,752) 2009-10-22 02:53
https://public.kitware.com/Bug/file/2586/FindJNI.cmake
Issue History
2009-10-09 03:42Timi TuohenmaaNew Issue
2009-10-13 03:26Timi TuohenmaaNote Added: 0018064
2009-10-21 21:36Bill HoffmanNote Added: 0018155
2009-10-21 21:37Bill HoffmanStatusnew => assigned
2009-10-21 21:37Bill HoffmanAssigned To => Bill Hoffman
2009-10-22 02:53Timi TuohenmaaFile Added: FindJNI.cmake
2009-10-22 02:56Timi TuohenmaaNote Added: 0018163
2009-10-22 06:57Bill HoffmanNote Added: 0018167
2009-10-22 06:57Bill HoffmanStatusassigned => closed
2009-10-22 06:57Bill HoffmanResolutionopen => fixed

Notes
(0018064)
Timi Tuohenmaa   
2009-10-13 03:26   
This can be fixed easily by modifying $ENV{JAVA_HOME} using FILE(TO_CMAKE_PATH ..) and then using modified JAVA_HOME with line 70 JAVA_APPEND_LIBRARY_DIRECTORIES, but I am not sure if this is the correct way of doing it. I think that macro arguments lose double backslashes and cause invalid parsing of string.

I also think this should be changed to major problem as it is not probably able to handle directories correctly (unfortunately I can't change priority even if I made the original report).
(0018155)
Bill Hoffman   
2009-10-21 21:36   
Do you have a patch for this?
(0018163)
Timi Tuohenmaa   
2009-10-22 02:56   
I uploaded modified FindJNI.cmake. I don't have patch making tools here now, but I think that this is simple enough to be sent as replacement.
(0018167)
Bill Hoffman   
2009-10-22 06:57   
$ cvs commit -m "Fix for bug#9686 convert java_home to a cmake path before using." FindJNI.cmake
Committer: Bill Hoffman <bill.hoffman@kitware.com>
/cvsroot/CMake/CMake/Modules/FindJNI.cmake,v <-- FindJNI.cmake
new revision: 1.45; previous revision: 1.44