Qt World Summit: Register Today!

QT Creator and CMAKE

  • This might be the wrong forum for such a question but here goes anyway ;

    Am I right in thinking QT Creator supports CMAKE and CMakeLists.txt files,
    by in the background launching Cmake with generator type CodeBlocks and then reading the generated project file for CodeBlocks.

    I have noticed that defines listed in the project section of this file are not applied to the files once listed in Qt Creator. The the fundamental issue is that the files listed in the CodeBlock project are not associated specifically with the a project rather just listed separately.

    Basically this behaviour is a bit dumb, and I cant believe this is what people put up with.

    Am I right or wrong on this !


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Moved to a more suitable sub-forum :)

    As for your question, yes Qt Creator supports for CMake.

    Before going any further, you have to give more details about what is happening to you:

    • Which version of both are you using ?
    • What is your development environment ?
    • How are getting this ? (e.g. after modifying the CMakeList.txt file)
    • Does the same happen if you call cmake directly on the command line ?

  • @Andy-Page
    I will reply to my own post.

    I was running on Linux using QT Creator 3.5.0
    And have just updated to CMake 3.5.2

    Yes I know Qt Creator and CMake work together.

    In my question I was more interested in how Qt Creator takes the CMakeLists.txt file and generates its own internal representation of the project.
    From a bit of digging around I am convinced it is using the "CodeBlocks" generator from CMake, and then parsing the CodeBlocks project file.

    The issue I talked about in the original post, where files are not assigned to a specific sub project and that sub project has specific #defines active, has been corrected when using CMake 3.5.2 .
    However if a file appears in two sub projects, perfectly possible I would maintain, then I am not sure how that would be handled.

    If you look at how Visual Studio would handle this situation, then all files are arranged under specific sub projects, and a file can appear into two sub projects.

    What I am driving at, is the QT Creator way of arranging files by directory and not by project is not that sensible.

  • Lifetime Qt Champion

    From a quick look at Qt Creator's code there's indeed a dedicated class for CodeBlocks project parsing (if interested the cmake plugin).

    That's a point you should print to the Qt Creator developers/maintainers. You can do that on the corresponding mailing list here.

Log in to reply