cmake-gui: Fix regression that prints an incidental error on fresh build trees

Since commit a872844908 (cmake-gui: Handle relative paths in the build
directory text input, 2024-04-24, v3.30.0-rc1~5^2), `cmake-gui` gave an
incidental error message even when a valid build directory was being
passed.  Fix this by checking for a non-empty path before using it.

Fixes: #26744
This commit is contained in:
Juan Ramos 2025-03-05 15:21:42 -08:00 committed by Brad King
parent 2bd6fbe1b0
commit e9c494005c

View File

@ -94,7 +94,8 @@ void QCMake::setSourceDirectory(const QString& _dir)
emit this->sourceDirChanged(this->SourceDirectory);
this->loadPresets();
this->setPreset(QString{});
if (!cmSystemTools::FileIsFullPath(
if (!this->MaybeRelativeBinaryDirectory.isEmpty() &&
!cmSystemTools::FileIsFullPath(
this->MaybeRelativeBinaryDirectory.toStdString())) {
this->setBinaryDirectory(this->MaybeRelativeBinaryDirectory);
}