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.

68 lines
2.3 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 "cmIncludeExternalMSProjectCommand.h"
  14. // cmIncludeExternalMSProjectCommand
  15. bool cmIncludeExternalMSProjectCommand
  16. ::InitialPass(std::vector<std::string> const& args)
  17. {
  18. if(args.size() < 2)
  19. {
  20. this->SetError("INCLUDE_EXTERNAL_MSPROJECT called with incorrect "
  21. "number of arguments");
  22. return false;
  23. }
  24. // only compile this for win32 to avoid coverage errors
  25. #ifdef _WIN32
  26. if(this->Makefile->GetDefinition("WIN32"))
  27. {
  28. std::string location = args[1];
  29. std::vector<std::string> depends;
  30. if (args.size() > 2)
  31. {
  32. for (unsigned int i=2; i<args.size(); ++i)
  33. {
  34. depends.push_back(args[i]);
  35. }
  36. }
  37. // Hack together a utility target storing enough information
  38. // to reproduce the target inclusion.
  39. std::string utility_name("INCLUDE_EXTERNAL_MSPROJECT");
  40. utility_name += "_";
  41. utility_name += args[0];
  42. std::string path = args[1];
  43. cmSystemTools::ConvertToUnixSlashes(path);
  44. // Create a target instance for this utility.
  45. cmTarget* target=this->Makefile->AddNewTarget(cmTarget::UTILITY,
  46. utility_name.c_str(),
  47. false);
  48. target->SetProperty("EXCLUDE_FROM_ALL","FALSE");
  49. std::vector<std::string> no_outputs;
  50. cmCustomCommandLines commandLines;
  51. cmCustomCommandLine commandLine;
  52. commandLine.push_back(args[0]);
  53. commandLine.push_back(path);
  54. commandLines.push_back(commandLine);
  55. cmCustomCommand cc(no_outputs, depends, commandLines, 0, 0);
  56. target->GetPostBuildCommands().push_back(cc);
  57. }
  58. #endif
  59. return true;
  60. }