From 2e48d13fa2762fd0b3316a76705318be94db8e21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Volker=20Wei=C3=9Fmann?= Date: Wed, 20 Jan 2021 12:44:40 +0100 Subject: [PATCH] Added "How do I use a library before declaring it?" in the FAQ. --- docs/markdown/FAQ.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/markdown/FAQ.md b/docs/markdown/FAQ.md index 4ea4d8d61..b0db361b7 100644 --- a/docs/markdown/FAQ.md +++ b/docs/markdown/FAQ.md @@ -533,3 +533,20 @@ development but are not compiled in release builds. Note that (since Meson 0.57.0) you can set optimization to, say, 2 in your debug builds if you want to. If you tried to set this flag based on optimization level, it would fail in this case. + +## How do I use a library before declaring it? + +This is valid (and good) code: +``` +libA = library('libA', 'fileA.cpp', link_with : []) +libB = library('libB', 'fileB.cpp', link_with : [libA]) +``` +But there is currently no way to get something like this to work: +``` +libB = library('libB', 'fileB.cpp', link_with : [libA]) +libA = library('libA', 'fileA.cpp', link_with : []) +``` +This means that you HAVE to write your `library(...)` calls in the order that the +dependencies flow. While ideas to make arbitrary orders possible exist, they were +rejected because reordering the `library(...)` calls was considered the "proper" +way. See [here](https://github.com/mesonbuild/meson/issues/8178) for the discussion. \ No newline at end of file