0

I am pretty new to C++ development with Android Studio.

I tried to add new .cpp/.h file(s) to my project. and android studio cannot find the references to these new files unless I added them to the CmakeLists.txt file. And the build will fail if I don't add them.

I found it super tedious this way. I would love to know if there is any way I can sync new files in the CmakeLists.txt

Thanks in advance.

enter image description here

Terence
  • 652
  • 11
  • 34
  • You are probably looking to use [`GLOB`](https://cmake.org/cmake/help/latest/command/file.html#glob) as shown in the top answer to [this](https://stackoverflow.com/q/3201154/3987854) question. This option is historically discouraged (see the linked docs) even by CMake itself. If you do choose to use it, you should use it with the option `CONFIGURE_DEPENDS`. – Kevin Jun 01 '20 at 12:40
  • As a project evolves, the rate of adding new files tends to slow down and most changes are to existing files. So personally I don't see it as a problem that once in a while you have to add a new file or two to your CMakeLists.txt files. It is a trivial task and takes a few seconds and is negligible compared to the time you spend doing other work on your project. – Jesper Juhl Jun 01 '20 at 13:13

0 Answers0