0

I am using CMake to generate Makefile.

Suppose I have the target MyTarget1,MyTarget2,...,MyTarget100

Now I only want obtain some specific targets, they are MyTarget1, MyTarget2, MyTarget3, MyTarget4.

I do not know how to do that.

I want something like

make MyTarget1,MyTarget2,MyTarget3,MyTarget4

or something like

cmake --build . --target MyTarget1,MyTarget2,MyTarget3,MyTarget4

I know that call the make or cmake many times must work. But I do not like the idea, because compile each target one by one leads to a lower parallism.

Thanks for your time.

Reference

Follow topic disscuss only obtain one target. I want many specific target.

cmake project build only one specific executable (and its dependencies)

Xu Hui
  • 1,213
  • 1
  • 11
  • 24

1 Answers1

1

Your syntax is very close; just use spaces to separate the target names instead of commas:

cmake --build . --target MyTarget1 MyTarget2 MyTarget3 MyTarget4

Please see the cmake command line documentation.

Kevin
  • 16,549
  • 8
  • 60
  • 74