[flang-commits] [flang] [flang][NFC] Create required Source dir for flang-doc. (PR #134000)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Tue Apr 1 15:51:30 PDT 2025


https://github.com/vzakhari created https://github.com/llvm/llvm-project/pull/134000

None

>From 028dc800ee8fed536c9c2ee4725d341b6c54a22f Mon Sep 17 00:00:00 2001
From: Slava Zakharin <szakharin at nvidia.com>
Date: Tue, 1 Apr 2025 15:49:29 -0700
Subject: [PATCH] [flang][NFC] Create required Source dir for flang-doc.

---
 flang/docs/CMakeLists.txt | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/flang/docs/CMakeLists.txt b/flang/docs/CMakeLists.txt
index 3e4883e881ffa..774fa4c745696 100644
--- a/flang/docs/CMakeLists.txt
+++ b/flang/docs/CMakeLists.txt
@@ -100,6 +100,15 @@ function (gen_rst_file_from_td output_file td_option source docs_target)
   list(APPEND LLVM_TABLEGEN_FLAGS "-I${CMAKE_CURRENT_SOURCE_DIR}/../../clang/include/clang/Driver/")
   clang_tablegen(Source/${output_file} ${td_option} SOURCE ${source} TARGET "gen-${output_file}")
   add_dependencies(${docs_target} "gen-${output_file}")
+
+  # clang_tablegen() does not create the output directory automatically,
+  # so we have to create it explicitly. Note that copy-flang-src-docs below
+  # does create the output directory, but it is not necessarily run
+  # before RST generation.
+  add_custom_target(create-flang-rst-output-dir
+    COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/Source
+  )
+  add_dependencies("gen-${output_file}" create-flang-rst-output-dir)
 endfunction()
 
 if (LLVM_ENABLE_SPHINX)



More information about the flang-commits mailing list