[PATCH] D87193: [CMake][TableGen] Simplify code by using list(TRANSFORM)

Raul Tambre via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 5 08:24:29 PDT 2020


tambre created this revision.
tambre added reviewers: phosek, compnerd.
Herald added subscribers: llvm-commits, mgorny.
Herald added a project: LLVM.
tambre requested review of this revision.

LLVM requires CMake 3.13.4 so now we can simplify the code.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87193

Files:
  llvm/cmake/modules/TableGen.cmake


Index: llvm/cmake/modules/TableGen.cmake
===================================================================
--- llvm/cmake/modules/TableGen.cmake
+++ llvm/cmake/modules/TableGen.cmake
@@ -80,14 +80,6 @@
     set(tblgen_change_flag "--write-if-changed")
   endif()
 
-  # With CMake 3.12 this can be reduced to:
-  # get_directory_property(tblgen_includes "INCLUDE_DIRECTORIES")
-  # list(TRANSFORM tblgen_includes PREPEND -I)
-  set(tblgen_includes)
-  get_directory_property(includes "INCLUDE_DIRECTORIES")
-  foreach(include ${includes})
-    list(APPEND tblgen_includes -I ${include})
-  endforeach()
   # We need both _TABLEGEN_TARGET and _TABLEGEN_EXE in the  DEPENDS list
   # (both the target and the file) to have .inc files rebuilt on
   # a tablegen change, as cmake does not propagate file-level dependencies
@@ -97,6 +89,9 @@
   # dependency twice in the result file when
   # ("${${project}_TABLEGEN_TARGET}" STREQUAL "${${project}_TABLEGEN_EXE}")
   # but lets us having smaller and cleaner code here.
+  get_directory_property(tblgen_includes INCLUDE_DIRECTORIES)
+  list(TRANSFORM tblgen_includes PREPEND -I)
+
   add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
     COMMAND ${${project}_TABLEGEN_EXE} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR}
     ${tblgen_includes}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87193.290093.patch
Type: text/x-patch
Size: 1295 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200905/d93b1d43/attachment.bin>


More information about the llvm-commits mailing list