Validity of using run_command
for file generation
#12909
-
As of meson v1.2.0, the following code fragment is valid: project('testing', 'cpp')
run_command('touch', 'test.cpp')
library('testing', 'test.cpp') Is this behaviour:
I'm aware that |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Formally speaking, And with great power, comes great responsibility. Meson doesn't know the file was created via run_command. It has no way of knowing. It also has no way of responding to this information. Meson will therefore behave as though it was created manually with a text editor before running Incidentally, it does do something you didn't expect. A run_command() is run in an unspecified directory. |
Beta Was this translation helpful? Give feedback.
-
Incidentally this is expected to change. I will be very happy to stop having to discuss various... replacements... with people. :D |
Beta Was this translation helpful? Give feedback.
Formally speaking,
run_command()
gives you great power.And with great power, comes great responsibility.
Meson doesn't know the file was created via run_command. It has no way of knowing. It also has no way of responding to this information.
Meson will therefore behave as though it was created manually with a text editor before running
meson setup
. It assumes you will update it when you want it to be updated, and will return an inscrutable "error: no such file as test.cpp" if that run_command fails or does something you didn't expect.Incidentally, it does do something you didn't expect. A run_command() is run in an unspecified directory.