Reputation: 1439
Is there a way to specify optional targets in CMake? I mean ones that are built only when one specifies them explicitly, for example by make <target>
, and are not built when you specify just make
? I know I can do this with add_custom_command(), but I need all the features that a normal build target has
Upvotes: 6
Views: 4310
Reputation: 1381
There is no need to use add_custom_target. You can simply specify EXCLUDE_FROM_ALL, when specifying the build rule for an executable via add_executable. The same applies to add_library.
Upvotes: 11