ENH: added internal target property for the name of the project file

This commit is contained in:
Ken Martin 2007-04-10 09:54:01 -04:00
parent 5415b65067
commit 8b0c61c322
6 changed files with 45 additions and 50 deletions

View File

@ -85,13 +85,9 @@ void cmGlobalVisualStudio71Generator
// Get the list of create dsp files names from the cmVCProjWriter, more
// than one dsp could have been created per input CMakeLists.txt file
// for each target
std::vector<std::string> dspnames =
static_cast<cmLocalVisualStudio7Generator *>(generators[i])
->GetCreatedProjectNames();
cmTargets &tgts = generators[i]->GetMakefile()->GetTargets();
cmTargets::iterator l = tgts.begin();
for(std::vector<std::string>::iterator si = dspnames.begin();
l != tgts.end() && si != dspnames.end(); ++l)
for(; l != tgts.end(); ++l)
{
// special handling for the current makefile
if(mf == generators[0]->GetMakefile())
@ -221,9 +217,13 @@ void cmGlobalVisualStudio71Generator
}
if(!skip)
{
this->WriteProject(fout, si->c_str(), dir.c_str(),l->second);
const char *dspname =
l->second.GetProperty("GENERATOR_FILE_NAME");
if (dspname)
{
this->WriteProject(fout, dspname, dir.c_str(),l->second);
}
}
++si;
}
}
}
@ -241,13 +241,10 @@ void cmGlobalVisualStudio71Generator
// Get the list of create dsp files names from the cmVCProjWriter, more
// than one dsp could have been created per input CMakeLists.txt file
// for each target
std::vector<std::string> dspnames =
pg->GetCreatedProjectNames();
cmTargets &tgts = pg->GetMakefile()->GetTargets();
cmTargets::iterator l = tgts.begin();
std::string dir = mf->GetStartDirectory();
for(std::vector<std::string>::iterator si = dspnames.begin();
l != tgts.end() && si != dspnames.end(); ++l)
for(; l != tgts.end(); ++l)
{
if (strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0)
{
@ -263,9 +260,13 @@ void cmGlobalVisualStudio71Generator
bool partOfDefaultBuild = this->IsPartOfDefaultBuild(
root->GetMakefile()->GetProjectName(),
&l->second);
this->WriteProjectConfigurations(fout, si->c_str(),
partOfDefaultBuild);
++si;
const char *dspname =
l->second.GetProperty("GENERATOR_FILE_NAME");
if (dspname)
{
this->WriteProjectConfigurations(fout, dspname,
partOfDefaultBuild);
}
}
}
}

View File

