[CMake] Overriding Win-Registry search in UseJNI.cmake

David Cole david.cole at kitware.com
Tue Apr 5 10:33:22 EDT 2011


On Tue, Apr 5, 2011 at 7:16 AM, Oliver Buchtala <oliver.buchtala at jku.at>wrote:

> Am 05.04.2011 13:12, schrieb Oliver Buchtala:
>
>  Hello,
>>
>> I am working with CMake 2.8 and using UseJNI.cmake
>> I have a JDK installed locally (registered in Win-Registry) but want to
>> configure a project to use a different JDK lying on my disk.
>>
>> Looking at UseJNI.cmake I find that the environment variable JAVA_HOME
>> could be handy,
>> but unfortunately UseJNI prefers the Windows-Registry entries above all
>> other search paths.
>>
>> Did I miss something?
>> Shall I file an issue?
>>
>> Oliver
>>
>>  Sorry, the macro file is called FindJNI.cmake.
>
>
> _______________________________________________
> 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://www.cmake.org/mailman/listinfo/cmake
>

The only find_* calls I see in FindJNI.cmake are:

  FIND_LIBRARY(JAVA_AWT_LIBRARY jawt
  FIND_LIBRARY(JAVA_JVM_LIBRARY NAMES jvm JavaVM
  FIND_PATH(JAVA_INCLUDE_PATH jni.h
  FIND_PATH(JAVA_INCLUDE_PATH2 jni_md.h
  FIND_PATH(JAVA_AWT_INCLUDE_PATH jawt.h

If you want to override the default locations to find a specific
installation of java stuff, just set those variables in your cache to point
to the right stuff before calling find_package(JNI).

For example:
  set(JAVA_AWT_LIBRARY "/full/path/to/libjawt.a" CACHE FILEPATH "jawt
library")
  find_package(JNI)

If a variable is already set before calling a find_* command, then the find
is a no-op and it trusts that you've set it correctly.


HTH,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110405/6107a8c2/attachment-0001.htm>


More information about the CMake mailing list