When file(GLOB ...) is called, CMake applies regex to all files it can find. The question is whether it’s done only on first cmake invocation, or every time?
In other words, does use of file(GLOB ...) slows down Makefiles regenration process? The same question can be applied to file(GLOB_RECURSE ...).
It’s done every time (the results might be different, naturally).
Don’t worry about it slowing you down. Build systems have to do a
stat(or equivalent) on tens, hundreds, or thousands of files every invocation and a glob or two won’t even show up as a blip.