@@ -563,6 +563,7 @@ final class PackagePIFProjectBuilder: PIFProjectBuilder {
563
563
let generatedModuleMapDir = "$(OBJROOT)/GeneratedModuleMaps/$(PLATFORM_NAME)"
564
564
let moduleMapFile = "\(generatedModuleMapDir)/\(target.name).modulemap"
565
565
let moduleMapFileContents: String?
566
+ let shouldImpartModuleMap: Bool
566
567
567
568
if let clangTarget = target.underlyingTarget as? ClangTarget {
568
569
// Let the target itself find its own headers.
@@ -583,8 +584,11 @@ final class PackagePIFProjectBuilder: PIFProjectBuilder {
583
584
export *
584
585
}
585
586
"""
587
+
588
+ shouldImpartModuleMap = true
586
589
} else {
587
590
moduleMapFileContents = nil
591
+ shouldImpartModuleMap = false
588
592
}
589
593
} else if let swiftTarget = target.underlyingTarget as? SwiftTarget {
590
594
settings[.SWIFT_VERSION] = swiftTarget.swiftVersion.description
@@ -598,6 +602,8 @@ final class PackagePIFProjectBuilder: PIFProjectBuilder {
598
602
export *
599
603
}
600
604
"""
605
+
606
+ shouldImpartModuleMap = true
601
607
} else {
602
608
throw InternalError("unexpected target")
603
609
}
@@ -608,7 +614,9 @@ final class PackagePIFProjectBuilder: PIFProjectBuilder {
608
614
}
609
615
610
616
// Pass the path of the module map up to all direct and indirect clients.
611
- impartedSettings[.OTHER_CFLAGS, default: ["$(inherited)"]].append("-fmodule-map-file=\(moduleMapFile)")
617
+ if shouldImpartModuleMap {
618
+ impartedSettings[.OTHER_CFLAGS, default: ["$(inherited)"]].append("-fmodule-map-file=\(moduleMapFile)")
619
+ }
612
620
impartedSettings[.OTHER_LDRFLAGS] = []
613
621
614
622
if target.underlyingTarget.isCxx {
0 commit comments