Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
37 lines (35 sloc) 1.16 KB
macro (rospack VAR)
if(NOT ${VAR}_CACHED)
execute_process(COMMAND /usr/bin/env rospack ${ARGN}
OUTPUT_VARIABLE ${VAR}
ERROR_VARIABLE rospack_error
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(rospack_error)
message(STATUS "Is your path setup correctly for ROS?\nrospack failed:${rospack_error}")
else()
unset(${VAR}_NOTFOUND)
separate_arguments(${VAR} UNIX_COMMAND ${${VAR}})
set(${VAR} ${${VAR}} CACHE STRING "${VAR} value")
set(${VAR}_CACHED TRUE CACHE BOOL "${VAR} cached flag")
#message(STATUS "Found ${VAR}.")
endif()
else()
#message(STATUS "BANG! Using cached ${VAR}")
endif()
endmacro()
macro (find_ros_package NAME)
rospack(${NAME}_INCLUDES cflags-only-I ${NAME})
if(rospack_error)
else()
set(${NAME}_FOUND TRUE)
include_directories(${${NAME}_INCLUDES})
rospack(${NAME}_DEFINITIONS cflags-only-other ${NAME})
foreach(DEF ${${NAME}_DEFINITIONS})
add_definitions(" ${DEF}")
endforeach()
rospack(${NAME}_LIBRARY_DIRS libs-only-L ${NAME})
rospack(${NAME}_LIBRARIES libs-only-l ${NAME})
link_directories(${${NAME}_LIBRARY_DIRS})
endif()
endmacro()