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.

56 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 "cmBuildCommand.h"
  14. #include "cmLocalGenerator.h"
  15. #include "cmGlobalGenerator.h"
  16. // cmBuildCommand
  17. bool cmBuildCommand::InitialPass(std::vector<std::string> const& args)
  18. {
  19. if(args.size() < 2 )
  20. {
  21. this->SetError("called with incorrect number of arguments");
  22. return false;
  23. }
  24. const char* define = args[0].c_str();
  25. const char* cacheValue
  26. = this->Makefile->GetDefinition(define);
  27. std::string makeprogram = args[1];
  28. std::string configType = "Release";
  29. const char* cfg = getenv("CMAKE_CONFIG_TYPE");
  30. if ( cfg )
  31. {
  32. configType = cfg;
  33. }
  34. std::string makecommand = this->Makefile->GetLocalGenerator()
  35. ->GetGlobalGenerator()->GenerateBuildCommand
  36. (makeprogram.c_str(), this->Makefile->GetProjectName(), 0,
  37. 0, configType.c_str(), true, false);
  38. if(cacheValue)
  39. {
  40. return true;
  41. }
  42. this->Makefile->AddCacheDefinition(define,
  43. makecommand.c_str(),
  44. "Command used to build entire project "
  45. "from the command line.",
  46. cmCacheManager::STRING);
  47. return true;
  48. }