1 Star 0 Fork 0

wanquan1117/serial

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CMakeLists.txt 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
zhaoxiangli 提交于 2022-06-24 10:51 . upload serial ros2 foxy node
cmake_minimum_required(VERSION 3.5)
project(serial)
find_package(ament_cmake REQUIRED)
ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})
## Sources
## Add serial library
add_library(${PROJECT_NAME} SHARED
src/serial.cc
include/serial/serial.h
include/serial/v8stdint.h
)
if(APPLE) # macOS
find_library(IOKIT_LIBRARY IOKit)
find_library(FOUNDATION_LIBRARY Foundation)
target_sources(${PROJECT_NAME} PRIVATE
src/impl/unix.cc
src/impl/list_ports/list_ports_osx.cc
)
target_link_libraries(${PROJECT_NAME} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY})
elseif(UNIX) # .*nix
target_sources(${PROJECT_NAME} PRIVATE
src/impl/unix.cc
src/impl/list_ports/list_ports_linux.cc
)
target_link_libraries(${PROJECT_NAME} rt pthread)
elseif(WIN32) # Windows
target_sources(${PROJECT_NAME} PRIVATE
src/impl/win.cc
src/impl/list_ports/list_ports_win.cc
)
target_link_libraries(${PROJECT_NAME} setupapi)
ament_export_libraries(setupapi)
endif()
## Include headers
target_include_directories(${PROJECT_NAME} PRIVATE include)
## Uncomment for example
# add_executable(serial_example examples/serial_example.cc)
# add_dependencies(serial_example ${PROJECT_NAME})
# target_link_libraries(serial_example ${PROJECT_NAME})
## Install executable
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
## Install headers
install(FILES include/serial/serial.h include/serial/v8stdint.h
DESTINATION include/serial
)
## Tests
#if(BUILD_TESTING)
# add_subdirectory(tests)
#endif()
ament_package()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wanquan1117/serial.git
git@gitee.com:wanquan1117/serial.git
wanquan1117
serial
serial
foxy

搜索帮助