From d2d3672f1c0b4bb2a2ca25aa1ca46d2edef436a8 Mon Sep 17 00:00:00 2001 From: James Bigler Date: Thu, 28 Jan 2010 12:58:22 -0500 Subject: [PATCH] Define __CUDACC__ during dependency scanning, since NVCC doesn't. --- Modules/FindCUDA/run_nvcc.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake index 31bd74efc..7349da322 100644 --- a/Modules/FindCUDA/run_nvcc.cmake +++ b/Modules/FindCUDA/run_nvcc.cmake @@ -164,11 +164,18 @@ if(CUDA_VERSION VERSION_LESS "3.0") cmake_policy(POP) endif() +# nvcc doesn't define __CUDACC__ for some reason when generating dependency files. This +# can cause incorrect dependencies when #including files based on this macro which is +# defined in the generating passes of nvcc invokation. We will go ahead and manually +# define this for now until a future version fixes this bug. +set(CUDACC_DEFINE -D__CUDACC__) + # Generate the dependency file cuda_execute_process( "Generating dependency file: ${NVCC_generated_dependency_file}" COMMAND "${CUDA_NVCC_EXECUTABLE}" -M + ${CUDACC_DEFINE} "${source_file}" -o "${NVCC_generated_dependency_file}" ${CCBIN}