| cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR) |
| project(chassisi2c CXX) |
| set(CMAKE_CXX_STANDARD 17) |
| set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| |
| set(LIBRARY_NAME "${PROJECT_NAME}") |
| set(INSTALL_BIN_DIR ${CMAKE_INSTALL_PREFIX}/bin) |
| set(INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib) |
| set(PROJECT_CMAKE_FILES ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}) |
| |
| set(INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include) |
| set(DEF_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_PREFIX}/lib/cmake) |
| set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR}) |
| |
| include(GNUInstallDirs) |
| include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc) |
| |
| add_library(${PROJECT_NAME} SHARED src/i2c.cpp) |
| |
| set_target_properties(${PROJECT_NAME} PROPERTIES VERSION "0.1.0") |
| set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION "0") |
| |
| install(TARGETS ${PROJECT_NAME} |
| EXPORT "${PROJECT_NAME}EXPORT" |
| RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT bin |
| LIBRARY DESTINATION "${INSTALL_LIB_DIR}" COMPONENT shlib |
| ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" COMPONENT stlib |
| COMPONENT dev) |
| |
| install(FILES "inc/i2c.hpp" |
| DESTINATION "${INSTALL_INCLUDE_DIR}/" ) |
| |
| install(EXPORT "${PROJECT_NAME}EXPORT" |
| DESTINATION "lib/cmake" |
| FILE ${PROJECT_NAME}Targets.cmake) |
| |
| configure_file(${CMAKE_SOURCE_DIR}/cmake/Config.cmake.in |
| "${PROJECT_CMAKE_FILES}/${PROJECT_NAME}-config.cmake" @ONLY) |
| |
| install(FILES |
| "${PROJECT_CMAKE_FILES}/${PROJECT_NAME}-config.cmake" |
| DESTINATION "lib/cmake" COMPONENT dev) |