The CMake documentation explicitly states that file(GLOB ...) is not
recommended to collect source files for a build, but it doesn’t
mention what the recommended method actually is.
Specifying every source file manually sounds a little bit too manually
to me. So, what is the right method to collect source files, if not
file(GLOB ...)?
Manual is indeed the recommended method. By recommending against using GLOB, the documentation is simply warning against a build system that depends on files present. For example, you want to add a test executable, so you create mytest.cpp. Oops. Now your library compilation breaks. The documentation for AUX_SOURCE_DIRECTORY (similar purpose as globbing for for source files) gives the following warning:
If you’re certain that you want all the contents of a directory, and don’t plan on adding new ones, then by all means use a GLOB.
Also, don’t forget listing files manually doesn’t have to involve typing all the filenames. You could do, for example,
ls *.cpp >> CMakeLists.txt, then use your editor to move the list of files to the correct place in the file.