Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way export xcode build settings to .xcconfig file?

Is it possible to export xcode build settings to .xcconfig file? Other than just copy-paste it to text file line-by-line. Thanks!

like image 629
almas Avatar asked Jun 22 '12 22:06

almas


People also ask

How do I save build settings in Xcode?

You will have to copy the build settings from your xcodeproj file. Open your xcodeproj file in a text editor and copy: buildSettings = { ... } Into your xcconfig file.

Where are build settings stored Xcode?

Choose the project in the Project Navigator on the left. Select the Configurations target from the Targets section and click the Build Settings tab at the top. The Build Settings tab shows the build settings for the Configurations target. It's possible to expand this list with build settings that you define.

How do I create a .xcconfig file on a Mac?

To create the XCCONFIG file, open the project you want to create the XCCONFIG file for, select File → New → File..., choose "Other" (under iOS and OS X), select "Configuration Settings File," name the file, choose the save location, and click Create.

What is a Xcconfig file?

Xcode build configuration files, more commonly known by their xcconfig file extension, allow build settings for your app to be declared and managed without Xcode. They're plain text, which means they're much friendlier to source control systems and can be modified with any editor.


1 Answers

This SO answer helped me.

Show the package contents of your project file (MyProject.xcodeproj) by two finger clicking on it in finder, then open the 'project.pbxproj' file in a text editor.

Look for the section XCConfigurationList. It starts with /* Begin XCConfigurationList section */. You will find all your targets and their respective builConfigurations. Now do a find (command - f) on the long hex ID to find the other occurance in the project.pbxproj where you should also find your buildSettings. Copy and paste everything between the buildSettings brackets into your xcconfig file. You will then need to massage some of the variables, specifically the lists of search paths.

Alternatively, you can use xcodebuild from the command line:

First to list your schemes:

xcodebuild -list

Then export your desired scheme's settings:

xcodebuild -scheme "schemeName" -showBuildSettings >> mynew.xcconfig

You will then need to delete the first line or comment it out

like image 140
Michael M. Myers Avatar answered Sep 24 '22 21:09

Michael M. Myers