Fixed: Only one struct was generated

parent 6f9d44e2
......@@ -3,23 +3,22 @@ project (struct_msgs)
find_package(genmsg REQUIRED)
FILE(GLOB MSG_FILES_RAW RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ../*/roscpp/struct_msgs/*.msg)
FILE(GLOB MSG_FILES_RAW RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ../*/*/struct_msgs/*.msg)
#generate struct_msgs iff .msg files where found
if(MSG_FILES_RAW)
#filter: add each struct msg only once (distinct by filename without path)
foreach(CUR_MSG_FILE ${MSG_FILES_RAW})
get_filename_component(TMP_MSG_NAME ${CUR_MSG_FILE} NAME)
IF(NOT MSG_DEFINED_${TMP_MSG})
LIST(APPEND MSG_FILES ${CUR_MSG_FILE})
SET(MSG_DEFINED_${TMP_MSG} TRUE)
ENDIF()
endforeach(CUR_MSG_FILE)
#generate messages
add_message_files(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} FILES ${MSG_FILES})
generate_messages()
#filter: add each struct msg only once (distinct by filename without path)
foreach(CUR_MSG_FILE ${MSG_FILES_RAW})
get_filename_component(TMP_MSG_NAME ${CUR_MSG_FILE} NAME)
IF(NOT MSG_DEFINED_${TMP_MSG_NAME})
get_filename_component(DIR_${TMP_MSG_NAME} ${CUR_MSG_FILE} DIRECTORY)
add_message_files(DIRECTORY ${DIR_${TMP_MSG_NAME}} FILES ${TMP_MSG_NAME})
SET(MSG_DEFINED_${TMP_MSG_NAME} TRUE)
ENDIF()
endforeach(CUR_MSG_FILE)
#export the include_dirs, so that other subprojects can use it
set(struct_msgs_INCLUDE_DIRS ${struct_msgs_INCLUDE_DIRS} PARENT_SCOPE)
endif()
generate_messages()
#export the include_dirs, so that other subprojects can use it
set(struct_msgs_INCLUDE_DIRS ${struct_msgs_INCLUDE_DIRS} PARENT_SCOPE)
endif()
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment