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: 88db08a CI: use system docopt-cpp
Bug: docopt/docopt.cpp#134
Change-Id: Ief13813210199d8d58b82659e522a941033f6302
  • Loading branch information
jktjkt committed Feb 5, 2023
1 parent 88db08a commit 4cf3a01
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 @@ -54,14 +54,14 @@ find_package(Threads)
find_package(Doxygen)
option(WITH_DOCS "Create and install internal documentation (needs Doxygen)" ${DOXYGEN_FOUND})

find_package(docopt REQUIRED)
find_package(Boost REQUIRED COMPONENTS filesystem)
# Fixes C++20 build
# https://github.com/boostorg/asio/issues/312
add_definitions(-DBOOST_ASIO_DISABLE_CONCEPTS)
find_package(replxx REQUIRED)

find_package(PkgConfig)
pkg_check_modules(DOCOPT REQUIRED IMPORTED_TARGET docopt)

set(ENABLE_SYSREPO_CLI AUTO CACHE STRING "Enable the `sysrepo-cli`")
set_property(CACHE ENABLE_SYSREPO_CLI PROPERTY STRINGS AUTO ON OFF)
Expand Down Expand Up @@ -207,7 +207,7 @@ target_link_libraries(proxydatastore PUBLIC datastoreaccess yangaccess)

# Links libraries, that aren't specific to a datastore type
function(cli_link_required cli_target)
target_link_libraries(${cli_target} proxydatastore yangschema docopt parser replxx::replxx)
target_link_libraries(${cli_target} proxydatastore yangschema PkgConfig::DOCOPT parser replxx::replxx)
add_dependencies(${cli_target} target-NETCONF_CLI_VERSION)
target_include_directories(${cli_target} PRIVATE ${PROJECT_BINARY_DIR})
endfunction()
Expand Down

0 comments on commit 4cf3a01

Please sign in to comment.