MantisBT - CMake
View Issue Details
0013281CMakeCMakepublic2012-06-08 07:392013-01-09 10:55
renzodenardi 
Rolf Eike Beer 
normalminoralways
closedfixed 
Ubuntu 10.0.4GNU/Linux2.6.32-21-generi
CMake-2-8 
CMake 2.8.9CMake 2.8.9 
0013281: the module UseJava reports a warning when find_jar is used with a list of NAMES
when the command find_jar is used with multiple jar names e.g.

find_jar(PROTO_JAVA NAMES protobuf protobuf-java)

cmake reports a warning:

CMake Warning at cmake/Modules/UseJava.cmake:523 (if):
  given arguments:

    "protobuf" "protobuf-java" "STREQUAL" ""

  Unknown arguments specified
Call Stack (most recent call first):
  CMakeLists.txt:75 (find_jar)
use the following as a CMakeLists.txt


PROJECT(TEST)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
set(PACKAGE_NAME "test")
FIND_PACKAGE(Java)
INCLUDE(UseJava)
find_jar(PROTO_JAVA NAMES a_name another_name)
as far as I understand this is due to the fact that the variable _jar_names in the function find_jar is actually a list, therefore the correct way of checking if it is empty is to test its length.

A patch is attached.
No tags attached.
patch UseJava.cmake.patch (565) 2012-06-08 07:39
https://public.kitware.com/Bug/file/4349/UseJava.cmake.patch
Issue History
2012-06-08 07:39renzodenardiNew Issue
2012-06-08 07:39renzodenardiFile Added: UseJava.cmake.patch
2012-06-08 08:06David ColeNote Added: 0029646
2012-06-08 11:36Rolf Eike BeerNote Added: 0029648
2012-06-08 11:36Rolf Eike BeerAssigned To => Rolf Eike Beer
2012-06-08 11:36Rolf Eike BeerStatusnew => resolved
2012-06-08 11:36Rolf Eike BeerResolutionopen => fixed
2012-06-08 11:36Rolf Eike BeerFixed in Version => CMake 2.8.9
2012-08-09 19:37David ColeTarget Version => CMake 2.8.9
2013-01-09 10:55Robert MaynardNote Added: 0032030
2013-01-09 10:55Robert MaynardStatusresolved => closed

Notes
(0029646)
David Cole   
2012-06-08 08:06   
A simpler change would be to quote the argument to the "if" call like this:

  if ("${_jar_names}" STREQUAL "")
(0029648)
Rolf Eike Beer   
2012-06-08 11:36   
Fix pushed to next:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5593d5718ec90f6a2e37ca4e2fdf3fc4537380ff [^]
(0032030)
Robert Maynard   
2013-01-09 10:55   
Closing resolved issues that have not been updated in more than 4 months.