X-Git-Url: http://developer.intra2net.com/git/?p=libftdi;a=blobdiff_plain;f=ftdipp%2FCMakeLists.txt;h=43057ce203c388344830125abc00c8234db25ea0;hp=411abdbac9d989757861bfdfdc3e139279ea3cc5;hb=998266bf16a3f88480382070b4af670d5998a1c5;hpb=89a3169e7d78b6aff609aa88760af2fd5c61cf7c diff --git a/ftdipp/CMakeLists.txt b/ftdipp/CMakeLists.txt index 411abdb..43057ce 100644 --- a/ftdipp/CMakeLists.txt +++ b/ftdipp/CMakeLists.txt @@ -1,57 +1,79 @@ # Check set(FTDI_BUILD_CPP False PARENT_SCOPE) -# Includes -include_directories( ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/../src - ) +option(FTDIPP "Build C++ binding library libftdi++" ON) -# Targets -set(cpp_sources ftdi.cpp) -set(cpp_headers ftdi.hpp) +if (FTDIPP) -# Find Boost -find_package(Boost) -if(Boost_FOUND) -set(FTDI_BUILD_CPP True PARENT_SCOPE) -message(STATUS "Building libftdi++") + if(Boost_FOUND) -# Targets -add_library(ftdi_cpp SHARED ${cpp_sources}) + # Includes + include_directories(${Boost_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../src) -# Dependencies -target_link_libraries(ftdi_cpp ftdi ${LIBUSB_LIBRARIES} ${BOOST_LIBRARIES}) + # Targets + set(cpp_sources ftdi.cpp) + set(cpp_headers ftdi.hpp) -# Install -if(${UNIX}) + set(FTDI_BUILD_CPP True PARENT_SCOPE) + message(STATUS "Building libftdi++") - install( TARGETS ftdi_cpp - LIBRARY DESTINATION lib - COMPONENT sharedlibs - ) + # Shared library + add_library(ftdipp SHARED ${cpp_sources}) - install( FILES ${cpp_headers} - DESTINATION include/${PROJECT_NAME} - COMPONENT headers - ) + math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1") # Compatiblity with previous releases + set_target_properties(ftdipp PROPERTIES VERSION ${VERSION_FIXUP}.${MINOR_VERSION}.0 SOVERSION 1) -endif(${UNIX}) + # Static library + add_library(ftdipp-static STATIC ${cpp_sources}) + set_target_properties(ftdipp-static PROPERTIES OUTPUT_NAME "ftdipp") -if(${WIN32}) + # 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 ftdi_cpp - DESTINATION bin - COMPONENT sharedlibs - ) + # Dependencies + target_link_libraries(ftdipp ftdi ${LIBUSB_LIBRARIES} ${BOOST_LIBRARIES}) - install( FILES ${cpp_headers} - DESTINATION include/${PROJECT_NAME} - COMPONENT headers - ) + # 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}) -endif(${WIN32}) + 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(Boost_FOUND) + message(STATUS "Boost not found, won't build libftdi++") + endif(Boost_FOUND) + +else(FTDIPP) + + message(STATUS "Not building libftdi++") + +endif(FTDIPP)