Replaced the logic to use VARIANT variable instead.

The CMAKE_CROSSCOMPILING variable cannot be used here because it will be always false since 'buildvm-*' is only built natively (not cross-compiling).