Il 12/02/2011 19.58, Alexander Neundorf ha scritto:
On Friday 11 February 2011, Andrea Galeazzi wrote:
Alexander Neundorf ha scritto:
On Wednesday 09 February 2011, Andrea Galeazzi wrote:
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() )
Cool :-)
Without having looked at the code in detail, what I'd like to have is to
keep the linked resource [SOURCE DIR] pointing to CMAKE_SOURCE_DIR, and
additionally a linked resource [PROJECTS], which contains linked
resources pointing to the different project directories.
This way I hope it should be clear that the one link just takes you to
the source directory, while the other links (only visible when the
[PROJECTS] resource is opened) take you to the project directories.

Alex

   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
_______________________________________________
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
I modified the code in order to achieve what you suggested, now CMake
generates two Linked Folders: [Sources Directory] pointing to
CMAKE_SOURCE_DIR and [Dependent Projects] containing all sub projects
specified in add_subdirectory commands.

     const std::vector<cmLocalGenerator*>&  generators =
this->GlobalGenerator->GetLocalGenerators();
     std::vector<cmLocalGenerator*>::const_iterator iter =
generators.begin();
     std::string sourceLinkedResourceName;
     for(; iter != generators.end(); ++iter)
     {
       std::string rootLinkDirectory;
       mf = (*iter)->GetMakefile();
       if (iter != generators.begin())
       {
         rootLinkDirectory = "[Dependent Projects]";
         sourceLinkedResourceName = rootLinkDirectory;
         sourceLinkedResourceName += "/";
         sourceLinkedResourceName += mf->GetProjectName();
       }
       else
       {
         sourceLinkedResourceName = "[Sources Directory]";
         rootLinkDirectory = 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));
         if (find (this->SrcLinkedResources.begin(),
                   this->SrcLinkedResources.end(),
                   rootLinkDirectory) == this->SrcLinkedResources.end())
                   this->SrcLinkedResources.push_back(rootLinkDirectory);
         }

       // 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"));
      }

Please let  me know what do you think about it and if this kind of
"patch" could enter in the main repository.
Thanks :-)

I implemented something a bit different now.
For each project()-call in your project a linked resource will be created.

But I think this won't make it into 2.8.4 anymore.

Alex

__________ Informazioni da ESET NOD32 Antivirus, versione del database delle 
firme digitali 5871 (20110213) __________

Il messaggio و stato controllato da ESET NOD32 Antivirus.

www.nod32.it




Did you already commit it into git? I'm very curious to see it... :-)

_______________________________________________
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