Am 05.04.2011 17:11, schrieb Oliver Buchtala:
Am 05.04.2011 16:33, schrieb David Cole:
On Tue, Apr 5, 2011 at 7:16 AM, Oliver Buchtala <oliver.bucht...@jku.at <mailto:oliver.bucht...@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 <http://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

Hi David,

ok. I thought it could even be easier ;)
If I disable the win-Registry lookup stuff and set JAVA_HOME appropriately then everything is found perfectly. And if disabling would be just changing the order of search paths this would be more control for me and still powerful (i.e., when not using JAVA_HOME).
Nevertheless, I can also live with your suggestion...

Thank you,
Oliver

Hi David,

Thinking it over again, I am getting to like it less...
Setting these variables is in fact the stuff that FindJNI does.

For now I will live with a monkey patched version that allows disabling the registry search stuff. Is this an option for the core FindJNI.cmake too - i.e., introducing a means to disable win registry search?

Bye,
Oliver

_______________________________________________
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

Reply via email to