code:
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

#[=======================================================================[.rst:
CheckTypeSize
-------------

Check sizeof a type

.. command:: check_type_size

  .. code-block:: cmake

    check_type_size(<type> <variable> [BUILTIN_TYPES_ONLY]
                                      [LANGUAGE <language>])

  Check if the type exists and determine its size.  Results are reported
  in the following variables:

  ``HAVE_<variable>``
    Holds a true or false value indicating whether the type exists.

  ``<variable>``
    Holds one of the following values:

    ``<size>``
       Type has non-zero size ``<size>``.

    ``0``
       Type has architecture-dependent size.  This may occur when
       :variable:`CMAKE_OSX_ARCHITECTURES` has multiple architectures.
       In this case ``<variable>_CODE`` contains C preprocessor tests
       mapping from each architecture macro to the corresponding type size.
       The list of architecture macros is stored in ``<variable>_KEYS``,
       and the value for each key is stored in ``<variable>-<key>``.

    "" (empty string)
       Type does not exist.

  ``<variable>_CODE``
    Holds C preprocessor code to define the macro ``<variable>`` to the size
    of the type, or to leave the macro undefined if the type does not exist.

  The options are:

  ``BUILTIN_TYPES_ONLY``

    Support only compiler-builtin types.  If *not* given, the macro checks
    for headers ``<sys/types.h>``, ``<stdint.h>``, and ``<stddef.h>``, and
    saves results in ``HAVE_SYS_TYPES_H``, ``HAVE_STDINT_H``, and
    ``HAVE_STDDEF_H``.  The type size check automatically includes the
    available headers, thus supporting checks of types defined in the headers.

  ``LANGUAGE <language>``
    Use the ``<language>`` compiler to perform the check.
    Acceptable values are ``C`` and ``CXX``.

Despite the name of the macro you may use it to check the size of more
complex expressions, too.  To check e.g.  for the size of a struct
member you can do something like this:

.. code-block:: cmake

  check_type_size("((struct something*)0)->member" SIZEOF_MEMBER)

The following variables may be set before calling this macro to modify
the way the check is run:

.. include:: /module/CMAKE_REQUIRED_FLAGS.txt

.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt

.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt

.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt

.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt

.. include:: /module/CMAKE_REQUIRED_QUIET.txt

``CMAKE_EXTRA_INCLUDE_FILES``
  list of extra headers to include.
#]=======================================================================]

include(CheckIncludeFile)
include(CheckIncludeFileCXX)

get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)

include_guard(GLOBAL)

block(SCOPE_FOR POLICIES)
cmake_policy(SET CMP0054 NEW)

#-----------------------------------------------------------------------------
# Helper function.  DO NOT CALL DIRECTLY.
function(__check_type_size_impl type var map builtin language)
  if(NOT CMAKE_REQUIRED_QUIET)
    message(CHECK_START "Check size of ${type}")
  endif()

  # Perform language check
  string(MAKE_C_IDENTIFIER ${var} _var_escaped)
  if(language STREQUAL "C")
    set(src ${_var_escaped}.c)
  elseif(language STREQUAL "CXX")
    set(src ${_var_escaped}.cpp)
  else()
    message(FATAL_ERROR "Unknown language:\n  ${language}\nSupported languages: C, CXX.\n")
  endif()

  # Include header files.
  set(headers)
  if(builtin)
    if(language STREQUAL "CXX" AND type MATCHES "^std::")
      if(HAVE_SYS_TYPES_H)
        string(APPEND headers "#include <sys/types.h>\n")
      endif()
      if(HAVE_CSTDINT)
        string(APPEND headers "#include <cstdint>\n")
      endif()
      if(HAVE_CSTDDEF)
        string(APPEND headers "#include <cstddef>\n")
      endif()
    else()
      if(HAVE_SYS_TYPES_H)
        string(APPEND headers "#include <sys/types.h>\n")
      endif()
      if(HAVE_STDINT_H)
        string(APPEND headers "#include <stdint.h>\n")
      endif()
      if(HAVE_STDDEF_H)
        string(APPEND headers "#include <stddef.h>\n")
      endif()
    endif()
  endif()
  foreach(h ${CMAKE_EXTRA_INCLUDE_FILES})
    string(APPEND headers "#include \"${h}\"\n")
  endforeach()

  # Perform the check.
  set(bin ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.bin)
  file(READ ${__check_type_size_dir}/CheckTypeSize.c.in src_content)
  string(CONFIGURE "${src_content}" src_content @ONLY)
  try_compile(HAVE_${var} SOURCE_FROM_VAR "${src}" src_content
    COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
    LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS}
    LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
    CMAKE_FLAGS
      "-DCOMPILE_DEFINITIONS:STRING=${CMAKE_REQUIRED_FLAGS}"
      "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}"
    COPY_FILE ${bin}
    )

  if(HAVE_${var})
    # The check compiled.  Load information from the binary.
    file(STRINGS ${bin} strings LIMIT_COUNT 10 REGEX "INFO:size")

    # Parse the information strings.
    set(regex_size ".*INFO:size\\[0*([^]]*)\\].*")
    set(regex_key " key\\[([^]]*)\\]")
    set(keys)
    set(code)
    set(mismatch)
    set(first 1)
    foreach(info ${strings})
      if("${info}" MATCHES "${regex_size}")
        # Get the type size.
        set(size "${CMAKE_MATCH_1}")
        if(first)
          set(${var} ${size})
        elseif(NOT "${size}" STREQUAL "${${var}}")
          set(mismatch 1)
        endif()
        set(first 0)

        # Get the architecture map key.
        string(REGEX MATCH   "${regex_key}"       key "${info}")
        string(REGEX REPLACE "${regex_key}" "\\1" key "${key}")
        if(key)
          string(APPEND code "\nset(${var}-${key} \"${size}\")")
          list(APPEND keys ${key})
        endif()
      endif()
    endforeach()

    # Update the architecture-to-size map.
    if(mismatch AND keys)
      configure_file(${__check_type_size_dir}/CheckTypeSizeMap.cmake.in ${map} @ONLY)
      set(${var} 0)
    else()
      file(REMOVE ${map})
    endif()

    if(mismatch AND NOT keys)
      message(SEND_ERROR "CHECK_TYPE_SIZE found different results, consider setting CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !")
    endif()

    if(NOT CMAKE_REQUIRED_QUIET)
      message(CHECK_PASS "done")
    endif()
    set(${var} "${${var}}" CACHE INTERNAL "CHECK_TYPE_SIZE: sizeof(${type})")
  else()
    # The check failed to compile.
    if(NOT CMAKE_REQUIRED_QUIET)
      message(CHECK_FAIL "failed")
    endif()
    set(${var} "" CACHE INTERNAL "CHECK_TYPE_SIZE: ${type} unknown")
    file(REMOVE ${map})
  endif()
endfunction()

#-----------------------------------------------------------------------------
macro(CHECK_TYPE_SIZE TYPE VARIABLE)
  # parse arguments
  unset(doing)
  foreach(arg ${ARGN})
    if("x${arg}" STREQUAL "xBUILTIN_TYPES_ONLY")
      set(_CHECK_TYPE_SIZE_${arg} 1)
      unset(doing)
    elseif("x${arg}" STREQUAL "xLANGUAGE") # change to MATCHES for more keys
      set(doing "${arg}")
      set(_CHECK_TYPE_SIZE_${doing} "")
    elseif("x${doing}" STREQUAL "xLANGUAGE")
      set(_CHECK_TYPE_SIZE_${doing} "${arg}")
      unset(doing)
    else()
      message(FATAL_ERROR "Unknown argument:\n  ${arg}\n")
    endif()
  endforeach()
  if("x${doing}" MATCHES "^x(LANGUAGE)$")
    message(FATAL_ERROR "Missing argument:\n  ${doing} arguments requires a value\n")
  endif()
  if(DEFINED _CHECK_TYPE_SIZE_LANGUAGE)
    if(NOT "x${_CHECK_TYPE_SIZE_LANGUAGE}" MATCHES "^x(C|CXX)$")
      message(FATAL_ERROR "Unknown language:\n  ${_CHECK_TYPE_SIZE_LANGUAGE}.\nSupported languages: C, CXX.\n")
    endif()
    set(_language ${_CHECK_TYPE_SIZE_LANGUAGE})
  else()
    set(_language C)
  endif()

  # Optionally check for standard headers.
  if(_CHECK_TYPE_SIZE_BUILTIN_TYPES_ONLY)
    set(_builtin 0)
  else()
    set(_builtin 1)
    if(_language STREQUAL "C")
      check_include_file(sys/types.h HAVE_SYS_TYPES_H)
      check_include_file(stdint.h HAVE_STDINT_H)
      check_include_file(stddef.h HAVE_STDDEF_H)
    elseif(_language STREQUAL "CXX")
      check_include_file_cxx(sys/types.h HAVE_SYS_TYPES_H)
      if("${TYPE}" MATCHES "^std::")
        check_include_file_cxx(cstdint HAVE_CSTDINT)
        check_include_file_cxx(cstddef HAVE_CSTDDEF)
      else()
        check_include_file_cxx(stdint.h HAVE_STDINT_H)
        check_include_file_cxx(stddef.h HAVE_STDDEF_H)
      endif()
    endif()
  endif()
  unset(_CHECK_TYPE_SIZE_BUILTIN_TYPES_ONLY)
  unset(_CHECK_TYPE_SIZE_LANGUAGE)

  # Compute or load the size or size map.
  set(${VARIABLE}_KEYS)
  set(_map_file ${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${VARIABLE}.cmake)
  if(NOT DEFINED HAVE_${VARIABLE})
    __check_type_size_impl(${TYPE} ${VARIABLE} ${_map_file} ${_builtin} ${_language})
  endif()
  include(${_map_file} OPTIONAL)
  set(_map_file)
  set(_builtin)

  # Create preprocessor code.
  if(${VARIABLE}_KEYS)
    set(${VARIABLE}_CODE)
    set(_if if)
    foreach(key ${${VARIABLE}_KEYS})
      string(APPEND ${VARIABLE}_CODE "#${_if} defined(${key})\n# define ${VARIABLE} ${${VARIABLE}-${key}}\n")
      set(_if elif)
    endforeach()
    string(APPEND ${VARIABLE}_CODE "#else\n# error ${VARIABLE} unknown\n#endif")
    set(_if)
  elseif(${VARIABLE})
    set(${VARIABLE}_CODE "#define ${VARIABLE} ${${VARIABLE}}")
  else()
    set(${VARIABLE}_CODE "/* #undef ${VARIABLE} */")
  endif()
endmacro()

#-----------------------------------------------------------------------------
endblock()


code: set(@var@_KEYS "@keys@")@code@

repo_name: lazytadpole/codenamesilverfish

license: mit


code:
#ifdef CHECK_VARIABLE_EXISTS

extern int CHECK_VARIABLE_EXISTS;

#  ifdef __CLASSIC_C__
int main()
{
  int ac;
  char* av[];
#  else
int main(int ac, char* av[])
{
#  endif
  if (ac > 1000) {
    return *av[0];
  }
  return CHECK_VARIABLE_EXISTS;
}

#else /* CHECK_VARIABLE_EXISTS */

#  error "CHECK_VARIABLE_EXISTS has to specify the variable"

#endif /* CHECK_VARIABLE_EXISTS */


code:
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

#[=======================================================================[.rst:
CheckVariableExists
-------------------

Check if the variable exists.

.. command:: CHECK_VARIABLE_EXISTS

  .. code-block:: cmake

    CHECK_VARIABLE_EXISTS(VAR VARIABLE)

  ::

    VAR      - the name of the variable
    VARIABLE - variable to store the result
               Will be created as an internal cache variable.

  This macro is only for ``C`` variables.

The following variables may be set before calling this macro to modify
the way the check is run:

.. include:: /module/CMAKE_REQUIRED_FLAGS.txt

.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt

.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt

.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt

.. include:: /module/CMAKE_REQUIRED_QUIET.txt

#]=======================================================================]

include_guard(GLOBAL)

macro(CHECK_VARIABLE_EXISTS VAR VARIABLE)
  if(NOT DEFINED "${VARIABLE}")
    set(MACRO_CHECK_VARIABLE_DEFINITIONS
      "-DCHECK_VARIABLE_EXISTS=${VAR} ${CMAKE_REQUIRED_FLAGS}")
    if(NOT CMAKE_REQUIRED_QUIET)
      message(CHECK_START "Looking for ${VAR}")
    endif()
    if(CMAKE_REQUIRED_LINK_OPTIONS)
      set(CHECK_VARIABLE_EXISTS_ADD_LINK_OPTIONS
        LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
    else()
      set(CHECK_VARIABLE_EXISTS_ADD_LINK_OPTIONS)
    endif()
    if(CMAKE_REQUIRED_LIBRARIES)
      set(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES
        LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
    else()
      set(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES)
    endif()
    try_compile(${VARIABLE}
      SOURCES ${CMAKE_ROOT}/Modules/CheckVariableExists.c
      COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
      ${CHECK_VARIABLE_EXISTS_ADD_LINK_OPTIONS}
      ${CHECK_VARIABLE_EXISTS_ADD_LIBRARIES}
      CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_VARIABLE_DEFINITIONS}
      )
    if(${VARIABLE})
      set(${VARIABLE} 1 CACHE INTERNAL "Have variable ${VAR}")
      if(NOT CMAKE_REQUIRED_QUIET)
        message(CHECK_PASS "found")
      endif()
    else()
      set(${VARIABLE} "" CACHE INTERNAL "Have variable ${VAR}")
      if(NOT CMAKE_REQUIRED_QUIET)
        message(CHECK_FAIL "not found")
      endif()
    endif()
  endif()
endmacro()


code:
include(Compiler/ADSP)
__compiler_adsp(ASM)

set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm)
set(CMAKE_ASM_OUTPUT_EXTENSION ".o" )
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>")


code:
include(Compiler/CMakeCommonCompilerMacros)
include(Compiler/ADSP)

__compiler_adsp(C)

set(CMAKE_C90_STANDARD_COMPILE_OPTION -c89)
set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)

set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)

