[Mlir-commits] [mlir] dc1056a - Revert "[MLIR] Move from using target_link_libraries to LINK_LIBS for llvm libraries."

Stephen Neuendorffer llvmlistbot at llvm.org
Fri Feb 28 14:17:05 PST 2020


Author: Stephen Neuendorffer
Date: 2020-02-28T14:13:30-08:00
New Revision: dc1056a3f1f95635dfd2188f21c49ae2cb2d3a90

URL: https://github.com/llvm/llvm-project/commit/dc1056a3f1f95635dfd2188f21c49ae2cb2d3a90
DIFF: https://github.com/llvm/llvm-project/commit/dc1056a3f1f95635dfd2188f21c49ae2cb2d3a90.diff

LOG: Revert "[MLIR] Move from using target_link_libraries to LINK_LIBS for llvm libraries."

This reverts commit 2f265e35285127de376afc2243e3b5d0c5842cc2.

Added: 
    

Modified: 
    mlir/examples/toy/Ch6/CMakeLists.txt
    mlir/examples/toy/Ch7/CMakeLists.txt
    mlir/lib/Analysis/CMakeLists.txt
    mlir/lib/Conversion/AffineToStandard/CMakeLists.txt
    mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
    mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt
    mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt
    mlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt
    mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt
    mlir/lib/Conversion/LinalgToSPIRV/CMakeLists.txt
    mlir/lib/Conversion/LoopToStandard/CMakeLists.txt
    mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt
    mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt
    mlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt
    mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt
    mlir/lib/Conversion/VectorToLoops/CMakeLists.txt
    mlir/lib/Dialect/AffineOps/CMakeLists.txt
    mlir/lib/Dialect/CMakeLists.txt
    mlir/lib/Dialect/FxpMathOps/CMakeLists.txt
    mlir/lib/Dialect/GPU/CMakeLists.txt
    mlir/lib/Dialect/LLVMIR/CMakeLists.txt
    mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
    mlir/lib/Dialect/Linalg/EDSC/CMakeLists.txt
    mlir/lib/Dialect/Linalg/IR/CMakeLists.txt
    mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
    mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt
    mlir/lib/Dialect/LoopOps/CMakeLists.txt
    mlir/lib/Dialect/OpenMP/CMakeLists.txt
    mlir/lib/Dialect/QuantOps/CMakeLists.txt
    mlir/lib/Dialect/SDBM/CMakeLists.txt
    mlir/lib/Dialect/SPIRV/CMakeLists.txt
    mlir/lib/Dialect/SPIRV/Serialization/CMakeLists.txt
    mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt
    mlir/lib/Dialect/StandardOps/CMakeLists.txt
    mlir/lib/Dialect/VectorOps/CMakeLists.txt
    mlir/lib/EDSC/CMakeLists.txt
    mlir/lib/ExecutionEngine/CMakeLists.txt
    mlir/lib/IR/CMakeLists.txt
    mlir/lib/Parser/CMakeLists.txt
    mlir/lib/Pass/CMakeLists.txt
    mlir/lib/Quantizer/CMakeLists.txt
    mlir/lib/Support/CMakeLists.txt
    mlir/lib/TableGen/CMakeLists.txt
    mlir/lib/Target/CMakeLists.txt
    mlir/lib/Transforms/CMakeLists.txt
    mlir/lib/Transforms/Utils/CMakeLists.txt
    mlir/lib/Translation/CMakeLists.txt
    mlir/test/EDSC/CMakeLists.txt
    mlir/test/lib/Dialect/SPIRV/CMakeLists.txt
    mlir/test/lib/IR/CMakeLists.txt
    mlir/test/lib/Pass/CMakeLists.txt
    mlir/test/lib/TestDialect/CMakeLists.txt
    mlir/test/lib/Transforms/CMakeLists.txt
    mlir/test/mlir-cpu-runner/CMakeLists.txt
    mlir/tools/mlir-cuda-runner/CMakeLists.txt
    mlir/tools/mlir-opt/CMakeLists.txt
    mlir/unittests/Dialect/SPIRV/CMakeLists.txt
    mlir/unittests/Pass/CMakeLists.txt
    mlir/unittests/SDBM/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/mlir/examples/toy/Ch6/CMakeLists.txt b/mlir/examples/toy/Ch6/CMakeLists.txt
index d22ee0873b56..e46200d3f9ad 100644
--- a/mlir/examples/toy/Ch6/CMakeLists.txt
+++ b/mlir/examples/toy/Ch6/CMakeLists.txt
@@ -41,9 +41,4 @@ target_link_libraries(toyc-ch6
     MLIRPass
     MLIRTargetLLVMIR
     MLIRTransforms
-    LLVMOrcJIT
-    LLVMSupport
-    LLVMX86CodeGen
-    LLVMX86Desc
-    LLVMX86Info
     )

diff  --git a/mlir/examples/toy/Ch7/CMakeLists.txt b/mlir/examples/toy/Ch7/CMakeLists.txt
index 9f0790391366..7f67cc9519ec 100644
--- a/mlir/examples/toy/Ch7/CMakeLists.txt
+++ b/mlir/examples/toy/Ch7/CMakeLists.txt
@@ -38,12 +38,6 @@ target_link_libraries(toyc-ch7
     MLIRIR
     MLIRParser
     MLIRPass
-    MLIRSupport
     MLIRTargetLLVMIR
     MLIRTransforms
-    LLVMOrcJIT
-    LLVMSupport
-    LLVMX86CodeGen
-    LLVMX86Desc
-    LLVMX86Info
     )

