fix whole-archive link

This commit is contained in:
Tian Jin 2019-12-23 11:40:15 -05:00
parent 50ea6bed03
commit 206fb5db67
1 changed files with 13 additions and 13 deletions

View File

@ -140,15 +140,15 @@ set(MLIRLibs
Threads::Threads) Threads::Threads)
set(MLIRWholeArchiveLibs set(MLIRWholeArchiveLibs
${MLIRAffineToStandard} MLIRAffineToStandard
${MLIRAffineOps} MLIRAffineOps
${MLIRLLVMIR} MLIRLLVMIR
${MLIRStandardOps} MLIRStandardOps
${MLIRStandardToLLVM} MLIRStandardToLLVM
${MLIRTransforms} MLIRTransforms
${MLIRLoopToStandard} MLIRLoopToStandard
${MLIRVectorOps} MLIRVectorOps
${MLIRLoopOps}) MLIRLoopOps)
function(whole_archive_link target lib_dir) function(whole_archive_link target lib_dir)
get_property(link_flags TARGET ${target} PROPERTY LINK_FLAGS) get_property(link_flags TARGET ${target} PROPERTY LINK_FLAGS)
@ -156,7 +156,7 @@ function(whole_archive_link target lib_dir)
set(link_flags "${link_flags} -L${lib_dir} ") set(link_flags "${link_flags} -L${lib_dir} ")
foreach(LIB ${ARGN}) foreach(LIB ${ARGN})
string(CONCAT link_flags ${link_flags} string(CONCAT link_flags ${link_flags}
"-Wl,-force_load,${LIB} ") "-Wl,-force_load, ${lib_dir}/lib${LIB}.a ")
endforeach(LIB) endforeach(LIB)
elseif(MSVC) elseif(MSVC)
foreach(LIB ${ARGN}) foreach(LIB ${ARGN})
@ -177,9 +177,9 @@ function(whole_archive_link_mlir target)
endfunction(whole_archive_link_mlir) endfunction(whole_archive_link_mlir)
function(whole_archive_link_onnf target) function(whole_archive_link_onnf target)
foreach(LIB ${ARGN}) foreach(lib_target ${ARGN})
add_dependencies(${target} ${LIB}) add_dependencies(${target} ${lib_target})
endforeach(LIB) endforeach(lib_target)
whole_archive_link(${target} ${CMAKE_BINARY_DIR}/lib ${ARGN}) whole_archive_link(${target} ${CMAKE_BINARY_DIR}/lib ${ARGN})
endfunction(whole_archive_link_onnf) endfunction(whole_archive_link_onnf)