Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CMake] Fix ordering problem when checking and setting cuda flag #15155

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

guitargeek
Copy link
Contributor

In the ROOT build system, CheckCompiler is included before RootBuildOptions. The problem with this is that when building with -Dall=ON, the cuda flag is only set in RootBuildOptions, which is too late to find the CUDA compiler in CheckCompiler. This results in issues like #15139:

CMake Error in roofit/batchcompute/CMakeLists.txt:
  Exporting the target "RooBatchCompute_CUDA" is not allowed since its linker
  language cannot be determined

This commit suggests a solution to this problem: just always enable the CUDA language in CMake if it is found, and only set the cuda flag with -Dall=ON if the CUDA language is enabled.

In the ROOT build system, `CheckCompiler` is included before
`RootBuildOptions`. The problem with this is that when building with
`-Dall=ON`, the `cuda` flag is only set in `RootBuildOptions`, which is
too late to find the CUDA compiler in `CheckCompiler`. This results in
issues like root-project#15139:
```
CMake Error in roofit/batchcompute/CMakeLists.txt:
  Exporting the target "RooBatchCompute_CUDA" is not allowed since its linker
  language cannot be determined
```

This commit suggests a solution to this problem: just always enable the
CUDA language in CMake if it is found, and only set the `cuda` flag with
`-Dall=ON` if the CUDA language is enabled.
Copy link
Member

@bellenot bellenot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks Jonas! (at least it works on Windows without CUDA installed)

@guitargeek guitargeek merged commit e26d574 into root-project:master Apr 5, 2024
15 checks passed
@guitargeek guitargeek deleted the issue-15139 branch April 5, 2024 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants