You can use project properties that can be set on the command line.
if( hasProperty( 'myprop' ) ) {
include( 'subproject' )
}
./gradlew -Pmyprop ...
You can also use the value of the property for whatever you need.
if( hasProperty( 'myprop' ) ) {
include( myprop )
}
./gradlew -Pmyprop=subproject ...