Skip to content

Use cuda_add_library and cuda_add_executable if cuda is found#576

Open
jjcasmar wants to merge 10 commits intoEyescale:masterfrom
jjcasmar:master
Open

Use cuda_add_library and cuda_add_executable if cuda is found#576
jjcasmar wants to merge 10 commits intoEyescale:masterfrom
jjcasmar:master

Conversation

@jjcasmar
Copy link

No description provided.

@hernando
Copy link

It looks this will work for your case but could have undesired side effects in the general case. In particular, in complex projects that have multiple targets, you don't want to use cuda_add_foo for those ones that don't have a direct dependency on CUDA. Can you confirm what happens if you add common_find_package(CUDA) to a project that actually doesn't use it?

@jjcasmar
Copy link
Author

You are absolutely right. For a particular target that doesn't need CUDA, cuda_add_foo would still be called, which may be undesirable. Maybe we can activate cuda calls by setting a flag for the target set(TARGET_USE_CUDA).

I have test this with a project which has some targets needing CUDA and some targets that don't and it works fine anyway, but, of course, its not perfect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants