From f27a5b77eb8907ab35df44521e6a2376d6d7c818 Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Wed, 30 Mar 2022 17:00:39 -0300 Subject: [PATCH] cmake work-around for cmake < 3.21 --- .../patches/0002-Fully-version-library.patch | 2 +- ...002-cmake-work-around-for-cmake-3.21.patch | 28 +++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 debian/patches/0002-cmake-work-around-for-cmake-3.21.patch diff --git a/debian/patches/0002-Fully-version-library.patch b/debian/patches/0002-Fully-version-library.patch index ddb785f..01cff03 100644 --- a/debian/patches/0002-Fully-version-library.patch +++ b/debian/patches/0002-Fully-version-library.patch @@ -7,7 +7,7 @@ Subject: Fully version library 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index ae117c7..9af859f 100644 +index baef9ef..26942e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ include(GNUInstallDirs) diff --git a/debian/patches/0002-cmake-work-around-for-cmake-3.21.patch b/debian/patches/0002-cmake-work-around-for-cmake-3.21.patch new file mode 100644 index 0000000..3101c22 --- /dev/null +++ b/debian/patches/0002-cmake-work-around-for-cmake-3.21.patch @@ -0,0 +1,28 @@ +From: Jason Rhinelander +Date: Wed, 30 Mar 2022 16:09:40 -0300 +Subject: cmake work-around for cmake < 3.21 + +PkgConfig::xyz won't exist before 3.21 if xyz doesn't require any flags +(which is common for a system-installed header-only library like oxenc). + +(CMake bug 22180) +--- + CMakeLists.txt | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 26942e1..e90ac40 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -76,7 +76,10 @@ elseif(BUILD_SHARED_LIBS) + pkg_check_modules(oxenc liboxenc IMPORTED_TARGET) + + if(oxenc_FOUND) +- target_link_libraries(oxenmq PUBLIC PkgConfig::oxenc) ++ # Work around cmake bug 22180 (PkgConfig::tgt not set if no flags needed) ++ if(TARGET PkgConfig::oxenc OR CMAKE_VERSION VERSION_GREATER_EQUAL "3.21") ++ target_link_libraries(oxenmq PUBLIC PkgConfig::oxenc) ++ endif() + else() + add_subdirectory(oxen-encoding) + target_link_libraries(oxenmq PUBLIC oxenc) diff --git a/debian/patches/series b/debian/patches/series index 76109be..e49ed82 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ 0002-Fully-version-library.patch +0002-cmake-work-around-for-cmake-3.21.patch