I just included doxygen generation in my project using the add_custom_target() command. Now I did not include ALL as I don't want this build be default.
Now I have the following scenario.
project/subproj1/doc project/subproj2/doc
In each subproject there is a CMakeLists.txt file with:
add_custom_target(gen_doc_subproj1 ...)
add_custom_target(gen_doc_subproj2 ...)
What I'd like to achieve is that after generating my make files I can type:
make doc and it will build all documentation targets.
Is there some construction in CMake such as:
if_not_exist_target_group(doc)
create_target_group(doc)
endif
add_to_target_group(gen_doc_subproj1, doc)
Any pointers would be appriciated.
Use the add_custom_command() command to generate a file with dependencies. By default nothing depends on the custom target. Use the add_dependencies() command to add dependencies to or from other targets.
Introduction. A CMake-based buildsystem is organized as a set of high-level logical targets. Each target corresponds to an executable or library, or is a custom target containing custom commands.
Add a subdirectory to the build. Adds a subdirectory to the build. The source_dir specifies the directory in which the source CMakeLists.
If i understood you right, it is as simple as
if(NOT TARGET doc)
add_custom_target(doc)
add_dependencies(doc gen_doc_subproj1 gen_doc_subproj2 ...)
endif()
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