[Lldb-commits] [lldb] bca4366 - [lldb] Use modern CMake to avoid repetition (NFC)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 10 22:29:50 PDT 2020


Author: Jonas Devlieghere
Date: 2020-08-10T22:29:40-07:00
New Revision: bca43666e7dc41207b91fe28d7c6442b60d0e787

URL: https://github.com/llvm/llvm-project/commit/bca43666e7dc41207b91fe28d7c6442b60d0e787
DIFF: https://github.com/llvm/llvm-project/commit/bca43666e7dc41207b91fe28d7c6442b60d0e787.diff

LOG: [lldb] Use modern CMake to avoid repetition (NFC)

Use the target variants of include_directories and add_definitions to
avoid repetition.

Added: 
    

Modified: 
    lldb/unittests/Process/Linux/CMakeLists.txt
    lldb/unittests/Process/POSIX/CMakeLists.txt
    lldb/unittests/TestingSupport/CMakeLists.txt
    lldb/unittests/TestingSupport/Symbol/CMakeLists.txt
    lldb/unittests/debugserver/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/lldb/unittests/Process/Linux/CMakeLists.txt b/lldb/unittests/Process/Linux/CMakeLists.txt
index 31e9a57a4e46..d2256bc5ea38 100644
--- a/lldb/unittests/Process/Linux/CMakeLists.txt
+++ b/lldb/unittests/Process/Linux/CMakeLists.txt
@@ -1,8 +1,9 @@
-include_directories(${LLDB_SOURCE_DIR}/source/Plugins/Process/Linux)
-
 add_lldb_unittest(ProcessorTraceTests
   ProcessorTraceTest.cpp
 
   LINK_LIBS
     lldbPluginProcessLinux
-  )
\ No newline at end of file
+  )
+
+target_include_directories(ProcessorTraceTests PRIVATE
+  ${LLDB_SOURCE_DIR}/source/Plugins/Process/Linux)
\ No newline at end of file

diff  --git a/lldb/unittests/Process/POSIX/CMakeLists.txt b/lldb/unittests/Process/POSIX/CMakeLists.txt
index eabfb58d46fc..9d12495dd3e3 100644
--- a/lldb/unittests/Process/POSIX/CMakeLists.txt
+++ b/lldb/unittests/Process/POSIX/CMakeLists.txt
@@ -1,8 +1,9 @@
-include_directories(${LLDB_SOURCE_DIR}/source/Plugins/Process/POSIX)
-
 add_lldb_unittest(ProcessPOSIXTests
   NativeProcessELFTest.cpp
 
   LINK_LIBS
     lldbPluginProcessPOSIX
   )
+
+target_include_directories(ProcessPOSIXTests PRIVATE
+  ${LLDB_SOURCE_DIR}/source/Plugins/Process/POSIX)

diff  --git a/lldb/unittests/TestingSupport/CMakeLists.txt b/lldb/unittests/TestingSupport/CMakeLists.txt
index 5322362ed3a2..67ebe3242629 100644
--- a/lldb/unittests/TestingSupport/CMakeLists.txt
+++ b/lldb/unittests/TestingSupport/CMakeLists.txt
@@ -1,6 +1,3 @@
-# Gtest 1.8.0 uses tr1/tuple which is deprecated on MSVC, so we force it off.
-add_definitions(-DGTEST_HAS_TR1_TUPLE=0)
-
 set_property(DIRECTORY PROPERTY EXCLUDE_FROM_ALL ON)
 add_lldb_library(lldbUtilityHelpers
   MockTildeExpressionResolver.cpp
@@ -14,6 +11,5 @@ add_lldb_library(lldbUtilityHelpers
     Support
     ObjectYAML
   )
-include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
 
 add_subdirectory(Symbol)

diff  --git a/lldb/unittests/TestingSupport/Symbol/CMakeLists.txt b/lldb/unittests/TestingSupport/Symbol/CMakeLists.txt
index 3f93b9411373..c9891f2b0777 100644
--- a/lldb/unittests/TestingSupport/Symbol/CMakeLists.txt
+++ b/lldb/unittests/TestingSupport/Symbol/CMakeLists.txt
@@ -7,7 +7,9 @@ add_lldb_library(lldbSymbolHelpers
 # with MSVC, so it falls back to tr1 / experimental classes.  Since LLVM
 # itself requires C++11, we can safely force it on unconditionally so that
 # we don't have to fight with the buggy gtest check.
-add_definitions(-DGTEST_LANG_CXX11=1)
-add_definitions(-DGTEST_HAS_TR1_TUPLE=0)
-include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
-include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googlemock/include)
+target_compile_definitions(lldbSymbolHelpers PUBLIC
+  -DGTEST_LANG_CXX11=1
+  -DGTEST_HAS_TR1_TUPLE=0)
+target_include_directories(lldbSymbolHelpers PUBLIC
+  ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include
+  ${LLVM_MAIN_SRC_DIR}/utils/unittest/googlemock/include)

diff  --git a/lldb/unittests/debugserver/CMakeLists.txt b/lldb/unittests/debugserver/CMakeLists.txt
index c216eecd7d8a..415336948d0f 100644
--- a/lldb/unittests/debugserver/CMakeLists.txt
+++ b/lldb/unittests/debugserver/CMakeLists.txt
@@ -4,9 +4,6 @@
 # of the debugserver communication path. If you are looking for a non-darwin
 # remote debugging server, please use lldb-server.
 
-include_directories(${LLDB_SOURCE_DIR}/tools/debugserver/source
-                    ${LLDB_SOURCE_DIR}/tools/debugserver/source/MacOSX)
-
 add_lldb_unittest(debugserverTests
   JSONTest.cpp
   RNBSocketTest.cpp
@@ -20,6 +17,10 @@ add_lldb_unittest(debugserverTests
     Support
   )
 
+target_include_directories(debugserverTests PRIVATE
+  ${LLDB_SOURCE_DIR}/tools/debugserver/source
+  ${LLDB_SOURCE_DIR}/tools/debugserver/source/MacOSX)
+
 if(IOS)
   set_property(TARGET debugserverTests APPEND PROPERTY COMPILE_DEFINITIONS
       WITH_LOCKDOWN


        


More information about the lldb-commits mailing list