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