-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix spurious error message so its clear using get_option() as a parameter to project() is prohibited #14016
base: master
Are you sure you want to change the base?
Conversation
I didn’t know where to add the test cases for this so I put them in common. I can move them. The second commit “Add a feature fixed warning message” isn’t needed for the fix and can be dropped. If its not dropped the meson version that this fix goes in to needs to be confirmed. Its coded as 1.7 at the moment. |
|
I have replace the warning message with a new feature message. My idea is to make it easier to append some local version information via a flatpak .json file. I didn’t want to be patching files but it could be done that way, just more work. |
What would that "local version information" do exactly? If this is just about getting git revision information, deriving the version from git is typically done via project(...,
version: run_command('./get_git_version.py', check: true).stdout().strip(),
) It's still not generally expected to be a user-selectable option... |
Assuming by user you mean package maintainer. You are stating that the package maintainer should be prohibited from doing:
because it is not generally expected? |
If you aren't 100% sure what I mean by user, then I should perhaps clarify that I am not 100% sure what you mean by package maintainer. The maintainer of a project that uses meson as its build system may be a user of meson, but is not a "user" of the meson.build file that contains |
00802d7
to
9e5af6d
Compare
Make it clear that reading meson.options or a meson -Dopt=value parameter by using get_option() as a parameter to project() isn't allowed.
Ok, its prohibited. On that bases I have change the code to make that clear as the current message is spurious. I have based the new warning message on your previous suggestion. Do you think it could be improved or made more precise?
|
For those of you who find this and would like some more details on eli-schwartz suggestion to use run_command(). Here is a code snippet that works to replace get_option('append_to_version'). Obviously you should replace all instances of the string append_to_version with your own option. example meson.options file:
example meson.build file:
|
Are you trying to be funny or are you seriously considering to use code like that in a project? You seem to have completely misunderstood what @eli-schwartz is saying. |
Calling get_option() from within project() fails because the meson.options file hasn’t be read yet. Reading the options file from within func_get_option fixes the issue.