summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorPhil Pritchett <p.pritchett@2d3.com>2001-10-31 12:03:32 (GMT)
committerPhil Pritchett <p.pritchett@2d3.com>2001-10-31 12:03:32 (GMT)
commit4ba36ca453792be53916d29ee056f94232fd85f7 (patch)
tree945337627151687961e96d5f7c556ec2712faa1c /Source
parent4a8b9ecf98d33b891f83dd75b2158f50a2d8dcb1 (diff)
downloadCMake-4ba36ca453792be53916d29ee056f94232fd85f7.zip
CMake-4ba36ca453792be53916d29ee056f94232fd85f7.tar.gz
CMake-4ba36ca453792be53916d29ee056f94232fd85f7.tar.bz2
INCLUDE_EXTERNAL_MSPROJECT command
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCommands.cxx2
-rw-r--r--Source/cmDSPWriter.cxx5
-rw-r--r--Source/cmDSWWriter.cxx47
-rw-r--r--Source/cmDSWWriter.h3
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.cxx34
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.h58
6 files changed, 147 insertions, 2 deletions
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 55d8da6..550f580 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -31,6 +31,7 @@
#include "cmIfCommand.cxx"
#include "cmIncludeCommand.cxx"
#include "cmIncludeDirectoryCommand.cxx"
+#include "cmIncludeExternalMSProjectCommand.cxx"
#include "cmIncludeRegularExpressionCommand.cxx"
#include "cmInstallFilesCommand.cxx"
#include "cmInstallProgramsCommand.cxx"
@@ -89,6 +90,7 @@ void GetPredefinedCommands(std::list<cmCommand*>& commands)
commands.push_back(new cmIfCommand);
commands.push_back(new cmIncludeCommand);
commands.push_back(new cmIncludeDirectoryCommand);
+ commands.push_back(new cmIncludeExternalMSProjectCommand);
commands.push_back(new cmIncludeRegularExpressionCommand);
commands.push_back(new cmInstallFilesCommand);
commands.push_back(new cmInstallProgramsCommand);
diff --git a/Source/cmDSPWriter.cxx b/Source/cmDSPWriter.cxx
index 8d52ee4..4b2f405 100644
--- a/Source/cmDSPWriter.cxx
+++ b/Source/cmDSPWriter.cxx
@@ -124,8 +124,11 @@ void cmDSPWriter::OutputDSPFile()
cmSystemTools::Error("Bad target type", l->first.c_str());
break;
}
+ // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
+ // so don't build a projectfile for it
if ((l->second.GetType() != cmTarget::INSTALL_FILES)
- && (l->second.GetType() != cmTarget::INSTALL_PROGRAMS))
+ && (l->second.GetType() != cmTarget::INSTALL_PROGRAMS)
+ && (l->first != "INCLUDE_EXTERNAL_MSPROJECT"))
{
this->CreateSingleDSP(l->first.c_str(),l->second);
}
diff --git a/Source/cmDSWWriter.cxx b/Source/cmDSWWriter.cxx
index 378a3e2..07ad24d 100644
--- a/Source/cmDSWWriter.cxx
+++ b/Source/cmDSWWriter.cxx
@@ -172,7 +172,18 @@ void cmDSWWriter::WriteDSWFile(std::ostream& fout)
}
}
// Write the project into the DSW file
- if ((l->second.GetType() != cmTarget::INSTALL_FILES)
+ if (l->first == "INCLUDE_EXTERNAL_MSPROJECT")
+ {
+ cmCustomCommand cc = l->second.GetCustomCommands()[0];
+
+ // dodgy use of the cmCustomCommand's members to store the
+ // arguments from the INCLUDE_EXTERNAL_MSPROJECT command
+ std::vector<std::string> stuff = cc.GetDepends();
+ std::vector<std::string> depends = cc.GetOutputs();
+ this->WriteExternalProject(fout, stuff[0].c_str(), stuff[1].c_str(), depends);
+ ++si;
+ }
+ else if ((l->second.GetType() != cmTarget::INSTALL_FILES)
&& (l->second.GetType() != cmTarget::INSTALL_PROGRAMS))
{
this->WriteProject(fout, si->c_str(), dir.c_str(),
@@ -186,6 +197,7 @@ void cmDSWWriter::WriteDSWFile(std::ostream& fout)
delete mf;
}
}
+
// Write the footer for the DSW file
this->WriteDSWFooter(fout);
}
@@ -248,6 +260,39 @@ void cmDSWWriter::WriteProject(std::ostream& fout,
fout << "}}}\n\n";
}
+
+// Write a dsp file into the DSW file,
+// Note, that dependencies from executables to
+// the libraries it uses are also done here
+void cmDSWWriter::WriteExternalProject(std::ostream& fout,
+ const char* name,
+ const char* location,
+ const std::vector<std::string>& dependencies)
+{
+ fout << "#########################################################"
+ "######################\n\n";
+ fout << "Project: \"" << name << "\"="
+ << location << " - Package Owner=<4>\n\n";
+ fout << "Package=<5>\n{{{\n}}}\n\n";
+ fout << "Package=<4>\n";
+ fout << "{{{\n";
+
+
+ std::vector<std::string>::const_iterator i, end;
+ // write dependencies.
+ i = dependencies.begin();
+ end = dependencies.end();
+ for(;i!= end; ++i)
+ {
+ fout << "Begin Project Dependency\n";
+ fout << "Project_Dep_Name " << *i << "\n";
+ fout << "End Project Dependency\n";
+ }
+ fout << "}}}\n\n";
+}
+
+
+
// Standard end of dsw file
void cmDSWWriter::WriteDSWFooter(std::ostream& fout)
{
diff --git a/Source/cmDSWWriter.h b/Source/cmDSWWriter.h
index 9e94d4a..6d51b0e 100644
--- a/Source/cmDSWWriter.h
+++ b/Source/cmDSWWriter.h
@@ -71,6 +71,9 @@ private:
void WriteProject(std::ostream& fout,
const char* name, const char* path,
cmDSPWriter* project, const cmTarget &t);
+ void WriteExternalProject(std::ostream& fout,
+ const char* name, const char* path,
+ const std::vector<std::string>& dependencies);
void WriteDSWFooter(std::ostream& fout);
cmMakefile* m_Makefile;
};
diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx
new file mode 100644
index 0000000..3968ce4
--- /dev/null
+++ b/Source/cmIncludeExternalMSProjectCommand.cxx
@@ -0,0 +1,34 @@
+#include "cmIncludeExternalMSProjectCommand.h"
+
+// cmIncludeExternalMSProjectCommand
+bool cmIncludeExternalMSProjectCommand::InitialPass(std::vector<std::string> const& args)
+{
+ if(args.size() < 2)
+ {
+ this->SetError("INCLUDE_EXTERNAL_MSPROJECT called with incorrect number of arguments");
+ return false;
+ }
+
+
+ if(m_Makefile->GetDefinition("WIN32")) {
+
+ std::string location = args[1];
+ m_Makefile->ExpandVariablesInString(location);
+
+ std::vector<std::string> name_and_location;
+ name_and_location.push_back(args[0]);
+ name_and_location.push_back(location);
+
+ std::vector<std::string> depends;
+ if (args.size() > 2) {
+ for (int i=2; i<args.size(); ++i) {
+ depends.push_back(args[i]);
+ }
+ }
+
+ m_Makefile->AddUtilityCommand("INCLUDE_EXTERNAL_MSPROJECT", "echo", "\"Include external project\"",
+ false, name_and_location, depends);
+
+ }
+ return true;
+}
diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h
new file mode 100644
index 0000000..5c97051
--- /dev/null
+++ b/Source/cmIncludeExternalMSProjectCommand.h
@@ -0,0 +1,58 @@
+#ifndef cmIncludeExternalMSProjectCommand_h
+#define cmIncludeExternalMSProjectCommand_h
+
+#include "cmStandardIncludes.h"
+#include "cmCommand.h"
+
+/** \class cmIncludeExternalMSProjectCommand
+ * \brief Specify an external MS project file for inclusion in the workspace.
+ *
+ * cmIncludeExternalMSProjectCommand is used to specify an externally generated
+ * Microsoft project file for inclusion in the default workspace generated by
+ * CMake.
+ */
+class cmIncludeExternalMSProjectCommand : public cmCommand
+{
+public:
+ /**
+ * This is a virtual constructor for the command.
+ */
+ virtual cmCommand* Clone()
+ {
+ return new cmIncludeExternalMSProjectCommand;
+ }
+
+ /**
+ * This is called when the command is first encountered in
+ * the CMakeLists.txt file.
+ */
+ virtual bool InitialPass(std::vector<std::string> const& args);
+
+ /**
+ * The name of the command as specified in CMakeList.txt.
+ */
+ virtual const char* GetName() {return "INCLUDE_EXTERNAL_MSPROJECT";}
+
+ /**
+ * Succinct documentation.
+ */
+ virtual const char* GetTerseDocumentation()
+ {
+ return "Include an external Microsoft project file in a workspace.";
+ }
+
+ /**
+ * More documentation.
+ */
+ virtual const char* GetFullDocumentation()
+ {
+ return
+ "INCLUDE_EXTERNAL_MSPROJECT(projectname location dep1 dep2 ...) Includes an external Microsoft project in the workspace file. Does nothing on UNIX currently\n";
+ }
+
+ cmTypeMacro(cmIncludeExternalMSProjectCommand, cmCommand);
+};
+
+
+
+#endif