summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalVisualStudio10Generator.cxx
diff options
context:
space:
mode:
authorPetr Kmoch <petr.kmoch@gmail.com>2013-03-21 14:53:26 (GMT)
committerBrad King <brad.king@kitware.com>2013-04-12 15:35:36 (GMT)
commit3cd400060162a0069d5798ce8dc33f0507594938 (patch)
tree18d53886f4e7eb65295f17b5770193c289576bfd /Source/cmGlobalVisualStudio10Generator.cxx
parentdf035e4825189c0d4d9519160d439e7f96a39086 (diff)
downloadCMake-3cd400060162a0069d5798ce8dc33f0507594938.zip
CMake-3cd400060162a0069d5798ce8dc33f0507594938.tar.gz
CMake-3cd400060162a0069d5798ce8dc33f0507594938.tar.bz2
VS: Use .sln parser to build targets in subdirs with msbuild (#13623)
Use cmVisualStudioSlnParser in GenerateBuildCommand() to provide correct command line for MSBuild even when target project is stored in a subdirectory.
Diffstat (limited to 'Source/cmGlobalVisualStudio10Generator.cxx')
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx35
1 files changed, 33 insertions, 2 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 2d0880f..742ab78 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -14,6 +14,8 @@
#include "cmLocalVisualStudio10Generator.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
+#include "cmVisualStudioSlnData.h"
+#include "cmVisualStudioSlnParser.h"
#include "cmake.h"
static const char vs10Win32generatorName[] = "Visual Studio 10";
@@ -259,9 +261,38 @@ std::string cmGlobalVisualStudio10Generator
}
else
{
+ std::string targetProject(targetName);
+ targetProject += ".vcxproj";
+ if (targetProject.find('/') == std::string::npos)
+ {
+ // it might be in a subdir
+ cmVisualStudioSlnParser parser;
+ cmSlnData slnData;
+ std::string slnFile;
+ if (projectDir && *projectDir)
+ {
+ slnFile = projectDir;
+ slnFile += '/';
+ slnFile += projectName;
+ }
+ else
+ {
+ slnFile = projectName;
+ }
+ if (parser.ParseFile(slnFile + ".sln", slnData,
+ cmVisualStudioSlnParser::DataGroupProjects))
+ {
+ if (cmSlnProjectEntry const* proj =
+ slnData.GetProjectByName(targetName))
+ {
+ targetProject = proj->GetRelativePath();
+ cmSystemTools::ConvertToUnixSlashes(targetProject);
+ }
+ }
+ }
+ makeCommand += " ";
+ makeCommand += targetProject;
makeCommand += " ";
- makeCommand += targetName;
- makeCommand += ".vcxproj ";
}
makeCommand += "/p:Configuration=";
if(config && strlen(config))