Create a valid CTestTestfile for installation
MODIFY
test/CMakeLists.txt
test/CMakeLists.txt
# Copyright 2019-2021 Advanced Micro Devices, Inc.
# ########################################################################
+set(INSTALL_TEST_FILE "${CMAKE_CURRENT_BINARY_DIR}/install_CTestTestfile.cmake")
+file(WRITE "${INSTALL_TEST_FILE}"
+[=[
+# This is a test file generated by rocThrust for install time.
+# It differs slightly from the default testfile, and you may encounter issues because of that.
+]=]
+)
+
if(NOT CMAKE_VERSION VERSION_LESS 3.12)
list(JOIN PRNG_SEEDS ", " PRNG_SEEDS_INITIALIZER)
else() # Workaround for not having string(JOIN) and list(JOIN)
@@ -36,6 +44,7 @@ function(add_relative_test test_name test_target)
endif()
file(RELATIVE_PATH rel_path "${CMAKE_CURRENT_BINARY_DIR}" "${EXE_PATH}/${EXE_NAME}")
add_test(NAME "${test_name}" COMMAND "./${rel_path}")
+ file(APPEND "${INSTALL_TEST_FILE}" "add_test(${test_name} \"../${EXE_NAME}\")\n")
endfunction()
function(add_rocthrust_test TEST)
@@ -215,3 +224,10 @@ add_rocthrust_test("zip_iterator_scan")
add_rocthrust_test("zip_iterator_sort")
add_rocthrust_test("zip_iterator_sort_by_key")
add_rocthrust_test("zip_iterator_reduce_by_key")
+
+rocm_install(
+ FILES "${INSTALL_TEST_FILE}"
+ DESTINATION "${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME}"
+ COMPONENT tests
+ RENAME "CTestTestfile.cmake"
+)

Create a valid CTestTestfile for installation (#249)