Instead of having the $<$<BOOL:ON>:SomeCudaFile.cu;AnotherCudaFile.cu> as a second line (out of 3). There is also no way to reconstruct it as the end is not marked as anyway.
Short of demanding the user to change their code, what are the option to handle this situations?
(this is related to CMake challenges with nested list).
Since the list of sources can depend on generator expressions, even CMake itself doesn’t know the answer to that question until generate time. It is not possible to know this information at configure time in general. What do you want to do in response to it?
If the whole generator expression was passed as a single item (instead of N items), at the very least we could ‘skip’ it or probably better I could detect that it is a generator expression and either
tell the user that generator expression are not support
or even look at its components
Stepping back, is there a better way to answer the question:
Is there any CUDA source file in this library
and is cuda separatable compilation enabled for the library
Context:
if the condition above are true (and this library needs to be used by any other library), the only solution (that we know of) to properly handle nvcc and nvlink quirks is to replace that single library by 3 libraries files (an object library, a static library and a ‘final’ library). This is because an executable can (in practice due to the nvlink implementation) load one and only one result of nvlink (which was invoked passing the .o (eg. final static libraries) for all the Relocatable Device Code libraries involved in that executable).
Is anyone that works in the innards of CMake interest in incorporating the concept and thus add ‘proper’ support nvcc’s relocatable device code? The above mentioned script is used by a couple of projects and is decent starting point.
No one is currently working on CMake support for CUDA relocatable device code AFAIK. Please open an issue to propose it, at least to have a common tracking point.