View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0011657CMakeCMakepublic2011-01-05 04:002011-02-22 15:24
ReporterMichał Fita 
Assigned ToAlex Neundorf 
PriorityhighSeverityfeatureReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake 2.8.3 
Target VersionFixed in Version 
Summary0011657: CMake Eclipse CDT generator out-of-source suggestion
DescriptionI cannot force CMake to generate CDT project with sources for me. This is probably due to complex structure of sources in our project.

However, the most important thing is that I have fond a way how to handle source files out of build tree without conflicts if sources are inside build tree or somewhere outside or both.

You can use virtual folders under "source" directory of project created to reflect the structure of files being part of the project build by CMake and use links to existing files to put source files in proper virtual folders. Then in fact developer will have access to these files in their original location.

I am currently working on Python script which will parse CMakeLists.txt files in our complex project structure and build such virtual structure in .cproject and .project XML files.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0025094)
Alex Neundorf (developer)
2011-01-26 12:29

Can you create a small test project which shows the problem you have ?
This would help a lot.
Right now the eclipse generator already generated a virtual resource (or how it is called) which points to CMAKE_SOURCE_DIR.

Do you mean this doesn't work for you or do you have a different way of showing the sources inside the project ?
(0025104)
Michał Fita (reporter)
2011-01-27 04:56

I cannot send you my current project files or structures due to corporation trade secrets. However, I will try to reproduce similar scenario on demo project and then send you CMakeLists.txt and .project files gathered from CMake and expected.
(0025115)
Alex Neundorf (developer)
2011-01-27 16:17

I found how to create a virtual folder in Eclipse.

Does the cmake generator create the "[Source directory]" linked folder for you ?

It should.
What advantage do you get with the virtual folder compared to the linked folder ?

Alex
(0025117)
Michał Fita (reporter)
2011-01-28 03:24

Assume we have root directory with 7 directories, each of them is part of my project, now some (I found it yesterday) of the code is compiled as libraries (from the same CMake project), these libraries have its source code inside subdirectories of these 7 dirs in root. The libs dir in Eclipse project contains only CMakeFiles dirs and other CMake stuff, not links to source code.

I start thinking I am expecting too much from CMake itself for such corner case as my. The problem with my CMAKE_SOURCE_DIR is that it points to an empty directory.

No, I am not responsible for designing that, CMake was fitted into our project to handle non-standard compilation with non-open Texas Instruments toolchain.

The advantage I achieved by scanning all project directories for CMakeLists.txt and extract where sub_targets and SRC_LISTs points to, then link all these source files by creating virtual directory structure. The problem is that I cannot just link these 7 directories from root because there is large mess there and not everything is useful in this particular project.
(0025162)
Alex Neundorf (developer)
2011-01-29 12:54

Ahh, maybe I understand.

So your layout is like this:

/foo/foo.c
/bar/bar.c
/blub/CMakeLists.txt

and the CMakeLists.txt either calls
add_library(WhatEver ../foo/foo.c ../bar/bar.c)

or it does

add_subdirectory(../foo "${CMAKE_CURRENT_BINARY_DIR}/foo")
add_subdirectory(../bar "${CMAKE_CURRENT_BINARY_DIR}/bar")

?

Indeed, in both cases there is no link to the directories where the source actually are is created.

Do I understand correctly ?

Alex
(0025163)
Alex Neundorf (developer)
2011-01-29 13:01

If that's the case, I think the problem here is that Eclipse doesn't support source files outside the toplevel project directory.

Can you please have a look at the documentation for the source_group() command of cmake ?
This is currently only supported for the VisualStudio generators.
Maybe this could be extended so that if used with the Eclipse generator, it creates virtual folders, which contain links to the listed source files ?

Alex
(0025419)
Alex Neundorf (developer)
2011-02-12 13:59

Ok, locally I have a patch now which adds linked resources for all project()s in the project.
So if you have a project() call in the other subdirectories, there will be links to them.
Does that work for you ?

But I think this will not make it into 2.8.4 anymore.

Alex
(0025546)
Alex Neundorf (developer)
2011-02-22 15:24

I merged this into next now, so next week it should be in the master branch of CMake. This will be in 2.8.5.

Alex

 Issue History
Date Modified Username Field Change
2011-01-05 04:00 Michał Fita New Issue
2011-01-06 16:58 Bill Hoffman Assigned To => Alex Neundorf
2011-01-06 16:58 Bill Hoffman Status new => assigned
2011-01-26 12:29 Alex Neundorf Note Added: 0025094
2011-01-27 04:56 Michał Fita Note Added: 0025104
2011-01-27 16:17 Alex Neundorf Note Added: 0025115
2011-01-28 03:24 Michał Fita Note Added: 0025117
2011-01-29 12:54 Alex Neundorf Note Added: 0025162
2011-01-29 13:01 Alex Neundorf Note Added: 0025163
2011-02-12 13:59 Alex Neundorf Note Added: 0025419
2011-02-22 15:24 Alex Neundorf Note Added: 0025546
2011-02-22 15:24 Alex Neundorf Status assigned => closed
2011-02-22 15:24 Alex Neundorf Resolution open => fixed


Copyright © 2000 - 2018 MantisBT Team