Commit | Line | Data |
---|---|---|
5f70b4c1 | 1 | # Targets |
019f4846 TJ |
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") | |
6d4f7fba | 4 | |
68d2167b YY |
5 | # Includes |
6 | include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR} | |
019f4846 TJ |
7 | ${CMAKE_CURRENT_SOURCE_DIR} |
8 | ${PROJECT_SOURCE_DIR}/src | |
7828006e | 9 | ) |
6d4f7fba | 10 | |
68d2167b | 11 | # Shared library |
019f4846 TJ |
12 | if (SHAREDLIBS) |
13 | add_library(ftdipp1 SHARED ${cpp_sources}) | |
14 | math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1") # Compatibility with previous releases | |
15 | set_target_properties(ftdipp1 PROPERTIES VERSION ${VERSION_FIXUP}.${MINOR_VERSION}.0 SOVERSION 3) | |
16 | # Prevent clobbering each other during the build | |
17 | set_target_properties(ftdipp1 PROPERTIES CLEAN_DIRECT_OUTPUT 1) | |
18 | # Dependencies | |
19 | target_link_libraries(ftdipp1 ftdi1 ${LIBUSB_LIBRARIES}) | |
20 | install(TARGETS ftdipp1 | |
21 | RUNTIME DESTINATION bin | |
22 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | |
23 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | |
24 | ) | |
25 | endif () | |
6d4f7fba | 26 | |
68d2167b | 27 | # Static library |
019f4846 TJ |
28 | if (STATICLIBS) |
29 | add_library(ftdipp1-static STATIC ${cpp_sources}) | |
30 | set_target_properties(ftdipp1-static PROPERTIES OUTPUT_NAME "ftdipp1") | |
31 | set_target_properties(ftdipp1-static PROPERTIES CLEAN_DIRECT_OUTPUT 1) | |
32 | target_link_libraries(ftdipp1-static ftdi1-static ${LIBUSB_LIBRARIES}) | |
33 | install(TARGETS ftdipp1-static | |
34 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | |
35 | COMPONENT staticlibs | |
36 | ) | |
37 | endif () | |
68d2167b | 38 | |
2a992306 YY |
39 | install(FILES ${cpp_headers} |
40 | DESTINATION include/${PROJECT_NAME} | |
41 | COMPONENT headers | |
7828006e | 42 | ) |