Bug 275648

Summary: KDevelop does not support CMake's COMPILE_DEFINITIONS property
Product: [Applications] kdevelop Reporter: Benjamin Eikel <kdebugs>
Component: Build tools: CMakeAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: wishlist CC: aleixpol
Priority: NOR    
Version: unspecified   
Target Milestone: 4.2.0   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Screen shot of the editor part showing the incorrect highlighting
CMake file setting properties
C++ source code
Screen shot with today's Git version of KDevelop

Description Benjamin Eikel 2011-06-14 20:20:53 UTC
Created attachment 60993 [details]
Screen shot of the editor part showing the incorrect highlighting

Version:           unspecified (using KDE 4.6.3) 
OS:                Linux

Application Version 4.2.2

The KDevelop parser/code highlighting does not respect compile flags that are set by the CMake functions set_property or set_target_properties.

Reproducible: Always

Steps to Reproduce:
Create a project using the attached CMakeLists.txt.

Actual Results:  
See the attached screenshot showing that MyClassSTP and MyClassSP are not recognized correctly by KDevelop.
The classes are built because the output is:
There is support for MyClassSP.
There is support for MyClassSTP.
There is support for MyClassAD.


Expected Results:  
KDevelop should recognized build flags set as CMake properties.
Comment 1 Benjamin Eikel 2011-06-14 20:22:32 UTC
Created attachment 60994 [details]
CMake file setting properties
Comment 2 Benjamin Eikel 2011-06-14 20:23:29 UTC
Created attachment 60995 [details]
C++ source code

This is the code that is open on the attached screen shot
Comment 3 Benjamin Eikel 2011-06-22 13:29:18 UTC
The same problem exists in the current git version (kdevplatform 0525625a083d1011e3aa943e3c3f2aa014d0fbb8, kdevelop f7060b5d7dba0fcd3e6526ae87d80087b137385f).
Comment 4 Aleix Pol 2011-06-22 16:21:59 UTC
Very well reported bug. I'll take a look into it ASAP.
Comment 5 Benjamin Eikel 2011-07-26 07:36:13 UTC
I am wondering why KDevelop does not highlight the code in sections that are guarded by preprocessor defines at all? I know that for example Eclipse CDT shows these parts with a gray background, but you can use the code navigation in these parts. Even if some parts are currently not activated you might want to work with them. Is this a deliberate design decision or a bug?
Comment 6 Aleix Pol 2011-12-02 20:50:29 UTC
Git commit 7ba74cb34c7308185740dbe4489c939664e539dd by Aleix Pol.
Committed on 02/12/2011 at 21:48.
Pushed by apol into branch 'master'.

Prefer files in targets instead of those in directories.
Targets may store relevant information.

CCBUG: 275648

M  +10   -4    languages/cpp/includepathcomputer.cpp

http://commits.kde.org/kdevelop/7ba74cb34c7308185740dbe4489c939664e539dd
Comment 7 Aleix Pol 2011-12-02 20:50:29 UTC
Git commit 2ed170abf8d92a02e1021858d68e29cca63f16fb by Aleix Pol.
Committed on 02/12/2011 at 21:47.
Pushed by apol into branch 'master'.

Support compile definitions in target properties.

BUG: 275648

M  +16   -6    projectmanagers/cmake/cmakemanager.cpp
M  +9    -3    projectmanagers/cmake/cmakemodelitems.cpp
M  +18   -6    projectmanagers/cmake/cmakemodelitems.h

http://commits.kde.org/kdevelop/2ed170abf8d92a02e1021858d68e29cca63f16fb
Comment 8 Benjamin Eikel 2011-12-05 08:45:17 UTC
Created attachment 66391 [details]
Screen shot with today's Git version of KDevelop

I have built the current Git version (KDevelop 90ac02b0fa4686e4e8f4fcc7d5259b61effaa020, KDevPlatform a7afb39d8d64e4c2944f0df556706f7b0b84cab9). The CMake properties set with set_property(TARGET CMakeTestApp APPEND PROPERTY COMPILE_DEFINITIONS "BUILD_MYCLASS_SET_PROPERTY") are now recognized. Thank you very much for that. But the properties set with set_target_properties(CMakeTestApp PROPERTIES COMPILE_DEFINITIONS "BUILD_MYCLASS_SET_TARGET_PROPERTIES") are not recognized (see screen shot).
Comment 9 Aleix Pol 2011-12-14 02:01:31 UTC
Git commit 0203df5150c760f446dcb51291251615bfb4f155 by Aleix Pol.
Committed on 14/12/2011 at 03:00.
Pushed by apol into branch 'master'.

Add support for properties appending in set_property.

BUG: 275648

M  +8    -2    projectmanagers/cmake/parser/cmakeprojectvisitor.cpp

http://commits.kde.org/kdevelop/0203df5150c760f446dcb51291251615bfb4f155
Comment 10 Benjamin Eikel 2011-12-14 12:37:42 UTC
The test project works perfectly now. Thank you very much.