CMake: bump the minimal required version to 3.5
[libftdi] / ftdipp / CMakeLists.txt
... / ...
CommitLineData
1# Targets
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" )
4
5# Includes
6include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}
7 ${CMAKE_CURRENT_SOURCE_DIR}
8 ${PROJECT_SOURCE_DIR}/src
9)
10
11include_directories(${Boost_INCLUDE_DIRS})
12
13# Shared library
14add_library(ftdipp1 SHARED ${cpp_sources})
15
16math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1") # Compatibility with previous releases
17set_target_properties(ftdipp1 PROPERTIES VERSION ${VERSION_FIXUP}.${MINOR_VERSION}.0 SOVERSION 3)
18
19# Prevent clobbering each other during the build
20set_target_properties(ftdipp1 PROPERTIES CLEAN_DIRECT_OUTPUT 1)
21
22# Dependencies
23target_link_libraries(ftdipp1 ftdi1 ${LIBUSB_LIBRARIES} ${BOOST_LIBRARIES})
24
25install ( TARGETS ftdipp1
26 RUNTIME DESTINATION bin
27 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
28 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
29)
30
31# Static library
32if ( STATICLIBS )
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
38 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
39 COMPONENT staticlibs
40 )
41endif ()
42
43install ( FILES ${cpp_headers}
44 DESTINATION include/${PROJECT_NAME}
45 COMPONENT headers
46)