[Lldb-commits] [PATCH] D63544: Use object library if cmake supports it
Phabricator via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Jun 20 08:03:38 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL363933: [unittests] Use object library if cmake supports it (authored by tkrasnukha, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D63544?vs=205800&id=205816#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63544/new/
https://reviews.llvm.org/D63544
Files:
lldb/trunk/unittests/tools/lldb-mi/utils/CMakeLists.txt
Index: lldb/trunk/unittests/tools/lldb-mi/utils/CMakeLists.txt
===================================================================
--- lldb/trunk/unittests/tools/lldb-mi/utils/CMakeLists.txt
+++ lldb/trunk/unittests/tools/lldb-mi/utils/CMakeLists.txt
@@ -1,4 +1,10 @@
-add_library(lldb-mi-utils OBJECT
+# Create object library to avoid unnecessary linking. If CMake version
+# doesn't support it, just create an ordinary library.
+if(NOT (${CMAKE_VERSION} VERSION_LESS "3.5.0"))
+ set (LIBRARY_TYPE "OBJECT")
+endif()
+
+add_library(lldb-mi-utils ${LIBRARY_TYPE}
${LLDB_SOURCE_DIR}/tools/lldb-mi/MIUtilString.cpp
)
@@ -9,5 +15,16 @@
Support
)
-target_sources(LLDBMiUtilTests PRIVATE $<TARGET_OBJECTS:lldb-mi-utils>)
+if((${CMAKE_VERSION} VERSION_LESS "3.5.0") OR
+ NOT (${CMAKE_VERSION} VERSION_LESS "3.12.0"))
+ # Link to either usual (cmake version < 3.5) or
+ # object (cmake version >= 3.12) library with lldm-mi sources.
+ target_link_libraries(LLDBMiUtilTests PRIVATE lldb-mi-utils)
+else()
+ # Object libraries still cannot be on the right-hand side of
+ # `target_link_libraries` but `$<TARGET_OBJECTS:objlib>` expression is
+ # already supported in `target_sources`.
+ target_sources(LLDBMiUtilTests PRIVATE $<TARGET_OBJECTS:lldb-mi-utils>)
+endif()
+
set_target_properties(lldb-mi-utils PROPERTIES FOLDER "lldb libraries")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63544.205816.patch
Type: text/x-patch
Size: 1363 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190620/7167b1a0/attachment-0001.bin>
More information about the lldb-commits
mailing list