cmExternalMakefileProjectGenerator.cxx 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #include <assert.h>
  11. #include "cmExternalMakefileProjectGenerator.h"
  12. std::string cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
  13. const char* globalGenerator,
  14. const char* extraGenerator)
  15. {
  16. std::string fullName;
  17. if (globalGenerator)
  18. {
  19. if (extraGenerator && *extraGenerator)
  20. {
  21. fullName = extraGenerator;
  22. fullName += " - ";
  23. }
  24. fullName += globalGenerator;
  25. }
  26. return fullName;
  27. }
  28. const char* cmExternalMakefileProjectGenerator::GetGlobalGeneratorName(
  29. const char* fullName)
  30. {
  31. // at least one global generator must be supported
  32. assert(!this->SupportedGlobalGenerators.empty());
  33. if (fullName==0)
  34. {
  35. return 0;
  36. }
  37. std::string currentName = fullName;
  38. // if we get only the short name, take the first global generator as default
  39. if (currentName == this->GetName())
  40. {
  41. return this->SupportedGlobalGenerators[0].c_str();
  42. }
  43. // otherwise search for the matching global generator
  44. for (std::vector<std::string>::const_iterator
  45. it = this->SupportedGlobalGenerators.begin();
  46. it != this->SupportedGlobalGenerators.end();
  47. ++it)
  48. {
  49. if (this->CreateFullGeneratorName(it->c_str(), this->GetName())
  50. == currentName)
  51. {
  52. return it->c_str();
  53. }
  54. }
  55. return 0;
  56. }