diff options
author | Brad King <brad.king@kitware.com> | 2012-04-27 15:00:22 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-04-27 17:17:16 (GMT) |
commit | b2e7c7aef0375d5d676632d8cc3a7c2d96d6a8fa (patch) | |
tree | 48723daaa6817c6ad71f435c668141bcd6d60342 /Source | |
parent | 4248132e59a8401a96d9c20ef155d80e439e7346 (diff) | |
download | CMake-b2e7c7aef0375d5d676632d8cc3a7c2d96d6a8fa.zip CMake-b2e7c7aef0375d5d676632d8cc3a7c2d96d6a8fa.tar.gz CMake-b2e7c7aef0375d5d676632d8cc3a7c2d96d6a8fa.tar.bz2 |
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.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 7c38d4b..f8e4c30 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -751,13 +751,28 @@ WriteGroupSources(const char* name, void cmVisualStudio10TargetGenerator::WriteSource( const char* tool, cmSourceFile* sf, const char* end) { - std::string sourceFile = sf->GetFullPath(); - // do not use a relative path here because it means that you - // can not use as long a path to the file. - // custom command sources must use relative paths or they will - // not show up in the GUI. - bool forceRelative = sf->GetCustomCommand()? true:false; - sourceFile = this->ConvertPath(sourceFile, forceRelative); + // Visual Studio tools append relative paths to the current dir, as in: + // + // c:\path\to\current\dir\..\..\..\relative\path\to\source.c + // + // and fail if this exceeds the maximum allowed path length. Our path + // conversion uses full paths outside the build tree to allow deeper trees. + 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->WriteString("<", 2); (*this->BuildFileStream ) << tool << |