Skip to content

Commit 3d0922c

Browse files
committed
Fix lz4 / HDF5 missing from flann.pc Requires: line.
lz4 is an unconditional dependency of flann (see #399), but until now was not correctly generated into the `Requires: lz4` line of `flann.pc`, because the `PKG_EXTERNAL_DEPS` variable used in `flann.pc.in` was not defined at all. This fixes build error `lz4.h: No such file or directory` for properly sandboxed builds, in which undeclared dependencies are not made available. Same thing for HDF5, but conditionally.
1 parent f9caaf6 commit 3d0922c

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ option(USE_MPI "Use MPI" OFF)
6262

6363
set(NVCC_COMPILER_BINDIR "" CACHE PATH "Directory where nvcc should look for C++ compiler. This is passed to nvcc through the --compiler-bindir option.")
6464

65+
# pkg-config dependencies to be generated into the .pc file
66+
set(PKGCONFIG_EXTERNAL_DEPS_LIST "")
67+
6568
if (NOT BUILD_C_BINDINGS)
6669
set(BUILD_PYTHON_BINDINGS OFF)
6770
set(BUILD_MATLAB_BINDINGS OFF)
@@ -81,6 +84,7 @@ if (NOT HDF5_FOUND)
8184
message(WARNING "hdf5 library not found, some tests will not be run")
8285
else()
8386
include_directories(${HDF5_INCLUDE_DIR})
87+
list(APPEND PKGCONFIG_EXTERNAL_DEPS_LIST "hdf5")
8488
endif()
8589

8690
if (USE_MPI OR HDF5_IS_PARALLEL)
@@ -150,6 +154,7 @@ endif(BUILD_CUDA_LIB)
150154
find_package(PkgConfig REQUIRED)
151155
pkg_check_modules(LZ4 REQUIRED liblz4)
152156
include_directories(${LZ4_INCLUDE_DIRS})
157+
list(APPEND PKGCONFIG_EXTERNAL_DEPS_LIST "liblz4")
153158

154159
#set the C/C++ include path to the "include" directory
155160
include_directories(BEFORE ${PROJECT_SOURCE_DIR}/src/cpp)

cmake/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
set(PKG_DESC "Fast Library for Approximate Nearest Neighbors")
2+
3+
# Compute `PKG_EXTERNAL_DEPS` string from `PKGCONFIG_EXTERNAL_DEPS_LIST`.
4+
# Once the project has `cmake_minimum_required(VERSION 2.6)`, this
5+
# can be replaced by `list(JOIN ...)`.
6+
set(PKG_EXTERNAL_DEPS "")
7+
foreach(_dep ${PKGCONFIG_EXTERNAL_DEPS_LIST})
8+
string(APPEND PKG_EXTERNAL_DEPS " ${_dep}")
9+
endforeach()
10+
211
set(pkg_conf_file ${CMAKE_CURRENT_BINARY_DIR}/flann.pc)
312
configure_file(flann.pc.in ${pkg_conf_file} @ONLY)
413
install(FILES ${pkg_conf_file}

0 commit comments

Comments
 (0)