当前位置: 代码迷 >> 综合 >> CMakelists 文件 bug记录
  详细解决方案

CMakelists 文件 bug记录

热度:41   发布时间:2024-02-13 18:46:02.0

小白学习,大神勿喷!

1 固定库指定

set(LCM_DIR    ${PROJECT_SOURCE_DIR}/include/lcmtype_dir)
set(LCMLAB_DIR  ${PROJECT_SOURCE_DIR}/include/lcmlib)include_directories(${LCM_DIR}${LCMLAB_DIR}
)

2 自己cpp文件为库文件

add_library(lcm_serversrc/GPSConversion.cppinclude/lcmtype_dir/laser_t.cppinclude/lcmtype_dir/pose_t.cppinclude/lcmtype_dir/robot_control_t.cpp
)target_link_libraries(lcm_send
lcm_server lcm pthread   
)

lcm_server 链接到自己的库上

ros opencv3 路径指定

set(OpenCV_DIR /opt/ros/kinetic/share/OpenCV-3.3.1-dev)
# find_package(OpenCV 3 REQUIRED)

设置为固定路径,代替find_package

下面链接opencv库是一样的

include_directories( ${OpenCV_INCLUDE_DIRS})
# target_link_libraries(${PROJECT_NAME}${OpenCV_LIBRARIES}  
)