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 I cannot type `Depends-on`
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: 4e473f1 CI: use system docopt-cpp
Bug: docopt/docopt.cpp#134
Change-Id: Ief13813210199d8d58b82659e522a941033f6302
  • Loading branch information
jktjkt authored and peckato1 committed Feb 5, 2023
1 parent 4e473f1 commit 9e8752a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ find_package(Doxygen)
option(WITH_DOCS "Create and install internal documentation (needs Doxygen)" ${DOXYGEN_FOUND})

find_package(Boost REQUIRED)
find_package(docopt REQUIRED)
find_package(spdlog REQUIRED)
find_package(sdbus-c++ "1.0.0" REQUIRED)
find_package(PkgConfig)
find_package(fmt)
find_package(nlohmann_json REQUIRED)
pkg_check_modules(DOCOPT REQUIRED IMPORTED_TARGET docopt)

pkg_check_modules(SYSTEMD REQUIRED IMPORTED_TARGET libsystemd)
if(${SYSTEMD_VERSION} VERSION_EQUAL 245)
Expand Down Expand Up @@ -103,7 +103,7 @@ add_library(velia-utils STATIC
src/utils/waitUntilSignalled.cpp
src/utils/waitUntilSignalled.h
)
target_link_libraries(velia-utils PUBLIC spdlog::spdlog PRIVATE PkgConfig::SYSTEMD PkgConfig::SYSREPO fmt::fmt docopt)
target_link_libraries(velia-utils PUBLIC spdlog::spdlog PRIVATE PkgConfig::SYSTEMD PkgConfig::SYSREPO fmt::fmt PkgConfig::DOCOPT)

# - health
add_library(velia-health STATIC
Expand Down Expand Up @@ -262,7 +262,7 @@ add_executable(veliad-health
target_link_libraries(veliad-health
PUBLIC
velia-health
docopt
PkgConfig::DOCOPT
)
add_dependencies(veliad-health target-VELIA_VERSION)
target_include_directories(veliad-health PUBLIC ${CMAKE_BINARY_DIR})
Expand All @@ -273,7 +273,7 @@ add_executable(veliad-system
target_link_libraries(veliad-system
PUBLIC
velia-system
docopt
PkgConfig::DOCOPT
)
add_dependencies(veliad-system target-VELIA_VERSION)
target_include_directories(veliad-system PUBLIC ${CMAKE_BINARY_DIR})
Expand All @@ -285,7 +285,7 @@ target_link_libraries(veliad-firewall
PUBLIC
velia-firewall
velia-utils
docopt
PkgConfig::DOCOPT
)
add_dependencies(veliad-firewall target-VELIA_VERSION)
target_include_directories(veliad-firewall PUBLIC ${CMAKE_BINARY_DIR})
Expand All @@ -299,7 +299,7 @@ target_link_libraries(veliad-hardware
PUBLIC
velia-ietf-hardware
velia-ietf-hardware-sysrepo
docopt
PkgConfig::DOCOPT
)
add_dependencies(veliad-hardware target-VELIA_VERSION)
target_include_directories(veliad-hardware PUBLIC ${CMAKE_BINARY_DIR})
Expand Down

0 comments on commit 9e8752a

Please sign in to comment.