better fix for tracing linkopts: local not global. (#3534)
diff --git a/build_tools/cmake/iree_copts.cmake b/build_tools/cmake/iree_copts.cmake
index 74a29c4..dd3b3c0 100644
--- a/build_tools/cmake/iree_copts.cmake
+++ b/build_tools/cmake/iree_copts.cmake
@@ -38,10 +38,6 @@
${PROJECT_BINARY_DIR}
)
-if(${IREE_ENABLE_RUNTIME_TRACING})
- string (APPEND CMAKE_EXE_LINKER_FLAGS -ldl)
-endif()
-
iree_select_compiler_opts(IREE_DEFAULT_COPTS
CLANG
# LINT.IfChange(clang_diagnostics)
diff --git a/iree/base/CMakeLists.txt b/iree/base/CMakeLists.txt
index 4e6b7ce..257618b 100644
--- a/iree/base/CMakeLists.txt
+++ b/iree/base/CMakeLists.txt
@@ -595,6 +595,11 @@
iree::testing::gtest_main
)
+iree_select_compiler_opts(IREE_LINKOPTS_TRACING
+ GCC_OR_CLANG
+ -ldl
+)
+
if(${IREE_ENABLE_RUNTIME_TRACING})
iree_cc_library(
NAME
@@ -605,6 +610,8 @@
"${IREE_ROOT_DIR}/third_party/tracy/TracyC.h"
SRCS
"tracing.cc"
+ LINKOPTS
+ ${IREE_LINKOPTS_TRACING}
DEPS
absl::core_headers
DEFINES