[PATCH] D126717: [pseudo] Add PSEUDO_GEN cmake cache variable to avoid nested CMake invocation

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 31 12:10:33 PDT 2022


sammccall created this revision.
sammccall added a reviewer: mstorsjo.
Herald added a subscriber: mgorny.
Herald added a project: All.
sammccall requested review of this revision.
Herald added subscribers: cfe-commits, alextsao1999.
Herald added a project: clang-tools-extra.

Similar to LLVM_TABLEGEN, CLANG_TABLEGEN variables


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126717

Files:
  clang-tools-extra/pseudo/include/CMakeLists.txt


Index: clang-tools-extra/pseudo/include/CMakeLists.txt
===================================================================
--- clang-tools-extra/pseudo/include/CMakeLists.txt
+++ clang-tools-extra/pseudo/include/CMakeLists.txt
@@ -1,7 +1,13 @@
 # The cxx.bnf grammar file
 set(cxx_bnf ${CMAKE_CURRENT_SOURCE_DIR}/../lib/cxx.bnf)
 
-if(LLVM_USE_HOST_TOOLS)
+set(PSEUDO_GEN "pseudo-gen" CACHE
+  STRING "Host pseudo-gen executable. Saves building one if cross-compiling.")
+
+if(NOT PSEUDO_GEN STREQUAL "pseudo-gen")
+  set(pseudo_gen ${PSEUDO_GEN})
+  set(pseudo_gen_target ${PSEUDO_GEN})
+elseif(LLVM_USE_HOST_TOOLS)
   build_native_tool(pseudo-gen pseudo_gen)
   set(pseudo_gen_target "${pseudo_gen}")
 else()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126717.433164.patch
Type: text/x-patch
Size: 711 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220531/4dbcdbfd/attachment.bin>


More information about the cfe-commits mailing list