cmGlobalUnixMakefileGenerator.cxx 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "cmGlobalUnixMakefileGenerator.h"
  14. #include "cmLocalUnixMakefileGenerator.h"
  15. #include "cmMakefile.h"
  16. #include "cmake.h"
  17. cmGlobalUnixMakefileGenerator::cmGlobalUnixMakefileGenerator()
  18. {
  19. // This type of makefile always requires unix style paths
  20. m_ForceUnixPaths = true;
  21. m_FindMakeProgramFile = "CMakeUnixFindMake.cmake";
  22. }
  23. void cmGlobalUnixMakefileGenerator::EnableLanguage(std::vector<std::string>const& languages,
  24. cmMakefile *mf)
  25. {
  26. mf->AddDefinition("CMAKE_CFG_INTDIR",".");
  27. this->cmGlobalGenerator::EnableLanguage(languages, mf);
  28. std::string path;
  29. for(std::vector<std::string>::const_iterator l = languages.begin();
  30. l != languages.end(); ++l)
  31. {
  32. const char* lang = l->c_str();
  33. std::string langComp = "CMAKE_";
  34. langComp += lang;
  35. langComp += "_COMPILER";
  36. if(!mf->GetDefinition(langComp.c_str()))
  37. {
  38. cmSystemTools::Error(langComp.c_str(), " not set, after EnableLanguage");
  39. continue;
  40. }
  41. const char* cc = mf->GetRequiredDefinition(langComp.c_str());
  42. path = cmSystemTools::FindProgram(cc);
  43. if(path.size() == 0)
  44. {
  45. std::string message = "your ";
  46. message += lang;
  47. message += " compiler: ";
  48. if(cc)
  49. {
  50. message += cc;
  51. }
  52. else
  53. {
  54. message += "(NULL)";
  55. }
  56. message += " was not found in your path. "
  57. "For CMake to correctly use try compile commands, the compiler must "
  58. "be in your path. Please add the compiler to your PATH environment,"
  59. " and re-run CMake.";
  60. cmSystemTools::Error(message.c_str());
  61. }
  62. }
  63. }
  64. ///! Create a local generator appropriate to this Global Generator
  65. cmLocalGenerator *cmGlobalUnixMakefileGenerator::CreateLocalGenerator()
  66. {
  67. cmLocalGenerator *lg = new cmLocalUnixMakefileGenerator;
  68. lg->SetGlobalGenerator(this);
  69. return lg;
  70. }
  71. //----------------------------------------------------------------------------
  72. void cmGlobalUnixMakefileGenerator::GetDocumentation(cmDocumentationEntry& entry) const
  73. {
  74. entry.name = this->GetName();
  75. entry.brief = "Generates standard UNIX makefiles.";
  76. entry.full =
  77. "A hierarchy of UNIX makefiles is generated into the build tree. Any "
  78. "standard UNIX-style make program can build the project through the "
  79. "default make target. A \"make install\" target is also provided.";
  80. }