mirror of
https://github.com/microsoft/vcpkg.git
synced 2026-01-18 01:11:23 +01:00
106 lines
3.2 KiB
Diff
106 lines
3.2 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index f82410c..01dd9bc 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -25,7 +25,7 @@ project(Ppconsul VERSION ${VERSION})
|
|
|
|
include(./conan_paths.cmake OPTIONAL)
|
|
|
|
-if (WIN32)
|
|
+if (NOT BUILD_SHARED_LIBS)
|
|
option(BUILD_STATIC_LIB "Build Ppconsul as static library" ON)
|
|
else()
|
|
option(BUILD_STATIC_LIB "Build Ppconsul as static library" OFF)
|
|
@@ -64,7 +64,13 @@ endif()
|
|
|
|
|
|
if (NOT ${USE_BOOST_REGEX})
|
|
- find_package(Boost ${BOOST_MIN_VERSION} REQUIRED)
|
|
+ find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS
|
|
+ fusion
|
|
+ mpl
|
|
+ optional
|
|
+ preprocessor
|
|
+ variant
|
|
+ )
|
|
else ()
|
|
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS regex)
|
|
add_definitions(-DPPCONSUL_USE_BOOST_REGEX)
|
|
@@ -82,8 +88,8 @@ if (NOT ${CURL_ROOT} STREQUAL "")
|
|
endif ()
|
|
find_package(CURL REQUIRED)
|
|
|
|
-set(LIBB64_DIR "${PROJECT_SOURCE_DIR}/ext/b64")
|
|
-set(LIBB64_SOURCES "${LIBB64_DIR}/cdecode.h" "${LIBB64_DIR}/cdecode.c" "${LIBB64_DIR}/cencode.h" "${LIBB64_DIR}/cencode.c")
|
|
+find_package(unofficial-b64 CONFIG REQUIRED)
|
|
+set(LIBB64_SOURCES "")
|
|
|
|
set(CATCH_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/ext/catch")
|
|
set(HEADERS_DIR "${PROJECT_SOURCE_DIR}/include/ppconsul")
|
|
@@ -92,7 +98,7 @@ if (WIN32 AND NOT BUILD_STATIC_LIB)
|
|
message(FATAL_ERROR "Building Ppconsul as dynamic library on Windows is not supported, see https://github.com/oliora/ppconsul/issues/25")
|
|
endif()
|
|
|
|
-add_subdirectory(ext/json11)
|
|
+find_package(json11 CONFIG REQUIRED)
|
|
add_subdirectory(src)
|
|
|
|
option(BUILD_TESTS "Flag to use to build test or not" ON)
|
|
diff --git a/ppconsul.pc.in b/ppconsul.pc.in
|
|
index 199395a..abeb1dc 100644
|
|
--- a/ppconsul.pc.in
|
|
+++ b/ppconsul.pc.in
|
|
@@ -6,5 +6,7 @@ libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
|
|
Name: ppconsul
|
|
Description: C++ client for the Consul HTTP API
|
|
Version: @Ppconsul_VERSION@
|
|
+Requires.private: libcurl
|
|
Libs: -L${libdir} @ppconsul_libs@
|
|
+Libs.prvate: -lb64
|
|
Cflags: -I${includedir}
|
|
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
|
index 1318433..8400172 100644
|
|
--- a/src/CMakeLists.txt
|
|
+++ b/src/CMakeLists.txt
|
|
@@ -66,18 +66,22 @@ target_compile_features(${PROJECT_NAME} PUBLIC cxx_auto_type cxx_decltype cxx_st
|
|
target_include_directories(${PROJECT_NAME}
|
|
PUBLIC
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
|
|
- $<BUILD_INTERFACE:${Boost_INCLUDE_DIRS}>
|
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
|
PRIVATE
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
- ${Boost_INCLUDE_DIRS}
|
|
- ${CMAKE_CURRENT_SOURCE_DIR}/../ext
|
|
)
|
|
|
|
+target_include_directories(${PROJECT_NAME} PRIVATE ${JSON11_INCLUDE_DIRS})
|
|
target_link_libraries(${PROJECT_NAME}
|
|
PRIVATE
|
|
- json11
|
|
- ${Boost_LIBRARIES}
|
|
+ unofficial::b64::b64
|
|
+ ${JSON11_LIBRARIES}
|
|
+ PUBLIC
|
|
+ Boost::fusion
|
|
+ Boost::mpl
|
|
+ Boost::optional
|
|
+ Boost::preprocessor
|
|
+ Boost::variant
|
|
)
|
|
|
|
target_include_directories(${PROJECT_NAME} PRIVATE ${CURL_INCLUDE_DIR})
|
|
diff --git a/src/s11n.h b/src/s11n.h
|
|
index 33fa151..c4f9a84 100644
|
|
--- a/src/s11n.h
|
|
+++ b/src/s11n.h
|
|
@@ -6,7 +6,7 @@
|
|
|
|
#include "ppconsul/config.h"
|
|
#include "ppconsul/error.h"
|
|
-#include <json11/json11.hpp>
|
|
+#include <json11.hpp>
|
|
#include <vector>
|
|
#include <chrono>
|
|
#include <set>
|