Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect use of FindThreads in cmake package config file #668

Closed
K-ballo opened this issue Apr 21, 2020 · 0 comments
Closed

Incorrect use of FindThreads in cmake package config file #668

K-ballo opened this issue Apr 21, 2020 · 0 comments

Comments

@K-ballo
Copy link

K-ballo commented Apr 21, 2020

The generated cmake package config file does a direct inclusion of the FindThread module:

include(FindThreads)

This results in the following cmake developer warning:

 CMake Warning (dev) at /usr/local/lib/python3.6/dist-packages/cmake/data/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
  The package name passed to `find_package_handle_standard_args` (Threads)
  does not match the name of the calling package (absl).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.

The proper way to consume find modules is via find_package(<NAME>), which interacts with the module by setting and reading various variables prefixed with <NAME> (hence the above warning).

Furthermore, the find_dependency macro was created to wrap find_package calls in package configuration files to correctly handle QUIET and REQUIRED arguments given to to the original call.

Summing up, rather than directly including the FindThreads module, the cmake package file should instead do:

include(CMakeFindDependencyMacro)
find_dependency(Threads)
zach2good added a commit to zach2good/abseil-cpp that referenced this issue Apr 22, 2020
(cherry picked from commit d5a8e65f135581e3bba3eb0c0f6516a09886238c)
rongjiecomputer pushed a commit to rongjiecomputer/abseil-cpp that referenced this issue Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant