Is there a way to check when any cmake task has finished purely from the filesystem/build directory?

If I am running a cmake task, let’s say CMakeConfigure, (and I know that I am running configure in the main thread), Is there a way for another thread to check if this configure step is completed just by looking at the Filesystem/build directory while not having any communication with the main thread on the status of first cmake task/command (if the command is complete or exited)?

(Like say read the file outputs in the CMakeCache.txt or codemodel targets per target or something and check some file for an exit code and a timestamp…?)

Reason for this:
I want to chain commands one after another, like Clean Rebuild, which cleans, generates and builds the project. The way I intend to do this is by sending the entire string of commands to a terminal (with the enter or return key) and when the command finishes, we launch the next task only on success of the previous.


Exact Reference:

You can check the generator-specific file that is expected to exist. build.ninja, Makefile, etc. You need to know the generator and IDE generators (I believe) have the top-level project name in their “main” expected file.

The other thing to do would be to have a command sequence like:

rm -f cmake-success cmake-failure
cmake … && touch cmake-success || touch cmake-failure

and watch for those files.

Thanks for the reply!
Actually chaining commands is what I didn’t want to do… Or make is toolchain specific.

Is there something more pure CMakeSpecific? Like a file whose timestamp is updated each and every time we run any cmake command?

There might be, but I don’t think there’s any stability guarantee there.

Though there is one thing that might work: the CMake File API. You can drop some dummy query and when the response is updated, CMake is “done enough”. I don’t know if there’s a guaranteed order between it and the build files being ready. Might be worth experimenting with at least.

Thanks for the suggestion!