我尝试使用以下方式添加路径:
export PATH=<myPath>
export CPPFLAGS='-I<myPath>'
我尝试使用make -I=<myPath>
运行make。但是make仍然看不到hpp
个文件。
CmakeLists
:
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
rosbuild_init()
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
rosbuild_genmsg()
rosbuild_gensrv()
rosbuild_add_executable(add_two_ints_server src/add_two_ints_server.cpp)
rosbuild_add_executable(add_two_ints_client src/add_two_ints_client.cpp)
rosbuild_add_executable(data_sender src/data_sender.cpp)
rosbuild_add_executable(data_listener src/data_listener.cpp)
rosbuild_add_executable(dds_transfer src/dds_transfer.cpp)
MakeFile
:
include $(shell rospack find mk)/cmake.mk
答案 0 :(得分:0)
使用CMAKE_PREFIX_PATH
,这是CMake搜索库的路径。请参见示例https://stackoverflow.com/a/41909627/2799037