cmTargetIncludeDirectoriesCommand.cxx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2013 Stephen Kelly <[email protected]>
  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 "cmTargetIncludeDirectoriesCommand.h"
  11. #include "cmMakefileIncludeDirectoriesEntry.h"
  12. //----------------------------------------------------------------------------
  13. bool cmTargetIncludeDirectoriesCommand
  14. ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
  15. {
  16. return this->HandleArguments(args, "INCLUDE_DIRECTORIES", PROCESS_BEFORE);
  17. }
  18. //----------------------------------------------------------------------------
  19. void cmTargetIncludeDirectoriesCommand
  20. ::HandleImportedTarget(const std::string &tgt)
  21. {
  22. cmOStringStream e;
  23. e << "Cannot specify include directories for imported target \""
  24. << tgt << "\".";
  25. this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
  26. }
  27. //----------------------------------------------------------------------------
  28. void cmTargetIncludeDirectoriesCommand
  29. ::HandleMissingTarget(const std::string &name)
  30. {
  31. cmOStringStream e;
  32. e << "Cannot specify include directories for target \"" << name << "\" "
  33. "which is not built by this project.";
  34. this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
  35. }
  36. //----------------------------------------------------------------------------
  37. bool cmTargetIncludeDirectoriesCommand
  38. ::HandleNonTargetArg(std::string &content,
  39. const std::string &sep,
  40. const std::string &entry,
  41. const std::string &tgt)
  42. {
  43. if (!cmSystemTools::FileIsFullPath(entry.c_str()))
  44. {
  45. cmOStringStream e;
  46. e << "Cannot specify relative include directory \"" << entry << "\" for "
  47. "target \"" << tgt << "\". Only absolute paths are permitted";
  48. this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
  49. return false;
  50. }
  51. content += sep + entry;
  52. return true;
  53. }
  54. //----------------------------------------------------------------------------
  55. void cmTargetIncludeDirectoriesCommand
  56. ::HandleDirectContent(cmTarget *tgt, const std::string &content,
  57. bool prepend)
  58. {
  59. cmListFileBacktrace lfbt;
  60. this->Makefile->GetBacktrace(lfbt);
  61. cmMakefileIncludeDirectoriesEntry entry(content, lfbt);
  62. tgt->InsertInclude(entry, prepend);
  63. }