View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015356CMakeCMakepublic2015-01-16 05:152015-11-02 09:13
ReporterPeter Kuemmel 
Assigned ToNils Gladitz 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformAllOSAllOS VersionAll
Product VersionCMake 3.2 
Target VersionFixed in VersionCMake 3.3 
Summary0015356: CodeBlocks: add target to which a file belongs to
DescriptionIDEs like QtCreator parse the cbp file to figure out compile options for each file.

Currently it is not possible to figure out to which <Target title=> a file belongs to and the IDE has to guess a target which is mostly done by the file location.

But when there are multiple targets within the same directory with different options the IDE has no chance to do the mapping file<->target right.

A <Unit> part within <Target> would solve the problem.
TagsNo tags attached.
Attached Filespng file icon qtcreator.png [^] (130,302 bytes) 2015-03-11 17:46

 Relationships

  Notes
(0038147)
Nils Gladitz (developer)
2015-03-05 08:53

It looks like the format allows for one or more <Option target="target-name"/> elements under each <Unit> element for this.

It also looks like QtCreator's cbp parser does not handle those (yet).
(0038149)
Peter Kuemmel (developer)
2015-03-05 12:30

Is this only available in CMake 3.2?
(0038150)
Nils Gladitz (developer)
2015-03-05 12:39

Is that in response to me? What do you mean specifically?
I was looking at the CodeBlocks's project specification and into what would be required in CMake and QtCreator but I haven't actually implemented anything.
(0038151)
Peter Kuemmel (developer)
2015-03-05 14:16

Yes, when I use cmake version 3.1.3, I don't see any <Option target="target-name"/> under <Unit>.

Is this already available in 3.2, or needs it to be implemented?
(0038152)
Nils Gladitz (developer)
2015-03-05 14:22

No like I said I was looking into what would be required to implement this hence this isn't implemented yet.

In CMake this looks simple enough but I am not really sure about what would be required in QtCreator.
(0038155)
Nils Gladitz (developer)
2015-03-06 03:53

I've given the CMake side a try:
https://github.com/ngladitz/cmake/commit/099b0cab1d12b5b3734342ac516c8d42c78cdef7 [^]
(0038158)
Nils Gladitz (developer)
2015-03-06 09:13

It looks like neither QtCreator nor CodeBlocks itself choke on the new elements and CodeBlocks does seems to properly associate source files with the targets that they belong to now.

I've merged to "next" for testing.
(0038175)
Peter Kuemmel (developer)
2015-03-07 10:17

I had a look at the QtCreator code:
https://codereview.qt-project.org/#/c/107991/ [^]

Related QtCreator bug:
https://bugreports.qt.io/browse/QTCREATORBUG-13695 [^]
(0038181)
Nils Gladitz (developer)
2015-03-09 07:36

Minor clarification; the earliest CMake release this could get into is 3.3 rather than 3.2.

I tried your QtCreator changes with this test case:
https://gist.github.com/ngladitz/a2ea8df64ba36bdf1077 [^]

In foo.cpp the code model seems to correctly see that FOO is defined and BAR isn't.

In bar.cpp however both FOO and BAR seem to be defined (expected would be that only BAR is defined).

With vanilla QtCreator 3.3.1 FOO is defined in both foo.cpp and bar.cpp and BAR is defined in neither.
(0038200)
Peter Kuemmel (developer)
2015-03-11 08:58

I've tested with your gist, and the code model now looks correct, but highlighting in the editor does not work; maybe different issue in qtcreator.
(0038202)
Nils Gladitz (developer)
2015-03-11 13:37

Thanks! It seems to work for me as well.
The highlighting defaults seem to have changed in QtCreator.

I changed "Text Editor" -> "Font & Colors" -> "Disabled Code" in the "Color Scheme" and it highlights as expected.

In "Tools" -> "C++" -> "Inspect C++ Code Model..." in the "Project Parts" tab "foo" seems to list foo.cpp twice under "Project Files" while "bar" shows bar.cpp only once.

Could that be an issue?
(0038205)
Peter Kuemmel (developer)
2015-03-11 17:28

Here still both ifdefs are disabled in both files, but there should be one enabled and one disabled.

> list foo.cpp twice under "Project Files"
Not here, have you build latest 3.4?
(0038206)
Nils Gladitz (developer)
2015-03-11 17:46

I used "Patch Set 4" (44694284a5290d5a065ae52246d83006770ac2ca) from the code review that you linked (screenshot attached).
(0038210)
Peter Kuemmel (developer)
2015-03-14 02:31
edited on: 2015-03-14 04:21

I abandoned creator patch, because it seems the file logic is completely path based, and the creator team there isn't very interested in CMake.

I tried CLion with your example, and there it works like expected! I will also have a look at Kdevelop.

So maybe it's time to move away from QtCreator until there is reliable meta information:
http://public.kitware.com/pipermail/cmake-developers/2015-March/024666.html [^]

(0038211)
Nils Gladitz (developer)
2015-03-14 04:05

I don't understand why that is an issue or what the issue even is given that this had the appearance of mostly working (see screenshot).

Thanks for trying though!

I'll resolve this issue given that the cmake part is now in master: http://www.cmake.org/gitweb?p=cmake.git;a=commit;h=099b0cab [^]
(0038212)
Peter Kuemmel (developer)
2015-03-14 04:24
edited on: 2015-04-15 05:59

Thanks, too. I hope someone of the creator guys has a look at it.

We should create a new QtCreator ticket when there is a CMake release which supports the target property, and upload the example project.

(0039771)
Robert Maynard (manager)
2015-11-02 09:13

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2015-01-16 05:15 Peter Kuemmel New Issue
2015-03-05 08:53 Nils Gladitz Note Added: 0038147
2015-03-05 12:30 Peter Kuemmel Note Added: 0038149
2015-03-05 12:39 Nils Gladitz Note Added: 0038150
2015-03-05 14:16 Peter Kuemmel Note Added: 0038151
2015-03-05 14:22 Nils Gladitz Note Added: 0038152
2015-03-06 03:53 Nils Gladitz Note Added: 0038155
2015-03-06 09:13 Nils Gladitz Note Added: 0038158
2015-03-07 10:17 Peter Kuemmel Note Added: 0038175
2015-03-09 07:36 Nils Gladitz Note Added: 0038181
2015-03-11 08:58 Peter Kuemmel Note Added: 0038200
2015-03-11 13:37 Nils Gladitz Note Added: 0038202
2015-03-11 17:28 Peter Kuemmel Note Added: 0038205
2015-03-11 17:46 Nils Gladitz File Added: qtcreator.png
2015-03-11 17:46 Nils Gladitz Note Added: 0038206
2015-03-14 02:31 Peter Kuemmel Note Added: 0038210
2015-03-14 04:05 Nils Gladitz Note Added: 0038211
2015-03-14 04:05 Nils Gladitz Status new => resolved
2015-03-14 04:05 Nils Gladitz Fixed in Version => CMake 3.3
2015-03-14 04:05 Nils Gladitz Resolution open => fixed
2015-03-14 04:05 Nils Gladitz Assigned To => Nils Gladitz
2015-03-14 04:21 Peter Kuemmel Note Edited: 0038210
2015-03-14 04:24 Peter Kuemmel Note Added: 0038212
2015-04-15 05:59 Peter Kuemmel Note Edited: 0038212
2015-11-02 09:13 Robert Maynard Note Added: 0039771
2015-11-02 09:13 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team