CMake 3.10 CUDA + C++ Code Compilation

I have a visual c++ project which creates a dll. For this project I have a working CMakeLists.txt.

Now I created two cuda source files which complete the project and with visual studio the build works fine. I want to add the matching commands to my cmake file. Can anyone tell me the basic commands I need to add?

I try to build a dll library where i use .cu and .cpp files… The important part of my cmake file looks like:

----------------------------------------------------------------------------

Set Cuda properties

----------------------------------------------------------------------------

enable_language(CUDA)
set(CUDA_SEPARABLE_COMPILATION ON)
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
if (CMAKE_SIZEOF_VOID_P MATCHES 8)
set(CUDA_64_BIT_DEVICE_CODE_DEFAULT ON)
endif()
set(CUDA_NVCC_FLAGS “-gencode arch=compute_50,code=sm_50;-rdc=true;-use_fast_math”)

message(STATUS “CUDA_PROPAGATE_HOST_FLAGS: ${CUDA_PROPAGATE_HOST_FLAGS}”)
message(STATUS “CUDA_HOST_COMPILER: ${CUDA_HOST_COMPILER}”)
message(STATUS “CUDA_NVCC_FLAGS: ${CUDA_NVCC_FLAGS}”)

----------------------------------------------------------------------------

Create shared library project

----------------------------------------------------------------------------

add_library(${LIB_NAME} SHARED ${HEADERS} ${SOURCES} ${CUDA_SOURCES})
set(CUDA_LIBRARIES “cudadevrt.lib;cudart.lib”)
target_link_libraries(${LIB_NAME} ${CUDA_LIBRARIES})

But it doesn’t compile the cuda files with the right nvcc flags. Also in visual studio the preprocessor definitions are also in the cuda part of the properties…any suggestions?