[flang-commits] [flang] [flang][docs] Fix cmake warning when building documentation (PR #175597)
Tarun Prabhu via flang-commits
flang-commits at lists.llvm.org
Wed Jan 14 09:54:21 PST 2026
https://github.com/tarunprabhu updated https://github.com/llvm/llvm-project/pull/175597
>From c2336f60c61efc1e7572f3f5f7b1cafb6e9cac47 Mon Sep 17 00:00:00 2001
From: Tarun Prabhu <tarun at lanl.gov>
Date: Mon, 12 Jan 2026 11:00:11 -0700
Subject: [PATCH] [flang][docs] Fix cmake warning when building documentation
CMake issues the following warning when configuring with support for building
documentation enabled.
Exactly one of PRE_BUILD, PRE_LINK, or POST_BUILD must be given. Assuming
POST_BUILD to preserve backward compatibility.
The offending command add_custom_command call in flang/docs/CMakeLists.txt has
been fixed to ensure that this warning is not issued. The comment describing
the purpose of the command was expanded to provide a more detailed explanation
of the command's purpose.
---
flang/docs/CMakeLists.txt | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/flang/docs/CMakeLists.txt b/flang/docs/CMakeLists.txt
index b183d6add1059..09219b2bad811 100644
--- a/flang/docs/CMakeLists.txt
+++ b/flang/docs/CMakeLists.txt
@@ -129,11 +129,16 @@ if (LLVM_ENABLE_SPHINX)
"${FLANG_DOCS_HTML_DIR}/FlangCommandLineReference.rst"
DEPENDS flang-doc gen-FlangCommandLineReference.rst)
- # Run Python preprocessing ONLY for HTML build
- # This script prepends headers to FIRLangRef.md for proper formatting
- add_custom_command(TARGET copy-flang-src-docs-html
+ # ${CMAKE_CURRENT_BINARY_DIR}/Dialect/FIRLangRef.md is generated by
+ # mlir-tblgen. The script executed in the command below adds some text to
+ # this document providing a brief overview of its contents in order to
+ # make it a bit more user-friendly. The result is written to
+ # ${FLANG_DOCS_HTML_DIR}/FIRLangRef.md. The original file in
+ # ${CMAKE_CURRENT_BINARY_DIR}/Dialect is *not* modified.
+ add_custom_command(TARGET copy-flang-src-docs-html POST_BUILD
COMMAND "${Python3_EXECUTABLE}"
- ARGS "${FLANG_DOCS_HTML_DIR}/FIR/CreateFIRLangRef.py")
+ ARGS "${FLANG_DOCS_HTML_DIR}/FIR/CreateFIRLangRef.py"
+ BYPRODUCTS ${FLANG_DOCS_HTML_DIR}/FIRLangRef.md)
add_sphinx_target(html flang SOURCE_DIR "${FLANG_DOCS_HTML_DIR}")
add_dependencies(docs-flang-html copy-flang-src-docs-html)
More information about the flang-commits
mailing list