__compiler_check_default_language_standard(C 8.0.0.0 99)


code:
include(Compiler/CMakeCommonCompilerMacros)
include(Compiler/ADSP)

__compiler_adsp(CXX)

set(CMAKE_CXX98_STANDARD_COMPILE_OPTION -c++)
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -g++)
set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)

if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.3.0.0)
  set(CMAKE_CXX11_STANDARD_COMPILE_OPTION -c++11)
  set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -c++11 -g++)
  set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
endif()

__compiler_check_default_language_standard(CXX 8.0.0.0 98)


code:
set(_compiler_id_pp_test "defined(_ADI_COMPILER)")

set(_compiler_id_version_compute "
#if defined(__VERSIONNUM__)
  /* __VERSIONNUM__ = 0xVVRRPPTT */
#  define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__VERSIONNUM__ >> 24 & 0xFF)
#  define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__VERSIONNUM__ >> 16 & 0xFF)
#  define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__VERSIONNUM__ >> 8 & 0xFF)
#  define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__VERSIONNUM__ & 0xFF)
#endif")


code:
include_guard()

set(CMAKE_EXECUTABLE_SUFFIX ".dxe")

macro(__compiler_adsp lang)
  set(CMAKE_${lang}_OUTPUT_EXTENSION ".doj")

  set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-flags-link" " ")
  set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")

  set(_CMAKE_${lang}_ADSP_FLAGS "-proc=${CMAKE_ADSP_PROCESSOR}")

  set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -Mo <DEP_FILE>")

  set(CMAKE_${lang}_COMPILE_OBJECT
    "<CMAKE_${lang}_COMPILER> ${_CMAKE_${lang}_ADSP_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")

  set(CMAKE_${lang}_CREATE_STATIC_LIBRARY
    "<CMAKE_${lang}_COMPILER> ${_CMAKE_${lang}_ADSP_FLAGS} -build-lib -o <TARGET> <CMAKE_${lang}_LINK_FLAGS> <OBJECTS>")

  set(CMAKE_${lang}_LINK_EXECUTABLE
    "<CMAKE_${lang}_COMPILER> ${_CMAKE_${lang}_ADSP_FLAGS} <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")

  unset(_CMAKE_${lang}_ADSP_FLAGS)

  set(CMAKE_${lang}_CREATE_SHARED_LIBRARY)
  set(CMAKE_${lang}_CREATE_MODULE_LIBRARY)
endmacro()


code:
include(Compiler/ARMCC)

set(CMAKE_ASM_OUTPUT_EXTENSION ".o")
set(CMAKE_ASM_OUTPUT_EXTENSION_REPLACE 1)

set(CMAKE_ASM_COMPILE_OBJECT       "<CMAKE_ASM_COMPILER> <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>")
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS S;s;asm;msa)


code:
# ARMCC Toolchain
set(_compiler_id_pp_test "defined(__ARMCC_VERSION) && !defined(__clang__)")

set(_compiler_id_version_compute "
#if __ARMCC_VERSION >= 1000000
  /* __ARMCC_VERSION = VRRPPPP */
  # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ARMCC_VERSION/1000000)
  # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ARMCC_VERSION/10000 % 100)
  # define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ARMCC_VERSION     % 10000)
#else
  /* __ARMCC_VERSION = VRPPPP */
  # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ARMCC_VERSION/100000)
  # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ARMCC_VERSION/10000 % 10)
  # define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ARMCC_VERSION    % 10000)
#endif
")


code:
if(_ARMCC_CMAKE_LOADED)
  return()
endif()
set(_ARMCC_CMAKE_LOADED TRUE)

# See ARM Compiler documentation at:
# http://infocenter.arm.com/help/topic/com.arm.doc.set.swdev/index.html

get_filename_component(_CMAKE_C_TOOLCHAIN_LOCATION "${CMAKE_C_COMPILER}" PATH)
get_filename_component(_CMAKE_CXX_TOOLCHAIN_LOCATION "${CMAKE_CXX_COMPILER}" PATH)

set(CMAKE_EXECUTABLE_SUFFIX ".elf")

find_program(CMAKE_ARMCC_LINKER armlink HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" )
find_program(CMAKE_ARMCC_AR     armar   HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" )

set(CMAKE_LINKER "${CMAKE_ARMCC_LINKER}" CACHE FILEPATH "The ARMCC linker" FORCE)
mark_as_advanced(CMAKE_ARMCC_LINKER)
set(CMAKE_AR "${CMAKE_ARMCC_AR}" CACHE FILEPATH "The ARMCC archiver" FORCE)
mark_as_advanced(CMAKE_ARMCC_AR)

macro(__compiler_armcc lang)
  string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
  string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
  string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Ospace -DNDEBUG")
  string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -Otime -DNDEBUG")
  string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g")

  set(CMAKE_${lang}_OUTPUT_EXTENSION ".o")
  set(CMAKE_${lang}_OUTPUT_EXTENSION_REPLACE 1)
  set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "--via=")

  set(CMAKE_${lang}_LINK_EXECUTABLE      "<CMAKE_LINKER> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> -o <TARGET> --list <TARGET_BASE>.map")
  set(CMAKE_${lang}_CREATE_STATIC_LIBRARY  "<CMAKE_AR> --create -cr <TARGET> <LINK_FLAGS> <OBJECTS>")

  set(CMAKE_DEPFILE_FLAGS_${lang} "--depend=<DEP_FILE> --depend_single_line --no_depend_system_headers")

  set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Xlinker" " ")
endmacro()


code:
include(Compiler/ARMClang)

set(CMAKE_ASM_OUTPUT_EXTENSION ".o")
set(CMAKE_ASM_OUTPUT_EXTENSION_REPLACE 1)

set(CMAKE_ASM_COMPILE_OBJECT       "<CMAKE_ASM_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -c -o <OBJECT> <SOURCE>")
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS S;s;asm;msa)

__compiler_armclang(ASM)


code: include(Compiler/Clang-C-FeatureTests)


code:
include(Compiler/Clang-C)
include(Compiler/ARMClang)
__compiler_armclang(C)

if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
    AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
    AND CMAKE_DEPFILE_FLAGS_C)
  # dependencies are computed by the compiler itself
  set(CMAKE_C_DEPFILE_FORMAT gcc)
  set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
endif()

set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)

set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)

set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)


code:
include(Compiler/Clang-CXX)
include(Compiler/ARMClang)
__compiler_armclang(CXX)

if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
    AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
    AND CMAKE_DEPFILE_FLAGS_CXX)
  # dependencies are computed by the compiler itself
  set(CMAKE_CXX_DEPFILE_FORMAT gcc)
  set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
endif()


code:
# ARMClang Toolchain
set(_compiler_id_pp_test "defined(__clang__) && defined(__ARMCOMPILER_VERSION)")

set(_compiler_id_version_compute "
  # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ARMCOMPILER_VERSION/1000000)
  # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ARMCOMPILER_VERSION/10000 % 100)
  # define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ARMCOMPILER_VERSION/100   % 100)")

string(APPEND _compiler_id_version_compute "
# define @PREFIX@COMPILER_VERSION_INTERNAL @MACRO_DEC@(__ARMCOMPILER_VERSION)")


code:
if(_ARMClang_CMAKE_LOADED)
  return()
endif()

# This file requires CMAKE_LINKER and CMAKE_AR set by CMakeFindBinUtils.cmake.
if(NOT (DEFINED CMAKE_LINKER AND DEFINED CMAKE_AR))
  return()
endif()

set(_ARMClang_CMAKE_LOADED TRUE)

# Save the CMP0123 setting in a variable used both below and by try_compile.
cmake_policy(GET CMP0123 CMAKE_ARMClang_CMP0123)

cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST

set(CMAKE_EXECUTABLE_SUFFIX ".elf")

if (CMAKE_LINKER MATCHES "armlink")
  set(__CMAKE_ARMClang_USING_armlink TRUE)
  set(CMAKE_LIBRARY_PATH_FLAG "--userlibpath=")
else()
  set(__CMAKE_ARMClang_USING_armlink FALSE)
endif()

# get compiler supported cpu list
function(__armclang_set_processor_list lang out_var)
  execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" --target=${CMAKE_${lang}_COMPILER_TARGET} -mcpu=list
    OUTPUT_VARIABLE processor_list
    ERROR_VARIABLE processor_list)
  string(REGEX MATCHALL "-mcpu=([^ \n]*)" processor_list "${processor_list}")
  string(REGEX REPLACE "-mcpu=" "" processor_list "${processor_list}")
  set(${out_var} "${processor_list}" PARENT_SCOPE)
endfunction()

# check processor is in list
function(__armclang_check_processor processor list out_var)
  string(TOLOWER "${processor}" processor)
  if(processor IN_LIST list)
    set(${out_var} TRUE PARENT_SCOPE)
  else()
    set(${out_var} FALSE PARENT_SCOPE)
  endif()
endfunction()

# get compiler supported arch list
function(__armclang_set_arch_list lang out_var)
  execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" --target=${CMAKE_${lang}_COMPILER_TARGET} -march=list
    OUTPUT_VARIABLE arch_list
    ERROR_VARIABLE arch_list)
  string(REGEX MATCHALL "-march=([^ \n]*)" arch_list "${arch_list}")
  string(REGEX REPLACE "-march=" "" arch_list "${arch_list}")
  set(${out_var} "${arch_list}" PARENT_SCOPE)
endfunction()

# get linker supported cpu list
function(__armlink_set_cpu_list lang out_var)
  if(__CMAKE_ARMClang_USING_armlink)
    set(__linker_wrapper_flags "")
  else()
    set(__linker_wrapper_flags --target=${CMAKE_${lang}_COMPILER_TARGET} -Xlinker)
  endif()

  execute_process(COMMAND "${CMAKE_LINKER}" ${__linker_wrapper_flags} --cpu=list
    OUTPUT_VARIABLE cpu_list
    ERROR_VARIABLE cpu_list)
  string(REGEX MATCHALL "--cpu=([^ \n]*)" cpu_list "${cpu_list}")
  string(REGEX REPLACE "--cpu=" "" cpu_list "${cpu_list}")
  set(${out_var} "${cpu_list}" PARENT_SCOPE)
endfunction()

