You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.8 KiB

  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 "cmDefinePropertyCommand.h"
  14. #include "cmake.h"
  15. // cmDefinePropertiesCommand
  16. bool cmDefinePropertyCommand::InitialPass(
  17. std::vector<std::string> const& args)
  18. {
  19. if(args.size() < 5 )
  20. {
  21. this->SetError("called with incorrect number of arguments");
  22. return false;
  23. }
  24. // determine the scope
  25. cmProperty::ScopeType scope;
  26. if (args[1] == "GLOBAL")
  27. {
  28. scope = cmProperty::GLOBAL;
  29. }
  30. else if (args[1] == "DIRECTORY")
  31. {
  32. scope = cmProperty::DIRECTORY;
  33. }
  34. else if (args[1] == "TARGET")
  35. {
  36. scope = cmProperty::TARGET;
  37. }
  38. else if (args[1] == "SOURCE_FILE")
  39. {
  40. scope = cmProperty::SOURCE_FILE;
  41. }
  42. else if (args[1] == "TEST")
  43. {
  44. scope = cmProperty::TEST;
  45. }
  46. else if (args[1] == "VARIABLE")
  47. {
  48. scope = cmProperty::VARIABLE;
  49. }
  50. else if (args[1] == "CACHED_VARIABLE")
  51. {
  52. scope = cmProperty::CACHED_VARIABLE;
  53. }
  54. else
  55. {
  56. this->SetError("called with illegal arguments.");
  57. return false;
  58. }
  59. this->Makefile->GetCMakeInstance()->DefineProperty
  60. (args[0].c_str(), scope,args[2].c_str(), args[3].c_str(),
  61. cmSystemTools::IsOn(args[4].c_str()));
  62. return true;
  63. }