From 4eb9d880fd049730f452a651419bf73b7abdab1b Mon Sep 17 00:00:00 2001 From: Egor Churaev Date: Fri, 12 Jan 2024 14:56:10 +0300 Subject: [PATCH] [OpenCL] Fix OpenCL tests compilation Found a problem when you are in a different cmake project (not TVM) and you run TVM build with OpenCL tests, then `CMAKE_SOURCE_DIR` returns the path to the `CMakeList.txt` in the current project (not to the TVM) and in this case we will see the following error: `No SOURCES given to target: opencl-cpptest`. To be consistent with code style in `OpenCL.cmake`, I removed the usage of `CMAKE_SOURCE_DIR` variable. It also fixes the issue if TVM cmake was called from directory with another cmake project. --- cmake/modules/OpenCL.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/OpenCL.cmake b/cmake/modules/OpenCL.cmake index 2dc1fc18f36c..ddcd1e4190d1 100644 --- a/cmake/modules/OpenCL.cmake +++ b/cmake/modules/OpenCL.cmake @@ -81,7 +81,7 @@ if(USE_OPENCL) if(Build_OpenCL_GTests) message(STATUS "Building OpenCL-Gtests") tvm_file_glob(GLOB_RECURSE OPENCL_TEST_SRCS - "${CMAKE_SOURCE_DIR}/tests/cpp-runtime/opencl/*.cc" + "tests/cpp-runtime/opencl/*.cc" ) add_executable(opencl-cpptest ${OPENCL_TEST_SRCS}) target_link_libraries(opencl-cpptest PRIVATE gtest_main tvm_runtime)