I'm trying to get a Rust hello world to build as part of a much larger catkin/cmake build. The relevant part of the relevant CMakeLists.txt
file is:
add_custom_target(_rtde_interface ALL)
set(CARGO_TARGET_DIR ${CMAKE_CURRENT_BINARY_DIR})
add_custom_command( TARGET _rtde_interface
PRE_BUILD
COMMAND cargo build
# WORKING_DIRECTORY ${CARGO_TARGET_DIR}/src/rtde_interface
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/rtde_interface
VERBATIM)
But Cargo is behaving as if the CARGO_TARGET_DIR variable is unset. If I set it in the shell before invoking Catkin the binary shows up in whatever directory I choose, and if I leave it unset in the shell it defaults to ${CMAKE_CURRENT_SOURCE_DIR}/src/rtde_interface/target/
, but the build results never get put in ${CMAKE_CURRENT_BINARY_DIR}
, and I don't know why. I have used the Cmake message
function to confirm that CMAKE_CURRENT_BINARY_DIR contains a real path...
Any ideas?