Skip to content

Commit

Permalink
Resolve root of cuda toolkit not found3
Browse files Browse the repository at this point in the history
  • Loading branch information
EliasReutelsterz committed Jul 9, 2024
1 parent ab2aa0a commit ac055e5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/code-gen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,19 @@ foreach(EXAMPLE ${EXAMPLES})
# compile source code
add_executable(${EXAMPLE}-target ${TEST_RUNNER} ${GENERATED_SRC})

# GPU specific code generation
# GPU specific code generation
set(GENERATED_GPU_SRC ${GEN_DIR}/gpulike_subroutine.cpp)
enable_language(CUDA REQUIRED)
# Attempt to find the CUDA Toolkit path from an environment variable
if(NOT DEFINED CUDA_TOOLKIT_ROOT_DIR)
if(DEFINED ENV{CUDA_TOOLKIT_ROOT_DIR})
set(CUDA_TOOLKIT_ROOT_DIR $ENV{CUDA_TOOLKIT_ROOT_DIR})
if(NOT DEFINED CUDAToolkit_ROOT)
if(DEFINED ENV{CUDAToolkit_ROOT})
set(CUDAToolkit_ROOT $ENV{CUDAToolkit_ROOT})
else()
message(FATAL_ERROR "CUDA_TOOLKIT_ROOT_DIR is not set. Please define the environment variable CUDA_TOOLKIT_ROOT_DIR pointing to your CUDA Toolkit installation.")
message(FATAL_ERROR "CUDAToolkit_ROOT is not set. Please define the environment variable CUDAToolkit_ROOT pointing to your CUDA Toolkit installation.")
endif()
endif()

# Now that CUDA_TOOLKIT_ROOT_DIR is set, you can proceed to find the CUDA package
# Now that CUDAToolkit_ROOT is set, you can proceed to find the CUDA package
find_package(CUDAToolkit REQUIRED)
set(CMAKE_CUDA_STANDARD 17)
add_library(${EXAMPLE}-target-gpu SHARED ${GENERATED_GPU_SRC})
Expand Down

0 comments on commit ac055e5

Please sign in to comment.