1
0
mirror of https://github.com/wjwwood/serial.git synced 2026-01-23 04:04:54 +08:00

make example optional in CMake

This commit is contained in:
Perry Naseck 2022-12-14 12:05:23 -05:00
parent a59a81fd82
commit bda4ba7f1e
No known key found for this signature in database
GPG Key ID: 306D6025E0D69537

View File

@ -65,10 +65,12 @@ else()
target_link_libraries(${PROJECT_NAME} setupapi)
endif()
## Uncomment for example
add_executable(serial_example examples/serial_example.cc)
add_dependencies(serial_example ${PROJECT_NAME})
target_link_libraries(serial_example ${PROJECT_NAME})
option(SERIAL_ENABLE_EXAMPLE "Enable example" ON)
if(${SERIAL_ENABLE_EXAMPLE})
add_executable(serial_example examples/serial_example.cc)
add_dependencies(serial_example ${PROJECT_NAME})
target_link_libraries(serial_example ${PROJECT_NAME})
endif()