CMake: bump the minimal required version to 3.5
[libftdi] / ftdipp / CMakeLists.txt
CommitLineData
5f70b4c1 1# Targets
68d2167b
YY
2set(cpp_sources ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.cpp CACHE INTERNAL "List of cpp sources" )
3set(cpp_headers ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.hpp CACHE INTERNAL "List of cpp headers" )
6d4f7fba 4
68d2167b
YY
5# Includes
6include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}
7828006e 7 ${CMAKE_CURRENT_SOURCE_DIR}
e7f734f8 8 ${PROJECT_SOURCE_DIR}/src
7828006e 9)
6d4f7fba 10
68d2167b 11include_directories(${Boost_INCLUDE_DIRS})
6d4f7fba 12
68d2167b
YY
13# Shared library
14add_library(ftdipp1 SHARED ${cpp_sources})
6d4f7fba 15
db9c7eba 16math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1") # Compatibility with previous releases
68d2167b 17set_target_properties(ftdipp1 PROPERTIES VERSION ${VERSION_FIXUP}.${MINOR_VERSION}.0 SOVERSION 3)
6d4f7fba 18
68d2167b
YY
19# Prevent clobbering each other during the build
20set_target_properties(ftdipp1 PROPERTIES CLEAN_DIRECT_OUTPUT 1)
6d4f7fba 21
68d2167b
YY
22# Dependencies
23target_link_libraries(ftdipp1 ftdi1 ${LIBUSB_LIBRARIES} ${BOOST_LIBRARIES})
6d4f7fba 24
68d2167b 25install ( TARGETS ftdipp1
7828006e 26 RUNTIME DESTINATION bin
3c7141a7
YY
27 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
28 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
7828006e 29)
6d4f7fba 30
68d2167b
YY
31# Static library
32if ( STATICLIBS )
7828006e
YY
33 add_library(ftdipp1-static STATIC ${cpp_sources})
34 set_target_properties(ftdipp1-static PROPERTIES OUTPUT_NAME "ftdipp1")
35 set_target_properties(ftdipp1-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
36
37 install ( TARGETS ftdipp1-static
3c7141a7 38 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
7828006e
YY
39 COMPONENT staticlibs
40 )
6d4f7fba 41endif ()
68d2167b
YY
42
43install ( FILES ${cpp_headers}
7828006e
YY
44 DESTINATION include/${PROJECT_NAME}
45 COMPONENT headers
46)