Patch from Slava for JNI & cmake