summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-04-09 15:32:39 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-04-09 15:32:39 (GMT)
commit48040c19d5f1bcec55a130fcf8f8d83db27291b4 (patch)
treed8e81a860305aff5ec7210480db069b03114a09f /Modules
parent26d6c095d6117d7f9cb02378acb74d86efe59d0b (diff)
parent99abebdea01b9ef73e091db5594553f7b1694a1b (diff)
downloadCMake-48040c19d5f1bcec55a130fcf8f8d83db27291b4.zip
CMake-48040c19d5f1bcec55a130fcf8f8d83db27291b4.tar.gz
CMake-48040c19d5f1bcec55a130fcf8f8d83db27291b4.tar.bz2
Merge topic 'FindCUDA.cmake/C++11Flags'
99abebde FindCUDA: Handle c++11 host flag
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindCUDA.cmake13
1 files changed, 13 insertions, 0 deletions
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 8f80993..ca32559 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -1261,6 +1261,19 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
set(_cuda_nvcc_flags_config "${_cuda_nvcc_flags_config}\nset(CUDA_NVCC_FLAGS_${config_upper} ${CUDA_NVCC_FLAGS_${config_upper}} ;; ${CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}})")
endforeach()
+ # Process the C++11 flag. If the host sets the flag, we need to add it to nvcc and
+ # remove it from the host. This is because -Xcompile -std=c++ will choke nvcc (it uses
+ # the C preprocessor). In order to get this to work correctly, we need to use nvcc's
+ # specific c++11 flag.
+ if( "${_cuda_host_flags}" MATCHES "-std=c\\+\\+11")
+ # Add the c++11 flag to nvcc if it isn't already present. Note that we only look at
+ # the main flag instead of the configuration specific flags.
+ if( NOT "${CUDA_NVCC_FLAGS}" MATCHES "-std;c\\+\\+11" )
+ list(APPEND nvcc_flags --std c++11)
+ endif()
+ string(REGEX REPLACE "[-]+std=c\\+\\+11" "" _cuda_host_flags "${_cuda_host_flags}")
+ endif()
+
# Get the list of definitions from the directory property
get_directory_property(CUDA_NVCC_DEFINITIONS COMPILE_DEFINITIONS)
if(CUDA_NVCC_DEFINITIONS)