Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 4,101
    • Issues 4,101
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMakeCMake
  • CMakeCMake
  • Issues
  • #18836
Closed
Open
Issue created Jan 25, 2019 by Cris Luengo@crisluengoContributor

`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.)

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking