| 1 | option(EXAMPLES "Build example programs" ON) |
| 2 | |
| 3 | if (EXAMPLES) |
| 4 | # Includes |
| 5 | include_directories( ${CMAKE_CURRENT_SOURCE_DIR} |
| 6 | ${CMAKE_CURRENT_BINARY_DIR} |
| 7 | ) |
| 8 | |
| 9 | message(STATUS "Building example programs.") |
| 10 | |
| 11 | # Targets |
| 12 | add_executable(simple simple.c) |
| 13 | add_executable(bitbang bitbang.c) |
| 14 | add_executable(bitbang2 bitbang2.c) |
| 15 | add_executable(bitbang_cbus bitbang_cbus.c) |
| 16 | add_executable(bitbang_ft2232 bitbang_ft2232.c) |
| 17 | add_executable(find_all find_all.c) |
| 18 | add_executable(serial_test serial_test.c) |
| 19 | add_executable(baud_test baud_test.c) |
| 20 | add_executable(stream_test stream_test.c) |
| 21 | add_executable(eeprom eeprom.c) |
| 22 | |
| 23 | # Linkage |
| 24 | target_link_libraries(simple ftdi1) |
| 25 | target_link_libraries(bitbang ftdi1) |
| 26 | target_link_libraries(bitbang2 ftdi1) |
| 27 | target_link_libraries(bitbang_cbus ftdi1) |
| 28 | target_link_libraries(bitbang_ft2232 ftdi1) |
| 29 | target_link_libraries(find_all ftdi1) |
| 30 | target_link_libraries(serial_test ftdi1) |
| 31 | target_link_libraries(baud_test ftdi1) |
| 32 | target_link_libraries(stream_test ftdi1) |
| 33 | target_link_libraries(eeprom ftdi1) |
| 34 | |
| 35 | # libftdi++ examples |
| 36 | if(FTDI_BUILD_CPP) |
| 37 | if(Boost_FOUND) |
| 38 | message(STATUS "Building libftdi++ examples.") |
| 39 | include_directories(BEFORE ${CMAKE_SOURCE_DIR}/ftdipp |
| 40 | ${Boost_INCLUDE_DIRS}) |
| 41 | |
| 42 | # Target |
| 43 | add_executable(find_all_pp find_all_pp.cpp) |
| 44 | |
| 45 | # Linkage |
| 46 | target_link_libraries(find_all_pp ftdipp1) |
| 47 | endif(Boost_FOUND) |
| 48 | endif(FTDI_BUILD_CPP) |
| 49 | |
| 50 | # Source includes |
| 51 | include_directories(BEFORE ${CMAKE_SOURCE_DIR}/src) |
| 52 | |
| 53 | else(EXAMPLES) |
| 54 | message(STATUS "Not building example programs.") |
| 55 | endif(EXAMPLES) |