arximboldi/immer

Boehm GC optional dependency warnings at configure time

kevin-- opened this issue · 4 comments

when running CMake to generate a project, we get the following cmake warning in the console (with no Boehm GC installed)

-- Found GC library: BOEHM_GC_LIBRARIES-NOTFOUND
CMake Warning (dev) at /usr/local/Cellar/cmake/3.22.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (Boehm_GC)
  does not match the name of the calling package (BoehmGC).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  app/lib/immer/cmake/FindBoehmGC.cmake:105 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  app/lib/immer/CMakeLists.txt:73 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

Yes, the package is optional. If you know how to remove the warning, happy to accept the change.

Yes, the package is optional. If you know how to remove the warning, happy to accept the change.

i can try to look into it eventually. Just curious because the other libs do not cause such warnings

The following should silence the warning.

# Suppress warnings, see the grey Note on https://cmake.org/cmake/help/latest/module/FindPackageHandleStandardArgs.html
set(FPHSA_NAME_MISMATCHED on)
find_package(Boehm_GC)
unset(FPHSA_NAME_MISMATCHED)

Of course actually addressing the warning would be nicer. It seems to suggest to call find_package(BoehmGC), notice no underscore.

Oh, interesting, thanks Tradias!