birdofpreyru / react-native-static-server

Embedded HTTP server for React Native
https://dr.pogodin.studio/docs/react-native-static-server
Other
142 stars 22 forks source link

Cmake detection in Android builds #57

Closed birdofpreyru closed 1 year ago

birdofpreyru commented 1 year ago

The following might cause an obscure failure when building for Android on Ubuntu host (probably on other build host systems as well): https://github.com/birdofpreyru/react-native-static-server/blob/9758fe6526f438bd6fc376c313102f0622c7c4f1/CMakeLists.txt#L65-L78

The problem is that CMake might be installed as a part of the Android Studio installation, and not installed system-wide; then on surface CMake part of the native build works alright; however this particular cmake build step, executed as a child build process, will fail (because calling cmake command it now assumes system-wide cmake command, and does not find the one coming from Android Studio installation) silently (because the fail-on-error options are commented out in favor of supporting older CMake versions). In result, the outer CMake build continues and fails further below saying it could not find PCRE2 library (which silently failed to build); or, presumably, if there is a system-wide PCRE2 library installation, not suitable for Android, it may try to use that in fail in other obscure ways down the line.

TODO: Figure out how to update the command to ensure we are using the same cmake Android Studio uses.