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

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