diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -1502,7 +1502,7 @@ # libpthreads overrides some standard library symbols, so main # executable must be linked with it in order to provide consistent # API for all shared libaries loaded by this executable. - target_link_libraries(${test_name} PRIVATE gtest_main gtest ${LLVM_PTHREAD_LIB}) + target_link_libraries(${test_name} PRIVATE llvm_gtest_main llvm_gtest ${LLVM_PTHREAD_LIB}) add_dependencies(${test_suite} ${test_name}) get_target_property(test_suite_folder ${test_suite} FOLDER) diff --git a/llvm/utils/unittest/CMakeLists.txt b/llvm/utils/unittest/CMakeLists.txt --- a/llvm/utils/unittest/CMakeLists.txt +++ b/llvm/utils/unittest/CMakeLists.txt @@ -39,7 +39,7 @@ list(APPEND LIBS pthread) endif() -add_llvm_library(gtest +add_llvm_library(llvm_gtest googletest/src/gtest-all.cc googlemock/src/gmock-all.cc @@ -58,14 +58,14 @@ # that warning here for any targets that link to gtest. if(CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG) add_definitions("-Wno-suggest-override") - set_target_properties(gtest PROPERTIES INTERFACE_COMPILE_OPTIONS "-Wno-suggest-override") + set_target_properties(llvm_gtest PROPERTIES INTERFACE_COMPILE_OPTIONS "-Wno-suggest-override") endif() if (NOT LLVM_ENABLE_THREADS) - target_compile_definitions(gtest PUBLIC GTEST_HAS_PTHREAD=0) + target_compile_definitions(llvm_gtest PUBLIC GTEST_HAS_PTHREAD=0) endif () -target_include_directories(gtest +target_include_directories(llvm_gtest PUBLIC googletest/include googlemock/include PRIVATE googletest googlemock ) @@ -89,5 +89,5 @@ endif() endfunction() -gtest_remove_dylib_from_link_interface(gtest) -gtest_remove_dylib_from_link_interface(gtest_main) +gtest_remove_dylib_from_link_interface(llvm_gtest) +gtest_remove_dylib_from_link_interface(llvm_gtest_main) diff --git a/llvm/utils/unittest/UnitTestMain/CMakeLists.txt b/llvm/utils/unittest/UnitTestMain/CMakeLists.txt --- a/llvm/utils/unittest/UnitTestMain/CMakeLists.txt +++ b/llvm/utils/unittest/UnitTestMain/CMakeLists.txt @@ -1,8 +1,8 @@ -add_llvm_library(gtest_main +add_llvm_library(llvm_gtest_main TestMain.cpp LINK_LIBS - gtest + llvm_gtest LINK_COMPONENTS Support # Depends on llvm::cl