macro(__compiler_armclang lang)
  if(NOT CMAKE_${lang}_COMPILER_TARGET)
    set(CMAKE_${lang}_COMPILER_TARGET arm-arm-none-eabi)
  endif()
  if(NOT CMAKE_${lang}_COMPILER_PROCESSOR_LIST)
    __armclang_set_processor_list(${lang} CMAKE_${lang}_COMPILER_PROCESSOR_LIST)
  endif()
  if(NOT CMAKE_${lang}_COMPILER_ARCH_LIST)
    __armclang_set_arch_list(${lang} CMAKE_${lang}_COMPILER_ARCH_LIST)
  endif()

  # CMAKE_SYSTEM_PROCESSOR and CMAKE_SYSTEM_ARCH are not sufficient because they provide no
  # information of additional CPU features needed in `-mcpu=<name>[+[no]<feature>+...]`.
  # The automatic setting of compile and link options is deprecated and projects should specify their own.
  cmake_policy(GET CMP0123 policy_CMP0123)
  if(NOT "x${CMAKE_ARMClang_CMP0123}x" STREQUAL "xNEWx")
    if(NOT "x${CMAKE_ARMClang_CMP0123}x" STREQUAL "xOLDx")
      cmake_policy(GET_WARNING CMP0123 _cmp0123_warning)
      message(AUTHOR_WARNING
        "${_cmp0123_warning}\n"
        "For compatibility, CMake will automatically add cpu/arch flags based "
        "on the CMAKE_SYSTEM_PROCESSOR and/or CMAKE_SYSTEM_ARCH variables."
        )
    endif()

    if(NOT CMAKE_SYSTEM_PROCESSOR AND NOT CMAKE_SYSTEM_ARCH)
      message(FATAL_ERROR "  CMAKE_SYSTEM_PROCESSOR or CMAKE_SYSTEM_ARCH must be set for ARMClang\n"
        "  Supported processor: ${CMAKE_${lang}_COMPILER_PROCESSOR_LIST}\n"
        "  Supported Architecture: ${CMAKE_${lang}_COMPILER_ARCH_LIST}")
    else()
      __armclang_check_processor("${CMAKE_SYSTEM_ARCH}" "${CMAKE_${lang}_COMPILER_ARCH_LIST}" _CMAKE_${lang}_CHECK_ARCH_RESULT)
      if( _CMAKE_${lang}_CHECK_ARCH_RESULT)
        string(APPEND CMAKE_${lang}_FLAGS_INIT " -march=${CMAKE_SYSTEM_ARCH}")
        set(__march_flag_set TRUE)
      endif()
      __armclang_check_processor("${CMAKE_SYSTEM_PROCESSOR}" "${CMAKE_${lang}_COMPILER_PROCESSOR_LIST}" _CMAKE_${lang}_CHECK_PROCESSOR_RESULT)
      if(_CMAKE_${lang}_CHECK_PROCESSOR_RESULT)
        string(APPEND CMAKE_${lang}_FLAGS_INIT " -mcpu=${CMAKE_SYSTEM_PROCESSOR}")
        set(__mcpu_flag_set TRUE)
      endif()
      if(NOT __march_flag_set AND NOT __mcpu_flag_set)
        message(FATAL_ERROR "At least one of the variables CMAKE_SYSTEM_PROCESSOR or CMAKE_SYSTEM_ARCH must be set for ARMClang\n"
                            "Supported processor: ${CMAKE_${lang}_COMPILER_PROCESSOR_LIST}\n"
                            "  Supported Architecture: ${CMAKE_${lang}_COMPILER_ARCH_LIST}")
      endif()
      unset(_CMAKE_${lang}_CHECK_PROCESSOR_RESULT)
      unset(_CMAKE_${lang}_CHECK_ARCH_RESULT)
    endif()

    #check if CMAKE_SYSTEM_PROCESSOR belongs to supported cpu list for armlink
    __armlink_set_cpu_list( ${lang} CMAKE_LINKER_CPU_LIST)
    list(TRANSFORM CMAKE_LINKER_CPU_LIST TOLOWER)
    __armclang_check_processor("${CMAKE_SYSTEM_PROCESSOR}" "${CMAKE_LINKER_CPU_LIST}" _CMAKE_CHECK_LINK_CPU_RESULT)
    if(_CMAKE_CHECK_LINK_CPU_RESULT)
      string(APPEND CMAKE_${lang}_LINK_FLAGS " --cpu=${CMAKE_SYSTEM_PROCESSOR}")
    endif()

  endif()

  if(__CMAKE_ARMClang_USING_armlink)
    unset(CMAKE_${lang}_LINKER_WRAPPER_FLAG)
    set(__CMAKE_ARMClang_USING_armlink_WRAPPER "")
  else()
    set(__CMAKE_ARMClang_USING_armlink_WRAPPER "-Xlinker")
  endif()
  set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> -o <TARGET> ${__CMAKE_ARMClang_USING_armlink_WRAPPER} --list=<TARGET_BASE>.map")
  set(CMAKE_${lang}_CREATE_STATIC_LIBRARY  "<CMAKE_AR> --create -cr <TARGET> <LINK_FLAGS> <OBJECTS>")
  set(CMAKE_${lang}_ARCHIVE_CREATE         "<CMAKE_AR> --create -cr <TARGET> <LINK_FLAGS> <OBJECTS>")
  set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "${__CMAKE_ARMClang_USING_armlink_WRAPPER} --via=")
  set(CMAKE_${lang}_OUTPUT_EXTENSION ".o")
  set(CMAKE_${lang}_OUTPUT_EXTENSION_REPLACE 1)
endmacro()

cmake_policy(POP)


code:
string(APPEND CMAKE_Fortran_FLAGS_INIT " ")
string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " ")
string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -O3")
string(APPEND CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT " -O2 -g")
set(CMAKE_Fortran_MODDIR_FLAG "-YMOD_OUT_DIR=")
set(CMAKE_Fortran_MODPATH_FLAG "-p")
set(CMAKE_Fortran_VERBOSE_FLAG "-v")
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree")
set(CMAKE_Fortran_LINKER_WRAPPER_FLAG "-X")
set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-cpp")
set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-no-cpp")


code: include(Compiler/Clang-ASM)


code:
set(_cmake_oldestSupported "((__clang_major__ * 100) + __clang_minor__) >= 400")

set(AppleClang_C11 "${_cmake_oldestSupported} && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L")
set(_cmake_feature_test_c_static_assert "${AppleClang_C11}")
set(AppleClang_C99 "${_cmake_oldestSupported} && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L")
set(_cmake_feature_test_c_restrict "${AppleClang_C99}")
set(_cmake_feature_test_c_variadic_macros "${AppleClang_C99}")

set(AppleClang_C90 "${_cmake_oldestSupported}")
set(_cmake_feature_test_c_function_prototypes "${AppleClang_C90}")


code:
include(Compiler/Clang)
__compiler_clang(C)

if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
  if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
      AND CMAKE_GENERATOR MATCHES "Makefiles"
      AND CMAKE_DEPFILE_FLAGS_C)
    # dependencies are computed by the compiler itself
    set(CMAKE_C_DEPFILE_FORMAT gcc)
    set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
  endif()
endif()

set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)

if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
  set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
  set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
  set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)

  set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
  set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
  set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)

  set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
  set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
  set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
endif()

if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0)
  set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
  set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
endif()

if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0.3)
  set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x")
  set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x")
endif()

__compiler_check_default_language_standard(C 4.0 99 9.1 11 12.0.5 17)


code:
# No known reference for AppleClang versions.
# Generic reference: http://clang.llvm.org/cxx_status.html
# http://clang.llvm.org/docs/LanguageExtensions.html

# Note: CXX compiler in Xcode 4.3 does not set __apple_build_version__ and so is
# not recognized as AppleClang.
# Xcode_43 - Apple clang version 3.1 (tags/Apple/clang-318.0.61) (based on LLVM 3.1svn)
# Xcode_44 - Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn)
# Xcode_45 - Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
# Xcode_46 - Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
# Xcode_50 - Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
# Xcode_51 - Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
# Xcode_60 - Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
# Xcode_61 - Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)

# There is some non-correspondance. __has_feature(cxx_user_literals) is
# false for AppleClang 4.0 and 4.1, although it is reported as
# supported in the reference link for Clang 3.1.  The compiler does not pass
# the CompileFeatures/cxx_user_literals.cpp test.
# cxx_attributes is listed as not supported until Clang 3.3. It works without
# warning with AppleClang 5.0, but issues a gcc-compat warning for
# AppleClang 4.0-4.2.
# cxx_alignof and cxx_alignas tests work for early AppleClang versions, though
# they are listed as supported for Clang 3.3 and later.

set(_cmake_oldestSupported "((__clang_major__ * 100) + __clang_minor__) >= 400")

include("${CMAKE_CURRENT_LIST_DIR}/Clang-CXX-TestableFeatures.cmake")

set(AppleClang51_CXX14 "((__clang_major__ * 100) + __clang_minor__) >= 501 && __cplusplus > 201103L")
# http://llvm.org/bugs/show_bug.cgi?id=19242
set(_cmake_feature_test_cxx_attribute_deprecated "${AppleClang51_CXX14}")
# http://llvm.org/bugs/show_bug.cgi?id=19698
set(_cmake_feature_test_cxx_decltype_auto "${AppleClang51_CXX14}")
set(_cmake_feature_test_cxx_digit_separators "${AppleClang51_CXX14}")
# http://llvm.org/bugs/show_bug.cgi?id=19674
set(_cmake_feature_test_cxx_generic_lambdas "${AppleClang51_CXX14}")

set(AppleClang40_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L")
set(_cmake_feature_test_cxx_enum_forward_declarations "${AppleClang40_CXX11}")
set(_cmake_feature_test_cxx_sizeof_member "${AppleClang40_CXX11}")
set(_cmake_feature_test_cxx_extended_friend_declarations "${AppleClang40_CXX11}")
set(_cmake_feature_test_cxx_extern_templates "${AppleClang40_CXX11}")
set(_cmake_feature_test_cxx_func_identifier "${AppleClang40_CXX11}")
set(_cmake_feature_test_cxx_inline_namespaces "${AppleClang40_CXX11}")
set(_cmake_feature_test_cxx_long_long_type "${AppleClang40_CXX11}")
set(_cmake_feature_test_cxx_right_angle_brackets "${AppleClang40_CXX11}")
set(_cmake_feature_test_cxx_variadic_macros "${AppleClang40_CXX11}")

set(AppleClang_CXX98 "${_cmake_oldestSupported} && __cplusplus >= 199711L")
set(_cmake_feature_test_cxx_template_template_parameters "${AppleClang_CXX98}")


code:
include(Compiler/Clang)
__compiler_clang(CXX)

set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)

if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
  if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
      AND CMAKE_GENERATOR MATCHES "Makefiles"
      AND CMAKE_DEPFILE_FLAGS_CXX)
    # dependencies are computed by the compiler itself
    set(CMAKE_CXX_DEPFILE_FORMAT gcc)
    set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
  endif()

  set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
endif()

if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
  set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
  set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
  set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)

  set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
  set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
endif()

if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
  set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
  set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
  set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
  # AppleClang 5.0 knows this flag, but does not set a __cplusplus macro greater than 201103L
  set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
  set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
  set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
endif()

if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
  set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
  set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
  set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++1z")
  set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
endif()

if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
    set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
endif()

if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0)
  set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20")
  set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
  set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++2a")
  set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a")
endif()

if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0)
  set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-std=c++2b")
  set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-std=gnu++2b")
endif()

__compiler_check_default_language_standard(CXX 4.0 98)


code:
set(_compiler_id_pp_test "defined(__clang__) && defined(__apple_build_version__)")

include("${CMAKE_CURRENT_LIST_DIR}/Clang-DetermineCompilerInternal.cmake")

string(APPEND _compiler_id_version_compute "
# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__apple_build_version__)")


code:
include(Compiler/Clang-OBJC)

if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
    AND CMAKE_GENERATOR MATCHES "Makefiles"
    AND CMAKE_DEPFILE_FLAGS_OBJC)
  # dependencies are computed by the compiler itself
  set(CMAKE_OBJC_DEPFILE_FORMAT gcc)
  set(CMAKE_OBJC_DEPENDS_USE_COMPILER TRUE)
endif()

if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 4.0)
  set(CMAKE_OBJC90_STANDARD_COMPILE_OPTION "-std=c90")
  set(CMAKE_OBJC90_EXTENSION_COMPILE_OPTION "-std=gnu90")
  set(CMAKE_OBJC90_STANDARD__HAS_FULL_SUPPORT ON)

  set(CMAKE_OBJC99_STANDARD_COMPILE_OPTION "-std=c99")
  set(CMAKE_OBJC99_EXTENSION_COMPILE_OPTION "-std=gnu99")
  set(CMAKE_OBJC99_STANDARD__HAS_FULL_SUPPORT ON)

  set(CMAKE_OBJC11_STANDARD_COMPILE_OPTION "-std=c11")
  set(CMAKE_OBJC11_EXTENSION_COMPILE_OPTION "-std=gnu11")
  set(CMAKE_OBJC11_STANDARD__HAS_FULL_SUPPORT ON)
endif()

# AppleClang 10.0 was the oldest compiler available to test C17 support
if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 10.0)
  set(CMAKE_OBJC17_STANDARD_COMPILE_OPTION "-std=c17")
  set(CMAKE_OBJC17_EXTENSION_COMPILE_OPTION "-std=gnu17")
  set(CMAKE_OBJC17_STANDARD__HAS_FULL_SUPPORT ON)
