diff options
-rw-r--r-- | var/spack/repos/builtin/packages/tinyxml/CMakeLists.txt | 22 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/tinyxml/package.py | 7 |
2 files changed, 20 insertions, 9 deletions
diff --git a/var/spack/repos/builtin/packages/tinyxml/CMakeLists.txt b/var/spack/repos/builtin/packages/tinyxml/CMakeLists.txt index 93f124d716..32db119762 100644 --- a/var/spack/repos/builtin/packages/tinyxml/CMakeLists.txt +++ b/var/spack/repos/builtin/packages/tinyxml/CMakeLists.txt @@ -1,17 +1,21 @@ cmake_minimum_required(VERSION 2.6) project(TinyXml) + OPTION(TIXML_USE_STL "Use STL with TIXML" ON) +OPTION(BUILD_SHARED_LIBS "build as shared library" ON) + if(TIXML_USE_STL) add_definitions(-DTIXML_USE_STL) endif(TIXML_USE_STL) -add_library( - tinyxml - tinyxml.cpp - tinystr.cpp - tinyxmlerror.cpp - tinyxmlparser.cpp -) -INSTALL( FILES tinyxml.h tinystr.h DESTINATION include ) -INSTALL( TARGETS tinyxml ARCHIVE DESTINATION lib ) +if(BUILD_SHARED_LIBS) + add_library(tinyxml SHARED tinyxml.cpp tinystr.cpp tinyxmlerror.cpp tinyxmlparser.cpp) + install(TARGETS tinyxml LIBRARY DESTINATION lib) +else() + add_library(tinyxml_static STATIC tinyxml.cpp tinystr.cpp tinyxmlerror.cpp tinyxmlparser.cpp) + set_target_properties(tinyxml_static PROPERTIES OUTPUT_NAME tinyxml) + install(TARGETS tinyxml_static ARCHIVE DESTINATION lib) +endif(BUILD_SHARED_LIBS) + +install(FILES tinyxml.h tinystr.h DESTINATION include) diff --git a/var/spack/repos/builtin/packages/tinyxml/package.py b/var/spack/repos/builtin/packages/tinyxml/package.py index d1f16fae57..e34315882f 100644 --- a/var/spack/repos/builtin/packages/tinyxml/package.py +++ b/var/spack/repos/builtin/packages/tinyxml/package.py @@ -35,6 +35,8 @@ class Tinyxml(CMakePackage): version('2.6.2', 'cba3f50dd657cb1434674a03b21394df9913d764') + variant('shared', default=True, description='Build a shared library') + def url_for_version(self, version): url = "https://sourceforge.net/projects/tinyxml/files/tinyxml/{0}/tinyxml_{1}.tar.gz" return url.format(version.dotted, version.underscored) @@ -42,3 +44,8 @@ class Tinyxml(CMakePackage): def patch(self): copyfile(join_path(os.path.dirname(__file__), "CMakeLists.txt"), "CMakeLists.txt") + + def cmake_args(self): + spec = self.spec + return [ + '-DBUILD_SHARED_LIBS=%s' % ('YES' if '+shared' in spec else 'NO')] |