Closed talih0 closed 1 week ago
Yeah, found this same issue. Put foo.c in the source list and touched src/cpp/foo.c so it would find it. There must be a correct way to do this with cmake.
I had the same problem (Ubuntu 20.04 and cmake 3.16.3). The problem was resolved by adding an empty file.
The cmake function add_library()
only allows to omit source files if they are added later using the target_sources()
function, which is not the case here. It seems that the flann
library is a shared version of the static library flann_s
, that's the reason why the linker option -whole-archive
is enabled when linking the flann_s
library (and then disabled).
I'm not sure why the static library has to be created to build the shared library, but it seems to be used only for Linux when the compiler is gcc.
cmake version 3.16.3 creates following two errors:
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
The issue is caused with the following two lines: https://github.com/mariusmuja/flann/blob/master/src/cpp/CMakeLists.txt#L33 https://github.com/mariusmuja/flann/blob/master/src/cpp/CMakeLists.txt#L91
Creating a dummy file instead of having an empty list seems to solve the problem