Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode - duplicate Target - new Target fails to build

using Xcode 3.2.5 on 10.6.6 (10J521) and now 10J537.

I have an Xcode project containing 1 Target: "MyApp". It builds and runs successfully.

As well as source and resource files, the Target contains a "Copy Files" build phase which copies "Sparkle.framework" in. The framework is in the same directory as the project.

I want to duplicate this Target. Steps taken:

  • Did "Clean all Targets".

  • Right-clicked on the "MyApp" Target within Xcode, and then chose "Duplicate".

  • Renamed the duplicated target to "MyAppTarget2".

  • Selected "MyAppTarget2" as the Active Target from the popup menu in the top-left.

  • Did "Build".

The problem:

error: Sparkle/Sparkle.h: No such file or directory

At the line:

#import <Sparkle/Sparkle.h>  // In MyAppDelegate.mm

This is puzzling! Further info:

  • Each Build step appears to have been replicated in the duplicated Target, including the "Copy Files" phase.

  • The Sparkle.framework itself exists in the project's folder.

  • In the "Link Binaries with Library" phase of both "MyApp" and "MyAppTarget2", I am linking to the Sparkle.framework at the above location. A "Get Info" on the linked binary reports that it is a member of both Targets.

  • If I right-click on the Sparkle.framework file within the "Copy Files" build phase of the duplicated Target, and select "Reveal in Finder", then the correct Sparkle.framework file is shown. The required file exists at Sparkle.framework/Headers/Sparkle.h

  • If I switch back to the original "MyApp" target, it builds and runs successfully.

Am I doing something obviously wrong here? Thanks.

[EDIT - SOLVED]

like image 216
SirRatty Avatar asked Dec 28 '10 03:12

SirRatty


1 Answers

I had a look at the Build settings for each supposedly-identical Target.

Under "Framework Search Paths", the first Target had this:

$(inherited) "$(SRCROOT)"

But the duplicated Target had this path:

$(inherited) \"$(SRCROOT)\"

It appears that Xcode incorrectly escaped the path during the duplication process. Ouch.

like image 158
SirRatty Avatar answered Oct 29 '22 13:10

SirRatty