mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-01 03:11:08 -06:00
Using a single ID 'IntelLLVM' for the suite of Intel compilers based on the LLVM backend. The 'IntelLLVM' ID are used for C, C++, and Fortran. Data Parallel C++ will be handled in a separate commit. The C and C++ definitions are based on the Clang definitions. The Intel LLVM-based C and C++ compilers are based on the Clang front end, so existing Clang options are more likely to be a good match than options for the older Intel compilers. Fortran is based on the older Fortran front end with the LLVM backend. It has a similar interface to the older versions, though many options are shared with the C and C++ compilers. Fixes: #21561 Signed-off-by: William R. Dieter <william.r.dieter@intel.com>
56 lines
1.9 KiB
CMake
56 lines
1.9 KiB
CMake
# 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(__LINUX_COMPILER_INTEL_LLVM)
|
|
return()
|
|
endif()
|
|
set(__LINUX_COMPILER_INTEL_LLVM 1)
|
|
|
|
if(NOT XIAR)
|
|
set(_intel_xiar_hints)
|
|
foreach(lang C CXX Fortran)
|
|
if(IS_ABSOLUTE "${CMAKE_${lang}_COMPILER}")
|
|
get_filename_component(_hint "${CMAKE_${lang}_COMPILER}" PATH)
|
|
list(APPEND _intel_xiar_hints ${_hint})
|
|
endif()
|
|
endforeach()
|
|
find_program(XIAR NAMES xiar HINTS ${_intel_xiar_hints})
|
|
mark_as_advanced(XIAR)
|
|
endif()
|
|
|
|
macro(__linux_compiler_intel_llvm lang)
|
|
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
|
|
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
|
|
set(_CMAKE_${lang}_PIE_MAY_BE_SUPPORTED_BY_LINKER NO)
|
|
set(_CMAKE_${lang}_PIE_MAY_BE_SUPPORTED_BY_LINKER YES)
|
|
set(CMAKE_${lang}_LINK_OPTIONS_PIE ${CMAKE_${lang}_COMPILE_OPTIONS_PIE} "-pie")
|
|
set(CMAKE_${lang}_LINK_OPTIONS_NO_PIE "-no-pie")
|
|
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
|
|
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
|
|
|
|
# We pass this for historical reasons. Projects may have
|
|
# executables that use dlopen but do not set ENABLE_EXPORTS.
|
|
set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-rdynamic")
|
|
|
|
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
|
|
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
|
|
|
|
set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
|
|
|
|
if(XIAR)
|
|
# INTERPROCEDURAL_OPTIMIZATION
|
|
set(CMAKE_${lang}_COMPILE_OPTIONS_IPO -ipo)
|
|
set(CMAKE_${lang}_CREATE_STATIC_LIBRARY_IPO
|
|
"${XIAR} cr <TARGET> <LINK_FLAGS> <OBJECTS> "
|
|
"${XIAR} -s <TARGET> ")
|
|
set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)
|
|
set(_CMAKE_${lang}_IPO_LEGACY_BEHAVIOR YES)
|
|
else()
|
|
set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO)
|
|
endif()
|
|
|
|
set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
|
|
endmacro()
|