Skip to content

Commit 57f8409

Browse files
committed
allow build from src using external zlib
This uses `find_package(ZLIB)` when building from source to optionally avoid the submodule and use an installed zlib instead.
1 parent 47faa50 commit 57f8409

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ set(VERSION 1.0.5)
66

77
set(CMAKE_C_STANDARD 99)
88

9+
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
10+
find_package(ZLIB REQUIRED)
11+
set(zlib_target ZLIB::ZLIB)
12+
else()
13+
set(zlib_target zlib)
14+
endif()
15+
916
add_library(pplib_utils STATIC
1017
util/utilplat.h
1118
util/utilcryptdef.h
@@ -42,7 +49,7 @@ target_include_directories(pplib_utils PUBLIC
4249
target_link_libraries(pplib_utils
4350
PUBLIC
4451
m
45-
zlib
52+
${zlib_target}
4653
)
4754

4855
add_library(pplib_filters STATIC
@@ -63,7 +70,7 @@ target_include_directories(pplib_filters PUBLIC
6370
target_link_libraries(pplib_filters
6471
PUBLIC
6572
m
66-
zlib
73+
${zlib_target}
6774
)
6875

6976
add_library(pplib

0 commit comments

Comments
 (0)