diff --git a/compiler-rt/lib/memprof/tests/CMakeLists.txt b/compiler-rt/lib/memprof/tests/CMakeLists.txt --- a/compiler-rt/lib/memprof/tests/CMakeLists.txt +++ b/compiler-rt/lib/memprof/tests/CMakeLists.txt @@ -36,8 +36,10 @@ list(APPEND MEMPROF_UNITTEST_LINK_FLAGS -pthread) endif() +set(MEMPROF_UNITTEST_LINK_LIBRARIES "dl") foreach(lib ${SANITIZER_TEST_CXX_LIBRARIES}) - list(APPEND MEMPROF_UNITTEST_LINK_FLAGS -l${lib}) + set(libname "$<$>:$>") + list(APPEND MEMPROF_UNITTEST_LINK_LIBRARIES "${libname}") endforeach() if(COMPILER_RT_DEFAULT_TARGET_ARCH IN_LIST MEMPROF_SUPPORTED_ARCH) @@ -55,7 +57,7 @@ $) set_target_compile_flags(MemProfUnitTests ${MEMPROF_UNITTEST_CFLAGS}) set_target_link_flags(MemProfUnitTests ${MEMPROF_UNITTEST_LINK_FLAGS}) - target_link_libraries(MemProfUnitTests dl) + target_link_libraries(MemProfUnitTests ${MEMPROF_UNITTEST_LINK_LIBRARIES}) if (TARGET cxx-headers OR HAVE_LIBCXX) add_dependencies(MemProfUnitTests cxx-headers)