Skip to content

Commit

Permalink
CMake: Fix CUDA Options Order (#3274)
Browse files Browse the repository at this point in the history
## Summary

Some options in the CMake CUDA logic check the CUDA version. Thus, the
CUDA language needs to be enabled and the compiler be found already.
This fixes this order.

## Additional background

Preparation of a work-around for #3215
  • Loading branch information
ax3l committed Apr 26, 2023
1 parent 9adadfb commit ba69155
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,15 @@ endif()
# Include options, utilities and other stuff we need
#
include( AMReXOptions )
if (AMReX_GPU_BACKEND STREQUAL "CUDA")
include(AMReXCUDAOptions)

#
# Enable CUDA if requested
#
if (AMReX_CUDA)
enable_language(CUDA)
if(CMAKE_VERSION VERSION_LESS 3.20)
include(AMReX_SetupCUDA)
endif()
endif ()

#
Expand All @@ -104,13 +111,10 @@ if(AMReX_FORTRAN)
endif ()

#
# Enable CUDA if requested
# Include options specifically for CUDA
#
if (AMReX_CUDA)
enable_language(CUDA)
if(CMAKE_VERSION VERSION_LESS 3.20)
include(AMReX_SetupCUDA)
endif()
if (AMReX_GPU_BACKEND STREQUAL "CUDA")
include(AMReXCUDAOptions)
endif ()

#
Expand Down

0 comments on commit ba69155

Please sign in to comment.