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

Escape string literals passed to defines() for Xcode #678

Merged
merged 1 commit into from
Jan 23, 2017

Conversation

macsforme
Copy link
Contributor

This corrects an issue with defines() in Xcode. If you make a call such as defines "MY_LITERAL=\"string literal\"", you would expect the result to be -DMY_LITERAL=\"string\ literal\". And indeed, that is the result in a makefile created by the gmake action. Furthermore, in the .xcodeproj, you will even see GCC_PREPROCESSOR_DEFINITIONS = ( "MY_LITERAL=\"string literal\"", );. However, when Xcode runs the compile command, it ends up being -DMY_LITERAL=string\ literal and compilation fails. With this change, values passed to defines() are escaped in Xcode and it will work equivalently to how it works in gmake.

It was possible before to pass a string literal to defines() for Xcode, but you had to escape it yourself (e.g., defines "MY_LITERAL=\\\"value\\\""). With this change, it eliminates the special platform check and handling you have to do because the behavior will be consistent. All types of arguments (string literals, numeric values, and names only) passed to defines() appear to function as expected after this change.

@tvandijck tvandijck merged commit 5f02759 into premake:master Jan 23, 2017
@macsforme macsforme deleted the xcode-string-literals branch January 23, 2017 22:33
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.

3 participants