1# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2# file Copyright.txt or https://cmake.org/licensing for details.
3
4
5# This module is shared by multiple languages; use include blocker.
6if(__COMPILER_PGI)
7  return()
8endif()
9set(__COMPILER_PGI 1)
10
11include(Compiler/CMakeCommonCompilerMacros)
12
13macro(__compiler_pgi lang)
14  # Feature flags.
15  set(CMAKE_${lang}_VERBOSE_FLAG "-v")
16
17  # Initial configuration flags.
18  string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
19  string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g -O0")
20  string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -O2 -s")
21  string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -fast -O3")
22  string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -gopt")
23
24  if(CMAKE_HOST_WIN32)
25    string(APPEND CMAKE_${lang}_FLAGS_INIT " -Bdynamic")
26  endif()
27
28  set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
29  set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
30
31  set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
32  if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL ppc64le AND (NOT CMAKE_HOST_WIN32 OR CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 16.3))
33    set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)
34    set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-Mipa=fast,inline")
35  else()
36    set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO)
37  endif()
38
39  # Preprocessing and assembly rules.
40  set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
41  set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
42endmacro()
43