You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is an alternative ordering of the instructions where the configuring of the tools comes before the examples. Just discard this change if you don't like it!
Copy file name to clipboardExpand all lines: README.md
+57-61Lines changed: 57 additions & 61 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,67 +24,6 @@ The required tools are similar either if __Windows__ or __Linux__ is being used:
24
24
25
25
>:warning: In order to conveniently execute __cmake__ and __ninja__ from anywhere in your system, without specifying their respective full paths, make sure their locations are in the `PATH` variable of your operating system.
26
26
27
-
28
-
## Examples
29
-
In this section you will find examples on how `CMakeLists.txt` files can be created to build __executable__ targets as well as __library__ targets.
30
-
31
-
The examples work with all the architectures supported in CMake.
32
-
33
-
__CMake 3__ has been described as the beginning of the "Modern CMake" age. Since then, it has been advised to avoid variables in favor of targets and properties. The commands __add_compile_options()__, __include_directories()__, __link_directories()__, __link_libraries()__, that were at the core of __CMake 2__, should now be replaced by target-specific commands.
34
-
35
-
The __CMakeLists.txt__ in the examples use expressions that look like this `$<...>`. Those are the so-called [_generator expressions_][url-cm-docs-genex] (or _genex_, for short) and they allow us to express our intentions in many powerful ways.
36
-
37
-
>:warning: In order to get the all the examples, you can clone this repository __or__, if you want to get only the files from a single example, click on its respective link in the examples' titles and get it bundled in a __zip__ archive.
38
-
39
-
40
-
### Example 1 - [Mixing C and Assembly][url-repo-example1]
41
-
The [mix-c-asm](examples/mix-c-asm) project demonstrates the basic concepts on how to build a single executable target (__mixLanguages__) using __C__ and __Assembly__ sources.
42
-
43
-
It also shows:
44
-
* How to use __target_compile_definitions()__ to set preprocessor symbols that can be used in the target's sources.
45
-
*__Windows-only__: How to execute the target using the [IAR C-SPY Debugger Simulator][url-iar-docs-cspybat] via CTest.
46
-
47
-
Each `<arch>` has its own __CMakeLists.txt__. The file is located in the respective `<arch>` folder and has further comments. Below you will find the direct links to each of them:
Instructions for [building](#building-projects) and [testing](#testing-projects) these projects are provided below.
53
-
54
-
55
-
### Example 2 - [Creating and using libraries][url-repo-example2]
56
-
The [using-libs](examples/using-libs) project demonstrates some advanced features and how to build one executable target (__myProgram__) linked against a static library target (__myMath__) using __C__ sources.
57
-
58
-
It also shows:
59
-
* How to use __set_target_properties()__ to propagate configuration details across the target options.
60
-
* How to set __target_linker_options()__ to create a map file of the executable.
61
-
* How to use __add_custom_target()__ for executing `ielftool` and generate an `.ihex`|`.srec`|`.bin` output.
62
-
*__Windows-only__: How to execute the target using the [IAR C-SPY Debugger Simulator][url-iar-docs-cspybat] via CTest.
63
-
64
-
The __myMath__ library target is located in the __lib__ subdirectory. The library contains functions which take two integer parameters to perform basic arithmetic over them, returning another integer as result.
65
-
66
-
The __myProgram__ executable target is located in the __app__ subdirectory. The program performs arithmetic operations using the __myMath__'s library functions.
67
-
68
-
For each architecture, the project uses 3 __CMakeLists.txt__. These files have further comments.
69
-
70
-
* The __CMakeLists.txt__ in the __top-level__ directory:
>:warning: The __IAR C-SPY Debugger__ is only available on Windows.
264
203
265
204
205
+
## Examples
206
+
In this section you will find examples on how `CMakeLists.txt` files can be created to build __executable__ targets as well as __library__ targets.
207
+
208
+
The examples work with all the architectures supported in CMake.
209
+
210
+
__CMake 3__ has been described as the beginning of the "Modern CMake" age. Since then, it has been advised to avoid variables in favor of targets and properties. The commands __add_compile_options()__, __include_directories()__, __link_directories()__, __link_libraries()__, that were at the core of __CMake 2__, should now be replaced by target-specific commands.
211
+
212
+
The __CMakeLists.txt__ in the examples use expressions that look like this `$<...>`. Those are the so-called [_generator expressions_][url-cm-docs-genex] (or _genex_, for short) and they allow us to express our intentions in many powerful ways.
213
+
214
+
>:warning: In order to get the all the examples, you can clone this repository __or__, if you want to get only the files from a single example, click on its respective link in the examples' titles and get it bundled in a __zip__ archive.
215
+
216
+
217
+
### Example 1 - [Mixing C and Assembly][url-repo-example1]
218
+
The [mix-c-asm](examples/mix-c-asm) project demonstrates the basic concepts on how to build a single executable target (__mixLanguages__) using __C__ and __Assembly__ sources.
219
+
220
+
It also shows:
221
+
* How to use __target_compile_definitions()__ to set preprocessor symbols that can be used in the target's sources.
222
+
* __Windows-only__: How to execute the target using the [IAR C-SPY Debugger Simulator][url-iar-docs-cspybat] via CTest.
223
+
224
+
Each `<arch>` has its own __CMakeLists.txt__. The file is located in the respective `<arch>` folder and has further comments. Below you will find the direct links to each of them:
Instructions for [building](#building-projects) and [testing](#testing-projects) these projects are provided below.
230
+
231
+
232
+
### Example 2 - [Creating and using libraries][url-repo-example2]
233
+
The [using-libs](examples/using-libs) project demonstrates some advanced features and how to build one executable target (__myProgram__) linked against a static library target (__myMath__) using __C__ sources.
234
+
235
+
It also shows:
236
+
* How to use __set_target_properties()__ to propagate configuration details across the target options.
237
+
* How to set __target_linker_options()__ to create a map file of the executable.
238
+
* How to use __add_custom_target()__ for executing `ielftool` and generate an `.ihex`|`.srec`|`.bin` output.
239
+
* __Windows-only__: How to execute the target using the [IAR C-SPY Debugger Simulator][url-iar-docs-cspybat] via CTest.
240
+
241
+
The __myMath__ library target is located in the __lib__ subdirectory. The library contains functions which take two integer parameters to perform basic arithmetic over them, returning another integer as result.
242
+
243
+
The __myProgram__ executable target is located in the __app__ subdirectory. The program performs arithmetic operations using the __myMath__'s library functions.
244
+
245
+
For each architecture, the project uses 3 __CMakeLists.txt__. These files have further comments.
246
+
247
+
* The __CMakeLists.txt__ in the __top-level__ directory:
When executable targets are built with __debug information__, they can be debugged with the __IAR C-SPY Debugger__, directly from the __IAR Embedded Workbench__ IDE.
0 commit comments