-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2861 from SunBlack/flann_imported_target
Implement imported target for FLANN
- Loading branch information
Showing
8 changed files
with
136 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,145 @@ | ||
############################################################################### | ||
# Find FLANN | ||
#.rst: | ||
# FindFLANN | ||
# -------- | ||
# | ||
# This sets the following variables: | ||
# FLANN_FOUND - True if FLANN was found. | ||
# FLANN_INCLUDE_DIRS - Directories containing the FLANN include files. | ||
# FLANN_LIBRARIES - Libraries needed to use FLANN. | ||
# FLANN_DEFINITIONS - Compiler flags for FLANN. | ||
# If FLANN_USE_STATIC is specified and then look for static libraries ONLY else | ||
# look for shared ones | ||
# Try to find FLANN library and include files. | ||
# | ||
# IMPORTED Targets | ||
# ^^^^^^^^^^^^^^^^ | ||
# | ||
# This module defines the :prop_tgt:`IMPORTED` targets: | ||
# | ||
# ``FLANN::FLANN`` | ||
# Defined if the system has FLANN. | ||
# | ||
# Result Variables | ||
# ^^^^^^^^^^^^^^^^ | ||
# | ||
# This module sets the following variables: | ||
# | ||
# :: | ||
# | ||
# FLANN_FOUND True in case FLANN is found, otherwise false | ||
# FLANN_DEFINITIONS Compiler flags for FLANN. | ||
# FLANN_INCLUDE_DIR Location of FLANN header files | ||
# FLANN_INCLUDE_DIRS Location of FLANN header files (including dependencies) | ||
# FLANN_LIBRARY FLANN release library | ||
# FLANN_LIBRARY_DEBUG FLANN debug library | ||
# FLANN_LIBRARIES FLANN release and debug library | ||
# | ||
# Example usage | ||
# ^^^^^^^^^^^^^ | ||
# | ||
# :: | ||
# | ||
# find_package(FLANN REQUIRED) | ||
# | ||
# add_executable(foo foo.cc) | ||
# target_link_libraries(foo FLANN::FLANN) | ||
# | ||
|
||
find_package(PkgConfig QUIET) | ||
if(FLANN_FIND_VERSION) | ||
pkg_check_modules(PC_FLANN flann>=${FLANN_FIND_VERSION}) | ||
else() | ||
pkg_check_modules(PC_FLANN flann) | ||
endif() | ||
|
||
set(FLANN_DEFINITIONS ${PC_FLANN_CFLAGS_OTHER}) | ||
|
||
if(FLANN_USE_STATIC) | ||
set(FLANN_RELEASE_NAME flann_cpp_s) | ||
set(FLANN_DEBUG_NAME flann_cpp_s-gd) | ||
set(FLANN_DEFINITIONS ${FLANN_DEFINITIONS} "-DFLANN_STATIC") | ||
else() | ||
set(FLANN_RELEASE_NAME flann_cpp) | ||
set(FLANN_DEBUG_NAME flann_cpp-gd) | ||
endif() | ||
|
||
find_package(PkgConfig QUIET) | ||
if(FLANN_FIND_VERSION) | ||
pkg_check_modules(FLANN flann>=${FLANN_FIND_VERSION}) | ||
else() | ||
pkg_check_modules(FLANN flann) | ||
endif() | ||
find_path(FLANN_INCLUDE_DIR | ||
NAMES | ||
flann/flann.hpp | ||
HINTS | ||
${PC_FLANN_INCLUDE_DIRS} | ||
${FLANN_ROOT} | ||
$ENV{FLANN_ROOT} | ||
PATHS | ||
$ENV{PROGRAMFILES}/Flann | ||
$ENV{PROGRAMW6432}/Flann | ||
PATH_SUFFIXES | ||
include | ||
) | ||
|
||
if(NOT FLANN_FOUND) | ||
find_path(FLANN_INCLUDE_DIR flann/flann.hpp | ||
HINTS "${FLANN_ROOT}" "$ENV{FLANN_ROOT}" | ||
PATHS "$ENV{PROGRAMFILES}/flann" "$ENV{PROGRAMW6432}/flann" | ||
PATH_SUFFIXES include) | ||
|
||
find_library(FLANN_LIBRARY | ||
NAMES ${FLANN_RELEASE_NAME} | ||
HINTS "${FLANN_ROOT}" "$ENV{FLANN_ROOT}" | ||
PATHS "$ENV{PROGRAMFILES}/flann" "$ENV{PROGRAMW6432}/flann" | ||
PATH_SUFFIXES lib) | ||
|
||
find_library(FLANN_LIBRARY_DEBUG | ||
NAMES ${FLANN_DEBUG_NAME} ${FLANN_RELEASE_NAME} | ||
HINTS "${FLANN_ROOT}" "$ENV{FLANN_ROOT}" | ||
PATHS "$ENV{PROGRAMFILES}/flann" "$ENV{PROGRAMW6432}/flann" | ||
PATH_SUFFIXES lib debug/lib) | ||
|
||
if(NOT FLANN_LIBRARY_DEBUG) | ||
set(FLANN_LIBRARY_DEBUG ${FLANN_LIBRARY}) | ||
endif() | ||
find_library(FLANN_LIBRARY | ||
NAMES | ||
${FLANN_RELEASE_NAME} | ||
HINTS | ||
${PC_FLANN_LIBRARY_DIRS} | ||
${FLANN_ROOT} | ||
$ENV{FLANN_ROOT} | ||
PATHS | ||
$ENV{PROGRAMFILES}/Flann | ||
$ENV{PROGRAMW6432}/Flann | ||
PATH_SUFFIXES | ||
lib | ||
) | ||
|
||
set(FLANN_INCLUDE_DIRS ${FLANN_INCLUDE_DIR}) | ||
set(FLANN_LIBRARIES optimized ${FLANN_LIBRARY} debug ${FLANN_LIBRARY_DEBUG}) | ||
find_library(FLANN_LIBRARY_DEBUG | ||
NAMES | ||
${FLANN_DEBUG_NAME} | ||
HINTS | ||
${PC_FLANN_LIBRARY_DIRS} | ||
${FLANN_ROOT} | ||
$ENV{FLANN_ROOT} | ||
PATHS | ||
$ENV{PROGRAMFILES}/Flann | ||
$ENV{PROGRAMW6432}/Flann | ||
PATH_SUFFIXES | ||
lib | ||
) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(FLANN DEFAULT_MSG FLANN_LIBRARY FLANN_INCLUDE_DIR) | ||
|
||
mark_as_advanced(FLANN_LIBRARY FLANN_LIBRARY_DEBUG FLANN_INCLUDE_DIR) | ||
if(FLANN_LIBRARY AND FLANN_LIBRARY_DEBUG) | ||
set(FLANN_LIBRARIES optimized ${FLANN_LIBRARY} debug ${FLANN_LIBRARY_DEBUG}) | ||
else() | ||
set(FLANN_LIBRARIES ${FLANN_LIBRARY}) | ||
endif() | ||
|
||
set(FLANN_INCLUDE_DIRS | ||
${FLANN_INCLUDE_DIR} | ||
) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args( | ||
FLANN DEFAULT_MSG | ||
FLANN_LIBRARIES FLANN_INCLUDE_DIR | ||
) | ||
|
||
if(FLANN_FOUND) | ||
message(STATUS "FLANN found (include: ${FLANN_INCLUDE_DIRS}, lib: ${FLANN_LIBRARIES})") | ||
if(FLANN_USE_STATIC) | ||
add_definitions(-DFLANN_STATIC) | ||
if(NOT TARGET FLANN::FLANN) | ||
if (FLANN_USE_STATIC) | ||
add_library(FLANN::FLANN STATIC IMPORTED) | ||
else() | ||
add_library(FLANN::FLANN SHARED IMPORTED) | ||
endif() | ||
set_target_properties(FLANN::FLANN PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FLANN_INCLUDE_DIRS}") | ||
set_target_properties(FLANN::FLANN PROPERTIES INTERFACE_COMPILE_DEFINITIONS "${FLANN_DEFINITIONS}") | ||
if(FLANN_LIBRARY) | ||
set_property(TARGET FLANN::FLANN APPEND PROPERTY IMPORTED_CONFIGURATIONS "RELEASE") | ||
set_target_properties(FLANN::FLANN PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX") | ||
if(WIN32) | ||
set_target_properties(FLANN::FLANN PROPERTIES IMPORTED_IMPLIB_RELEASE "${FLANN_LIBRARY}") | ||
else() | ||
set_target_properties(FLANN::FLANN PROPERTIES IMPORTED_LOCATION_RELEASE "${FLANN_LIBRARY}") | ||
endif() | ||
endif() | ||
if(FLANN_LIBRARY_DEBUG) | ||
set_property(TARGET FLANN::FLANN APPEND PROPERTY IMPORTED_CONFIGURATIONS "DEBUG") | ||
set_target_properties(FLANN::FLANN PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX") | ||
if(WIN32) | ||
set_target_properties(FLANN::FLANN PROPERTIES IMPORTED_IMPLIB_DEBUG "${FLANN_LIBRARY_DEBUG}") | ||
else() | ||
set_target_properties(FLANN::FLANN PROPERTIES IMPORTED_LOCATION_DEBUG "${FLANN_LIBRARY_DEBUG}") | ||
endif() | ||
endif() | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 0 additions & 63 deletions
63
doc/tutorials/content/sources/vfh_recognition/FindFLANN.cmake
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters