diff options
author | Brad King <brad.king@kitware.com> | 2015-10-26 17:13:04 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-10-26 17:13:04 (GMT) |
commit | d288b216af6864567354ccb05e85466fb57d46b0 (patch) | |
tree | 2e3709b4e47c9a9f2cd2983661423668ce7a4064 /Source/cmLocalVisualStudio7Generator.cxx | |
parent | d71920c45763fe15fa93c2fc1f5aceabba23975e (diff) | |
parent | 6cac952b9ed8ad202286ddee7246d9ef7ed8f22d (diff) | |
download | CMake-d288b216af6864567354ccb05e85466fb57d46b0.zip CMake-d288b216af6864567354ccb05e85466fb57d46b0.tar.gz CMake-d288b216af6864567354ccb05e85466fb57d46b0.tar.bz2 |
Merge topic 'use-generator-target'
6cac952b VS: Port interface to cmGeneratorTarget
97b37688 VS: Port WriteUtilityDepends to cmGeneratorTarget
600af01d VS: Port utility depends to cmGeneratorTarget
330bfa83 VS: Port target depends to cmGeneratorTarget
b13e26e2 VS: Port ProjectDepends to cmGeneratorTarget.
8ac8739b VS: Port TargetIsFortranOnly to cmGeneratorTarget
84fb579f VS: Port WriteProject to cmGeneratorTarget
1eff421a VS: Port loop to cmGeneratorTarget
94fd5a5a VS: Port ImplibDir to cmGeneratorTarget
ce9e9a92 VS: Port LinkClosure to cmGeneratorTarget
26e23e84 VS: Port ComputeLongestObjectDirectory to cmGeneratorTarget
01c26986 VS7: Port to cmGeneratorTarget
459c8910 VS10: Port to cmGeneratorTarget.
7f8bb857 VS6: Port to cmGeneratorTarget.
a0ebd69b Graphviz: Port to cmGeneratorTarget.
bcee21ce C::B: Port API to cmGeneratorTarget.
...
Diffstat (limited to 'Source/cmLocalVisualStudio7Generator.cxx')
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 251 |
1 files changed, 117 insertions, 134 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 819998c..ca8d697 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -34,7 +34,8 @@ public: LocalGenerator(e) {} typedef cmComputeLinkInformation::ItemVector ItemVector; void OutputLibraries(std::ostream& fout, ItemVector const& libs); - void OutputObjects(std::ostream& fout, cmTarget* t, const char* isep = 0); + void OutputObjects(std::ostream& fout, cmGeneratorTarget* t, + const char* isep = 0); private: cmLocalVisualStudio7Generator* LocalGenerator; }; @@ -67,19 +68,19 @@ cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator() void cmLocalVisualStudio7Generator::AddHelperCommands() { // Now create GUIDs for targets - cmTargets &tgts = this->Makefile->GetTargets(); - - for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) + std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets(); + for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin(); + l != tgts.end(); ++l) { - if(l->second.GetType() == cmState::INTERFACE_LIBRARY) + if((*l)->GetType() == cmState::INTERFACE_LIBRARY) { continue; } - const char* path = l->second.GetProperty("EXTERNAL_MSPROJECT"); + const char* path = (*l)->GetProperty("EXTERNAL_MSPROJECT"); if(path) { this->ReadAndStoreExternalGUID( - l->second.GetName().c_str(), path); + (*l)->GetName().c_str(), path); } } @@ -95,7 +96,6 @@ void cmLocalVisualStudio7Generator::Generate() void cmLocalVisualStudio7Generator::AddCMakeListsRules() { - cmTargets &tgts = this->Makefile->GetTargets(); // Create the regeneration custom rule. if(!this->Makefile->IsOn("CMAKE_SUPPRESS_REGENERATION")) { @@ -104,17 +104,17 @@ void cmLocalVisualStudio7Generator::AddCMakeListsRules() if(cmSourceFile* sf = this->CreateVCProjBuildRule()) { // Add the rule to targets that need it. - for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) + std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets(); + for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin(); + l != tgts.end(); ++l) { - if (l->second.GetType() == cmState::GLOBAL_TARGET) + if ((*l)->GetType() == cmState::GLOBAL_TARGET) { continue; } - if(l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET) + if((*l)->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) { - cmGeneratorTarget* gt = - this->GlobalGenerator->GetGeneratorTarget(&l->second); - gt->AddSource(sf->GetFullPath()); + (*l)->AddSource(sf->GetFullPath()); } } } @@ -126,12 +126,11 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets() // Visual Studio .NET 2003 Service Pack 1 will not run post-build // commands for targets in which no sources are built. Add dummy // rules to force these targets to build. - cmTargets &tgts = this->Makefile->GetTargets(); - for(cmTargets::iterator l = tgts.begin(); + std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets(); + for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin(); l != tgts.end(); l++) { - cmTarget& tgt = l->second; - if(tgt.GetType() == cmState::GLOBAL_TARGET) + if((*l)->GetType() == cmState::GLOBAL_TARGET) { std::vector<std::string> no_depends; cmCustomCommandLine force_command; @@ -143,16 +142,14 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets() std::string force = this->GetCurrentBinaryDirectory(); force += cmake::GetCMakeFilesDirectory(); force += "/"; - force += tgt.GetName(); + force += (*l)->GetName(); force += "_force"; if(cmSourceFile* file = this->Makefile->AddCustomCommandToOutput( force.c_str(), no_depends, no_main_dependency, force_commands, " ", 0, true)) { - cmGeneratorTarget* gt = - this->GlobalGenerator->GetGeneratorTarget(&tgt); - gt->AddSource(file->GetFullPath()); + (*l)->AddSource(file->GetFullPath()); } } } @@ -176,21 +173,21 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles() } // Get the set of targets in this directory. - cmTargets &tgts = this->Makefile->GetTargets(); + std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets(); // Create the project file for each target. - for(cmTargets::iterator l = tgts.begin(); + for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin(); l != tgts.end(); l++) { - if(l->second.GetType() == cmState::INTERFACE_LIBRARY) + if((*l)->GetType() == cmState::INTERFACE_LIBRARY) { continue; } // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace // so don't build a projectfile for it - if(!l->second.GetProperty("EXTERNAL_MSPROJECT")) + if(!(*l)->GetProperty("EXTERNAL_MSPROJECT")) { - this->CreateSingleVCProj(l->first.c_str(),l->second); + this->CreateSingleVCProj((*l)->GetName().c_str(), *l); } } } @@ -228,7 +225,7 @@ void cmLocalVisualStudio7Generator::WriteStampFiles() //---------------------------------------------------------------------------- void cmLocalVisualStudio7Generator -::CreateSingleVCProj(const std::string& lname, cmTarget &target) +::CreateSingleVCProj(const std::string& lname, cmGeneratorTarget *target) { cmGlobalVisualStudioGenerator* gg = static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator); @@ -244,7 +241,7 @@ void cmLocalVisualStudio7Generator } // add to the list of projects - target.SetProperty("GENERATOR_FILE_NAME",lname.c_str()); + target->Target->SetProperty("GENERATOR_FILE_NAME",lname.c_str()); // create the dsp.cmake file std::string fname; fname = this->GetCurrentBinaryDirectory(); @@ -327,8 +324,9 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule() } void cmLocalVisualStudio7Generator::WriteConfigurations( - std::ostream& fout, std::vector<std::string> const& configs, - const std::string& libName, cmTarget &target + std::ostream& fout, + std::vector<std::string> const& configs, + const std::string& libName, cmGeneratorTarget *target ) { fout << "\t<Configurations>\n"; @@ -646,7 +644,7 @@ private: void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, const std::string& configName, const std::string& libName, - cmTarget &target) + cmGeneratorTarget *target) { const char* mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG"); if(!mfcFlag) @@ -667,10 +665,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, const char* projectType = 0; bool targetBuilds = true; - cmGeneratorTarget* gt = - this->GlobalGenerator->GetGeneratorTarget(&target); - - switch(target.GetType()) + switch(target->GetType()) { case cmState::OBJECT_LIBRARY: targetBuilds = false; // no manifest tool for object library @@ -702,12 +697,12 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, { const std::string& linkLanguage = (this->FortranProject? std::string("Fortran"): - gt->GetLinkerLanguage(configName)); + target->GetLinkerLanguage(configName)); if(linkLanguage.empty()) { cmSystemTools::Error ("CMake can not determine linker language for target: ", - target.GetName().c_str()); + target->GetName().c_str()); return; } if(linkLanguage == "C" || linkLanguage == "CXX" @@ -733,12 +728,12 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, } // Add the target-specific flags. - this->AddCompileOptions(flags, gt, linkLanguage, configName); + this->AddCompileOptions(flags, target, linkLanguage, configName); } if(this->FortranProject) { - switch(this->GetFortranFormat(target.GetProperty("Fortran_FORMAT"))) + switch(this->GetFortranFormat(target->GetProperty("Fortran_FORMAT"))) { case FortranFormatFixed: flags += " -fixed"; break; case FortranFormatFree: flags += " -free"; break; @@ -765,7 +760,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, targetOptions.Parse(defineFlags.c_str()); targetOptions.ParseFinish(); std::vector<std::string> targetDefines; - gt->GetCompileDefinitions(targetDefines, configName, "CXX"); + target->GetCompileDefinitions(targetDefines, configName, "CXX"); targetOptions.AddDefines(targetDefines); targetOptions.SetVerboseMakefile( this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")); @@ -777,22 +772,22 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, targetOptions.AddDefine(configDefine); // Add the export symbol definition for shared library objects. - if(const char* exportMacro = gt->GetExportMacro()) + if(const char* exportMacro = target->GetExportMacro()) { targetOptions.AddDefine(exportMacro); } // The intermediate directory name consists of a directory for the // target and a subdirectory for the configuration name. - std::string intermediateDir = this->GetTargetDirectory(gt); + std::string intermediateDir = this->GetTargetDirectory(target); intermediateDir += "/"; intermediateDir += configName; - if (target.GetType() < cmState::UTILITY) + if (target->Target->GetType() < cmState::UTILITY) { std::string const& outDir = - target.GetType() == cmState::OBJECT_LIBRARY? - intermediateDir : gt->GetDirectory(configName); + target->Target->GetType() == cmState::OBJECT_LIBRARY? + intermediateDir : target->GetDirectory(configName); fout << "\t\t\tOutputDirectory=\"" << this->ConvertToXMLOutputPathSingle(outDir.c_str()) << "\"\n"; } @@ -807,7 +802,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, if (this->FortranProject) { // Intel Fortran >= 15.0 uses TargetName property. - std::string targetNameFull = gt->GetFullName(configName); + std::string targetNameFull = target->GetFullName(configName); std::string targetName = cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull); std::string targetExt = @@ -842,7 +837,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, if(this->FortranProject) { const char* target_mod_dir = - target.GetProperty("Fortran_MODULE_DIRECTORY"); + target->Target->GetProperty("Fortran_MODULE_DIRECTORY"); std::string modDir; if(target_mod_dir) { @@ -861,7 +856,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, targetOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); fout << "\t\t\t\tAdditionalIncludeDirectories=\""; std::vector<std::string> includes; - this->GetIncludeDirectories(includes, gt, "C", configName); + this->GetIncludeDirectories(includes, target, "C", configName); std::vector<std::string>::iterator i = includes.begin(); for(;i != includes.end(); ++i) { @@ -882,10 +877,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, targetOptions.OutputFlagMap(fout, "\t\t\t\t"); targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n", "CXX"); fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n"; - if(target.GetType() <= cmState::OBJECT_LIBRARY) + if(target->Target->GetType() <= cmState::OBJECT_LIBRARY) { // Specify the compiler program database file if configured. - std::string pdb = gt->GetCompilePDBPath(configName); + std::string pdb = target->GetCompilePDBPath(configName); if(!pdb.empty()) { fout << "\t\t\t\tProgramDataBaseFileName=\"" @@ -989,7 +984,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, "\t\t\t\tName=\"" << manifestTool << "\""; std::vector<cmSourceFile const*> manifest_srcs; - gt->GetManifests(manifest_srcs, configName); + target->GetManifests(manifest_srcs, configName); if (!manifest_srcs.empty()) { fout << "\n\t\t\t\tAdditionalManifestFiles=\""; @@ -1004,7 +999,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, // Check if we need the FAT32 workaround. // Check the filesystem type where the target will be written. - if (cmLVS6G_IsFAT(gt->GetDirectory(configName).c_str())) + if (cmLVS6G_IsFAT(target->GetDirectory(configName).c_str())) { // Add a flag telling the manifest tool to use a workaround // for FAT32 file systems, which can cause an empty manifest @@ -1038,28 +1033,28 @@ cmLocalVisualStudio7Generator } void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, - const std::string& configName, cmTarget &target, + const std::string& configName, cmGeneratorTarget* target, const Options& targetOptions) { cmGlobalVisualStudio7Generator* gg = static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator); std::string temp; std::string extraLinkOptions; - if(target.GetType() == cmState::EXECUTABLE) + if(target->GetType() == cmState::EXECUTABLE) { extraLinkOptions = this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS") + std::string(" ") + GetBuildTypeLinkerFlags("CMAKE_EXE_LINKER_FLAGS", configName); } - if(target.GetType() == cmState::SHARED_LIBRARY) + if(target->GetType() == cmState::SHARED_LIBRARY) { extraLinkOptions = this->Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS") + std::string(" ") + GetBuildTypeLinkerFlags("CMAKE_SHARED_LINKER_FLAGS", configName); } - if(target.GetType() == cmState::MODULE_LIBRARY) + if(target->GetType() == cmState::MODULE_LIBRARY) { extraLinkOptions = this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS") @@ -1067,7 +1062,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, + GetBuildTypeLinkerFlags("CMAKE_MODULE_LINKER_FLAGS", configName); } - const char* targetLinkFlags = target.GetProperty("LINK_FLAGS"); + const char* targetLinkFlags = target->GetProperty("LINK_FLAGS"); if(targetLinkFlags) { extraLinkOptions += " "; @@ -1076,7 +1071,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, std::string configTypeUpper = cmSystemTools::UpperCase(configName); std::string linkFlagsConfig = "LINK_FLAGS_"; linkFlagsConfig += configTypeUpper; - targetLinkFlags = target.GetProperty(linkFlagsConfig.c_str()); + targetLinkFlags = target->GetProperty(linkFlagsConfig.c_str()); if(targetLinkFlags) { extraLinkOptions += " "; @@ -1096,28 +1091,26 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, this->ConvertToOutputFormat(this->ModuleDefinitionFile, SHELL); linkOptions.AddFlag("ModuleDefinitionFile", defFile.c_str()); } - cmGeneratorTarget* gt = - this->GlobalGenerator->GetGeneratorTarget(&target); - if (target.GetType() == cmState::SHARED_LIBRARY && + if (target->GetType() == cmState::SHARED_LIBRARY && this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) { - if (target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) + if (target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) { linkOptions.AddFlag("ModuleDefinitionFile", "$(IntDir)/exportall.def"); } } - switch(target.GetType()) + switch(target->GetType()) { case cmState::UNKNOWN_LIBRARY: break; case cmState::OBJECT_LIBRARY: { - std::string libpath = this->GetTargetDirectory(gt); + std::string libpath = this->GetTargetDirectory(target); libpath += "/"; libpath += configName; libpath += "/"; - libpath += target.GetName(); + libpath += target->GetName(); libpath += ".lib"; const char* tool = this->FortranProject? "VFLibrarianTool":"VCLibrarianTool"; @@ -1129,8 +1122,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, } case cmState::STATIC_LIBRARY: { - std::string targetNameFull = gt->GetFullName(configName); - std::string libpath = gt->GetDirectory(configName); + std::string targetNameFull = target->GetFullName(configName); + std::string libpath = target->GetDirectory(configName); libpath += "/"; libpath += targetNameFull; const char* tool = "VCLibrarianTool"; @@ -1145,14 +1138,14 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, || this->FortranProject) { std::ostringstream libdeps; - this->Internal->OutputObjects(libdeps, &target); + this->Internal->OutputObjects(libdeps, target); if(!libdeps.str().empty()) { fout << "\t\t\t\tAdditionalDependencies=\"" << libdeps.str() << "\"\n"; } } std::string libflags; - this->GetStaticLibraryFlags(libflags, configTypeUpper, gt); + this->GetStaticLibraryFlags(libflags, configTypeUpper, target); if(!libflags.empty()) { fout << "\t\t\t\tAdditionalOptions=\"" << libflags << "\"\n"; @@ -1169,11 +1162,11 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, std::string targetNameFull; std::string targetNameImport; std::string targetNamePDB; - gt->GetLibraryNames(targetName, targetNameSO, targetNameFull, + target->GetLibraryNames(targetName, targetNameSO, targetNameFull, targetNameImport, targetNamePDB, configName); // Compute the link library and directory information. - cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName); + cmComputeLinkInformation* pcli = target->GetLinkInformation(configName); if(!pcli) { return; @@ -1205,22 +1198,22 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, if(this->GetVersion() < cmGlobalVisualStudioGenerator::VS8 || this->FortranProject) { - this->Internal->OutputObjects(fout, &target, " "); + this->Internal->OutputObjects(fout, target, " "); } fout << " "; this->Internal->OutputLibraries(fout, cli.GetItems()); fout << "\"\n"; - temp = gt->GetDirectory(configName); + temp = target->GetDirectory(configName); temp += "/"; temp += targetNameFull; fout << "\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; - this->WriteTargetVersionAttribute(fout, gt); + this->WriteTargetVersionAttribute(fout, target); linkOptions.OutputFlagMap(fout, "\t\t\t\t"); fout << "\t\t\t\tAdditionalLibraryDirectories=\""; this->OutputLibraryDirectories(fout, cli.GetDirectories()); fout << "\"\n"; - temp = gt->GetPDBDirectory(configName); + temp = target->GetPDBDirectory(configName); temp += "/"; temp += targetNamePDB; fout << "\t\t\t\tProgramDatabaseFile=\"" << @@ -1248,7 +1241,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, { fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\"\n"; } - temp = gt->GetDirectory(configName, true); + temp = target->GetDirectory(configName, true); temp += "/"; temp += targetNameImport; fout << "\t\t\t\tImportLibrary=\"" @@ -1266,11 +1259,11 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, std::string targetNameFull; std::string targetNameImport; std::string targetNamePDB; - gt->GetExecutableNames(targetName, targetNameFull, + target->GetExecutableNames(targetName, targetNameFull, targetNameImport, targetNamePDB, configName); // Compute the link library and directory information. - cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName); + cmComputeLinkInformation* pcli = target->GetLinkInformation(configName); if(!pcli) { return; @@ -1278,7 +1271,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, cmComputeLinkInformation& cli = *pcli; std::string linkLanguage = cli.GetLinkLanguage(); - bool isWin32Executable = target.GetPropertyAsBool("WIN32_EXECUTABLE"); + bool isWin32Executable = target->GetPropertyAsBool("WIN32_EXECUTABLE"); // Compute the variable name to lookup standard libraries for this // language. @@ -1304,23 +1297,23 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, if(this->GetVersion() < cmGlobalVisualStudioGenerator::VS8 || this->FortranProject) { - this->Internal->OutputObjects(fout, &target, " "); + this->Internal->OutputObjects(fout, target, " "); } fout << " "; this->Internal->OutputLibraries(fout, cli.GetItems()); fout << "\"\n"; - temp = gt->GetDirectory(configName); + temp = target->GetDirectory(configName); temp += "/"; temp += targetNameFull; fout << "\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; - this->WriteTargetVersionAttribute(fout, gt); + this->WriteTargetVersionAttribute(fout, target); linkOptions.OutputFlagMap(fout, "\t\t\t\t"); fout << "\t\t\t\tAdditionalLibraryDirectories=\""; this->OutputLibraryDirectories(fout, cli.GetDirectories()); fout << "\"\n"; std::string path = this->ConvertToXMLOutputPathSingle( - gt->GetPDBDirectory(configName).c_str()); + target->GetPDBDirectory(configName).c_str()); fout << "\t\t\t\tProgramDatabaseFile=\"" << path << "/" << targetNamePDB << "\"\n"; @@ -1367,7 +1360,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, { fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\""; } - temp = gt->GetDirectory(configName, true); + temp = target->GetDirectory(configName, true); temp += "/"; temp += targetNameImport; fout << "\t\t\t\tImportLibrary=\"" @@ -1418,13 +1411,11 @@ cmLocalVisualStudio7GeneratorInternals //---------------------------------------------------------------------------- void cmLocalVisualStudio7GeneratorInternals -::OutputObjects(std::ostream& fout, cmTarget* t, const char* isep) +::OutputObjects(std::ostream& fout, cmGeneratorTarget* gt, const char* isep) { // VS < 8 does not support per-config source locations so we // list object library content on the link line instead. cmLocalVisualStudio7Generator* lg = this->LocalGenerator; - cmGeneratorTarget* gt = - lg->GetGlobalGenerator()->GetGeneratorTarget(t); std::vector<std::string> objs; gt->UseObjectLibraries(objs, ""); const char* sep = isep? isep : ""; @@ -1481,7 +1472,7 @@ cmLocalVisualStudio7Generator void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, const std::string& libName, - cmTarget &target) + cmGeneratorTarget* target) { std::vector<std::string> configs; this->Makefile->GetConfigurations(configs); @@ -1489,13 +1480,10 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, // We may be modifying the source groups temporarily, so make a copy. std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups(); - cmGeneratorTarget* gt = - this->GlobalGenerator->GetGeneratorTarget(&target); - // get the classes from the source lists then add them to the groups this->ModuleDefinitionFile = ""; std::vector<cmSourceFile*> classes; - if (!gt->GetConfigCommonSourceFiles(classes)) + if (!target->GetConfigCommonSourceFiles(classes)) { return; } @@ -1538,7 +1526,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, // VS >= 8 support per-config source locations so we // list object library content as external objects. std::vector<std::string> objs; - gt->UseObjectLibraries(objs, ""); + target->UseObjectLibraries(objs, ""); if(!objs.empty()) { // TODO: Separate sub-filter for each object library used? @@ -1573,7 +1561,7 @@ class cmLocalVisualStudio7GeneratorFCInfo { public: cmLocalVisualStudio7GeneratorFCInfo(cmLocalVisualStudio7Generator* lg, - cmTarget& target, + cmGeneratorTarget* target, cmSourceFile const& sf, std::vector<std::string> const& configs); std::map<std::string, cmLVS7GFileConfig> FileConfigMap; @@ -1581,12 +1569,10 @@ public: cmLocalVisualStudio7GeneratorFCInfo ::cmLocalVisualStudio7GeneratorFCInfo(cmLocalVisualStudio7Generator* lg, - cmTarget& target, + cmGeneratorTarget* gt, cmSourceFile const& sf, std::vector<std::string> const& configs) { - cmGeneratorTarget* gt = - lg->GetGlobalGenerator()->GetGeneratorTarget(&target); std::string objectName; if(gt->HasExplicitObjectName(&sf)) { @@ -1703,10 +1689,10 @@ cmLocalVisualStudio7GeneratorFCInfo //---------------------------------------------------------------------------- std::string cmLocalVisualStudio7Generator -::ComputeLongestObjectDirectory(cmTarget& target) const +::ComputeLongestObjectDirectory(cmGeneratorTarget const* target) const { std::vector<std::string> configs; - target.GetMakefile()->GetConfigurations(configs); + target->Target->GetMakefile()->GetConfigurations(configs); // Compute the maximum length configuration name. std::string config_max; @@ -1725,9 +1711,7 @@ cmLocalVisualStudio7Generator std::string dir_max; dir_max += this->GetCurrentBinaryDirectory(); dir_max += "/"; - cmGeneratorTarget* gt = - this->GlobalGenerator->GetGeneratorTarget(&target); - dir_max += this->GetTargetDirectory(gt); + dir_max += this->GetTargetDirectory(target); dir_max += "/"; dir_max += config_max; dir_max += "/"; @@ -1735,7 +1719,7 @@ cmLocalVisualStudio7Generator } bool cmLocalVisualStudio7Generator -::WriteGroup(const cmSourceGroup *sg, cmTarget& target, +::WriteGroup(const cmSourceGroup *sg, cmGeneratorTarget* target, std::ostream &fout, const std::string& libName, std::vector<std::string> const& configs) { @@ -1770,15 +1754,14 @@ bool cmLocalVisualStudio7Generator } // Loop through each source in the source group. - std::string objectName; for(std::vector<const cmSourceFile *>::const_iterator sf = sourceFiles.begin(); sf != sourceFiles.end(); ++sf) { std::string source = (*sf)->GetFullPath(); FCInfo fcinfo(this, target, *(*sf), configs); - if (source != libName || target.GetType() == cmState::UTILITY || - target.GetType() == cmState::GLOBAL_TARGET ) + if (source != libName || target->GetType() == cmState::UTILITY || + target->GetType() == cmState::GLOBAL_TARGET ) { fout << "\t\t\t<File\n"; std::string d = this->ConvertToXMLOutputPathSingle(source.c_str()); @@ -2025,10 +2008,10 @@ void cmLocalVisualStudio7Generator::WriteVCProjEndGroup(std::ostream& fout) void cmLocalVisualStudio7Generator ::OutputTargetRules(std::ostream& fout, const std::string& configName, - cmTarget &target, + cmGeneratorTarget *target, const std::string& /*libName*/) { - if (target.GetType() > cmState::GLOBAL_TARGET) + if (target->GetType() > cmState::GLOBAL_TARGET) { return; } @@ -2038,36 +2021,35 @@ void cmLocalVisualStudio7Generator const char* tool = this->FortranProject? "VFPreBuildEventTool":"VCPreBuildEventTool"; event.Start(tool); - event.Write(target.GetPreBuildCommands()); + event.Write(target->Target->GetPreBuildCommands()); event.Finish(); // Add pre-link event. tool = this->FortranProject? "VFPreLinkEventTool":"VCPreLinkEventTool"; event.Start(tool); bool addedPrelink = false; - if (target.GetType() == cmState::SHARED_LIBRARY && + if (target->GetType() == cmState::SHARED_LIBRARY && this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) { - if (target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) + if (target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) { addedPrelink = true; std::vector<cmCustomCommand> commands = - target.GetPreLinkCommands(); + target->Target->GetPreLinkCommands(); cmGlobalVisualStudioGenerator* gg = static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator); - cmGeneratorTarget* gt = - this->GlobalGenerator->GetGeneratorTarget(&target); gg->AddSymbolExportCommand( - gt, commands, configName); + target, commands, configName); event.Write(commands); } } if (!addedPrelink) { - event.Write(target.GetPreLinkCommands()); + event.Write(target->Target->GetPreLinkCommands()); } cmsys::auto_ptr<cmCustomCommand> pcc( - this->MaybeCreateImplibDir(target, configName, this->FortranProject)); + this->MaybeCreateImplibDir(target, + configName, this->FortranProject)); if(pcc.get()) { event.Write(*pcc); @@ -2077,18 +2059,18 @@ void cmLocalVisualStudio7Generator // Add post-build event. tool = this->FortranProject? "VFPostBuildEventTool":"VCPostBuildEventTool"; event.Start(tool); - event.Write(target.GetPostBuildCommands()); + event.Write(target->Target->GetPostBuildCommands()); event.Finish(); } void cmLocalVisualStudio7Generator::WriteProjectSCC(std::ostream& fout, - cmTarget& target) + cmGeneratorTarget* target) { // if we have all the required Source code control tags // then add that to the project - const char* vsProjectname = target.GetProperty("VS_SCC_PROJECTNAME"); - const char* vsLocalpath = target.GetProperty("VS_SCC_LOCALPATH"); - const char* vsProvider = target.GetProperty("VS_SCC_PROVIDER"); + const char* vsProjectname = target->GetProperty("VS_SCC_PROJECTNAME"); + const char* vsLocalpath = target->GetProperty("VS_SCC_LOCALPATH"); + const char* vsProvider = target->GetProperty("VS_SCC_PROVIDER"); if(vsProvider && vsLocalpath && vsProjectname) { @@ -2096,7 +2078,7 @@ void cmLocalVisualStudio7Generator::WriteProjectSCC(std::ostream& fout, << "\tSccLocalPath=\"" << vsLocalpath << "\"\n" << "\tSccProvider=\"" << vsProvider << "\"\n"; - const char* vsAuxPath = target.GetProperty("VS_SCC_AUXPATH"); + const char* vsAuxPath = target->GetProperty("VS_SCC_AUXPATH"); if(vsAuxPath) { fout << "\tSccAuxPath=\"" << vsAuxPath << "\"\n"; @@ -2108,7 +2090,7 @@ void cmLocalVisualStudio7Generator ::WriteProjectStartFortran(std::ostream& fout, const std::string& libName, - cmTarget & target) + cmGeneratorTarget *target) { cmGlobalVisualStudio7Generator* gg = @@ -2118,13 +2100,13 @@ cmLocalVisualStudio7Generator << "<VisualStudioProject\n" << "\tProjectCreator=\"Intel Fortran\"\n" << "\tVersion=\"" << gg->GetIntelProjectVersion() << "\"\n"; - const char* keyword = target.GetProperty("VS_KEYWORD"); + const char* keyword = target->GetProperty("VS_KEYWORD"); if(!keyword) { keyword = "Console Application"; } const char* projectType = 0; - switch(target.GetType()) + switch(target->GetType()) { case cmState::STATIC_LIBRARY: projectType = "typeStaticLibrary"; @@ -2169,7 +2151,7 @@ cmLocalVisualStudio7Generator void cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, const std::string& libName, - cmTarget & target, + cmGeneratorTarget *target, std::vector<cmSourceGroup> &) { if(this->FortranProject) @@ -2193,12 +2175,12 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, { fout << "\tVersion=\"" << (gg->GetVersion()/10) << ".00\"\n"; } - const char* projLabel = target.GetProperty("PROJECT_LABEL"); + const char* projLabel = target->GetProperty("PROJECT_LABEL"); if(!projLabel) { projLabel = libName.c_str(); } - const char* keyword = target.GetProperty("VS_KEYWORD"); + const char* keyword = target->GetProperty("VS_KEYWORD"); if(!keyword) { keyword = "Win32Proj"; @@ -2210,7 +2192,7 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, } this->WriteProjectSCC(fout, target); if(const char* targetFrameworkVersion = - target.GetProperty("VS_DOTNET_TARGET_FRAMEWORK_VERSION")) + target->GetProperty("VS_DOTNET_TARGET_FRAMEWORK_VERSION")) { fout << "\tTargetFrameworkVersion=\"" << targetFrameworkVersion << "\"\n"; } @@ -2231,12 +2213,13 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, } -void cmLocalVisualStudio7Generator::WriteVCProjFooter(std::ostream& fout, - cmTarget &target) +void cmLocalVisualStudio7Generator::WriteVCProjFooter( + std::ostream& fout, + cmGeneratorTarget *target) { fout << "\t<Globals>\n"; - cmPropertyMap const& props = target.GetProperties(); + cmPropertyMap const& props = target->Target->GetProperties(); for(cmPropertyMap::const_iterator i = props.begin(); i != props.end(); ++i) { if(i->first.find("VS_GLOBAL_") == 0) |