I'm building a project for first time and its really confusing. I've included a project through using gitmodules and I'm using Visual Studio and I want to statically link that project in my own project. The issue is that the project doesn't come with a Visual Studio solution, so I'm left with running CMake on this. However, I saw online through looking on GitHub that people use scripts to run all the prerequisite stuff for building. So I've made batch scripts and python scripts and its going well so far.
But I haven't been able to find anywhere online that shows how to get the CMake version using Python.
I want the Python script to detect if CMake is installed or not and if it is installed then to check its version.
Current my Python code looks like this
if cmake --version <= 3.22.1:
exit(1)
This gives me errors though: SyntaxError: invalid syntax
Running cmake --version
in the terminal shows the version as expected.
"cmake version 3.22.1"
I'm trying to get the CMake version from the call to be used in an if statement in python rather than just calling cmake --version
in python.
Does anyone know how to do this? Also if this is an XY problem, please let me know. I don't know what I'm doing!