Skip to content

Commit a62084a

Browse files
authored
chore: Use mold when available without option (#2521)
1 parent b8c298b commit a62084a

File tree

4 files changed

+10
-15
lines changed

4 files changed

+10
-15
lines changed

.github/actions/cmake/action.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ inputs:
3333
description: Whether to enable compiler trace reports
3434
required: true
3535
default: "false"
36-
use_mold:
37-
description: Whether to use mold linker
38-
required: true
39-
default: "false"
4036
package:
4137
description: Whether to generate Debian package
4238
required: true
@@ -59,7 +55,6 @@ runs:
5955
COVERAGE: "${{ inputs.code_coverage == 'true' && 'ON' || 'OFF' }}"
6056
STATIC: "${{ inputs.static == 'true' && 'ON' || 'OFF' }}"
6157
TIME_TRACE: "${{ inputs.time_trace == 'true' && 'ON' || 'OFF' }}"
62-
USE_MOLD: "${{ inputs.use_mold == 'true' && 'ON' || 'OFF' }}"
6358
PACKAGE: "${{ inputs.package == 'true' && 'ON' || 'OFF' }}"
6459
run: |
6560
cmake \
@@ -74,5 +69,4 @@ runs:
7469
-Dcoverage="${COVERAGE}" \
7570
-Dstatic="${STATIC}" \
7671
-Dtime_trace="${TIME_TRACE}" \
77-
-Duse_mold="${USE_MOLD}" \
7872
-Dpackage="${PACKAGE}"

.github/workflows/build_impl.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ jobs:
121121
code_coverage: ${{ inputs.code_coverage }}
122122
static: ${{ inputs.static }}
123123
time_trace: ${{ inputs.analyze_build_time }}
124-
use_mold: ${{ runner.os != 'macOS' }}
125124
package: ${{ inputs.package }}
126125

127126
- name: Build Clio

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ option(lint "Run clang-tidy checks during compilation" FALSE)
1616
option(static "Statically linked Clio" FALSE)
1717
option(snapshot "Build snapshot tool" FALSE)
1818
option(time_trace "Build using -ftime-trace to create compiler trace reports" FALSE)
19-
option(use_mold "Use mold linker" FALSE)
2019

2120
# ========================================================================== #
2221
set(san "" CACHE STRING "Add sanitizer instrumentation")

cmake/Linker.cmake

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
if (use_mold)
2-
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
3-
message(STATUS "Using Mold linker")
4-
set(CMAKE_LINKER_TYPE MOLD)
5-
else ()
6-
message(FATAL_ERROR "Mold linker is only supported on Linux.")
7-
endif ()
1+
if (DEFINED CMAKE_LINKER_TYPE)
2+
message(STATUS "Custom linker is already set: ${CMAKE_LINKER_TYPE}")
3+
return()
4+
endif ()
5+
6+
find_program(MOLD_PATH mold)
7+
8+
if (MOLD_PATH AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
9+
message(STATUS "Using Mold linker: ${MOLD_PATH}")
10+
set(CMAKE_LINKER_TYPE MOLD)
811
endif ()

0 commit comments

Comments
 (0)