Merge topic 'link-warning-as-error'

7907c83175 Link step: Add LINK_WARNING_AS_ERROR target property
656267c871 COMPILE_WARNING_AS_ERROR: rename methods to prepare link similar functionality

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9984
This commit is contained in:
Brad King
2024-11-13 14:24:22 +00:00
committed by Kitware Robot
58 changed files with 442 additions and 40 deletions
+2
View File
@@ -6,4 +6,6 @@
include_guard()
macro(__linker_aix lang)
# Linker warning as error
set(CMAKE_${lang}_LINK_OPTIONS_WARNING_AS_ERROR "LINKER:-bhalt:0")
endmacro()
+2
View File
@@ -7,4 +7,6 @@
include_guard()
macro(__linker_appleclang lang)
# Linker warning as error
set(CMAKE_${lang}_LINK_OPTIONS_WARNING_AS_ERROR "LINKER:-fatal_warnings")
endmacro()
+5 -1
View File
@@ -65,10 +65,14 @@ function(__linker_gnu lang)
set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER FALSE)
endif()
# Linker warning as error
set(CMAKE_${lang}_LINK_OPTIONS_WARNING_AS_ERROR "LINKER:--fatal-warnings")
return(PROPAGATE CMAKE_${lang}_LINKER_DEPFILE_FLAGS
CMAKE_${lang}_LINKER_DEPFILE_FORMAT
CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED
CMAKE_${lang}_LINK_DEPENDS_USE_LINKER)
CMAKE_${lang}_LINK_DEPENDS_USE_LINKER
CMAKE_${lang}_LINK_OPTIONS_WARNING_AS_ERROR)
endfunction()
endblock()
+14 -2
View File
@@ -3,8 +3,20 @@
include_guard()
include(Linker/GNU)
block(SCOPE_FOR POLICIES)
cmake_policy(SET CMP0054 NEW)
macro(__linker_lld lang)
__linker_gnu(${lang})
if(CMAKE_${lang}_COMPILER_LINKER_FRONTEND_VARIANT STREQUAL "MSVC")
include(Linker/MSVC)
__linker_msvc(${lang})
else()
include(Linker/GNU)
__linker_gnu(${lang})
endif()
endmacro()
endblock()
+2 -2
View File
@@ -1,6 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(Linker/GNU)
include(Linker/MOLD)
__linker_gnu(ASM)
__linker_mold(ASM)
+2 -2
View File
@@ -1,6 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(Linker/GNU)
include(Linker/MOLD)
__linker_gnu(C)
__linker_mold(C)
+2 -2
View File
@@ -1,6 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(Linker/GNU)
include(Linker/MOLD)
__linker_gnu(CUDA)
__linker_mold(CUDA)
+2 -2
View File
@@ -1,6 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(Linker/GNU)
include(Linker/MOLD)
__linker_gnu(CXX)
__linker_mold(CXX)
+2 -2
View File
@@ -1,6 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(Linker/GNU)
include(Linker/MOLD)
__linker_gnu(Fortran)
__linker_mold(Fortran)
+2 -2
View File
@@ -1,6 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(Linker/GNU)
include(Linker/MOLD)
__linker_gnu(HIP)
__linker_mold(HIP)
+2 -2
View File
@@ -1,6 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(Linker/GNU)
include(Linker/MOLD)
__linker_gnu(OBJC)
__linker_mold(OBJC)
+2 -2
View File
@@ -1,6 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(Linker/GNU)
include(Linker/MOLD)
__linker_gnu(OBJCXX)
__linker_mold(OBJCXX)
+23
View File
@@ -0,0 +1,23 @@
# 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 linkers; use include blocker.
include_guard()
block(SCOPE_FOR POLICIES)
cmake_policy(SET CMP0054 NEW)
macro(__linker_mold lang)
if(CMAKE_EFFECTIVE_SYSTEM_NAME STREQUAL "Apple")
include(Linker/AppleClang)
__linker_appleclang(${lang})
else()
include(Linker/GNU)
__linker_gnu(${lang})
endif()
endmacro()
endblock()
+6
View File
@@ -0,0 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(Linker/MSVC)
__linker_msvc(ASM)
+6
View File
@@ -0,0 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(Linker/MSVC)
__linker_msvc(C)
+6
View File
@@ -0,0 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(Linker/MSVC)
__linker_msvc(CUDA)
+6
View File
@@ -0,0 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(Linker/MSVC)
__linker_msvc(CXX)
+6
View File
@@ -0,0 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(Linker/MSVC)
__linker_msvc(Fortran)
+6
View File
@@ -0,0 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(Linker/MSVC)
__linker_msvc(HIP)
+12
View File
@@ -0,0 +1,12 @@
# 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 linkers; use include blocker.
include_guard()
macro(__linker_msvc lang)
# Linker warning as error
set(CMAKE_${lang}_LINK_OPTIONS_WARNING_AS_ERROR "LINKER:/WX")
endmacro()
+2
View File
@@ -6,4 +6,6 @@
include_guard()
macro(__linker_solaris lang)
# Linker warning as error
set(CMAKE_${lang}_LINK_OPTIONS_WARNING_AS_ERROR "LINKER:-z,fatal-warnings")
endmacro()