Imported Upstream version 3.21.4
[platform/upstream/cmake.git] / Modules / Compiler / NVHPC-C.cmake
1 include(Compiler/PGI-C)
2 include(Compiler/NVHPC)
3
4 # Needed so that we support `LANGUAGE` property correctly
5 set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
6
7 if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 20.11)
8   set(CMAKE_C17_STANDARD_COMPILE_OPTION  -std=c17)
9   set(CMAKE_C17_EXTENSION_COMPILE_OPTION -std=gnu17)
10 endif()
11
12 if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 21.07)
13   set(CMAKE_DEPFILE_FLAGS_C "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")
14   set(CMAKE_C_DEPFILE_FORMAT gcc)
15   set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
16 else()
17   # Before NVHPC 21.07 the `-MD` flag implicitly
18   # implies `-E` and therefore compilation and dependency generation
19   # can't occur in the same invocation
20   set(CMAKE_C_DEPENDS_EXTRA_COMMANDS "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -x c -M <SOURCE> -MT <OBJECT> -MD<DEP_FILE>")
21 endif()
22
23 __compiler_nvhpc(C)