tkonolige commented on a change in pull request #9208:
URL: https://github.com/apache/tvm/pull/9208#discussion_r723525084
##########
File path: CMakeLists.txt
##########
@@ -52,6 +52,7 @@ tvm_option(INDEX_DEFAULT_I64 "Defaults the index datatype to
int64" ON)
tvm_option(USE_LIBBACKTRACE "Build libbacktrace to supply linenumbers on stack
traces" AUTO)
tvm_option(BUILD_STATIC_RUNTIME "Build static version of libtvm_runtime" OFF)
tvm_option(USE_PAPI "Use Performance Application Programming Interface (PAPI)
to read performance counters" OFF)
+tvm_option(USE_GTEST "Use GoogleTest for C++ sanity tests" AUTO)
Review comment:
Can you also add a line to `cmake/config.cmake`.
##########
File path: CMakeLists.txt
##########
@@ -585,22 +596,14 @@ endif()
# Create the `cpptest` target if we can find GTest. If not, we create dummy
# targets that give the user an informative error message.
-if(GTEST_INCLUDE_DIR AND GTEST_LIB)
+if(GTEST_FOUND)
file(GLOB_RECURSE TEST_SRCS tests/cpp/*.cc)
add_executable(cpptest ${TEST_SRCS})
- target_include_directories(cpptest SYSTEM PUBLIC ${GTEST_INCLUDE_DIR})
- target_link_libraries(cpptest PRIVATE ${TVM_TEST_LIBRARY_NAME} ${GTEST_LIB}
gtest_main pthread dl)
+ target_include_directories(cpptest SYSTEM PUBLIC ${GTEST_INCLUDE_DIRS})
+ target_link_libraries(cpptest PRIVATE ${TVM_TEST_LIBRARY_NAME}
${GTEST_BOTH_LIBRARIES} pthread dl)
Review comment:
```suggestion
target_link_libraries(cpptest PRIVATE GTest::GTest GTest::Main)
```
In cmake it is preferred to use targets over manually specifying include
directories and libraries.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]