forked from mkrainin/ecto_corrector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rosbuild_lite.cmake
36 lines (35 loc) · 1.16 KB
/
rosbuild_lite.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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()