title: Xcode 8 doesn't seem to be honoring my target platform when building
body: <p>I can't tell if this is my configuration issue (likely) or Xcode 8's bug (also likely).</p>
  
  <p>I'm working on porting an iOS framework, <a href="https://github.com/hilogames/HLSpriteKit" rel="nofollow noreferrer">HLSpriteKit</a> over to Mac. Because there's a couple of iOS-specific files in the project, and now one specific to Mac, I chose to create two separate targets, one for iOS and one for macOS.</p>
  
  <p><a href="https://i.stack.imgur.com/d1IQL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d1IQL.png" alt="enter image description here"></a></p>
  
  <p>For the shared code, I want to use <code>#if TARGET_OS_OSX</code> to target macOS and <code>#else</code> for everything else:</p>
  
  <p><a href="https://i.stack.imgur.com/zQP72.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zQP72.png" alt="enter image description here"></a></p>
  
  <p>When I try to build this using my iOS target, it works great. But when I try to build with the Mac target (as you can see in the upper left of the screenshot), it fails. It seems to be failing the <code>#if TARGET_OS_OSX</code> check even though I'm building for Mac. Better yet, when I cmd-click <code>TARGET_OS_OSX</code>, it takes me to the macOS 10.12 TargetConditionals.h file with the line <code>#define TARGET_OS_OSX 1</code>. So why is it failing?</p>
  
  <p>My questions:</p>
  
  <ol>
  <li><p>What controls which TargetConditionals.h file (ie: iOS or macOS) Xcode chooses when compiling? I was under the assumption it was purely based on which device I've selected in the Scheme/Device picker, and the list of devices available is based on <strong>Build Settings -> Supported Platforms</strong> for the given target. Right?</p></li>
  <li><p>Is Xcode building my project differently than the text editor auto-complete (ie: the cmd-click support) is leading me to believe?</p></li>
  <li><p>Should I be doing this a different way?</p></li>
  </ol>