endif()

if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 11.0)
  set(CMAKE_OBJC23_STANDARD_COMPILE_OPTION "-std=c2x")
  set(CMAKE_OBJC23_EXTENSION_COMPILE_OPTION "-std=gnu2x")
  set(CMAKE_OBJC23_STANDARD__HAS_FULL_SUPPORT ON)
endif()

# AppleClang 10.0 was the oldest compiler available to test default C11 support
__compiler_check_default_language_standard(OBJC 4.0 99 10.0 11)


code:
include(Compiler/Clang-OBJCXX)

if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
    AND CMAKE_GENERATOR MATCHES "Makefiles"
    AND CMAKE_DEPFILE_FLAGS_OBJCXX)
  # dependencies are computed by the compiler itself
  set(CMAKE_OBJCXX_DEPFILE_FORMAT gcc)
  set(CMAKE_OBJCXX_DEPENDS_USE_COMPILER TRUE)
endif()

set(CMAKE_OBJCXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")

if(NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 4.0)
  set(CMAKE_OBJCXX98_STANDARD_COMPILE_OPTION "-std=c++98")
  set(CMAKE_OBJCXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
  set(CMAKE_OBJCXX98_STANDARD__HAS_FULL_SUPPORT ON)

  set(CMAKE_OBJCXX11_STANDARD_COMPILE_OPTION "-std=c++11")
  set(CMAKE_OBJCXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
endif()

if(NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 6.1)
  set(CMAKE_OBJCXX14_STANDARD_COMPILE_OPTION "-std=c++14")
  set(CMAKE_OBJCXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
  set(CMAKE_OBJCXX14_STANDARD__HAS_FULL_SUPPORT ON)
elseif(NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 5.1)
  # AppleClang 5.0 knows this flag, but does not set a __cplusplus macro greater than 201103L
  set(CMAKE_OBJCXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
  set(CMAKE_OBJCXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
  set(CMAKE_OBJCXX14_STANDARD__HAS_FULL_SUPPORT ON)
endif()

if (NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 10.0)
  set(CMAKE_OBJCXX17_STANDARD_COMPILE_OPTION "-std=c++17")
  set(CMAKE_OBJCXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
elseif (NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 6.1)
  set(CMAKE_OBJCXX17_STANDARD_COMPILE_OPTION "-std=c++1z")
  set(CMAKE_OBJCXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
endif()

if (NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 8.0)
    set(CMAKE_OBJCXX11_STANDARD__HAS_FULL_SUPPORT ON)
endif()

if (NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 10.0)
  set(CMAKE_OBJCXX20_STANDARD_COMPILE_OPTION "-std=c++2a")
  set(CMAKE_OBJCXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a")
endif()

__compiler_check_default_language_standard(OBJCXX 4.0 98)


code:
set(_compiler_id_pp_test "defined(__BORLANDC__)")

set(_compiler_id_version_compute "
  /* __BORLANDC__ = 0xVRR */
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__BORLANDC__>>8)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__BORLANDC__ & 0xFF)")


code:
# Bruce C Compiler ignores "-g" flag and optimization cannot be
# enabled here (it is implemented only for 8086 target).
string(APPEND CMAKE_C_FLAGS_INIT " -D__CLASSIC_C__")
string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -g -DNDEBUG")

set(CMAKE_C_LINKER_WRAPPER_FLAG "-X")


code: include(Compiler/GNU-Fortran)


code:
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

# This module is shared by multiple languages and compilers; use include guard
if (__COMPILER_CMAKE_COMMON_COMPILER_MACROS)
  return()
endif ()
set(__COMPILER_CMAKE_COMMON_COMPILER_MACROS 1)

# Check that a compiler's language standard is properly detected
# Parameters:
#   lang   - Language to check
#   stdver1 - Minimum version to set a given default for
#   std1    - Default to use for compiler ver >= stdver1
#   stdverN - Minimum version to set a given default for
#   stdN    - Default to use for compiler ver >= stdverN
#
#   The order of stdverN stdN pairs passed as arguments is expected to be in
#   monotonically increasing version order.
#
# Note:
#   This macro can be called with multiple version / std pairs to convey that
#   newer compiler versions may use a newer standard default.
#
# Example:
#   To specify that compiler version 6.1 and newer defaults to C++11 while
#   4.8 <= ver < 6.1 default to C++98, you would call:
#
# __compiler_check_default_language_standard(CXX 4.8 98 6.1 11)
#
macro(__compiler_check_default_language_standard lang stdver1 std1)
  set(__std_ver_pairs "${stdver1};${std1};${ARGN}")
  string(REGEX REPLACE " *; *" " " __std_ver_pairs "${__std_ver_pairs}")
  string(REGEX MATCHALL "[^ ]+ [^ ]+" __std_ver_pairs "${__std_ver_pairs}")

  # If the compiler version is below the threshold of even having CMake
  # support for language standards, then don't bother.
  if (CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL "${stdver1}")
    if (NOT CMAKE_${lang}_COMPILER_FORCED)
      if (NOT CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT OR NOT DEFINED CMAKE_${lang}_EXTENSIONS_COMPUTED_DEFAULT)
        message(FATAL_ERROR "CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT and CMAKE_${lang}_EXTENSIONS_COMPUTED_DEFAULT should be set for ${CMAKE_${lang}_COMPILER_ID} (${CMAKE_${lang}_COMPILER}) version ${CMAKE_${lang}_COMPILER_VERSION}")
      endif ()
      set(CMAKE_${lang}_STANDARD_DEFAULT ${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT})
      set(CMAKE_${lang}_EXTENSIONS_DEFAULT ${CMAKE_${lang}_EXTENSIONS_COMPUTED_DEFAULT})
    else ()
      list(REVERSE __std_ver_pairs)
      foreach (__std_ver_pair IN LISTS __std_ver_pairs)
        string(REGEX MATCH "([^ ]+) (.+)" __std_ver_pair "${__std_ver_pair}")
        set(__stdver ${CMAKE_MATCH_1})
        set(__std ${CMAKE_MATCH_2})
        # Compiler id was forced so just guess the defaults.
        if (CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL __stdver)
          if(NOT DEFINED CMAKE_${lang}_EXTENSIONS_DEFAULT)
            # Currently known compilers default to enabling extensions.
            set(CMAKE_${lang}_EXTENSIONS_DEFAULT ON)
          endif()
          if(NOT DEFINED CMAKE_${lang}_STANDARD_DEFAULT)
            set(CMAKE_${lang}_STANDARD_DEFAULT ${__std})
          endif()
        endif ()
        unset(__std)
        unset(__stdver)
      endforeach ()
    endif ()
  endif ()
  unset(__std_ver_pairs)
endmacro()

# Define to allow compile features to be automatically determined
macro(cmake_record_c_compile_features)
  set(_result 0)
  if(_result EQUAL 0 AND DEFINED CMAKE_C23_STANDARD_COMPILE_OPTION)
    _has_compiler_features_c(23)
  endif()
  if(_result EQUAL 0 AND DEFINED CMAKE_C17_STANDARD_COMPILE_OPTION)
    _has_compiler_features_c(17)
  endif()
  if(_result EQUAL 0 AND DEFINED CMAKE_C11_STANDARD_COMPILE_OPTION)
    if(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT)
      _has_compiler_features_c(11)
    else()
      _record_compiler_features_c(11)
    endif()
    unset(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT)
  endif()
  if(_result EQUAL 0 AND DEFINED CMAKE_C99_STANDARD_COMPILE_OPTION)
    if(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT)
      _has_compiler_features_c(99)
    else()
      _record_compiler_features_c(99)
    endif()
    unset(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT)
  endif()
  if(_result EQUAL 0 AND DEFINED CMAKE_C90_STANDARD_COMPILE_OPTION)
    if(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT)
      _has_compiler_features_c(90)
    else()
      _record_compiler_features_c(90)
    endif()
    unset(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT)
  endif()
endmacro()

# Define to allow compile features to be automatically determined
macro(cmake_record_cxx_compile_features)
  set(_result 0)
  if(_result EQUAL 0 AND DEFINED CMAKE_CXX23_STANDARD_COMPILE_OPTION)
    _has_compiler_features_cxx(23)
  endif()
  if(_result EQUAL 0 AND DEFINED CMAKE_CXX20_STANDARD_COMPILE_OPTION)
    _has_compiler_features_cxx(20)
  endif()
  if(_result EQUAL 0 AND DEFINED CMAKE_CXX17_STANDARD_COMPILE_OPTION)
    _has_compiler_features_cxx(17)
  endif()
  if(_result EQUAL 0 AND DEFINED CMAKE_CXX14_STANDARD_COMPILE_OPTION)
    if(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT)
      _has_compiler_features_cxx(14)
    else()
      _record_compiler_features_cxx(14)
    endif()
    unset(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT)
  endif()
  if(_result EQUAL 0 AND DEFINED CMAKE_CXX11_STANDARD_COMPILE_OPTION)
    if(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT)
      _has_compiler_features_cxx(11)
    else()
      _record_compiler_features_cxx(11)
    endif()
    unset(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT)
  endif()
  if(_result EQUAL 0 AND DEFINED CMAKE_CXX98_STANDARD_COMPILE_OPTION)
    if(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT)
      _has_compiler_features_cxx(98)
    else()
      _record_compiler_features_cxx(98)
    endif()
    unset(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT)
  endif()
endmacro()

macro(cmake_record_cuda_compile_features)
  set(_result 0)
  if(_result EQUAL 0 AND DEFINED CMAKE_CUDA23_STANDARD_COMPILE_OPTION)
    _has_compiler_features_cuda(23)
  endif()
  if(_result EQUAL 0 AND DEFINED CMAKE_CUDA20_STANDARD_COMPILE_OPTION)
    _has_compiler_features_cuda(20)
  endif()
  if(_result EQUAL 0 AND DEFINED CMAKE_CUDA17_STANDARD_COMPILE_OPTION)
    _has_compiler_features_cuda(17)
  endif()
  if(_result EQUAL 0 AND DEFINED CMAKE_CUDA14_STANDARD_COMPILE_OPTION)
    if(CMAKE_CUDA14_STANDARD__HAS_FULL_SUPPORT)
      _has_compiler_features_cuda(14)
    else()
      _record_compiler_features_cuda(14)
    endif()
    unset(CMAKE_CUDA14_STANDARD__HAS_FULL_SUPPORT)
  endif()
  if(_result EQUAL 0 AND DEFINED CMAKE_CUDA11_STANDARD_COMPILE_OPTION)
    if(CMAKE_CUDA11_STANDARD__HAS_FULL_SUPPORT)
      _has_compiler_features_cuda(11)
    else()
      _record_compiler_features_cuda(11)
    endif()
    unset(CMAKE_CUDA11_STANDARD__HAS_FULL_SUPPORT)
  endif()
  if(_result EQUAL 0 AND DEFINED CMAKE_CUDA03_STANDARD_COMPILE_OPTION)
    if(CMAKE_CUDA03_STANDARD__HAS_FULL_SUPPORT)
      _has_compiler_features_cuda(03)
    else()
      _record_compiler_features_cuda(03)
    endif()
    unset(CMAKE_CUDA03_STANDARD__HAS_FULL_SUPPORT)
  endif()
endmacro()

macro(cmake_record_hip_compile_features)
  set(_result 0)
  if(_result EQUAL 0 AND DEFINED CMAKE_HIP23_STANDARD_COMPILE_OPTION)
    _has_compiler_features_hip(23)
  endif()
  if(_result EQUAL 0 AND DEFINED CMAKE_HIP20_STANDARD_COMPILE_OPTION)
    _has_compiler_features_hip(20)
  endif()
  if(_result EQUAL 0 AND DEFINED CMAKE_HIP17_STANDARD_COMPILE_OPTION)
    _has_compiler_features_hip(17)
  endif()
  _has_compiler_features_hip(14)
  _has_compiler_features_hip(11)
  _has_compiler_features_hip(98)
endmacro()


code:
include(Compiler/Clang)

set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S;asm)

__compiler_clang(ASM)


code:
set(_cmake_oldestSupported "((__clang_major__ * 100) + __clang_minor__) >= 304")

set(Clang_C11 "${_cmake_oldestSupported} && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L")
set(_cmake_feature_test_c_static_assert "${Clang_C11}")
set(Clang_C99 "${_cmake_oldestSupported} && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L")
set(_cmake_feature_test_c_restrict "${Clang_C99}")
set(_cmake_feature_test_c_variadic_macros "${Clang_C99}")

set(Clang_C90 "${_cmake_oldestSupported}")
set(_cmake_feature_test_c_function_prototypes "${Clang_C90}")


code:
include(Compiler/Clang)
__compiler_clang(C)

cmake_policy(GET CMP0025 appleClangPolicy)
if(APPLE AND NOT appleClangPolicy STREQUAL NEW)
  return()
endif()

if("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")
  set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -TC)
  set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl")
  set(CMAKE_C_INCLUDE_WHAT_YOU_USE_DRIVER_MODE "cl")
  if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
      AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
      AND CMAKE_DEPFILE_FLAGS_C)
    set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
  endif()
elseif("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
  set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
  if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
      AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
      AND CMAKE_DEPFILE_FLAGS_C)
    # dependencies are computed by the compiler itself
    set(CMAKE_C_DEPFILE_FORMAT gcc)
    set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
  endif()
endif()

if("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
  if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 2.1)
    set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
    set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")

    set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
    set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
  endif()

  if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.1)
    set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
    set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
  elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.0)
    set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c1x")
    set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x")
  endif()

  if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0)
    set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
    set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
  endif()

  if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 18.0)
    set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c23")
    set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu23")
  elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)
    set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x")
    set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x")
  endif()
