cmake: Use find_package for replxx
Change-Id: I1e60203bf749f6088781245242b0084619c50f36
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e61c6c6..53dda3b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,11 +59,7 @@
# Fixes C++20 build
# https://github.com/boostorg/asio/issues/312
add_definitions(-DBOOST_ASIO_DISABLE_CONCEPTS)
-find_library(REPLXX_LIBRARY NAMES replxx replxx-d REQUIRED)
-find_path(REPLXX_PATH replxx.hxx)
-if("${REPLXX_PATH}" STREQUAL REPLXX_PATH-NOTFOUND)
- message(FATAL_ERROR "Cannot find the \"replxx.hxx\" include file for the replxx library.")
-endif()
+find_package(replxx REQUIRED)
find_package(PkgConfig)
@@ -212,8 +208,7 @@
# Links libraries, that aren't specific to a datastore type
function(cli_link_required cli_target)
- target_include_directories(${cli_target} PRIVATE ${REPLXX_PATH})
- target_link_libraries(${cli_target} proxydatastore yangschema docopt parser ${REPLXX_LIBRARY})
+ target_link_libraries(${cli_target} proxydatastore yangschema docopt parser replxx::replxx)
add_dependencies(${cli_target} target-NETCONF_CLI_VERSION)
target_include_directories(${cli_target} PRIVATE ${PROJECT_BINARY_DIR})
endfunction()