CMake: Normalize file paths before comparing them

On windows we got false negatives due to one path starting with "C:" and
the other with "c:". Use Utils::FileName which should do the right thing.

Change-Id: I7dcf8ad3f61caca7ac7c183d492ebfd57fe1b669
Reviewed-by: Cristian Adam <cristian.adam@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2016-03-29 11:59:36 +02:00
parent 35bafd3952
commit 34b18c699c

View File

@@ -280,7 +280,9 @@ CMakeConfig BuildDirManager::parsedConfiguration() const
CMakeConfig result = parseConfiguration(cacheFile, &errorMessage); CMakeConfig result = parseConfiguration(cacheFile, &errorMessage);
if (!errorMessage.isEmpty()) if (!errorMessage.isEmpty())
emit errorOccured(errorMessage); emit errorOccured(errorMessage);
if (CMakeConfigItem::valueOf("CMAKE_HOME_DIRECTORY", result) != sourceDirectory().toString().toUtf8()) const Utils::FileName sourceOfBuildDir
= Utils::FileName::fromUtf8(CMakeConfigItem::valueOf("CMAKE_HOME_DIRECTORY", result));
if (sourceOfBuildDir != sourceDirectory()) // Use case-insensitive compare where appropriate
emit errorOccured(tr("The build directory is not for %1").arg(sourceDirectory().toUserOutput())); emit errorOccured(tr("The build directory is not for %1").arg(sourceDirectory().toUserOutput()));
return result; return result;