diff  --git a/mlir/lib/Analysis/CMakeLists.txt b/mlir/lib/Analysis/CMakeLists.txt
index 23dcd0521e06..9eccde56e6ee 100644
--- a/mlir/lib/Analysis/CMakeLists.txt
+++ b/mlir/lib/Analysis/CMakeLists.txt
@@ -22,13 +22,6 @@ add_llvm_library(MLIRAnalysis
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Analysis
-
-  LINK_LIBS
-  MLIRAffineOps
-  MLIRIR
-  MLIRLoopOps
-  MLIRSupport
-  LLVMSupport
   )
 add_dependencies(MLIRAnalysis
   MLIRAffineOps
@@ -37,6 +30,8 @@ add_dependencies(MLIRAnalysis
   MLIRLoopOps
   )
 
+target_link_libraries(MLIRAnalysis MLIRAffineOps MLIRLoopOps)
+
 add_llvm_library(MLIRLoopAnalysis
   AffineAnalysis.cpp
   AffineStructures.cpp
@@ -46,14 +41,6 @@ add_llvm_library(MLIRLoopAnalysis
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Analysis
-
-  LINK_LIBS
-  MLIRAffineOps
-  MLIRIR
-  MLIRLoopOps
-  MLIRStandardOps
-  MLIRSupport
-  LLVMSupport
   )
 add_dependencies(MLIRLoopAnalysis
   MLIRAffineOps
@@ -61,3 +48,5 @@ add_dependencies(MLIRLoopAnalysis
   MLIRTypeInferOpInterfaceIncGen
   MLIRLoopOps
   )
+
+target_link_libraries(MLIRLoopAnalysis MLIRAffineOps MLIRLoopOps)

diff  --git a/mlir/lib/Conversion/AffineToStandard/CMakeLists.txt b/mlir/lib/Conversion/AffineToStandard/CMakeLists.txt
index 73ea74df5af3..9d639e034b66 100644
--- a/mlir/lib/Conversion/AffineToStandard/CMakeLists.txt
+++ b/mlir/lib/Conversion/AffineToStandard/CMakeLists.txt
@@ -3,22 +3,24 @@ add_mlir_conversion_library(MLIRAffineToStandard
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/AffineToStandard
+)
+add_dependencies(
+  MLIRAffineToStandard
 
-  LINK_LIBS
   MLIRAffineOps
-  MLIRLoopOps
-  MLIRPass
   MLIRStandardOps
-  MLIRTransforms
   MLIRIR
   LLVMCore
   LLVMSupport
-  )
-add_dependencies(
+)
+target_link_libraries(
   MLIRAffineToStandard
 
   MLIRAffineOps
+  MLIRLoopOps
+  MLIRPass
   MLIRStandardOps
+  MLIRTransforms
   MLIRIR
   LLVMCore
   LLVMSupport

diff  --git a/mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt b/mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
index 4c682b471015..65c976ce9a38 100644
--- a/mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
+++ b/mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
@@ -10,15 +10,11 @@ if (MLIR_CUDA_CONVERSIONS_ENABLED)
  list(APPEND SOURCES "ConvertKernelFuncToCubin.cpp")
 endif()
 
-add_mlir_conversion_library(MLIRGPUtoCUDATransforms
-  ${SOURCES}
-  LINK_LIBS
-  LLVMNVPTXCodeGen
-  LLVMNVPTXDesc
-  LLVMNVPTXInfo
+add_mlir_conversion_library(MLIRGPUtoCUDATransforms ${SOURCES})
+target_link_libraries(MLIRGPUtoCUDATransforms
   MLIRGPU
   MLIRLLVMIR
   MLIRNVVMIR
   MLIRPass
   MLIRTargetNVVMIR
-  )
+)

diff  --git a/mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt b/mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt
index 146c8a115cfe..339b2b79a439 100644
--- a/mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt
+++ b/mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt
@@ -4,21 +4,17 @@ add_public_tablegen_target(MLIRGPUToNVVMIncGen)
 
 add_mlir_conversion_library(MLIRGPUtoNVVMTransforms
   LowerGpuOpsToNVVMOps.cpp
+  )
+
+add_dependencies(MLIRGPUtoNVVMTransforms
+  MLIRGPUToNVVMIncGen)
 
-  LINK_LIBS
-  LLVMCore
+target_link_libraries(MLIRGPUtoNVVMTransforms
   LLVMSupport
   MLIRGPU
-  MLIRIR
   MLIRLLVMIR
   MLIRNVVMIR
   MLIRPass
-  MLIRStandardOps
   MLIRStandardToLLVM
-  MLIRSupport
-  MLIRTransforms
   MLIRTransformUtils
   )
-
-add_dependencies(MLIRGPUtoNVVMTransforms
-  MLIRGPUToNVVMIncGen)

diff  --git a/mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt b/mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt
index ea3a3406608f..778689859a84 100644
--- a/mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt
+++ b/mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt
@@ -1,16 +1,11 @@
 add_mlir_conversion_library(MLIRGPUtoROCDLTransforms
   LowerGpuOpsToROCDLOps.cpp
-
-  LINK_LIBS
-  LLVMCore
+  )
+target_link_libraries(MLIRGPUtoROCDLTransforms
   LLVMSupport
   MLIRGPU
-  MLIRIR
   MLIRLLVMIR
   MLIRROCDLIR
   MLIRPass
   MLIRStandardToLLVM
-  MLIRStandardOps
-  MLIRTransforms
-  MLIRTransformUtils
   )

diff  --git a/mlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt b/mlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt
index 36f8ad2afe2e..e59c48e4a614 100644
--- a/mlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt
+++ b/mlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt
@@ -5,19 +5,18 @@ add_public_tablegen_target(MLIRGPUToSPIRVIncGen)
 add_mlir_conversion_library(MLIRGPUtoSPIRVTransforms
   ConvertGPUToSPIRV.cpp
   ConvertGPUToSPIRVPass.cpp
+  )
+
+add_dependencies(MLIRGPUtoSPIRVTransforms
+  MLIRGPUToSPIRVIncGen)
 
-  LINK_LIBS
+target_link_libraries(MLIRGPUtoSPIRVTransforms
   MLIRGPU
   MLIRIR
-  MLIRLoopOps
   MLIRPass
   MLIRSPIRV
   MLIRStandardOps
   MLIRStandardToSPIRVTransforms
   MLIRSupport
   MLIRTransforms
-  LLVMSupport
   )
-
-add_dependencies(MLIRGPUtoSPIRVTransforms
-  MLIRGPUToSPIRVIncGen)

diff  --git a/mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt b/mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt
index 2280d83dd382..c63411796465 100644
--- a/mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt
+++ b/mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt
@@ -3,19 +3,20 @@ add_mlir_conversion_library(MLIRLinalgToLLVM
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/LinalgToLLVM
-
-  LINK_LIBS
+)
+set(LIBS
   MLIRAffineToStandard
   MLIREDSC
   MLIRIR
   MLIRLinalgOps
   MLIRLLVMIR
   MLIRLoopToStandard
-  MLIRPass
-  MLIRStandardOps
   MLIRStandardToLLVM
   MLIRVectorToLLVM
   MLIRTransforms
   LLVMCore
   LLVMSupport
   )
+
+add_dependencies(MLIRLinalgToLLVM ${LIBS})
+target_link_libraries(MLIRLinalgToLLVM ${LIBS})

diff  --git a/mlir/lib/Conversion/LinalgToSPIRV/CMakeLists.txt b/mlir/lib/Conversion/LinalgToSPIRV/CMakeLists.txt
index 1b5236ee5919..5f00034abae9 100644
--- a/mlir/lib/Conversion/LinalgToSPIRV/CMakeLists.txt
+++ b/mlir/lib/Conversion/LinalgToSPIRV/CMakeLists.txt
@@ -5,15 +5,13 @@ add_mlir_conversion_library(MLIRLinalgToSPIRVTransforms
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/IR
+  )
 
-  LINK_LIBS
+target_link_libraries(MLIRLinalgToSPIRVTransforms
   MLIRIR
   MLIRLinalgOps
   MLIRLinalgUtils
   MLIRPass
   MLIRSPIRV
   MLIRSupport
-  MLIRTransforms
-  MLIRTransformUtils
-  LLVMSupport
   )

diff  --git a/mlir/lib/Conversion/LoopToStandard/CMakeLists.txt b/mlir/lib/Conversion/LoopToStandard/CMakeLists.txt
index db17dd82ad9b..4297346a10bf 100644
--- a/mlir/lib/Conversion/LoopToStandard/CMakeLists.txt
+++ b/mlir/lib/Conversion/LoopToStandard/CMakeLists.txt
@@ -3,17 +3,16 @@ add_mlir_conversion_library(MLIRLoopToStandard
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/LoopToStandard
+)
+add_dependencies(
+  MLIRLoopToStandard
 
-  LINK_LIBS
-  MLIRIR
   MLIRLoopOps
-  MLIRPass
-  MLIRStandardOps
   MLIRTransforms
   LLVMCore
   LLVMSupport
-  )
-add_dependencies(
+)
+target_link_libraries(
   MLIRLoopToStandard
 
   MLIRLoopOps

diff  --git a/mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt b/mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt
index 739c5b89b14b..c2f3c2a7f852 100644
--- a/mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt
+++ b/mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt
@@ -4,12 +4,10 @@ set(LIBS
   MLIRGPU
   MLIRIR
   MLIRLinalgOps
-  MLIRLoopOps
   MLIRPass
   MLIRStandardOps
   MLIRSupport
   MLIRTransforms
-  MLIRTransformUtils
   LLVMSupport
 )
 
@@ -19,8 +17,6 @@ add_mlir_conversion_library(MLIRLoopsToGPU
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/LoopsToGPU
-
-  LINK_LIBS
-  ${LIBS}
-  )
+)
 add_dependencies(MLIRLoopsToGPU ${LIBS})
+target_link_libraries(MLIRLoopsToGPU ${LIBS})

diff  --git a/mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt b/mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt
index 36f9d601ec80..3e8f72bb60c5 100644
--- a/mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt
+++ b/mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt
@@ -3,17 +3,16 @@ add_mlir_conversion_library(MLIRStandardToLLVM
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/StandardToLLVM
+)
+add_dependencies(
+  MLIRStandardToLLVM
 
-  LINK_LIBS
-  MLIRIR
   MLIRLLVMIR
-  MLIRPass
-  MLIRStandardOps
   MLIRTransforms
   LLVMCore
   LLVMSupport
-  )
-add_dependencies(
+)
+target_link_libraries(
   MLIRStandardToLLVM
 
   MLIRLLVMIR

diff  --git a/mlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt b/mlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt
index 6ba6c31606d9..f02f68db7bb1 100644
--- a/mlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt
+++ b/mlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt
@@ -10,18 +10,17 @@ add_mlir_conversion_library(MLIRStandardToSPIRVTransforms
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/IR
+  )
+
+add_dependencies(MLIRStandardToSPIRVTransforms
+  MLIRStandardToSPIRVIncGen)
 
-  LINK_LIBS
+target_link_libraries(MLIRStandardToSPIRVTransforms
   MLIRIR
   MLIRPass
   MLIRSPIRV
   MLIRSupport
-  MLIRTransforms
   MLIRTransformUtils
   MLIRSPIRV
   MLIRStandardOps
-  LLVMSupport
   )
-
-add_dependencies(MLIRStandardToSPIRVTransforms
-  MLIRStandardToSPIRVIncGen)

diff  --git a/mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt b/mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt
index bba43147caf6..5a89f399516c 100644
--- a/mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt
+++ b/mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt
@@ -3,16 +3,15 @@ add_mlir_conversion_library(MLIRVectorToLLVM
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/VectorToLLVM
-
-  LINK_LIBS
-  MLIRIR
+)
+set(LIBS
   MLIRLLVMIR
-  MLIRPass
-  MLIRStandardOps
   MLIRStandardToLLVM
   MLIRVectorOps
   MLIRTransforms
-  MLIRTransformUtils
   LLVMCore
   LLVMSupport
-)
+  )
+
+add_dependencies(MLIRVectorToLLVM ${LIBS})
+target_link_libraries(MLIRVectorToLLVM ${LIBS})

diff  --git a/mlir/lib/Conversion/VectorToLoops/CMakeLists.txt b/mlir/lib/Conversion/VectorToLoops/CMakeLists.txt
index 0d95365ae1e6..0dccea93b234 100644
--- a/mlir/lib/Conversion/VectorToLoops/CMakeLists.txt
+++ b/mlir/lib/Conversion/VectorToLoops/CMakeLists.txt
@@ -3,17 +3,14 @@ add_mlir_conversion_library(MLIRVectorToLoops
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/VectorToLoops
-
-  LINK_LIBS
-  MLIRAffineOps
+)
+set(LIBS
   MLIREDSC
-  MLIRIR
   MLIRLLVMIR
-  MLIRLoopOps
-  MLIRStandardOps
   MLIRTransforms
-  MLIRTransformUtils
-  MLIRVectorOps
   LLVMCore
   LLVMSupport
   )
+
+add_dependencies(MLIRVectorToLoops ${LIBS})
+target_link_libraries(MLIRVectorToLoops ${LIBS})

diff  --git a/mlir/lib/Dialect/AffineOps/CMakeLists.txt b/mlir/lib/Dialect/AffineOps/CMakeLists.txt
index 749e7e283f3c..1c1c95cf3f8f 100644
--- a/mlir/lib/Dialect/AffineOps/CMakeLists.txt
+++ b/mlir/lib/Dialect/AffineOps/CMakeLists.txt
@@ -5,18 +5,18 @@ add_mlir_dialect_library(MLIRAffineOps
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/AffineOps
+  )
+add_dependencies(MLIRAffineOps
 
-  LINK_LIBS
+  MLIRAffineOpsIncGen
   MLIREDSC
   MLIRIR
+  MLIRLoopLikeInterfaceIncGen
   MLIRStandardOps
-  LLVMSupport
   )
-add_dependencies(MLIRAffineOps
+target_link_libraries(MLIRAffineOps
 
-  MLIRAffineOpsIncGen
   MLIREDSC
   MLIRIR
-  MLIRLoopLikeInterfaceIncGen
   MLIRStandardOps
   )

diff  --git a/mlir/lib/Dialect/CMakeLists.txt b/mlir/lib/Dialect/CMakeLists.txt
index d9d91b9bb717..59186ed37964 100644
--- a/mlir/lib/Dialect/CMakeLists.txt
+++ b/mlir/lib/Dialect/CMakeLists.txt
@@ -22,8 +22,5 @@ add_llvm_library(MLIRDialect
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect
-
-  LINK_LIBS
-  MLIRIR
-  LLVMSupport
   )
+target_link_libraries(MLIRDialect MLIRIR)

diff  --git a/mlir/lib/Dialect/FxpMathOps/CMakeLists.txt b/mlir/lib/Dialect/FxpMathOps/CMakeLists.txt
index e631fc67b534..021cade6e091 100644
--- a/mlir/lib/Dialect/FxpMathOps/CMakeLists.txt
+++ b/mlir/lib/Dialect/FxpMathOps/CMakeLists.txt
@@ -4,16 +4,14 @@ add_mlir_dialect_library(MLIRFxpMathOps
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/FxpMathOps
+  )
 
-  LINK_LIBS
+target_link_libraries(MLIRFxpMathOps
   MLIRQuantOps
   MLIRIR
   MLIRPass
   MLIRSupport
   MLIRStandardOps
-  MLIRTransforms
-  MLIRTransformUtils
-  LLVMSupport
   )
 add_dependencies(MLIRFxpMathOps
                  MLIRFxpMathOpsIncGen

diff  --git a/mlir/lib/Dialect/GPU/CMakeLists.txt b/mlir/lib/Dialect/GPU/CMakeLists.txt
index 595f8b737ac9..41884a9ddb66 100644
--- a/mlir/lib/Dialect/GPU/CMakeLists.txt
+++ b/mlir/lib/Dialect/GPU/CMakeLists.txt
@@ -7,24 +7,23 @@ add_mlir_dialect_library(MLIRGPU
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/GPU
-
-  LINK_LIBS
+)
+add_dependencies(MLIRGPU
+  MLIRGPUOpsIncGen
   MLIREDSC
   MLIRIR
   MLIRLLVMIR
   MLIRLoopOps
-  MLIRPass
-  MLIRStandardOps
   MLIRSupport
   MLIRTransformUtils
-  LLVMSupport
-  )
-add_dependencies(MLIRGPU
-  MLIRGPUOpsIncGen
+  LLVMSupport)
+target_link_libraries(MLIRGPU
   MLIREDSC
   MLIRIR
   MLIRLLVMIR
   MLIRLoopOps
+  MLIRPass
+  MLIRStandardOps
   MLIRSupport
   MLIRTransformUtils
   LLVMSupport)

diff  --git a/mlir/lib/Dialect/LLVMIR/CMakeLists.txt b/mlir/lib/Dialect/LLVMIR/CMakeLists.txt
index eb32510c722a..b0c4eb241381 100644
--- a/mlir/lib/Dialect/LLVMIR/CMakeLists.txt
+++ b/mlir/lib/Dialect/LLVMIR/CMakeLists.txt
@@ -3,42 +3,24 @@ add_mlir_dialect_library(MLIRLLVMIR
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/LLVMIR
-
-  LINK_LIBS
-  LLVMAsmParser
-  LLVMCore
-  LLVMSupport
-  MLIRIR
-  MLIRSupport
   )
 add_dependencies(MLIRLLVMIR MLIRLLVMOpsIncGen MLIRLLVMConversionsIncGen LLVMAsmParser LLVMCore LLVMSupport)
+target_link_libraries(MLIRLLVMIR LLVMAsmParser LLVMCore LLVMSupport MLIRIR)
 
 add_mlir_dialect_library(MLIRNVVMIR
   IR/NVVMDialect.cpp
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/LLVMIR
-
-  LINK_LIBS
-  LLVMAsmParser
-  MLIRIR
-  MLIRLLVMIR
-  LLVMSupport
-  LLVMCore
   )
 add_dependencies(MLIRNVVMIR MLIRNVVMOpsIncGen MLIRNVVMConversionsIncGen LLVMAsmParser LLVMCore LLVMSupport)
-
+target_link_libraries(MLIRNVVMIR LLVMAsmParser MLIRIR MLIRLLVMIR LLVMSupport LLVMCore)
 
 add_mlir_dialect_library(MLIRROCDLIR
   IR/ROCDLDialect.cpp
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/LLVMIR
-
-  LINK_LIBS
-  LLVMAsmParser
-  LLVMCore
-  LLVMSupport
-  MLIRIR
   )
 add_dependencies(MLIRROCDLIR MLIRROCDLOpsIncGen MLIRROCDLConversionsIncGen LLVMAsmParser LLVMCore LLVMSupport)
+target_link_libraries(MLIRROCDLIR LLVMAsmParser LLVMCore LLVMSupport MLIRIR)

diff  --git a/mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt b/mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
index 629e071e7b57..96698a9ef5e8 100644
--- a/mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
@@ -1,8 +1,7 @@
 set(LIBS
-  MLIRIR
+
   MLIRLinalgOps
   MLIRStandardOps
-  LLVMSupport
   )
 
 
@@ -13,9 +12,7 @@ add_mlir_dialect_library(MLIRLinalgAnalysis
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Linalg
   DEPENDS
   intrinsics_gen
-
-  LINK_LIBS
-  ${LIBS}
   )
 
 add_dependencies(MLIRLinalgAnalysis ${LIBS})
+target_link_libraries(MLIRLinalgAnalysis ${LIBS})

diff  --git a/mlir/lib/Dialect/Linalg/EDSC/CMakeLists.txt b/mlir/lib/Dialect/Linalg/EDSC/CMakeLists.txt
index 6c0cc3cfe617..dc87d7fad224 100644
--- a/mlir/lib/Dialect/Linalg/EDSC/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/EDSC/CMakeLists.txt
@@ -6,7 +6,6 @@ set(LIBS
   MLIRLinalgOps
   MLIRLoopOps
   MLIRStandardOps
-  LLVMSupport
   )
 
 add_mlir_dialect_library(MLIRLinalgEDSC
@@ -16,9 +15,7 @@ add_mlir_dialect_library(MLIRLinalgEDSC
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Linalg
   DEPENDS
   intrinsics_gen
-
-  LINK_LIBS
-  ${LIBS}
   )
 
 add_dependencies(MLIRLinalgEDSC ${LIBS})
+target_link_libraries(MLIRLinalgEDSC ${LIBS})

diff  --git a/mlir/lib/Dialect/Linalg/IR/CMakeLists.txt b/mlir/lib/Dialect/Linalg/IR/CMakeLists.txt
index 3988daa66b8c..9dba1e52bdb7 100644
--- a/mlir/lib/Dialect/Linalg/IR/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/IR/CMakeLists.txt
@@ -1,8 +1,7 @@
 set(LIBS
+
   MLIRIR
   MLIRStandardOps
-  MLIRSupport
-  LLVMSupport
   )
 
 add_mlir_dialect_library(MLIRLinalgOps
@@ -13,12 +12,6 @@ add_mlir_dialect_library(MLIRLinalgOps
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Linalg
   DEPENDS
   intrinsics_gen
-
-  LINK_LIBS
-  MLIRIR
-  MLIRStandardOps
-  MLIRSupport
-  LLVMSupport
   )
 
 add_dependencies(MLIRLinalgOps
@@ -28,3 +21,4 @@ add_dependencies(MLIRLinalgOps
   MLIRLinalgStructuredOpsIncGen
   MLIRLinalgStructuredOpsInterfaceIncGen
   )
+target_link_libraries(MLIRLinalgOps ${LIBS})

diff  --git a/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt b/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
index 5c1df0451c10..763ef558e47c 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
@@ -14,7 +14,6 @@ set(LIBS
   MLIRStandardToLLVM
   MLIRTransformUtils
   MLIRVectorOps
-  LLVMSupport
   )
 
 add_mlir_dialect_library(MLIRLinalgTransforms
@@ -28,9 +27,6 @@ add_mlir_dialect_library(MLIRLinalgTransforms
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Linalg
   DEPENDS
   intrinsics_gen
-
-  LINK_LIBS
-  ${LIBS}
   )
 
 add_dependencies(MLIRLinalgTransforms
@@ -38,3 +34,4 @@ add_dependencies(MLIRLinalgTransforms
   ${LIBS}
   MLIRLinalgTransformPatternsIncGen
   )
+target_link_libraries(MLIRLinalgTransforms ${LIBS})

diff  --git a/mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt b/mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt
index 2bf36d0a3236..76581e226d37 100644
--- a/mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt
@@ -1,5 +1,5 @@
 set(LIBS
-  MLIRAffineOps
+
   MLIREDSC
   MLIRIR
   MLIRLinalgOps
@@ -7,7 +7,6 @@ set(LIBS
   MLIRPass
   MLIRStandardOps
   MLIRTransformUtils
-  LLVMSupport
   )
 
 add_mlir_dialect_library(MLIRLinalgUtils
@@ -18,8 +17,7 @@ add_mlir_dialect_library(MLIRLinalgUtils
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Linalg
   DEPENDS
   intrinsics_gen
-
-  LINK_LIBS
-  ${LIBS})
+  )
 
 add_dependencies(MLIRLinalgUtils ${LIBS})
+target_link_libraries(MLIRLinalgUtils ${LIBS})

diff  --git a/mlir/lib/Dialect/LoopOps/CMakeLists.txt b/mlir/lib/Dialect/LoopOps/CMakeLists.txt
index e228654ced25..98367d1c2268 100644
--- a/mlir/lib/Dialect/LoopOps/CMakeLists.txt
+++ b/mlir/lib/Dialect/LoopOps/CMakeLists.txt
@@ -5,18 +5,19 @@ add_mlir_dialect_library(MLIRLoopOps
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/LoopOps
+  )
+add_dependencies(MLIRLoopOps
 
-  LINK_LIBS
   MLIREDSC
-  MLIRIR
+  MLIRLoopLikeInterfaceIncGen
+  MLIRLoopOpsIncGen
   MLIRStandardOps
   LLVMSupport
   )
-add_dependencies(MLIRLoopOps
+target_link_libraries(MLIRLoopOps
 
   MLIREDSC
-  MLIRLoopLikeInterfaceIncGen
-  MLIRLoopOpsIncGen
+  MLIRIR
   MLIRStandardOps
   LLVMSupport
   )

diff  --git a/mlir/lib/Dialect/OpenMP/CMakeLists.txt b/mlir/lib/Dialect/OpenMP/CMakeLists.txt
index 8e00e473af20..bf55088a7cb0 100644
--- a/mlir/lib/Dialect/OpenMP/CMakeLists.txt
+++ b/mlir/lib/Dialect/OpenMP/CMakeLists.txt
@@ -3,11 +3,7 @@ add_mlir_dialect_library(MLIROpenMP
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/OpenMP
-
-  LINK_LIBS
-  MLIRIR
-  LLVMCore
-  LLVMSupport
   )
 
 add_dependencies(MLIROpenMP MLIROpenMPOpsIncGen)
+target_link_libraries(MLIROpenMP MLIRIR)

diff  --git a/mlir/lib/Dialect/QuantOps/CMakeLists.txt b/mlir/lib/Dialect/QuantOps/CMakeLists.txt
index 14acb913ec85..12cb44fd42db 100644
--- a/mlir/lib/Dialect/QuantOps/CMakeLists.txt
+++ b/mlir/lib/Dialect/QuantOps/CMakeLists.txt
@@ -11,14 +11,6 @@ add_mlir_dialect_library(MLIRQuantOps
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/QuantOps
-
-  LINK_LIBS
-  MLIRIR
-  MLIRPass
-  MLIRSupport
-  MLIRStandardOps
-  MLIRTransformUtils
-  LLVMSupport
   )
 add_dependencies(MLIRQuantOps
                  MLIRIR
@@ -26,3 +18,11 @@ add_dependencies(MLIRQuantOps
                  MLIRQuantOpsIncGen
                  MLIRSupport
                  MLIRStandardOps)
+
+target_link_libraries(MLIRQuantOps
+  MLIRIR
+  MLIRPass
+  MLIRSupport
+  MLIRStandardOps
+  MLIRTransformUtils
+  )

diff  --git a/mlir/lib/Dialect/SDBM/CMakeLists.txt b/mlir/lib/Dialect/SDBM/CMakeLists.txt
index b75e257daf77..648d9f268c2f 100644
--- a/mlir/lib/Dialect/SDBM/CMakeLists.txt
+++ b/mlir/lib/Dialect/SDBM/CMakeLists.txt
@@ -4,10 +4,6 @@ add_mlir_dialect_library(MLIRSDBM
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SDBM
-
-  LINK_LIBS
-  MLIRIR
-  MLIRSupport
-  LLVMSupport
-  )
+)
 add_dependencies(MLIRSDBM MLIRIR)
+target_link_libraries(MLIRSDBM MLIRIR)

diff  --git a/mlir/lib/Dialect/SPIRV/CMakeLists.txt b/mlir/lib/Dialect/SPIRV/CMakeLists.txt
index ba67e745b13e..ad1bb4df2b5b 100644
--- a/mlir/lib/Dialect/SPIRV/CMakeLists.txt
+++ b/mlir/lib/Dialect/SPIRV/CMakeLists.txt
@@ -13,14 +13,6 @@ add_mlir_dialect_library(MLIRSPIRV
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
-
-  LINK_LIBS
-  MLIRIR
-  MLIRParser
-  MLIRStandardOps
-  MLIRSupport
-  MLIRTransforms
-  LLVMSupport
   )
 
 add_dependencies(MLIRSPIRV
@@ -32,6 +24,11 @@ add_dependencies(MLIRSPIRV
   MLIRSPIRVOpUtilsGen
   MLIRSPIRVTargetAndABIIncGen)
 
+target_link_libraries(MLIRSPIRV
+  MLIRIR
+  MLIRParser
+  MLIRSupport
+  MLIRTransforms)
 
 add_subdirectory(Serialization)
 add_subdirectory(Transforms)

diff  --git a/mlir/lib/Dialect/SPIRV/Serialization/CMakeLists.txt b/mlir/lib/Dialect/SPIRV/Serialization/CMakeLists.txt
index 543e1b430ecb..3d9ea7939535 100644
--- a/mlir/lib/Dialect/SPIRV/Serialization/CMakeLists.txt
+++ b/mlir/lib/Dialect/SPIRV/Serialization/CMakeLists.txt
@@ -6,15 +6,13 @@ add_mlir_dialect_library(MLIRSPIRVSerialization
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
-
-  LINK_LIBS
-  MLIRIR
-  MLIRParser
-  MLIRSPIRV
-  MLIRSupport
-  MLIRTranslation
-  LLVMSupport
   )
 
 add_dependencies(MLIRSPIRVSerialization
   MLIRSPIRVSerializationGen)
+
+target_link_libraries(MLIRSPIRVSerialization
+  MLIRIR
+  MLIRSPIRV
+  MLIRSupport
+  MLIRTranslation)

diff  --git a/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt b/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt
index 30c2c42e960f..e9d6492c0b1c 100644
--- a/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt
@@ -4,13 +4,9 @@ add_mlir_dialect_library(MLIRSPIRVTransforms
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
+  )
 
-  LINK_LIBS
-  MLIRIR
+target_link_libraries(MLIRSPIRVTransforms
   MLIRPass
   MLIRSPIRV
-  MLIRStandardOps
-  MLIRTransforms
-  MLIRTransformUtils
-  LLVMSupport
   )

diff  --git a/mlir/lib/Dialect/StandardOps/CMakeLists.txt b/mlir/lib/Dialect/StandardOps/CMakeLists.txt
index e802e0c0fb03..c8af4702fbc1 100644
--- a/mlir/lib/Dialect/StandardOps/CMakeLists.txt
+++ b/mlir/lib/Dialect/StandardOps/CMakeLists.txt
@@ -5,19 +5,18 @@ add_mlir_dialect_library(MLIRStandardOps
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/StandardOps
+  )
+add_dependencies(MLIRStandardOps
 
-  LINK_LIBS
+  MLIRCallOpInterfacesIncGen
   MLIREDSC
   MLIRIR
-  MLIRSupport
-  LLVMCore
+  MLIRStandardOpsIncGen
   LLVMSupport
   )
-add_dependencies(MLIRStandardOps
+target_link_libraries(MLIRStandardOps
 
-  MLIRCallOpInterfacesIncGen
   MLIREDSC
   MLIRIR
-  MLIRStandardOpsIncGen
   LLVMSupport
   )

diff  --git a/mlir/lib/Dialect/VectorOps/CMakeLists.txt b/mlir/lib/Dialect/VectorOps/CMakeLists.txt
index ff97a95b0c8b..8bdce35f71ff 100644
--- a/mlir/lib/Dialect/VectorOps/CMakeLists.txt
+++ b/mlir/lib/Dialect/VectorOps/CMakeLists.txt
@@ -6,15 +6,9 @@ add_mlir_dialect_library(MLIRVectorOps
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/VectorOps
-
-  LINK_LIBS
-  MLIRIR
-  MLIRStandardOps
-  MLIRAffineOps
-  MLIRLoopOps
-  MLIRLoopAnalysis
-  LLVMSupport
   )
 
 add_dependencies(MLIRVectorOps MLIRVectorOpsIncGen)
 add_dependencies(MLIRVectorOps MLIRVectorTransformPatternsIncGen)
+
+target_link_libraries(MLIRVectorOps MLIRIR MLIRStandardOps MLIRAffineOps MLIRLoopOps MLIRLoopAnalysis)

diff  --git a/mlir/lib/EDSC/CMakeLists.txt b/mlir/lib/EDSC/CMakeLists.txt
index 3d0290a61dc1..533d7ec84a40 100644
--- a/mlir/lib/EDSC/CMakeLists.txt
+++ b/mlir/lib/EDSC/CMakeLists.txt
@@ -8,11 +8,12 @@ add_llvm_library(MLIREDSC
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/EDSC
+  )
+target_link_libraries(MLIREDSC
+  PUBLIC
 
-  LINK_LIBS
   MLIRIR
   MLIRSupport
-  LLVMSupport
   )
 
 add_llvm_library(MLIREDSCInterface
@@ -20,11 +21,11 @@ add_llvm_library(MLIREDSCInterface
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/EDSC
-
-  LINK_LIBS
+  )
+add_dependencies(MLIREDSCInterface MLIRIR)
+target_link_libraries(MLIREDSCInterface
+  PUBLIC
   MLIRIR
   MLIRSupport
   MLIRParser
-  LLVMSupport
   )
-add_dependencies(MLIREDSCInterface MLIRIR)

diff  --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt
index c24917c11a96..dc20e5fd4622 100644
--- a/mlir/lib/ExecutionEngine/CMakeLists.txt
+++ b/mlir/lib/ExecutionEngine/CMakeLists.txt
@@ -12,15 +12,13 @@ add_llvm_library(MLIRExecutionEngine
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/ExecutionEngine
+  )
+target_link_libraries(MLIRExecutionEngine
 
-  LINK_LIBS
-  MLIRIR
   MLIRLLVMIR
-  MLIRSupport
   MLIRTargetLLVMIR
   LLVMBitReader
   LLVMBitWriter
-  LLVMCore
   LLVMExecutionEngine
   LLVMObject
   LLVMOrcJIT
@@ -34,8 +32,8 @@ add_llvm_library(MLIRExecutionEngine
   LLVMTarget
   LLVMVectorize
   LLVMTransformUtils
-  ${outlibs}
-  )
+
+  ${outlibs})
 
 add_llvm_library(mlir_c_runner_utils SHARED CRunnerUtils.cpp)
 target_compile_definitions(mlir_c_runner_utils PRIVATE mlir_c_runner_utils_EXPORTS)

diff  --git a/mlir/lib/IR/CMakeLists.txt b/mlir/lib/IR/CMakeLists.txt
index 8802f6c986d2..415d9d66e22c 100644
--- a/mlir/lib/IR/CMakeLists.txt
+++ b/mlir/lib/IR/CMakeLists.txt
@@ -4,10 +4,6 @@ add_llvm_library(MLIRIR
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/IR
-
-  LINK_LIBS
-  MLIRSupport
-  LLVMSupport
-  ${LLVM_PTHREAD_LIB}
   )
 add_dependencies(MLIRIR MLIRCallOpInterfacesIncGen MLIROpAsmInterfacesIncGen MLIRSupport LLVMSupport)
+target_link_libraries(MLIRIR MLIRSupport LLVMSupport)

diff  --git a/mlir/lib/Parser/CMakeLists.txt b/mlir/lib/Parser/CMakeLists.txt
index 36ede655daaa..9fd29ae78791 100644
--- a/mlir/lib/Parser/CMakeLists.txt
+++ b/mlir/lib/Parser/CMakeLists.txt
@@ -5,10 +5,6 @@ add_llvm_library(MLIRParser
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Parser
-
-  LINK_LIBS
-  MLIRIR
-  MLIRAnalysis
-  LLVMSupport
   )
 add_dependencies(MLIRParser MLIRIR MLIRAnalysis)
+target_link_libraries(MLIRParser MLIRIR MLIRAnalysis)

diff  --git a/mlir/lib/Pass/CMakeLists.txt b/mlir/lib/Pass/CMakeLists.txt
index 54407d98503b..05122f5a7ed4 100644
--- a/mlir/lib/Pass/CMakeLists.txt
+++ b/mlir/lib/Pass/CMakeLists.txt
@@ -4,12 +4,6 @@ add_llvm_library(MLIRPass
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Pass
-
-  LINK_LIBS
-  MLIRAnalysis
-  MLIRIR
-  MLIRSupport
-  LLVMIRReader
-  LLVMSupport
   )
 add_dependencies(MLIRPass MLIRAnalysis MLIRIR LLVMSupport)
+target_link_libraries(MLIRPass MLIRAnalysis MLIRIR LLVMSupport)

diff  --git a/mlir/lib/Quantizer/CMakeLists.txt b/mlir/lib/Quantizer/CMakeLists.txt
index d87b7da0a10e..6e2c86484138 100644
--- a/mlir/lib/Quantizer/CMakeLists.txt
+++ b/mlir/lib/Quantizer/CMakeLists.txt
@@ -9,13 +9,6 @@ add_llvm_library(MLIRQuantizerSupport
   Support/UniformSolvers.cpp
 
   ADDITIONAL_HEADER_DIRS
-
-  LINK_LIBS
-  MLIRIR
-  MLIRQuantOps
-  MLIRSupport
-  MLIRStandardOps
-  LLVMSupport
   )
 
 add_dependencies(MLIRQuantizerSupport
@@ -23,27 +16,31 @@ add_dependencies(MLIRQuantizerSupport
                  MLIRQuantOps
                  MLIRSupport
                  MLIRStandardOps)
+target_link_libraries(MLIRQuantizerSupport
+  MLIRIR
+  MLIRQuantOps
+  MLIRSupport
+  MLIRStandardOps
+  LLVMSupport
+  )
 
 # Configurations.
 add_llvm_library(MLIRQuantizerFxpMathConfig
   Configurations/FxpMathConfig.cpp
 
   ADDITIONAL_HEADER_DIRS
+  )
 
-  LINK_LIBS
+add_dependencies(MLIRQuantizerFxpMathConfig
+                 MLIRFxpMathOpsIncGen
+                 MLIRQuantizerSupport)
+target_link_libraries(MLIRQuantizerFxpMathConfig
   MLIRIR
   MLIRFxpMathOps
   MLIRQuantOps
   MLIRQuantizerSupport
-  MLIRStandardOps
-  MLIRSupport
-  LLVMSupport
   )
 
-add_dependencies(MLIRQuantizerFxpMathConfig
-                 MLIRFxpMathOpsIncGen
-                 MLIRQuantizerSupport)
-
 # Transforms.
 add_llvm_library(MLIRQuantizerTransforms
   Transforms/AddDefaultStatsTestPass.cpp
@@ -51,18 +48,16 @@ add_llvm_library(MLIRQuantizerTransforms
   Transforms/RemoveInstrumentationPass.cpp
 
   ADDITIONAL_HEADER_DIRS
-
-  LINK_LIBS
+  )
+add_dependencies(MLIRQuantizerTransforms
+  MLIRQuantizerFxpMathConfig
+  MLIRQuantizerSupport
+  MLIRPass)
+target_link_libraries(MLIRQuantizerTransforms
   MLIRIR
   MLIRQuantizerFxpMathConfig
   MLIRQuantizerSupport
   MLIRQuantOps
   MLIRPass
-  MLIRTransforms
-  MLIRTransformUtils
   LLVMSupport
   )
-add_dependencies(MLIRQuantizerTransforms
-  MLIRQuantizerFxpMathConfig
-  MLIRQuantizerSupport
-  MLIRPass)

diff  --git a/mlir/lib/Support/CMakeLists.txt b/mlir/lib/Support/CMakeLists.txt
index 140c2ce721a7..b8c0b17a68f8 100644
--- a/mlir/lib/Support/CMakeLists.txt
+++ b/mlir/lib/Support/CMakeLists.txt
@@ -14,24 +14,20 @@ add_llvm_library(MLIRSupport
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Support
-
-  LINK_LIBS
-  LLVMSupport
-  ${LLVM_PTHREAD_LIB}
   )
+target_link_libraries(MLIRSupport LLVMSupport ${LLVM_PTHREAD_LIB})
 
 add_llvm_library(MLIROptLib
   MlirOptMain.cpp
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Support
-
-  LINK_LIBS
-  MLIRIR
+  )
+target_link_libraries(MLIROptLib
   MLIRPass
   MLIRParser
-  MLIRSupport
   LLVMSupport
+  MLIRSupport
   )
 
 add_llvm_library(MLIRTranslateClParser
@@ -39,22 +35,15 @@ add_llvm_library(MLIRTranslateClParser
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Support
-
-  LINK_LIBS
-  LLVMSupport
-  MLIRAnalysis
-  MLIRIR
-  MLIRTranslation
-  MLIRParser
   )
+target_link_libraries(MLIRTranslateClParser LLVMSupport MLIRIR MLIRTranslation MLIRParser)
 
 add_llvm_library(MLIRJitRunner
   JitRunner.cpp
-
-  LINK_LIBS
+)
+target_link_libraries(MLIRJitRunner PRIVATE
   MLIRExecutionEngine
   MLIRIR
-  MLIRLLVMIR
   MLIRParser
   MLIRStandardOps
   MLIRTargetLLVMIR
@@ -62,9 +51,5 @@ add_llvm_library(MLIRJitRunner
   MLIRStandardToLLVM
   MLIRSupport
   LLVMCore
-  LLVMOrcJIT
   LLVMSupport
-  LLVMX86CodeGen
-  LLVMX86Desc
-  LLVMX86Info
-  )
+)

diff  --git a/mlir/lib/TableGen/CMakeLists.txt b/mlir/lib/TableGen/CMakeLists.txt
index aa1e4a0a44b6..6317c669192e 100644
--- a/mlir/lib/TableGen/CMakeLists.txt
+++ b/mlir/lib/TableGen/CMakeLists.txt
@@ -15,8 +15,5 @@ add_llvm_library(LLVMMLIRTableGen
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/TableGen
-
-  LINK_LIBS
-  LLVMSupport
-  LLVMTableGen
   )
+target_link_libraries(LLVMMLIRTableGen LLVMSupport LLVMTableGen)

diff  --git a/mlir/lib/Target/CMakeLists.txt b/mlir/lib/Target/CMakeLists.txt
index 93f997f0876d..53786b94ad70 100644
--- a/mlir/lib/Target/CMakeLists.txt
+++ b/mlir/lib/Target/CMakeLists.txt
@@ -4,74 +4,47 @@ add_llvm_library(MLIRTargetLLVMIRModuleTranslation
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Target/LLVMIR
-
   DEPENDS
   intrinsics_gen
-
-  LINK_LIBS
-  MLIRLLVMIR
-  LLVMCore
-  LLVMIRReader
-  LLVMSupport
-  LLVMTransformUtils
-  MLIRIR
-  MLIRSupport
-  MLIRTranslation
   )
-
+target_link_libraries(MLIRTargetLLVMIRModuleTranslation
+  MLIRLLVMIR LLVMCore LLVMIRReader LLVMSupport LLVMTransformUtils
+  MLIRTranslation)
 add_llvm_library(MLIRTargetLLVMIR
   LLVMIR/ConvertFromLLVMIR.cpp
   LLVMIR/ConvertToLLVMIR.cpp
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Target/LLVMIR
-
-  LINK_LIBS
-  MLIRIR
-  MLIRLLVMIR
-  MLIRSupport
-  MLIRTargetLLVMIRModuleTranslation
-  MLIRTranslation
-  LLVMCore
-  LLVMIRReader
-  LLVMSupport
   )
+target_link_libraries(MLIRTargetLLVMIR MLIRTargetLLVMIRModuleTranslation)
 add_llvm_library(MLIRTargetNVVMIR
   LLVMIR/ConvertToNVVMIR.cpp
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Target/LLVMIR
-
   DEPENDS
   intrinsics_gen
-
-  LINK_LIBS
+  )
+target_link_libraries(MLIRTargetNVVMIR
   MLIRGPU
   MLIRIR
   MLIRLLVMIR
   MLIRNVVMIR
   MLIRTargetLLVMIRModuleTranslation
-  MLIRTranslation
-  LLVMCore
-  LLVMSupport
   )
-
 add_llvm_library(MLIRTargetROCDLIR
   LLVMIR/ConvertToROCDLIR.cpp
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Target/LLVMIR
-
   DEPENDS
   intrinsics_gen
-
-  LINK_LIBS
+  )
+target_link_libraries(MLIRTargetROCDLIR
   MLIRGPU
   MLIRIR
   MLIRLLVMIR
   MLIRROCDLIR
   MLIRTargetLLVMIRModuleTranslation
-  MLIRTranslation
-  LLVMCore
-  LLVMSupport
   )

diff  --git a/mlir/lib/Transforms/CMakeLists.txt b/mlir/lib/Transforms/CMakeLists.txt
index 7a98490904bd..7d671003e7f0 100644
--- a/mlir/lib/Transforms/CMakeLists.txt
+++ b/mlir/lib/Transforms/CMakeLists.txt
@@ -26,21 +26,16 @@ add_llvm_library(MLIRTransforms
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Transforms
+  )
 
-  LINK_LIBS
+add_dependencies(MLIRTransforms
+  MLIRLoopLikeInterfaceIncGen
+  MLIRStandardOpsIncGen)
+target_link_libraries(MLIRTransforms
   MLIRAffineOps
   MLIRAnalysis
-  MLIRIR
   MLIRLoopOps
-  MLIRLoopAnalysis
   MLIRPass
-  MLIRSupport
-  MLIRStandardOps
   MLIRTransformUtils
   MLIRVectorOps
-  LLVMSupport
   )
-
-add_dependencies(MLIRTransforms
-  MLIRLoopLikeInterfaceIncGen
-  MLIRStandardOpsIncGen)

diff  --git a/mlir/lib/Transforms/Utils/CMakeLists.txt b/mlir/lib/Transforms/Utils/CMakeLists.txt
index d826a6bde6fc..bf4abf8f2807 100644
--- a/mlir/lib/Transforms/Utils/CMakeLists.txt
+++ b/mlir/lib/Transforms/Utils/CMakeLists.txt
@@ -9,15 +9,14 @@ add_llvm_library(MLIRTransformUtils
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Transforms
+  )
 
-  LINK_LIBS
+add_dependencies(MLIRTransformUtils MLIRStandardOpsIncGen)
+target_link_libraries(MLIRTransformUtils
   MLIRAffineOps
   MLIRAnalysis
-  MLIRIR
   MLIRLoopAnalysis
   MLIRLoopOps
   MLIRPass
   MLIRStandardOps
-  LLVMSupport
   )
-add_dependencies(MLIRTransformUtils MLIRStandardOpsIncGen)

diff  --git a/mlir/lib/Translation/CMakeLists.txt b/mlir/lib/Translation/CMakeLists.txt
index b8e809f40129..122db2e6a319 100644
--- a/mlir/lib/Translation/CMakeLists.txt
+++ b/mlir/lib/Translation/CMakeLists.txt
@@ -3,7 +3,5 @@ add_llvm_library(MLIRTranslation
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Translation
-
-  LINK_LIBS
-  LLVMSupport
-)
+  )
+target_link_libraries(MLIRTranslation LLVMSupport)

diff  --git a/mlir/test/EDSC/CMakeLists.txt b/mlir/test/EDSC/CMakeLists.txt
index 55e015bc4482..b922c594dffd 100644
--- a/mlir/test/EDSC/CMakeLists.txt
+++ b/mlir/test/EDSC/CMakeLists.txt
@@ -15,7 +15,6 @@ target_link_libraries(mlir-edsc-builder-api-test
   MLIRStandardOps
   MLIRTransforms
   MLIRVectorOps
-  MLIRTransformUtils
   LLVMCore
   LLVMSupport
 )

diff  --git a/mlir/test/lib/Dialect/SPIRV/CMakeLists.txt b/mlir/test/lib/Dialect/SPIRV/CMakeLists.txt
index 1d6563cbf170..5035c9cc8d49 100644
--- a/mlir/test/lib/Dialect/SPIRV/CMakeLists.txt
+++ b/mlir/test/lib/Dialect/SPIRV/CMakeLists.txt
@@ -4,13 +4,11 @@ add_llvm_library(MLIRSPIRVTestPasses
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/IR
+  )
 
-  LINK_LIBS
+target_link_libraries(MLIRSPIRVTestPasses PRIVATE
   MLIRIR
   MLIRPass
   MLIRSPIRV
   MLIRSupport
-  MLIRTransforms
-  MLIRTransformUtils
-  LLVMSupport
   )

diff  --git a/mlir/test/lib/IR/CMakeLists.txt b/mlir/test/lib/IR/CMakeLists.txt
index 355faccc6927..b6b3c4377c6b 100644
--- a/mlir/test/lib/IR/CMakeLists.txt
+++ b/mlir/test/lib/IR/CMakeLists.txt
@@ -4,15 +4,12 @@ add_llvm_library(MLIRTestIR
   TestSymbolUses.cpp
 
   ADDITIONAL_HEADER_DIRS
-
-  LINK_LIBS
-  MLIRIR
-  MLIRPass
-  MLIRStandardOps
-  LLVMSupport
   )
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../TestDialect)
 include_directories(${CMAKE_CURRENT_BINARY_DIR}/../TestDialect)
 add_dependencies(MLIRTestIR
   MLIRTestDialect
   )
+target_link_libraries(MLIRTestIR
+  MLIRPass
+  )

diff  --git a/mlir/test/lib/Pass/CMakeLists.txt b/mlir/test/lib/Pass/CMakeLists.txt
index 97900950010b..3289a7add942 100644
--- a/mlir/test/lib/Pass/CMakeLists.txt
+++ b/mlir/test/lib/Pass/CMakeLists.txt
@@ -3,9 +3,8 @@ add_llvm_library(MLIRTestPass
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Pass
-
-  LINK_LIBS
+  )
+target_link_libraries(MLIRTestPass
   MLIRIR
   MLIRPass
-  LLVMSupport
   )

diff  --git a/mlir/test/lib/TestDialect/CMakeLists.txt b/mlir/test/lib/TestDialect/CMakeLists.txt
index d35caae2e5bb..15459b9abaa1 100644
--- a/mlir/test/lib/TestDialect/CMakeLists.txt
+++ b/mlir/test/lib/TestDialect/CMakeLists.txt
@@ -14,9 +14,12 @@ add_public_tablegen_target(MLIRTestOpsIncGen)
 add_llvm_library(MLIRTestDialect
   TestDialect.cpp
   TestPatterns.cpp
-
-  LINK_LIBS
-  MLIRAnalysis
+)
+add_dependencies(MLIRTestDialect
+  MLIRTestOpsIncGen
+  MLIRTypeInferOpInterfaceIncGen
+)
+target_link_libraries(MLIRTestDialect
   MLIRDialect
   MLIRIR
   MLIRLinalgTransforms
@@ -25,7 +28,3 @@ add_llvm_library(MLIRTestDialect
   MLIRTransformUtils
   LLVMSupport
 )
-add_dependencies(MLIRTestDialect
-  MLIRTestOpsIncGen
-  MLIRTypeInferOpInterfaceIncGen
-)

diff  --git a/mlir/test/lib/Transforms/CMakeLists.txt b/mlir/test/lib/Transforms/CMakeLists.txt
index 867a7b7c72cb..91672ea129c0 100644
--- a/mlir/test/lib/Transforms/CMakeLists.txt
+++ b/mlir/test/lib/Transforms/CMakeLists.txt
@@ -22,31 +22,27 @@ add_llvm_library(MLIRTestTransforms
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Transforms
+)
 
-  LINK_LIBS
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../TestDialect)
+include_directories(${CMAKE_CURRENT_BINARY_DIR}/../TestDialect)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../DeclarativeTransforms)
+include_directories(${CMAKE_CURRENT_BINARY_DIR}/../DeclarativeTransforms)
+add_dependencies(MLIRTestTransforms MLIRStandardOpsIncGen)
+add_dependencies(MLIRTestTransforms MLIRTestLinalgTransformPatternsIncGen)
+add_dependencies(MLIRTestTransforms MLIRTestVectorTransformPatternsIncGen)
+target_link_libraries(MLIRTestTransforms
   MLIRAffineOps
   MLIRAnalysis
-  MLIRLoopAnalysis
   MLIREDSC
   MLIRGPU
-  MLIRIR
   MLIRLinalgOps
   MLIRLinalgTransforms
   MLIRLoopOps
   MLIRGPU
   MLIRPass
-  MLIRStandardOps
   MLIRTestDialect
   MLIRTransformUtils
   MLIRVectorToLoops
   MLIRVectorOps
-  LLVMSupport
-)
-
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../TestDialect)
-include_directories(${CMAKE_CURRENT_BINARY_DIR}/../TestDialect)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../DeclarativeTransforms)
-include_directories(${CMAKE_CURRENT_BINARY_DIR}/../DeclarativeTransforms)
-add_dependencies(MLIRTestTransforms MLIRStandardOpsIncGen)
-add_dependencies(MLIRTestTransforms MLIRTestLinalgTransformPatternsIncGen)
-add_dependencies(MLIRTestTransforms MLIRTestVectorTransformPatternsIncGen)
+  )

diff  --git a/mlir/test/mlir-cpu-runner/CMakeLists.txt b/mlir/test/mlir-cpu-runner/CMakeLists.txt
index 15a63978ea73..a9d45f0f7f8b 100644
--- a/mlir/test/mlir-cpu-runner/CMakeLists.txt
+++ b/mlir/test/mlir-cpu-runner/CMakeLists.txt
@@ -6,9 +6,7 @@ set(LLVM_OPTIONAL_SOURCES
 add_llvm_library(cblas SHARED cblas.cpp)
 target_compile_definitions(cblas PRIVATE cblas_EXPORTS)
 
-add_llvm_library(cblas_interface SHARED cblas_interface.cpp
-  LINK_LIBS
-  cblas
-  )
+add_llvm_library(cblas_interface SHARED cblas_interface.cpp)
+target_link_libraries(cblas_interface PRIVATE cblas)
 target_compile_definitions(cblas_interface PRIVATE cblas_interface_EXPORTS)
 

diff  --git a/mlir/tools/mlir-cuda-runner/CMakeLists.txt b/mlir/tools/mlir-cuda-runner/CMakeLists.txt
index babe13dd128d..3c6dcbaec7ba 100644
--- a/mlir/tools/mlir-cuda-runner/CMakeLists.txt
+++ b/mlir/tools/mlir-cuda-runner/CMakeLists.txt
@@ -25,15 +25,15 @@ if(MLIR_CUDA_RUNNER_ENABLED)
 
   add_llvm_library(cuda-runtime-wrappers SHARED
     cuda-runtime-wrappers.cpp
-
-    LINK_LIBS
-    LLVMSupport
-    ${CUDA_RUNTIME_LIBRARY}
   )
   target_include_directories(cuda-runtime-wrappers
     PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
     LLVMSupport
   )
+  target_link_libraries(cuda-runtime-wrappers
+    LLVMSupport
+    ${CUDA_RUNTIME_LIBRARY}
+  )
 
   get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
   get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)

diff  --git a/mlir/tools/mlir-opt/CMakeLists.txt b/mlir/tools/mlir-opt/CMakeLists.txt
index 0eaed46521d8..b415bf97b63d 100644
--- a/mlir/tools/mlir-opt/CMakeLists.txt
+++ b/mlir/tools/mlir-opt/CMakeLists.txt
@@ -10,12 +10,11 @@ set(LIB_LIBS
   MLIRPass
   MLIRTransforms
   MLIRSupport
-  LLVMSupport
-  )
+)
 add_llvm_library(MLIRMlirOptMain
   mlir-opt.cpp
-
-  LINK_LIBS
+)
+target_link_libraries(MLIRMlirOptMain
   ${LIB_LIBS}
 )
 

diff  --git a/mlir/unittests/Dialect/SPIRV/CMakeLists.txt b/mlir/unittests/Dialect/SPIRV/CMakeLists.txt
index 84b442baf8e4..b444b5c0220a 100644
--- a/mlir/unittests/Dialect/SPIRV/CMakeLists.txt
+++ b/mlir/unittests/Dialect/SPIRV/CMakeLists.txt
@@ -4,11 +4,8 @@ add_mlir_unittest(MLIRSPIRVTests
 )
 target_link_libraries(MLIRSPIRVTests
   PRIVATE
-  MLIRIR
   MLIRSPIRV
-  MLIRSPIRVSerialization
-  MLIRStandardOps
-  MLIRSupport)
+  MLIRSPIRVSerialization)
 
 whole_archive_link(MLIRSPIRVTests MLIRSPIRV)
 

diff  --git a/mlir/unittests/Pass/CMakeLists.txt b/mlir/unittests/Pass/CMakeLists.txt
index 7421abd471f6..a5aaee378f33 100644
--- a/mlir/unittests/Pass/CMakeLists.txt
+++ b/mlir/unittests/Pass/CMakeLists.txt
@@ -3,7 +3,4 @@ add_mlir_unittest(MLIRPassTests
 )
 target_link_libraries(MLIRPassTests
   PRIVATE
-  MLIRIR
-  MLIRPass
-  MLIRStandardOps
-  MLIRSupport)
+  MLIRPass)

diff  --git a/mlir/unittests/SDBM/CMakeLists.txt b/mlir/unittests/SDBM/CMakeLists.txt
index 8fbea63f7a48..3d832ec15488 100644
--- a/mlir/unittests/SDBM/CMakeLists.txt
+++ b/mlir/unittests/SDBM/CMakeLists.txt
@@ -3,9 +3,6 @@ add_mlir_unittest(MLIRSDBMTests
 )
 target_link_libraries(MLIRSDBMTests
   PRIVATE
-  MLIRIR
   MLIRSDBM
-  MLIRStandardOps
-  MLIRSupport
-  )
+)
 whole_archive_link(MLIRSDBMTests MLIRSDBM)


        


More information about the Mlir-commits mailing list