Skip to content

Commit fe9814c

Browse files
authored
[OpenCL][CMake] Fix OpenCL tests compilation (#16394)
[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.
1 parent 3e52c3d commit fe9814c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmake/modules/OpenCL.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ if(USE_OPENCL)
8181
if(Build_OpenCL_GTests)
8282
message(STATUS "Building OpenCL-Gtests")
8383
tvm_file_glob(GLOB_RECURSE OPENCL_TEST_SRCS
84-
"${CMAKE_SOURCE_DIR}/tests/cpp-runtime/opencl/*.cc"
84+
"tests/cpp-runtime/opencl/*.cc"
8585
)
8686
add_executable(opencl-cpptest ${OPENCL_TEST_SRCS})
8787
target_link_libraries(opencl-cpptest PRIVATE gtest_main tvm_runtime)

0 commit comments

Comments
 (0)