else()
  set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
  set(CMAKE_C90_EXTENSION_COMPILE_OPTION "")
  set(CMAKE_C99_STANDARD_COMPILE_OPTION "")
  set(CMAKE_C99_EXTENSION_COMPILE_OPTION "")

  if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)
    set(CMAKE_C11_STANDARD_COMPILE_OPTION "/std:c11")
    set(CMAKE_C11_EXTENSION_COMPILE_OPTION "/std:c11")

    set(CMAKE_C17_STANDARD_COMPILE_OPTION "/std:c17")
    set(CMAKE_C17_EXTENSION_COMPILE_OPTION "/std:c17")
  else()
    set(CMAKE_C11_STANDARD_COMPILE_OPTION "")
    set(CMAKE_C11_EXTENSION_COMPILE_OPTION "")

    set(CMAKE_C17_STANDARD_COMPILE_OPTION "")
    set(CMAKE_C17_EXTENSION_COMPILE_OPTION "")
  endif()
endif()

if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 2.1)
  set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)
  set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
endif()

if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.0)
  set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
endif()

__compiler_check_default_language_standard(C 2.1 99 3.5.2 11 11.0 17)


code:
include(Compiler/Clang)
__compiler_clang(CUDA)

# Set explicitly, because __compiler_clang() doesn't set this if we're simulating MSVC.
set(CMAKE_DEPFILE_FLAGS_CUDA "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")
if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
    AND CMAKE_GENERATOR MATCHES "Makefiles|WMake")
  # dependencies are computed by the compiler itself
  set(CMAKE_CUDA_DEPFILE_FORMAT gcc)
  set(CMAKE_CUDA_DEPENDS_USE_COMPILER TRUE)
endif()

# C++03 isn't supported for CXX, but is for CUDA, so we need to set these manually.
# Do this before __compiler_clang_cxx_standards() since that adds the feature.
set(CMAKE_CUDA03_STANDARD_COMPILE_OPTION "-std=c++03")
set(CMAKE_CUDA03_EXTENSION_COMPILE_OPTION "-std=gnu++03")
__compiler_clang_cxx_standards(CUDA)

set(CMAKE_CUDA_COMPILER_HAS_DEVICE_LINK_PHASE TRUE)
set(_CMAKE_COMPILE_AS_CUDA_FLAG "-x cuda")
set(_CMAKE_CUDA_WHOLE_FLAG "-c")
set(_CMAKE_CUDA_RDC_FLAG "-fgpu-rdc")
set(_CMAKE_CUDA_PTX_FLAG "--cuda-device-only -S")

# Device linking is just regular linking so these are the same.
set(CMAKE_CUDA_DEVICE_LINKER_WRAPPER_FLAG ${CMAKE_CUDA_LINKER_WRAPPER_FLAG})
set(CMAKE_CUDA_DEVICE_LINKER_WRAPPER_FLAG_SEP ${CMAKE_CUDA_LINKER_WRAPPER_FLAG_SEP})

# RulePlaceholderExpander expands crosscompile variables like sysroot and target only for CMAKE_<LANG>_COMPILER. Override the default.
set(CMAKE_CUDA_LINK_EXECUTABLE "<CMAKE_CUDA_COMPILER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICIT_LINKS}")
set(CMAKE_CUDA_CREATE_SHARED_LIBRARY "<CMAKE_CUDA_COMPILER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICIT_LINKS}")

set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC")
set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "cudadevrt;cudart_static")
set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_SHARED "cudadevrt;cudart")
set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_NONE   "")

# Clang doesn't support CUDA device LTO
set(_CMAKE_CUDA_IPO_SUPPORTED_BY_CMAKE NO)
set(_CMAKE_CUDA_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO)

if(UNIX)
  list(APPEND CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "rt" "pthread" "dl")
endif()


code:
# Reference: http://clang.llvm.org/cxx_status.html
# http://clang.llvm.org/docs/LanguageExtensions.html

set(_cmake_oldestSupported "((__clang_major__ * 100) + __clang_minor__) >= 301")

include("${CMAKE_CURRENT_LIST_DIR}/Clang-CXX-TestableFeatures.cmake")

set(Clang34_CXX14 "((__clang_major__ * 100) + __clang_minor__) >= 304 && __cplusplus > 201103L")
# http://llvm.org/bugs/show_bug.cgi?id=19242
set(_cmake_feature_test_cxx_attribute_deprecated "${Clang34_CXX14}")
# http://llvm.org/bugs/show_bug.cgi?id=19698
set(_cmake_feature_test_cxx_decltype_auto "${Clang34_CXX14}")
set(_cmake_feature_test_cxx_digit_separators "${Clang34_CXX14}")
# http://llvm.org/bugs/show_bug.cgi?id=19674
set(_cmake_feature_test_cxx_generic_lambdas "${Clang34_CXX14}")

set(Clang31_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L")
set(_cmake_feature_test_cxx_enum_forward_declarations "${Clang31_CXX11}")
set(_cmake_feature_test_cxx_sizeof_member "${Clang31_CXX11}")
# TODO: Should be supported by Clang 2.9
set(Clang29_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L")
set(_cmake_feature_test_cxx_extended_friend_declarations "${Clang29_CXX11}")
set(_cmake_feature_test_cxx_extern_templates "${Clang29_CXX11}")
set(_cmake_feature_test_cxx_func_identifier "${Clang29_CXX11}")
set(_cmake_feature_test_cxx_inline_namespaces "${Clang29_CXX11}")
set(_cmake_feature_test_cxx_long_long_type "${Clang29_CXX11}")
set(_cmake_feature_test_cxx_right_angle_brackets "${Clang29_CXX11}")
set(_cmake_feature_test_cxx_variadic_macros "${Clang29_CXX11}")

# TODO: Should be supported forever?
set(Clang_CXX98 "${_cmake_oldestSupported} && __cplusplus >= 199711L")
set(_cmake_feature_test_cxx_template_template_parameters "${Clang_CXX98}")


code:
set(testable_features
  cxx_alias_templates
  cxx_alignas
  cxx_attributes
  cxx_auto_type
  cxx_binary_literals
  cxx_constexpr
  cxx_contextual_conversions
  cxx_decltype
  cxx_default_function_template_args
  cxx_defaulted_functions
  cxx_delegating_constructors
  cxx_deleted_functions
  cxx_explicit_conversions
  cxx_generalized_initializers
  cxx_inheriting_constructors
  cxx_lambdas
  cxx_local_type_template_args
  cxx_noexcept
  cxx_nonstatic_member_init
  cxx_nullptr
  cxx_range_for
  cxx_raw_string_literals
  cxx_reference_qualified_functions
  cxx_relaxed_constexpr
  cxx_return_type_deduction
  cxx_rvalue_references
  cxx_static_assert
  cxx_strong_enums
  cxx_thread_local
  cxx_unicode_literals
  cxx_unrestricted_unions
  cxx_user_literals
  cxx_variable_templates
  cxx_variadic_templates
)
if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
  list(APPEND testable_features cxx_decltype_incomplete_return_types)
endif()

foreach(feature ${testable_features})
  set(_cmake_feature_test_${feature} "${_cmake_oldestSupported} && __has_feature(${feature})")
endforeach()

unset(testable_features)

set(_cmake_feature_test_cxx_aggregate_default_initializers "${_cmake_oldestSupported} && __has_feature(cxx_aggregate_nsdmi)")

set(_cmake_feature_test_cxx_trailing_return_types "${_cmake_oldestSupported} && __has_feature(cxx_trailing_return)")
set(_cmake_feature_test_cxx_alignof "${_cmake_oldestSupported} && __has_feature(cxx_alignas)")
set(_cmake_feature_test_cxx_final "${_cmake_oldestSupported} && __has_feature(cxx_override_control)")
set(_cmake_feature_test_cxx_override "${_cmake_oldestSupported} && __has_feature(cxx_override_control)")
set(_cmake_feature_test_cxx_uniform_initialization "${_cmake_oldestSupported} && __has_feature(cxx_generalized_initializers)")
set(_cmake_feature_test_cxx_defaulted_move_initializers "${_cmake_oldestSupported} && __has_feature(cxx_defaulted_functions)")
set(_cmake_feature_test_cxx_lambda_init_captures "${_cmake_oldestSupported} && __has_feature(cxx_init_captures)")


code:
include(Compiler/Clang)
__compiler_clang(CXX)
__compiler_clang_cxx_standards(CXX)

if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
  if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
      AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
      AND CMAKE_DEPFILE_FLAGS_CXX)
    # dependencies are computed by the compiler itself
    set(CMAKE_CXX_DEPFILE_FORMAT gcc)
    set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
  endif()

  set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
  set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
endif()

cmake_policy(GET CMP0025 appleClangPolicy)
if(APPLE AND NOT appleClangPolicy STREQUAL NEW)
  return()
endif()

if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")
  set(CMAKE_CXX_CLANG_TIDY_DRIVER_MODE "cl")
  set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE_DRIVER_MODE "cl")
  if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
      AND CMAKE_GENERATOR MATCHES "Makefiles"
      AND CMAKE_DEPFILE_FLAGS_CXX)
    set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
  endif()
endif()

if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)
  if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
    if (CMAKE_CXX_COMPILER_CLANG_RESOURCE_DIR)
      set(_clang_scan_deps_resource_dir
        " -resource-dir \"${CMAKE_CXX_COMPILER_CLANG_RESOURCE_DIR}\"")
    else()
      set(_clang_scan_deps_resource_dir "")
    endif ()
    if (CMAKE_HOST_WIN32)
      # `rename` doesn't overwrite and doesn't retry in case of "target file is
      # busy".
      set(_clang_scan_deps_mv "\"${CMAKE_COMMAND}\" -E rename")
    else ()
      set(_clang_scan_deps_mv "mv")
    endif ()
    string(CONCAT CMAKE_CXX_SCANDEP_SOURCE
      "\"${CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS}\""
      " -format=p1689"
      " --"
      " <CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS>"
      " -x c++ <SOURCE> -c -o <OBJECT>"
      "${_clang_scan_deps_resource_dir}"
      " -MT <DYNDEP_FILE>"
      " -MD -MF <DEP_FILE>"
      # Write to a temporary file. If the scan fails, we do not want to update
      # the actual output file as `ninja` (at least) assumes that failed
      # commands either delete or leave output files alone. See Issue#25419.
      " > <DYNDEP_FILE>.tmp"
      # We cannot use `copy_if_different` as the rule does not have a feature
      # analogous to `ninja`'s `restat = 1`. It would also leave behind the
      # `.tmp` file.
      " && ${_clang_scan_deps_mv} <DYNDEP_FILE>.tmp <DYNDEP_FILE>")
    unset(_clang_scan_deps_resource_dir)
    unset(_clang_scan_deps_mv)
    set(CMAKE_CXX_MODULE_MAP_FORMAT "clang")
    set(CMAKE_CXX_MODULE_MAP_FLAG "@<MODULE_MAP_FILE>")
    set(CMAKE_CXX_MODULE_BMI_ONLY_FLAG "--precompile")
  endif()
endif()


code:
set(_compiler_id_version_compute "
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__clang_major__)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__clang_minor__)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__clang_patchlevel__)
# if defined(_MSC_VER)
   /* _MSC_VER = VVRR */
#  define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100)
#  define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100)
# endif")

