CMakeList.txt: Update code to handle recent changes for `freetype.pc`. Fixes #1144.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 747fc91..8d6e16a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -498,7 +498,9 @@ if (BUILD_FRAMEWORK)
endif ()
+set(PKGCONFIG_REQUIRES "")
set(PKGCONFIG_REQUIRES_PRIVATE "")
+set(PKGCONFIG_LIBS "-L\${libdir} -lfreetype")
set(PKGCONFIG_LIBS_PRIVATE "")
if (ZLIB_FOUND)
@@ -569,10 +571,26 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%ft_version%" "${LIBTOOL_CURRENT}.${LIBTOOL_REVISION}.${LIBTOOL_AGE}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
- string(REPLACE "%REQUIRES_PRIVATE%" "${PKGCONFIG_REQUIRES_PRIVATE}"
- FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
- string(REPLACE "%LIBS_PRIVATE%" "${PKGCONFIG_LIBS_PRIVATE}"
- FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
+
+ if (BUILD_SHARED_LIBS)
+ string(REPLACE "%PKGCONFIG_REQUIRES%" "${PKGCONFIG_REQUIRES}"
+ FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
+ string(REPLACE "%PKGCONFIG_REQUIRES_PRIVATE%" "${PKGCONFIG_REQUIRES_PRIVATE}"
+ FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
+ string(REPLACE "%PKGCONFIG_LIBS%" "${PKGCONFIG_LIBS}"
+ FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
+ string(REPLACE "%PKGCONFIG_LIBS_PRIVATE%" "${PKGCONFIG_LIBS_PRIVATE}"
+ FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
+ else ()
+ string(REPLACE "%PKGCONFIG_REQUIRES%" "${PKGCONFIG_REQUIRES} ${PKGCONFIG_REQUIRES_PRIVATE}"
+ FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
+ string(REPLACE "%PKGCONFIG_REQUIRES_PRIVATE%" ""
+ FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
+ string(REPLACE "%PKGCONFIG_LIBS%" "${PKGCONFIG_LIBS} ${PKGCONFIG_LIBS_PRIVATE}"
+ FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
+ string(REPLACE "%PKGCONFIG_LIBS_PRIVATE%" ""
+ FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
+ endif ()
set(FREETYPE2_PC_IN_NAME "${PROJECT_BINARY_DIR}/freetype2.pc")
if (EXISTS "${FREETYPE2_PC_IN_NAME}")