From d76c7b1c2a79477424d191d4c7b1b8f4d30004ee Mon Sep 17 00:00:00 2001 From: Tatyana Krasnukha Date: Fri, 21 Jun 2019 11:46:46 +0000 Subject: [PATCH] [unittests] Simplify CMakeLists with object library The solution suggested by Chris Bieneman works for all versions of CMake. Differential Revision: https://reviews.llvm.org/D63544 llvm-svn: 364035 --- .../tools/lldb-mi/utils/CMakeLists.txt | 21 ++----------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/lldb/unittests/tools/lldb-mi/utils/CMakeLists.txt b/lldb/unittests/tools/lldb-mi/utils/CMakeLists.txt index cda54c1d1fee..7615dd7a662e 100644 --- a/lldb/unittests/tools/lldb-mi/utils/CMakeLists.txt +++ b/lldb/unittests/tools/lldb-mi/utils/CMakeLists.txt @@ -1,30 +1,13 @@ -# 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} +add_library(lldb-mi-utils OBJECT ${LLDB_SOURCE_DIR}/tools/lldb-mi/MIUtilString.cpp ) add_lldb_unittest(LLDBMiUtilTests + $ StringTest.cpp LINK_COMPONENTS Support ) -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 `$` expression is - # already supported in `target_sources`. - target_sources(LLDBMiUtilTests PRIVATE $) -endif() - set_target_properties(lldb-mi-utils PROPERTIES FOLDER "lldb libraries")