I'm developing a cpp library and my CMakeList.txt starts to look like a big list of files. The library provides UI components so there is a lot of small classes, and UI related files. I find it hard to maintain as it hides logic and I wonder if there's something I can do.
I started making directories to regroup some files that are strongly connected to each other to make it clearer but it doesn't help the CMakeList. I consider two approaches:
- Using file and GLOB but I read that's not recommended
 - Using "*.cmake" file in subfolders that will list files so I can keep the main CMakeLists.txt clean (or at least less overloaded).
 
To illustrate:
MyLibrary
│  CMakeLists.txt   ////< Big CMakeLists I want to split
│  filexxx.cpp
|  filexxx.h
│  more and more files
|  ...
└───Component
│   │   filexxx.cpp
│   │   filexxx.h
│   │   ...
└───SomeDialog
│   │   filexxx.cpp
│   │   filexxx.h
└───... ///< more directories
└───ui
│   │   someUiRelatedStuff.ui
│   │   someUiRelatedStuff.ui
CMakeLists.txt
set(${PROJECT_NAME}_SRC
   filexxx.cpp
   Component/filexxx.cpp
   SomeDialog/filexxx.cpp
   # and so on for hundred of lines ...
)
# same goes for _HDR and _UI
All I could find was how to organize large project with multiple libraries or executables but not how to manage a big one. The closest question was : How to write "CMakeLists.txt" for a big project with multiple subdirectories? but it's not really helping.