Commit 0565c5ba2bfee0211d250bd90482cc9b20321260

Xavier Claessens 2020-10-26T11:31:19

* meson.build: Use `meson.override_dependency`. This is a new meson mechanism to avoid other projects to hard-code the `freetype2_dep` variable name in their build definition. It also ensures that meson does not mix system and subproject versions of FreeType inside of the same project. Also remove outdated TODO because `declare_dependency` was already there.

diff --git a/ChangeLog b/ChangeLog
index 57704cc..1312b04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2021-02-09  Xavier Claessens  <xavier.claessens@collabora.com>
 
+	* meson.build: Use `meson.override_dependency`.
+
+	This is a new meson mechanism to avoid other projects to hard-code
+	the `freetype2_dep` variable name in their build definition.  It
+	also ensures that meson does not mix system and subproject versions
+	of FreeType inside of the same project.
+
+	Also remove outdated TODO because `declare_dependency` was already
+	there.
+
+2021-02-09  Xavier Claessens  <xavier.claessens@collabora.com>
+
 	* meson.build (bzip2_dep): Simplify.
 
 	We remove `static:false` from `find_library('bz2')`.
diff --git a/meson.build b/meson.build
index 243046c..30b03bb 100644
--- a/meson.build
+++ b/meson.build
@@ -334,6 +334,7 @@ freetype2_dep = declare_dependency(
   include_directories: ft2_includes,
   link_with: ft2_lib,
   version: ft2_so_version)
+meson.override_dependency('freetype2', freetype2_dep)
 
 
 # NOTE: Using both `install_dir` and `subdir` doesn't seem to work below,
@@ -347,8 +348,6 @@ install_headers(ft2_config_headers,
   install_dir: 'include/freetype2/freetype/config')
 
 
-# TODO(david): Declare_dependency() for using this in a Meson subproject
-#
 pkgconfig = import('pkgconfig')
 pkgconfig.generate(ft2_lib,
   filebase: 'freetype2',