Modifying Extension's CMakeLists results in reconfigure the whole Application

I am developing a customized application generated by SlicerCustomAppTemplate.

From my experience of developing Slicer loadable extensions, it is supposed that when you edit the extension’s CMakeLists.txt, only the extension itself will be reconfigured and rebuilt.

However, when it comes to Customized Application, every time I edit the CMakeLists.txt of my loadable module, cmake reconfigures the whole custom application which takes very long time.

How does this happen and how to avoid such situation?

If you bundle an extension in a custom Slicer application then the extension is built as part of the application and so modification of the CMakeLists.txt file triggers reconfiguration of the entire applicaiton. This is indeed a quite long process - may take 5-10 minutes on Windows on a computer with a slow disk, using the MSVC generator.

However, since modification of CMakeLists.txt files is a very rare event (you add a source file once and then modify it hundreds or thousands of times) the task of reducing this configuration time would have low priority compared to most fixes and development of new features.