Qt World Summit: Register Today!

Can qt creator parse compiler commands to reslove includes (-Idir) or defines (-Dmacro) for Makefile based project?

  • Hello,
    the title describes whole my question. I'm trying to switch from Eclipse to qtcreator and I need to use the IDE for many Makefile projects.
    Is there any way to force qt creator to parse compiler commands and use the result to index the project?

    I'm aware about project.includes file, but it is not elegant solution for me...


  • Well I think that qt creator just launches make and doesn't care about the gory details. Thus, it cannot access the build flags (which might vary from one source file to another anyway).
    You would need to expose them by the makefile somehow, e.g. I have a script for coreboot (a free software boot loader) which generates the DISTFILES, HEADERS and SOURCES sections for the configuration which is actually built. This isn't difficult because coreboot already has a facility in the makefile for generating list of files used during build (via compiler-generated dependency files as far as I remember).

    For the defines, there are special compiler switches which print list of built-in and user-provided defines, e.g. for GCC this would be gcc -dM -E. In case of a KConfig project like coreboot, the .config file is a good start too.

    For the include directories, I am still searching.

Log in to reply