Nominate our 2022 Qt Champions!

Qt Creator and CMake targets

  • Hi,
    CMake creates project with 20 targets. I see those targets in "Build settings". I can manualy add new Build Step and selecting those targets.
    QtCreator without targets in Kit selector

    • But WHY aren't those targets visible in "Build and Run kit selector"? In other project I see possible targets there.
    • How - from CMake level - define Build steps? I don't want to define each time when I need to regenerate or create new project.

  • @SebastianM Not quite sure what you actually want here.

    Cmake has those as internal targets really. All you should need to do to build your project is just run build. It will determine what has changed and build appropriately.

    If you want to say run the make install part or something you could do that from a command line easily enough. I don't really use Qt Creator but I'm sure there's a way to add specific targets in there as well.

    If you are talking about building sub projects and stuff, cmake will handle that as well depending on how you lay out your directory structure and set up your cmakelists.txt files.

    If you were a little more specific of what you actually want to do I might be able to help. I'm very good with cmake but not good with Qt Creator as I don't use it. So if it's Qt Creator specific I'll let someone else handle this. ;)

  • Hi,
    I would like to be able to select which target to build from GUI. In few other projects when I click on this icon beside list of Build types (Debug, release) I also see target list with all defined in CMake executables and libraries.
    In above example Qt Creator sees plenty of executables and libraries targets (visible in Build steps). But don't display them in 'Build and Run kit selector'.
    So to run/build specific target I need to use command line or each time modify project build steps with selecting other targets.

    In above example I need to build 3 targets in order and then my work is focused only in last of those targets. Each time I made modification I would like to run only this target. In other project I could simply change this from 'Build and Run kit selector' (like change from build/run app to build/run app UT).
    Yes, I can do it by modifying Build steps manually. But I would like to know WHY targets aren't visible. Reading and understanding Qt Creator code is really challenging.

    PS. I noticed something peculiar - in my other project in Run list I see only Executable cmake projects. Previously I saw also library targets (Qt Creator 4.2). So perhaps 4.2.1 version introduced this change. In above project only one is defined as Executable - all other are custom targets or libraries.

  • @SebastianM Ah yea you'll have to wait for someone else to help then. I don't use Qt Creator so I can't really help with build targets there.

    You could always run your builds manually on the command line. I do that most of the time I'm working anyway since I always have a terminal open.

    But if you want Creator integration that's out of my league, I've barely ever launched it and have been writing Qt code for like 14 years or so.

Log in to reply