| 1 | # Check |
| 2 | set(FTDI_BUILD_CPP False PARENT_SCOPE) |
| 3 | |
| 4 | # Includes |
| 5 | include_directories( ${CMAKE_CURRENT_BINARY_DIR} |
| 6 | ${CMAKE_CURRENT_SOURCE_DIR} |
| 7 | ${CMAKE_CURRENT_SOURCE_DIR}/../src |
| 8 | ) |
| 9 | |
| 10 | # Targets |
| 11 | set(cpp_sources ftdi.cpp) |
| 12 | set(cpp_headers ftdi.hpp) |
| 13 | |
| 14 | # Find Boost |
| 15 | find_package(Boost) |
| 16 | if(Boost_FOUND) |
| 17 | set(FTDI_BUILD_CPP True PARENT_SCOPE) |
| 18 | message(STATUS "Building libftdi++") |
| 19 | |
| 20 | # Targets |
| 21 | add_library(ftdi_cpp SHARED ${cpp_sources}) |
| 22 | |
| 23 | # Dependencies |
| 24 | target_link_libraries(ftdi_cpp ftdi usb ${BOOST_LIBRARIES}) |
| 25 | |
| 26 | # Install |
| 27 | if(${UNIX}) |
| 28 | |
| 29 | install( TARGETS ftdi_cpp |
| 30 | LIBRARY DESTINATION lib |
| 31 | COMPONENT sharedlibs |
| 32 | ) |
| 33 | |
| 34 | install( FILES ${cpp_headers} |
| 35 | DESTINATION include/${PROJECT_NAME} |
| 36 | COMPONENT headers |
| 37 | ) |
| 38 | |
| 39 | endif(${UNIX}) |
| 40 | |
| 41 | if(${WIN32}) |
| 42 | |
| 43 | install( TARGETS ftdi_cpp |
| 44 | DESTINATION bin |
| 45 | COMPONENT sharedlibs |
| 46 | ) |
| 47 | |
| 48 | install( FILES ${cpp_headers} |
| 49 | DESTINATION include/${PROJECT_NAME} |
| 50 | COMPONENT headers |
| 51 | ) |
| 52 | |
| 53 | endif(${WIN32}) |
| 54 | |
| 55 | else(Boost_FOUND) |
| 56 | message(STATUS "Boost not found, won't build libftdi++") |
| 57 | endif(Boost_FOUND) |
| 58 | |