代码拉取完成,页面将自动刷新
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()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。