diff options
author | Brad King <brad.king@kitware.com> | 2017-03-07 19:27:36 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-03-10 15:19:58 (GMT) |
commit | 65481a60a06b4238d342f64b5fed52e252ee191b (patch) | |
tree | f3b7e918dd560b5e1829340a55ad9bf77eac0e79 /Tests/CudaOnly | |
parent | 8cae24a1d0277fe3fdd0f2fa9e9a76906ad6c016 (diff) | |
download | CMake-65481a60a06b4238d342f64b5fed52e252ee191b.zip CMake-65481a60a06b4238d342f64b5fed52e252ee191b.tar.gz CMake-65481a60a06b4238d342f64b5fed52e252ee191b.tar.bz2 |
CUDA: Work around VS limitation in CudaOnly.WithDefs test
CUDA 8.0 MSBuild rules do not pass `-x cu` to nvcc and so cannot support
a custom file extension. Fix our test for this to use a `.cu` extension
instead.
Diffstat (limited to 'Tests/CudaOnly')
-rw-r--r-- | Tests/CudaOnly/WithDefs/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Tests/CudaOnly/WithDefs/main_for_vs.cu | 1 |
2 files changed, 10 insertions, 2 deletions
diff --git a/Tests/CudaOnly/WithDefs/CMakeLists.txt b/Tests/CudaOnly/WithDefs/CMakeLists.txt index 2646d29..38f2a44 100644 --- a/Tests/CudaOnly/WithDefs/CMakeLists.txt +++ b/Tests/CudaOnly/WithDefs/CMakeLists.txt @@ -16,8 +16,15 @@ set(release_compile_defs DEFREL) #build a executable that needs to be passed a complex define through add_defintions #this verifies we can pass things such as '_','(' to nvcc add_definitions("-DPACKED_DEFINE=__attribute__((packed))") -set_source_files_properties(main.notcu PROPERTIES LANGUAGE CUDA) -add_executable(CudaOnlyWithDefs main.notcu) + +if(CMAKE_GENERATOR MATCHES "Visual Studio") + # CUDA MSBuild rules do not pass '-x cu' to nvcc + set(main main_for_vs.cu) +else() + set(main main.notcu) + set_source_files_properties(main.notcu PROPERTIES LANGUAGE CUDA) +endif() +add_executable(CudaOnlyWithDefs ${main}) target_compile_options(CudaOnlyWithDefs PRIVATE diff --git a/Tests/CudaOnly/WithDefs/main_for_vs.cu b/Tests/CudaOnly/WithDefs/main_for_vs.cu new file mode 100644 index 0000000..56078e7 --- /dev/null +++ b/Tests/CudaOnly/WithDefs/main_for_vs.cu @@ -0,0 +1 @@ +#include "main.notcu" |