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

Method WriteVCProjFile

Source/cmLocalVisualStudio7Generator.cxx:1379–1449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1377}
1378
1379void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
1380 std::string const& libName,
1381 cmGeneratorTarget* target)
1382{
1383 std::vector<std::string> configs =
1384 this->Makefile->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
1385
1386 AllConfigSources sources;
1387 sources.Sources = target->GetAllConfigSources();
1388
1389 cmSourceGroupFiles sourceGroupFiles;
1390
1391 // Add CMakeLists.txt file with rule to re-run CMake for user convenience.
1392 if (target->GetType() != cmStateEnums::GLOBAL_TARGET &&
1393 target->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) {
1394 if (cmSourceFile* sf = this->CreateVCProjBuildRule()) {
1395 cmGeneratorTarget::AllConfigSource acs;
1396 acs.Source = sf;
1397 acs.Kind = cmGeneratorTarget::SourceKindCustomCommand;
1398 for (size_t ci = 0; ci < configs.size(); ++ci) {
1399 acs.Configs.push_back(ci);
1400 }
1401 bool haveCMakeLists = false;
1402 for (cmGeneratorTarget::AllConfigSource& si : sources.Sources) {
1403 if (si.Source == sf) {
1404 haveCMakeLists = true;
1405 // Replace the explicit source reference with our generated one.
1406 si = acs;
1407 break;
1408 }
1409 }
1410 if (!haveCMakeLists) {
1411 sources.Sources.emplace_back(std::move(acs));
1412 }
1413 }
1414 }
1415
1416 for (size_t si = 0; si < sources.Sources.size(); ++si) {
1417 cmSourceFile const* sf = sources.Sources[si].Source;
1418 sources.Index[sf] = si;
1419 if (!sf->GetObjectLibrary().empty()) {
1420 if (this->FortranProject) {
1421 // Intel Fortran does not support per-config source locations
1422 // so we list object library content on the link line instead.
1423 // See OutputObjects.
1424 continue;
1425 }
1426 }
1427 // Add the file to the list of sources.
1428 sourceGroupFiles.Add(this->FindSourceGroup(sf->GetFullPath()), sf);
1429 }
1430
1431 // open the project
1432 this->WriteProjectStart(fout, libName, target);
1433 // write the configuration information
1434 this->WriteConfigurations(fout, configs, libName, target);
1435
1436 fout << "\t<Files>\n";

Callers 1

GenerateTargetMethod · 0.95

Calls 15

CreateVCProjBuildRuleMethod · 0.95
WriteProjectStartMethod · 0.95
WriteConfigurationsMethod · 0.95
WriteGroupMethod · 0.95
WriteVCProjFooterMethod · 0.95
moveFunction · 0.85
GetGeneratorConfigsMethod · 0.80
GetAllConfigSourcesMethod · 0.80
push_backMethod · 0.80
emplace_backMethod · 0.80
GetObjectLibraryMethod · 0.80
GetTypeMethod · 0.45

Tested by

no test coverage detected