VS11: Do not use source path conversion workaround specific to VS 10
CMake <= 2.8.4 generated VS 10 project files with a relative path to
source files. Then commit ed0075bd
(Use relative paths for custom command
inputs, 2011-06-22) switched to using relative paths only for source files
holding custom commands and full paths for other sources. This behavior
was inhereted by the VS 11 generator but is not needed so use the
workaround only for exactly VS 10. Explain the behavior in comments.
This commit is contained in:
parent
4248132e59
commit
b2e7c7aef0
|
@ -751,13 +751,28 @@ WriteGroupSources(const char* name,
|
||||||
void cmVisualStudio10TargetGenerator::WriteSource(
|
void cmVisualStudio10TargetGenerator::WriteSource(
|
||||||
const char* tool, cmSourceFile* sf, const char* end)
|
const char* tool, cmSourceFile* sf, const char* end)
|
||||||
{
|
{
|
||||||
std::string sourceFile = sf->GetFullPath();
|
// Visual Studio tools append relative paths to the current dir, as in:
|
||||||
// do not use a relative path here because it means that you
|
//
|
||||||
// can not use as long a path to the file.
|
// c:\path\to\current\dir\..\..\..\relative\path\to\source.c
|
||||||
// custom command sources must use relative paths or they will
|
//
|
||||||
// not show up in the GUI.
|
// and fail if this exceeds the maximum allowed path length. Our path
|
||||||
bool forceRelative = sf->GetCustomCommand()? true:false;
|
// conversion uses full paths outside the build tree to allow deeper trees.
|
||||||
sourceFile = this->ConvertPath(sourceFile, forceRelative);
|
bool forceRelative = false;
|
||||||
|
std::string sourceFile = this->ConvertPath(sf->GetFullPath(), false);
|
||||||
|
if(this->LocalGenerator->GetVersion() == cmLocalVisualStudioGenerator::VS10
|
||||||
|
&& cmSystemTools::FileIsFullPath(sourceFile.c_str()))
|
||||||
|
{
|
||||||
|
// Normal path conversion resulted in a full path. VS 10 (but not 11)
|
||||||
|
// refuses to show the property page in the IDE for a source file with a
|
||||||
|
// full path (not starting in a '.' or '/' AFAICT). CMake <= 2.8.4 used a
|
||||||
|
// relative path but to allow deeper build trees now CMake uses a full
|
||||||
|
// path except for custom commands which work only as relative paths.
|
||||||
|
if(sf->GetCustomCommand())
|
||||||
|
{
|
||||||
|
forceRelative = true;
|
||||||
|
sourceFile = this->ConvertPath(sf->GetFullPath(), forceRelative);
|
||||||
|
}
|
||||||
|
}
|
||||||
this->ConvertToWindowsSlash(sourceFile);
|
this->ConvertToWindowsSlash(sourceFile);
|
||||||
this->WriteString("<", 2);
|
this->WriteString("<", 2);
|
||||||
(*this->BuildFileStream ) << tool <<
|
(*this->BuildFileStream ) << tool <<
|
||||||
|
|
Loading…
Reference in New Issue