Skip to content

Commit

Permalink
Fix lz4 missing from flann.pc Requires: line.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nh2 committed Nov 1, 2021
1 parent 1d04523 commit d8eff43
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ option(USE_MPI "Use MPI" OFF)

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

# pkg-config dependencies to be generated into the .pc file
set(PKGCONFIG_EXTERNAL_DEPS_LIST "")

if (NOT BUILD_C_BINDINGS)
set(BUILD_PYTHON_BINDINGS OFF)
set(BUILD_MATLAB_BINDINGS OFF)
Expand Down Expand Up @@ -148,6 +151,7 @@ endif(BUILD_CUDA_LIB)

find_package(PkgConfig REQUIRED)
pkg_check_modules(LZ4 REQUIRED liblz4)
list(APPEND PKGCONFIG_EXTERNAL_DEPS_LIST "liblz4")

#set the C/C++ include path to the "include" directory
include_directories(BEFORE ${PROJECT_SOURCE_DIR}/src/cpp)
Expand Down
9 changes: 9 additions & 0 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
set(PKG_DESC "Fast Library for Approximate Nearest Neighbors")

# Compute `PKG_EXTERNAL_DEPS` string from `PKGCONFIG_EXTERNAL_DEPS_LIST`.
# Once the project has `cmake_minimum_required(VERSION 2.6)`, this
# can be replaced by `list(JOIN ...)`.
set(PKG_EXTERNAL_DEPS "")
foreach(_dep ${PKGCONFIG_EXTERNAL_DEPS_LIST})
string(APPEND PKG_EXTERNAL_DEPS " ${_dep}")
endforeach()

set(pkg_conf_file ${CMAKE_CURRENT_BINARY_DIR}/flann.pc)
configure_file(flann.pc.in ${pkg_conf_file} @ONLY)
install(FILES ${pkg_conf_file}
Expand Down

0 comments on commit d8eff43

Please sign in to comment.