[CMake] Exclude CMakeFiles path from GLOB_RECURSE
cmake.org › pipermail › cmakeJul 01, 2010 · Never use GLOB_RECURSE. It's evil. E.g. if you add or remove source files, CMake has no way of knowing that it should be re-run. > I have tested rerunning cmake manually and it worked out well. (Testcase: I added a new .cpp file to the build) I either have to change the CMakeLists.txt or to rerun cmake manually. Seems to be the same effort for me.
CMake exclude files from a given pattern after file(GLOB_RECURSE)
stackoverflow.com › questions › 32016750There is no EXCLUDE option for file (GLOB_RECURSE ...) command flow. You probably take this option from file (COPY|INSTALL ...), which is a different command flow. You may iterate over list, obtained from file (GLOB_RECURSE) and exclude needed files manually: macro ( add_recursive dir retVal) # Store unfiltered list of files into temporary list file ( GLOB_RECURSE _tmp_list $ {dir}/*.h $ {dir}/*.cpp $ {dir}/*.c $ {dir}/*.inl ) # Resulted list is initially empty.
file — CMake 3.23.0-rc3 Documentation
cmake.org › cmake › helpNew in version 3.3: By default GLOB lists directories - directories are omitted in result if LIST_DIRECTORIES is set to false. New in version 3.12: If the CONFIGURE_DEPENDS flag is specified, CMake will add logic to the main build system check target to rerun the flagged GLOB commands at build time.