[CMake] Re: Out of source build and KDevelop
William A. Hoffman
billlist at nycap.rr.com
Mon Oct 18 10:32:00 EDT 2004
At 10:08 AM 10/18/2004, Alexander Neundorf wrote:
>> When you load the project into kdevelop, and you load the top level
>> project, does it also load the other projects? Why do you want
>> them all to be called CMake?
>
>Well, I don't really want them all to be called CMake. That's just the best
>way I
>found until now.
>
>> For example, cmake contains the Curl project
>> as a sub project. Why should you load the project CMAke to build Curl?
>> How does kdevelop treat these sub-projects? Does it load them all when
>> you load the top one?
>
>"Loading the project" mainly defines the directory in which to call make. So
>they
>will be "made" too.
>
>So, two points: finding better names for the project files and including all
>source
>files of sub-projects in upper projects, right ?
>
>Bye
>Alex
>
>
>
Yes, that sounds good. To get the correct names, I think you have
to move the code to the global generator and basically remove the kdevelop3
local generator.
Here are the changes I would like to see:
1. move cmGlobalVisualStudio7Generator::CollectSubprojects() and the map
m_SubProjectMap to the parent class cmGlobalGenerator so you can
use it in the kdevelop global generator.
// The function looks like this:
// populate the m_SubProjectMap
void cmGlobalVisualStudio7Generator::CollectSubprojects()
{
unsigned int i;
for(i = 0; i < m_LocalGenerators.size(); ++i)
{
std::string name = m_LocalGenerators[i]->GetMakefile()->GetProjectName();
m_SubProjectMap[name].push_back(m_LocalGenerators[i]);
std::vector<std::string> const& pprojects
= m_LocalGenerators[i]->GetMakefile()->GetParentProjects();
for(unsigned int k =0; k < pprojects.size(); ++k)
{
m_SubProjectMap[pprojects[k]].push_back(m_LocalGenerators[i]);
}
}
}
2. Add a Generate method to the kdevlop global generator:
void cmGlobalKdevelopGenerator::Generate()
{
this->CollectSubprojects(); // call the parent class to fill m_SubProjectMap
// Create a kdevlop3 project for each project in the project:
for(it = m_SubProjectMap.begin(); it!= m_SubProjectMap.end(); ++it)
{
this->OutputKDevelop3Project(it->second[0], it->second);
}
3. Implement OutputKDevelop3Project something like this:
cmGlobalKdevelopGenerator::OutputKDevelop3Project(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators)
{
// root is the top level project where you get the project name from
std::string fname = root->GetMakefile()->GetStartOutputDirectory();
fname += "/";
fname += root->GetMakefile()->GetProjectName();
...
// then collect up all the files in all the targets in the generators
// vector. This will contain the list of local generators for
// all sub projects of root
}
More information about the CMake
mailing list