forked from qt-creator/qt-creator
CppTools: Do not use -isystem for header paths in the repository
Clang uses mmap for system headers. This locks the header files on Windows. If the project file is not in the root directory of the repository, and it uses header files that are outside its directory, but in the repository, Git operations like checkout, rebase etc. can fail because the header files are locked. Change-Id: If8a258234479fc70ca0a8384bf24c68d767dbeaa Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
cab82a94c7
commit
c62daf9cda
@@ -26,6 +26,7 @@
|
||||
#include "compileroptionsbuilder.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/vcsmanager.h>
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
@@ -137,7 +138,12 @@ static Utils::FileName projectTopLevelDirectory(const ProjectPart &projectPart)
|
||||
{
|
||||
if (!projectPart.project)
|
||||
return Utils::FileName();
|
||||
return projectPart.project->projectDirectory();
|
||||
const Utils::FileName result = projectPart.project->projectDirectory();
|
||||
const Utils::FileName vcsTopLevel = Utils::FileName::fromString(
|
||||
Core::VcsManager::findTopLevelForDirectory(result.toString()));
|
||||
if (result.isChildOf(vcsTopLevel))
|
||||
return vcsTopLevel;
|
||||
return result;
|
||||
}
|
||||
|
||||
void CompilerOptionsBuilder::addHeaderPathOptions()
|
||||
@@ -165,10 +171,13 @@ void CompilerOptionsBuilder::addHeaderPathOptions()
|
||||
// intentional fall-through:
|
||||
case HeaderPath::IncludePath:
|
||||
path = absoluteDirectory(headerPath.path);
|
||||
if (path == projectDirectory || path.isChildOf(projectDirectory))
|
||||
if (projectDirectory.isEmpty()
|
||||
|| path == projectDirectory
|
||||
|| path.isChildOf(projectDirectory)) {
|
||||
prefix = defaultPrefix;
|
||||
else
|
||||
} else {
|
||||
prefix = SYSTEM_INCLUDE_PREFIX;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user