Clear specific build setting
Hi:
I am using xcconfig files to inject build settings to the xcode project. I managed to remove all build settings from the project except for SDKROOT by doing:
options:
settingPresets: none
Is there any way I can clear SDKROOT from the project build settings, as I have it set in the xcconfig files?
For example:
settings:
SDKROOT: none
Thanks
Hi @acecilia
If you want to override that you can set the target setting to ${inherited}
settings:
SDKROOT: ${inherited}
May I ask, do your SDKROOT settings not align with what XcodeGen generates by default?
Hi @yonaskolb:
Ideally, I would like to not specify any platform, as I already set SDKROOT with the xcconfig files. I saw that platform is mandatory, and that is the reason I was looking into clearing SDKROOT (as it is set automatically).
To answer your question:
- Yes, the platform information I introduce in
project.ymlis the same as the one I have set withSDKROOTusingxcconfigfiles. But its duplication of information, that is why I would like to only rely in thexcconfigfiles.
Thanks for your answer! I tried your approach, but it still appears in the xcode project as set:
At this point, being able to clear that setting isn't possible. As it's the same value as your own settings though, I don't see an issue here
I'd like to 2nd this issue. We have a modular app and moved to exclusively .xcconfig files about a year ago. We have a danger check to validate that each project.pbxproj has an empty build settings array, forcing .xcconfig usage. Despite using settingPresets: none I too am getting a couple of build settings to still come through, INFOPLIST_FILE and FRAMEWORK_SEARCH_PATHS.
Is there a reason that any config is still set with settingPresets: none applied? I'd be happy to go track down why they're still being set if you'd be okay with merging the PR afterwards.
I'd like this ability too, or at least that the CODE_SIGN_IDENTITY wouldn't default to "".
We have the same issue, we have a danger check to ensure no project files have any settings in them and everything is in xcconfig files. We can remove the build settings after generating the project with a ruby script using xcodeproj but we have 30+ targets and deleting the settings and saving the projects take a while and the process as a whole takes more than twice as much time so I'd rather generate the project without it
I'd welcome a PR that doesn't apply any build settings if options.settingsPresets: none. In hindsight the name of that option isn't great, as settings coming from the preset yaml files is just an implementation detail. I also welcome other ideas of how to configure this
IMO: Don't validate or lint pbxproj itself as it's an implementation detail already. Validate output of xcodebuild -showBuildSetting in Danger like script in your CI workflow so it's safer.
Just hit this as well. I wrote a quick script to just remove all build settings after generating the pbxproj:
#!/usr/bin/env bash
xcode_project="${1}"
pbxproj_file="${xcode_project}/project.pbxproj"
perl -0pe 's/buildSettings = \{[^}]*\};/buildSettings = \{\};/gms' "${pbxproj_file}" > fixed.pbxproj
mv fixed.pbxproj "${pbxproj_file}"