1include(Compiler/Clang) 2__compiler_clang(CUDA) 3 4# Set explicitly, because __compiler_clang() doesn't set this if we're simulating MSVC. 5set(CMAKE_DEPFILE_FLAGS_CUDA "-MD -MT <DEP_TARGET> -MF <DEP_FILE>") 6if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) 7 AND CMAKE_GENERATOR MATCHES "Makefiles|WMake") 8 # dependencies are computed by the compiler itself 9 set(CMAKE_CUDA_DEPFILE_FORMAT gcc) 10 set(CMAKE_CUDA_DEPENDS_USE_COMPILER TRUE) 11endif() 12 13# C++03 isn't supported for CXX, but is for CUDA, so we need to set these manually. 14# Do this before __compiler_clang_cxx_standards() since that adds the feature. 15set(CMAKE_CUDA03_STANDARD_COMPILE_OPTION "-std=c++03") 16set(CMAKE_CUDA03_EXTENSION_COMPILE_OPTION "-std=gnu++03") 17__compiler_clang_cxx_standards(CUDA) 18 19set(CMAKE_CUDA_COMPILER_HAS_DEVICE_LINK_PHASE TRUE) 20set(_CMAKE_COMPILE_AS_CUDA_FLAG "-x cuda") 21set(_CMAKE_CUDA_PTX_FLAG "--cuda-device-only -S") 22set(_CMAKE_CUDA_DEVICE_CODE "-fgpu-rdc -c") 23 24# RulePlaceholderExpander expands crosscompile variables like sysroot and target only for CMAKE_<LANG>_COMPILER. Override the default. 25set(CMAKE_CUDA_LINK_EXECUTABLE "<CMAKE_CUDA_COMPILER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICIT_LINKS}") 26set(CMAKE_CUDA_CREATE_SHARED_LIBRARY "<CMAKE_CUDA_COMPILER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICIT_LINKS}") 27 28set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC") 29set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "cudadevrt;cudart_static") 30set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_SHARED "cudadevrt;cudart") 31set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_NONE "") 32 33if(UNIX) 34 list(APPEND CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "rt" "pthread" "dl") 35endif() 36