Add cmake-init-include target property#2432
Conversation
|
The change to |
|
Hi Edward, thanks for your feedback. The problem you identify is solved with the companion PR here: lf-lang/reactor-c#494 It adds back the quotation marks when they are defined as compiler flags. So the change is subtle, basically it only means that the CMake variable does not have the quotation marks and can thus conveniently be used in the |
f708f10 to
5393d17
Compare
|
@edwardalee I propose we merge this. Especially the changes to the CMake variables are very useful. |
edwardalee
left a comment
There was a problem hiding this comment.
LGTM, modulo:
- get tests to pass
- merge lf-lang/reactor-c#494 (review)
- document the new target property in lf-lang.org.
This PR adds a new target property called
cmake-init-include(I am open to other naming suggestions). You can pass it a list of paths to cmake files, which will be included in the generated CMakeLists.txt at the very beginning, before theproject(statement.I am also removing the quotation marks on the LF_SOURCE_DIRECTORY compile def. The quotation mark makes it awkward to use it in the included cmake files, which is where they are likely to be used the most.
This means that the user can override the TOOLCHAIN_FILE cmake variable and can easily set up cross-compilation.
This PR enables STM32F4 support without piling on more platform and build logic into lfc but instead requiring the user to configure CMake correctly and add the right paths, compile defs and options.
In this PR I use the target property to enable cross compiling for STM32: lf-lang/stm32-nucleo-f446re-template#1
This PR is blocking #2185