From 5001eed8a577f997be5f2ad50e0c8eb0999eb83f Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 15 Sep 2004 12:07:57 -0400 Subject: [PATCH] ENH: clean up of INCLUDE_EXTERNAL_MSPROJECT contributed by Clinton Stimpson --- Source/cmGlobalVisualStudio6Generator.cxx | 10 +++----- Source/cmGlobalVisualStudio71Generator.cxx | 26 +++++++++++--------- Source/cmGlobalVisualStudio7Generator.cxx | 17 +++++-------- Source/cmIncludeExternalMSProjectCommand.cxx | 8 ++---- Source/cmLocalVisualStudio7Generator.cxx | 6 ++--- 5 files changed, 29 insertions(+), 38 deletions(-) diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 474d911918..afceb6b24a 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -289,13 +289,9 @@ void cmGlobalVisualStudio6Generator::WriteDSWFile(std::ostream& fout, if (strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0) { cmCustomCommand cc = l->second.GetPostBuildCommands()[0]; - - // dodgy use of the cmCustomCommand's members to store the - // arguments from the INCLUDE_EXTERNAL_MSPROJECT command - std::vector stuff = cc.GetDepends(); - std::vector depends; - depends.push_back(cc.GetOutput()); - this->WriteExternalProject(fout, stuff[0].c_str(), stuff[1].c_str(), depends); + std::string project = cc.GetCommand(); + std::string location = cc.GetArguments(); + this->WriteExternalProject(fout, project.c_str(), location.c_str(), cc.GetDepends()); } else { diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 6867519892..814a0a1cc8 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -121,13 +121,10 @@ void cmGlobalVisualStudio71Generator::WriteSLNFile(std::ostream& fout, { cmCustomCommand cc = l->second.GetPostBuildCommands()[0]; - // dodgy use of the cmCustomCommand's members to store the - // arguments from the INCLUDE_EXTERNAL_MSPROJECT command - std::vector stuff = cc.GetDepends(); - std::vector depends; - depends.push_back(cc.GetOutput()); - this->WriteExternalProject(fout, stuff[0].c_str(), - stuff[1].c_str(), depends); + std::string project = cc.GetCommand(); + std::string location = cc.GetArguments(); + this->WriteExternalProject(fout, project.c_str(), + location.c_str(), cc.GetDepends()); } else { @@ -207,10 +204,9 @@ void cmGlobalVisualStudio71Generator::WriteSLNFile(std::ostream& fout, if (strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0) { cmCustomCommand cc = l->second.GetPostBuildCommands()[0]; - // dodgy use of the cmCustomCommand's members to store the - // arguments from the INCLUDE_EXTERNAL_MSPROJECT command - std::vector stuff = cc.GetDepends(); - this->WriteProjectConfigurations(fout, stuff[0].c_str(), l->second.IsInAll()); + std::string project = cc.GetCommand(); + + this->WriteProjectConfigurations(fout, project.c_str(), l->second.IsInAll()); } else if ((l->second.GetType() != cmTarget::INSTALL_FILES) && (l->second.GetType() != cmTarget::INSTALL_PROGRAMS)) @@ -291,7 +287,15 @@ void cmGlobalVisualStudio71Generator::WriteProjectDepends(std::ostream& fout, { std::string name = i->c_str(); if(strncmp(name.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0) + { + // kind of weird removing the first 27 letters. + // my recommendatsions: + // use cmCustomCommand::GetCommand() to get the project name + // or get rid of the target name starting with "INCLUDE_EXTERNAL_MSPROJECT_" and use another + // indicator/flag somewhere. These external project names shouldn't conflict with cmake + // target names anyways. name.erase(name.begin(), name.begin() + 27); + } fout << "\t\t{" << this->GetGUID(name.c_str()) << "} = {" << this->GetGUID(name.c_str()) << "}\n"; } diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index f3db0cc5e3..e667ede863 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -392,13 +392,10 @@ void cmGlobalVisualStudio7Generator::WriteSLNFile(std::ostream& fout, { cmCustomCommand cc = l->second.GetPostBuildCommands()[0]; - // dodgy use of the cmCustomCommand's members to store the - // arguments from the INCLUDE_EXTERNAL_MSPROJECT command - std::vector stuff = cc.GetDepends(); - std::vector depends; - depends.push_back(cc.GetOutput()); - this->WriteExternalProject(fout, stuff[0].c_str(), - stuff[1].c_str(), depends); + std::string project_name = cc.GetCommand(); + std::string location = cc.GetArguments(); + this->WriteExternalProject(fout, project_name.c_str(), + location.c_str(), cc.GetDepends()); } else { @@ -481,10 +478,8 @@ void cmGlobalVisualStudio7Generator::WriteSLNFile(std::ostream& fout, if (strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0) { cmCustomCommand cc = l->second.GetPostBuildCommands()[0]; - // dodgy use of the cmCustomCommand's members to store the - // arguments from the INCLUDE_EXTERNAL_MSPROJECT command - std::vector stuff = cc.GetDepends(); - this->WriteProjectConfigurations(fout, stuff[0].c_str(), l->second.IsInAll()); + std::string project = cc.GetCommand(); + this->WriteProjectConfigurations(fout, project.c_str(), l->second.IsInAll()); } else if ((l->second.GetType() != cmTarget::INSTALL_FILES) && (l->second.GetType() != cmTarget::INSTALL_PROGRAMS)) diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx index 8c00895ca9..7e87dad270 100644 --- a/Source/cmIncludeExternalMSProjectCommand.cxx +++ b/Source/cmIncludeExternalMSProjectCommand.cxx @@ -30,10 +30,6 @@ bool cmIncludeExternalMSProjectCommand::InitialPass(std::vector con { std::string location = args[1]; - std::vector name_and_location; - name_and_location.push_back(args[0]); - name_and_location.push_back(location); - std::vector depends; if (args.size() > 2) { @@ -47,8 +43,8 @@ bool cmIncludeExternalMSProjectCommand::InitialPass(std::vector con utility_name += "_"; utility_name += args[0]; - m_Makefile->AddUtilityCommand(utility_name.c_str(), "echo", "\"Include external project\"", - true, name_and_location, depends); + m_Makefile->AddUtilityCommand(utility_name.c_str(), args[0].c_str(), args[1].c_str(), + true, depends); } #endif diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 790cc1e186..84f10a5641 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1285,10 +1285,10 @@ void cmLocalVisualStudio7Generator::ConfigureFinalPass() for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) { if (strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0) - { + { cmCustomCommand cc = l->second.GetPostBuildCommands()[0]; - std::vector stuff = cc.GetDepends(); - gg->CreateGUID(stuff[0].c_str()); + std::string project_name = cc.GetCommand(); + gg->CreateGUID(project_name.c_str()); } else {