Skip to content

Commit f9f77cb

Browse files
committed
[doc]: Conditionally add ocaml_doc to ALL target
Add the ocaml_doc target to the default ALL build target, but only when LLVM_BUILD_DOCS is enabled. This addresses two issues: 1. It prevents the 'install' target from failing due to a missing ocamldoc output directory by ensuring docs are generated beforehand. 2. It avoids unnecessary build steps when documentation is not required (LLVM_BUILD_DOCS is OFF), saving build time.
1 parent 0ebcc97 commit f9f77cb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

llvm/docs/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,12 @@ if( NOT uses_ocaml LESS 0 AND LLVM_ENABLE_OCAMLDOC )
136136
list(APPEND odoc_files -load ${odoc_file})
137137
endforeach()
138138

139-
add_custom_target(ocaml_doc
139+
set(OCAML_DOC_ADD_TO_ALL "")
140+
if(LLVM_BUILD_DOCS)
141+
set(OCAML_DOC_ADD_TO_ALL ALL)
142+
endif()
143+
144+
add_custom_target(ocaml_doc ${OCAML_DOC_ADD_TO_ALL}
140145
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/ocamldoc/html
141146
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/ocamldoc/html
142147
COMMAND ${OCAMLFIND} ocamldoc -d ${CMAKE_CURRENT_BINARY_DIR}/ocamldoc/html

0 commit comments

Comments
 (0)