[llvm] 80186e4 - [CMake][TableGen] Simplify code by using list(TRANSFORM)
    Raul Tambre via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Sep  7 00:53:31 PDT 2020
    
    
  
Author: Raul Tambre
Date: 2020-09-07T10:53:20+03:00
New Revision: 80186e4efc92aaa0c279846a438950c7bbe1e022
URL: https://github.com/llvm/llvm-project/commit/80186e4efc92aaa0c279846a438950c7bbe1e022
DIFF: https://github.com/llvm/llvm-project/commit/80186e4efc92aaa0c279846a438950c7bbe1e022.diff
LOG: [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
Added: 
    
Modified: 
    llvm/cmake/modules/TableGen.cmake
Removed: 
    
################################################################################
diff  --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake
index 73c1e96d3d9a..d58ee1de043f 100644
--- a/llvm/cmake/modules/TableGen.cmake
+++ b/llvm/cmake/modules/TableGen.cmake
@@ -80,14 +80,6 @@ function(tablegen project ofn)
     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 @@ function(tablegen project ofn)
   # 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}
        
    
    
More information about the llvm-commits
mailing list