summaryrefslogtreecommitdiffstats
path: root/Modules/FindCUDA.cmake
diff options
context:
space:
mode:
authorJames Bigler <jamesbigler@gmail.com>2012-06-19 16:04:51 (GMT)
committerJames Bigler <jamesbigler@gmail.com>2012-06-19 16:04:51 (GMT)
commita20c41d0328f6a4557789bb382c9b3f69b76ea30 (patch)
tree3fb54a1fb251085c40c76b93c77741c50e29a630 /Modules/FindCUDA.cmake
parent4889188f670ae9e836a5f7a58928227e836d3292 (diff)
downloadCMake-a20c41d0328f6a4557789bb382c9b3f69b76ea30.zip
CMake-a20c41d0328f6a4557789bb382c9b3f69b76ea30.tar.gz
CMake-a20c41d0328f6a4557789bb382c9b3f69b76ea30.tar.bz2
Replace -g3 with -g for CUDA 4.1 and 4.2 in addition to CUDA < 3.0.
CUDA 4.1 reintroduced the bug where -g3 breaks compilation. This wasn't fixed until CUDA 5.0, so both CUDA 4.1 and 4.2 have this bug.
Diffstat (limited to 'Modules/FindCUDA.cmake')
-rw-r--r--Modules/FindCUDA.cmake12
1 files changed, 11 insertions, 1 deletions
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 9f8d575..e79353e 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -1016,7 +1016,17 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
if(CUDA_PROPAGATE_HOST_FLAGS)
# nvcc chokes on -g3 in versions previous to 3.0, so replace it with -g
- if(CMAKE_COMPILER_IS_GNUCC AND CUDA_VERSION VERSION_LESS "3.0")
+ set(_cuda_fix_g3 FALSE)
+
+ if(CMAKE_COMPILER_IS_GNUCC)
+ if (CUDA_VERSION VERSION_LESS "3.0" OR
+ CUDA_VERSION VERSION_EQUAL "4.1" OR
+ CUDA_VERSION VERSION_EQUAL "4.2"
+ )
+ set(_cuda_fix_g3 TRUE)
+ endif()
+ endif()
+ if(_cuda_fix_g3)
string(REPLACE "-g3" "-g" _cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}")
else()
set(_cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}")