summaryrefslogtreecommitdiffstats
path: root/Source/cmCablePackageCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2001-03-08 21:13:27 (GMT)
committerBrad King <brad.king@kitware.com>2001-03-08 21:13:27 (GMT)
commit71153219e19446350006f84e0b712e912bb0e291 (patch)
tree8a316ed37e6ba9392373ee0900caab3e2ac6c9e8 /Source/cmCablePackageCommand.cxx
parent02fe9118038019e05320081d893340a659f8daa3 (diff)
downloadCMake-71153219e19446350006f84e0b712e912bb0e291.zip
CMake-71153219e19446350006f84e0b712e912bb0e291.tar.gz
CMake-71153219e19446350006f84e0b712e912bb0e291.tar.bz2
ENH: Added creation of custom rules for generating CABLE packages.
Diffstat (limited to 'Source/cmCablePackageCommand.cxx')
-rw-r--r--Source/cmCablePackageCommand.cxx45
1 files changed, 41 insertions, 4 deletions
diff --git a/Source/cmCablePackageCommand.cxx b/Source/cmCablePackageCommand.cxx
index a6787e2..50332b3 100644
--- a/Source/cmCablePackageCommand.cxx
+++ b/Source/cmCablePackageCommand.cxx
@@ -32,17 +32,54 @@ bool cmCablePackageCommand::Invoke(std::vector<std::string>& args)
m_PackageName = args[0];
// Ask the cable data to begin the package. This may call another
- // cmCablePackageCommand's WritePackageFooter().
+ // cmCablePackageCommand's WritePackageFooter(). This will call
+ // this cmCablePackageCommand's WritePackageHeader().
m_CableData->BeginPackage(this);
- // Write the configuration for this command.
- // The cmCableData::EndPackage() later on will call WritePackageFooter().
- this->WritePackageHeader();
+ // Add custom rules to the makefile to generate this package's source
+ // files.
+ std::vector<std::string> depends;
+ depends.push_back("cable_config.xml");
+
+ std::string command = "${CABLE}";
+ m_Makefile->ExpandVariablesInString(command);
+ depends.push_back(command);
+ command += " cable_config.xml";
+
+ std::string packageFile = "Cxx/"+m_PackageName+"_cxx";
+ std::string packageHeader = packageFile+".h";
+ std::string packageSource = packageFile+".cxx";
+
+ // A rule for the package's header file.
+ m_Makefile->AddCustomCommand("",
+ packageHeader.c_str(),
+ command.c_str(),
+ depends);
+
+ // A rule for the package's source file.
+ m_Makefile->AddCustomCommand("",
+ packageSource.c_str(),
+ command.c_str(),
+ depends);
return true;
}
+void cmCablePackageCommand::FinalPass()
+{
+ // Add a rule to build the generated package.
+ std::string fileName = "Cxx/"+m_PackageName+"_cxx";
+ std::string filePath = m_Makefile->GetStartOutputDirectory();
+ cmClassFile file;
+ file.m_AbstractClass = false;
+ file.SetName(fileName.c_str(), filePath.c_str(), "cxx", false);
+
+ m_CableData->SetPackageClassIndex(m_Makefile->GetClasses().size());
+ m_Makefile->AddClass(file);
+}
+
+
/**
* Write a CABLE package header.
*/