Use a file generated with configure_file

314 views
Skip to first unread message

Sergio Costas

unread,
Jan 1, 2017, 8:01:39 AM1/1/17
to The Meson Build System
Hi again:

I'm creating a source file using "configure_file". The problem is that
I'm unable to add it to the list of source files. How can I do it? (I
presume I need to get, somehow, the full path where I'm building the
project, but I'm unable to find how to do that).

Thanks again.

--
Nos leemos
RASTER (Linux user #228804)
ras...@rastersoft.com http://www.rastersoft.com

Igor Gnatenko

unread,
Jan 1, 2017, 8:19:04 AM1/1/17
to Sergio Costas, The Meson Build System
It perfectly works as it is:
config_h = configure_file(output : 'config.h', configuration : conf)
library(..., sources : [..., config_h], ...)

--
You received this message because you are subscribed to the Google Groups "The Meson Build System" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mesonbuild+...@googlegroups.com.
To post to this group, send an email to meson...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/mesonbuild/8a7ee19d-029a-82d2-5a02-19a28b9655e9%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
--

-Igor Gnatenko

Jussi Pakkanen

unread,
Jan 1, 2017, 8:50:32 AM1/1/17
to Igor Gnatenko, Sergio Costas, The Meson Build System
On Sun, Jan 1, 2017 at 3:18 PM, Igor Gnatenko
<i.gnaten...@gmail.com> wrote:

> It perfectly works as it is:
> config_h = configure_file(output : 'config.h', configuration : conf)
> library(..., sources : [..., config_h], ...)

Just make sure that the directory you generate the header file is in
the current target's include path. Usually this is done by something
like the following:

config_inc = include_directories('.') # in the directory where you
generate the header

and then

executable(..., include_directories : [config_inc, ...]) # In your target

If you generate a header (rather than a source), you don't need to
explicitly put the header in the source list, it is generated during
configure phase and is guaranteed to be available in the compilation
phase.

Sergio Costas

unread,
Jan 1, 2017, 11:34:37 AM1/1/17
to meson...@googlegroups.com
My fault: I already did that, but put the variable name between single quotes... O:)

El 01/01/17 a las 14:18, Igor Gnatenko escribió:
Reply all
Reply to author
Forward
0 new messages