Permalink
Browse files

Add cmake package config files

  • Loading branch information...
stotko committed May 10, 2017
1 parent 29aa640 commit 77835f7e6ca434e146163dc0136773295ce973ca
Showing with 47 additions and 3 deletions.
  1. +29 −3 CMakeLists.txt
  2. +7 −0 scripts/nanoflannConfig.cmake.in
  3. +11 −0 scripts/nanoflannConfigVersion.cmake.in
View
@@ -86,6 +86,27 @@ CONFIGURE_FILE(
"${nanoflann_BINARY_DIR}/nanoflann.pc" @ONLY IMMEDIATE )
# Set relative install directories
set(INSTALL_INCLUDE_DIR "include")
set(INSTALL_PKGCONFIG_DIR "lib${LIB_SUFFIX}/pkgconfig")
set(INSTALL_CMAKE_DIR "lib${LIB_SUFFIX}/cmake/nanoflann")
set(INSTALL_COPYRIGHT_DIR "share/doc/libnanoflann-dev")
# Generate the cmake config and cmake config-version file:
SET(RELATIVE_INCLUDE_DIR "../../../include")
SET(CONFIG_INCLUDE_DIRS "\${nanoflann_CMAKE_DIR}/${RELATIVE_INCLUDE_DIR}")
CONFIGURE_FILE(
"${nanoflann_SOURCE_DIR}/scripts/nanoflannConfig.cmake.in"
"${nanoflann_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/nanoflannConfig.cmake" @ONLY IMMEDIATE )
CONFIGURE_FILE(
"${nanoflann_SOURCE_DIR}/scripts/nanoflannConfigVersion.cmake.in"
"${nanoflann_BINARY_DIR}/nanoflannConfigVersion.cmake" @ONLY IMMEDIATE )
# Uninstall target, for "make uninstall"
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake_uninstall.cmake.in"
@@ -98,15 +119,20 @@ ADD_CUSTOM_TARGET(uninstall
INSTALL(
FILES "${nanoflann_BINARY_DIR}/nanoflann.pc"
DESTINATION ${libnanoflann_dev_INSTALL_PREFIX}lib${LIB_SUFFIX}/pkgconfig )
DESTINATION "${libnanoflann_dev_INSTALL_PREFIX}${INSTALL_PKGCONFIG_DIR}" )
INSTALL(
FILES "${nanoflann_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/nanoflannConfig.cmake"
"${nanoflann_BINARY_DIR}/nanoflannConfigVersion.cmake"
DESTINATION "${libnanoflann_dev_INSTALL_PREFIX}${INSTALL_CMAKE_DIR}" )
INSTALL(
FILES "${nanoflann_SOURCE_DIR}/include/nanoflann.hpp"
DESTINATION ${libnanoflann_dev_INSTALL_PREFIX}include/ )
DESTINATION "${libnanoflann_dev_INSTALL_PREFIX}${INSTALL_INCLUDE_DIR}" )
IF(CMAKE_USE_DEB_POSTFIXS)
INSTALL(
FILES "${nanoflann_SOURCE_DIR}/copyright"
DESTINATION ${libnanoflann_dev_INSTALL_PREFIX}share/doc/libnanoflann-dev/ )
DESTINATION "${libnanoflann_dev_INSTALL_PREFIX}${INSTALL_COPYRIGHT_DIR}" )
ENDIF(CMAKE_USE_DEB_POSTFIXS)
@@ -0,0 +1,7 @@
# - Config file for the nanoflann package
# It defines the following variables
# nanoflann_INCLUDE_DIRS - include directories for FooBar
# Compute paths
get_filename_component(nanoflann_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(nanoflann_INCLUDE_DIRS "@CONFIG_INCLUDE_DIRS@")
@@ -0,0 +1,11 @@
set(PACKAGE_VERSION "@NANOFLANN_VERSION_MAJOR@.@NANOFLANN_VERSION_MINOR@.@NANOFLANN_VERSION_PATCH@")
# Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()

0 comments on commit 77835f7

Please sign in to comment.