[CMake] QtCreator project generator

Campbell Barton ideasman42 at gmail.com
Tue Mar 1 10:45:57 EST 2011


On Tue, Mar 1, 2011 at 2:47 PM, Marcus D. Hanwell
<marcus.hanwell at kitware.com> wrote:
> On Tue, Mar 1, 2011 at 9:15 AM, John Drescher <drescherjm at gmail.com> wrote:
>> On Tue, Mar 1, 2011 at 6:45 AM, Campbell Barton <ideasman42 at gmail.com> wrote:
>>> QT-Creator which currently supports CMake by reading code::blocks project files.
>>>
>>> The problem with this is code::blocks project files don't write in
>>> #defines, so the IDE shows #ifdef's incorrecyly.
>>>
>>> For the short term I wrote a eclipse -> qtcreator project converter in
>>> python, which has a few hard coded values but could easily be made
>>> generic.
>>> http://www.pasteall.org/19595/python
>>>
>>> So I was wondering if CMake developers would accept a patch to add
>>> native generation of qtcreator project files?
>>>
>>> An alternative solutions could be to write defines into code::blocks
>>> files, or for qtcreator to read in eclipse files instead but qtcreator
>>> project files are quite simple to write so if this feature is
>>> acceptable I was thinking to try and write a patch.
>>
>> Recent versions of QtCreator use CMakeLists.txt directly? Is there
>> something missing in this functionality?
>>
> You can open a CMakeLists.txt as a project, this then uses the CMake
> plugin to create a build directory, use the CodeBlocks - Unix
> Makefiles generator and then add a CMakeLists.txt.user with some
> project settings. As stated, it lacks the #defines, although this is
> less pronounced in many of the projects I work on where configured
> headers are used.
>
> I am not a core CMake developer, but it seems to me that extending the
> CodeBlocks generator would be the right thing to do here (if that is
> feasible). I think Alexander Neundorf did a lot of this work,
> hopefully he will comment.
>
> Marcus

Looked into this further and there is really no problem with
code::blocks generator,
The way it works is it calls make directly, so there is no need for
the code::blocks file to contain defines.
<Build command="/usr/bin/make -f .....>

If you take a CMake generated code::blocks project and try edit the
settings there is no way you can add defines, which makes me think
that CMake adding them would be incorrect.

Before I discovered this I made a patch which adds the defines (which
code::blocks wont use).
http://www.graphicall.org/ftp/ideasman42/code_blocks.diff

All things considered I still think a QtCreator project generator is
the way to go.

-- 
- Campbell


More information about the CMake mailing list