mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-23 04:04:54 +08:00
cmake: Add option to build sample
This commit is contained in:
parent
690990ccb0
commit
61a914cd88
@ -3,6 +3,8 @@ project(serial)
|
|||||||
## Options
|
## Options
|
||||||
# Use Catkin (disabled by default)
|
# Use Catkin (disabled by default)
|
||||||
option(USE_CATKIN off)
|
option(USE_CATKIN off)
|
||||||
|
# Build serial sample
|
||||||
|
option(BUILD_SAMPLE on)
|
||||||
|
|
||||||
# Find catkin
|
# Find catkin
|
||||||
if(USE_CATKIN)
|
if(USE_CATKIN)
|
||||||
@ -60,10 +62,15 @@ else()
|
|||||||
target_link_libraries(${PROJECT_NAME} setupapi)
|
target_link_libraries(${PROJECT_NAME} setupapi)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
## Uncomment for example
|
## Include headers
|
||||||
add_executable(serial_example examples/serial_example.cc)
|
|
||||||
add_dependencies(serial_example ${PROJECT_NAME})
|
|
||||||
target_link_libraries(serial_example ${PROJECT_NAME})
|
## Example
|
||||||
|
if(BUILD_SAMPLE)
|
||||||
|
add_executable(serial_example examples/serial_example.cc)
|
||||||
|
add_dependencies(serial_example ${PROJECT_NAME})
|
||||||
|
target_link_libraries(serial_example ${PROJECT_NAME})
|
||||||
|
endif()
|
||||||
|
|
||||||
## Include headers
|
## Include headers
|
||||||
include_directories(include)
|
include_directories(include)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user