From efae3174f09560353fb0f3d528bcbffe060d5438 Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Wed, 1 Feb 2023 08:25:35 +0000 Subject: [CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag These have the same purposes but two different implementations. llvm_check_compiler_linker_flag uses CMAKE_REQUIRED_FLAGS which affects flags used both for compilation and linking which is problematic because some flags may be link-only and trigger unused argument warning when set during compilation. llvm_check_linker_flag does not have this issue so we chose it as the prevailaing implementation. Differential Revision: https://reviews.llvm.org/D143052 --- libunwind/cmake/config-ix.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libunwind') diff --git a/libunwind/cmake/config-ix.cmake b/libunwind/cmake/config-ix.cmake index d311477..ae6caeb 100644 --- a/libunwind/cmake/config-ix.cmake +++ b/libunwind/cmake/config-ix.cmake @@ -2,14 +2,14 @@ include(CMakePushCheckState) include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) include(CheckLibraryExists) -include(LLVMCheckCompilerLinkerFlag) +include(LLVMCheckLinkerFlag) include(CheckSymbolExists) include(CheckCSourceCompiles) # The compiler driver may be implicitly trying to link against libunwind, which # might not work if libunwind doesn't exist yet. Try to check if # --unwindlib=none is supported, and use that if possible. -llvm_check_compiler_linker_flag(C "--unwindlib=none" CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG) +llvm_check_linker_flag(C "--unwindlib=none" CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG) check_library_exists(c fopen "" LIBUNWIND_HAS_C_LIB) @@ -31,11 +31,11 @@ endif() # required for the link to go through. We remove sanitizers from the # configuration checks to avoid spurious link errors. -llvm_check_compiler_linker_flag(CXX "-nostdlib++" CXX_SUPPORTS_NOSTDLIBXX_FLAG) +llvm_check_linker_flag(CXX "-nostdlib++" CXX_SUPPORTS_NOSTDLIBXX_FLAG) if (CXX_SUPPORTS_NOSTDLIBXX_FLAG) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdlib++") else() - llvm_check_compiler_linker_flag(C "-nodefaultlibs" C_SUPPORTS_NODEFAULTLIBS_FLAG) + llvm_check_linker_flag(C "-nodefaultlibs" C_SUPPORTS_NODEFAULTLIBS_FLAG) if (C_SUPPORTS_NODEFAULTLIBS_FLAG) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs") endif() -- cgit v1.1