mirror of
https://github.com/Kitware/CMake.git
synced 2026-08-09 17:18:18 +00:00
@@ -35,6 +35,7 @@ are:
|
||||
* ``MOLD``
|
||||
* ``MSVC``
|
||||
* ``Solaris``
|
||||
* ``WILD``
|
||||
|
||||
This property is initialized by the value of the variable
|
||||
:variable:`CMAKE_LINK_WARNING_AS_ERROR` if it is set when a target is
|
||||
|
||||
5
Help/release/dev/Wild-linker.rst
Normal file
5
Help/release/dev/Wild-linker.rst
Normal file
@@ -0,0 +1,5 @@
|
||||
Wild-linker
|
||||
-----------
|
||||
|
||||
* CMake gains the support of the
|
||||
`wild linker <https://github.com/wild-linker/wild>`_.
|
||||
@@ -11,6 +11,7 @@ include:
|
||||
=============================== ===============================================
|
||||
Value Name
|
||||
=============================== ===============================================
|
||||
``AIX`` AIX system linker
|
||||
``AppleClang`` Apple Clang
|
||||
``LLD`` `LLVM LLD`_
|
||||
``GNU`` `GNU Binutils - ld linker`_ (also known as
|
||||
@@ -19,8 +20,8 @@ Value Name
|
||||
``MSVC`` `Microsoft Visual Studio`_
|
||||
``MOLD`` `mold: A Modern Linker`_, or on Apple the
|
||||
`sold`_ linker
|
||||
``AIX`` AIX system linker
|
||||
``Solaris`` SunOS system linker
|
||||
``WILD`` `wild`_ linker
|
||||
=============================== ===============================================
|
||||
|
||||
This variable is not guaranteed to be defined for all linkers or languages.
|
||||
@@ -31,3 +32,4 @@ This variable is not guaranteed to be defined for all linkers or languages.
|
||||
.. _Microsoft Visual Studio: https://visualstudio.microsoft.com
|
||||
.. _mold\: A Modern Linker: https://github.com/rui314/mold
|
||||
.. _sold: https://github.com/bluewhalesystems/sold
|
||||
.. _wild: https://github.com/wild-linker/wild
|
||||
|
||||
@@ -45,8 +45,8 @@ built-in types. The pre-defined linker types are:
|
||||
``NVIDIA``, and ``Swift`` compilers.
|
||||
|
||||
``MOLD``
|
||||
Use the `mold linker <https://github.com/rui314/mold>`_. This type is
|
||||
supported on the following platform-compiler combinations:
|
||||
Use the `mold linker`_. This type is supported on the following
|
||||
platform-compiler combinations:
|
||||
|
||||
* Linux: ``GNU``, ``Clang``, ``LLVMFlang``, and ``NVIDIA`` compilers.
|
||||
* Apple platforms: ``Clang`` and ``AppleClang`` compilers (acts as an
|
||||
@@ -56,6 +56,12 @@ built-in types. The pre-defined linker types are:
|
||||
Use the `sold linker`_. This type is only supported on Apple platforms
|
||||
with ``Clang`` and ``AppleClang`` compilers.
|
||||
|
||||
``WILD``
|
||||
.. versionadded:: 4.4
|
||||
|
||||
Use the `wild linker`_. This type is only supported on Linux platforms
|
||||
with ``Clang`` and ``GNU`` compilers.
|
||||
|
||||
``APPLE_CLASSIC``
|
||||
Use the Apple linker in the classic behavior (i.e. before ``Xcode 15.0``).
|
||||
This type is only supported on Apple platforms with ``GNU``, ``Clang``,
|
||||
@@ -66,4 +72,6 @@ built-in types. The pre-defined linker types are:
|
||||
platform with ``MSVC``, ``Clang`` with MSVC-like front-end, and ``Swift``
|
||||
compilers.
|
||||
|
||||
.. _mold linker: https://github.com/rui314/mold
|
||||
.. _sold linker: https://github.com/bluewhalesystems/sold
|
||||
.. _wild linker: https://github.com/wild-linker/wild
|
||||
|
||||
@@ -46,12 +46,18 @@ function(cmake_parse_implicit_link_info2 text log_var obj_regex)
|
||||
cmake_parse_arguments(EXTRA_PARSE "${keywordArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
set(is_lfortran_less_0_40 0)
|
||||
set(is_clang 0)
|
||||
set(is_gnu 0)
|
||||
set(is_msvc 0)
|
||||
set(is_cray 0)
|
||||
if(EXTRA_PARSE_LANGUAGE)
|
||||
if("x${CMAKE_${EXTRA_PARSE_LANGUAGE}_COMPILER_ID}" STREQUAL "xMSVC" OR
|
||||
"x${CMAKE_${EXTRA_PARSE_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC")
|
||||
set(is_msvc 1)
|
||||
elseif("x${CMAKE_${EXTRA_PARSE_LANGUAGE}_COMPILER_ID}" STREQUAL "xGNU")
|
||||
set(is_gnu 1)
|
||||
elseif("x${CMAKE_${EXTRA_PARSE_LANGUAGE}_COMPILER_ID}" STREQUAL "xClang")
|
||||
set(is_clang 1)
|
||||
elseif("x${CMAKE_${EXTRA_PARSE_LANGUAGE}_COMPILER_ID}" STREQUAL "xLFortran"
|
||||
AND CMAKE_${EXTRA_PARSE_LANGUAGE}_COMPILER_VERSION VERSION_LESS "0.40")
|
||||
set(is_lfortran_less_0_40 1)
|
||||
@@ -65,6 +71,9 @@ function(cmake_parse_implicit_link_info2 text log_var obj_regex)
|
||||
# lfortran < 0.40 has no way to pass -v to clang/gcc driver.
|
||||
string(APPEND linker "|clang|gcc")
|
||||
endif()
|
||||
if(is_clang OR is_gnu)
|
||||
string(APPEND linker "|wild")
|
||||
endif()
|
||||
if(is_msvc)
|
||||
string(APPEND linker "|link\\.exe|lld-link(\\.exe)?")
|
||||
endif()
|
||||
|
||||
@@ -21,7 +21,7 @@ function(cmake_determine_linker_id lang linker)
|
||||
|
||||
# Compute the linker ID and version.
|
||||
foreach(flags IN ITEMS
|
||||
"-v" # AppleClang, GNU, GNUgold, MOLD
|
||||
"-v" # AppleClang, GNU, GNUgold, MOLD, WILD
|
||||
"-V" # AIX, Solaris
|
||||
"--version" # LLD
|
||||
)
|
||||
@@ -45,6 +45,11 @@ function(cmake_determine_linker_id lang linker)
|
||||
set(linker_frontend "GNU")
|
||||
set(linker_version "${CMAKE_MATCH_1}")
|
||||
break()
|
||||
elseif(linker_desc MATCHES "Wild version ([0-9.]+)")
|
||||
set(linker_id "WILD")
|
||||
set(linker_frontend "GNU")
|
||||
set(linker_version "${CMAKE_MATCH_1}")
|
||||
break()
|
||||
elseif(linker_desc MATCHES "mold \\(sold\\) ([0-9.]+)")
|
||||
set(linker_id "MOLD")
|
||||
set(linker_frontend "GNU")
|
||||
|
||||
6
Modules/Linker/WILD-ASM.cmake
Normal file
6
Modules/Linker/WILD-ASM.cmake
Normal file
@@ -0,0 +1,6 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
include(Linker/WILD)
|
||||
|
||||
__linker_wild(ASM)
|
||||
6
Modules/Linker/WILD-C.cmake
Normal file
6
Modules/Linker/WILD-C.cmake
Normal file
@@ -0,0 +1,6 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
include(Linker/WILD)
|
||||
|
||||
__linker_wild(C)
|
||||
6
Modules/Linker/WILD-CXX.cmake
Normal file
6
Modules/Linker/WILD-CXX.cmake
Normal file
@@ -0,0 +1,6 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
include(Linker/WILD)
|
||||
|
||||
__linker_wild(CXX)
|
||||
6
Modules/Linker/WILD-Fortran.cmake
Normal file
6
Modules/Linker/WILD-Fortran.cmake
Normal file
@@ -0,0 +1,6 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
include(Linker/WILD)
|
||||
|
||||
__linker_wild(Fortran)
|
||||
12
Modules/Linker/WILD.cmake
Normal file
12
Modules/Linker/WILD.cmake
Normal file
@@ -0,0 +1,12 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# This module is shared by multiple linkers; use include blocker.
|
||||
include_guard()
|
||||
|
||||
macro(__linker_wild lang)
|
||||
include(Linker/GNU)
|
||||
|
||||
__linker_gnu(${lang})
|
||||
endmacro()
|
||||
6
Modules/Platform/Linker/Linux-WILD-ASM.cmake
Normal file
6
Modules/Platform/Linker/Linux-WILD-ASM.cmake
Normal file
@@ -0,0 +1,6 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
include(Platform/Linker/Linux-WILD)
|
||||
|
||||
__linux_linker_wild(ASM)
|
||||
6
Modules/Platform/Linker/Linux-WILD-C.cmake
Normal file
6
Modules/Platform/Linker/Linux-WILD-C.cmake
Normal file
@@ -0,0 +1,6 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
include(Platform/Linker/Linux-WILD)
|
||||
|
||||
__linux_linker_wild(C)
|
||||
6
Modules/Platform/Linker/Linux-WILD-CXX.cmake
Normal file
6
Modules/Platform/Linker/Linux-WILD-CXX.cmake
Normal file
@@ -0,0 +1,6 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
include(Platform/Linker/Linux-WILD)
|
||||
|
||||
__linux_linker_wild(CXX)
|
||||
6
Modules/Platform/Linker/Linux-WILD-Fortran.cmake
Normal file
6
Modules/Platform/Linker/Linux-WILD-Fortran.cmake
Normal file
@@ -0,0 +1,6 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
include(Platform/Linker/Linux-WILD)
|
||||
|
||||
__linux_linker_wild(Fortran)
|
||||
18
Modules/Platform/Linker/Linux-WILD.cmake
Normal file
18
Modules/Platform/Linker/Linux-WILD.cmake
Normal file
@@ -0,0 +1,18 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# This module is shared by multiple languages; use include blocker.
|
||||
include_guard()
|
||||
|
||||
|
||||
include(Platform/Linker/Linux-GNU)
|
||||
|
||||
|
||||
macro(__linux_linker_wild lang)
|
||||
__linux_linker_gnu(${lang})
|
||||
|
||||
|
||||
set(CMAKE_C_PLATFORM_LINKER_ID WILD)
|
||||
set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL)
|
||||
endmacro()
|
||||
@@ -24,4 +24,10 @@ macro(__linux_compiler_gnu lang)
|
||||
OR CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL "12.1")
|
||||
set(CMAKE_${lang}_USING_LINKER_MOLD "-fuse-ld=mold")
|
||||
endif()
|
||||
if(CMAKE_${lang}_COMPILER_ID STREQUAL "Clang")
|
||||
set(CMAKE_${lang}_USING_LINKER_WILD "--ld-path=wild")
|
||||
elseif(CMAKE_${lang}_COMPILER_ID STREQUAL "GNU"
|
||||
AND CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL "16.0")
|
||||
set(CMAKE_${lang}_USING_LINKER_WILD "-fuse-ld=wild")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
Reference in New Issue
Block a user