Skip to content

Commit 80186e4

Browse files
committed
[CMake][TableGen] Simplify code by using list(TRANSFORM)
LLVM requires CMake 3.13.4 so now we can simplify the code. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D87193
1 parent b3205e2 commit 80186e4

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

llvm/cmake/modules/TableGen.cmake

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,6 @@ function(tablegen project ofn)
8080
set(tblgen_change_flag "--write-if-changed")
8181
endif()
8282

83-
# With CMake 3.12 this can be reduced to:
84-
# get_directory_property(tblgen_includes "INCLUDE_DIRECTORIES")
85-
# list(TRANSFORM tblgen_includes PREPEND -I)
86-
set(tblgen_includes)
87-
get_directory_property(includes "INCLUDE_DIRECTORIES")
88-
foreach(include ${includes})
89-
list(APPEND tblgen_includes -I ${include})
90-
endforeach()
9183
# We need both _TABLEGEN_TARGET and _TABLEGEN_EXE in the DEPENDS list
9284
# (both the target and the file) to have .inc files rebuilt on
9385
# a tablegen change, as cmake does not propagate file-level dependencies
@@ -97,6 +89,9 @@ function(tablegen project ofn)
9789
# dependency twice in the result file when
9890
# ("${${project}_TABLEGEN_TARGET}" STREQUAL "${${project}_TABLEGEN_EXE}")
9991
# but lets us having smaller and cleaner code here.
92+
get_directory_property(tblgen_includes INCLUDE_DIRECTORIES)
93+
list(TRANSFORM tblgen_includes PREPEND -I)
94+
10095
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
10196
COMMAND ${${project}_TABLEGEN_EXE} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR}
10297
${tblgen_includes}

0 commit comments

Comments
 (0)