JNI Project: SDK path, don't compile native code per default


I have some JNI Projects, projects containing Java and native code. The java code is easy to compile, but the JNI part is tricky because I depend on third party libs. So to make things easy for someone who checks out the code, I want to make the native compile part optional (and don’t compile per default).

Now my basic questions are:

What is the best way to configure an SDK path?

I would like to give two options: an environment variable (like JAVA_HOME) and/or a property (in gradle.properties). How do I evaluate if these properties are set?

And if the above conditions are not met, how do I skip a native build? I’ve seen there exists a buildable attribute?

Best regards,
Andreas Fagschlunger