Skip to content

Commit 802598d

Browse files
committed
add required lib if UMF_BUILD_FUZZTESTS is set
1 parent d31509a commit 802598d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

CMakeLists.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,28 @@ if(UMF_BUILD_FUZZTESTS
585585
AND LINUX)
586586
add_compile_options("-fsanitize=fuzzer-no-link")
587587
add_link_options("-fsanitize=fuzzer-no-link")
588+
589+
file(GLOB_RECURSE LIBRARY_FILES /usr/lib/*)
590+
message(STATUS "Files in /usr/lib:")
591+
foreach(FILE ${LIBRARY_FILES})
592+
message(STATUS " ${FILE}")
593+
endforeach()
594+
595+
find_library(
596+
FUZZER_NO_MAIN_LIB
597+
NAMES libclang_rt.fuzzer_no_main-x86_64.a
598+
PATHS
599+
"/usr/lib/llvm-{CMAKE_CXX_COMPILER_VERSION}/lib/clang/${CMAKE_CXX_COMPILER_VERSION}/lib/linux/"
600+
"lib/clang/${CMAKE_CXX_COMPILER_VERSION}/lib/linux/"
601+
)
602+
603+
if(FUZZER_NO_MAIN_LIB)
604+
message(STATUS "Found fuzzer lib: ${FUZZER_NO_MAIN_LIB}")
605+
link_libraries(${FUZZER_NO_MAIN_LIB})
606+
link_libraries("stdc++")
607+
else()
608+
message(FATAL_ERROR "libclang_rt.fuzzer_no_main-x86_64 not found!")
609+
endif()
588610
endif()
589611

590612
# A header-only lib to specify include directories in transitive dependencies

0 commit comments

Comments
 (0)