Skip to content

Commit

Permalink
cmake: Add check MAVLINK_DIALECT value
Browse files Browse the repository at this point in the history
Fix #139.
  • Loading branch information
vooon committed Aug 28, 2014
1 parent 0e3e071 commit edb2c49
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions mavros/cmake/Modules/MavrosMavlink.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,29 @@
find_package(mavlink REQUIRED)

# fallback for older mavlink package.
if(NOT DEFINED mavlink_DIALECTS)
if (NOT DEFINED mavlink_DIALECTS)
list(APPEND mavlink_DIALECTS "ardupilotmega")
list(APPEND mavlink_DIALECTS "pixhawk")
list(APPEND mavlink_DIALECTS "common")
endif()
endif ()

# Select MAVLink dialect
set(MAVLINK_DIALECT "ardupilotmega" CACHE STRING "MAVLink dialect selector")
set_property(CACHE MAVLINK_DIALECT PROPERTY STRINGS ${mavlink_DIALECTS})

# TODO: check that selected dialect are known
# check that selected dialect are known
set(MAVLINK_DIALECT_KNOWN)
foreach (dialect ${mavlink_DIALECTS})
if (MAVLINK_DIALECT STREQUAL dialect)
set(MAVLINK_DIALECT_KNOWN TRUE)
endif ()
endforeach ()

message(STATUS "Selected MAVLink dialect: ${MAVLINK_DIALECT}")
if (MAVLINK_DIALECT_KNOWN)
message(STATUS "Selected MAVLink dialect: ${MAVLINK_DIALECT}")
else ()
message(FATAL_ERROR "Unknown MAVLink dialect: ${MAVLINK_DIALECT}, known dialects: ${mavlink_DIALECTS}")
endif ()

# define dialect for mavconn_mavlink.h
add_definitions(
Expand Down

2 comments on commit edb2c49

@TSC21
Copy link
Member

@TSC21 TSC21 commented on edb2c49 Aug 28, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vooon at this current stage, when issuing catkin_make on a ws, how do we define the MAVLINK_DIALECT in compile time? catkin_make DMAVLINK_DIALECT="pixhawk"?

@vooon
Copy link
Member Author

@vooon vooon commented on edb2c49 Aug 28, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, -D key. Or use cmake-gui build (from cmake-qt-gui package).

Please sign in to comment.