[cmake-developers] Idea for Multi-Toolchain Support

Torsten Robitzki Torsten at Robitzki.de
Sat Dec 22 10:57:36 EST 2018


Hi,

> Am 17.12.2018 um 21:18 schrieb Kyle Edwards via cmake-developers <cmake-developers at cmake.org>:
> 
> Then, executables and libraries could have a toolchain specified:
> 
> add_executable(BuildUtility TOOLCHAIN DEFAULT ...)
> add_library(MyLibrary TOOLCHAIN CrossToolchain …)

or even toolchains:

    add_library(feature1 TOOLCHAINS CrossToolChain HostToolChain)

    add_executable(Firmware TOOLCHAIN CrossToolChain)
    target_link_libraries(Firmware feature1)

    add_executable(Test_Feature1 TOOLCHAIN HostToolChain)
    target_link_libraries(Test_Feature1 feature1)

A nice feature would be to let toolchain propagate along the dependency graph defined by `target_link_libraries`. So in the example above, the TOOLCHAINS option to `add_library` would be optional, because the target Firmware requires feature1 to be build with CrossToolChain and Test_Feature1 to be build with HostToolChain. Which requires the build to have different binary directories for every toolchain. (Which for me is an indication that having multidimensional build types would be the more natural way to go)

What I’m still missing is support to define dependencies between different targets (build by different toolchains), so that I can describe that I require a tool that is build with the HostToolChain, to generate a file that is required by the part of the build, that is using the CrossToolChain. And, of cause, if the source of that tool changes, that tool have to be rebuild and the generated file from the CrossToolChain part of the build have to be rebuild.

best regards,

Torsten
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <https://cmake.org/pipermail/cmake-developers/attachments/20181222/20bbde54/attachment.sig>


More information about the cmake-developers mailing list