When building with doc USE flag enabled, the doc target is not built by default and the missing docs cause an install failure. This patch ensures that when the doc target is defined, it will be built. Otherwise it might be possible to fix it using a separate step in src_compile to build the documentation specifically, prior to running install. This has been tested and is required on 4.0.2 and 5.2.0, but is not needed in >=openvdb-6 To reproduce the bug, enable the doc USE flag and emerge openvdb 4 or 5 without this patch. The install fails as the doc file is missing. To show it is fixed. enable the doc USE flag and this patch and emerge again. The install succeeds and the documentation can be found at /usr/share/doc/openvdb-X Patch by Adrian Grigo diff -Naur a/openvdb/CMakeLists.txt b/openvdb/CMakeLists.txt --- a/openvdb/CMakeLists.txt 2020-08-18 12:17:15.261321103 +1000 +++ b/openvdb/CMakeLists.txt 2020-08-18 12:17:37.101397373 +1000 @@ -394,7 +394,7 @@ FILE ( WRITE ${CMAKE_CURRENT_BINARY_DIR}/cmake-doxygen-config ${DOXYGEN_CONFIG_CONTENT} ) FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/cmake-doxygen-config "OUTPUT_DIRECTORY=${CMAKE_CURRENT_BINARY_DIR}/doc\n" ) - ADD_CUSTOM_TARGET ( doc + ADD_CUSTOM_TARGET ( doc ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/cmake-doxygen-config WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMENT "Generating API documentation with Doxygen" VERBATIM