Merging r257925, r257929, r257930, and r257997:
[oota-llvm.git] / lib / Fuzzer / CMakeLists.txt
index 49d7f8fa5e8fce34544e2d0e7108be5f9ce9a313..d4d85041d218d39a7f12a51e1f572c0d48f81ec2 100644 (file)
@@ -2,8 +2,9 @@ set(LIBFUZZER_FLAGS_BASE "${CMAKE_CXX_FLAGS_RELEASE}")
 # Disable the coverage and sanitizer instrumentation for the fuzzer itself.
 set(CMAKE_CXX_FLAGS_RELEASE "${LIBFUZZER_FLAGS_BASE} -O2 -fno-sanitize=all")
 if( LLVM_USE_SANITIZE_COVERAGE )
-  add_library(LLVMFuzzerNoMain OBJECT
+  add_library(LLVMFuzzerNoMainObjects OBJECT
     FuzzerCrossOver.cpp
+    FuzzerInterface.cpp
     FuzzerTraceState.cpp
     FuzzerDriver.cpp
     FuzzerIO.cpp
@@ -13,10 +14,19 @@ if( LLVM_USE_SANITIZE_COVERAGE )
     FuzzerSHA1.cpp
     FuzzerUtil.cpp
     )
+  add_library(LLVMFuzzerNoMain STATIC
+    $<TARGET_OBJECTS:LLVMFuzzerNoMainObjects>
+    )
+  if( HAVE_LIBPTHREAD )
+    target_link_libraries(LLVMFuzzerNoMain pthread)
+  endif()
   add_library(LLVMFuzzer STATIC
     FuzzerMain.cpp
-    $<TARGET_OBJECTS:LLVMFuzzerNoMain>
+    $<TARGET_OBJECTS:LLVMFuzzerNoMainObjects>
     )
+  if( HAVE_LIBPTHREAD )
+    target_link_libraries(LLVMFuzzer pthread)
+  endif()
 
   if( LLVM_INCLUDE_TESTS )
     add_subdirectory(test)