diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2011-06-22 15:52:15 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2011-06-22 15:52:15 (GMT) |
commit | ed0075bdb768f8272c2a9fc48e37bf9897427258 (patch) | |
tree | ce0c7ccaa5412d8a768bd3eefab5156b4596ff78 | |
parent | 38368d52f34086294f4647b97a7111fa2547905a (diff) | |
download | CMake-ed0075bdb768f8272c2a9fc48e37bf9897427258.zip CMake-ed0075bdb768f8272c2a9fc48e37bf9897427258.tar.gz CMake-ed0075bdb768f8272c2a9fc48e37bf9897427258.tar.bz2 |
Use relative paths for custom command inputs.
For source files we use full paths. This allows for longer directory
names with VS2010. However, the use of full paths causes the GUI
to not display the custom commands.
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index d15099a..facb551 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -367,10 +367,11 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, static_cast<cmGlobalVisualStudio7Generator *> (this->GlobalGenerator)->GetConfigurations(); this->WriteString("<CustomBuild Include=\"", 2); - std::string path = - cmSystemTools::RelativePath( - this->Makefile->GetCurrentOutputDirectory(), - sourcePath.c_str()); + // custom command have to use relative paths or they do not + // show up in the GUI + std::string path = cmSystemTools::RelativePath( + this->Makefile->GetCurrentOutputDirectory(), + sourcePath.c_str()); this->ConvertToWindowsSlash(path); (*this->BuildFileStream ) << path << "\">\n"; for(std::vector<std::string>::iterator i = configs->begin(); @@ -611,9 +612,14 @@ WriteGroupSources(const char* name, const char* filter = sourceGroup.GetFullName(); this->WriteString("<", 2); std::string path = source; - path = cmSystemTools::RelativePath( - this->Makefile->GetCurrentOutputDirectory(), - source.c_str()); + // custom command sources must use relative paths or they will + // not show up in the GUI. + if(sf->GetCustomCommand()) + { + path = cmSystemTools::RelativePath( + this->Makefile->GetCurrentOutputDirectory(), + source.c_str()); + } this->ConvertToWindowsSlash(path); (*this->BuildFileStream) << name << " Include=\"" << path; @@ -701,9 +707,8 @@ void cmVisualStudio10TargetGenerator::WriteCLSources() bool rc = lang && (strcmp(lang, "RC") == 0); bool idl = ext == "idl"; std::string sourceFile = (*source)->GetFullPath(); - sourceFile = cmSystemTools::RelativePath( - this->Makefile->GetCurrentOutputDirectory(), - sourceFile.c_str()); + // do not use a relative path here because it means that you + // can not use as long a path to the file. this->ConvertToWindowsSlash(sourceFile); // output the source file if(header) |