Does CMake have a REPL (Read-Eval-Print Loop) ?

As the title says:

Does CMake have a REPL (Read-Eval-Print Loop) ?

At present I am fairly sure the answer is no but better to ask than not.

Remember I am new to CMake so if something is wrong here please point it out.

Why would one need a REPL for CMake?

One of the first things one does when creating a new CmakeLists.txt file is to use one of the find commands

AFAIK the only way to see what a find command is searching is to use the CMAKE_FIND_DEBUG_MODE or something similar but such requires running cmake as a program for the entire process. If one thinks of a build as a tree of goals with one of the branches being a find which can also be a tree of sub find goals then why not just run the find command interactively and modify the find subgoals until the find command is working as expected. This way a user can more quickly see what a find is doing, learn how a find works faster as a new user and also see spurious results that can be pruned from the search.

While this notes find as an example there are many more such reasons to have a REPL, think building up the root goal (CMakeLists.txt) from many branches and leaves of the problem state.

In researching this question am just now finding

CMake has a lot of state that gets carried around. I suppose some kind of “find” REPL might be possible since the state space is small, but there will be issues around find_package since some packages want languages enabled to be able to query the compiler. This kind of stuff generally just requires the cache.

I suppose a tool could be proposed where setup is done and “snapshotted” and then some specific sequence of commands is run based on that snapshot. Editing any of the setup prep would obviously require making a new snapshot from the beginning (or perhaps the prior snapshot). The state is tidier than it used to be, but lifetime issues may arise when trying to rewind the state like this.