SlicerCustomAppTemplate build fails on Loadable Module

I have a SlicerCustomApplication with a loadable module with this tree structure:

.
├── CMakeLists.txt
├── Logic
│   ├── CMakeLists.txt
│   ├── vtkKernelFeedMultiply.cxx
│   ├── vtkKernelFeedMultiply.h
│   ├── vtkSlicerFeedMultiplyLogic.cxx
│   └── vtkSlicerFeedMultiplyLogic.h
├── Resources
│   ├── Icons
│   │   └── FeedMultiply.png
│   ├── UI
│   │   ├── qSlicerFeedMultiplyFooBarWidget.ui
│   │   └── qSlicerFeedMultiplyModuleWidget.ui
│   └── qSlicerFeedMultiplyModule.qrc
├── Testing
│   ├── CMakeLists.txt
│   └── Cxx
│       └── CMakeLists.txt
├── Widgets
│   ├── CMakeLists.txt
│   ├── qSlicerFeedMultiplyFooBarWidget.cxx
│   └── qSlicerFeedMultiplyFooBarWidget.h
├── build.sh
├── qSlicerFeedMultiplyModule.cxx
├── qSlicerFeedMultiplyModule.h
├── qSlicerFeedMultiplyModuleWidget.cxx
└── qSlicerFeedMultiplyModuleWidget.h

the customapp always built correctly while this module was bundled in an Extension. Now for development reasons I had to take this out of such extension and add it directly through the cmake Slicer_EXTENSION_SOURCE_DIRS variable in the app CMakeLists.txt.

Now the build fails with:

/opt/p/Slicer-build/E/FeedMultiply/qSlicerFeedMultiplyModuleWidgetGenericTest.cxx:51:10: fatal error: 'qSlicerFeedMultiplyModule.h' file not found
#include "qSlicerFeedMultiplyModule.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [E/FeedMultiply/CMakeFiles/qSlicerFeedMultiplyModuleGenericCxxTests.dir/qSlicerFeedMultiplyModuleWidgetGenericTest.cxx.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/opt/p/Slicer-build/E/FeedMultiply/qSlicerFeedMultiplyModuleGenericTest.cxx:49:10: fatal error: 'qSlicerFeedMultiplyModule.h' file not found
#include "qSlicerFeedMultiplyModule.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [E/FeedMultiply/CMakeFiles/qSlicerFeedMultiplyModuleGenericCxxTests.dir/qSlicerFeedMultiplyModuleGenericTest.cxx.o] Error 1
make[1]: *** [E/FeedMultiply/CMakeFiles/qSlicerFeedMultiplyModuleGenericCxxTests.dir/all] Error 2
make: *** [all] Error 2

A workaround is commenting the default flag WITH_GENERIC_TESTS in slicerMacroBuildLoadableModule in the module CMakeLists.txt. Then it build correctly

Any suggestion on why this happens?

Thank you very much

You can compare your CMakeLists.txt files with similar files in other extensions, such as in SlicerIGT.