7

Always when I add a new C++-File, Android Studio informs me that the file is not part of my project and I should include the new file in the appropriate build file (build.gradle, CMakeLists.txt, Android.mk, etc.).

I have always to click manually on "Refresh Linked C++-Projects" to get Android Studio to include my new C++-File in the project.

I am using Cmake and I glob my C++-Files by the line file(GLOB CPP_FILES "src/main/cpp/*.cpp") in the CMakeLists.txt.

How can I make Android Studio to refresh liked C++-Project automatically if a new Cpp-File was added?

Thanks in advance!

Sebastian
  • 183
  • 1
  • 12
  • 1
    Possible duplicate of [Why is cmake file GLOB evil?](http://stackoverflow.com/questions/32411963/why-is-cmake-file-glob-evil) – Florian Feb 20 '17 at 08:29
  • Yes, if I do not use glob I would have to include each new file which should be part of the project in CMakeLists.txt manually. Thus, CMakeLists.txt has changed and Andoid Studio will call it automatically during the build-process. But if you have lots of C++-files, you might forget to inlcude one or more in the CMakeLists.txt. So, this is no smart workflow in my opinion. – Sebastian Feb 20 '17 at 09:19
  • 1
    The question is how CMake should know that a new file was added to your file system's directory? You could force CMake to run the configruation/generation step every time, but that's time consuming. So you have to find another trigger for re-scanning your files (see e.g. my answer [here](http://stackoverflow.com/questions/30949452/cmake-ninja-attempting-to-compile-deleted-cpp-file/31183245#31183245) if you use Git). – Florian Feb 20 '17 at 09:55

0 Answers0