When I call cmake like this, everything works:
cmake -G'Android Gradle - Ninja' ..
However, I'm setting up a bash script that lets me specify the target platform, changing the -G argument dynamically.
#!/usr/bin/env bash
CMAKE_GENERATOR="Ninja"
if [[ $TARGET_PLATFORM == "android" ]] ; then
CMAKE_GENERATOR="'Android Gradle - Ninja'"
fi
cmake -G$CMAKE_GENERATOR ..
This gives me the following error:
CMake Error: Could not create named generator 'Android
Apparently cmake splits the generator name at the whitespace and interprets it as multiple arguments. I've tried multiple combinations of escaping the single/double quotes as well as the whitespaces but can't get it to work. I'm not even sure if this is a cmake or bash issue. Any ideas?