Skip to content

Commit 371df0e

Browse files
committedFeb 13, 2023
cmake: use pkg-config to discover docopt
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
1 parent c64c42a commit 371df0e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ prepare_git_version(SYSREPO_IETF_ALARMS_VERSION "0.0")
2121
find_package(Doxygen)
2222
option(WITH_DOCS "Create and install internal documentation (needs Doxygen)" ${DOXYGEN_FOUND})
2323

24-
find_package(docopt REQUIRED)
2524
find_package(spdlog REQUIRED)
2625
find_package(PkgConfig REQUIRED)
2726
find_package(date REQUIRED)
2827

28+
pkg_check_modules(DOCOPT REQUIRED IMPORTED_TARGET docopt)
2929
pkg_check_modules(SYSREPO REQUIRED IMPORTED_TARGET sysrepo-cpp>=1.1.0 sysrepo)
3030
pkg_check_modules(LIBYANG REQUIRED IMPORTED_TARGET libyang-cpp>=1.1.0)
3131
pkg_check_modules(SYSTEMD REQUIRED IMPORTED_TARGET libsystemd)
@@ -79,7 +79,7 @@ target_link_libraries(alarms PUBLIC alarms-utils)
7979

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

8484
# Testing
8585
include(CTest)

0 commit comments

Comments
 (0)
Please sign in to comment.