eg:
CMake Error at CMakeLists.txt:12 (find_package):
By not providing "Findserial.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "serial", but
CMake did not find one.
Could not find a package configuration file provided by "serial" with any
of the following names:
serialConfig.cmake
serial-config.cmake
Add the installation prefix of "serial" to CMAKE_PREFIX_PATH or set
"serial_DIR" to a directory containing one of the above files. If "serial"
provides a separate development package or SDK, be sure it has been
installed.
(1)缺少serial包
(2)cmake配置路径不正确
(3)库未正确安装
cmakelists第12行使用find_package(serial REQUIRED)查找serial包,但是没找到下面配置文件
serialConfig.cmake
serial-config.cmake
sudo updatedb
locate serialConfig.cmake
看终端是否返回路径,若无返回,则serial包没安装成功,继续步骤3;若返回路径,在cmakelist文件找包之前,设置相关路径,然后重新编译。
set(serial_DIR "/path/to/serial/cmake")
find_package(serial REQUIRED)
根据自己的ubuntu系统以及ros版本,可自行搜索下载指令
重复步骤2
若存在重新编译,编译若继续说配置文件不存在,按照步骤2设置配置文件路径;
若不存在,刚刚装的包可能不太对,重新安装相关包(具体可网上搜索应该安装哪个包)
三、手动编译
若各种安装之后还没没有cmake,则可选择手动编译
(1)进入你想要存放相关包的位置
(2)git clone相关包
(3)进入包路径
(4)手动编译
eg:
(1) cd ~/ros2_ws/src/common
(2) git clone https://github.com/xxxx/serial.git
(3) cd serial
(4) mkdir build && cd build
cmake ..
make -j$(nproc)
sudo make install