summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler/NVIDIA-CUDA.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-12-13 18:10:12 (GMT)
committerBrad King <brad.king@kitware.com>2017-01-12 15:39:04 (GMT)
commit1155170230ebd096df06ebf108908d6c99242d6d (patch)
treed3bcab362b98e1bf634f021624e9d4decf9c39f6 /Modules/Compiler/NVIDIA-CUDA.cmake
parent5365421e84e6133f0e038995e3a8232ec46d6a91 (diff)
downloadCMake-1155170230ebd096df06ebf108908d6c99242d6d.zip
CMake-1155170230ebd096df06ebf108908d6c99242d6d.tar.gz
CMake-1155170230ebd096df06ebf108908d6c99242d6d.tar.bz2
CUDA: Populate NVIDIA compiler information on Windows
Port Windows-specific compilation and linking rules over from the `Platform/Windows-MSVC` module and adapt it for NVIDIA CUDA. On Windows nvcc and its host compiler (MSVC) do not understand or use options like `-fPIC` or `-std=`, so condition those out.
Diffstat (limited to 'Modules/Compiler/NVIDIA-CUDA.cmake')
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake30
1 files changed, 17 insertions, 13 deletions
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
index 605d555..ae35132 100644
--- a/Modules/Compiler/NVIDIA-CUDA.cmake
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -1,14 +1,15 @@
set(CMAKE_CUDA_VERBOSE_FLAG "-v")
-
-set(CMAKE_CUDA_COMPILE_OPTIONS_PIE -Xcompiler=-fPIE)
-set(CMAKE_CUDA_COMPILE_OPTIONS_PIC -Xcompiler=-fPIC)
-#CMAKE_SHARED_LIBRARY_CUDA_FLAGS is sent to the host linker so we don' need
-#to forward it through nvcc
-set(CMAKE_SHARED_LIBRARY_CUDA_FLAGS -fPIC)
+if(NOT "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
+ set(CMAKE_CUDA_COMPILE_OPTIONS_PIE -Xcompiler=-fPIE)
+ set(CMAKE_CUDA_COMPILE_OPTIONS_PIC -Xcompiler=-fPIC)
+ set(CMAKE_CUDA_COMPILE_OPTIONS_VISIBILITY -Xcompiler=-fvisibility=)
+ # CMAKE_SHARED_LIBRARY_CUDA_FLAGS is sent to the host linker so we
+ # don't need to forward it through nvcc.
+ set(CMAKE_SHARED_LIBRARY_CUDA_FLAGS -fPIC)
+endif()
set(CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS -shared)
set(CMAKE_INCLUDE_SYSTEM_FLAG_CUDA -isystem=)
-set(CMAKE_CUDA_COMPILE_OPTIONS_VISIBILITY -Xcompiler=-fvisibility=)
string(APPEND CMAKE_CUDA_FLAGS_INIT " ")
string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -g")
@@ -16,9 +17,12 @@ string(APPEND CMAKE_CUDA_FLAGS_MINSIZEREL_INIT " -Os -DNDEBUG")
string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
string(APPEND CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
-set(CMAKE_CUDA98_STANDARD_COMPILE_OPTION "")
-set(CMAKE_CUDA98_EXTENSION_COMPILE_OPTION "")
-set(CMAKE_CUDA11_STANDARD_COMPILE_OPTION "-std=c++11")
-set(CMAKE_CUDA11_EXTENSION_COMPILE_OPTION "-std=c++11")
-
-set(CMAKE_CUDA_STANDARD_DEFAULT 98)
+if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
+ set(CMAKE_CUDA_STANDARD_DEFAULT "")
+else()
+ set(CMAKE_CUDA_STANDARD_DEFAULT 98)
+ set(CMAKE_CUDA98_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CUDA98_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_CUDA11_STANDARD_COMPILE_OPTION "-std=c++11")
+ set(CMAKE_CUDA11_EXTENSION_COMPILE_OPTION "-std=c++11")
+endif()