fix:add generate_messages dependencies in CMakeLists when the Livox-SDK lib not be found

This commit is contained in:
Livox-SDK
2019-05-05 15:21:25 +08:00
parent c0ae1fd139
commit ad565df2d6

View File

@@ -64,8 +64,7 @@ find_package(Boost REQUIRED COMPONENTS thread)
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) ## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)
## Generate messages in the 'msg' folder ## Generate messages in the 'msg' folder
add_message_files( add_message_files(FILES
FILES
CustomPoint.msg CustomPoint.msg
CustomMsg.msg CustomMsg.msg
# Message2.msg # Message2.msg
@@ -86,8 +85,7 @@ add_message_files(
# ) # )
## Generate added messages and services with any dependencies listed here ## Generate added messages and services with any dependencies listed here
generate_messages( generate_messages(DEPENDENCIES
DEPENDENCIES
std_msgs std_msgs
) )
@@ -120,11 +118,8 @@ generate_messages(
## LIBRARIES: libraries you create in this project that dependent projects also need ## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need ## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need ## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package( catkin_package(CATKIN_DEPENDS
# INCLUDE_DIRS include roscpp rospy std_msgs message_runtime
# LIBRARIES lidar_sdk
CATKIN_DEPENDS roscpp rospy std_msgs message_runtime
# DEPENDS system_lib
) )
########### ###########
@@ -134,7 +129,6 @@ catkin_package(
## Specify additional locations of header files ## Specify additional locations of header files
## Your package locations should be listed before other locations ## Your package locations should be listed before other locations
include_directories( include_directories(
#include
${catkin_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS}
#${PCL_INCLUDE_DIRS} #${PCL_INCLUDE_DIRS}
) )
@@ -197,15 +191,13 @@ if((NOT LIVOX_SDK_LIBRARY) OR (NOT EXISTS ${LIVOX_SDK_LIBRARY}))
link_directories( link_directories(
./lib_backup ./lib_backup
) )
# link_directories(
#
# )
## add lidar project here ## add lidar project here
add_executable(${PROJECT_LIDAR}_node add_executable(${PROJECT_LIDAR}_node
${PROJECT_LIDAR_SRC} ${PROJECT_LIDAR_SRC}
) )
#add_dependencies(${PROJECT_LIDAR}_node liblivox_sdk_static.a) add_dependencies(${PROJECT_LIDAR}_node ${PROJECT_NAME}_generate_messages_cpp)
target_link_libraries(${PROJECT_LIDAR}_node target_link_libraries(${PROJECT_LIDAR}_node
livox_sdk_static.a livox_sdk_static.a
@@ -220,6 +212,8 @@ if((NOT LIVOX_SDK_LIBRARY) OR (NOT EXISTS ${LIVOX_SDK_LIBRARY}))
${PROJECT_HUB_SRC} ${PROJECT_HUB_SRC}
) )
add_dependencies(${PROJECT_LIDAR}_node ${PROJECT_NAME}_generate_messages_cpp)
target_link_libraries(${PROJECT_HUB}_node target_link_libraries(${PROJECT_HUB}_node
livox_sdk_static.a livox_sdk_static.a
${APR_LIBRARIES} ${APR_LIBRARIES}
@@ -236,7 +230,7 @@ else()
${PROJECT_LIDAR_SRC} ${PROJECT_LIDAR_SRC}
) )
add_dependencies(${PROJECT_LIDAR}_node livox_ros_driver_generate_messages_cpp) add_dependencies(${PROJECT_LIDAR}_node ${PROJECT_NAME}_generate_messages_cpp)
target_link_libraries(${PROJECT_LIDAR}_node target_link_libraries(${PROJECT_LIDAR}_node
livox_sdk_static.a livox_sdk_static.a
@@ -251,7 +245,7 @@ else()
${PROJECT_HUB_SRC} ${PROJECT_HUB_SRC}
) )
add_dependencies(${PROJECT_HUB}_node livox_ros_driver_generate_messages_cpp) add_dependencies(${PROJECT_HUB}_node ${PROJECT_NAME}_generate_messages_cpp)
target_link_libraries(${PROJECT_HUB}_node target_link_libraries(${PROJECT_HUB}_node
livox_sdk_static.a livox_sdk_static.a