Skip to content

Commit 6b471b3

Browse files
authored
[mlir] [test] Fix unittests in standalone builds (#120910)
Fix the logic used to run unit tests to account for `llvm_gtest` targets being installed, since 91b3ca3. This involves removing a rule that would cause a duplicate `llvm_gtest` target being created, and updates the method for determining whether unittests can be run to checking whether the target is present, rather than the source directory (that is no longer actually necessary).
1 parent e3846c0 commit 6b471b3

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

mlir/CMakeLists.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ if(MLIR_STANDALONE_BUILD)
2727

2828
include_directories(${LLVM_INCLUDE_DIRS})
2929

30-
set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
31-
if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h)
32-
add_subdirectory(${UNITTEST_DIR} third-party/unittest)
33-
endif()
34-
3530
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
3631
"${CMAKE_CURRENT_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
3732
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
@@ -227,7 +222,7 @@ if (MLIR_INCLUDE_TESTS)
227222
add_definitions(-DMLIR_INCLUDE_TESTS)
228223
add_custom_target(MLIRUnitTests)
229224
set_target_properties(MLIRUnitTests PROPERTIES FOLDER "MLIR/Tests")
230-
if (EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest/googletest/include/gtest/gtest.h)
225+
if (TARGET llvm_gtest)
231226
add_subdirectory(unittests)
232227
else()
233228
message(WARNING "gtest not found, unittests will not be available")

0 commit comments

Comments
 (0)