Paul
Paul

Reputation: 2564

Cmake Custom Target not selected for configuration

I have cmake a custom command and custom target which runs doxygen to generate documentation from the header files.

However Visual Studio doesn't build this target when the build is started from command line. It says "Project not selected to build for this solution configuration". Is there a way make sure this target is selected for the release (or debug) configuration in Visual Studio?

Upvotes: 2

Views: 1127

Answers (1)

Mark
Mark

Reputation: 1053

You probably want the add_dependencies command.

After you have defined they doxygen target and an executable or library target, write something like

add_dependencies( my_executable my_custom_doxygen_target )

This will force the doxygen target to be built every time your executable is.

It may also be possible to make it work by turning off the EXCLUDE_FROM_ALL property on your doxygen target. I expected to see EXCLUDE_FROM_ALL mentioned in the description of add_custom_target, but didn't - so it might be different than I remember.

Upvotes: 1

Related Questions