title: How do I link to a system module from inside a C language target with Swift Pacakge Manager?
body: <p>I want to implement a C wrapper for Bullet physics in Swift.  Basically my plan is to implement a C language target which wraps the necessary functionality I am using in bullet, and to depend on this C target in my swift code.  The problem is, I can't get the bullet headers to be found from within the C language target.</p>
  
  <p>My initial approach has been to create 3 modules managed by Swift Package Manager: a system module (bullet), a C language target (the wrapper) and a Swift module (the client code).</p>
  
  <p>My system module looks like this:</p>
  
  <h2>Package.swift:</h2>
  
  <pre><code>// swift-tools-version:3.1
  
  import PackageDescription
  
  let package = Package(
      name: "Cbullet",
      pkgConfig: "bullet",
      providers: [
          .Brew("bullet")
      ]
  )
  </code></pre>
  
  <h2>module.modulemap:</h2>
  
  <pre><code>module ClibBullet [system] {
    header "/usr/local/Cellar/bullet/2.86.1_1/include/bullet/btBulletCollisionCommon.h"
    header "/usr/local/Cellar/bullet/2.86.1_1/include/bullet/btBulletDynamicsCommon.h"
    link "bullet"
    export *
  }
  </code></pre>
  
  <p>The other two modules are part of the same package:</p>
  
  <h2>Package.swift</h2>
  
  <pre><code>// swift-tools-version:4.0
  // The swift-tools-version declares the minimum version of Swift required to build this package.
  
  import PackageDescription
  
  func localModulesPath(_ moduleName: String) -&gt; String {
      return "../\(moduleName)"
  }
  
  let package = Package(
      name: "Physics",
      products: [
          .library(
              name: "Physics",
              targets: ["Physics"]),
  
      ],
      dependencies: [
          .package(url: localModulesPath("Cbullet"), .branch("master")),
      ],
      targets: [
          .target(
              name: "CBulletWrapper",
              dependencies: []),
          .target(
              name: "Physics",
              dependencies: ["CBulletWrapper"]),
      ]
  )
  </code></pre>
  
  <p>From inside my <code>CBulletWrapper.cpp</code> implementation file, I try to include the Cbullet headers like so:</p>
  
  <pre><code>#include &lt;Cbullet/btBulletCollisionCommon.h&gt;
  #include &lt;Cbullet/btBulletDynamicsCommon.h&gt;
  </code></pre>
  
  <p>But I get an error:</p>
  
  <pre><code>"btBulletCollisionCommon.h" file not found
  </code></pre>
  
  <p>I have also tried including the bullet headers from their explicit path:</p>
  
  <pre><code>#include "/usr/local/Cellar/bullet/2.86.1_1/include/bullet/btBulletDynamicsCommon.h"
  </code></pre>
  
  <p>But then I get <code>file not found</code> errors on all the imports within <code>btBulletDynamicsCommon.h</code> (for example <code>#include "LinearMath/btVector3.h"</code></p>
  
  <p>So the question is, what is the correct way to link to a system library from inside a C language target built by Swift Pacakage Manager?</p>