Skip to content

Commit 806f3a6

Browse files
authored
Update README.md
Be more explicit about requirements for Windows. Add the need for Swift flags with CMake on WIndows. Add explicit content for Windows and macOS and Linux. This should clear up the confusion for people not familiar with the use of CMake for Swift.
1 parent 7748017 commit 806f3a6

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

Diff for: HelloWorld/README.md

+25-5
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,32 @@ and android).
1919
If `swiftc` is not in your path, you will need to add `-DCMAKE_Swift_COMPILER=`
2020
with the path to swiftc.
2121

22-
```sh
23-
cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=YES
24-
cd build
25-
ninja
26-
ninja test
22+
<details>
23+
<summary>Linux or macOS</summary>
24+
25+
26+
```bash
27+
cmake -B build -D CMAKE_BUILD_TYPE=RelWithDebInfo -D BUILD_TESTING=YES -G Ninja -S .
28+
ninja -C build
29+
ninja -C build test
30+
```
31+
</details>
32+
33+
<details>
34+
<summary>Windows</summary>
35+
36+
> **NOTE:** we must build with the Release configuration on Windows as the Swift runtime
37+
> in debug configuration is not distributed with the standard toolchain. MSVCRT cannot
38+
> be used in different configurations in the same process, and will result in runtime
39+
> failures.
40+
41+
```cmd
42+
set SWIFTFLAGS=-sdk %SDKROOT%
43+
cmake -B build -D CMAKE_BUILD_TYPE=Release -D BUILD_TESTING=YES -G Ninja -S .
44+
ninja -C build
45+
ninja -C build test
2746
```
47+
</details>
2848

2949
This invocation builds the project in release mode with debug information. This
3050
enables optimized builds with debug information. Additionally, the standard

0 commit comments

Comments
 (0)