From 5906db11daf53cd11df9c32835aae9a05b498e89 Mon Sep 17 00:00:00 2001 From: tastytea Date: Fri, 1 May 2020 20:30:07 +0200 Subject: [PATCH] Change jsoncpp discovery from CMake to pkg-config. CMake is deprecated by upstream. --- CMakeLists.txt | 3 ++- src/CMakeLists.txt | 2 +- tests/CMakeLists.txt | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ada646e..a2a1b56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,8 @@ else() add_link_options("$<$:${DEBUG_LDFLAGS}>") endif() -find_package(jsoncpp CONFIG REQUIRED) +find_package(PkgConfig REQUIRED) +pkg_check_modules(jsoncpp REQUIRED IMPORTED_TARGET jsoncpp) # Some distributions do not contain Poco*Config.cmake recipes. find_package(Poco COMPONENTS Foundation Net NetSSL CONFIG) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a4792c1..2efd0ae 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -11,7 +11,7 @@ target_include_directories(${PROJECT_NAME} PRIVATE "$") target_link_libraries(${PROJECT_NAME} - PRIVATE jsoncpp_lib) + PRIVATE PkgConfig::jsoncpp) # If no Poco*Config.cmake recipes are found, look for headers in standard dirs. if(PocoNetSSL_FOUND) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6094c72..f934cd4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -9,7 +9,7 @@ target_include_directories(${PROJECT_NAME}_testlib "$") target_link_libraries(${PROJECT_NAME}_testlib - PRIVATE Poco::Foundation Poco::Net Poco::NetSSL jsoncpp_lib) + PRIVATE Poco::Foundation Poco::Net Poco::NetSSL PkgConfig::jsoncpp) file(GLOB sources_tests test_*.cpp)