diff options
author | Brad King <brad.king@kitware.com> | 2001-04-26 19:27:38 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2001-04-26 19:27:38 (GMT) |
commit | 61d23149893dcba75115486187a39ce853e091b9 (patch) | |
tree | 64bd472802296213e0189094f3592e28cd25e9fe | |
parent | 2c1fb789d7a182ab0df53aad474a657d59d894b0 (diff) | |
download | CMake-61d23149893dcba75115486187a39ce853e091b9.zip CMake-61d23149893dcba75115486187a39ce853e091b9.tar.gz CMake-61d23149893dcba75115486187a39ce853e091b9.tar.bz2 |
ENH: Changed WriteConfiguration to non-const so it can do error checking. Added parsing and output of a name for each WrapperSet generated from a CABLE_WRAP command.
-rw-r--r-- | Source/cmCableInstantiateClassCommand.cxx | 4 | ||||
-rw-r--r-- | Source/cmCableInstantiateClassCommand.h | 2 | ||||
-rw-r--r-- | Source/cmCableInstantiateCommand.cxx | 4 | ||||
-rw-r--r-- | Source/cmCableInstantiateCommand.h | 2 | ||||
-rw-r--r-- | Source/cmCablePackageCommand.cxx | 22 | ||||
-rw-r--r-- | Source/cmCablePackageEntryCommand.cxx | 4 | ||||
-rw-r--r-- | Source/cmCablePackageEntryCommand.h | 2 | ||||
-rw-r--r-- | Source/cmCableSourceFilesCommand.cxx | 4 | ||||
-rw-r--r-- | Source/cmCableSourceFilesCommand.h | 2 | ||||
-rw-r--r-- | Source/cmCableWrapCommand.cxx | 16 | ||||
-rw-r--r-- | Source/cmCableWrapCommand.h | 2 |
11 files changed, 49 insertions, 15 deletions
diff --git a/Source/cmCableInstantiateClassCommand.cxx b/Source/cmCableInstantiateClassCommand.cxx index 939f530..f6ab833 100644 --- a/Source/cmCableInstantiateClassCommand.cxx +++ b/Source/cmCableInstantiateClassCommand.cxx @@ -23,7 +23,7 @@ * Write the CABLE configuration code to define this InstantiationSet. * This includes the "class" keyword to do class template instantiations. */ -void cmCableInstantiateClassCommand::WriteConfiguration() const +bool cmCableInstantiateClassCommand::WriteConfiguration() { std::ostream& os = m_CableData->GetOutputStream(); cmCableData::Indentation indent = m_CableData->GetIndentation(); @@ -46,4 +46,6 @@ void cmCableInstantiateClassCommand::WriteConfiguration() const os << "</Element>" << std::endl; } os << indent << "</InstantiationSet>" << std::endl; + + return true; } diff --git a/Source/cmCableInstantiateClassCommand.h b/Source/cmCableInstantiateClassCommand.h index b592cd7..5663093 100644 --- a/Source/cmCableInstantiateClassCommand.h +++ b/Source/cmCableInstantiateClassCommand.h @@ -63,7 +63,7 @@ public: "template classes (not functions, operators, etc)."; } - virtual void WriteConfiguration() const; + virtual bool WriteConfiguration(); cmTypeMacro(cmCableInstantiateClassCommand, cmCableInstantiateCommand); protected: diff --git a/Source/cmCableInstantiateCommand.cxx b/Source/cmCableInstantiateCommand.cxx index 629e6da..09483bb 100644 --- a/Source/cmCableInstantiateCommand.cxx +++ b/Source/cmCableInstantiateCommand.cxx @@ -22,7 +22,7 @@ /** * Write the CABLE configuration code to define this InstantiationSet. */ -void cmCableInstantiateCommand::WriteConfiguration() const +bool cmCableInstantiateCommand::WriteConfiguration() { std::ostream& os = m_CableData->GetOutputStream(); cmCableData::Indentation indent = m_CableData->GetIndentation(); @@ -45,4 +45,6 @@ void cmCableInstantiateCommand::WriteConfiguration() const os << "</Element>" << std::endl; } os << indent << "</InstantiationSet>" << std::endl; + + return true; } diff --git a/Source/cmCableInstantiateCommand.h b/Source/cmCableInstantiateCommand.h index 4f8f2bd..d8ea9f6 100644 --- a/Source/cmCableInstantiateCommand.h +++ b/Source/cmCableInstantiateCommand.h @@ -62,7 +62,7 @@ public: "template non-classes (functions, operators, etc)."; } - virtual void WriteConfiguration() const; + virtual bool WriteConfiguration(); cmTypeMacro(cmCableInstantiateCommand, cmCablePackageCommand); protected: diff --git a/Source/cmCablePackageCommand.cxx b/Source/cmCablePackageCommand.cxx index 1808dee..6776fc3 100644 --- a/Source/cmCablePackageCommand.cxx +++ b/Source/cmCablePackageCommand.cxx @@ -100,6 +100,7 @@ bool cmCablePackageCommand::Invoke(std::vector<std::string>& args) // Add custom rules to the makefile to generate this package's source // files. + { std::string command = "${CABLE}"; m_Makefile->ExpandVariablesInString(command); std::vector<std::string> depends; @@ -115,6 +116,27 @@ bool cmCablePackageCommand::Invoke(std::vector<std::string>& args) command.c_str(), depends, outputs, m_TargetName.c_str()); + } + + // Add custom rules to the makefile to generate this package's xml files. + { + std::string command = "${GCCXML}"; + m_Makefile->ExpandVariablesInString(command); + std::vector<std::string> depends; + depends.push_back(command); + std::string input = "Cxx/"+m_PackageName+"_cxx.cxx"; + std::string output = "Cxx/"+m_PackageName+"_cxx.xml"; + command = "\""+command+"\" ${CXX_FLAGS} -fsyntax-only -fxml=" + output + " -c " + input; + + std::vector<std::string> outputs; + outputs.push_back("Cxx/"+m_PackageName+"_cxx.xml"); + + // A rule for the package's source files. + m_Makefile->AddCustomCommand(input.c_str(), + command.c_str(), + depends, + outputs, m_TargetName.c_str()); + } // add the source list to the target m_Makefile->GetTargets()[m_TargetName.c_str()].GetSourceLists().push_back(m_PackageName); diff --git a/Source/cmCablePackageEntryCommand.cxx b/Source/cmCablePackageEntryCommand.cxx index 5930272..add6a35 100644 --- a/Source/cmCablePackageEntryCommand.cxx +++ b/Source/cmCablePackageEntryCommand.cxx @@ -36,7 +36,5 @@ bool cmCablePackageEntryCommand::Invoke(std::vector<std::string>& args) } // Write this command's configuration. - this->WriteConfiguration(); - - return true; + return this->WriteConfiguration(); } diff --git a/Source/cmCablePackageEntryCommand.h b/Source/cmCablePackageEntryCommand.h index e4ef3bd..a108ae1 100644 --- a/Source/cmCablePackageEntryCommand.h +++ b/Source/cmCablePackageEntryCommand.h @@ -42,7 +42,7 @@ public: cmTypeMacro(cmCablePackageEntryCommand, cmCableCommand); - virtual void WriteConfiguration() const =0; + virtual bool WriteConfiguration() =0; protected: typedef std::vector<std::string> Entries; diff --git a/Source/cmCableSourceFilesCommand.cxx b/Source/cmCableSourceFilesCommand.cxx index 50e4d2c..13f1218 100644 --- a/Source/cmCableSourceFilesCommand.cxx +++ b/Source/cmCableSourceFilesCommand.cxx @@ -45,7 +45,7 @@ void cmCableSourceFilesCommand::FinalPass() * Write the CABLE configuration code to indicate header dependencies for * a package. */ -void cmCableSourceFilesCommand::WriteConfiguration() const +bool cmCableSourceFilesCommand::WriteConfiguration() { std::ostream& os = m_CableData->GetOutputStream(); cmCableData::Indentation indent = m_CableData->GetIndentation(); @@ -77,6 +77,8 @@ void cmCableSourceFilesCommand::WriteConfiguration() const } } os << indent << "</Headers>" << std::endl; + + return true; } diff --git a/Source/cmCableSourceFilesCommand.h b/Source/cmCableSourceFilesCommand.h index 4aefeb0..7b58c21 100644 --- a/Source/cmCableSourceFilesCommand.h +++ b/Source/cmCableSourceFilesCommand.h @@ -67,7 +67,7 @@ public: "Generates a Package's Headers block in the CABLE configuration."; } - virtual void WriteConfiguration() const; + virtual bool WriteConfiguration(); bool SourceFileExists(const std::string&) const; cmTypeMacro(cmCableSourceFilesCommand, cmCableCommand); diff --git a/Source/cmCableWrapCommand.cxx b/Source/cmCableWrapCommand.cxx index c42f81f..46f5142 100644 --- a/Source/cmCableWrapCommand.cxx +++ b/Source/cmCableWrapCommand.cxx @@ -19,16 +19,22 @@ /** * Write the CABLE configuration code to define this WrapperSet. */ -void cmCableWrapCommand::WriteConfiguration() const +bool cmCableWrapCommand::WriteConfiguration() { + if(m_Entries.size() < 2) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + std::ostream& os = m_CableData->GetOutputStream(); cmCableData::Indentation indent = m_CableData->GetIndentation(); cmRegularExpression needCdataBlock("[&<>]"); - os << indent << "<WrapperSet>" << std::endl; - for(Entries::const_iterator e = m_Entries.begin(); - e != m_Entries.end(); ++e) + Entries::const_iterator e = m_Entries.begin(); + os << indent << "<WrapperSet name=\"" << e->c_str() << "\">" << std::endl; + for(++e;e != m_Entries.end(); ++e) { os << indent << " <Element>"; if(needCdataBlock.find(e->c_str())) @@ -42,4 +48,6 @@ void cmCableWrapCommand::WriteConfiguration() const os << "</Element>" << std::endl; } os << indent << "</WrapperSet>" << std::endl; + + return true; } diff --git a/Source/cmCableWrapCommand.h b/Source/cmCableWrapCommand.h index 9054795..e139714 100644 --- a/Source/cmCableWrapCommand.h +++ b/Source/cmCableWrapCommand.h @@ -59,7 +59,7 @@ public: "Generates a WrapSet in the CABLE configuration."; } - virtual void WriteConfiguration() const; + virtual bool WriteConfiguration(); cmTypeMacro(cmCableWrapCommand, cmCablePackageCommand); }; |