Not sure if the standalone build case is supposed to be a supported
path. Should probably rely on find_package and imported targets
anyway.
Details
Diff Detail
Event Timeline
I do not understand the contexts where generator expressions work. Also make execution a fatal error. If it's found it should work
$<TARGET_FILE:amdgpu-arch> should work. We have similar code in openmp/libomptarget/DeviceRTL/CMakeLists.txt.
But those are to add_custom_command with an output that targets depend on, which is at build time. It seems to not work with execute_process which is configure time?
Hmm, that's odd as TARGET_FILE is supposed to give the full path of the target binary file (https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#genex:TARGET_FILE), and using that in execute_process should be fine. Not sure what error you encountered.
It tries to execute the literal string '$<TARGET_FILE:amdgpu-arch>' and produces no such file or directory error