My question is similar to this one, except that in that question, he wanted to pass arguments directly from gradle to CMake. But in my case, I am not directly invoking the cmake build, but rather "flutter is doing it for me"
So to put it all together, when the app build starts:
- gradle build of the app starts (
build.gradle
in the flutter project) ------(1) - the above build invokes gradle build of the plugin (
build.gradle
in the plugin's project) ------(2) - the gradle build of the plugin invokes the CMake build of the plugin (
CMakeLists.txt
in the plugin project) ------(3)
Now sending args from step (2) to step (3) is as mentioned in the link above.
My question is how to send args from step (1) to step (2)?
I am not very experienced with gradle but I tried inspecting the build.gradle
file of step (1) to see from where it is invoking the build.gradle
of the plugin, but I wasn't able to do that.
Update:
- this answer is very similar to what I want, except that, as I mentioned, I want to pass variable from a gradle build that indirectly invokes cmake.
- The use case for me is as follows: the plugin has some C code and uses shared libraries, these libraries have different versions and the user must choose one of them at build time, thats why I want the user to pass variables to cmake, for ex:
externalNativeBuild {
cmake {
arguments "-DLIB_VERSION=VERSION_WITH_SOME_OPTION"
}
}
and then in CMake:
if(${LIB_VERSION})
# link some version of the shared libs
else()
# link another version