Skip to content

find_package(Servus) does not set Servus_FOUND #112

@umlaeute

Description

@umlaeute

Here's what I do:

  1. build Servus as a static library with -DCOMMON_LIBRARY_TYPE=STATIC
    • on macOS this uses the default DNS-SD installation
    • on Linux, this uses the installed libavahi-client-dev package
    • on Windows, this uses the Bonjour 4 Windows 3.0 SDK, which gets manually installed as C:\Program Files/Bonjour SDK and which is declared when building Servus via `-DDNSSD_DIR="C:\Program Files/Bonjour SDK"}
  2. after a successful built, install Servus with cmake --install
  • on macOS this installs to /usr/local (in order to workaround installs to /usr by default #111, the install path is manually set to this directory)
  • on Linux this installs to /usr
  • on Windows this installs to C:/Program Files (x86)/Servus
  1. in another project, use find_package(Servus REQUIRED)
  2. observe that this other project fails to configure on all platforms, because Servus cannot find the the zeroconf-backend

Windows (Msys/MinGW64 with VisualStudio):

CMake Warning at C:/msys64/mingw32/share/cmake/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
  By not providing "FindDNSSD.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "DNSSD", but
  CMake did not find one.
  Could not find a package configuration file provided by "DNSSD" with any of
  the following names:
    DNSSDConfig.cmake
    dnssd-config.cmake
  Add the installation prefix of "DNSSD" to CMAKE_PREFIX_PATH or set
  "DNSSD_DIR" to a directory containing one of the above files.  If "DNSSD"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  C:/Program Files (x86)/Servus/Servus/CMake/ServusConfig.cmake:11 (find_dependency)
  CMakeLists.txt:17 (find_package)
CMake Warning at CMakeLists.txt:17 (find_package):
  Found package configuration file:
    C:/Program Files (x86)/Servus/Servus/CMake/ServusConfig.cmake
  but it set Servus_FOUND to FALSE so package "Servus" is considered to be
  NOT FOUND.  Reason given by package:
  Servus could not be found because dependency DNSSD could not be found.
CMake Debug Log at CMakeLists.txt:17 (find_package):
    C:/Program Files (x86)/Servus/Servus/CMake/ServusConfig.cmake

of course i set the DNSSD_DIR (to the same value as when building Servus itself) but this doesn't help.

macOS(11.4/BigSur)

CMake Warning at /usr/local/Cellar/cmake/3.22.2/share/cmake/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
  By not providing "FindDNSSD.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "DNSSD", but
  CMake did not find one.
  Could not find a package configuration file provided by "DNSSD" with any of
  the following names:
    DNSSDConfig.cmake
    dnssd-config.cmake
  Add the installation prefix of "DNSSD" to CMAKE_PREFIX_PATH or set
  "DNSSD_DIR" to a directory containing one of the above files.  If "DNSSD"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  /usr/local/share/Servus/CMake/ServusConfig.cmake:11 (find_dependency)
  CMakeLists.txt:17 (find_package)
CMake Warning at CMakeLists.txt:17 (find_package):
  Found package configuration file:
    /usr/local/share/Servus/CMake/ServusConfig.cmake
  but it set Servus_FOUND to FALSE so package "Servus" is considered to be
  NOT FOUND.  Reason given by package:
  Servus could not be found because dependency DNSSD could not be found.

Linux (Debian/bookworm):

CMake Warning at /usr/share/cmake-3.25/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
  By not providing "Findavahi-client.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "avahi-client", but CMake did not find one.
  Could not find a package configuration file provided by "avahi-client" with
  any of the following names:
    avahi-clientConfig.cmake
    avahi-client-config.cmake
  Add the installation prefix of "avahi-client" to CMAKE_PREFIX_PATH or set
  "avahi-client_DIR" to a directory containing one of the above files.  If
  "avahi-client" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  /usr/share/Servus/CMake/ServusConfig.cmake:11 (find_dependency)
  CMakeLists.txt:17 (find_package)
CMake Warning at CMakeLists.txt:17 (find_package):
  Found package configuration file:
    /usr/share/Servus/CMake/ServusConfig.cmake
  but it set Servus_FOUND to FALSE so package "Servus" is considered to be
  NOT FOUND.  Reason given by package:
  Servus could not be found because dependency avahi-client could not be
  found.

neither bonjour nor avahi-client ship a Cmake-snippet.
I guess this is the reason why CMake fails to mark these dependencies as FOUND and thus (wrongly) concludes that Servus_FOUND ought to be 0 as well.

Sidenote: I also tried with find_package(Servus CONFIG), but that didn't help either...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions