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-file-api. Could that be a segue to creating a REPL by using the CMake API from a language with an existing REPL? I don’t see find results as objects but perhaps that could easily be added.
- cmake_language
- Why CMake functions can’t return value?