Is it possible to have an out-of-tree msg directory that is also compiled in with the normal Firmware/msg directory?
In order to still keep rebasing “easy” when I rebase on the PX4/Firmware repo, I don’t want to make unnecessary changes within the Firmware files to get my stuff to compile. In the same way as one can add out-of-tree modules to the compilation, is it possible to add out-of-tree uORB message definitions?
What I have done until now is modified the Firmware/msg/CMakeLists.txt file and added the following line in order to allow me to somewhat achieve my goal, but it still feels a bit ‘hacked’:
add_subdirectory(<path_to_out_of_tree_msg_directory> ${CMAKE_CURRENT_BINARY_DIR}/<out_of_tree_msg/directory>)
And then in my out-of-tree msg directory I simply append to the msg_files variable that was set in Firmware/msg.CMakeLists. Contents of the out-of-tree msg CMakeLists
set(additional_msg_files
message1.msg
message2.msg
message3.msg
)
# Add each of the external message files to the global msg_files list
foreach(additional_msg_file ${additional_msg_files})
list(APPEND msg_files ${CMAKE_CURRENT_SOURCE_DIR}/${additional_msg_file})
endforeach()
# Set the msg_files variable in the parent scope to new msg_files list
set(msg_files ${msg_files} PARENT_SCOPE)
The rest of the compilation of the uORB headers and sources is then handled by the normal Firmware/msg/CMakeLists.txt file and the compiled messages appear in the /uORB/topics/ directory.