set(_compiler_id_simulate "
# if defined(_MSC_VER)
#  define @PREFIX@SIMULATE_ID \"MSVC\"
# endif")


code:
if(NOT DEFINED _CMAKE_PROCESSING_LANGUAGE OR _CMAKE_PROCESSING_LANGUAGE STREQUAL "")
  message(FATAL_ERROR "Internal error: _CMAKE_PROCESSING_LANGUAGE is not set")
endif()

# Ubuntu:
# * /usr/bin/llvm-ar-9
# * /usr/bin/llvm-ranlib-9
string(REGEX MATCH "^([0-9]+)" __version_x
    "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}")

# Debian:
# * /usr/bin/llvm-ar-4.0
# * /usr/bin/llvm-ranlib-4.0
string(REGEX MATCH "^([0-9]+\\.[0-9]+)" __version_x_y
    "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}")

# Try to find tools in the same directory as Clang itself
get_filename_component(__clang_hint_1 "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER}" REALPATH)
get_filename_component(__clang_hint_1 "${__clang_hint_1}" DIRECTORY)

get_filename_component(__clang_hint_2 "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER}" DIRECTORY)

set(__clang_hints ${__clang_hint_1} ${__clang_hint_2})

# http://manpages.ubuntu.com/manpages/precise/en/man1/llvm-ar.1.html
find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR NAMES
    "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar-${__version_x_y}"
    "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar-${__version_x}"
    "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar${__version_x}"
    "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar"
    HINTS ${__clang_hints}
    NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH
    DOC "LLVM archiver"
)
mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR)

# http://manpages.ubuntu.com/manpages/precise/en/man1/llvm-ranlib.1.html
find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB NAMES
    "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib-${__version_x_y}"
    "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib-${__version_x}"
    "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib${__version_x}"
    "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib"
    HINTS ${__clang_hints}
    NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH
    DOC "Generate index for LLVM archive"
)
mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB)

# clang-scan-deps
find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_CLANG_SCAN_DEPS NAMES
    "${_CMAKE_TOOLCHAIN_PREFIX}clang-scan-deps-${__version_x_y}"
    "${_CMAKE_TOOLCHAIN_PREFIX}clang-scan-deps-${__version_x}"
    "${_CMAKE_TOOLCHAIN_PREFIX}clang-scan-deps${__version_x}"
    "${_CMAKE_TOOLCHAIN_PREFIX}clang-scan-deps"
    HINTS ${__clang_hints}
    NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH
    DOC "`clang-scan-deps` dependency scanner"
)
mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_CLANG_SCAN_DEPS)


code:
include(Compiler/Clang)

__compiler_clang(HIP)
__compiler_clang_cxx_standards(HIP)

set(_CMAKE_COMPILE_AS_HIP_FLAG "-x hip")
set(_CMAKE_HIP_RDC_FLAG "-fgpu-rdc")

if(NOT "x${CMAKE_HIP_SIMULATE_ID}" STREQUAL "xMSVC")
  set(CMAKE_HIP_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")

  string(APPEND CMAKE_HIP_FLAGS_DEBUG_INIT " -O")
endif()

set(CMAKE_HIP_RUNTIME_LIBRARY_DEFAULT "SHARED")
set(CMAKE_HIP_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC  "")
set(CMAKE_HIP_RUNTIME_LIBRARY_LINK_OPTIONS_SHARED  "")

# Populated by CMakeHIPInformation.cmake
set(CMAKE_HIP_RUNTIME_LIBRARIES_STATIC "")
set(CMAKE_HIP_RUNTIME_LIBRARIES_SHARED "")


code:
include(Compiler/Clang)
__compiler_clang(OBJC)

if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
    AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
    AND CMAKE_DEPFILE_FLAGS_OBJC)
  # dependencies are computed by the compiler itself
  set(CMAKE_OBJC_DEPFILE_FORMAT gcc)
  set(CMAKE_OBJC_DEPENDS_USE_COMPILER TRUE)
endif()

if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 3.4)
  set(CMAKE_OBJC90_STANDARD_COMPILE_OPTION "-std=c90")
  set(CMAKE_OBJC90_EXTENSION_COMPILE_OPTION "-std=gnu90")
  set(CMAKE_OBJC90_STANDARD__HAS_FULL_SUPPORT ON)

  set(CMAKE_OBJC99_STANDARD_COMPILE_OPTION "-std=c99")
  set(CMAKE_OBJC99_EXTENSION_COMPILE_OPTION "-std=gnu99")
  set(CMAKE_OBJC99_STANDARD__HAS_FULL_SUPPORT ON)

  set(CMAKE_OBJC11_STANDARD_COMPILE_OPTION "-std=c11")
  set(CMAKE_OBJC11_EXTENSION_COMPILE_OPTION "-std=gnu11")
  set(CMAKE_OBJC11_STANDARD__HAS_FULL_SUPPORT ON)
endif()

if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 6.0)
  set(CMAKE_OBJC17_STANDARD_COMPILE_OPTION "-std=c17")
  set(CMAKE_OBJC17_EXTENSION_COMPILE_OPTION "-std=gnu17")
  set(CMAKE_OBJC17_STANDARD__HAS_FULL_SUPPORT ON)
endif()

if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 9.0)
  set(CMAKE_OBJC23_STANDARD_COMPILE_OPTION "-std=c2x")
  set(CMAKE_OBJC23_EXTENSION_COMPILE_OPTION "-std=gnu2x")
  set(CMAKE_OBJC23_STANDARD__HAS_FULL_SUPPORT ON)
endif()

__compiler_check_default_language_standard(OBJC 3.4 99 3.6 11)


code:
include(Compiler/Clang)
__compiler_clang(OBJCXX)
__compiler_clang_cxx_standards(OBJCXX)

if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
    AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
    AND CMAKE_DEPFILE_FLAGS_OBJCXX)
  # dependencies are computed by the compiler itself
  set(CMAKE_OBJCXX_DEPFILE_FORMAT gcc)
  set(CMAKE_OBJCXX_DEPENDS_USE_COMPILER TRUE)
endif()


code:
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

# This module is shared by multiple languages; use include blocker.
if(__COMPILER_CLANG)
  return()
endif()
set(__COMPILER_CLANG 1)

include(Compiler/CMakeCommonCompilerMacros)

set(__pch_header_C "c-header")
set(__pch_header_CXX "c++-header")
set(__pch_header_OBJC "objective-c-header")
set(__pch_header_OBJCXX "objective-c++-header")

if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
    OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"
    OR "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC"
    OR "x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC")
  macro(__compiler_clang lang)
  endmacro()
else()
  include(Compiler/GNU)

  macro(__compiler_clang lang)
    __compiler_gnu(${lang})
    set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
    # Link options for PIE are already set in 'Compiler/GNU.cmake'
    # but clang may require alternate syntax on some platforms
    if (APPLE)
      set(CMAKE_${lang}_LINK_OPTIONS_PIE ${CMAKE_${lang}_COMPILE_OPTIONS_PIE} -Xlinker -pie)
      set(CMAKE_${lang}_LINK_OPTIONS_NO_PIE -Xlinker -no_pie)
    endif()
    set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
    set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
    if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4.0)
      set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-target ")
      set(CMAKE_${lang}_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN "-gcc-toolchain ")
    else()
      set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "--target=")
      set(CMAKE_${lang}_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN "--gcc-toolchain=")
    endif()
    set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Xlinker" " ")
    set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP)

    if(CMAKE_${lang}_COMPILER_TARGET AND "${lang}" STREQUAL "CXX")
      if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4.0)
        list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-target" "${CMAKE_${lang}_COMPILER_TARGET}")
      else()
        list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "--target=${CMAKE_${lang}_COMPILER_TARGET}")
      endif()
    endif()

    set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
    set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)

    string(COMPARE EQUAL "${CMAKE_${lang}_COMPILER_ID}" "AppleClang" __is_apple_clang)
    string(COMPARE EQUAL "${CMAKE_${lang}_COMPILER_ID}" "FujitsuClang" __is_fujitsu_clang)

    # '-flto=thin' available since Clang 3.9 and Xcode 8
    # * http://clang.llvm.org/docs/ThinLTO.html#clang-llvm
    # * https://trac.macports.org/wiki/XcodeVersionInfo
    set(_CMAKE_LTO_THIN TRUE)
    if(__is_apple_clang)
      if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 8.0)
        set(_CMAKE_LTO_THIN FALSE)
      endif()
    elseif(__is_fujitsu_clang)
      set(_CMAKE_LTO_THIN FALSE)
    else()
      if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.9)
        set(_CMAKE_LTO_THIN FALSE)
      endif()
    endif()

    if(_CMAKE_LTO_THIN)
      set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto=thin")
    else()
      set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto")
    endif()

    if(ANDROID AND NOT CMAKE_ANDROID_NDK_VERSION VERSION_GREATER_EQUAL "22")
      # https://github.com/android-ndk/ndk/issues/242
      set(CMAKE_${lang}_LINK_OPTIONS_IPO "-fuse-ld=gold")
    endif()

    if(ANDROID OR __is_apple_clang)
      set(__ar "${CMAKE_AR}")
      set(__ranlib "${CMAKE_RANLIB}")
    else()
      set(__ar "${CMAKE_${lang}_COMPILER_AR}")
      set(__ranlib "${CMAKE_${lang}_COMPILER_RANLIB}")
    endif()

    set(CMAKE_${lang}_ARCHIVE_CREATE_IPO
      "\"${__ar}\" qc <TARGET> <LINK_FLAGS> <OBJECTS>"
    )

    set(CMAKE_${lang}_ARCHIVE_APPEND_IPO
      "\"${__ar}\" q <TARGET> <LINK_FLAGS> <OBJECTS>"
    )

    set(CMAKE_${lang}_ARCHIVE_FINISH_IPO
      "\"${__ranlib}\" <TARGET>"
    )

    set(CMAKE_PCH_EXTENSION .pch)
    if (NOT CMAKE_GENERATOR MATCHES "Xcode")
      set(CMAKE_PCH_PROLOGUE "#pragma clang system_header")
    endif()
    if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0.0 AND NOT __is_apple_clang)
      set(CMAKE_${lang}_COMPILE_OPTIONS_INSTANTIATE_TEMPLATES_PCH -fpch-instantiate-templates)
    endif()
    set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE> -Xclang -include -Xclang <PCH_HEADER>)
    set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER> -x ${__pch_header_${lang}})

    # '-fcolor-diagnostics' introduced since Clang 2.6
    if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 2.6)
      # -fansi-escape-codes mentioned at https://releases.llvm.org/3.7.0/tools/clang/docs/UsersManual.html
      if (CMAKE_HOST_WIN32 AND CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 3.7)
        set(CMAKE_${lang}_COMPILE_OPTIONS_COLOR_DIAGNOSTICS -fansi-escape-codes -fcolor-diagnostics)
        set(CMAKE_${lang}_COMPILE_OPTIONS_COLOR_DIAGNOSTICS_OFF -fno-ansi-escape-codes  -fno-color-diagnostics)
      else()
        set(CMAKE_${lang}_COMPILE_OPTIONS_COLOR_DIAGNOSTICS -fcolor-diagnostics)
        set(CMAKE_${lang}_COMPILE_OPTIONS_COLOR_DIAGNOSTICS_OFF -fno-color-diagnostics)
      endif()
    endif()
  endmacro()
endif()

