`find_jar` function doesn't see input name
The line
find_jar(BIOFORMATS_JAR "bioformats_package")
yields the error message:
CMake Error at /usr/local/Cellar/cmake/3.13.2/share/cmake/Modules/UseJava.cmake:968 (message):
find_jar: No name to search for given
Changing line number 906:
if (${_state} STREQUAL "name")
to
if ("${_state}" STREQUAL "name")
or to
if (_state STREQUAL "name")
solves this issue.
It seems that ${_state}
is evaluated to name
, and then the if
statement takes name
as a variable name because it's not quoted. There is a variable name
in scope, but it's defined as the empty string. If I add the lines
if(DEFINED name)
message("name defined!!!")
endif()
just before the if
statement, I get the output
name defined!!!
The only variable name
I can find in any of my CMake scripts is used as an input argument to a function. I didn't think that would be visible outside the function?
(I'm running CMake 3.13.2 on MacOS installed through Homebrew.)