Skip to content

Globs trigger unnecessary CMake re-run when rebuilding #1463

Description

@andrewcorrigan

My code uses yaml-cpp via add_subdirectory and I was attempting to speed-up cmake --build . --parallel for the case when nothing has changed. One of the things that came up was that yaml-cpp consistently triggers a cmake re-run,

ninja explain: .../VerifyGlobs.cmake_force is dirty
[0/2] Re-checking globbed directories...
[1/2] Re-running CMake...

Would there be interest in avoiding this by eliminating the Glob? I see #1349 , but it looks like it's over a year old without any feedback, so wanted to open up a discussion here.

-set(contrib-pattern "src/contrib/*.cpp")
-set(src-pattern "src/*.cpp")
-if (CMAKE_VERSION VERSION_GREATER 3.12)
-  list(INSERT contrib-pattern 0 CONFIGURE_DEPENDS)
-  list(INSERT src-pattern 0 CONFIGURE_DEPENDS)
-endif()
-
-file(GLOB yaml-cpp-contrib-sources ${contrib-pattern})
-file(GLOB yaml-cpp-sources ${src-pattern})
+set(yaml-cpp-contrib-sources
+  src/contrib/graphbuilder.cpp
+  src/contrib/graphbuilderadapter.cpp)
+
+set(yaml-cpp-sources
+  src/binary.cpp
+  src/convert.cpp
+  src/depthguard.cpp
+  src/directives.cpp
+  src/emit.cpp
+  src/emitfromevents.cpp
+  src/emitter.cpp
+  src/emitterstate.cpp
+  src/emitterutils.cpp
+  src/exceptions.cpp
+  src/exp.cpp
+  src/fptostring.cpp
+  src/memory.cpp
+  src/node.cpp
+  src/node_data.cpp
+  src/nodebuilder.cpp
+  src/nodeevents.cpp
+  src/null.cpp
+  src/ostream_wrapper.cpp
+  src/parse.cpp
+  src/parser.cpp
+  src/regex_yaml.cpp
+  src/scanner.cpp
+  src/scanscalar.cpp
+  src/scantag.cpp
+  src/scantoken.cpp
+  src/simplekey.cpp
+  src/singledocparser.cpp
+  src/stream.cpp
+  src/tag.cpp)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions