HI, everyone
I am writing a tool related to cmake, it will collect all of packages declared in cmakelists.txt by every command find_package.
so given a cmake-related project, this tool will output a json object, then thought apt or rpm, it will try resolving the dependency problem. like bellow:
{
"sdl": {
"installed": "no",
"model": "",
"version": "2.0"
},
"jpeg": {
"installed": "yes",
"model": "REQUIRED",
"version": ""
},
...
}
I have found a private method named cmake::findpackage in cmake_source_top_dir_/Source/cmake.h, I guess it meens that, give it a vector<std::string>, it will try finding needed package.
but how to collect a packages list in cmakelists.txt and cmakelists.txt in subdirectories?
I can just collect them by parsing the command find_package(), but if there is a “if” outside the command, it will be complex.
thanks.