Skip to content

Commit 4ee0972

Browse files
will-v-pilurch
andauthored
Use platform/generator agnostic CMake commands (#2539)
* Use platform/generator agnostic CMake commands Change the README to use platform/generator agnostic commands to create and build the CMake project * review fixup * Apply suggestions from code review Co-authored-by: Andrew Scheller <[email protected]> * Whitespace fix --------- Co-authored-by: Andrew Scheller <[email protected]>
1 parent 214c243 commit 4ee0972

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,11 @@ instructions for other platforms, and just in general, we recommend you see [Ras
177177
1. Setup a CMake build directory.
178178
For example, if not using an IDE:
179179
```
180-
$ mkdir build
181-
$ cd build
182-
$ cmake ..
183-
```
180+
$ cmake -S . -B build
181+
```
182+
> The cmake -S flag indicates the source directory, and the -B flag tells cmake the name of the output-directory to create. This doesn't have to be named "build", you can call it whatever you want.
184183
185-
When building for a board other than the Raspberry Pi Pico, you should pass `-DPICO_BOARD=board_name` to the `cmake` command above, e.g. `cmake -DPICO_BOARD=pico2 ..` or `cmake -DPICO_BOARD=pico_w ..` to configure the SDK and build options accordingly for that particular board.
184+
When building for a board other than the Raspberry Pi Pico, you should pass `-DPICO_BOARD=board_name` to the `cmake` command above, e.g. `cmake -S . -B build -DPICO_BOARD=pico2` or `cmake -S . -B build -DPICO_BOARD=pico_w` to configure the SDK and build options accordingly for that particular board.
186185
187186
Specifying `PICO_BOARD=<boardname>` sets up various compiler defines (e.g. default pin numbers for UART and other hardware) and in certain
188187
cases also enables the use of additional libraries (e.g. wireless support when building for `PICO_BOARD=pico_w`) which cannot
@@ -193,8 +192,9 @@ instructions for other platforms, and just in general, we recommend you see [Ras
193192
194193
1. Make your target from the build directory you created.
195194
```sh
196-
$ make hello_world
195+
$ cmake --build build --target hello_world
197196
```
197+
> The directory-name supplied to the `--build` flag needs to match the directory-name that was passed to the `-B` flag in the earlier cmake command.
198198
199199
1. You now have `hello_world.elf` to load via a debugger, or `hello_world.uf2` that can be installed and run on your Raspberry Pi Pico-series device via drag and drop.
200200

0 commit comments

Comments
 (0)