@ -317,13 +317,9 @@ void cmGlobalVisualStudio7Generator
// Get the list of create dsp files names from the cmVCProjWriter, more
// than one dsp could have been created per input CMakeLists.txt file
// for each target
std::vector<std::string> dspnames =
static_cast<cmLocalVisualStudio7Generator *>(generators[i])
->GetCreatedProjectNames();
cmTargets &tgts = generators[i]->GetMakefile()->GetTargets();
cmTargets::iterator l = tgts.begin();
for(std::vector<std::string>::iterator si = dspnames.begin();
l != tgts.end(); ++l)
for(; l != tgts.end(); ++l)
{
// special handling for the current makefile
if(mf == generators[0]->GetMakefile())
@ -442,9 +438,13 @@ void cmGlobalVisualStudio7Generator
}
if(!skip)
{
this->WriteProject(fout, si->c_str(), dir.c_str(),l->second);
const char *dspname =
l->second.GetProperty("GENERATOR_FILE_NAME");
if (dspname)
{
this->WriteProject(fout, dspname, dir.c_str(),l->second);
}
}
++si;
}
}
}
@ -471,13 +471,10 @@ void cmGlobalVisualStudio7Generator
// Get the list of create dsp files names from the cmVCProjWriter, more
// than one dsp could have been created per input CMakeLists.txt file
// for each target
std::vector<std::string> dspnames =
pg->GetCreatedProjectNames();
cmTargets &tgts = pg->GetMakefile()->GetTargets();
cmTargets::iterator l = tgts.begin();
std::string dir = mf->GetStartDirectory();
for(std::vector<std::string>::iterator si = dspnames.begin();
l != tgts.end() && si != dspnames.end(); ++l)
for(; l != tgts.end(); ++l)
{
if (strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0)
{
@ -507,8 +504,13 @@ void cmGlobalVisualStudio7Generator
else if ((l->second.GetType() != cmTarget::INSTALL_FILES)
&& (l->second.GetType() != cmTarget::INSTALL_PROGRAMS))
{
this->WriteProjectDepends(fout, si->c_str(), dir.c_str(), l->second);
++si;
const char *dspname =
l->second.GetProperty("GENERATOR_FILE_NAME");
if (dspname)
{
this->WriteProjectDepends(fout, dspname,
dir.c_str(), l->second);
}
}
}
}
@ -523,13 +525,10 @@ void cmGlobalVisualStudio7Generator
// Get the list of create dsp files names from the cmVCProjWriter, more
// than one dsp could have been created per input CMakeLists.txt file
// for each target
std::vector<std::string> dspnames =
pg->GetCreatedProjectNames();
cmTargets &tgts = pg->GetMakefile()->GetTargets();
cmTargets::iterator l = tgts.begin();
std::string dir = mf->GetStartDirectory();
for(std::vector<std::string>::iterator si = dspnames.begin();
l != tgts.end() && si != dspnames.end(); ++l)
for(; l != tgts.end(); ++l)
{
if(strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0)
{
@ -545,9 +544,13 @@ void cmGlobalVisualStudio7Generator
bool partOfDefaultBuild = this->IsPartOfDefaultBuild(
root->GetMakefile()->GetProjectName(),
&l->second);
this->WriteProjectConfigurations(fout, si->c_str(),
partOfDefaultBuild);
++si;
const char *dspname =
l->second.GetProperty("GENERATOR_FILE_NAME");
if (dspname)
{
this->WriteProjectConfigurations(fout, dspname,
partOfDefaultBuild);
}
}
}
}

View File

@ -184,9 +184,6 @@ void cmGlobalVisualStudio8Generator::WriteSLNFile(
continue;
}
cmMakefile* mf = generators[i]->GetMakefile();
std::vector<std::string> dspnames =
static_cast<cmLocalVisualStudio7Generator*>(generators[i])
->GetCreatedProjectNames();
cmTargets& tgts = mf->GetTargets();
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
{

View File

@ -110,9 +110,6 @@ void cmLocalVisualStudio7Generator::OutputVCProjFile()
// Create the VCProj or set of VCProj's for libraries and executables
// clear project names
this->CreatedProjectNames.clear();
// Call TraceVSDependencies on all targets
cmTargets &tgts = this->Makefile->GetTargets();
for(cmTargets::iterator l = tgts.begin();
@ -158,7 +155,7 @@ void cmLocalVisualStudio7Generator
{
// add to the list of projects
std::string pname = lname;
this->CreatedProjectNames.push_back(pname);
target.SetProperty("GENERATOR_FILE_NAME",lname);
// create the dsp.cmake file
std::string fname;
fname = this->Makefile->GetStartOutputDirectory();

View File

@ -54,14 +54,6 @@ public:
*/
void SetBuildType(BuildType,const char *name);
/**
* Return array of created DSP names in a STL vector.
* Each executable must have its own dsp.
*/
std::vector<std::string> GetCreatedProjectNames()
{
return this->CreatedProjectNames;
}
void SetVersion71() {this->Version = 71;}
void SetVersion8() {this->Version = 8;}
void SetPlatformName(const char* n) { this->PlatformName = n;}
@ -127,7 +119,6 @@ private:
virtual std::string GetTargetDirectory(cmTarget&);
cmVS7FlagTable const* ExtraFlagTable;
std::vector<std::string> CreatedProjectNames;
std::string ModuleDefinitionFile;
int Version;
std::string PlatformName; // Win32 or x64

View File

@ -275,6 +275,12 @@ void cmTarget::DefineProperties(cmake *cm)
"exported symbols and then used for linking. "
"All Windows-based systems including Cygwin are DLL platforms.");
cm->DefineProperty
("GENERATOR_FILE_NAME", cmProperty::TARGET,
"Generator's file for this target.",
"An internal property used by some generators to record the name of "
"project or dsp file associated with this target.");
cm->DefineProperty
("OBJECT_FILES", cmProperty::TARGET,
"Used to get the resulting list of object files that make up a "