Robotics StackExchange | Archived questions

How can I tell Colcon about another CMake-based framework?

I'm playing around with ros2arduino and want to have it be a part of the build process like any other node, so I'm trying to set up Arduino-CMake to work with the Colcon build process. Looking through the documentation, it looks like I have to use a colcon.pkg with something like this:

{
  "CMAKE_TOOLCHAIN_FILE": "/my/path/to/Arduino-CMake-Framework/Arduino-Toolchain.cmake"
}

because I want to pass an argument like -DCMAKE_TOOLCHAIN_FILE=/my/path/to/Development/Arduino-CMake-Framework/Arduino-Toolchain.cmake if I was simply calling the equivalent cmake command. But, there's no reference to the cmake variable CMAKE_TOOLCHAIN_FILE when I use this colcon.pkg setup. Unless I have to explicitly tell Colcon about the colcon.pkg? The documentation made it seem like it should detect its presence.

Thanks in advance!

Asked by rnvandemark on 2019-08-31 13:04:45 UTC

Comments

Answers

Please see the colcon documentation about colcon.pkg files: https://colcon.readthedocs.io/en/released/user/configuration.html#colcon-pkg-files

If you would pass the argument on the command line you would involve it with --cmake-args -DCMAKE_TOOLCHAIN_FILE=.... therefore your yaml file must look like this:

{
  "cmake-args": ["-DCMAKE_TOOLCHAIN_FILE=..."]
}

Asked by Dirk Thomas on 2019-09-01 11:25:08 UTC

Comments

Since a toolchain file usually applies to multiple packages it is commonly passed on the command line though.

Asked by Dirk Thomas on 2019-09-01 11:27:05 UTC