Install example config for ftdi_eeprom in docdir
[libftdi] / ftdi_eeprom / CMakeLists.txt
CommitLineData
c4c9f0ae
TJ
1# determine docdir
2include(GNUInstallDirs)
3if(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)
9endif(NOT CMAKE_INSTALL_DOCDIR)
a9dddb4d
TJ
10
11option(FTDI_EEPROM "Build ftdi_eeprom" ON)
12
602adb25
MZ
13if ( FTDI_EEPROM )
14 find_package ( Confuse )
438d977e 15 find_package ( Libintl )
602adb25
MZ
16else(FTDI_EEPROM)
17 message(STATUS "ftdi_eeprom build is disabled")
18endif ()
a9dddb4d 19
a9dddb4d 20
602adb25
MZ
21if ( CONFUSE_FOUND )
22 message(STATUS "Building ftdi_eeprom")
ade814a5 23
e043da42 24 include_directories ( ${CONFUSE_INCLUDE_DIRS} )
602adb25 25 list ( APPEND libs ${CONFUSE_LIBRARIES} )
c4c9f0ae 26
e043da42 27 if ( LIBINTL_FOUND )
28 include_directories ( ${LIBINTL_INCLUDE_DIR} )
29 list ( APPEND libs ${LIBINTL_LIBRARIES} )
30 endif ()
ade814a5 31
c4c9f0ae 32
602adb25
MZ
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} )
a9dddb4d 37
602adb25
MZ
38 include_directories ( BEFORE ${CMAKE_SOURCE_DIR}/src )
39 include_directories ( BEFORE ${CMAKE_CURRENT_BINARY_DIR} )
af7a35fe 40
602adb25
MZ
41 configure_file(
42 ftdi_eeprom_version.h.in
43 ${CMAKE_CURRENT_BINARY_DIR}/ftdi_eeprom_version.h
44 )
a9dddb4d 45
602adb25 46 add_executable ( ftdi_eeprom main.c )
e043da42 47 target_link_libraries ( ftdi_eeprom ftdi1 ${CONFUSE_LIBRARIES} )
48 if ( LIBINTL_FOUND )
49 target_link_libraries ( ftdi_eeprom ${LIBINTL_LIBRARIES} )
50 endif ()
602adb25 51 install ( TARGETS ftdi_eeprom DESTINATION bin )
c4c9f0ae 52 install ( FILES example.conf DESTINATION ${CMAKE_INSTALL_DOCDIR} )
602adb25
MZ
53else ()
54 message ( STATUS "libConfuse not found, won't build ftdi_eeprom" )
55endif ()