diff --git a/CMakeLists.txt b/CMakeLists.txt index e2fff5041837db4d13062888915930570eea625b..c1ff8b241868cd5962c3aa5172f8577c423454de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,16 +23,8 @@ SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -D_REENTRANT") #find dependencies FIND_PACKAGE(Eigen3 3.3 REQUIRED) FIND_PACKAGE(falkolib QUIET) - find_package(PkgConfig) pkg_check_modules(csm QUIET csm ) -message(WARNING ${csm_FOUND}) -message(WARNING csm_LIBRARIES: ${csm_LIBRARIES}) -message(WARNING csm_LIBRARY: ${csm_LIBRARY}) -message(WARNING csm_LINK_LIBRARIES: ${csm_LINK_LIBRARIES}) -message(WARNING csm_LIBRARY_DIRS: ${csm_LIBRARY_DIRS}) -message(WARNING csm_INCLUDE_DIRS: ${csm_INCLUDE_DIRS}) -message(WARNING csm_INCLUDE_DIR: ${csm_INCLUDE_DIR}) # NOPE! #Build tests @@ -61,6 +53,37 @@ endif() ADD_SUBDIRECTORY(src) +#install library +#============================================================= +INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets + RUNTIME DESTINATION bin + LIBRARY DESTINATION ${LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${LIB_INSTALL_DIR} +) +install(EXPORT ${PROJECT_NAME}Targets DESTINATION lib/${PROJECT_NAME}/cmake) + +#Â Configure the package installation +include(CMakePackageConfigHelpers) +configure_package_config_file( + ${CMAKE_SOURCE_DIR}/cmake_modules/${PROJECT_NAME}Config.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake + INSTALL_DESTINATION ${LIB_INSTALL_DIR}/${PROJECT_NAME}/cmake + PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR +) + +install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake + DESTINATION + ${LIB_INSTALL_DIR}/${PROJECT_NAME}/cmake +) + +# Specifies include directories to use when compiling the plugin target +# This way, include_directories does not need to be called in plugins depending on this one +target_include_directories(${PROJECT_NAME} INTERFACE + $<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}> +) + #Build tests IF(BUILD_TESTS) # Enables testing for this directory and below. diff --git a/cmake_modules/laser_scan_utilsConfig.cmake.in b/cmake_modules/laser_scan_utilsConfig.cmake.in new file mode 100644 index 0000000000000000000000000000000000000000..699253a8747f367e40732cfbab17ded58218e1b5 --- /dev/null +++ b/cmake_modules/laser_scan_utilsConfig.cmake.in @@ -0,0 +1,9 @@ +set(@PROJECT_NAME@_VERSION 0.0.1) + + +@PACKAGE_INIT@ + + +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") + +check_required_components(@PROJECT_NAME@) \ No newline at end of file