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# This module is shared by multiple languages; use include blocker.
5if(__COMPILER_FUJITSU)
6  return()
7endif()
8set(__COMPILER_FUJITSU 1)
9
10include(Compiler/CMakeCommonCompilerMacros)
11
12macro(__compiler_fujitsu lang)
13  set(CMAKE_${lang}_VERBOSE_FLAG "-###")
14
15  # Initial configuration flags
16  string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
17  string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g -O0")
18  string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
19  string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
20
21  # PIC flags
22  set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
23  set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
24
25  # Passing link options to the compiler
26  set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
27  set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
28
29  # IPO flag
30  set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
31  if ("${lang}" STREQUAL "Fortran")
32    # Supported by Fortran compiler only
33    set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)
34    set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-Klto")
35  else()
36    set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO)
37  endif()
38
39  # How to actually call the compiler
40  set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
41  "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E $<$<COMPILE_LANGUAGE:Fortran>:-Cpp> <SOURCE> > <PREPROCESSED_SOURCE>")
42  set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
43endmacro()
44