From 19bfeb545d307a35bfa0bf3d85886a2d4430f878 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Mon, 8 Apr 2024 18:29:07 +0900 Subject: [PATCH] GH-41061: [C++] Ignore ARROW_USE_MOLD/ARROW_USE_LLD with clang < 12 (#41062) ### Rationale for this change `--ld-path` is available since clang 12 or later. ### What changes are included in this PR? Ignore `ARROW_USE_MOLD`/`ARROW_USE_LLD` with clang < 12. ### Are these changes tested? Yes. ### Are there any user-facing changes? Yes. * GitHub Issue: #41061 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- cpp/cmake_modules/SetupCxxFlags.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake b/cpp/cmake_modules/SetupCxxFlags.cmake index 6d3a292382826..d56609c123968 100644 --- a/cpp/cmake_modules/SetupCxxFlags.cmake +++ b/cpp/cmake_modules/SetupCxxFlags.cmake @@ -679,7 +679,12 @@ if(ARROW_USE_LLD) ) endif() elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set(LLD_LINKER_FLAGS "--ld-path=${LD_LLD}") + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0") + set(LLD_LINKER_FLAGS "--ld-path=${LD_LLD}") + else() + message(STATUS "Need clang 12.0.0 or later to use LLD linker: ${CMAKE_CXX_COMPILER_VERSION}" + ) + endif() else() message(STATUS "Using the default linker because compiler doesn't support LLD: ${CMAKE_CXX_COMPILER_ID}" )