NVHPC: Support nvfortran versions that don't support isystem

Fixes: #25019
This commit is contained in:
Robert Maynard 2023-06-23 09:21:41 -04:00 committed by Brad King
parent f58c7659d8
commit f73ae7c510
7 changed files with 16 additions and 1 deletions

View File

@ -1,3 +1,7 @@
include(Compiler/PGI-Fortran)
include(Compiler/NVHPC)
__compiler_nvhpc(Fortran)
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 21.7)
# Before NVHPC 21.7 nvfortran didn't support isystem
unset(CMAKE_INCLUDE_SYSTEM_FLAG_Fortran)
endif()

View File

@ -452,7 +452,7 @@ add_RunCMake_test(add_custom_target)
add_RunCMake_test(add_dependencies)
add_RunCMake_test(add_executable)
add_RunCMake_test(add_library)
add_RunCMake_test(add_subdirectory)
add_RunCMake_test(add_subdirectory -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER})
add_RunCMake_test(add_test)
add_RunCMake_test(build_command)
add_executable(exit_code exit_code.c)

View File

@ -3,7 +3,9 @@ include(RunCMake)
run_cmake(DoesNotExist)
run_cmake(Missing)
run_cmake(Function)
set(RunCMake_TEST_OPTIONS -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER})
run_cmake(System)
unset(RunCMake_TEST_OPTIONS)
macro(run_cmake_install case)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build)

View File

@ -1,4 +1,7 @@
enable_language(CXX)
if(CMAKE_Fortran_COMPILER)
enable_language(Fortran)
endif()
add_subdirectory(System SYSTEM)

View File

@ -4,6 +4,11 @@ add_subdirectory(SubSub1 SYSTEM)
add_subdirectory(SubSub2)
add_library(bar STATIC bar.cpp)
if(CMAKE_Fortran_COMPILER)
target_sources(bar PRIVATE zap.f)
endif()
# Verify CMAKE_INCLUDE_SYSTEM_FLAG_<LANG> works
target_link_libraries(bar PRIVATE subsub1bar)
add_library(foo STATIC foo.cpp)
set_target_properties(foo PROPERTIES SYSTEM OFF)

View File

@ -1,4 +1,5 @@
add_library(subsub1bar STATIC bar.cpp)
target_include_directories(subsub1bar PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
add_library(subsub1foo STATIC foo.cpp)
set_target_properties(subsub1foo PROPERTIES SYSTEM OFF)