NVHPC.cmake 976 B

123456789101112131415161718192021222324252627
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. # This module is shared by multiple languages; use include blocker.
  4. if(__COMPILER_NVHPC)
  5. return()
  6. endif()
  7. set(__COMPILER_NVHPC 1)
  8. include(Compiler/PGI)
  9. macro(__compiler_nvhpc lang)
  10. # Logic specific to NVHPC.
  11. if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 21.07)
  12. set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")
  13. set(CMAKE_${lang}_DEPFILE_FORMAT gcc)
  14. set(CMAKE_${lang}_DEPENDS_USE_COMPILER TRUE)
  15. else()
  16. # Before NVHPC 21.07 the `-MD` flag implicitly
  17. # implies `-E` and therefore compilation and dependency generation
  18. # can't occur in the same invocation
  19. set(CMAKE_${lang}_DEPENDS_EXTRA_COMMANDS "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> ${CMAKE_${lang}_COMPILE_OPTIONS_EXPLICIT_LANGUAGE} -M <SOURCE> -MT <OBJECT> -MD<DEP_FILE>")
  20. endif()
  21. endmacro()