# doxygen\_add\_docs install output directory

**URL:** <https://discourse.cmake.org/t/doxygen-add-docs-install-output-directory/2904>\
**Category:** Code\
**Created:** [March 6, 2021, 12:11pm UTC](https://discourse.cmake.org/t/doxygen-add-docs-install-output-directory/2904 "2021-03-06T12:11:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wirtos](https://discourse.cmake.org/user_avatar/discourse.cmake.org/wirtos/32/1081_2.png) [@Wirtos](https://discourse.cmake.org/u/Wirtos)\
**Post date:** [March 6, 2021, 12:11pm UTC](https://discourse.cmake.org/t/doxygen-add-docs-install-output-directory/2904/1 "2021-03-06T12:11:48Z")

</div>

I’m trying to install generated doxygen directory like this:

```auto
    set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/doxy")
    doxygen_add_docs(
    			mylib_docs
    			include
    			COMMENT "Generate docs"
    	)
    add_custom_command(OUTPUT "${DOXYGEN_OUTPUT_DIRECTORY}" DEPENDS mylib_docs)
    install(DIRECTORY "${DOXYGEN_OUTPUT_DIRECTORY}" TYPE DOC)

```

But for some reason when installing it complains about directory not existing, shouldn’t it be marked generated? CMake project version 3.10, tried both on linux and windows with different generators. Is there any way to get this behavior without adding a dummy custom target?

---

<div class="post-metadata">

**Author:** ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)\
**Post date:** [March 6, 2021, 8:37pm UTC](https://discourse.cmake.org/t/doxygen-add-docs-install-output-directory/2904/2 "2021-03-06T20:37:11Z")

</div>

If you are installing the docs, you probably want the docs to be part of the default “all” build target. You can do that by adding the `ALL` keyword to your `doxygen_add_docs()` call. Without this, doxygen won’t be run unless you explicitly build the `mylib_docs` target.

Your call to `add_custom_command()` won’t work for a couple of reasons. Firstly, it doesn’t create any target, so there’s nothing in the build system to attach the dependency to. Secondly, you’ve specified a directory as an output, but only files can be specified as outputs with `add_custom_command(OUTPUT...)`.

---

<div class="post-metadata">

**Author:** ![Wirtos](https://discourse.cmake.org/user_avatar/discourse.cmake.org/wirtos/32/1081_2.png) [@Wirtos](https://discourse.cmake.org/u/Wirtos)\
**Post date:** [March 7, 2021, 10:33am UTC](https://discourse.cmake.org/t/doxygen-add-docs-install-output-directory/2904/3 "2021-03-07T10:33:33Z")

</div>

Thanks! It seems like add\_doc’s ALL option was added in 3.12, so I’ll probably stick with proxy custom ALL target that depends on add\_docs target for now. My initial idea was that custom command would mark directory as GENERATED, so install DIRECTORY would invoke command that depends on target when installing, seemed like a clever idea, but well.
