Skip to content
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

Stay backwards compatible with cflags, cxxflags, ldflags #24

Merged
merged 1 commit into from
Jun 8, 2023

Conversation

davispuh
Copy link
Collaborator

5e173ae (related to #22) changed API regarding cflags, cxxflags, ldflags

Previously it was expected to be raw and passed as is, thus applications could do either

cflags << "-Wall -Wextra -O3"

cflags << "-Wall" << "-Wextra" << "-O3"

And both would work and do exactly same thing. But 5e173ae made that each item is a separate flag thus you couldn't put multiple flags in same string so only 2nd way would work.

I don't think that previous API is good because it's 2 ways to do exactly same thing and you would have to escape it for target shell yourself and it's something that's easy to forget, eg. ldflags << "-L" << libpath - this actually wouldn't work if libpath contained spaces and weren't escaped for shell.

But there's probably a lot of applications that are passing multiple flags in single string so to make life easier for everyone lets just keep API compatibility.

And for new applications they can disable this compatibility with raw = false like this

ldflags.raw = false
ldflags << "-L" << libpath # Now we correctly support `libpath` that contains spaces

Previous change made it API breaking so fix that
@davispuh davispuh merged commit d372fdc into ffi:master Jun 8, 2023
@davispuh davispuh deleted the fix_api branch February 6, 2024 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant