I use cmake to generate qtcreator's project files, For the run part I can have different targets, but the build parts, I can only select all, and could not build each targets separately. Is there anyway I can build only one targets with qtcreator's cmake projects?
Since QtCreator 4.0.0, on Projects pane, go to build steps -> Details and select your target. You can also use the "--target" command line option with cmake.
Update:
Since QtCreator 4.3.0 with CMake 3.7.2 or greater the list of targets is on the project view, so you can just right click and build.
With QtCreator 4.0+ it is is possible, see rboc's answer below.
Old answer
I believe this is currently essentially impossible. I say "essentially" because if you wanted to, you could make a custom build configuration for each target you want to create, manually specifying the target as an argument in the command for that configuration. Then, to build that target, simply select that configuration and build. This is an extremely hacky workaround, but unfortunately I think it's the only viable option at the moment. A better solution might be to create a separate project for each target.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With