cmTargetCompileDefinitionsCommand.cxx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 "cmTargetCompileDefinitionsCommand.h"
  11. #include "cmMakefileIncludeDirectoriesEntry.h"
  12. bool cmTargetCompileDefinitionsCommand
  13. ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
  14. {
  15. return this->HandleArguments(args, "COMPILE_DEFINITIONS");
  16. }
  17. void cmTargetCompileDefinitionsCommand
  18. ::HandleImportedTarget(const std::string &tgt)
  19. {
  20. cmOStringStream e;
  21. e << "Cannot specify compile definitions for imported target \""
  22. << tgt << "\".";
  23. this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
  24. }
  25. void cmTargetCompileDefinitionsCommand
  26. ::HandleMissingTarget(const std::string &name)
  27. {
  28. cmOStringStream e;
  29. e << "Cannot specify compile definitions for target \"" << name << "\" "
  30. "which is not built by this project.";
  31. this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
  32. }
  33. bool cmTargetCompileDefinitionsCommand
  34. ::HandleNonTargetArg(std::string &content,
  35. const std::string &sep,
  36. const std::string &entry,
  37. const std::string &)
  38. {
  39. content += sep + entry;
  40. return true;
  41. }
  42. void cmTargetCompileDefinitionsCommand
  43. ::HandleDirectContent(cmTarget *tgt, const std::string &content,
  44. bool)
  45. {
  46. tgt->AppendProperty("COMPILE_DEFINITIONS", content.c_str());
  47. }