Skip to content

Commit 4b1fa5e

Browse files
committed
Add option to use system cpr
1 parent 007383f commit 4b1fa5e

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ find_package(PkgConfig)
9090
# now, we use a system provided crypto library for this purpose
9191
pkg_check_modules(libgcrypt REQUIRED IMPORTED_TARGET libgcrypt)
9292

93+
option(USE_SYSTEM_CPR OFF "Use system-wide installed CPR")
94+
95+
if(USE_SYSTEM_CPR)
96+
find_package(cpr REQUIRED)
97+
add_library(cpr ALIAS cpr::cpr)
98+
endif()
99+
93100
# add libraries shipped along with the project
94101
add_subdirectory(lib)
95102

lib/CMakeLists.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ add_subdirectory(libzsync)
1010

1111
# external dependencies used as submodules
1212

13-
# using system cURL as it has proper SSL support etc., and reduces the build time
14-
set(USE_SYSTEM_CURL ON CACHE BOOL "" FORCE)
15-
# disable CPR tests to save compile time and avoid clashes with own tests
16-
set(BUILD_CPR_TESTS OFF CACHE BOOL "" FORCE)
17-
add_subdirectory(cpr)
18-
set_property(TARGET cpr PROPERTY POSITION_INDEPENDENT_CODE ON)
13+
if(NOT USE_SYSTEM_CPR)
14+
add_subdirectory(cpr)
15+
set_property(TARGET cpr PROPERTY POSITION_INDEPENDENT_CODE ON)
16+
endif()
1917

2018
# it's quite simple dealing with the args library directly from CMake
2119
add_library(args INTERFACE)

src/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ cmake_minimum_required(VERSION 3.2)
33
set(CMAKE_CXX_STANDARD 11)
44
set(CMAKE_POSITION_INDEPENDENT_CODE true)
55

6-
# fix CPR target
7-
target_include_directories(cpr PUBLIC ${CPR_INCLUDE_DIRS})
8-
96
set(zsync2_public_headers
107
${PROJECT_SOURCE_DIR}/include/zsutil.h
118
${PROJECT_SOURCE_DIR}/include/zsclient.h

0 commit comments

Comments
 (0)