[CMake] Latest UseJava.cmake
Allen Byrne
byrn at hdfgroup.org
Mon Feb 24 09:28:09 EST 2014
On Saturday, February 22, 2014 12:00:02 PM cmake-request at cmake.org wrote:
> Date: Fri, 21 Feb 2014 16:58:12 -0500
> From: Matthew Woehlke <mw_triad at users.sourceforge.net>
> To: cmake at cmake.org
> Subject: Re: [CMake] Latest UseJava.cmake
> Message-ID: <le8i57$ftf$1 at ger.gmane.org>
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
> On 2014-02-21 13:48, Allen Byrne wrote:
> > One is the issue with, http://public.kitware.com/Bug/view.php?id=14655,
> > the
> > CMAKE_JAVA_TARGET_OUTPUT_DIR doesn't override OUTPUT_DIR.
>
> Pedantic: if OUTPUT_DIR is given, it should override
> CMAKE_JAVA_TARGET_OUTPUT_DIR. I think maybe you didn't mean to suggest
> otherwise, but the above can be read that way.
>
> If OUTPUT_DIR is *not* given, CMAKE_JAVA_TARGET_OUTPUT_DIR should be
> used. IIUC this is what is not working for you? I wonder if this is an
> unexpected behavior in cmake_parse_arguments (setting it to empty if not
> specified rather than leaving it along)? I seem to recall there being a
> discussion about that semi-recently...
>
> > I disagree with the
> > issue being minor, because if you have a lot of JARs, it can be really
> > annoying and error prone to set that everywhere. We just set the
> > CMAKE_JAVA_TARGET_OUTPUT_DIR at the top of our root CMakeLists.cmake file.
>
> As a work-around, you could write a wrapper function, but your
> disagreement is reasonable. Patches welcomed.
Yes I was setting "CMAKE_JAVA_TARGET_OUTPUT_DIR" and it was not being ignored.
As best as I could determine, the test for it being set failed and skipped the
setting of "_add_jar_OUTPUT_DIR" which then later passed the test for
"_add_jar_OUTPUT_DIR" being not defined. Couldn't figure out how to fix it.
Therefore no patch suggestion.
>
> > Could MANIFEST be added to the options in:
> > cmake_parse_arguments(_add_jar
> > ""
> > "VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT;MANIFEST"
> > "SOURCES;INCLUDE_JARS"
> > ${ARGN}
> > )
>
> Yes. (IIRC I only left it out because (a) it wasn't present previously,
> (b) I didn't need it myself and (c) I am lazy :-).) Again, patches welcomed.
>
Sorry I forgot to add the patch I used:
In the " # create the jar file" ADD_CUSTOM_COMMAND section I added this
command;
COMMAND ${Java_JAR_EXECUTABLE}
-ufm ${_JAVA_JAR_OUTPUT_PATH}
${_add_jar_MANIFEST}
but this needs to be optional, again I haven't figured out how to make it
optional.
And also how would COMPONENT in the install be made optional?
More questions then answers. I would welcome suggestions on things to try to
provide the best solution to fix these issues.
Allen
> --
> Matthew
More information about the CMake
mailing list