[Mlir-commits] [mlir] [mlir] tentative fix for "'GTEST_NO_LLVM_SUPPORT' is not defined" war… (PR #84539)
Peiming Liu
llvmlistbot at llvm.org
Fri Mar 8 12:42:18 PST 2024
https://github.com/PeimingLiu updated https://github.com/llvm/llvm-project/pull/84539
>From b9e0048de943c76352743c524bb47bf78c30abe9 Mon Sep 17 00:00:00 2001
From: Peiming Liu <peiming at google.com>
Date: Fri, 8 Mar 2024 19:13:24 +0000
Subject: [PATCH 1/2] [mlir] tentative fix for "'GTEST_NO_LLVM_SUPPORT' is not
defined" warning when unittest is enabled
---
mlir/CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index 5c4301af040b47..9bc0ea1169f487 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -197,6 +197,7 @@ add_subdirectory(lib/CAPI)
if (MLIR_INCLUDE_TESTS)
add_definitions(-DMLIR_INCLUDE_TESTS)
+ add_definitions(-DGTEST_NO_LLVM_SUPPORT=0)
add_custom_target(MLIRUnitTests)
if (EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest/googletest/include/gtest/gtest.h)
add_subdirectory(unittests)
>From 5267b8039830e91b112aabf1c8a504b86a11407b Mon Sep 17 00:00:00 2001
From: Peiming Liu <peiming at google.com>
Date: Fri, 8 Mar 2024 20:42:04 +0000
Subject: [PATCH 2/2] address comments
---
mlir/CMakeLists.txt | 1 -
mlir/unittests/CMakeLists.txt | 3 +++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index 9bc0ea1169f487..5c4301af040b47 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -197,7 +197,6 @@ add_subdirectory(lib/CAPI)
if (MLIR_INCLUDE_TESTS)
add_definitions(-DMLIR_INCLUDE_TESTS)
- add_definitions(-DGTEST_NO_LLVM_SUPPORT=0)
add_custom_target(MLIRUnitTests)
if (EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest/googletest/include/gtest/gtest.h)
add_subdirectory(unittests)
diff --git a/mlir/unittests/CMakeLists.txt b/mlir/unittests/CMakeLists.txt
index d0e222091c9f89..6fad249a0b2fba 100644
--- a/mlir/unittests/CMakeLists.txt
+++ b/mlir/unittests/CMakeLists.txt
@@ -1,5 +1,8 @@
set_target_properties(MLIRUnitTests PROPERTIES FOLDER "MLIR Tests")
+# To silence warning caused by Wundef.
+add_definitions(-DGTEST_NO_LLVM_SUPPORT=0)
+
function(add_mlir_unittest test_dirname)
add_unittest(MLIRUnitTests ${test_dirname} ${ARGN})
endfunction()
More information about the Mlir-commits
mailing list