Build and install static versions of the libraries
[libftdi] / src / CMakeLists.txt
CommitLineData
0b2d00fc
MV
1# Includes
2include_directories( ${CMAKE_CURRENT_BINARY_DIR}
3 ${CMAKE_CURRENT_SOURCE_DIR}
4 )
5
6# Targets
7set(c_sources ftdi.c)
8set(c_headers ftdi.h)
9
10add_library(ftdi SHARED ${c_sources})
11
b80aee72
TJ
12# Static library
13add_library(ftdi-static STATIC ${c_sources})
14set_target_properties(ftdi-static PROPERTIES OUTPUT_NAME "ftdi")
15
16# Prevent clobbering each other during the build
17set_target_properties(ftdi PROPERTIES CLEAN_DIRECT_OUTPUT 1)
18set_target_properties(ftdi-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
19
0b2d00fc 20# Dependencies
89a3169e 21target_link_libraries(ftdi ${LIBUSB_LIBRARIES})
0b2d00fc
MV
22
23# Install
24if(${UNIX})
25
26 install( TARGETS ftdi
27 LIBRARY DESTINATION lib
28 COMPONENT sharedlibs
29 )
30
b80aee72
TJ
31 install( TARGETS ftdi-static
32 ARCHIVE DESTINATION lib
33 COMPONENT staticlibs
34 )
35
0b2d00fc
MV
36 install( FILES ${c_headers}
37 DESTINATION include/${PROJECT_NAME}
38 COMPONENT headers
39 )
40
41endif(${UNIX})
42
43if(${WIN32})
44
45 install( TARGETS ftdi
46 DESTINATION bin
47 COMPONENT sharedlibs
48 )
49
b80aee72
TJ
50 install( TARGETS ftdi-static
51 DESTINATION bin
52 COMPONENT staticlibs
53 )
54
0b2d00fc
MV
55 install( FILES ${c_headers}
56 DESTINATION include/${PROJECT_NAME}
57 COMPONENT headers
58 )
59
60endif(${WIN32})