summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/googletest/package.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/var/spack/repos/builtin/packages/googletest/package.py b/var/spack/repos/builtin/packages/googletest/package.py
index 4651ea7c3e..67edb2dc2e 100644
--- a/var/spack/repos/builtin/packages/googletest/package.py
+++ b/var/spack/repos/builtin/packages/googletest/package.py
@@ -39,6 +39,8 @@ class Googletest(CMakePackage):
variant('pthreads', default=True,
description='Build multithreaded version with pthreads')
+ variant('shared', default=True,
+ description='Build shared libraries (DLLs)')
def cmake_args(self):
spec = self.spec
@@ -55,6 +57,8 @@ class Googletest(CMakePackage):
options.append('-Dgtest_disable_pthreads={0}'.format(
'ON' if '+pthreads' in spec else 'OFF'))
+ options.append('-DBUILD_SHARED_LIBS={0}'.format(
+ 'ON' if '+shared' in spec else 'OFF'))
return options
@when('@:1.7.0')
@@ -67,5 +71,9 @@ class Googletest(CMakePackage):
prefix.include)
mkdirp(prefix.lib)
- install('libgtest.a', prefix.lib)
- install('libgtest_main.a', prefix.lib)
+ if '+shared' in spec:
+ install('libgtest.{0}'.format(dso_suffix), prefix.lib)
+ install('libgtest_main.{0}'.format(dso_suffix), prefix.lib)
+ else:
+ install('libgtest.a', prefix.lib)
+ install('libgtest_main.a', prefix.lib)