cmTarget.cxx 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Insight Consortium. All rights reserved.
  8. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmTarget.h"
  14. #include "cmMakefile.h"
  15. void cmTarget::GenerateSourceFilesFromSourceLists(const cmMakefile &mf)
  16. {
  17. // this is only done for non install targets
  18. if ((this->m_TargetType == cmTarget::INSTALL_FILES)
  19. || (this->m_TargetType == cmTarget::INSTALL_PROGRAMS))
  20. {
  21. return;
  22. }
  23. // for each src lists add the classes
  24. for (std::vector<std::string>::const_iterator s = m_SourceLists.begin();
  25. s != m_SourceLists.end(); ++s)
  26. {
  27. // replace any variables
  28. std::string temps = *s;
  29. mf.ExpandVariablesInString(temps);
  30. // look for a srclist
  31. if (mf.GetSources().find(temps) != mf.GetSources().end())
  32. {
  33. const std::vector<cmSourceFile> &clsList =
  34. mf.GetSources().find(temps)->second;
  35. // if we ahave a limited build list, use it
  36. m_SourceFiles.insert(m_SourceFiles.end(),
  37. clsList.begin(),
  38. clsList.end());
  39. }
  40. // if one wasn't found then assume it is a single class
  41. else
  42. {
  43. cmSourceFile file;
  44. file.SetIsAnAbstractClass(false);
  45. file.SetName(temps.c_str(), mf.GetCurrentDirectory(),
  46. mf.GetSourceExtensions(),
  47. mf.GetHeaderExtensions());
  48. m_SourceFiles.push_back(file);
  49. }
  50. }
  51. // expand any link library variables whle we are at it
  52. LinkLibraries::iterator p = m_LinkLibraries.begin();
  53. for (;p != m_LinkLibraries.end(); ++p)
  54. {
  55. mf.ExpandVariablesInString(p->first);
  56. }
  57. }
  58. void cmTarget::MergeLibraries(const LinkLibraries &ll)
  59. {
  60. typedef std::vector<std::pair<std::string,LinkLibraryType> > LinkLibraries;
  61. LinkLibraries::const_iterator p = ll.begin();
  62. for (;p != ll.end(); ++p)
  63. {
  64. m_LinkLibraries.push_back(*p);
  65. }
  66. }