| 809 | } |
| 810 | |
| 811 | void cmake::ReadListFile(std::vector<std::string> const& args, |
| 812 | std::string const& path) |
| 813 | { |
| 814 | // if a generator was not yet created, temporarily create one |
| 815 | cmGlobalGenerator* gg = this->GetGlobalGenerator(); |
| 816 | |
| 817 | // if a generator was not specified use a generic one |
| 818 | std::unique_ptr<cmGlobalGenerator> gen; |
| 819 | if (!gg) { |
| 820 | gen = cm::make_unique<cmGlobalGenerator>(this); |
| 821 | gg = gen.get(); |
| 822 | } |
| 823 | |
| 824 | // read in the list file to fill the cache |
| 825 | if (!path.empty()) { |
| 826 | this->CurrentSnapshot = this->State->Reset(); |
| 827 | cmStateSnapshot snapshot = this->GetCurrentSnapshot(); |
| 828 | snapshot.GetDirectory().SetCurrentBinary(this->GetHomeOutputDirectory()); |
| 829 | snapshot.GetDirectory().SetCurrentSource(this->GetHomeDirectory()); |
| 830 | snapshot.SetDefaultDefinitions(); |
| 831 | cmMakefile mf(gg, snapshot); |
| 832 | if (this->State->GetRole() == cmState::Role::Script) { |
| 833 | mf.SetScriptModeFile(path); |
| 834 | mf.SetArgcArgv(args); |
| 835 | } |
| 836 | if (!cmSystemTools::FileExists(path, true)) { |
| 837 | cmSystemTools::Error("Not a file: " + path); |
| 838 | } |
| 839 | if (!mf.ReadListFile(path)) { |
| 840 | cmSystemTools::Error("Error processing file: " + path); |
| 841 | } |
| 842 | } |
| 843 | } |
| 844 | |
| 845 | bool cmake::FindPackage(std::vector<std::string> const& args) |
| 846 | { |