[Lldb-commits] [lldb] c1bc4fb - [lldb] Simplify CMake logic with LLVM's append_if function
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu Aug 20 22:35:42 PDT 2020
Author: Jonas Devlieghere
Date: 2020-08-20T22:35:31-07:00
New Revision: c1bc4fb95e37ade1256da8ea8db1030ae84705bd
URL: https://github.com/llvm/llvm-project/commit/c1bc4fb95e37ade1256da8ea8db1030ae84705bd
DIFF: https://github.com/llvm/llvm-project/commit/c1bc4fb95e37ade1256da8ea8db1030ae84705bd.diff
LOG: [lldb] Simplify CMake logic with LLVM's append_if function
Use the append_if CMake function from HandleLLVMOptions. Since we
include this file in LLDBStandalone it should work in both for in-tree
and out-of-tree builds.
Added:
Modified:
lldb/cmake/modules/LLDBConfig.cmake
Removed:
################################################################################
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index b0c139e71ebc..b149836d2666 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -159,36 +159,21 @@ endif ()
include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include")
# Disable GCC warnings
-check_cxx_compiler_flag("-Wno-deprecated-declarations"
- CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS)
-if (CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
-endif ()
+check_cxx_compiler_flag("-Wno-deprecated-declarations" CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS)
+append_if(CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS "-Wno-deprecated-declarations" CMAKE_CXX_FLAGS)
-check_cxx_compiler_flag("-Wno-unknown-pragmas"
- CXX_SUPPORTS_NO_UNKNOWN_PRAGMAS)
-if (CXX_SUPPORTS_NO_UNKNOWN_PRAGMAS)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas")
-endif ()
+check_cxx_compiler_flag("-Wno-unknown-pragmas" CXX_SUPPORTS_NO_UNKNOWN_PRAGMAS)
+append_if(CXX_SUPPORTS_NO_UNKNOWN_PRAGMAS "-Wno-unknown-pragmas" CMAKE_CXX_FLAGS)
-check_cxx_compiler_flag("-Wno-strict-aliasing"
- CXX_SUPPORTS_NO_STRICT_ALIASING)
-if (CXX_SUPPORTS_NO_STRICT_ALIASING)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-strict-aliasing")
-endif ()
+check_cxx_compiler_flag("-Wno-strict-aliasing" CXX_SUPPORTS_NO_STRICT_ALIASING)
+append_if(CXX_SUPPORTS_NO_STRICT_ALIASING "-Wno-strict-aliasing" CMAKE_CXX_FLAGS)
# Disable Clang warnings
-check_cxx_compiler_flag("-Wno-deprecated-register"
- CXX_SUPPORTS_NO_DEPRECATED_REGISTER)
-if (CXX_SUPPORTS_NO_DEPRECATED_REGISTER)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-register")
-endif ()
+check_cxx_compiler_flag("-Wno-deprecated-register" CXX_SUPPORTS_NO_DEPRECATED_REGISTER)
+append_if(CXX_SUPPORTS_NO_DEPRECATED_REGISTER "-Wno-deprecated-register" CMAKE_CXX_FLAGS)
-check_cxx_compiler_flag("-Wno-vla-extension"
- CXX_SUPPORTS_NO_VLA_EXTENSION)
-if (CXX_SUPPORTS_NO_VLA_EXTENSION)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-vla-extension")
-endif ()
+check_cxx_compiler_flag("-Wno-vla-extension" CXX_SUPPORTS_NO_VLA_EXTENSION)
+append_if(CXX_SUPPORTS_NO_VLA_EXTENSION "-Wno-vla-extension" CMAKE_CXX_FLAGS)
# Disable MSVC warnings
if( MSVC )
More information about the lldb-commits
mailing list