summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorThomas Sondergaard <thomas@sondergaard.cc>2022-06-23 08:51:50 +0200
committerWerner Lemberg <wl@gnu.org>2022-07-03 06:48:15 +0200
commit55a97b0cb133b7a5dc28dfabec77a1b9f742c301 (patch)
tree1cd6d3e8fdd7cc662d8d8f284a6b887387b63b19 /CMakeLists.txt
parent31005d98a43803d161773193286d0c34d78f4fea (diff)
downloadfreetype2-55a97b0cb133b7a5dc28dfabec77a1b9f742c301.tar.gz
CMakeLists.txt: Provide both 'freetype' and 'Freetype::Freetype' targets.
FreeType can be located by consuming projects that use `find_package(Freetype)` either via the old `MODULE` path (which uses `FindFreetype.cmake` supplied by CMake), or via the new `CONFIG` path (which uses `freetype-config.cmake` as supplied by this project). Up to this point the CMake module has supplied the target `Freetype::Freetype` and the config file provided by this project the target `freetype`. Now we supply both `freetype` and `Freetype::Freetype` so that consuming projects can always use the target `Freetype::Freetype` regardless of what path was taken by `find_package(Freetype)`. Fixes #1165.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt9
1 files changed, 8 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d12897cba..feb4be39a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -498,6 +498,13 @@ if (BUILD_FRAMEWORK)
)
endif ()
+# 'freetype-interface' is an interface library, to be accessed with
+# `EXPORT_NAME Freetype::Freetype`. This is the target name provided by
+# CMake's `FindFreetype.cmake`, so we provide it for compatibility.
+add_library(freetype-interface INTERFACE)
+set_target_properties(freetype-interface PROPERTIES
+ EXPORT_NAME Freetype::Freetype
+ INTERFACE_LINK_LIBRARIES freetype)
set(PKGCONFIG_REQUIRES "")
set(PKGCONFIG_REQUIRES_PRIVATE "")
@@ -615,7 +622,7 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
COMPATIBILITY SameMajorVersion)
install(
- TARGETS freetype
+ TARGETS freetype freetype-interface
EXPORT freetype-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}