macro(__compiler_clang_cxx_standards lang)
  if("x${CMAKE_${lang}_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
    if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 2.1)
      set(CMAKE_${lang}98_STANDARD_COMPILE_OPTION "-std=c++98")
      set(CMAKE_${lang}98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
    endif()

    if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.1)
      set(CMAKE_${lang}98_STANDARD__HAS_FULL_SUPPORT ON)
      set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "-std=c++11")
      set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
      set(CMAKE_${lang}11_STANDARD__HAS_FULL_SUPPORT ON)
    elseif(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 2.1)
      set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "-std=c++0x")
      set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "-std=gnu++0x")
    endif()

    if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.5)
      set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "-std=c++14")
      set(CMAKE_${lang}14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
      set(CMAKE_${lang}14_STANDARD__HAS_FULL_SUPPORT ON)
    elseif(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4)
      set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "-std=c++1y")
      set(CMAKE_${lang}14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
      set(CMAKE_${lang}14_STANDARD__HAS_FULL_SUPPORT ON)
    endif()

    set(_clang_version_std17 5.0)
    if(CMAKE_SYSTEM_NAME STREQUAL "Android")
      set(_clang_version_std17 6.0)
    endif()

    if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS "${_clang_version_std17}")
      set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std=c++17")
      set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
    elseif (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.5)
      set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std=c++1z")
      set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
    endif()

    if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 11.0)
      set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std=c++20")
      set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
    elseif(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS "${_clang_version_std17}")
      set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std=c++2a")
      set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std=gnu++2a")
    endif()

    unset(_clang_version_std17)

    set(_clang_version_std23 17.0)
    if(CMAKE_SYSTEM_NAME STREQUAL "Android")
      set(_clang_version_std23 18.0)
    endif()

    if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS "${_clang_version_std23}")
      set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std=c++23")
      set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std=gnu++23")
      set(CMAKE_${lang}26_STANDARD_COMPILE_OPTION "-std=c++26")
      set(CMAKE_${lang}26_EXTENSION_COMPILE_OPTION "-std=gnu++26")
    elseif(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0)
      set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std=c++2b")
      set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std=gnu++2b")
    endif()

    unset(_clang_version_std23)

    if("x${CMAKE_${lang}_SIMULATE_ID}" STREQUAL "xMSVC")
      # The MSVC standard library requires C++14, and MSVC itself has no
      # notion of operating in a mode not aware of at least that standard.
      set(CMAKE_${lang}98_STANDARD_COMPILE_OPTION "-std=c++14")
      set(CMAKE_${lang}98_EXTENSION_COMPILE_OPTION "-std=gnu++14")
      set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "-std=c++14")
      set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "-std=gnu++14")

      # This clang++ is missing some features because of MSVC compatibility.
      unset(CMAKE_${lang}11_STANDARD__HAS_FULL_SUPPORT)
      unset(CMAKE_${lang}14_STANDARD__HAS_FULL_SUPPORT)
    endif()

    __compiler_check_default_language_standard(${lang} 2.1 98)
  elseif(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 3.9
      AND CMAKE_${lang}_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.0)
    # This version of clang-cl and the MSVC version it simulates have
    # support for -std: flags.
    set(CMAKE_${lang}98_STANDARD_COMPILE_OPTION "")
    set(CMAKE_${lang}98_EXTENSION_COMPILE_OPTION "")
    set(CMAKE_${lang}98_STANDARD__HAS_FULL_SUPPORT ON)
    set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "")
    set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "")
    set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "-std:c++14")
    set(CMAKE_${lang}14_EXTENSION_COMPILE_OPTION "-std:c++14")

    if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0)
      set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std:c++17")
      set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std:c++17")
    else()
      set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std:c++latest")
      set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std:c++latest")
    endif()

    if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)
      set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std:c++latest")
      set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std:c++latest")
      set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std:c++20")
      set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std:c++20")
    elseif(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0)
      set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std:c++latest")
      set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std:c++latest")
    endif()

    __compiler_check_default_language_standard(${lang} 3.9 14)
  else()
    # This version of clang-cl, or the MSVC version it simulates, does not have
    # language standards.  Set these options as empty strings so the feature
    # test infrastructure can at least check to see if they are defined.
    set(CMAKE_${lang}98_STANDARD_COMPILE_OPTION "")
    set(CMAKE_${lang}98_EXTENSION_COMPILE_OPTION "")
    set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "")
    set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "")
    set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "")
    set(CMAKE_${lang}14_EXTENSION_COMPILE_OPTION "")
    set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "")
    set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "")
    set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "")
    set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "")
    set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "")
    set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "")

    # There is no meaningful default for this
    set(CMAKE_${lang}_STANDARD_DEFAULT "")

    # There are no compiler modes so we only need to test features once.
    # Override the default macro for this special case.  Pretend that
    # all language standards are available so that at least compilation
    # can be attempted.
    macro(cmake_record_${lang}_compile_features)
      list(APPEND CMAKE_${lang}_COMPILE_FEATURES
        cxx_std_98
        cxx_std_11
        cxx_std_14
        cxx_std_17
        cxx_std_20
        cxx_std_23
        cxx_std_26
        )
      _record_compiler_features(${lang} "" CMAKE_${lang}_COMPILE_FEATURES)
    endmacro()
  endif()
endmacro()


code:
set(_compiler_id_pp_test "defined(__DECC)")

set(_compiler_id_version_compute "
  /* __DECC_VER = VVRRTPPPP */
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__DECC_VER/10000000)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__DECC_VER/100000  % 100)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__DECC_VER         % 10000)")


code:
set(_compiler_id_pp_test "defined(__DECCXX)")

set(_compiler_id_version_compute "
  /* __DECCXX_VER = VVRRTPPPP */
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__DECCXX_VER/10000000)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__DECCXX_VER/100000  % 100)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__DECCXX_VER         % 10000)")


code:
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

include(Compiler/Cray)
__compiler_cray(C)

string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")

if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)
  set(CMAKE_C90_STANDARD_COMPILE_OPTION  -h noc99,conform)
  set(CMAKE_C90_EXTENSION_COMPILE_OPTION -h noc99,gnu)
  set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)
  set(CMAKE_C99_STANDARD_COMPILE_OPTION  -h c99,conform)
  set(CMAKE_C99_EXTENSION_COMPILE_OPTION -h c99,gnu)
  set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
  if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.5)
    set(CMAKE_C11_STANDARD_COMPILE_OPTION  -h std=c11,conform)
    set(CMAKE_C11_EXTENSION_COMPILE_OPTION -h std=c11,gnu)
    set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
  endif ()
endif ()

__compiler_check_default_language_standard(C 8.1 99)


code:
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

include(Compiler/Cray)
__compiler_cray(CXX)

string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG")

if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)
  set(CMAKE_CXX98_STANDARD_COMPILE_OPTION  -h conform)
  set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -h gnu)
  set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.4)
    set(CMAKE_CXX11_STANDARD_COMPILE_OPTION  -h std=c++11)
    set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -h std=c++11,gnu)
    set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
  endif()
  if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.6)
    set(CMAKE_CXX14_STANDARD_COMPILE_OPTION  -h std=c++14)
    set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION -h std=c++14,gnu)
    set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
  endif ()
endif ()

__compiler_check_default_language_standard(CXX 8.1 98)


code:
set(_compiler_id_pp_test "defined(_CRAYC)")

set(_compiler_id_version_compute "
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_RELEASE_MAJOR)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_RELEASE_MINOR)")


code:
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

include(Compiler/Cray)
__compiler_cray(Fortran)

set(CMAKE_Fortran_SUBMODULE_SEP "")
set(CMAKE_Fortran_SUBMODULE_EXT ".mod")
set(CMAKE_Fortran_MODOUT_FLAG -em)
set(CMAKE_Fortran_MODDIR_FLAG -J)
set(CMAKE_Fortran_MODDIR_DEFAULT .)
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-f fixed")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-f free")

if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 8.5)
  set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-eT")
  set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-dT")
else()
  set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-eZ")
  set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-dZ")
endif()

if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 11.0)
  set(CMAKE_Fortran_PREPROCESS_SOURCE "<CMAKE_Fortran_COMPILER> -o <PREPROCESSED_SOURCE> <DEFINES> <INCLUDES> <FLAGS> -eP <SOURCE>")
endif()


code:
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

# This module is shared by multiple languages; use include blocker.
if(__COMPILER_CRAY)
  return()
endif()
set(__COMPILER_CRAY 1)

include(Compiler/CMakeCommonCompilerMacros)

macro(__compiler_cray lang)
  set(CMAKE_${lang}_VERBOSE_FLAG "-v")
  set(CMAKE_${lang}_COMPILE_OPTIONS_PIC -h PIC)
  set(CMAKE_${lang}_COMPILE_OPTIONS_PIE -h PIC)
  set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-h PIC")
endmacro()


code:
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

include(Compiler/CrayClang)
__compiler_cray_clang(C)

set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)

string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")

set(CMAKE_C90_STANDARD_COMPILE_OPTION  -std=c90)
set(CMAKE_C90_EXTENSION_COMPILE_OPTION -std=gnu90)
set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)

set(CMAKE_C99_STANDARD_COMPILE_OPTION  -std=c99)
set(CMAKE_C99_EXTENSION_COMPILE_OPTION -std=gnu99)
set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)

set(CMAKE_C11_STANDARD_COMPILE_OPTION  -std=c11)
set(CMAKE_C11_EXTENSION_COMPILE_OPTION -std=gnu11)
set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)

set(CMAKE_C17_STANDARD_COMPILE_OPTION  -std=c17)
set(CMAKE_C17_EXTENSION_COMPILE_OPTION -std=gnu17)

set(CMAKE_C23_STANDARD_COMPILE_OPTION  -std=c2x)
set(CMAKE_C23_EXTENSION_COMPILE_OPTION -std=gnu2x)

__compiler_check_default_language_standard(C 15.0.0 17)


code:
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

include(Compiler/CrayClang)
__compiler_cray_clang(CXX)

set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")

string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG")

set(CMAKE_CXX98_STANDARD_COMPILE_OPTION  -std=c++98)
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -std=gnu++98)
set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)

set(CMAKE_CXX11_STANDARD_COMPILE_OPTION  -std=c++11)
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -std=gnu++11)
set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)

set(CMAKE_CXX14_STANDARD_COMPILE_OPTION  -std=c++14)
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION -std=gnu++14)
set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)

set(CMAKE_CXX17_STANDARD_COMPILE_OPTION  -std=c++17)
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION -std=gnu++17)

set(CMAKE_CXX20_STANDARD_COMPILE_OPTION  -std=c++20)
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION -std=gnu++20)

set(CMAKE_CXX23_STANDARD_COMPILE_OPTION  -std=c++2b)
set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION -std=gnu++2b)

__compiler_check_default_language_standard(CXX 15.0.0 14)


code:
set(_compiler_id_pp_test "defined(__clang__) && defined(__cray__)")

set(_compiler_id_version_compute "
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__cray_major__)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__cray_minor__)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__cray_patchlevel__)
# define @PREFIX@COMPILER_VERSION_INTERNAL_STR __clang_version__
")


code:
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

# This module is shared by multiple languages; use include blocker.
if(__COMPILER_CRAYCLANG)
  return()
endif()
set(__COMPILER_CRAYCLANG 1)

include(Compiler/Clang)

macro (__compiler_cray_clang lang)
  set(__crayclang_ver "${CMAKE_${lang}_COMPILER_VERSION}")
  set("CMAKE_${lang}_COMPILER_VERSION" "${CMAKE_${lang}_COMPILER_VERSION_INTERNAL}")
  __compiler_clang(${lang})
  set("CMAKE_${lang}_COMPILER_VERSION" "${__crayclang_ver}")
endmacro ()


code:
if(__craylinux_crayprgenv_c)
  return()
endif()
set(__craylinux_crayprgenv_c 1)

include(Compiler/CrayPrgEnv)
__CrayPrgEnv_setup(C)


code:
if(__craylinux_crayprgenv_cxx)
  return()
endif()
set(__craylinux_crayprgenv_cxx 1)

include(Compiler/CrayPrgEnv)
__CrayPrgEnv_setup(CXX)


code:
if(__craylinux_crayprgenv_fortran)
  return()
endif()
set(__craylinux_crayprgenv_fortran 1)

include(Compiler/CrayPrgEnv)
__CrayPrgEnv_setup(Fortran)


code:
# Guard against multiple inclusions
if(__cmake_craype_crayprgenv)
  return()
endif()
set(__cmake_craype_crayprgenv 1)

# CrayPrgEnv: loaded when compiling through the Cray compiler wrapper.
# The compiler wrapper can run on a front-end node or a compute node.

cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW)  # if IN_LIST

