Il 08/02/2011 17.58, Alexander Neundorf ha scritto:
On Tuesday 08 February 2011, Andrea Galeazzi wrote:
Il 18/01/2011 19.17, Alexander Neundorf ha scritto:
On Tuesday 18 January 2011, Andrea Galeazzi wrote:
...

I just read that wiki page but what I didn't find is how can I see the
sources referenced by the add_subproject function in the layout  of
eclipse project.
You mean add_subdirectory(), right ?

In other words, CMake generates an eclipse project with a folder named
[Source directory], containing just only the sources listed in the
CMakeLists.txt but it doesn't allow to see the sources included by
add_subproject.
There should be subdirectories there which you should be able to open,
which should show the files.

Which exact version of cmake are you using ?

Alex

__________ Informazioni da ESET NOD32 Antivirus, versione del database
delle firme digitali 5798 (20110118) __________

Il messaggio و stato controllato da ESET NOD32 Antivirus.

www.nod32.it
Yes I meant add_subdirectory and I'm using 2.8.3 version.
The point is that the path passed as argument to the add_subdirectory
function isn't necessary a real filesystem subdirectory of the current
CMakeLists.txt so, in this case, it cannot be browsed by the resource
view of eclipse.
To be more specific don't you think it'd better to generate a .project
containing more links than only [Source directory]?
i.e.:
<linkedResources>
<link>
<name>[Source directory]</name>
<type>2</type>
<location>/Project/Prj</location>
</link>
</linkedResources>

vs:
<linkedResources>
<link>
<name>Main Project</name>
<type>2</type>
<location>/Project/Prj</location>
</link>
<link>
<name>LibName</name>
<type>2</type>
<location>/Libs/Lib1</location>
</link>
</linkedResources>

where libName is the name declared in the project() statement of
CMakeLists.txt of /Libs/Lib1.
This behavior should be more similar to the Visual Studio generator.
So far I made a workaround writing a script which parse a CMakeLists.txt
and invokes CMake to generate one eclipse project for each
add_subdirectory entry. Then I import all projects in a workspace.
I dislike a such solution but that's the only way to browse all sources
that I found.
I  hope my suggestion will be taken into account for the next
releases... and sorry for the late answer!
Andrea
I'll have a look.

Alex

__________ Informazioni da ESET NOD32 Antivirus, versione del database delle 
firme digitali 5841 (20110202) __________

Il messaggio و stato controllato da ESET NOD32 Antivirus.

www.nod32.it




I took the liberty to change a piece of code just in order to test the idea above. That's the code modified (in cmExtraEclipseCDT4Generator::CreateProjectFile() )
 if (this->IsOutOfSourceBuild)
   {
   fout << "\t<linkedResources>\n";
   // create a linked resource to CMAKE_SOURCE_DIR
   // (this is not done anymore for each project because of
// http://public.kitware.com/Bug/view.php?id=9978 and because I found it // actually quite confusing in bigger projects with many directories and
   // projects, Alex
const std::vector<cmLocalGenerator*>& generators = this->GlobalGenerator->GetLocalGenerators(); std::vector<cmLocalGenerator*>::const_iterator iter = generators.begin();
   for(; iter != generators.end(); ++iter)
   {
     mf = (*iter)->GetMakefile();
     std::string sourceLinkedResourceName = "[";
     sourceLinkedResourceName += mf->GetProjectName();
     sourceLinkedResourceName += "]";
     std::string linkSourceDirectory = this->GetEclipsePath(
mf->GetStartDirectory());
     // .project dir can't be subdir of a linked resource dir
     if (!cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(),
                                          linkSourceDirectory.c_str()))
       {
       this->AppendLinkedResource(fout, sourceLinkedResourceName,
this->GetEclipsePath(linkSourceDirectory));
       this->SrcLinkedResources.push_back(sourceLinkedResourceName);
       }

     // for EXECUTABLE_OUTPUT_PATH when not in binary dir
     this->AppendOutLinkedResource(fout,
       mf->GetSafeDefinition("CMAKE_RUNTIME_OUTPUT_DIRECTORY"),
       mf->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"));
     // for LIBRARY_OUTPUT_PATH when not in binary dir
     this->AppendOutLinkedResource(fout,
       mf->GetSafeDefinition("CMAKE_LIBRARY_OUTPUT_DIRECTORY"),
       mf->GetSafeDefinition("LIBRARY_OUTPUT_PATH"));
    }

   fout << "\t</linkedResources>\n";
   }

and it works in my case. Consider this just as a "draft" of a possible patch. Let me know what do you think about it and if I can be of help in anyways.
Andrea.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to