summaryrefslogtreecommitdiff
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-04-27 08:34:49 -0400
committerBrad King <brad.king@kitware.com>2012-04-27 09:15:03 -0400
commit4f2d9d2da56b13b5780387492a400baa03d5bf70 (patch)
tree45975504955da28e2b3baedeff37f5651db17dfc /Source/cmVisualStudio10TargetGenerator.cxx
parenta7d0fb1470cc7c900abfff14a87039d353a8c2b3 (diff)
downloadcmake-4f2d9d2da56b13b5780387492a400baa03d5bf70.tar.gz
VS10: Refactor custom commands to use WriteSource
All other source file elements are already written through WriteSource. Refactor custom command source element generation into WriteSource too.
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx32
1 files changed, 19 insertions, 13 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 9c25b0cd43..9a0c5e1be6 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -491,14 +491,9 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations();
- this->WriteString("<CustomBuild Include=\"", 2);
- // 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";
+
+ this->WriteSource("CustomBuild", source, ">\n");
+
for(std::vector<std::string>::iterator i = configs->begin();
i != configs->end(); ++i)
{
@@ -796,15 +791,26 @@ WriteGroupSources(const char* name,
}
void cmVisualStudio10TargetGenerator::WriteSource(
- const char* tool, cmSourceFile* sf, bool end)
+ 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.
+ if(sf->GetCustomCommand())
+ {
+ // custom command sources must use relative paths or they will
+ // not show up in the GUI.
+ sourceFile = cmSystemTools::RelativePath(
+ this->Makefile->GetCurrentOutputDirectory(),
+ sourceFile.c_str());
+ }
+ else
+ {
+ // 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);
this->WriteString("<", 2);
(*this->BuildFileStream ) << tool <<
- " Include=\"" << sourceFile << (end? "\" />\n" : "\" ");
+ " Include=\"" << sourceFile << "\"" << (end? end : " />\n");
}
void cmVisualStudio10TargetGenerator::WriteSources(
@@ -836,7 +842,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
bool cl = strcmp(lang, "C") == 0 || strcmp(lang, "CXX") == 0;
bool rc = strcmp(lang, "RC") == 0;
const char* tool = cl? "ClCompile" : (rc? "ResourceCompile" : "None");
- this->WriteSource(tool, *si, false);
+ this->WriteSource(tool, *si, " ");
// ouput any flags specific to this source file
if(cl && this->OutputSourceSpecificFlags(*si))
{