summaryrefslogtreecommitdiff
path: root/Modules/Platform/Windows-NVIDIA-CUDA.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-02-14 15:11:25 -0500
committerBrad King <brad.king@kitware.com>2017-02-15 11:12:12 -0500
commit55fb46d273e8ab51d5df366286052c71b9008437 (patch)
treeb51aed5c4387892813e3788cc49573450efebba3 /Modules/Platform/Windows-NVIDIA-CUDA.cmake
parentd7c80f60362cbc40216fab67318d94988030315c (diff)
downloadcmake-55fb46d273e8ab51d5df366286052c71b9008437.tar.gz
CUDA: Fix default compiler flags on Windows
Fix the default values of `CMAKE_CUDA_FLAGS[_<CONFIG>]` on Windows to make the host compiler flags match those produced for C++ by the `Platform/Windows-MSVC` module. This makes the flags consistent with those used for C++.
Diffstat (limited to 'Modules/Platform/Windows-NVIDIA-CUDA.cmake')
-rw-r--r--Modules/Platform/Windows-NVIDIA-CUDA.cmake12
1 files changed, 7 insertions, 5 deletions
diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
index eda41e06c3..845fa4b6ff 100644
--- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake
+++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
@@ -35,10 +35,12 @@ set(CMAKE_CUDA_DEVICE_LINK_LIBRARY
set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE
"<CMAKE_CUDA_COMPILER> <FLAGS> <CMAKE_CUDA_LINK_FLAGS> -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
-string(APPEND CMAKE_CUDA_FLAGS_INIT " -Xcompiler=-GR,-EHsc")
-string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -Xcompiler=-MDd,-Zi,-RTC1")
-string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -Xcompiler=-MD")
-string(APPEND CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT " -Xcompiler=-MD")
-string(APPEND CMAKE_CUDA_FLAGS_MINSIZEREL_INIT " -Xcompiler=-MD")
+string(REPLACE "/D" "-D" _PLATFORM_DEFINES_CUDA "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_CXX}")
+
+string(APPEND CMAKE_CUDA_FLAGS_INIT " ${PLATFORM_DEFINES_CUDA} -D_WINDOWS -Xcompiler=\"/W3${_FLAGS_CXX}\"")
+string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -Xcompiler=\"-MDd -Zi -Ob0 -Od ${_RTC1}\"")
+string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -Xcompiler=\"-MD -O2 -Ob2\" -DNDEBUG")
+string(APPEND CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT " -Xcompiler=\"-MD -Zi -O2 -Ob1\" -DNDEBUG")
+string(APPEND CMAKE_CUDA_FLAGS_MINSIZEREL_INIT " -Xcompiler=\"-MD -O1 -Ob1\" -DNDEBUG")
set(CMAKE_CUDA_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")