Skip to content

Commit e20e381

Browse files
authored
Provide correct BZip2 information for in-project build (#227)
1 parent bcfe62b commit e20e381

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ if(QUAZIP_BZIP2)
176176
list(APPEND QUAZIP_LBD ${BZIP2_LIBRARY_DIRS})
177177

178178
set(PC_PRIVATE_LIBS "${PC_PRIVATE_LIBS} -lbzip2")
179+
180+
set(QUAZIP_BZIP2_BUILD FALSE)
179181
elseif(QUAZIP_FETCH_LIBS)
180182
clone_repo(bzip2 https://sourceware.org/git/bzip2.git)
181183

@@ -196,13 +198,23 @@ if(QUAZIP_BZIP2)
196198

197199
add_library(bzip2 STATIC ${BZIP2_SRC} ${BZIP2_HDR})
198200

201+
set_target_properties(bzip2 PROPERTIES
202+
PUBLIC_HEADER "${BZIP2_SOURCE_DIR}/bzlib.h"
203+
)
204+
target_include_directories(bzip2 PUBLIC
205+
$<BUILD_INTERFACE:${BZIP2_SOURCE_DIR}>
206+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
207+
)
208+
199209
if(NOT QUAZIP_BZIP2_STDIO)
200210
target_compile_definitions(bzip2 PRIVATE -DBZ_NO_STDIO)
201211
endif()
202212

203213
list(APPEND QUAZIP_DEP bzip2)
204214
list(APPEND QUAZIP_LIB bzip2)
205215
list(APPEND QUAZIP_INC ${BZIP2_SOURCE_DIR})
216+
217+
set(QUAZIP_BZIP2_BUILD ON)
206218
else()
207219
message(STATUS "BZip2 library not found")
208220

quazip/QuaZipConfig.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ else()
1414
message(FATAL_ERROR "Qt version QUAZIP_QT_MAJOR_VERSION=@QUAZIP_QT_MAJOR_VERSION@ is unsupported")
1515
endif()
1616

17-
if(@QUAZIP_BZIP2@)
17+
if(@QUAZIP_BZIP2@ AND NOT @QUAZIP_BZIP2_BUILD@)
1818
find_dependency(BZip2 REQUIRED)
1919
endif()
2020

0 commit comments

Comments
 (0)