cmake/Modules/Platform/Linux-Intel.cmake

51 lines
1.6 KiB
CMake
Raw Normal View History

2016-10-30 18:24:19 +01:00
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
2010-03-17 14:00:29 +02:00
# This module is shared by multiple languages; use include blocker.
if(__LINUX_COMPILER_INTEL)
return()
endif()
set(__LINUX_COMPILER_INTEL 1)
2009-10-04 10:30:41 +03:00
if(NOT XIAR)
2009-10-11 10:55:36 +03:00
set(_intel_xiar_hints)
2009-10-04 10:30:41 +03:00
foreach(lang C CXX Fortran)
if(IS_ABSOLUTE "${CMAKE_${lang}_COMPILER}")
get_filename_component(_hint "${CMAKE_${lang}_COMPILER}" PATH)
2009-10-11 10:55:36 +03:00
list(APPEND _intel_xiar_hints ${_hint})
2009-10-04 10:30:41 +03:00
endif()
endforeach()
2009-10-11 10:55:36 +03:00
find_program(XIAR NAMES xiar HINTS ${_intel_xiar_hints})
2009-10-04 10:30:41 +03:00
mark_as_advanced(XIAR)
2013-03-16 19:13:01 +02:00
endif()
2010-03-17 14:00:29 +02:00
macro(__linux_compiler_intel lang)
2012-06-27 20:52:58 +03:00
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
2010-03-17 14:00:29 +02:00
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")
2017-07-20 19:35:53 +02:00
set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
2010-03-17 14:00:29 +02:00
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> ")
2017-07-20 19:35:53 +02:00
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)
2010-03-17 14:00:29 +02:00
endif()
2014-08-03 19:52:23 +02:00
if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0)
set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
endif()
2010-03-17 14:00:29 +02:00
endmacro()