MCPcopy Create free account
hub / github.com/Kitware/CMake / AddVisualStudioPath

Function AddVisualStudioPath

Source/cmRuntimeDependencyArchive.cxx:34–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33#if defined(_WIN32)
34static void AddVisualStudioPath(std::vector<std::string>& paths,
35 std::string const& prefix,
36 unsigned int version, cmGlobalGenerator* gg)
37{
38 // If generating for the VS IDE, use the same instance.
39 std::string vsloc;
40 bool found = false;
41# ifndef CMAKE_BOOTSTRAP
42 if (cmHasPrefix(gg->GetName(), prefix)) {
43 cmGlobalVisualStudioVersionedGenerator* vsgen =
44 static_cast<cmGlobalVisualStudioVersionedGenerator*>(gg);
45 if (vsgen->GetVSInstance(vsloc)) {
46 found = true;
47 }
48 }
49# endif
50
51 // Otherwise, find a VS instance ourselves.
52 if (!found) {
53 cmVSSetupAPIHelper vsSetupAPIHelper(version);
54 if (vsSetupAPIHelper.GetVSInstanceInfo(vsloc)) {
55 cmSystemTools::ConvertToUnixSlashes(vsloc);
56 found = true;
57 }
58 }
59
60 if (found) {
61 cmsys::Glob glob;
62 glob.SetListDirs(true);
63 glob.FindFiles(vsloc + "/VC/Tools/MSVC/*");
64 for (auto const& vcdir : glob.GetFiles()) {
65 paths.push_back(vcdir + "/bin/Hostx64/x64");
66 paths.push_back(vcdir + "/bin/Hostx86/x64");
67 paths.push_back(vcdir + "/bin/Hostx64/x86");
68 paths.push_back(vcdir + "/bin/Hostx86/x86");
69 }
70 }
71}
72
73static void AddRegistryPath(std::vector<std::string>& paths,
74 std::string const& path, cmMakefile* mf)

Callers 1

Calls 7

cmHasPrefixFunction · 0.85
GetVSInstanceMethod · 0.80
GetVSInstanceInfoMethod · 0.80
FindFilesMethod · 0.80
push_backMethod · 0.80
GetNameMethod · 0.45
GetFilesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…