CMakeBuildTargets.cxx 874 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include "cmUnixMakefile.h"
  2. #include "cmMakeDepend.h"
  3. #include <iostream>
  4. main(int ac, char** av)
  5. {
  6. if(ac < 2)
  7. {
  8. std::cerr << "Usage: " << av[0] << " Makefile.in -Ipath ..." << std::endl;
  9. return -1;
  10. }
  11. cmUnixMakefile* mf = new cmUnixMakefile;
  12. cmMakeDepend md;
  13. if(ac > 2)
  14. {
  15. for(int i =2; i < ac; i++)
  16. {
  17. std::string arg = av[i];
  18. if(arg.find("-I",0) != std::string::npos)
  19. {
  20. std::string path = arg.substr(2);
  21. md.AddSearchPath(path.c_str());
  22. }
  23. if(arg.find("-S",0) != std::string::npos)
  24. {
  25. std::string path = arg.substr(2);
  26. mf->SetCurrentDirectory(path.c_str());
  27. }
  28. }
  29. }
  30. if(!mf->ReadMakefile(av[1]))
  31. {
  32. std::cerr << "Usage: " << av[0] << " Makefile.in -Ipath ..." << std::endl;
  33. return -1;
  34. }
  35. md.SetMakefile(mf);
  36. md.DoDepends();
  37. mf->OutputMakefile("CMakeTargets.make");
  38. delete mf;
  39. }