cmIncludeExternalMSProjectCommand.cxx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  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 "cmIncludeExternalMSProjectCommand.h"
  11. // cmIncludeExternalMSProjectCommand
  12. bool cmIncludeExternalMSProjectCommand
  13. ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
  14. {
  15. if(args.size() < 2)
  16. {
  17. this->SetError("INCLUDE_EXTERNAL_MSPROJECT called with incorrect "
  18. "number of arguments");
  19. return false;
  20. }
  21. // only compile this for win32 to avoid coverage errors
  22. #ifdef _WIN32
  23. if(this->Makefile->GetDefinition("WIN32"))
  24. {
  25. std::string path = args[1];
  26. cmSystemTools::ConvertToUnixSlashes(path);
  27. // Create a target instance for this utility.
  28. cmTarget* target=this->Makefile->AddNewTarget(cmTarget::UTILITY,
  29. args[0].c_str());
  30. target->SetProperty("EXTERNAL_MSPROJECT", path.c_str());
  31. target->SetProperty("EXCLUDE_FROM_ALL","FALSE");
  32. target->SetProperty("GENERATOR_FILE_NAME", args[0].c_str());
  33. for (unsigned int i=2; i<args.size(); ++i)
  34. {
  35. target->AddUtility(args[i].c_str());
  36. }
  37. }
  38. #endif
  39. return true;
  40. }