Protobuf package: allow building shared library (#7067)

This adds a +shared variant for building shared libraries in the
protobuf package and enables it by default.
This commit is contained in:
Brian Van Essen 2018-01-25 13:14:48 -07:00 committed by scheibelp
parent 82d4d58ca7
commit 8bc5916b68

View File

@ -41,6 +41,9 @@ class Protobuf(CMakePackage):
# does not build with CMake:
# version('2.5.0', '9c21577a03adc1879aba5b52d06e25cf')
variant('shared', default=True,
description='Enables the build of shared libraries')
depends_on('zlib')
conflicts('%gcc@:4.6') # Requires c++11
@ -62,6 +65,7 @@ def fetch_remote_versions(self):
def cmake_args(self):
args = [
'-DBUILD_SHARED_LIBS=%s' % int('+shared' in self.spec),
'-Dprotobuf_BUILD_TESTS:BOOL=OFF',
'-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON'
]