Commit | Line | Data |
---|---|---|
0b2d00fc MV |
1 | # Check |
2 | set(FTDI_BUILD_CPP False PARENT_SCOPE) | |
3 | ||
4 | # Includes | |
5 | include_directories( ${CMAKE_CURRENT_BINARY_DIR} | |
6 | ${CMAKE_CURRENT_SOURCE_DIR} | |
7 | ${CMAKE_CURRENT_SOURCE_DIR}/../src | |
8 | ) | |
9 | ||
10 | # Targets | |
11 | set(cpp_sources ftdi.cpp) | |
12 | set(cpp_headers ftdi.hpp) | |
13 | ||
14 | # Find Boost | |
15 | find_package(Boost) | |
16 | if(Boost_FOUND) | |
17 | set(FTDI_BUILD_CPP True PARENT_SCOPE) | |
18 | message(STATUS "Building libftdi++") | |
19 | ||
20 | # Targets | |
340152b2 | 21 | add_library(ftdipp SHARED ${cpp_sources}) |
0b2d00fc | 22 | |
b80aee72 TJ |
23 | # Static library |
24 | add_library(ftdipp-static STATIC ${cpp_sources}) | |
25 | set_target_properties(ftdipp-static PROPERTIES OUTPUT_NAME "ftdipp") | |
26 | ||
27 | # Prevent clobbering each other during the build | |
28 | set_target_properties(ftdipp PROPERTIES CLEAN_DIRECT_OUTPUT 1) | |
29 | set_target_properties(ftdipp-static PROPERTIES CLEAN_DIRECT_OUTPUT 1) | |
30 | ||
0b2d00fc | 31 | # Dependencies |
340152b2 | 32 | target_link_libraries(ftdipp ftdi ${LIBUSB_LIBRARIES} ${BOOST_LIBRARIES}) |
0b2d00fc MV |
33 | |
34 | # Install | |
35 | if(${UNIX}) | |
36 | ||
340152b2 | 37 | install( TARGETS ftdipp |
0b2d00fc MV |
38 | LIBRARY DESTINATION lib |
39 | COMPONENT sharedlibs | |
40 | ) | |
41 | ||
b80aee72 TJ |
42 | install( TARGETS ftdipp-static |
43 | ARCHIVE DESTINATION lib | |
44 | COMPONENT staticlibs | |
45 | ) | |
46 | ||
0b2d00fc MV |
47 | install( FILES ${cpp_headers} |
48 | DESTINATION include/${PROJECT_NAME} | |
49 | COMPONENT headers | |
50 | ) | |
51 | ||
52 | endif(${UNIX}) | |
53 | ||
54 | if(${WIN32}) | |
55 | ||
340152b2 | 56 | install( TARGETS ftdipp |
0b2d00fc MV |
57 | DESTINATION bin |
58 | COMPONENT sharedlibs | |
59 | ) | |
60 | ||
b80aee72 TJ |
61 | install( TARGETS ftdipp-static |
62 | DESTINATION bin | |
63 | COMPONENT staticlibs | |
64 | ) | |
65 | ||
0b2d00fc MV |
66 | install( FILES ${cpp_headers} |
67 | DESTINATION include/${PROJECT_NAME} | |
68 | COMPONENT headers | |
69 | ) | |
70 | ||
71 | endif(${WIN32}) | |
72 | ||
73 | else(Boost_FOUND) | |
74 | message(STATUS "Boost not found, won't build libftdi++") | |
75 | endif(Boost_FOUND) |