Commit | Line | Data |
---|---|---|
0b2d00fc MV |
1 | # Includes |
2 | include_directories( ${CMAKE_CURRENT_BINARY_DIR} | |
3 | ${CMAKE_CURRENT_SOURCE_DIR} | |
4 | ) | |
5 | ||
6 | # Targets | |
7 | set(c_sources ftdi.c) | |
8 | set(c_headers ftdi.h) | |
9 | ||
10 | add_library(ftdi SHARED ${c_sources}) | |
11 | ||
52448565 TJ |
12 | math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1") # Compatiblity with previous releases |
13 | set_target_properties(ftdi PROPERTIES VERSION ${VERSION_FIXUP}.${MINOR_VERSION}.0 SOVERSION 1) | |
14 | ||
b80aee72 TJ |
15 | # Static library |
16 | add_library(ftdi-static STATIC ${c_sources}) | |
17 | set_target_properties(ftdi-static PROPERTIES OUTPUT_NAME "ftdi") | |
18 | ||
19 | # Prevent clobbering each other during the build | |
20 | set_target_properties(ftdi PROPERTIES CLEAN_DIRECT_OUTPUT 1) | |
21 | set_target_properties(ftdi-static PROPERTIES CLEAN_DIRECT_OUTPUT 1) | |
22 | ||
0b2d00fc | 23 | # Dependencies |
89a3169e | 24 | target_link_libraries(ftdi ${LIBUSB_LIBRARIES}) |
0b2d00fc MV |
25 | |
26 | # Install | |
27 | if(${UNIX}) | |
28 | ||
29 | install( TARGETS ftdi | |
20a28968 | 30 | LIBRARY DESTINATION lib${LIB_SUFFIX} |
0b2d00fc MV |
31 | COMPONENT sharedlibs |
32 | ) | |
33 | ||
b80aee72 | 34 | install( TARGETS ftdi-static |
20a28968 | 35 | ARCHIVE DESTINATION lib${LIB_SUFFIX} |
b80aee72 TJ |
36 | COMPONENT staticlibs |
37 | ) | |
38 | ||
0b2d00fc MV |
39 | install( FILES ${c_headers} |
40 | DESTINATION include/${PROJECT_NAME} | |
41 | COMPONENT headers | |
42 | ) | |
43 | ||
44 | endif(${UNIX}) | |
45 | ||
46 | if(${WIN32}) | |
47 | ||
48 | install( TARGETS ftdi | |
49 | DESTINATION bin | |
50 | COMPONENT sharedlibs | |
51 | ) | |
52 | ||
b80aee72 TJ |
53 | install( TARGETS ftdi-static |
54 | DESTINATION bin | |
55 | COMPONENT staticlibs | |
56 | ) | |
57 | ||
0b2d00fc MV |
58 | install( FILES ${c_headers} |
59 | DESTINATION include/${PROJECT_NAME} | |
60 | COMPONENT headers | |
61 | ) | |
62 | ||
63 | endif(${WIN32}) |