问题:CMake Error at CMakeLists.txt:24 (add_subdirectory):
add_subdirectory given source "gtest" which is not an existing directory.
解答:
Cmake < 3.11 doesn't support add_library without any source file, but flann CMake use a trick that use an empty string "" as source list (i.e add_library(foo SHARED "")).
The existing flann Cmake code violates the new behavior of add_library() for Cmake>=3.11.
buildroot/buildroot@45a39b3
It turns out in Cmake 3.11, "add_library()" and "add_executable()" commands can be called without any sources and won't complain as long as sources are added later via "target_sources()" command.
https://blog.kitware.com/cmake-3-11-0-available-for-download