Open-CMSIS-Pack / devtools

Open-CMSIS-Pack development tools - C++
Apache License 2.0
74 stars 57 forks source link

Question on cbuild / Cmake process #1541

Closed ReinhardKeil closed 4 months ago

ReinhardKeil commented 4 months ago

This question is related to #1540

When using cbuild with option --debug my output shows two CMake calls:

cmake.exe -G Ninja -S C:\Test\USBD\tmp -B C:\Test\USBD\tmp -Wdev
cmake.exe --build C:\Test\USBD\tmp -j 8 --target all

Q1: Are these CMake calls exactly the same as without the option --debug? Q2: Do we always need the call cmake.exe -G Ninja -S C:\Test\USBD\tmp -B C:\Test\USBD\tmp -Wdev? It seems to setup the environment.

jkrech commented 4 months ago

To my understanding cmake always works in these two steps. The question is, whether cmake recognizes, if any of the configuration input changed to decide whether or not to re-generate the files used by ninja to build. This way a rebuild with only one source module being changed should not need to do anything during the first step.

brondani commented 4 months ago

It is CMake itself that checks the presence and validity of a cached CMake setup and skip the steps that are not needed. cbuild does not make any assumption about the CMake cache presence or status. For this reason both calls are mandatory and have in practice no impact on performance.