Skip to content

Commit

Permalink
cmake: use pkg-config to discover docopt
Browse files Browse the repository at this point in the history
The upstream project provides a CMake file which attempts to import both
static and shared libraries. This is a problem on any reasonable
distribution because Nobody Ships Static Libraries Anymore (for
reasonable reasons). So we have distros shipping CMake files from
upstream which are broken because distros actively remove the static
library from their packaging.

This was not caught by the CI because `Depends-on` was not typed
properly , and therefore Zuul would feed oldish prebuilt dependencies
which still included the custom-built docopt library in both static and
shared versions. We need a linter for commit footers :p.

Fixes: Ib246d39f975c00bc6489f683f1f21f34cc808201
Fixes: c64c42a CI: use system docopt-cpp
Bug: docopt/docopt.cpp#134
Change-Id: Ia50595b36cfe233fd67a5153ff804d77a0c77b94
  • Loading branch information
peckato1 committed Feb 13, 2023
1 parent c64c42a commit 371df0e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ prepare_git_version(SYSREPO_IETF_ALARMS_VERSION "0.0")
find_package(Doxygen)
option(WITH_DOCS "Create and install internal documentation (needs Doxygen)" ${DOXYGEN_FOUND})

find_package(docopt REQUIRED)
find_package(spdlog REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(date REQUIRED)

pkg_check_modules(DOCOPT REQUIRED IMPORTED_TARGET docopt)
pkg_check_modules(SYSREPO REQUIRED IMPORTED_TARGET sysrepo-cpp>=1.1.0 sysrepo)
pkg_check_modules(LIBYANG REQUIRED IMPORTED_TARGET libyang-cpp>=1.1.0)
pkg_check_modules(SYSTEMD REQUIRED IMPORTED_TARGET libsystemd)
Expand Down Expand Up @@ -79,7 +79,7 @@ target_link_libraries(alarms PUBLIC alarms-utils)

add_executable(sysrepo-ietf-alarmsd src/main.cpp)
add_dependencies(sysrepo-ietf-alarmsd target-SYSREPO_IETF_ALARMS_VERSION)
target_link_libraries(sysrepo-ietf-alarmsd PUBLIC alarms docopt PRIVATE PkgConfig::SYSTEMD)
target_link_libraries(sysrepo-ietf-alarmsd PUBLIC alarms PkgConfig::DOCOPT PRIVATE PkgConfig::SYSTEMD)

# Testing
include(CTest)
Expand Down

0 comments on commit 371df0e

Please sign in to comment.