arximboldi / immer

Postmodern immutable and persistent data structures for C++ — value semantics at scale
https://sinusoid.es/immer
Boost Software License 1.0
2.5k stars 183 forks source link

Boehm GC optional dependency warnings at configure time #204

Open kevin-- opened 2 years ago

kevin-- commented 2 years ago

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.
arximboldi commented 2 years ago

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

kevin-- commented 2 years ago

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

Tradias commented 2 years ago

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.

arximboldi commented 2 years ago

Oh, interesting, thanks Tradias!