# One-time setup of the craype environment.  First, check the wrapper config.
# The wrapper's selection of a compiler (gcc, clang, intel, etc.) and
# default include/library paths is selected using the "module" command.
# The CRAYPE_LINK_TYPE environment variable partly controls if static
# or dynamic binaries are generated (see __cmake_craype_linktype below).
# Running cmake and then changing module and/or linktype configuration
# may cause build problems (since the data in the cmake cache may no
# longer be correct after the change).  We can look for this and warn
# the user about it.  Second, use the "module" provided PKG_CONFIG_PATH-like
# environment variable to add additional prefixes to the system prefix
# path.
function(__cmake_craype_setupenv)
  if(NOT DEFINED __cmake_craype_setupenv_done)  # only done once per run
    set(__cmake_craype_setupenv_done 1 PARENT_SCOPE)
    unset(__cmake_check)
    set(CMAKE_CRAYPE_LINKTYPE "$ENV{CRAYPE_LINK_TYPE}" CACHE STRING
        "saved value of CRAYPE_LINK_TYPE environment variable")
    set(CMAKE_CRAYPE_LOADEDMODULES "$ENV{LOADEDMODULES}" CACHE STRING
        "saved value of LOADEDMODULES environment variable")
    mark_as_advanced(CMAKE_CRAYPE_LINKTYPE CMAKE_CRAYPE_LOADEDMODULES)
    if (NOT "${CMAKE_CRAYPE_LINKTYPE}" STREQUAL "$ENV{CRAYPE_LINK_TYPE}")
      string(APPEND __cmake_check "CRAYPE_LINK_TYPE ")
    endif()
    if (NOT "${CMAKE_CRAYPE_LOADEDMODULES}" STREQUAL "$ENV{LOADEDMODULES}")
      string(APPEND __cmake_check "LOADEDMODULES ")
    endif()
    if(DEFINED __cmake_check)
      message(STATUS "NOTE: ${__cmake_check}changed since initial config!")
      message(STATUS "NOTE: this may cause unexpected build errors.")
    endif()
    # loop over variables of interest
    foreach(pkgcfgvar PKG_CONFIG_PATH PKG_CONFIG_PATH_DEFAULT
            PE_PKG_CONFIG_PATH)
      file(TO_CMAKE_PATH "$ENV{${pkgcfgvar}}" pkgcfg)
      foreach(path ${pkgcfg})
        string(REGEX REPLACE "(.*)/lib[^/]*/pkgconfig$" "\\1" path "${path}")
        if(NOT "${path}" STREQUAL "" AND
           NOT "${path}" IN_LIST CMAKE_SYSTEM_PREFIX_PATH)
          list(APPEND CMAKE_SYSTEM_PREFIX_PATH "${path}")
        endif()
      endforeach()
    endforeach()
    # push it up out of this function into the parent scope
    set(CMAKE_SYSTEM_PREFIX_PATH "${CMAKE_SYSTEM_PREFIX_PATH}" PARENT_SCOPE)
  endif()
endfunction()

# The wrapper disables dynamic linking by default.  Dynamic linking is
# enabled either by setting $ENV{CRAYPE_LINK_TYPE} to "dynamic" or by
# specifying "-dynamic" to the wrapper when linking.  Specifying "-static"
# to the wrapper when linking takes priority over $ENV{CRAYPE_LINK_TYPE}.
# Furthermore, if you specify multiple "-dynamic" and "-static" flags to
# the wrapper when linking, the last one will win.  In this case, the
# wrapper will also print a warning like:
#  Warning: -dynamic was already seen on command line, overriding with -static.
#
# note that cmake applies both CMAKE_${lang}_FLAGS and CMAKE_EXE_LINKER_FLAGS
# (in that order) to the linking command, so -dynamic can appear in either
# variable.
#
# Note: As of CrayPE v19.06 (which translates to the craype/2.6.0 module)
# the default has changed and is now dynamic by default.  This is handled
# accordingly
function(__cmake_craype_linktype lang rv)
  # start with ENV, but allow flags to override
  if(("$ENV{CRAYPE_VERSION}" STREQUAL "") OR
     ("$ENV{CRAYPE_VERSION}" VERSION_LESS "2.6"))
    if("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic")
      set(linktype dynamic)
    else()
      set(linktype static)
    endif()
  else()
    if("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "static")
      set(linktype static)
    else()
      set(linktype dynamic)
    endif()
  endif()

  # combine flags and convert to a list so we can apply the flags in order
  set(linkflags "${CMAKE_${lang}_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}")
  string(REPLACE " " ";" linkflags "${linkflags}")
  foreach(flag IN LISTS linkflags)
    if("${flag}" STREQUAL "-dynamic")
      set(linktype dynamic)
    elseif("${flag}" STREQUAL "-static")
      set(linktype static)
    endif()
  endforeach()
  set(${rv} ${linktype} PARENT_SCOPE)
endfunction()

macro(__CrayPrgEnv_setup lang)
  if(DEFINED ENV{CRAYPE_VERSION})
    message(STATUS "Cray Programming Environment $ENV{CRAYPE_VERSION} ${lang}")
  elseif(DEFINED ENV{ASYNCPE_VERSION})
    message(STATUS "Cray XT Programming Environment $ENV{ASYNCPE_VERSION} ${lang}")
  else()
    message(STATUS "Cray Programming Environment (unknown version) ${lang}")
  endif()

  # setup the craype environment
  __cmake_craype_setupenv()

  # Flags for the Cray wrappers
  set(CMAKE_STATIC_LIBRARY_LINK_${lang}_FLAGS "-static")
  set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
  set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-dynamic")

  # determine linktype from environment and compiler flags
  __cmake_craype_linktype(${lang} __cmake_craype_${lang}_linktype)

  # switch off shared libs if we get a static linktype
  if("${__cmake_craype_${lang}_linktype}" STREQUAL "static")
    set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
    set(BUILD_SHARED_LIBS FALSE CACHE BOOL "")
    set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
    set(CMAKE_LINK_SEARCH_START_STATIC TRUE)
  endif()

endmacro()

cmake_policy(POP)


code:
set(_compiler_id_pp_test "defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)")

set(_compiler_id_version_compute "
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__CODEGEARC_VERSION__>>24 & 0x00FF)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__CODEGEARC_VERSION__>>16 & 0x00FF)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__CODEGEARC_VERSION__     & 0xFFFF)")


code: include(Compiler/Clang-FindBinUtils)


code:
include(Compiler/Clang)
__compiler_clang(Fortran)

set(CMAKE_Fortran_SUBMODULE_SEP "-")
set(CMAKE_Fortran_SUBMODULE_EXT ".mod")

set(CMAKE_Fortran_PREPROCESS_SOURCE
    "<CMAKE_Fortran_COMPILER> -cpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")

set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed-form")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form")

set(CMAKE_Fortran_MODDIR_FLAG "-J")

set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-cpp")
set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-nocpp")


code:
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(Compiler/Fujitsu)
__compiler_fujitsu(C)

if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4)
  set(CMAKE_C90_STANDARD_COMPILE_OPTION  -std=c89)
  set(CMAKE_C90_EXTENSION_COMPILE_OPTION -std=gnu89)
  set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)

  set(CMAKE_C99_STANDARD_COMPILE_OPTION  -std=c99)
  set(CMAKE_C99_EXTENSION_COMPILE_OPTION -std=gnu99)
  set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)

  set(CMAKE_C11_STANDARD_COMPILE_OPTION  -std=c11)
  set(CMAKE_C11_EXTENSION_COMPILE_OPTION -std=gnu11)
  set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
endif()

__compiler_check_default_language_standard(C 4 11)


code:
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(Compiler/Fujitsu)
__compiler_fujitsu(CXX)

#set(CMAKE_PCH_EXTENSION .pch)
#set(CMAKE_PCH_EPILOGUE "#pragma hdrstop")
#set(CMAKE_CXX_COMPILE_OPTIONS_USE_PCH --no_pch_messages -include <PCH_HEADER> --use_pch <PCH_FILE>)
#set(CMAKE_CXX_COMPILE_OPTIONS_CREATE_PCH --no_pch_messages -include <PCH_HEADER> --create_pch <PCH_FILE>)

# The Fujitsu compiler offers both a 98 and 03 mode.  These two are
# essentially interchangeable as 03 simply provides clarity to some 98
# ambiguyity.
#
# Re: Stroustrup's C++ FAQ:
#   What is the difference between C++98 and C++03?
#     From a programmer's view there is none. The C++03 revision of the
#     standard was a bug fix release for implementers to ensure greater
#     consistency and portability. In particular, tutorial and reference
#     material describing C++98 and C++03 can be used interchangeably by all
#     except compiler writers and standards gurus.
#
# Since CMake doesn't actually have an 03 mode and they're effectively
# interchangeable then we're just going to explicitly use 03 mode in the
# compiler when 98 is requested.

# The version matching is messy here.  The std support seems to be related to
# the compiler tweak version derived from the patch id in the version string.

if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 4)
  set(CMAKE_CXX98_STANDARD_COMPILE_OPTION  -std=c++03)
  set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -std=gnu++03)
  set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)

  set(CMAKE_CXX11_STANDARD_COMPILE_OPTION  -std=c++11)
  set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -std=gnu++11)
  set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)

  set(CMAKE_CXX14_STANDARD_COMPILE_OPTION  -std=c++14)
  set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION -std=gnu++14)
  set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)

  set(CMAKE_CXX17_STANDARD_COMPILE_OPTION  -std=c++17)
  set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION -std=gnu++17)
endif()

__compiler_check_default_language_standard(CXX 4 14)


code:
set(_compiler_id_pp_test "defined(__FUJITSU)")

set(_compiler_id_version_compute "
# if defined(__FCC_version__)
#   define @PREFIX@COMPILER_VERSION __FCC_version__
# elif defined(__FCC_major__)
#   define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__FCC_major__)
#   define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__FCC_minor__)
#   define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__FCC_patchlevel__)
# endif
# if defined(__fcc_version)
#   define @PREFIX@COMPILER_VERSION_INTERNAL @MACRO_DEC@(__fcc_version)
# elif defined(__FCC_VERSION)
#   define @PREFIX@COMPILER_VERSION_INTERNAL @MACRO_DEC@(__FCC_VERSION)
# endif
")


code:
include(Compiler/Fujitsu)
__compiler_fujitsu(Fortran)

set(CMAKE_Fortran_SUBMODULE_SEP ".")
set(CMAKE_Fortran_SUBMODULE_EXT ".smod")

set(CMAKE_Fortran_PREPROCESS_SOURCE
  "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -Cpp -P <SOURCE> -o <PREPROCESSED_SOURCE>")
set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-Cpp")

set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-Fixed")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-Free")

string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT "")

set(CMAKE_Fortran_MODDIR_FLAG "-M ")


code:
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

# This module is shared by multiple languages; use include blocker.
if(__COMPILER_FUJITSU)
  return()
endif()
set(__COMPILER_FUJITSU 1)

include(Compiler/CMakeCommonCompilerMacros)

macro(__compiler_fujitsu lang)
  set(CMAKE_${lang}_VERBOSE_FLAG "-###")
  set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-cwno")

  # Initial configuration flags
  string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
  string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g -O0")
  string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
  string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")

  # PIC flags
  set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
  set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")

  # Passing link options to the compiler
  set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
  set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")

  # IPO flag
  set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
  if ("${lang}" STREQUAL "Fortran")
    # Supported by Fortran compiler only
    set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)
    set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-Klto")
  else()
    set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO)
  endif()

  # How to actually call the compiler
  set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
  "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E $<$<COMPILE_LANGUAGE:Fortran>:-Cpp> <SOURCE> > <PREPROCESSED_SOURCE>")
  set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
endmacro()


code:
include(Compiler/FujitsuClang)

set(_fjclang_ver "${CMAKE_C_COMPILER_VERSION_INTERNAL}")
set(CMAKE_C_COMPILER_VERSION "${CMAKE_C_COMPILER_VERSION_INTERNAL}")
include(Compiler/Clang-C)
set(CMAKE_C_COMPILER_VERSION "${_fjclang_ver}")


code:
include(Compiler/FujitsuClang)

set(_fjclang_ver "${CMAKE_CXX_COMPILER_VERSION_INTERNAL}")
set(CMAKE_CXX_COMPILER_VERSION "${CMAKE_CXX_COMPILER_VERSION_INTERNAL}")
include(Compiler/Clang-CXX)
set(CMAKE_CXX_COMPILER_VERSION "${_fjclang_ver}")


code:
set(_compiler_id_pp_test "defined(__CLANG_FUJITSU)")

set(_compiler_id_version_compute "
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__FCC_major__)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__FCC_minor__)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__FCC_patchlevel__)
# define @PREFIX@COMPILER_VERSION_INTERNAL_STR __clang_version__
")


code:
if(NOT DEFINED _CMAKE_PROCESSING_LANGUAGE OR _CMAKE_PROCESSING_LANGUAGE STREQUAL "")
  message(FATAL_ERROR "Internal error: _CMAKE_PROCESSING_LANGUAGE is not set")
endif()

set(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR ar)
set(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB ranlib)


code:
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

# This module is shared by multiple languages; use include blocker.
if(__COMPILER_FUJITSUCLANG)
  return()
endif()
set(__COMPILER_FUJITSUCLANG 1)

include(Compiler/Clang)


code:
string(APPEND CMAKE_Fortran_FLAGS_INIT " ")
string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " -Os")
string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -O3")
string(APPEND CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT " -O2 -g")
set(CMAKE_Fortran_MODDIR_FLAG "-fmod=")
set(CMAKE_Fortran_VERBOSE_FLAG "-v")
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed-form")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form")
set(CMAKE_Fortran_LINKER_WRAPPER_FLAG "-Wl,")
set(CMAKE_Fortran_LINKER_WRAPPER_FLAG_SEP ",")
set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-cpp")
set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-no-cpp")