summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTatyana Krasnukha <tatyana@synopsys.com>2019-06-20 15:06:31 +0000
committerTatyana Krasnukha <tatyana@synopsys.com>2019-06-20 15:06:31 +0000
commit36358cd3ed0f27af941074677e530a8c9aea8802 (patch)
treea0b94bc36d6bb75379387a77c8fd49c5513e014e
parent20fe9e54525ca1e6bc63a086ee65e480ade2d015 (diff)
downloadbcm5719-llvm-36358cd3ed0f27af941074677e530a8c9aea8802.tar.gz
bcm5719-llvm-36358cd3ed0f27af941074677e530a8c9aea8802.zip
[unittests] Use object library if cmake supports it
Differential Revision: https://reviews.llvm.org/D63544 llvm-svn: 363933
-rw-r--r--lldb/unittests/tools/lldb-mi/utils/CMakeLists.txt21
1 files changed, 19 insertions, 2 deletions
diff --git a/lldb/unittests/tools/lldb-mi/utils/CMakeLists.txt b/lldb/unittests/tools/lldb-mi/utils/CMakeLists.txt
index 909c005dcab..cda54c1d1fe 100644
--- a/lldb/unittests/tools/lldb-mi/utils/CMakeLists.txt
+++ b/lldb/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 @@ add_lldb_unittest(LLDBMiUtilTests
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")
OpenPOWER on IntegriCloud