summaryrefslogtreecommitdiff
path: root/unittests/Makefile.unittest
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2010-02-25 06:34:33 +0000
committerJeffrey Yasskin <jyasskin@google.com>2010-02-25 06:34:33 +0000
commitc90171961d020d93e4ce548016d8ccb8aab00c57 (patch)
tree639ac8f1a8273a2563895bed7d55bd60fbff5f46 /unittests/Makefile.unittest
parente6ba0b576231ad3af599d1985dad370e59d954f9 (diff)
Try r96559 for the third time. This time the shared library is only built if
--enable-shared is passed to configure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97119 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Makefile.unittest')
-rw-r--r--unittests/Makefile.unittest11
1 files changed, 10 insertions, 1 deletions
diff --git a/unittests/Makefile.unittest b/unittests/Makefile.unittest
index 6fbef54691d..b1c1d2c6b14 100644
--- a/unittests/Makefile.unittest
+++ b/unittests/Makefile.unittest
@@ -28,6 +28,15 @@ CPP.Flags += -I$(LLVM_SRC_ROOT)/utils/unittest/googletest/include/
CPP.Flags += $(NO_VARIADIC_MACROS)
TESTLIBS = -lGoogleTest -lUnitTestMain
+ifeq ($(ENABLE_SHARED), 1)
+ # Add the absolute path to the dynamic library. This is ok because
+ # we'll never install unittests.
+ LD.Flags += $(RPATH) -Wl,$(LibDir)
+ # Also set {DYLD,LD}_LIBRARY_PATH because OSX ignores the rpath most
+ # of the time.
+ Run.Shared := $(SHLIBPATH_VAR)="$(LibDir)$${$(SHLIBPATH_VAR):+:}$$$(SHLIBPATH_VAR)"
+endif
+
$(LLVMUnitTestExe): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
$(Echo) Linking $(BuildMode) unit test $(TESTNAME) $(StripWarnMsg)
$(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
@@ -38,6 +47,6 @@ $(LLVMUnitTestExe): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
all:: $(LLVMUnitTestExe)
unitcheck:: $(LLVMUnitTestExe)
- $(LLVMUnitTestExe)
+ $(Run.Shared) $(LLVMUnitTestExe)
endif