Skip to content

Commit 916e093

Browse files
IdanHolinusg
authored andcommitted
Documentation: Add Kernel/Userland quick switch to CLion configuration
1 parent da1c3c5 commit 916e093

3 files changed

+21
-0
lines changed

Documentation/CLionConfiguration.md

+21
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,27 @@ following options under `Settings -> Editor -> Code Style -> C/C++`:
5656

5757
![Screenshot of Naming Convention settings](./CLion_Naming_Convention.png)
5858

59+
## Quick switching between Kernel and Userland targets
60+
61+
In order to let CLion know what kind of code you're currently working on (Kernel / Userland) to make sure it parses and displays the correct half of statements like this:
62+
```c++
63+
#ifdef KERNEL
64+
...
65+
#else
66+
...
67+
#endif
68+
```
69+
You need to add build configurations for each:
70+
71+
Click on one of the buttons below (top right of the IDE) - If you have the second one, press Edit Configurations after the dropdown box opens, then press CTRL+A to select the 1000s of automatically generated targets, and then press Delete to remove them.
72+
73+
![Add Configuration...](CLion_Add_Configuration.png)
74+
![Kernel | Default](CLion_Add_Configuration_Existing.png)
75+
76+
Then press the `+` button to add a new configuration, select `CMake Application`, name the configuration `Kernel`, set the target to `Kernel` (typing while the dropdown box is open searches), and then repeat the process one more time, this time with the name being `Userland` and the target being `true`.
77+
78+
Finally, to quickly switch between the two different contexts, simply click the `Kernel | Default` / `Userland | Default` button to switch.
79+
5980
## Notes for WSL Users
6081

6182
It is possible to set the embedded terminal in CLion to the one that your WSL distribution provides.
1.94 KB
Loading
Loading

0 commit comments

Comments
 (0)