Skip to content

Validity of using run_command for file generation #12909

Answered by eli-schwartz
mitchgrout asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@mitchgrout
Comment options

@eli-schwartz
Comment options

@mitchgrout
Comment options

Answer selected by mitchgrout
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants