Debian Codegraph @

llvm-project/clang/tools/nvptx-arch/CMakeLists.txt

raw
1 # //===--------------------------------------------------------------------===//
2 # //
3 # // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 # // See https://llvm.org/LICENSE.txt for details.
5 # // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 # //
7 # //===--------------------------------------------------------------------===//
8
9 set(LLVM_LINK_COMPONENTS Support)
10 add_clang_tool(nvptx-arch NVPTXArch.cpp)
11
12 # TODO: This is deprecated. Since CMake 3.17 we can use FindCUDAToolkit instead.
13 find_package(CUDA QUIET)
14 find_library(cuda-library NAMES cuda PATHS /lib64)
15 if (NOT cuda-library AND CUDA_FOUND)
16 get_filename_component(CUDA_LIBDIR "${CUDA_cudart_static_LIBRARY}" DIRECTORY)
17 find_library(cuda-library NAMES cuda HINTS "${CUDA_LIBDIR}/stubs")
18 endif()
19
20 # If we found the CUDA library directly we just dynamically link against it.
21 if (CUDA_FOUND AND cuda-library)
22 target_include_directories(nvptx-arch PRIVATE ${CUDA_INCLUDE_DIRS})
23 target_link_libraries(nvptx-arch PRIVATE ${cuda-library})
24 else()
25 target_compile_definitions(nvptx-arch PRIVATE "DYNAMIC_CUDA")
26 endif()