[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] master 35740aa6a: [cmake] Check the availability of `bzip2.p
From: |
Werner Lemberg |
Subject: |
[freetype2] master 35740aa6a: [cmake] Check the availability of `bzip2.pc'. |
Date: |
Fri, 28 Jan 2022 21:05:45 -0500 (EST) |
branch: master
commit 35740aa6a9b1d7f711dfe41a38dde5a178443b64
Author: suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
Commit: suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[cmake] Check the availability of `bzip2.pc'.
(CMakeLists.txt): Check the availability of `bzip2.pc'.
* If `bzip2.pc' is available, Requires.private should include
bzip2, but Libs.private should not include -lbz2.
* If `bzip2.pc' is unavailable, Requires.private cannot include
bzip2, but Libs.private should include -lbz2.
Fix #897.
---
CMakeLists.txt | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6f9a65001..4590309a0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -271,11 +271,16 @@ if (NOT FT_DISABLE_ZLIB)
endif ()
if (NOT FT_DISABLE_BZIP2)
+ # Genuine BZip2 does not provide bzip2.pc, but some platforms have it.
+ # For better dependency in freetype2.pc, bzip2.pc is searched
+ # regardless of the availability of libbz2. If bzip2.pc is found,
+ # Requires.private is used instead of Libs.private.
if (FT_REQUIRE_BZIP2)
find_package(BZip2 REQUIRED)
else ()
find_package(BZip2)
endif ()
+ pkg_check_modules(PC_BZIP2 bzip2)
endif ()
if (NOT FT_DISABLE_BROTLI)
@@ -504,7 +509,11 @@ endif ()
if (BZIP2_FOUND)
target_link_libraries(freetype PRIVATE ${BZIP2_LIBRARIES})
target_include_directories(freetype PRIVATE ${BZIP2_INCLUDE_DIR}) # not
BZIP2_INCLUDE_DIRS
- list(APPEND PKG_CONFIG_LIBS_PRIVATE "-lbz2")
+ if (PC_BZIP2_FOUND)
+ list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "bzip2")
+ else ()
+ list(APPEND PKG_CONFIG_LIBS_PRIVATE "-lbz2")
+ endif ()
endif ()
if (PNG_FOUND)
target_link_libraries(freetype PRIVATE ${PNG_LIBRARIES})
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] master 35740aa6a: [cmake] Check the availability of `bzip2.pc'.,
Werner Lemberg <=