Skip to content

Commit 89ffa9e

Browse files
authored
Merge pull request NVIDIA#1465 from allisonvacanti/gcc-5-nvcc-dialect-WAR
Override CMake's COMPILE_FEATURES for nvcc edgecases.
2 parents 55be5d0 + 1006944 commit 89ffa9e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

cmake/DetectSupportedStandards.cmake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,24 @@ function(detect_supported_standards prefix lang)
2323
else()
2424
set(${var_name} FALSE)
2525
endif()
26+
27+
28+
if (standard EQUAL 17 AND
29+
(lang STREQUAL "CXX" OR lang STREQUAL "CUDA") AND
30+
((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
31+
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7) OR
32+
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
33+
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8)))
34+
# Special cases:
35+
# gcc < 7 and clang < 8 don't fully support C++17.
36+
# They accept the flag and have partial support, but nvcc will refuse
37+
# to enable it and falls back to the default dialect for the current
38+
# CXX compiler version. This breaks our CI.
39+
# CMake's COMPILE_FEATURES var reports that these compilers support C++17,
40+
# but we can't rely on it, so manually disable the dialect in these cases.
41+
set(${var_name} FALSE)
42+
endif()
43+
2644
message(STATUS "Testing ${lang}${standard} Support: ${${var_name}}")
2745
set(${var_name} ${${var_name}} PARENT_SCOPE)
2846
endforeach()

0 commit comments

Comments
 (0)