[MLIR] Ensure that target_link_libraries() always has a keyword.

CMake allows calling target_link_libraries() without a keyword,
but this usage is not preferred when also called with a keyword,
and has surprising behavior.  This patch explicitly specifies a
keyword when using target_link_libraries().

Differential Revision: https://reviews.llvm.org/D75725
This commit is contained in:
Stephen Neuendorffer 2020-03-05 11:49:42 -08:00
parent fc6fda90f7
commit 1c82dd39f9
54 changed files with 148 additions and 36 deletions

View File

@ -33,7 +33,11 @@ add_dependencies(MLIRAnalysis
MLIRLoopOps
)
target_link_libraries(MLIRAnalysis MLIRAffineOps MLIRLoopOps)
target_link_libraries(MLIRAnalysis
PUBLIC
MLIRAffineOps
MLIRLoopOps
)
add_llvm_library(MLIRLoopAnalysis
AffineAnalysis.cpp
@ -53,4 +57,7 @@ add_dependencies(MLIRLoopAnalysis
MLIRLoopOps
)
target_link_libraries(MLIRLoopAnalysis MLIRAffineOps MLIRLoopOps)
target_link_libraries(MLIRLoopAnalysis
PUBLIC
MLIRAffineOps
MLIRLoopOps)

View File

@ -15,7 +15,7 @@ add_dependencies(
)
target_link_libraries(
MLIRAffineToStandard
PUBLIC
MLIRAffineOps
MLIRLoopOps
MLIRPass

View File

@ -12,6 +12,7 @@ endif()
add_mlir_conversion_library(MLIRGPUtoCUDATransforms ${SOURCES})
target_link_libraries(MLIRGPUtoCUDATransforms
PUBLIC
MLIRGPU
MLIRLLVMIR
MLIRNVVMIR

View File

@ -10,6 +10,7 @@ add_dependencies(MLIRGPUtoNVVMTransforms
MLIRGPUToNVVMIncGen)
target_link_libraries(MLIRGPUtoNVVMTransforms
PUBLIC
LLVMSupport
MLIRGPU
MLIRLLVMIR

View File

@ -2,6 +2,7 @@ add_mlir_conversion_library(MLIRGPUtoROCDLTransforms
LowerGpuOpsToROCDLOps.cpp
)
target_link_libraries(MLIRGPUtoROCDLTransforms
PUBLIC
LLVMSupport
MLIRGPU
MLIRLLVMIR

View File

@ -11,6 +11,7 @@ add_dependencies(MLIRGPUtoSPIRVTransforms
MLIRGPUToSPIRVIncGen)
target_link_libraries(MLIRGPUtoSPIRVTransforms
PUBLIC
MLIRGPU
MLIRIR
MLIRPass

View File

@ -3,6 +3,7 @@ add_mlir_conversion_library(MLIRGPUtoVulkanTransforms
)
target_link_libraries(MLIRGPUtoVulkanTransforms
PUBLIC
MLIRGPU
MLIRIR
MLIRLLVMIR

View File

@ -19,4 +19,6 @@ set(LIBS
)
add_dependencies(MLIRLinalgToLLVM ${LIBS})
target_link_libraries(MLIRLinalgToLLVM ${LIBS})
target_link_libraries(MLIRLinalgToLLVM
PUBLIC
${LIBS})

View File

@ -8,6 +8,7 @@ add_mlir_conversion_library(MLIRLinalgToSPIRVTransforms
)
target_link_libraries(MLIRLinalgToSPIRVTransforms
PUBLIC
MLIRIR
MLIRLinalgOps
MLIRLinalgUtils

View File

@ -14,7 +14,7 @@ add_dependencies(
)
target_link_libraries(
MLIRLoopToStandard
PUBLIC
MLIRLoopOps
MLIRTransforms
LLVMCore

View File

@ -19,4 +19,6 @@ add_mlir_conversion_library(MLIRLoopsToGPU
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/LoopsToGPU
)
add_dependencies(MLIRLoopsToGPU ${LIBS})
target_link_libraries(MLIRLoopsToGPU ${LIBS})
target_link_libraries(MLIRLoopsToGPU
PUBLIC
${LIBS})

View File

@ -14,7 +14,7 @@ add_dependencies(
)
target_link_libraries(
MLIRStandardToLLVM
PUBLIC
MLIRLLVMIR
MLIRTransforms
LLVMCore

View File

@ -16,6 +16,7 @@ add_dependencies(MLIRStandardToSPIRVTransforms
MLIRStandardToSPIRVIncGen)
target_link_libraries(MLIRStandardToSPIRVTransforms
PUBLIC
MLIRIR
MLIRPass
MLIRSPIRV

View File

@ -14,4 +14,6 @@ set(LIBS
)
add_dependencies(MLIRVectorToLLVM ${LIBS})
target_link_libraries(MLIRVectorToLLVM ${LIBS})
target_link_libraries(MLIRVectorToLLVM
PUBLIC
${LIBS})

View File

@ -13,4 +13,6 @@ set(LIBS
)
add_dependencies(MLIRVectorToLoops ${LIBS})
target_link_libraries(MLIRVectorToLoops ${LIBS})
target_link_libraries(MLIRVectorToLoops
PUBLIC
${LIBS})

View File

@ -15,7 +15,7 @@ add_dependencies(MLIRAffineOps
MLIRStandardOps
)
target_link_libraries(MLIRAffineOps
PUBLIC
MLIREDSC
MLIRIR
MLIRStandardOps

View File

@ -23,4 +23,7 @@ add_llvm_library(MLIRDialect
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect
)
target_link_libraries(MLIRDialect MLIRIR)
target_link_libraries(MLIRDialect
PUBLIC
MLIRIR
)

View File

@ -7,6 +7,7 @@ add_mlir_dialect_library(MLIRFxpMathOps
)
target_link_libraries(MLIRFxpMathOps
PUBLIC
MLIRQuantOps
MLIRIR
MLIRPass

View File

@ -18,6 +18,7 @@ add_dependencies(MLIRGPU
MLIRTransformUtils
LLVMSupport)
target_link_libraries(MLIRGPU
PUBLIC
MLIREDSC
MLIRIR
MLIRLLVMIR

View File

@ -5,7 +5,14 @@ add_mlir_dialect_library(MLIRLLVMIR
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/LLVMIR
)
add_dependencies(MLIRLLVMIR MLIRControlFlowInterfacesIncGen MLIRLLVMOpsIncGen MLIRLLVMConversionsIncGen MLIROpenMP LLVMFrontendOpenMP LLVMAsmParser LLVMCore LLVMSupport)
target_link_libraries(MLIRLLVMIR LLVMAsmParser LLVMCore LLVMSupport LLVMFrontendOpenMP MLIROpenMP MLIRIR)
target_link_libraries(MLIRLLVMIR
PUBLIC
LLVMAsmParser
LLVMCore
LLVMSupport
LLVMFrontendOpenMP
MLIROpenMP
MLIRIR)
add_mlir_dialect_library(MLIRNVVMIR
IR/NVVMDialect.cpp
@ -14,7 +21,13 @@ add_mlir_dialect_library(MLIRNVVMIR
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/LLVMIR
)
add_dependencies(MLIRNVVMIR MLIRNVVMOpsIncGen MLIRNVVMConversionsIncGen LLVMAsmParser LLVMCore LLVMSupport)
target_link_libraries(MLIRNVVMIR LLVMAsmParser MLIRIR MLIRLLVMIR LLVMSupport LLVMCore)
target_link_libraries(MLIRNVVMIR
PUBLIC
LLVMAsmParser
MLIRIR
MLIRLLVMIR
LLVMSupport
LLVMCore)
add_mlir_dialect_library(MLIRROCDLIR
IR/ROCDLDialect.cpp
@ -23,4 +36,9 @@ add_mlir_dialect_library(MLIRROCDLIR
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/LLVMIR
)
add_dependencies(MLIRROCDLIR MLIRROCDLOpsIncGen MLIRROCDLConversionsIncGen LLVMAsmParser LLVMCore LLVMSupport)
target_link_libraries(MLIRROCDLIR LLVMAsmParser LLVMCore LLVMSupport MLIRIR)
target_link_libraries(MLIRROCDLIR
PUBLIC
LLVMAsmParser
LLVMCore
LLVMSupport
MLIRIR)

View File

@ -15,4 +15,6 @@ add_mlir_dialect_library(MLIRLinalgAnalysis
)
add_dependencies(MLIRLinalgAnalysis ${LIBS})
target_link_libraries(MLIRLinalgAnalysis ${LIBS})
target_link_libraries(MLIRLinalgAnalysis
PUBLIC
${LIBS})

View File

@ -18,4 +18,6 @@ add_mlir_dialect_library(MLIRLinalgEDSC
)
add_dependencies(MLIRLinalgEDSC ${LIBS})
target_link_libraries(MLIRLinalgEDSC ${LIBS})
target_link_libraries(MLIRLinalgEDSC
PUBLIC
${LIBS})

View File

@ -21,4 +21,6 @@ add_dependencies(MLIRLinalgOps
MLIRLinalgStructuredOpsIncGen
MLIRLinalgStructuredOpsInterfaceIncGen
)
target_link_libraries(MLIRLinalgOps ${LIBS})
target_link_libraries(MLIRLinalgOps
PUBLIC
${LIBS})

View File

@ -34,4 +34,6 @@ add_dependencies(MLIRLinalgTransforms
${LIBS}
MLIRLinalgTransformPatternsIncGen
)
target_link_libraries(MLIRLinalgTransforms ${LIBS})
target_link_libraries(MLIRLinalgTransforms
PUBLIC
${LIBS})

View File

@ -20,4 +20,6 @@ add_mlir_dialect_library(MLIRLinalgUtils
)
add_dependencies(MLIRLinalgUtils ${LIBS})
target_link_libraries(MLIRLinalgUtils ${LIBS})
target_link_libraries(MLIRLinalgUtils
PUBLIC
${LIBS})

View File

@ -15,7 +15,7 @@ add_dependencies(MLIRLoopOps
LLVMSupport
)
target_link_libraries(MLIRLoopOps
PUBLIC
MLIREDSC
MLIRIR
MLIRStandardOps

View File

@ -8,6 +8,7 @@ add_mlir_dialect_library(MLIRLoopOpsTransforms
)
target_link_libraries(MLIRLoopOpsTransforms
PUBLIC
MLIRPass
MLIRLoopOps
)

View File

@ -6,4 +6,6 @@ add_mlir_dialect_library(MLIROpenMP
)
add_dependencies(MLIROpenMP MLIROpenMPOpsIncGen)
target_link_libraries(MLIROpenMP MLIRIR)
target_link_libraries(MLIROpenMP
PUBLIC
MLIRIR)

View File

@ -20,6 +20,7 @@ add_dependencies(MLIRQuantOps
MLIRStandardOps)
target_link_libraries(MLIRQuantOps
PUBLIC
MLIRIR
MLIRPass
MLIRSupport

View File

@ -6,4 +6,6 @@ add_mlir_dialect_library(MLIRSDBM
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SDBM
)
add_dependencies(MLIRSDBM MLIRIR)
target_link_libraries(MLIRSDBM MLIRIR)
target_link_libraries(MLIRSDBM
PUBLIC
MLIRIR)

View File

@ -26,6 +26,7 @@ add_dependencies(MLIRSPIRV
MLIRSPIRVTargetAndABIIncGen)
target_link_libraries(MLIRSPIRV
PUBLIC
MLIRIR
MLIRParser
MLIRSupport

View File

@ -12,6 +12,7 @@ add_dependencies(MLIRSPIRVSerialization
MLIRSPIRVSerializationGen)
target_link_libraries(MLIRSPIRVSerialization
PUBLIC
MLIRIR
MLIRSPIRV
MLIRSupport

View File

@ -7,6 +7,7 @@ add_mlir_dialect_library(MLIRSPIRVTransforms
)
target_link_libraries(MLIRSPIRVTransforms
PUBLIC
MLIRPass
MLIRSPIRV
)

View File

@ -6,4 +6,6 @@ add_mlir_dialect_library(MLIRShape
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Shape
)
add_dependencies(MLIRShape MLIRShapeOpsIncGen LLVMSupport)
target_link_libraries(MLIRShape LLVMSupport)
target_link_libraries(MLIRShape
PUBLIC
LLVMSupport)

View File

@ -16,7 +16,7 @@ add_dependencies(MLIRStandardOps
LLVMSupport
)
target_link_libraries(MLIRStandardOps
PUBLIC
MLIREDSC
MLIRIR
LLVMSupport

View File

@ -11,4 +11,10 @@ add_mlir_dialect_library(MLIRVectorOps
add_dependencies(MLIRVectorOps MLIRVectorOpsIncGen)
add_dependencies(MLIRVectorOps MLIRVectorTransformPatternsIncGen)
target_link_libraries(MLIRVectorOps MLIRIR MLIRStandardOps MLIRAffineOps MLIRLoopOps MLIRLoopAnalysis)
target_link_libraries(MLIRVectorOps
PUBLIC
MLIRIR
MLIRStandardOps
MLIRAffineOps
MLIRLoopOps
MLIRLoopAnalysis)

View File

@ -14,7 +14,7 @@ add_llvm_library(MLIRExecutionEngine
${MLIR_MAIN_INCLUDE_DIR}/mlir/ExecutionEngine
)
target_link_libraries(MLIRExecutionEngine
PUBLIC
MLIRLLVMIR
MLIRTargetLLVMIR
LLVMBitReader
@ -41,7 +41,7 @@ target_compile_definitions(mlir_c_runner_utils PRIVATE mlir_c_runner_utils_EXPOR
add_llvm_library(mlir_runner_utils SHARED RunnerUtils.cpp)
target_link_libraries(mlir_runner_utils
PUBLIC
mlir_c_runner_utils_static
)
target_compile_definitions(mlir_runner_utils PRIVATE mlir_runner_utils_EXPORTS)

View File

@ -6,4 +6,4 @@ add_llvm_library(MLIRIR
${MLIR_MAIN_INCLUDE_DIR}/mlir/IR
)
add_dependencies(MLIRIR MLIRCallOpInterfacesIncGen MLIROpAsmInterfacesIncGen MLIRSupport LLVMSupport)
target_link_libraries(MLIRIR MLIRSupport LLVMSupport)
target_link_libraries(MLIRIR PUBLIC MLIRSupport LLVMSupport)

View File

@ -7,4 +7,7 @@ add_llvm_library(MLIRParser
${MLIR_MAIN_INCLUDE_DIR}/mlir/Parser
)
add_dependencies(MLIRParser MLIRIR MLIRAnalysis)
target_link_libraries(MLIRParser MLIRIR MLIRAnalysis)
target_link_libraries(MLIRParser
PUBLIC
MLIRIR
MLIRAnalysis)

View File

@ -6,4 +6,8 @@ add_llvm_library(MLIRPass
${MLIR_MAIN_INCLUDE_DIR}/mlir/Pass
)
add_dependencies(MLIRPass MLIRAnalysis MLIRIR LLVMSupport)
target_link_libraries(MLIRPass MLIRAnalysis MLIRIR LLVMSupport)
target_link_libraries(MLIRPass
PUBLIC
MLIRAnalysis
MLIRIR
LLVMSupport)

View File

@ -17,6 +17,7 @@ add_dependencies(MLIRQuantizerSupport
MLIRSupport
MLIRStandardOps)
target_link_libraries(MLIRQuantizerSupport
PUBLIC
MLIRIR
MLIRQuantOps
MLIRSupport
@ -35,6 +36,7 @@ add_dependencies(MLIRQuantizerFxpMathConfig
MLIRFxpMathOpsIncGen
MLIRQuantizerSupport)
target_link_libraries(MLIRQuantizerFxpMathConfig
PUBLIC
MLIRIR
MLIRFxpMathOps
MLIRQuantOps
@ -54,6 +56,7 @@ add_dependencies(MLIRQuantizerTransforms
MLIRQuantizerSupport
MLIRPass)
target_link_libraries(MLIRQuantizerTransforms
PUBLIC
MLIRIR
MLIRQuantizerFxpMathConfig
MLIRQuantizerSupport

View File

@ -15,7 +15,10 @@ add_llvm_library(MLIRSupport
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Support
)
target_link_libraries(MLIRSupport LLVMSupport ${LLVM_PTHREAD_LIB})
target_link_libraries(MLIRSupport
PUBLIC
LLVMSupport
${LLVM_PTHREAD_LIB})
add_llvm_library(MLIROptLib
MlirOptMain.cpp
@ -24,6 +27,7 @@ add_llvm_library(MLIROptLib
${MLIR_MAIN_INCLUDE_DIR}/mlir/Support
)
target_link_libraries(MLIROptLib
PUBLIC
MLIRPass
MLIRParser
LLVMSupport
@ -36,12 +40,18 @@ add_llvm_library(MLIRTranslateClParser
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Support
)
target_link_libraries(MLIRTranslateClParser LLVMSupport MLIRIR MLIRTranslation MLIRParser)
target_link_libraries(MLIRTranslateClParser
PUBLIC
LLVMSupport
MLIRIR
MLIRTranslation
MLIRParser)
add_llvm_library(MLIRJitRunner
JitRunner.cpp
)
target_link_libraries(MLIRJitRunner PRIVATE
target_link_libraries(MLIRJitRunner
PUBLIC
MLIRExecutionEngine
MLIRIR
MLIRParser

View File

@ -16,4 +16,7 @@ add_llvm_library(LLVMMLIRTableGen
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/TableGen
)
target_link_libraries(LLVMMLIRTableGen LLVMSupport LLVMTableGen)
target_link_libraries(LLVMMLIRTableGen
PUBLIC
LLVMSupport
LLVMTableGen)

View File

@ -8,6 +8,7 @@ add_llvm_library(MLIRTargetLLVMIRModuleTranslation
intrinsics_gen
)
target_link_libraries(MLIRTargetLLVMIRModuleTranslation
PUBLIC
MLIRLLVMIR LLVMCore LLVMIRReader LLVMSupport LLVMTransformUtils
MLIRTranslation)
add_llvm_library(MLIRTargetLLVMIR
@ -17,7 +18,9 @@ add_llvm_library(MLIRTargetLLVMIR
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Target/LLVMIR
)
target_link_libraries(MLIRTargetLLVMIR MLIRTargetLLVMIRModuleTranslation)
target_link_libraries(MLIRTargetLLVMIR
PUBLIC
MLIRTargetLLVMIRModuleTranslation)
add_llvm_library(MLIRTargetNVVMIR
LLVMIR/ConvertToNVVMIR.cpp
@ -27,6 +30,7 @@ add_llvm_library(MLIRTargetNVVMIR
intrinsics_gen
)
target_link_libraries(MLIRTargetNVVMIR
PUBLIC
MLIRGPU
MLIRIR
MLIRLLVMIR
@ -42,6 +46,7 @@ add_llvm_library(MLIRTargetROCDLIR
intrinsics_gen
)
target_link_libraries(MLIRTargetROCDLIR
PUBLIC
MLIRGPU
MLIRIR
MLIRLLVMIR

View File

@ -32,6 +32,7 @@ add_dependencies(MLIRTransforms
MLIRLoopLikeInterfaceIncGen
MLIRStandardOpsIncGen)
target_link_libraries(MLIRTransforms
PUBLIC
MLIRAffineOps
MLIRAnalysis
MLIRLoopOps

View File

@ -13,6 +13,7 @@ add_llvm_library(MLIRTransformUtils
add_dependencies(MLIRTransformUtils MLIRStandardOpsIncGen)
target_link_libraries(MLIRTransformUtils
PUBLIC
MLIRAffineOps
MLIRAnalysis
MLIRLoopAnalysis

View File

@ -4,4 +4,7 @@ add_llvm_library(MLIRTranslation
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Translation
)
target_link_libraries(MLIRTranslation LLVMSupport)
target_link_libraries(MLIRTranslation
PUBLIC
LLVMSupport
)

View File

@ -11,5 +11,6 @@ add_dependencies(MLIRTestIR
MLIRTestDialect
)
target_link_libraries(MLIRTestIR
PUBLIC
MLIRPass
)

View File

@ -5,6 +5,7 @@ add_llvm_library(MLIRTestPass
${MLIR_MAIN_INCLUDE_DIR}/mlir/Pass
)
target_link_libraries(MLIRTestPass
PUBLIC
MLIRIR
MLIRPass
)

View File

@ -21,6 +21,7 @@ add_dependencies(MLIRTestDialect
MLIRTypeInferOpInterfaceIncGen
)
target_link_libraries(MLIRTestDialect
PUBLIC
MLIRDialect
MLIRIR
MLIRLinalgTransforms

View File

@ -32,6 +32,7 @@ add_dependencies(MLIRTestTransforms MLIRStandardOpsIncGen)
add_dependencies(MLIRTestTransforms MLIRTestLinalgTransformPatternsIncGen)
add_dependencies(MLIRTestTransforms MLIRTestVectorTransformPatternsIncGen)
target_link_libraries(MLIRTestTransforms
PUBLIC
MLIRAffineOps
MLIRAnalysis
MLIREDSC

View File

@ -31,6 +31,7 @@ if(MLIR_CUDA_RUNNER_ENABLED)
LLVMSupport
)
target_link_libraries(cuda-runtime-wrappers
PUBLIC
LLVMSupport
${CUDA_RUNTIME_LIBRARY}
)

View File

@ -15,6 +15,7 @@ add_llvm_library(MLIRMlirOptMain
mlir-opt.cpp
)
target_link_libraries(MLIRMlirOptMain
PUBLIC
${LIB_LIBS}
)

View File

@ -44,6 +44,7 @@ if (MLIR_VULKAN_RUNNER_ENABLED)
)
target_link_libraries(vulkan-runtime-wrappers
PUBLIC
LLVMSupport
MLIRSPIRVSerialization
LLVMCore