From 0e97e84a6588ca21d93037969c24c82f19698986 Mon Sep 17 00:00:00 2001 From: Guillaume Chatelet Date: Mon, 3 May 2021 08:39:26 +0000 Subject: [PATCH] [libc] warns about missing linting only in full build mode Differential Revision: https://reviews.llvm.org/D101609 --- libc/CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt index 61cc5a17a205..ff1a0c6fe69a 100644 --- a/libc/CMakeLists.txt +++ b/libc/CMakeLists.txt @@ -42,7 +42,12 @@ else() --print-resource-dir not supported by host compiler") endif() +option(LLVM_LIBC_FULL_BUILD "Build and test LLVM libc as if it is the full libc" OFF) + option(LLVM_LIBC_ENABLE_LINTING "Enables linting of libc source files" OFF) +if(LLVM_LIBC_ENABLE_LINTING AND (NOT LLVM_LIBC_FULL_BUILD)) + message(FATAL_ERROR "Cannot enable linting when full libc build is not enabled.") +endif() if(LLVM_LIBC_ENABLE_LINTING) if("clang-tools-extra" IN_LIST LLVM_ENABLE_PROJECTS AND "clang" IN_LIST LLVM_ENABLE_PROJECTS) @@ -56,7 +61,7 @@ if(LLVM_LIBC_ENABLE_LINTING) To disable linting set LLVM_LIBC_ENABLE_LINTING to OFF (pass -DLLVM_LIBC_ENABLE_LINTING=OFF to cmake).") endif() -else() +elseif(LLVM_LIBC_FULL_BUILD) message(WARNING " Linting for libc is currently disabled. @@ -64,8 +69,6 @@ else() (pass -DLLVM_LIBC_ENABLE_LINTING=ON to cmake).") endif() -option(LLVM_LIBC_FULL_BUILD "Build and test LLVM libc as if it is the full libc" OFF) - include(CMakeParseArguments) include(LLVMLibCRules) include(LLVMLibCCheckCpuFeatures)