Skip to content

Commit ede7a72

Browse files
committed
Update FLANN configuration for better compatibility
- Use FLANN master branch instead of 1.9.2 - Disable C bindings to reduce complexity - Add proper target aliasing for flann_cpp_s -> flann_cpp - Handle multiple possible FLANN target names If this still fails, will implement conditional compilation next.
1 parent 7f54163 commit ede7a72

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

cpp/kiss_matcher/3rdparty/flann/flann.cmake

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
2828
FetchContent_Declare(
2929
flann
3030
GIT_REPOSITORY https://github.com/flann-lib/flann.git
31-
GIT_TAG 1.9.2
31+
GIT_TAG master
3232
GIT_SHALLOW TRUE
3333
)
3434

35-
# Configure FLANN options
35+
# Configure FLANN options before FetchContent_MakeAvailable
36+
set(BUILD_C_BINDINGS OFF CACHE BOOL "Build FLANN C bindings" FORCE)
3637
set(BUILD_EXAMPLES OFF CACHE BOOL "Build FLANN examples" FORCE)
3738
set(BUILD_TESTS OFF CACHE BOOL "Build FLANN tests" FORCE)
3839
set(BUILD_DOC OFF CACHE BOOL "Build FLANN documentation" FORCE)
@@ -42,11 +43,16 @@ set(USE_OPENMP ON CACHE BOOL "Use OpenMP" FORCE)
4243

4344
FetchContent_MakeAvailable(flann)
4445

45-
# Ensure FLANN headers are treated as system includes
46-
if(TARGET flann)
47-
get_target_property(flann_include_dirs flann INTERFACE_INCLUDE_DIRECTORIES)
48-
set_target_properties(flann PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${flann_include_dirs}")
46+
# Create alias for easier linking (FLANN creates flann_cpp_s for static)
47+
if(TARGET flann_cpp_s)
48+
add_library(flann_cpp ALIAS flann_cpp_s)
49+
get_target_property(flann_include_dirs flann_cpp_s INTERFACE_INCLUDE_DIRECTORIES)
50+
set_target_properties(flann_cpp_s PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${flann_include_dirs}")
4951
elseif(TARGET flann_cpp)
5052
get_target_property(flann_include_dirs flann_cpp INTERFACE_INCLUDE_DIRECTORIES)
5153
set_target_properties(flann_cpp PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${flann_include_dirs}")
54+
elseif(TARGET flann)
55+
add_library(flann_cpp ALIAS flann)
56+
get_target_property(flann_include_dirs flann INTERFACE_INCLUDE_DIRECTORIES)
57+
set_target_properties(flann PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${flann_include_dirs}")
5258
endif()

0 commit comments

Comments
 (0)