Platform: Add compiler platform modules for BSDs

These set variables required for CMAKE_LINKER_TYPE to work

Fixes: #27037
This commit is contained in:
Undefine
2025-06-30 23:01:57 +02:00
parent 7dae5d8aa1
commit 7ae11ea4e7
30 changed files with 88 additions and 1 deletions

View File

@@ -0,0 +1 @@
include(Platform/FreeBSD-GNU-ASM)

View File

@@ -0,0 +1 @@
include(Platform/FreeBSD-GNU-C)

View File

@@ -0,0 +1 @@
include(Platform/FreeBSD-GNU-CXX)

View File

@@ -0,0 +1,2 @@
include(Platform/FreeBSD-GNU)
__freebsd_compiler_gnu(ASM)

View File

@@ -0,0 +1,2 @@
include(Platform/FreeBSD-GNU)
__freebsd_compiler_gnu(C)

View File

@@ -0,0 +1,2 @@
include(Platform/FreeBSD-GNU)
__freebsd_compiler_gnu(CXX)

View File

@@ -0,0 +1,2 @@
include(Platform/FreeBSD-GNU)
__freebsd_compiler_gnu(Fortran)

View File

@@ -0,0 +1,16 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file LICENSE.rst or https://cmake.org/licensing for details.
include_guard()
macro(__freebsd_compiler_gnu lang)
# linker selection
set(CMAKE_${lang}_USING_LINKER_SYSTEM "")
set(CMAKE_${lang}_USING_LINKER_LLD "-fuse-ld=lld")
set(CMAKE_${lang}_USING_LINKER_BFD "-fuse-ld=bfd")
set(CMAKE_${lang}_USING_LINKER_GOLD "-fuse-ld=gold")
if(NOT CMAKE_${lang}_COMPILER_ID STREQUAL "GNU"
OR CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL "12.1")
set(CMAKE_${lang}_USING_LINKER_MOLD "-fuse-ld=mold")
endif()
endmacro()

View File

@@ -0,0 +1,2 @@
include(Platform/MirBSD-GNU)
__mirbsd_compiler_gnu(ASM)

View File

@@ -0,0 +1,2 @@
include(Platform/MirBSD-GNU)
__mirbsd_compiler_gnu(C)

View File

@@ -0,0 +1,2 @@
include(Platform/MirBSD-GNU)
__mirbsd_compiler_gnu(CXX)

View File

@@ -0,0 +1,2 @@
include(Platform/MirBSD-GNU)
__mirbsd_compiler_gnu(Fortran)

View File

@@ -0,0 +1,7 @@
include_guard()
include(Platform/OpenBSD-GNU)
macro(__mirbsd_compiler_gnu lang)
__openbsd_compiler_gnu(${lang})
endmacro()

View File

@@ -0,0 +1 @@
include(Platform/NetBSD-GNU-ASM)

View File

@@ -0,0 +1 @@
include(Platform/NetBSD-GNU-C)

View File

@@ -0,0 +1 @@
include(Platform/NetBSD-GNU-CXX)

View File

@@ -0,0 +1,2 @@
include(Platform/NetBSD-GNU)
__netbsd_compiler_gnu(ASM)

View File

@@ -0,0 +1,2 @@
include(Platform/NetBSD-GNU)
__netbsd_compiler_gnu(C)

View File

@@ -0,0 +1,2 @@
include(Platform/NetBSD-GNU)
__netbsd_compiler_gnu(CXX)

View File

@@ -0,0 +1,2 @@
include(Platform/NetBSD-GNU)
__netbsd_compiler_gnu(Fortran)

View File

@@ -0,0 +1,16 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file LICENSE.rst or https://cmake.org/licensing for details.
include_guard()
macro(__netbsd_compiler_gnu lang)
# linker selection
set(CMAKE_${lang}_USING_LINKER_SYSTEM "")
set(CMAKE_${lang}_USING_LINKER_LLD "-fuse-ld=lld")
set(CMAKE_${lang}_USING_LINKER_BFD "-fuse-ld=bfd")
set(CMAKE_${lang}_USING_LINKER_GOLD "-fuse-ld=gold")
if(NOT CMAKE_${lang}_COMPILER_ID STREQUAL "GNU"
OR CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL "12.1")
set(CMAKE_${lang}_USING_LINKER_MOLD "-fuse-ld=mold")
endif()
endmacro()

View File

@@ -0,0 +1 @@
include(Platform/OpenBSD-GNU-ASM)

View File

@@ -0,0 +1 @@
include(Platform/OpenBSD-GNU-C)

View File

@@ -0,0 +1 @@
include(Platform/OpenBSD-GNU-CXX)

View File

@@ -0,0 +1,2 @@
include(Platform/OpenBSD-GNU)
__openbsd_compiler_gnu(ASM)

View File

@@ -0,0 +1,2 @@
include(Platform/OpenBSD-GNU)
__openbsd_compiler_gnu(C)

View File

@@ -0,0 +1,2 @@
include(Platform/OpenBSD-GNU)
__openbsd_compiler_gnu(CXX)

View File

@@ -0,0 +1,2 @@
include(Platform/OpenBSD-GNU)
__openbsd_compiler_gnu(Fortran)

View File

@@ -0,0 +1,7 @@
include_guard()
include(Platform/NetBSD-GNU)
macro(__openbsd_compiler_gnu lang)
__netbsd_compiler_gnu(${lang})
endmacro()

View File

@@ -939,7 +939,7 @@ if((CMAKE_C_COMPILER_ID STREQUAL "AppleClang"
endif()
endif()
if (CMAKE_SYSTEM_NAME MATCHES "(Linux|Darwin|Windows)"
if (CMAKE_SYSTEM_NAME MATCHES "(Linux|Darwin|Windows|OpenBSD|FreeBSD|NetBSD|MirBSD)"
AND CMAKE_C_COMPILER_ID MATCHES "^(AppleClang|Clang|GNU|MSVC|NVIDIA)$"
AND NOT CMAKE_GENERATOR STREQUAL "Green Hills MULTI")
add_RunCMake_test(LinkerSelection -DCMake_TEST_CUDA=${CMake_TEST_CUDA}