[go: up one dir, main page]

File: CMakeLists.txt

package info (click to toggle)
libftdi 0.18-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,296 kB
  • ctags: 429
  • sloc: sh: 10,187; ansic: 2,211; cpp: 594; makefile: 201
file content (89 lines) | stat: -rw-r--r-- 2,315 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Check
set(FTDI_BUILD_CPP False PARENT_SCOPE)

option(FTDIPP "Build C++ binding library libftdi++" ON)

if (FTDIPP)

    # Includes
    include_directories( ${CMAKE_CURRENT_BINARY_DIR}
                        ${CMAKE_CURRENT_SOURCE_DIR}
                        ${CMAKE_CURRENT_SOURCE_DIR}/../src
                        )

    # Targets
    set(cpp_sources   ftdi.cpp)
    set(cpp_headers   ftdi.hpp)

    # Find Boost
    find_package(Boost)
    if(Boost_FOUND)
    set(FTDI_BUILD_CPP True PARENT_SCOPE)
    message(STATUS "Building libftdi++")

    # Targets
    add_library(ftdipp SHARED ${cpp_sources})

    math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1")    # Compatiblity with previous releases
    set_target_properties(ftdipp PROPERTIES VERSION ${VERSION_FIXUP}.${MINOR_VERSION}.0 SOVERSION 1)

    # Static library
    add_library(ftdipp-static STATIC ${cpp_sources})
    set_target_properties(ftdipp-static PROPERTIES OUTPUT_NAME "ftdipp")

    # Prevent clobbering each other during the build
    set_target_properties(ftdipp PROPERTIES CLEAN_DIRECT_OUTPUT 1)
    set_target_properties(ftdipp-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)

    # Dependencies
    target_link_libraries(ftdipp ftdi ${LIBUSB_LIBRARIES} ${BOOST_LIBRARIES})

    # Install
    if(${UNIX})

    install( TARGETS ftdipp
                LIBRARY DESTINATION lib${LIB_SUFFIX}
                COMPONENT sharedlibs
                )

    install( TARGETS ftdipp-static
                ARCHIVE DESTINATION lib${LIB_SUFFIX}
                COMPONENT staticlibs
                )

    install( FILES ${cpp_headers}
                DESTINATION include/${PROJECT_NAME}
                COMPONENT headers
                )

    endif(${UNIX})

    if(${WIN32})

    install( TARGETS ftdipp
                DESTINATION bin
                COMPONENT sharedlibs
                )

    install( TARGETS ftdipp-static
                DESTINATION bin
                COMPONENT staticlibs
                )

    install( FILES ${cpp_headers}
                DESTINATION include/${PROJECT_NAME}
                COMPONENT headers
                )

    endif(${WIN32})

    else(Boost_FOUND)
    message(STATUS "Boost not found, won't build libftdi++")
    endif(Boost_FOUND)

else(FTDIPP)

    message(STATUS "Not building libftdi++")

endif(FTDIPP)