Federico Picetti
Federico Picetti

Reputation: 83

Building FLANN with Cmake fails

I am trying to build FLANN libraries in order to build PCL library afterwards.

I get an error while using CMake to compile the source. I guess I am missing something very basic. Since I can't find a compiled library for my system I have to build it myself.

With the command

~/flann-1.8.4-src/build> cmake ..

I get

CMake Error at src/cpp/CMakeLists.txt:86 (add_library):
No SOURCES given to target: flann
CMake Error at src/cpp/CMakeLists.txt:32 (add_library):
No SOURCES given to target: flann_cpp

This happens with flann 1.8.4 and 1.9.1 on a SLES11 operating system.

Any hint?

Here a complete transcription of what cmake says:

-- Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS) (found     version "")
CMake Warning at CMakeLists.txt:76 (message):
  hdf5 library not found, some tests will not be run


-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY)
CMake Warning at CMakeLists.txt:115 (message):
  gtest library not found, some tests will not be run


-- Found OpenMP_C: -fopenmp
-- Found OpenMP_CXX: -fopenmp
-- Found OpenMP: TRUE
CMake Warning at src/matlab/CMakeLists.txt:79 (message):
  Cannot find MATLAB or Octave instalation.  Make sure that the 'bin'
  directory from the MATLAB instalation or that mkoctfile is in PATH


hdf5 library not found, not compiling flann_example.cpp
-- Could NOT find LATEX (missing: LATEX_COMPILER)
-- Install prefix: /usr/local
-- Build type: RelWithDebInfo
-- Building C bindings: ON
-- Building python bindings: ON
-- Building matlab bindings: ON
-- Building CUDA library: OFF
-- Using OpenMP support: ON
-- Using MPI support: OFF
-- Configuring done
CMake Error at src/cpp/CMakeLists.txt:86 (add_library):
  No SOURCES given to target: flann


CMake Error at src/cpp/CMakeLists.txt:32 (add_library):
  No SOURCES given to target: flann_cpp
-- Build files have been written to: ~/flann-1.8.4-src/build

Upvotes: 1

Views: 6684

Answers (1)

Omkar Patil
Omkar Patil

Reputation: 51

In your flann dir run

touch src/cpp/empty.cpp

In src/cpp/CMakeLists.txt replace

add_library(flann_cpp SHARED "") and add_library(flann SHARED "")

with

add_library(flann_cpp SHARED empty.cpp) and add_library(flann SHARED empty.cpp)

Hope this helps :) link, thanks to the comment by Tsyvarev

Upvotes: 5

Related Questions