Skip to content

Commit 4166a74

Browse files
authored
Merge pull request NVIDIA#1377 from allisonvacanti/fixup_nvcxx_cmake_tests
Forward NVC++ info to CMake tests/examples.
2 parents 1ef0374 + 502e789 commit 4166a74

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

examples/cmake/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
thrust_update_system_found_flags()
22

3+
set(extra_cmake_flags)
4+
5+
# Need to pass these when testing NVC++.
6+
if ("NVCXX" STREQUAL "${CMAKE_CUDA_COMPILER_ID}")
7+
set(extra_cmake_flags
8+
-D "CMAKE_CUDA_COMPILER_ID=${CMAKE_CUDA_COMPILER_ID}"
9+
-D "CMAKE_CUDA_COMPILER_FORCED=${CMAKE_CUDA_COMPILER_FORCED}"
10+
)
11+
endif()
12+
313
if (THRUST_CPP_FOUND AND THRUST_CUDA_FOUND)
414
# Do a basic check of the cmake/ThrustAddSubdir.cmake mechanism:
515
add_test(
@@ -13,5 +23,6 @@ if (THRUST_CPP_FOUND AND THRUST_CUDA_FOUND)
1323
-D "CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
1424
-D "CMAKE_CUDA_COMPILER=${CMAKE_CUDA_COMPILER}"
1525
-D "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
26+
${extra_cmake_flags}
1627
)
1728
endif()

testing/cmake/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
thrust_update_system_found_flags()
22

3+
set(extra_cmake_flags)
4+
5+
# Need to pass these when testing NVC++.
6+
if ("NVCXX" STREQUAL "${CMAKE_CUDA_COMPILER_ID}")
7+
set(extra_cmake_flags
8+
-D "CMAKE_CUDA_COMPILER_ID=${CMAKE_CUDA_COMPILER_ID}"
9+
-D "CMAKE_CUDA_COMPILER_FORCED=${CMAKE_CUDA_COMPILER_FORCED}"
10+
)
11+
endif()
12+
313
if (THRUST_CPP_FOUND AND THRUST_CUDA_FOUND)
414
# Test that we can use `find_package` on an installed Thrust:
515
add_test(
@@ -13,5 +23,6 @@ if (THRUST_CPP_FOUND AND THRUST_CUDA_FOUND)
1323
-D "CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
1424
-D "CMAKE_CUDA_COMPILER=${CMAKE_CUDA_COMPILER}"
1525
-D "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
26+
${extra_cmake_flags}
1627
)
1728
endif()

0 commit comments

Comments
 (0)