| 1 | # Targets |
| 2 | set(cpp_sources ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.cpp CACHE INTERNAL "List of cpp sources" ) |
| 3 | set(cpp_headers ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.hpp CACHE INTERNAL "List of cpp headers" ) |
| 4 | |
| 5 | # Includes |
| 6 | include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR} |
| 7 | ${CMAKE_CURRENT_SOURCE_DIR} |
| 8 | ${PROJECT_SOURCE_DIR}/src |
| 9 | ) |
| 10 | |
| 11 | include_directories(${Boost_INCLUDE_DIRS}) |
| 12 | |
| 13 | # Shared library |
| 14 | add_library(ftdipp1 SHARED ${cpp_sources}) |
| 15 | |
| 16 | math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1") # Compatibility with previous releases |
| 17 | set_target_properties(ftdipp1 PROPERTIES VERSION ${VERSION_FIXUP}.${MINOR_VERSION}.0 SOVERSION 3) |
| 18 | |
| 19 | # Prevent clobbering each other during the build |
| 20 | set_target_properties(ftdipp1 PROPERTIES CLEAN_DIRECT_OUTPUT 1) |
| 21 | |
| 22 | # Dependencies |
| 23 | target_link_libraries(ftdipp1 ftdi1 ${LIBUSB_LIBRARIES} ${BOOST_LIBRARIES}) |
| 24 | |
| 25 | install ( TARGETS ftdipp1 |
| 26 | RUNTIME DESTINATION bin |
| 27 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} |
| 28 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} |
| 29 | ) |
| 30 | |
| 31 | # Static library |
| 32 | if ( STATICLIBS ) |
| 33 | add_library(ftdipp1-static STATIC ${cpp_sources}) |
| 34 | set_target_properties(ftdipp1-static PROPERTIES OUTPUT_NAME "ftdipp1") |
| 35 | set_target_properties(ftdipp1-static PROPERTIES CLEAN_DIRECT_OUTPUT 1) |
| 36 | |
| 37 | install ( TARGETS ftdipp1-static |
| 38 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} |
| 39 | COMPONENT staticlibs |
| 40 | ) |
| 41 | endif () |
| 42 | |
| 43 | install ( FILES ${cpp_headers} |
| 44 | DESTINATION include/${PROJECT_NAME} |
| 45 | COMPONENT headers |
| 46 | ) |