15 Most Recent [RSS]
More...
|
Shared Precompiled Headers considered harmful
Just because we got annoyed by this at work: There's a bug in the way Xcode shares its preompiled headers that may bite you. Xcode stores its precompiled headers in a folder named /Library/Caches/SharedPrecompiledHeaders/501/ProjectName_SettingsHash/.
Now, consider you have two copies of your application checked out of your Subversion repository, the 1.0 branch and the 2.0 branch. Of course, both project files have the same name, so when you switch between projects, the precompiled headers will be from the wrong branch.
So, it's a good idea to change the precompiled headers path to something that's relative to the project, so they will be shared, but not between branches.
Thanks to Stuart for tracking this one down.
Chris Hanson writes: It's only really a problem to share these precompiled headers if they're actually incompatible. Generally Xcode tries to be aggressive about calculating the hash of settings it uses to determine whether headers should be shared; look inside the cached precompiled header folder to see what criteria it actually used.
For example, if you're using gcc 4.0, the same set of preprocessor definitions, the same precompiled header name, and the contents of your prefix files are the same, there should be no issue sharing the precompiled versions among multiple projects - even projects representing v1.0 and v2.0 of the same product.
It's only if there's some criteria that should be affecting whether Xcode thinks they're the same but isn't that they shouldn't be shared. And if you've found that to be the case, please please please file a bug report and describe what that criteria is. Again, you can take a look inside the shared, precompiled prefix file to see what the hashing criteria were; it can be useful to include this information in your bug report along with the build settings that you think should be influencing sharing but aren't. |
| |