Skip to content

Commit e78aeae

Browse files
authored
Fix syntax highlighting in SE-0238 (#2367)
Also fixed naming of some declarations to reflect the actual implementation
1 parent 1f54c52 commit e78aeae

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

proposals/0238-package-manager-build-settings.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,41 +28,53 @@ We propose to add the following build settings in this proposal:
2828

2929
### Header search path (C/CXX)
3030

31-
`static func headerSearchPath(_ path: String, _ condition: BuildSettingCondition? = nil) -> <BuildSettingType>`
31+
```
32+
static func headerSearchPath(_ path: String, _ condition: BuildSettingCondition? = nil) -> <BuildSettingType>
33+
```
3234

3335
Many C-family projects are structured in a way that requires adding header search paths to different directories of the project. Currently, SwiftPM only adds a search path to the `include` directory which makes it difficult for many C projects to add support for building with SwiftPM. This specified path should be relative to the target and should not escape the package boundary. Absolute paths are disallowed.
3436

3537
*Note: It is not recommended to use this setting for adding search paths of public headers as the target-specific settings are not imparted onto other targets.*
3638

3739
### Define (C/CXX)
3840

39-
`static func define(_ name: String, to value: String? = nil, _ condition: BuildSettingCondition? = nil) -> <BuildSettingType>`
41+
```swift
42+
static func define(_ name: String, to value: String? = nil, _ condition: BuildSettingCondition? = nil) -> <BuildSettingType>
43+
```
4044

4145
This setting will add the `-D<name>=<value>` flag during a target's compilation. This is useful for projects that want to specify a compile-time condition.
4246

4347
*Note: It is not recommended to use this setting for public headers as the target-specific settings are not imparted.*
4448

4549
### Define (Swift)
4650

47-
`static func define(_ name: String, _ condition: BuildSettingCondition? = nil) -> SwiftSetting`
51+
```swift
52+
static func define(_ name: String, _ condition: BuildSettingCondition? = nil) -> SwiftSetting
53+
```
4854

4955
This setting enables the specified compilation condition for Swift targets. Unlike C/CXX's define, it doesn't have an associated value.
5056

5157
### Link library (Linker)
5258

53-
`static func linkLibrary(_ libraryName: String, _ condition: BuildSettingCondition? = nil) -> <BuildSettingType>`
59+
```swift
60+
static func linkedLibrary(_ libraryName: String, _ condition: BuildSettingCondition? = nil) -> <BuildSettingType>
61+
```
5462

5563
This is useful for packages that want to link against a library present in the system. The current approach requires them to create a module map using system library targets or a fake C target in order to achieve this effect. There is also no provision for conditionalization based on the platform in the existing approach, which is valuable when writing cross-platform packages.
5664

5765
### Link framework (Linker)
5866

59-
`static func linkFramework(_ frameworkName: String, _ condition: BuildSettingCondition? = nil) -> <BuildSettingType>`
67+
```swift
68+
static func linkedFramework(_ frameworkName: String, _ condition: BuildSettingCondition? = nil) -> <BuildSettingType>
69+
```
6070

6171
Frameworks are autolinked for Swift and C/ObjC targets so most packages shouldn't require this build setting. However, packages that contain C++ files can't autolink the frameworks. Since frameworks are widely used on Apple platforms, it is recommended to use this setting with a platform conditional.
6272

6373
### Unsafe flags (All)
6474

65-
`static func unsafeFlags(_ flags: [String], _ condition: BuildSettingCondition? = nil) -> <BuildSettingType>`
75+
```swift
76+
static func unsafeFlags(_ flags: [String], _ condition: BuildSettingCondition? = nil) -> <BuildSettingType>
77+
```
6678

6779
This is an escape hatch that will allow targets to pass arbitrary command-line flags to the corresponding build tool. The "unsafe" here implies that SwiftPM can't safely determine if the build flags will have any negative side-effect to the build since certain flags can change the behavior of how a build is performed. It is similar to how the `-Xcc`, `-Xswiftc`, `-Xlinker` option work in the command-line SwiftPM tools.
6880

0 commit comments

Comments
 (0)