| 924 | } |
| 925 | |
| 926 | cm::VS::Solution cmGlobalVisualStudioGenerator::CreateSolution( |
| 927 | cmLocalGenerator const* root, TargetDependSet const& projectTargets) const |
| 928 | { |
| 929 | using namespace cm::VS; |
| 930 | Solution solution; |
| 931 | solution.VSVersion = this->Version; |
| 932 | solution.VSExpress = |
| 933 | this->ExpressEdition ? VersionExpress::Yes : VersionExpress::No; |
| 934 | solution.Platform = this->GetPlatformName(); |
| 935 | solution.Configs = |
| 936 | root->GetMakefile()->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig); |
| 937 | solution.StartupProject = this->GetStartupProjectName(root); |
| 938 | |
| 939 | auto addProject = [this, useFolders = this->UseFolderProperty(), |
| 940 | &solution](cmGeneratorTarget const* gt, |
| 941 | Solution::Project const* p) { |
| 942 | if (Solution::Folder* const folder = useFolders |
| 943 | ? this->CreateSolutionFolder(solution, gt->GetEffectiveFolderName()) |
| 944 | : nullptr) { |
| 945 | folder->Projects.emplace_back(p); |
| 946 | } else { |
| 947 | solution.Projects.emplace_back(p); |
| 948 | } |
| 949 | }; |
| 950 | |
| 951 | for (cmTargetDepend const& projectTarget : projectTargets) { |
| 952 | cmGeneratorTarget const* gt = projectTarget; |
| 953 | if (!this->IsInSolution(gt)) { |
| 954 | continue; |
| 955 | } |
| 956 | |
| 957 | Solution::Project* project = solution.GetProject(gt->GetName()); |
| 958 | project->Id = this->GetGUID(gt->GetName()); |
| 959 | |
| 960 | std::set<std::string> const& includeConfigs = |
| 961 | this->IsPartOfDefaultBuild(solution.Configs, projectTargets, gt); |
| 962 | auto addProjectConfig = |
| 963 | [this, project, gt, &includeConfigs](std::string const& solutionConfig, |
| 964 | std::string const& projectConfig) { |
| 965 | bool const build = |
| 966 | includeConfigs.find(solutionConfig) != includeConfigs.end(); |
| 967 | bool const deploy = this->NeedsDeploy(*gt, solutionConfig.c_str()); |
| 968 | project->Configs.emplace_back( |
| 969 | Solution::ProjectConfig{ projectConfig, build, deploy }); |
| 970 | }; |
| 971 | |
| 972 | if (cmValue expath = gt->GetProperty("EXTERNAL_MSPROJECT")) { |
| 973 | project->Path = *expath; |
| 974 | cmValue const projectType = gt->GetProperty("VS_PROJECT_TYPE"); |
| 975 | if (!projectType.IsEmpty()) { |
| 976 | project->TypeId = *projectType; |
| 977 | } else { |
| 978 | project->TypeId = |
| 979 | std::string{ this->ExternalProjectTypeId(project->Path) }; |
| 980 | } |
| 981 | for (std::string const& config : solution.Configs) { |
| 982 | cmList mapConfig{ gt->GetProperty(cmStrCat( |
| 983 | "MAP_IMPORTED_CONFIG_", cmSystemTools::UpperCase(config))) }; |
no test coverage detected