Fix include directories: Prefer local (probably newer) ftdi.h instead of the already...
[libftdi] / src / CMakeLists.txt
CommitLineData
0b2d00fc 1# Includes
a4eac204 2include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}
0b2d00fc
MV
3 ${CMAKE_CURRENT_SOURCE_DIR}
4 )
5
6# Targets
40da63b1 7set(c_sources ftdi.c ftdi_stream.c)
0b2d00fc
MV
8set(c_headers ftdi.h)
9
10add_library(ftdi SHARED ${c_sources})
11
52448565
TJ
12math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1") # Compatiblity with previous releases
13set_target_properties(ftdi PROPERTIES VERSION ${VERSION_FIXUP}.${MINOR_VERSION}.0 SOVERSION 1)
14
b80aee72
TJ
15# Static library
16add_library(ftdi-static STATIC ${c_sources})
17set_target_properties(ftdi-static PROPERTIES OUTPUT_NAME "ftdi")
18
19# Prevent clobbering each other during the build
20set_target_properties(ftdi PROPERTIES CLEAN_DIRECT_OUTPUT 1)
21set_target_properties(ftdi-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
22
0b2d00fc 23# Dependencies
89a3169e 24target_link_libraries(ftdi ${LIBUSB_LIBRARIES})
0b2d00fc
MV
25
26# Install
27if(${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
44endif(${UNIX})
45
46if(${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
63endif(${WIN32})