cmake-gui: Fix selected item mismatched CMAKE_GENERATOR_PLATFORM env

The first empty item in the combobox causes a misalignment with the
actual setting by `CMAKE_GENERATOR_PLATFORM` environment variable.
This commit is contained in:
dou fu
2022-09-01 03:28:11 -04:00
committed by Brad King
parent 8ac6634b2f
commit 5671c5270b

View File

@@ -244,7 +244,8 @@ void StartCompilerSetup::onGeneratorChanged(int index)
if (!DefaultGeneratorPlatform.isEmpty()) {
int platform_index = platforms.indexOf(DefaultGeneratorPlatform);
if (platform_index != -1) {
this->PlatformOptions->setCurrentIndex(platform_index);
// The index is off-by-one due to the first empty item added above.
this->PlatformOptions->setCurrentIndex(platform_index + 1);
}
}
} else {