cmCableSourceFilesCommand.cxx 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2000 National Library of Medicine
  8. All rights reserved.
  9. See COPYRIGHT.txt for copyright details.
  10. =========================================================================*/
  11. #include "cmCableSourceFilesCommand.h"
  12. #include "cmCacheManager.h"
  13. void cmCableSourceFilesCommand::FinalPass()
  14. {
  15. // Get the index of the current package's cmClassFile.
  16. // If it doesn't exist, ignore this command.
  17. int index = m_CableData->GetPackageClassIndex();
  18. if(index < 0)
  19. { return; }
  20. // The package's file has not yet been generated yet. The dependency
  21. // finder will need hints. Add one for each source file.
  22. cmClassFile& cFile = m_Makefile->GetClasses()[index];
  23. for(Entries::const_iterator f = m_Entries.begin();
  24. f != m_Entries.end(); ++f)
  25. {
  26. std::string header = *f+".h";
  27. cFile.m_Depends.push_back(header);
  28. }
  29. }
  30. /**
  31. * Write the CABLE configuration code to indicate header dependencies for
  32. * a package.
  33. */
  34. void cmCableSourceFilesCommand::WriteConfiguration() const
  35. {
  36. std::ostream& os = m_CableData->GetOutputStream();
  37. cmCableData::Indentation indent = m_CableData->GetIndentation();
  38. cmRegularExpression needCdataBlock("[&<>]");
  39. // Look for the files on a path relative to the current CMakeLists.txt.
  40. std::string curPath = m_Makefile->GetCurrentDirectory();
  41. curPath += "/";
  42. os << indent << "<Headers>" << std::endl;
  43. for(Entries::const_iterator f = m_Entries.begin();
  44. f != m_Entries.end(); ++f)
  45. {
  46. // Look for the normal include file.
  47. std::string header = *f+".h";
  48. if(cmSystemTools::FileExists((curPath+header).c_str()))
  49. {
  50. os << indent << " <File name=\"" << header.c_str() << "\"/>"
  51. << std::endl;
  52. }
  53. else
  54. {
  55. cmSystemTools::Error("Unable to find source file ", header.c_str());
  56. }
  57. // Look for an instantiation file.
  58. std::string txx = *f+".txx";
  59. if(cmSystemTools::FileExists((curPath+txx).c_str()))
  60. {
  61. os << indent << " <File name=\"" << txx.c_str()
  62. << "\" purpose=\"instantiate\"/>" << std::endl;
  63. }
  64. }
  65. os << indent << "</Headers>" << std::endl;
  66. }