summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorStephen Sorley <Stephen.Sorley@jhuapl.edu>2016-08-31 14:11:41 (GMT)
committerBrad King <brad.king@kitware.com>2016-08-31 15:53:01 (GMT)
commit900ee0b80077b38b81e5da47cd79c38f044c3a03 (patch)
treeeb9afb2cfda9c564437baf49e4f40580fb28a89e /Modules
parent6442709bae306903084e0bd710b4cea41d0b2500 (diff)
downloadCMake-900ee0b80077b38b81e5da47cd79c38f044c3a03.zip
CMake-900ee0b80077b38b81e5da47cd79c38f044c3a03.tar.gz
CMake-900ee0b80077b38b81e5da47cd79c38f044c3a03.tar.bz2
FindCUDA: Allow cuda_compile* macros to be called more than once per directory
Added a counter as a directory property that gets incremented every time one of the cuda_compile* macros is called. The value of this counter is then added to the phony target name passed to CUDA_WRAP_SRCS. This ensures that every call to one of these macros has its own unique intermediate output directory.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindCUDA.cmake15
1 files changed, 13 insertions, 2 deletions
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 9545564..aaa1536 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -1797,12 +1797,23 @@ endmacro()
###############################################################################
###############################################################################
macro(cuda_compile_base cuda_target format generated_files)
+ # Update a counter in this directory, to keep phony target names unique.
+ set(_cuda_target "${cuda_target}")
+ get_property(_counter DIRECTORY PROPERTY _cuda_internal_phony_counter)
+ if(_counter)
+ math(EXPR _counter "${_counter} + 1")
+ else()
+ set(_counter 1)
+ endif()
+ set(_cuda_target "${_cuda_target}_${_counter}")
+ set_property(DIRECTORY PROPERTY _cuda_internal_phony_counter ${_counter})
# Separate the sources from the options
CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN})
+
# Create custom commands and targets for each file.
- CUDA_WRAP_SRCS( ${cuda_target} ${format} _generated_files ${_sources} ${_cmake_options}
- OPTIONS ${_options} PHONY)
+ CUDA_WRAP_SRCS( ${_cuda_target} ${format} _generated_files ${_sources}
+ ${_cmake_options} OPTIONS ${_options} PHONY)
set( ${generated_files} ${_generated_files})