X-Git-Url: http://developer.intra2net.com/git/?p=libftdi;a=blobdiff_plain;f=ftdipp%2FCMakeLists.txt;h=8423b2e7efa3d315b7499fb4c2e70cf0ed48ab71;hp=66efc32b595750d7ad460e85a85030820bd09c46;hb=a03fea794af90cd97514f35f212691f8b5b3700d;hpb=b80aee72c93847f79295722315e53fb898b46a27 diff --git a/ftdipp/CMakeLists.txt b/ftdipp/CMakeLists.txt index 66efc32..8423b2e 100644 --- a/ftdipp/CMakeLists.txt +++ b/ftdipp/CMakeLists.txt @@ -1,75 +1,89 @@ # Check set(FTDI_BUILD_CPP False PARENT_SCOPE) -# Includes -include_directories( ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/../src - ) - -# Targets -set(cpp_sources ftdi.cpp) -set(cpp_headers ftdi.hpp) - -# Find Boost -find_package(Boost) -if(Boost_FOUND) -set(FTDI_BUILD_CPP True PARENT_SCOPE) -message(STATUS "Building libftdi++") - -# Targets -add_library(ftdipp SHARED ${cpp_sources}) - -# Static library -add_library(ftdipp-static STATIC ${cpp_sources}) -set_target_properties(ftdipp-static PROPERTIES OUTPUT_NAME "ftdipp") - -# 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) - -# Dependencies -target_link_libraries(ftdipp ftdi ${LIBUSB_LIBRARIES} ${BOOST_LIBRARIES}) - -# Install -if(${UNIX}) - - install( TARGETS ftdipp - LIBRARY DESTINATION lib - COMPONENT sharedlibs - ) - - install( TARGETS ftdipp-static - ARCHIVE DESTINATION lib - 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) +option(FTDIPP "Build C++ binding library libftdi++" ON) + +if (FTDIPP) + + # Includes + include_directories( ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../src + ) + + # Targets + set(cpp_sources ftdi.cpp) + set(cpp_headers ftdi.hpp) + + # Find Boost + find_package(Boost) + if(Boost_FOUND) + set(FTDI_BUILD_CPP True PARENT_SCOPE) + message(STATUS "Building libftdi++") + + # Targets + add_library(ftdipp SHARED ${cpp_sources}) + + math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1") # Compatiblity with previous releases + set_target_properties(ftdipp PROPERTIES VERSION ${VERSION_FIXUP}.${MINOR_VERSION}.0 SOVERSION 1) + + # Static library + add_library(ftdipp-static STATIC ${cpp_sources}) + set_target_properties(ftdipp-static PROPERTIES OUTPUT_NAME "ftdipp") + + # 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) + + # 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) +