38147b56ce0d7edee442738618d1071b40129837
[libftdi] / ftdi_eeprom / CMakeLists.txt
1 find_package(Confuse REQUIRED)
2 find_package(Libintl)
3
4 # determine docdir
5 include(GNUInstallDirs)
6 if (NOT CMAKE_INSTALL_DOCDIR)
7     if (WIN32)
8         set(CMAKE_INSTALL_DOCDIR .)
9     else (WIN32)
10         set(CMAKE_INSTALL_DOCDIR ${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME})
11     endif (WIN32)
12 endif (NOT CMAKE_INSTALL_DOCDIR)
13
14 message(STATUS "Building ftdi_eeprom")
15
16 include_directories(${CONFUSE_INCLUDE_DIRS})
17 list(APPEND libs ${CONFUSE_LIBRARIES})
18
19 if (LIBINTL_FOUND)
20     include_directories(${LIBINTL_INCLUDE_DIR})
21     list(APPEND libs ${LIBINTL_LIBRARIES})
22 endif ()
23
24
25 # Version defines
26 set(EEPROM_MAJOR_VERSION 0)
27 set(EEPROM_MINOR_VERSION 17)
28 set(EEPROM_VERSION_STRING ${EEPROM_MAJOR_VERSION}.${EEPROM_MINOR_VERSION})
29
30 include_directories(BEFORE ${PROJECT_SOURCE_DIR}/src)
31 include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
32
33 configure_file(
34         ftdi_eeprom_version.h.in
35         ${CMAKE_CURRENT_BINARY_DIR}/ftdi_eeprom_version.h
36 )
37
38 add_executable(ftdi_eeprom main.c)
39 if (NOT SHAREDLIBS AND STATICLIBS)
40     target_link_libraries(ftdi_eeprom ftdi1-static)
41 else()
42     target_link_libraries(ftdi_eeprom ftdi1)
43 endif ()
44 target_link_libraries(ftdi_eeprom ${CONFUSE_LIBRARIES})
45 if (LIBINTL_FOUND)
46     target_link_libraries(ftdi_eeprom ${LIBINTL_LIBRARIES})
47 endif ()
48 if (NOT SHAREDLIBS AND STATICLIBS)
49     target_link_libraries(ftdi_eeprom ${LIBUSB_LIBRARIES})
50 endif ()
51 install(TARGETS ftdi_eeprom DESTINATION bin)
52 install(FILES example.conf DESTINATION ${CMAKE_INSTALL_DOCDIR})