Blame SOURCES/0001-unittests-Don-t-install-TestPlugin.so.patch

ef93f8
From cf1fb43186fd4d97ee2de0b222d44ecc500f82c7 Mon Sep 17 00:00:00 2001
ef93f8
From: Tom Stellard <tstellar@redhat.com>
ef93f8
Date: Mon, 13 Aug 2018 12:22:28 -0700
ef93f8
Subject: [PATCH] unittests: Don't install TestPlugin.so
ef93f8
ef93f8
add_llvm_loadable_module adds an install target by default, but this
ef93f8
module is only used for a unit test, so we don't need to instal it.
ef93f8
ef93f8
This patch adds a NO_INSTALL option to add_llvm_loadable_module that
ef93f8
can be used to disable installation of modules.
ef93f8
---
ef93f8
 cmake/modules/AddLLVM.cmake     | 13 ++++++++-----
ef93f8
 unittests/Passes/CMakeLists.txt |  2 +-
ef93f8
 2 files changed, 9 insertions(+), 6 deletions(-)
ef93f8
ef93f8
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
ef93f8
index 24ef5e4..1637ba6 100644
ef93f8
--- a/cmake/modules/AddLLVM.cmake
ef93f8
+++ b/cmake/modules/AddLLVM.cmake
ef93f8
@@ -671,7 +671,8 @@ macro(add_llvm_library name)
ef93f8
 endmacro(add_llvm_library name)
ef93f8
 
ef93f8
 macro(add_llvm_loadable_module name)
ef93f8
-  llvm_add_library(${name} MODULE ${ARGN})
ef93f8
+  cmake_parse_arguments(ARG "NO_INSTALL" "" "" ${ARGN})
ef93f8
+  llvm_add_library(${name} MODULE ${ARG_UNPARSED_ARGUMENTS})
ef93f8
   if(NOT TARGET ${name})
ef93f8
     # Add empty "phony" target
ef93f8
     add_custom_target(${name})
ef93f8
@@ -693,10 +694,12 @@ macro(add_llvm_loadable_module name)
ef93f8
           set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True)
ef93f8
         endif()
ef93f8
 
ef93f8
-        install(TARGETS ${name}
ef93f8
-                ${export_to_llvmexports}
ef93f8
-                LIBRARY DESTINATION ${dlldir}
ef93f8
-                ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
ef93f8
+        if (NOT ARG_NO_INSTALL)
ef93f8
+          install(TARGETS ${name}
ef93f8
+                  ${export_to_llvmexports}
ef93f8
+                  LIBRARY DESTINATION ${dlldir}
ef93f8
+                  ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
ef93f8
+        endif()
ef93f8
       endif()
ef93f8
       set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
ef93f8
     endif()
ef93f8
diff --git a/unittests/Passes/CMakeLists.txt b/unittests/Passes/CMakeLists.txt
ef93f8
index d90df20..99390e6 100644
ef93f8
--- a/unittests/Passes/CMakeLists.txt
ef93f8
+++ b/unittests/Passes/CMakeLists.txt
ef93f8
@@ -14,7 +14,7 @@ add_llvm_unittest(PluginsTests
ef93f8
 export_executable_symbols(PluginsTests)
ef93f8
 
ef93f8
 set(LLVM_LINK_COMPONENTS)
ef93f8
-add_llvm_loadable_module(TestPlugin
ef93f8
+add_llvm_loadable_module(TestPlugin NO_INSTALL
ef93f8
   TestPlugin.cpp
ef93f8
   )
ef93f8
 
ef93f8
-- 
ef93f8
1.8.3.1
ef93f8