From 0e7da0d9242a5e711c179839640f7ce1a7d94cfa Mon Sep 17 00:00:00 2001
From: Fabian Groffen <grobian@gentoo.org>
Date: Mon, 28 Dec 2020 17:07:28 +0100
Subject: [PATCH] [ld64, cmake] use normal cmake trickery to link against tapi

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
---
 ld64/src/ld/CMakeLists.txt | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git ld64/src/ld/CMakeLists.txt ld64/src/ld/CMakeLists.txt
index 79037a3..7a3fdc5 100644
--- ld64/src/ld/CMakeLists.txt
+++ ld64/src/ld/CMakeLists.txt
@@ -67,14 +67,6 @@ if(XTOOLS_LTO_SUPPORT)
   set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lLTO")
 endif()
 
-if(XTOOLS_TAPI_SUPPORT)
-  if(XTOOLS_USE_TAPILITE)
-    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ltapilite -lyaml")
-  else()
-    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ltapi")
-  endif()
-endif()
-
 add_definitions(-DLD_VERS="xtools-ld64-${LD64_VERSION_NUM}")
 
 add_executable(ld ${LD64_SOURCES})
@@ -82,4 +74,12 @@ if(NOT XTOOLS_HAS_MODERNXAR)
   target_link_libraries(ld xarextralib)
 endif()
 
+if(XTOOLS_TAPI_SUPPORT)
+  if(XTOOLS_USE_TAPILITE)
+    target_link_libraries(ld tapilite yaml)
+  else()
+    target_link_libraries(ld tapi)
+  endif()
+endif()
+
 install(TARGETS ld DESTINATION bin)
-- 
2.38.1

