c++ - CMake: How to pass mode dependent compile flags to nvcc in visual studio environment -
i using cmake compile cuda codes, don't know how pass different compile flags nvcc, in debug or release mode. wish can specify follows,
set(cuda_gene_flags_debug "-gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37") set(cuda_gene_flags_release "-xptxas -o3 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37")
so when specify debug or release mode in visual studio, these flags can chosen automatically. can give me hand on this? thanks.
i encountered same problem while compiling linking openmp cuda program.
according latest cmake document findcuda here, should try these 3 variables: cuda_nvcc_flags
, cuda_nvcc_flags_debug
, cuda_nvcc_flags_release
.
but didn't work me , found reference.
if none of above variables work, try use cmake_cuda_flags
workaround:
set(cmake_cuda_flags ${your_flags})
Comments
Post a Comment