Export rocm cmake config with if statement
MODIFY
cmake/ROCMExportTargetsHeaderOnly.cmake
cmake/ROCMExportTargetsHeaderOnly.cmake
@@ -31,6 +31,16 @@ include(ROCMInstallTargets)
set(ROCM_INSTALL_LIBDIR lib)
+function(rocm_write_package_template_function_if FILENAME NAME CHECK_VARIABLE)
+ string(REPLACE ";" " " ARGS "${ARGN}")
+ file(APPEND ${FILENAME}
+"
+if(NOT (DEFINED ${CHECK_VARIABLE} AND ${CHECK_VARIABLE}) )
+ ${NAME}(${ARGS})
+endif()
+")
+endfunction()
+
function(rocm_export_targets_header_only)
set(options)
@@ -95,12 +105,10 @@ function(rocm_export_targets_header_only)
if(PARSE_TARGETS)
rocm_write_package_template_function(${CONFIG_TEMPLATE} include "\${${PACKAGE_NAME}_TARGET_FILE}")
-# if(NOT (DEFINED PYTORCH_FOUND_HIP AND PYTORCH_FOUND_HIP) )
-# foreach(NAME ${PACKAGE_NAME} ${PACKAGE_NAME_UPPER} ${PACKAGE_NAME_LOWER})
-# rocm_write_package_template_function(${CONFIG_TEMPLATE} set ${NAME}_LIBRARIES ${PARSE_TARGETS})
-# rocm_write_package_template_function(${CONFIG_TEMPLATE} set ${NAME}_LIBRARY ${PARSE_TARGETS})
-# endforeach()
-# endif()
+ foreach(NAME ${PACKAGE_NAME} ${PACKAGE_NAME_UPPER} ${PACKAGE_NAME_LOWER})
+ rocm_write_package_template_function_if(${CONFIG_TEMPLATE} set DISABLE_ROCTHRUST_LIBRARIES_SET ${NAME}_LIBRARIES ${PARSE_TARGETS})
+ rocm_write_package_template_function_if(${CONFIG_TEMPLATE} set DISABLE_ROCTHRUST_LIBRARY_SET ${NAME}_LIBRARY ${PARSE_TARGETS})
+ endforeach()
endif()
rocm_configure_package_config_file(

Export rocm cmake config with if statement