sony / nmos-cpp

An NMOS (Networked Media Open Specifications) Registry and Node in C++ (IS-04, IS-05)
Apache License 2.0
141 stars 80 forks source link

CMake Error when using nmos-cpp conan package on Ubuntu 20.04 #298

Closed will-leathers-smith-sony closed 1 year ago

will-leathers-smith-sony commented 1 year ago

When importing nmos-cpp into a project using conan and CMake the following error occurs when configuring the project CMake cache.

CMake Error at cmake/NmosCppDependencies.cmake:267 (target_link_libraries):
  The link interface of target "DNSSD" contains:

    Avahi::compat-libdns_sd

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  CMakeLists.txt:21 (include)

I have been able to fix/work-around the issue by removing the avahi folder in .conan/data and manually installing the earliest revision of Avahi by doing: conan install avahi/0.8@#045ad530d68fcb08ffda15df2ad838ed

The issue seems to be that the find_package(Avahi) (cmake/NmosCppDependencies.cpp:262) is finding the conan installed version of avahi, and it is not using the customised "third_party/cmake/FindAvahi.cmake". It is the custom file that defines the target "Avahi::compat-libdns_sd" and since that file is not being used, the target is not defined.

This docker file Dockerfile.txt can be used to reproduce the error using the command "docker build . -t nmos-cpp-conan" (assuming Dockerfile is in current folder and .txt extension removed). Note that both zlib and openssl need to be explicitly defined in the conanfile.txt in order to fix version incompatibilities.

garethsb commented 1 year ago

Looks like https://github.com/conan-io/conan-center-index/pull/13206 changed the namespace of the targets that are generated. 😕