question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Handling package-local CMake modules

See original GitHub issue

When a ROS package uses the “Foo” project with no upstream-provided CMake module, the author may wish to write e.g. cmake/FindFoo.cmake and then find_package(Foo).

However, the “CMake coding standards” document says simply, “Do not set CMAKE_MODULE_PATH” without suggesting the correct way to do this.

Others who have asked this question haven’t found satisfactory answers, such as this question on ROS Answers (the OP ended up answering his own question by setting CMAKE_MODULE_PATH, contradictory to coding standards).

Anyway, other experienced ROS developers seem unaware of and violate this standard, such as here. (I understand cmake_modules makes this an obsolete example, and the line could simply be removed, but…)

The Indigo Migration guide suggests that CMake modules might be contributed to the ROS cmake_modules package. However, that package’s maintainers wouldn’t be interested in modules for an unpublished package, and .rosinstalling a locally-forked version with FindFoo.cmake is a lot of overhead.

So what is the correct way to find a CMake module that’s local to a package? Is this something missing from catkin, something missing from the docs, or something best accomplished some other way?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
zultroncommented, Aug 3, 2018

Since #951 is merged, I went ahead and submitted PR fkie/catkin_lint#56, reflecting the change in catkin lint.

Thanks, @dirk-thomas.

1reaction
zultroncommented, Jul 19, 2018

Argh, really dumb copy’n’paste error. I’ll fix the original description to CMAKE_MODULE_PATH!

Read more comments on GitHub >

github_iconTop Results From Across the Web

cmake-modules(7) — CMake 3.25.1 Documentation
Find Modules¶. These modules search for third-party software. They are normally called through the find_package() command.
Read more >
find_package — CMake 3.25.1 Documentation
The MODULE keyword implies that only Module mode can be used to find the package, with no fallback to Config mode. Regardless of...
Read more >
FindPackageHandleStandardArgs — CMake 3.25.1 ...
This module provides functions intended to be used in Find Modules implementing find_package(<PackageName>) calls. ... This command handles the REQUIRED , QUIET ...
Read more >
cmake-packages(7) — CMake 3.25.1 Documentation
find_package(Qt4 4.7.0 REQUIRED) # CMake provides a Qt4 find-module ... Handling of COMPONENTS and OPTIONAL_COMPONENTS is defined by the package.
Read more >
cmake-developer(7) — CMake 3.25.1 Documentation
The code here will obviously vary from module to module (dealing with that, after all, is the point of find modules), but there...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found