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