CMake Error (ADD_LIBRARY): Cannot find source file:

AndroidStudio编译cmake报错如下:
CMake Error at dvbv5/CMakeLists.txt:68 (ADD_LIBRARY):
Cannot find source file:
compat-soname.c,
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx

CMake Error at dvbv5/CMakeLists.txt:68 (ADD_LIBRARY):
No SOURCES given to target: libdvbv5

CMake Generate step failed. Build files cannot be regenerated correctly.

对比了文件名compat-soname.c,在相同目录下的文件compat-soname.c一模一样,找了半天,才发现文件名称后面多了一个逗号,文件名中不能出现这个逗号。
修改如下:

#设置变量LOCAL_SRC_FILES
SET(LOCAL_SRC_FILES
       compat-soname.c #,此处不要有逗号分割
       countries.c)
#指定编译为动态库
ADD_LIBRARY(libdvbv5 SHARED ${LOCAL_SRC_FILES})

你可能感兴趣的:(android,c++,开发语言,android-studio)