-
Notifications
You must be signed in to change notification settings - Fork 24
Check for CUDA headers rather than compiler #28
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,13 +17,11 @@ list(APPEND CMAKE_MODULE_PATH "${VecCore_CMAKE_DIR}") | |
| include(CMakeFindDependencyMacro) | ||
|
|
||
| if (VecCore_FIND_COMPONENTS MATCHES "CUDA") | ||
| include(CheckLanguage) | ||
| check_language(CUDA) | ||
| if(CMAKE_CUDA_COMPILER) | ||
| enable_language(CUDA) | ||
| find_dependency(CUDAToolkit) | ||
| if(CUDAToolkit_FOUND) | ||
| set(VecCore_CUDA_FOUND True) | ||
| set(VecCore_CUDA_DEFINITIONS -DVECCORE_ENABLE_CUDA) | ||
| set(VecCore_CUDA_INCLUDE_DIR ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) | ||
| set(VecCore_CUDA_INCLUDE_DIR ${CUDAToolkit_INCLUDE_DIRS}) | ||
| endif() | ||
| endif() | ||
|
|
||
|
|
@@ -80,3 +78,8 @@ if (VecCore_FOUND AND NOT TARGET VecCore::VecCore) | |
| INTERFACE_LINK_LIBRARIES "${VecCore_LIBRARIES}") | ||
| endif() | ||
| endif() | ||
|
|
||
| # Print a pretty message if the caller doesn't have a FindVecGeom.cmake | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| include(FindPackageHandleStandardArgs) | ||
| set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE_CURRENT_LIST_FILE}") | ||
| find_package_handle_standard_args(@PROJECT_NAME@ CONFIG_MODE HANDLE_COMPONENTS) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's probably better to hard-code |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please explain the motivation for this change? The current way of doing things follows advice from CMake policy CMP0146, which suggests projects should use CMake's first class support for cuda via
check_language(CUDA)/enable_language(CUDA). The addition of-DVECCORE_ENABLE_CUDAdoes require that the CUDA language be enabled if you are compiling CUDA code, because that will enable host/device macros, etc. If you want to handle that yourself, you can alwaysfind_package(VecCore)without specifying theCUDAcomponent, thenadd_definitions(VECCORE_ENABLE_CUDA)yourself, without having to change this logic.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record, this was last modified in this commit 743566f.