X-Git-Url: http://developer.intra2net.com/git/?p=libftdi;a=blobdiff_plain;f=ftdipp%2FCMakeLists.txt;h=a9e3418682f39800167dff83b40cd0e20b6e205b;hp=43057ce203c388344830125abc00c8234db25ea0;hb=51962d0874d4e731ff6ed93dbe838d4d4fcec55c;hpb=998266bf16a3f88480382070b4af670d5998a1c5 diff --git a/ftdipp/CMakeLists.txt b/ftdipp/CMakeLists.txt index 43057ce..a9e3418 100644 --- a/ftdipp/CMakeLists.txt +++ b/ftdipp/CMakeLists.txt @@ -1,79 +1,47 @@ -# Check -set(FTDI_BUILD_CPP False PARENT_SCOPE) +# vim: ts=2:sw=2:sts=2 -option(FTDIPP "Build C++ binding library libftdi++" ON) +# Targets +set(cpp_sources ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.cpp CACHE INTERNAL "List of cpp sources" ) +set(cpp_headers ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.hpp CACHE INTERNAL "List of cpp headers" ) -if (FTDIPP) +# Includes +include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/src) - if(Boost_FOUND) +include_directories(${Boost_INCLUDE_DIRS}) - # Includes - include_directories(${Boost_INCLUDE_DIRS} - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/../src) +# Shared library +add_library(ftdipp1 SHARED ${cpp_sources}) - # Targets - set(cpp_sources ftdi.cpp) - set(cpp_headers ftdi.hpp) +math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1") # Compatiblity with previous releases +set_target_properties(ftdipp1 PROPERTIES VERSION ${VERSION_FIXUP}.${MINOR_VERSION}.0 SOVERSION 3) - set(FTDI_BUILD_CPP True PARENT_SCOPE) - message(STATUS "Building libftdi++") +# Prevent clobbering each other during the build +set_target_properties(ftdipp1 PROPERTIES CLEAN_DIRECT_OUTPUT 1) - # Shared library - add_library(ftdipp SHARED ${cpp_sources}) +# Dependencies +target_link_libraries(ftdipp1 ftdi1 ${LIBUSB_LIBRARIES} ${BOOST_LIBRARIES}) - math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1") # Compatiblity with previous releases - set_target_properties(ftdipp PROPERTIES VERSION ${VERSION_FIXUP}.${MINOR_VERSION}.0 SOVERSION 1) +install ( TARGETS ftdipp1 + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib${LIB_SUFFIX} + ARCHIVE DESTINATION lib${LIB_SUFFIX} + ) - # Static library - add_library(ftdipp-static STATIC ${cpp_sources}) - set_target_properties(ftdipp-static PROPERTIES OUTPUT_NAME "ftdipp") +# Static library +if ( STATICLIBS ) + add_library(ftdipp1-static STATIC ${cpp_sources}) + set_target_properties(ftdipp1-static PROPERTIES OUTPUT_NAME "ftdipp1") + set_target_properties(ftdipp1-static PROPERTIES CLEAN_DIRECT_OUTPUT 1) - # 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) + install ( TARGETS ftdipp1-static + ARCHIVE DESTINATION lib${LIB_SUFFIX} + COMPONENT staticlibs + ) +endif () - # 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) +install ( FILES ${cpp_headers} + DESTINATION include/${PROJECT_NAME} + COMPONENT headers + )