| 1 | # determine docdir |
| 2 | include(GNUInstallDirs) |
| 3 | if(NOT CMAKE_INSTALL_DOCDIR) |
| 4 | if(WIN32) |
| 5 | set(CMAKE_INSTALL_DOCDIR .) |
| 6 | else(WIN32) |
| 7 | set(CMAKE_INSTALL_DOCDIR ${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}) |
| 8 | endif(WIN32) |
| 9 | endif(NOT CMAKE_INSTALL_DOCDIR) |
| 10 | |
| 11 | option(FTDI_EEPROM "Build ftdi_eeprom" ON) |
| 12 | |
| 13 | if ( FTDI_EEPROM ) |
| 14 | find_package ( Confuse ) |
| 15 | find_package ( Libintl ) |
| 16 | else(FTDI_EEPROM) |
| 17 | message(STATUS "ftdi_eeprom build is disabled") |
| 18 | endif () |
| 19 | |
| 20 | |
| 21 | if ( CONFUSE_FOUND ) |
| 22 | message(STATUS "Building ftdi_eeprom") |
| 23 | |
| 24 | include_directories ( ${CONFUSE_INCLUDE_DIRS} ) |
| 25 | list ( APPEND libs ${CONFUSE_LIBRARIES} ) |
| 26 | |
| 27 | if ( LIBINTL_FOUND ) |
| 28 | include_directories ( ${LIBINTL_INCLUDE_DIR} ) |
| 29 | list ( APPEND libs ${LIBINTL_LIBRARIES} ) |
| 30 | endif () |
| 31 | |
| 32 | |
| 33 | # Version defines |
| 34 | set ( EEPROM_MAJOR_VERSION 0 ) |
| 35 | set ( EEPROM_MINOR_VERSION 17 ) |
| 36 | set ( EEPROM_VERSION_STRING ${EEPROM_MAJOR_VERSION}.${EEPROM_MINOR_VERSION} ) |
| 37 | |
| 38 | include_directories ( BEFORE ${CMAKE_SOURCE_DIR}/src ) |
| 39 | include_directories ( BEFORE ${CMAKE_CURRENT_BINARY_DIR} ) |
| 40 | |
| 41 | configure_file( |
| 42 | ftdi_eeprom_version.h.in |
| 43 | ${CMAKE_CURRENT_BINARY_DIR}/ftdi_eeprom_version.h |
| 44 | ) |
| 45 | |
| 46 | add_executable ( ftdi_eeprom main.c ) |
| 47 | target_link_libraries ( ftdi_eeprom ftdi1 ${CONFUSE_LIBRARIES} ) |
| 48 | if ( LIBINTL_FOUND ) |
| 49 | target_link_libraries ( ftdi_eeprom ${LIBINTL_LIBRARIES} ) |
| 50 | endif () |
| 51 | install ( TARGETS ftdi_eeprom DESTINATION bin ) |
| 52 | install ( FILES example.conf DESTINATION ${CMAKE_INSTALL_DOCDIR} ) |
| 53 | else () |
| 54 | message ( STATUS "libConfuse not found, won't build ftdi_eeprom" ) |
| 55 | endif () |