Skip to content

Commit 4cf3a01

Browse files
committed
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 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
1 parent 88db08a commit 4cf3a01

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
@@ -54,14 +54,14 @@ find_package(Threads)
5454
find_package(Doxygen)
5555
option(WITH_DOCS "Create and install internal documentation (needs Doxygen)" ${DOXYGEN_FOUND})
5656

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

6463
find_package(PkgConfig)
64+
pkg_check_modules(DOCOPT REQUIRED IMPORTED_TARGET docopt)
6565

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

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

0 commit comments

Comments
 (0)