WIP: Support python CMakeLists.
TL;DR
Support running python scripts as CMakeLists:
Description - Desired behavior
When there is a CMakeLists.py
file in the directory, cmake would run it instead of looking for CMakeLists.txt
. Where CMakeLists.py
is a minimal python file (e.g. without any non-builtin modules other than cmake).
There would be a minimal cmake API for python (1-3 functions) with a few python modules for the actual implementation. For example, cmPythonAPI_runCommand
would run a command. then, the python module would implement cmake
's commands (e.g. add_library, etc).
Task list
-
Support cmMakeFile
abstraction:cmMakeFile
should be able to read both.txt
files and.py
files according to the files in the current directory (.py
should be preferred). -
In order to support this command in python, move cmake_minimum_required
validation code fromConfigure
to its own command. -
Implement the CMake->Python API: should not be more than 2-3 function (currently unstable): -
cmake_run_command(name, *args, **kwargs)
: should parse a list of parameters and run the command "name". -
cmake_get_var(name)
: get a cmake variable. -
cmake_put_var(name, object_value)
: set a cmake variable.
-
-
Implement rich cmake Python API from the functions above. -
Implement mPyMakefileProcessor::Configure
to run theCMakeLists.py
file.
Please let me know about any issues, problems, or suggestions. Thank you.