Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix yarp_add_idl use when cross-compiling #2983

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions cmake/YarpIDL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,18 @@ function(YARP_ADD_IDL var)
message(FATAL_ERROR "Unknown extension ${ext}. Supported extensions are .thrift, .msg, and .srv")
endif()

# FIXME This should handle cross-compiling
set(YARPIDL_${family}_COMMAND YARP::yarpidl_${family})
if (CMAKE_CROSSCOMPILING)
find_program(YARPIDL_${family}_LOCATION
NAMES yarpidl_${family}
HINTS ${YARP_IDL_BINARY_HINT} # This is a list of directories defined
# in YarpOptions.cmake (for YARP) or in
# YARPConfig.cmake for dependencies
NO_DEFAULT_PATH
)
set(YARPIDL_${family}_COMMAND ${YARPIDL_${family}_LOCATION})
else()
set(YARPIDL_${family}_COMMAND YARP::yarpidl_${family})
endif()

# Set output directories and remove extra "/" and ensure that the directory
# exists.
Expand Down Expand Up @@ -603,7 +613,9 @@ function(YARP_ADD_IDL var)
endforeach()

if(NOT "${output}" STREQUAL "")
set(depends ${YARPIDL_${family}_COMMAND})
if(TARGET ${YARPIDL_${family}_COMMAND})
set(depends ${YARPIDL_${family}_COMMAND})
endif()
if(NOT native)
list(APPEND depends ${file})
endif()
Expand Down