1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
3 #include "cmGlobalVisualStudio7Generator.h"
12 #include <cm/string_view>
16 #include "cmGeneratedFileStream.h"
17 #include "cmGeneratorExpression.h"
18 #include "cmGeneratorTarget.h"
19 #include "cmGlobalGenerator.h"
20 #include "cmLocalGenerator.h"
21 #include "cmLocalVisualStudio7Generator.h"
22 #include "cmMakefile.h"
23 #include "cmMessageType.h"
25 #include "cmStateTypes.h"
26 #include "cmStringAlgorithms.h"
27 #include "cmSystemTools.h"
29 #include "cmTargetDepend.h"
31 #include "cmVisualStudioGeneratorOptions.h"
34 static cmVS7FlagTable cmVS7ExtraFlagTable[] = {
35 // Precompiled header and related options. Note that the
36 // UsePrecompiledHeader entries are marked as "Continue" so that the
37 // corresponding PrecompiledHeaderThrough entry can be found.
38 { "UsePrecompiledHeader", "YX", "Automatically Generate", "2",
39 cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue },
40 { "PrecompiledHeaderThrough", "YX", "Precompiled Header Name", "",
41 cmVS7FlagTable::UserValueRequired },
42 { "UsePrecompiledHeader", "Yu", "Use Precompiled Header", "3",
43 cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue },
44 { "PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "",
45 cmVS7FlagTable::UserValueRequired },
46 { "UsePrecompiledHeader", "Y-", "Don't use precompiled header", "0", 0 },
47 { "WholeProgramOptimization", "LTCG", "WholeProgramOptimization", "true",
50 // Exception handling mode. If no entries match, it will be FALSE.
51 { "ExceptionHandling", "GX", "enable c++ exceptions", "true", 0 },
52 { "ExceptionHandling", "EHsc", "enable c++ exceptions", "true", 0 },
53 // The EHa option does not have an IDE setting. Let it go to false,
54 // and have EHa passed on the command line by leaving out the table
61 std::string GetSLNFile(cmLocalGenerator* root)
63 return cmStrCat(root->GetCurrentBinaryDirectory(), '/',
64 root->GetProjectName(), ".sln");
68 cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator(
69 cmake* cm, std::string const& platformInGeneratorName)
70 : cmGlobalVisualStudioGenerator(cm, platformInGeneratorName)
72 this->DevEnvCommandInitialized = false;
73 this->MasmEnabled = false;
74 this->NasmEnabled = false;
75 this->ExtraFlagTable = cmVS7ExtraFlagTable;
78 cmGlobalVisualStudio7Generator::~cmGlobalVisualStudio7Generator()
82 // Package GUID of Intel Visual Fortran plugin to VS IDE
83 #define CM_INTEL_PLUGIN_GUID "{B68A201D-CB9B-47AF-A52F-7EEC72E217E4}"
85 const std::string& cmGlobalVisualStudio7Generator::GetIntelProjectVersion()
87 if (this->IntelProjectVersion.empty()) {
88 // Compute the version of the Intel plugin to the VS IDE.
89 // If the key does not exist then use a default guess.
90 std::string intelVersion;
92 cmStrCat(this->GetRegistryBase(),
93 "\\Packages\\" CM_INTEL_PLUGIN_GUID ";ProductVersion");
94 cmSystemTools::ReadRegistryValue(vskey, intelVersion,
95 cmSystemTools::KeyWOW64_32);
96 unsigned int intelVersionNumber = ~0u;
97 sscanf(intelVersion.c_str(), "%u", &intelVersionNumber);
98 if (intelVersionNumber >= 11) {
99 // Default to latest known project file version.
100 intelVersion = "11.0";
101 } else if (intelVersionNumber == 10) {
102 // Version 10.x actually uses 9.10 in project files!
103 intelVersion = "9.10";
105 // Version <= 9: use ProductVersion from registry.
107 this->IntelProjectVersion = intelVersion;
109 return this->IntelProjectVersion;
112 void cmGlobalVisualStudio7Generator::EnableLanguage(
113 std::vector<std::string> const& lang, cmMakefile* mf, bool optional)
115 mf->AddDefinition("CMAKE_GENERATOR_RC", "rc");
116 mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1");
117 mf->InitCMAKE_CONFIGURATION_TYPES("Debug;Release;MinSizeRel;RelWithDebInfo");
119 // Create list of configurations requested by user's cache, if any.
120 this->cmGlobalVisualStudioGenerator::EnableLanguage(lang, mf, optional);
122 // if this environment variable is set, then copy it to
123 // a static cache entry. It will be used by
124 // cmLocalGenerator::ConstructScript, to add an extra PATH
125 // to all custom commands. This is because the VS IDE
126 // does not use the environment it is run in, and this allows
127 // for running commands and using dll's that the IDE environment
128 // does not know about.
129 std::string extraPath;
130 if (cmSystemTools::GetEnv("CMAKE_MSVCIDE_RUN_PATH", extraPath)) {
131 mf->AddCacheDefinition("CMAKE_MSVCIDE_RUN_PATH", extraPath,
132 "Saved environment variable CMAKE_MSVCIDE_RUN_PATH",
133 cmStateEnums::STATIC);
137 bool cmGlobalVisualStudio7Generator::FindMakeProgram(cmMakefile* mf)
139 if (!this->cmGlobalVisualStudioGenerator::FindMakeProgram(mf)) {
142 mf->AddDefinition("CMAKE_VS_DEVENV_COMMAND", this->GetDevEnvCommand());
146 std::string const& cmGlobalVisualStudio7Generator::GetDevEnvCommand()
148 if (!this->DevEnvCommandInitialized) {
149 this->DevEnvCommandInitialized = true;
150 this->DevEnvCommand = this->FindDevEnvCommand();
152 return this->DevEnvCommand;
155 std::string cmGlobalVisualStudio7Generator::FindDevEnvCommand()
160 // Search in standard location.
161 vskey = this->GetRegistryBase() + ";InstallDir";
162 if (cmSystemTools::ReadRegistryValue(vskey.c_str(), vscmd,
163 cmSystemTools::KeyWOW64_32)) {
164 cmSystemTools::ConvertToUnixSlashes(vscmd);
165 vscmd += "/devenv.com";
166 if (cmSystemTools::FileExists(vscmd, true)) {
171 // Search where VS15Preview places it.
173 "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;",
174 this->GetIDEVersion());
175 if (cmSystemTools::ReadRegistryValue(vskey.c_str(), vscmd,
176 cmSystemTools::KeyWOW64_32)) {
177 cmSystemTools::ConvertToUnixSlashes(vscmd);
178 vscmd += "/Common7/IDE/devenv.com";
179 if (cmSystemTools::FileExists(vscmd, true)) {
184 vscmd = "devenv.com";
188 const char* cmGlobalVisualStudio7Generator::ExternalProjectType(
189 const std::string& location)
191 std::string extension = cmSystemTools::GetFilenameLastExtension(location);
192 if (extension == ".vbproj") {
193 return "F184B08F-C81C-45F6-A57F-5ABD9991F28F";
194 } else if (extension == ".csproj") {
195 return "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC";
196 } else if (extension == ".fsproj") {
197 return "F2A71F9B-5D33-465A-A702-920D77279786";
198 } else if (extension == ".vdproj") {
199 return "54435603-DBB4-11D2-8724-00A0C9A8B90C";
200 } else if (extension == ".dbproj") {
201 return "C8D11400-126E-41CD-887F-60BD40844F9E";
202 } else if (extension == ".wixproj") {
203 return "930C7802-8A8C-48F9-8165-68863BCCD9DD";
204 } else if (extension == ".pyproj") {
205 return "888888A0-9F3D-457C-B088-3A5042F75D52";
207 return "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942";
210 std::vector<cmGlobalGenerator::GeneratedMakeCommand>
211 cmGlobalVisualStudio7Generator::GenerateBuildCommand(
212 const std::string& makeProgram, const std::string& projectName,
213 const std::string& /*projectDir*/,
214 std::vector<std::string> const& targetNames, const std::string& config,
215 int /*jobs*/, bool /*verbose*/, const cmBuildOptions& /*buildOptions*/,
216 std::vector<std::string> const& makeOptions)
218 // Select the caller- or user-preferred make program, else devenv.
219 std::string makeProgramSelected =
220 this->SelectMakeProgram(makeProgram, this->GetDevEnvCommand());
222 // Ignore the above preference if it is msbuild.
223 // Assume any other value is either a devenv or
224 // command-line compatible with devenv.
225 std::string makeProgramLower = makeProgramSelected;
226 cmSystemTools::LowerCase(makeProgramLower);
227 if (makeProgramLower.find("msbuild") != std::string::npos) {
228 makeProgramSelected = this->GetDevEnvCommand();
231 // Workaround to convince VCExpress.exe to produce output.
232 const bool requiresOutputForward =
233 (makeProgramLower.find("vcexpress") != std::string::npos);
234 std::vector<GeneratedMakeCommand> makeCommands;
236 std::vector<std::string> realTargetNames = targetNames;
237 if (targetNames.empty() ||
238 ((targetNames.size() == 1) && targetNames.front().empty())) {
239 realTargetNames = { "ALL_BUILD" };
241 for (const auto& tname : realTargetNames) {
242 std::string realTarget;
243 if (!tname.empty()) {
249 if (realTarget == "clean") {
251 realTarget = "ALL_BUILD";
253 GeneratedMakeCommand makeCommand;
254 makeCommand.RequiresOutputForward = requiresOutputForward;
255 makeCommand.Add(makeProgramSelected);
256 makeCommand.Add(projectName + ".sln");
257 makeCommand.Add((clean ? "/clean" : "/build"));
258 makeCommand.Add((config.empty() ? "Debug" : config));
259 makeCommand.Add("/project");
260 makeCommand.Add(realTarget);
261 makeCommand.Add(makeOptions.begin(), makeOptions.end());
262 makeCommands.emplace_back(std::move(makeCommand));
267 //! Create a local generator appropriate to this Global Generator
268 std::unique_ptr<cmLocalGenerator>
269 cmGlobalVisualStudio7Generator::CreateLocalGenerator(cmMakefile* mf)
271 auto lg = cm::make_unique<cmLocalVisualStudio7Generator>(this, mf);
272 return std::unique_ptr<cmLocalGenerator>(std::move(lg));
275 #if !defined(CMAKE_BOOTSTRAP)
276 Json::Value cmGlobalVisualStudio7Generator::GetJson() const
278 Json::Value generator = this->cmGlobalVisualStudioGenerator::GetJson();
279 generator["platform"] = this->GetPlatformName();
284 bool cmGlobalVisualStudio7Generator::SetSystemName(std::string const& s,
287 mf->AddDefinition("CMAKE_VS_INTEL_Fortran_PROJECT_VERSION",
288 this->GetIntelProjectVersion());
289 return this->cmGlobalVisualStudioGenerator::SetSystemName(s, mf);
292 void cmGlobalVisualStudio7Generator::Generate()
294 // first do the superclass method
295 this->cmGlobalVisualStudioGenerator::Generate();
297 // Now write out the DSW
298 this->OutputSLNFile();
299 // If any solution or project files changed during the generation,
300 // tell Visual Studio to reload them...
301 if (!cmSystemTools::GetErrorOccurredFlag() &&
302 !this->LocalGenerators.empty()) {
303 this->CallVisualStudioMacro(MacroReload,
304 GetSLNFile(this->LocalGenerators[0].get()));
307 if (this->Version == VSVersion::VS10 &&
308 !this->CMakeInstance->GetIsInTryCompile()) {
309 std::string cmakeWarnVS10;
310 if (cmValue cached = this->CMakeInstance->GetState()->GetCacheEntryValue(
311 "CMAKE_WARN_VS10")) {
312 this->CMakeInstance->MarkCliAsUsed("CMAKE_WARN_VS10");
313 cmakeWarnVS10 = *cached;
315 cmSystemTools::GetEnv("CMAKE_WARN_VS10", cmakeWarnVS10);
317 if (cmakeWarnVS10.empty() || !cmIsOff(cmakeWarnVS10)) {
318 this->CMakeInstance->IssueMessage(
319 MessageType::WARNING,
320 "The \"Visual Studio 10 2010\" generator is deprecated "
321 "and will be removed in a future version of CMake."
323 "Add CMAKE_WARN_VS10=OFF to the cache to disable this warning.");
328 void cmGlobalVisualStudio7Generator::OutputSLNFile(
329 cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators)
331 if (generators.empty()) {
334 this->CurrentProject = root->GetProjectName();
335 std::string fname = GetSLNFile(root);
336 cmGeneratedFileStream fout(fname.c_str());
337 fout.SetCopyIfDifferent(true);
341 this->WriteSLNFile(fout, root, generators);
343 this->FileReplacedDuringGenerate(fname);
347 // output the SLN file
348 void cmGlobalVisualStudio7Generator::OutputSLNFile()
350 for (auto& it : this->ProjectMap) {
351 this->OutputSLNFile(it.second[0], it.second);
355 void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
356 std::ostream& fout, std::vector<std::string> const& configs,
357 OrderedTargetDependSet const& projectTargets)
359 // loop over again and write out configurations for each target
361 for (cmGeneratorTarget const* target : projectTargets) {
362 if (!this->IsInSolution(target)) {
365 cmValue expath = target->GetProperty("EXTERNAL_MSPROJECT");
367 std::set<std::string> allConfigurations(configs.begin(), configs.end());
368 cmValue mapping = target->GetProperty("VS_PLATFORM_MAPPING");
369 this->WriteProjectConfigurations(fout, target->GetName(), *target,
370 configs, allConfigurations,
371 mapping ? *mapping : "");
373 const std::set<std::string>& configsPartOfDefaultBuild =
374 this->IsPartOfDefaultBuild(configs, projectTargets, target);
375 cmValue vcprojName = target->GetProperty("GENERATOR_FILE_NAME");
379 // On VS 19 and above, always map .NET SDK projects to "Any CPU".
380 if (target->IsDotNetSdkTarget() &&
381 this->GetVersion() >= VSVersion::VS16 &&
382 !this->IsReservedTarget(target->GetName())) {
385 this->WriteProjectConfigurations(fout, *vcprojName, *target, configs,
386 configsPartOfDefaultBuild, mapping);
392 void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
393 std::ostream& fout, cmLocalGenerator* root,
394 OrderedTargetDependSet const& projectTargets)
396 VisualStudioFolders.clear();
398 for (cmGeneratorTarget const* target : projectTargets) {
399 if (!this->IsInSolution(target)) {
402 bool written = false;
404 // handle external vc project files
405 cmValue expath = target->GetProperty("EXTERNAL_MSPROJECT");
407 std::string project = target->GetName();
408 std::string location = *expath;
410 this->WriteExternalProject(fout, project, location,
411 target->GetProperty("VS_PROJECT_TYPE"),
412 target->GetUtilities());
415 cmValue vcprojName = target->GetProperty("GENERATOR_FILE_NAME");
417 cmLocalGenerator* lg = target->GetLocalGenerator();
418 std::string dir = lg->GetCurrentBinaryDirectory();
419 dir = root->MaybeRelativeToCurBinDir(dir);
421 dir.clear(); // msbuild cannot handle ".\" prefix
423 this->WriteProject(fout, *vcprojName, dir, target);
428 // Create "solution folder" information from FOLDER target property
430 if (written && this->UseFolderProperty()) {
431 const std::string targetFolder = target->GetEffectiveFolderName();
432 if (!targetFolder.empty()) {
433 std::vector<std::string> tokens =
434 cmSystemTools::SplitString(targetFolder, '/', false);
436 std::string cumulativePath;
438 for (std::string const& iter : tokens) {
443 if (cumulativePath.empty()) {
444 cumulativePath = "CMAKE_FOLDER_GUID_" + iter;
446 VisualStudioFolders[cumulativePath].insert(cumulativePath + "/" +
449 cumulativePath = cumulativePath + "/" + iter;
453 if (!cumulativePath.empty()) {
454 VisualStudioFolders[cumulativePath].insert(target->GetName());
461 void cmGlobalVisualStudio7Generator::WriteFolders(std::ostream& fout)
463 cm::string_view const prefix = "CMAKE_FOLDER_GUID_";
464 std::string guidProjectTypeFolder = "2150E333-8FDC-42A3-9474-1A3956D46DE8";
465 for (auto const& iter : VisualStudioFolders) {
466 std::string fullName = iter.first;
467 std::string guid = this->GetGUID(fullName);
469 std::replace(fullName.begin(), fullName.end(), '/', '\\');
470 if (cmHasPrefix(fullName, prefix)) {
471 fullName = fullName.substr(prefix.size());
474 std::string nameOnly = cmSystemTools::GetFilenameName(fullName);
476 fout << "Project(\"{" << guidProjectTypeFolder << "}\") = \"" << nameOnly
477 << "\", \"" << fullName << "\", \"{" << guid << "}\"\nEndProject\n";
481 void cmGlobalVisualStudio7Generator::WriteFoldersContent(std::ostream& fout)
483 for (auto const& iter : VisualStudioFolders) {
484 std::string key(iter.first);
485 std::string guidParent(this->GetGUID(key));
487 for (std::string const& it : iter.second) {
488 std::string value(it);
489 std::string guid(this->GetGUID(value));
491 fout << "\t\t{" << guid << "} = {" << guidParent << "}\n";
496 std::string cmGlobalVisualStudio7Generator::ConvertToSolutionPath(
497 const std::string& path)
499 // Convert to backslashes. Do not use ConvertToOutputPath because
500 // we will add quoting ourselves, and we know these projects always
501 // use windows slashes.
502 std::string d = path;
503 std::string::size_type pos = 0;
504 while ((pos = d.find('/', pos)) != d.npos) {
510 void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections(
511 std::ostream& fout, cmLocalGenerator* root)
513 std::string const guid = this->GetGUID(root->GetProjectName() + ".sln");
514 bool extensibilityGlobalsOverridden = false;
515 bool extensibilityAddInsOverridden = false;
516 const std::vector<std::string> propKeys =
517 root->GetMakefile()->GetPropertyKeys();
518 for (std::string const& it : propKeys) {
519 if (cmHasLiteralPrefix(it, "VS_GLOBAL_SECTION_")) {
520 std::string sectionType;
521 std::string name = it.substr(18);
522 if (cmHasLiteralPrefix(name, "PRE_")) {
523 name = name.substr(4);
524 sectionType = "preSolution";
525 } else if (cmHasLiteralPrefix(name, "POST_")) {
526 name = name.substr(5);
527 sectionType = "postSolution";
531 bool addGuid = false;
532 if (name == "ExtensibilityGlobals" && sectionType == "postSolution") {
534 extensibilityGlobalsOverridden = true;
535 } else if (name == "ExtensibilityAddIns" &&
536 sectionType == "postSolution") {
537 extensibilityAddInsOverridden = true;
539 fout << "\tGlobalSection(" << name << ") = " << sectionType << "\n";
540 cmValue p = root->GetMakefile()->GetProperty(it);
541 std::vector<std::string> keyValuePairs = cmExpandedList(p ? *p : "");
542 for (std::string const& itPair : keyValuePairs) {
543 const std::string::size_type posEqual = itPair.find('=');
544 if (posEqual != std::string::npos) {
545 const std::string key =
546 cmTrimWhitespace(itPair.substr(0, posEqual));
547 const std::string value =
548 cmTrimWhitespace(itPair.substr(posEqual + 1));
549 fout << "\t\t" << key << " = " << value << "\n";
550 if (key == "SolutionGuid") {
556 fout << "\t\tSolutionGuid = {" << guid << "}\n";
558 fout << "\tEndGlobalSection\n";
562 if (!extensibilityGlobalsOverridden) {
563 fout << "\tGlobalSection(ExtensibilityGlobals) = postSolution\n"
564 << "\t\tSolutionGuid = {" << guid << "}\n"
565 << "\tEndGlobalSection\n";
567 if (!extensibilityAddInsOverridden)
568 fout << "\tGlobalSection(ExtensibilityAddIns) = postSolution\n"
569 << "\tEndGlobalSection\n";
572 // Standard end of dsw file
573 void cmGlobalVisualStudio7Generator::WriteSLNFooter(std::ostream& fout)
575 fout << "EndGlobal\n";
578 std::string cmGlobalVisualStudio7Generator::WriteUtilityDepend(
579 cmGeneratorTarget const* target)
581 std::vector<std::string> configs =
582 target->Target->GetMakefile()->GetGeneratorConfigs(
583 cmMakefile::ExcludeEmptyConfig);
584 std::string pname = cmStrCat(target->GetName(), "_UTILITY");
586 cmStrCat(target->GetLocalGenerator()->GetCurrentBinaryDirectory(), '/',
588 cmGeneratedFileStream fout(fname.c_str());
589 fout.SetCopyIfDifferent(true);
590 std::string guid = this->GetGUID(pname.c_str());
592 /* clang-format off */
594 "<?xml version=\"1.0\" encoding = \""
595 << this->Encoding() << "\"?>\n"
596 "<VisualStudioProject\n"
597 "\tProjectType=\"Visual C++\"\n"
598 "\tVersion=\"" << this->GetIDEVersion() << "0\"\n"
599 "\tName=\"" << pname << "\"\n"
600 "\tProjectGUID=\"{" << guid << "}\"\n"
601 "\tKeyword=\"Win32Proj\">\n"
602 "\t<Platforms><Platform Name=\"Win32\"/></Platforms>\n"
603 "\t<Configurations>\n"
605 /* clang-format on */
606 for (std::string const& i : configs) {
607 /* clang-format off */
609 "\t\t<Configuration\n"
610 "\t\t\tName=\"" << i << "|Win32\"\n"
611 "\t\t\tOutputDirectory=\"" << i << "\"\n"
612 "\t\t\tIntermediateDirectory=\"" << pname << ".dir\\" << i << "\"\n"
613 "\t\t\tConfigurationType=\"10\"\n"
614 "\t\t\tUseOfMFC=\"0\"\n"
615 "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"FALSE\"\n"
616 "\t\t\tCharacterSet=\"2\">\n"
617 "\t\t</Configuration>\n"
619 /* clang-format on */
621 /* clang-format off */
623 "\t</Configurations>\n"
624 "\t<Files></Files>\n"
625 "\t<Globals></Globals>\n"
626 "</VisualStudioProject>\n"
628 /* clang-format on */
631 this->FileReplacedDuringGenerate(fname);
636 std::string cmGlobalVisualStudio7Generator::GetGUID(std::string const& name)
638 std::string const& guidStoreName = name + "_GUID_CMAKE";
639 if (cmValue storedGUID =
640 this->CMakeInstance->GetCacheDefinition(guidStoreName)) {
643 // Compute a GUID that is deterministic but unique to the build tree.
645 cmStrCat(this->CMakeInstance->GetState()->GetBinaryDirectory(), '|', name);
647 cmUuid uuidGenerator;
649 std::vector<unsigned char> uuidNamespace;
650 uuidGenerator.StringToBinary("ee30c4be-5192-4fb0-b335-722a2dffe760",
653 std::string guid = uuidGenerator.FromMd5(uuidNamespace, input);
655 return cmSystemTools::UpperCase(guid);
658 void cmGlobalVisualStudio7Generator::AppendDirectoryForConfig(
659 const std::string& prefix, const std::string& config,
660 const std::string& suffix, std::string& dir)
662 if (!config.empty()) {
669 std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
670 std::vector<std::string> const& configs,
671 OrderedTargetDependSet const& projectTargets,
672 cmGeneratorTarget const* target)
674 std::set<std::string> activeConfigs;
675 // if it is a utilitiy target then only make it part of the
676 // default build if another target depends on it
677 int type = target->GetType();
678 if (type == cmStateEnums::GLOBAL_TARGET) {
679 std::vector<std::string> targetNames;
680 targetNames.push_back("INSTALL");
681 targetNames.push_back("PACKAGE");
682 for (std::string const& t : targetNames) {
683 // check if target <t> is part of default build
684 if (target->GetName() == t) {
685 const std::string propertyName =
686 "CMAKE_VS_INCLUDE_" + t + "_TO_DEFAULT_BUILD";
687 // inspect CMAKE_VS_INCLUDE_<t>_TO_DEFAULT_BUILD properties
688 for (std::string const& i : configs) {
689 cmValue propertyValue =
690 target->Target->GetMakefile()->GetDefinition(propertyName);
692 cmIsOn(cmGeneratorExpression::Evaluate(
693 *propertyValue, target->GetLocalGenerator(), i))) {
694 activeConfigs.insert(i);
699 return activeConfigs;
701 if (type == cmStateEnums::UTILITY &&
702 !this->IsDependedOn(projectTargets, target)) {
703 return activeConfigs;
705 // inspect EXCLUDE_FROM_DEFAULT_BUILD[_<CONFIG>] properties
706 for (std::string const& i : configs) {
707 if (cmIsOff(target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i))) {
708 activeConfigs.insert(i);
711 return activeConfigs;
714 bool cmGlobalVisualStudio7Generator::IsDependedOn(
715 OrderedTargetDependSet const& projectTargets, cmGeneratorTarget const* gtIn)
717 for (cmTargetDepend const& l : projectTargets) {
718 TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(l);
719 if (tgtdeps.count(gtIn)) {
726 std::string cmGlobalVisualStudio7Generator::Encoding()