View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012223CMakeCMakepublic2011-05-25 03:462011-10-23 09:07
ReporterwAy 
Assigned ToAlex Neundorf 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformanyOSanyOS Versionany
Product VersionCMake 2.8.3 
Target VersionFixed in Version 
Summary0012223: Support of linked resources in Eclipse/CDT (single files, not folders)
DescriptionWhen you´d like to add a single file that is placed outside the regular source folder, you can use the "linked resource" function of Eclipse/CDT.
Using this you will get a link to a single file within your project, that can be edited, compiled, etc. as if it was in your source folder.

At the moment it (seems that it(?)) isn´t possible to create links when using CMake to create a Eclipse project. The files will be compiled, as they should, but you won´t be able to see them in the Eclipse project explorer.
Steps To Reproducee.g. add_library( foo A_FILE_OUTSIDE_OF_THE_REGULAR_SOURCE_FOLDER)

cmake -G "Eclipse CDT4 - Unix Makefiles"

File->Import->Existing Projects into Workspace
TagsCDT, Eclipse, linked resource
Attached Files

 Relationships
related to 0012417closedAlex Neundorf CDT4 generator: source path configured incorrectly 
has duplicate 0012294closedAlex Neundorf Sources outside of source directory aren't included in Eclipse Project view 
related to 0012213closedAlex Neundorf Eclipse CDT4 Generator: Incompleted <linkedResources> 
related to 0012479closedAlex Neundorf Generated Eclipse CDT files only valid for >= Helios (3.6) 
related to 0011723closedAlex Neundorf Eclipse: "Build project" and "Clean project" do not work 
related to 0012392closedAlex Neundorf CMakeFindEclipseCDT4.cmake ignores CMAKE_CXX_COMPILER_ARG1 in compiler invocation 
related to 0012579closedAlex Neundorf Improve project generator for eclipse to handle multiple top level directories 

  Notes
(0026577)
Alex Neundorf (developer)
2011-05-25 15:36

Indeed.
How should this be done ?
I could add special variables like CMAKE_ECLIPSE_LINKED_FOLDERS, which you could set to a list of folders for which linked resources are created.
Or more general a list of files or directories for which linked resources are created.

But maybe we can reuse something which already exists in cmake.
How about using the source_group() command for this in Eclipse ?
http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:source_group [^]

So you could say
source_group(MyFavouriteFiles FILES abc.c foo.c bar.c)

and it would create a virtual folder named "MyFavouriteFiles" which contains links to the listed files.

What do you think ?

Alex
(0026613)
wAy (reporter)
2011-05-26 02:51
edited on: 2011-05-26 02:52

Well,

at the moment our linked files look like this in the .project file:

<linkedResources>
    <link>
    <name>Foobar.cpp</name>
        <type>1</type>
    <location>../foo/Foobar.cpp</location>
    </link>
    <link>
        ...
    </link>
</linkedResources>

So, there are no extra folders for the linked files. However, I think that there are many people, who prefer to have those files grouped also.

So what about something like:
CMAKE_ECLIPSE_LINKED_FILES where you may list all files:
set( CMAKE_ECLIPSE_LINKED_FILES ../foo1/bar1.cpp ../foo2/bar2.cpp ../foo2/bar3.cpp)

and a second one CMAKE_ECLIPSE_LINKED_FILES_FOLDER:
set( CMAKE_ECLIPSE_LINKED_FOLDERS folder_for_my_linked_files )

This one could create those linked resources at top level if not set and otherwise a folder, where the linked files will be found in?

Grouped folders won´t work, because if there are files in the same folder, that don´t belong to the project, you will see them within your project. At least, you can something similar to this with out-of-source-builds already.

I don´t know if this is acceptable for you or fits to the concept cmake follows, but if so, I would prefer something that works in this way.

Anyway, I would be happy about everything that makes it possible to link single files and see them in the eclipse project explorer. :-)

Regards,
wAy

(0027627)
Alex Neundorf (developer)
2011-10-23 09:07

The generated project now contains a virtual folder [Targets], where each target is again a sub-virtual folder, which contains links to all its source files, no matter where they are located.

This is now in the "next" branch of cmake.
Please give it a try and let me know if something doesn't work.

 Issue History
Date Modified Username Field Change
2011-05-25 03:46 wAy New Issue
2011-05-25 03:47 wAy Tag Attached: CDT
2011-05-25 03:47 wAy Tag Attached: Eclipse
2011-05-25 03:47 wAy Tag Attached: linked resource
2011-05-25 15:30 Alex Neundorf Assigned To => Alex Neundorf
2011-05-25 15:30 Alex Neundorf Status new => assigned
2011-05-25 15:36 Alex Neundorf Note Added: 0026577
2011-05-26 02:51 wAy Note Added: 0026613
2011-05-26 02:52 wAy Note Edited: 0026613
2011-09-30 14:54 Alex Neundorf Relationship added related to 0012213
2011-09-30 14:54 Alex Neundorf Relationship added related to 0012417
2011-09-30 14:56 Alex Neundorf Relationship added has duplicate 0012294
2011-09-30 15:17 Alex Neundorf Relationship added related to 0012479
2011-09-30 15:20 Alex Neundorf Relationship added related to 0011723
2011-09-30 15:20 Alex Neundorf Relationship added related to 0012392
2011-10-23 09:07 Alex Neundorf Note Added: 0027627
2011-10-23 09:07 Alex Neundorf Status assigned => closed
2011-10-23 09:07 Alex Neundorf Resolution open => fixed
2011-11-15 11:48 Alex Neundorf Relationship added related to 0012579


Copyright © 2000 - 2018 MantisBT Team