summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCompilerId.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-03-07 19:32:35 (GMT)
committerBrad King <brad.king@kitware.com>2017-03-10 15:19:55 (GMT)
commit82521e359f9afbb1644d1b8eae58f27a51407df3 (patch)
treea5cc4e7de34f660eef776cc48a235c8c9d00ce78 /Modules/CMakeDetermineCompilerId.cmake
parent80e982d7ad571ce308708d36a531df7a91ffe0f8 (diff)
downloadCMake-82521e359f9afbb1644d1b8eae58f27a51407df3.zip
CMake-82521e359f9afbb1644d1b8eae58f27a51407df3.tar.gz
CMake-82521e359f9afbb1644d1b8eae58f27a51407df3.tar.bz2
VS: Add support for determining CUDA compiler id
Teach `CMakeDetermineCompilerId` how to generate a vcxproj file using the `CMAKE_VS_PLATFORM_TOOLSET_CUDA`.
Diffstat (limited to 'Modules/CMakeDetermineCompilerId.cmake')
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake14
1 files changed, 14 insertions, 0 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 5d85186..6fce8e2 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -241,6 +241,20 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
set(id_Import_targets "")
set(id_ItemDefinitionGroup_entry "")
set(id_Link_AdditionalDependencies "")
+ if(lang STREQUAL CUDA)
+ if(NOT CMAKE_VS_PLATFORM_TOOLSET_CUDA)
+ message(FATAL_ERROR "No CUDA toolset found.")
+ endif()
+ set(cuda_tools "CUDA ${CMAKE_VS_PLATFORM_TOOLSET_CUDA}")
+ set(id_compile "CudaCompile")
+ set(id_PostBuildEvent_Command [[echo CMAKE_CUDA_COMPILER=$(CudaToolkitBinDir)\nvcc.exe]])
+ string(CONCAT id_Import_props [[<Import Project="$(VCTargetsPath)\BuildCustomizations\]] "${cuda_tools}" [[.props" />]])
+ string(CONCAT id_Import_targets [[<Import Project="$(VCTargetsPath)\BuildCustomizations\]] "${cuda_tools}" [[.targets" />]])
+ if(CMAKE_VS_PLATFORM_NAME STREQUAL x64)
+ set(id_ItemDefinitionGroup_entry "<CudaCompile><TargetMachinePlatform>64</TargetMachinePlatform></CudaCompile>")
+ endif()
+ set(id_Link_AdditionalDependencies "<AdditionalDependencies>cudart.lib</AdditionalDependencies>")
+ endif()
configure_file(${CMAKE_ROOT}/Modules/CompilerId/VS-${v}.${ext}.in
${id_dir}/CompilerId${lang}.${ext} @ONLY)
if(CMAKE_VS_MSBUILD_COMMAND AND NOT lang STREQUAL "Fortran")