android cmakelist add multi source file?

Viewed 2021

I write NDK project using Android Studio & CMakelist.

But when I want to include lots cpp/c files to CMakelists.txt , I can not find a easy way to do it gently.

I need your help.

Here is my code's file tree sample:

Cmakelists.txt
src
|__main
     |__cpp
         |___a.cpp   // cpp file 
         |___a.h
         |___aa.c   //   c file
         |___...
         |___dirA    //  a dir
              |__b.c  // also has c file 
              |__b.h
              |__d.cpp  // and cpp file
              |__...
              |___dirB  // another dir
                   |__xxx.c
                   |__...

In my Cmakelist, I used

file(GLOB cpp_srcs "src/main/cpp/*.cpp")

This seems only include the fist directory layer's cpp files , NOT include c files, and the sub dir's cpp/c files .

Any way to make it ? The dir is too deep, I don't want to add cpp/c files manually.

1 Answers
Related