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
- Minor changes for disambiguation around ##building-projects
- Updated examples for IAR_INSTALL_DIR
- Updated *notes* for IAR_INSTALL_DIR
- Updated ###configuring-the-build-system-generator
* Update [__IAR_INSTALL_DIR__](examples/iar-toolchain.cmake#L14) to point to the location where the corresponding IAR tools are __installed__ on __your__ system:
> * If the __IAR_INSTALL_DIR__ contains blank spaces, it might be necessary to escape them using backslashes `\ ` or, instead, use `\\`.
58
-
> * __Do not__ include `<arch>/bin` on the __IAR_INSTALL_DIR__ variable. The `<arch>` will be automatically added in the [__TOOLKIT_DIR__](https://github.com/IARSystems/cmake-tutorial/blob/1.0.0/examples/iar-toolchain.cmake#L17) variable using __CMAKE_SYSTEM_PROCESSOR__. The `/bin` sub-directory will be hardcoded to the ephemeral `PATH` environment variable used internally while CMake is running.
41
+
* Update [__IAR_INSTALL_DIR__](examples/iar-toolchain.cmake#L14) to match the corresponding location where the active product was __installed__ on __your__ system, adjusting as needed. Below you will find some general examples for Windows and Linux:
42
+
43
+
| IAR_INSTALL_DIR example for | Windows tools | Linux tools |
| a typical installation location |`"C:/Program\ Files/IAR\ Systems/Embedded\ Workbench\ N.n"`|`"/opt/iarsystems/bxarm"`|
46
+
| a custom installation location |`"C:/IAR_Systems/EWARM/N.nn.n"`| Not applicable |
47
+
48
+
> __Notes on IAR_INSTALL_DIR__
49
+
> * Replace `N.nn` by the active product's corresponding version.
50
+
> * If the path contains blank spaces, escape them with backslashes (`\ `).
51
+
> * The [__TOOLKIT_DIR__](https://github.com/IARSystems/cmake-tutorial/blob/1.0.0/examples/iar-toolchain.cmake#L17) is a variable that points to the directory of the active product. (e.g. `"${IAR_INSTALL_DIR}/${CMAKE_SYSTEM_PROCESSOR}"`).
52
+
> * The __TOOLKIT_DIR__ variable is used to set the [PATH](https://github.com/IARSystems/cmake-tutorial/blob/1.0.0/examples/iar-toolchain.cmake#L20-L24) environment variable with the `bin` directory so that the compiler can be found on the search path. Setting the PATH with this method lasts for the time CMake is running.
59
53
60
54
* When using the __IAR Assembler__ for `430`, `8051`, `avr` or `v850` architecture, update [__CMAKE_ASM_COMPILER__](examples/iar-toolchain.cmake#L29) to:
61
55
>`"a${CMAKE_SYSTEM_PROCESSOR}"`
62
56
63
57
64
-
### Generate a <i>Project Buildsystem</i>
65
-
The general syntax to generate the input files for a native build system is:
Once the toolchain file is modified, the next step for when cross-compiling with CMake is the configuration step. Among other possibilities, here is possible to choose which _build system generator_ and _toolchain file_ should be used for a project. A project is defined by one or more CMakeLists.txt file(s). Details about these files can be found in the [examples](#examples) section.
60
+
61
+
The simplified general syntax for the configuration step is: `cmake -G <generator> -B <build-dir> --toolchain <file>`.
|`--toolchain`| Specify the toolchain file `[CMAKE_TOOLCHAIN_FILE]`|
75
68
76
-
In this example we will use the __Ninja__ generator. Once the toolchain file is modified, inside each example's __architecture__ subdirectory, use the following command to generate the build scripts in the `_builds` sub-directory:
69
+
>:bulb: Use `cmake --help` for more information.
70
+
71
+
In this example we will take advantage of the `"Ninja Multi-Config"` generator option. This option can be used to generate build configurations for "Debug" and "Release" purposes. From inside each example's __architecture__ subdirectory you will find a corresponding CMakeLists.txt. From that location, use the following command to generate the scripts for the build system in the `_builds` sub-directory:
>-- The C compiler identification is IAR <ARCH> <VERSION>
77
+
>-- The C compiler identification is IAR <ARCH> N.nn
83
78
>-- Detecting C compiler ABI info
84
79
>-- Detecting C compiler ABI info - done
85
80
>-- Check for working C compiler: C:/<install-path>/<arch>/bin/icc<arch>.exe - skipped
@@ -90,15 +85,13 @@ The expected output is similar to:
90
85
>-- Build files have been written to: C:/<...>/cmake-tutorial/examples/<example>/<arch>/_builds
91
86
>```
92
87
93
-
>:warning: Once the `_builds` is configured, there is no need to re-run the configuration step, except if there are changes to the toolchain file.
88
+
>:bulb: Once the `_builds` is configured, there is no need to re-run the configuration step, except if there are changes to the toolchain file.
94
89
95
-
>:warning: If for some reason the configuration step fails, try removing the `_builds` subdirectory before running it again, in order to avoid any potential cache misses.
90
+
>:warning: If for some mistake the configuration step fails (e.g. wrong option, wrong selection, etc.), it might be necessary to remove the `_builds` subdirectory before trying again. This helps CMake to avoid potential cache misses interfering during a new attempt.
96
91
97
92
### Build the project
98
-
The general syntax to __build__ a project through CMake is:
0 commit comments