Build shared libs for tinyxml. (#7914)
This commit is contained in:
parent
d02b5b96d3
commit
094eb5f9a8
@ -1,17 +1,21 @@
|
|||||||
cmake_minimum_required(VERSION 2.6)
|
cmake_minimum_required(VERSION 2.6)
|
||||||
|
|
||||||
project(TinyXml)
|
project(TinyXml)
|
||||||
|
|
||||||
OPTION(TIXML_USE_STL "Use STL with TIXML" ON)
|
OPTION(TIXML_USE_STL "Use STL with TIXML" ON)
|
||||||
|
OPTION(BUILD_SHARED_LIBS "build as shared library" ON)
|
||||||
|
|
||||||
if(TIXML_USE_STL)
|
if(TIXML_USE_STL)
|
||||||
add_definitions(-DTIXML_USE_STL)
|
add_definitions(-DTIXML_USE_STL)
|
||||||
endif(TIXML_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 )
|
if(BUILD_SHARED_LIBS)
|
||||||
INSTALL( TARGETS tinyxml ARCHIVE DESTINATION lib )
|
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)
|
||||||
|
@ -35,6 +35,8 @@ class Tinyxml(CMakePackage):
|
|||||||
|
|
||||||
version('2.6.2', 'cba3f50dd657cb1434674a03b21394df9913d764')
|
version('2.6.2', 'cba3f50dd657cb1434674a03b21394df9913d764')
|
||||||
|
|
||||||
|
variant('shared', default=True, description='Build a shared library')
|
||||||
|
|
||||||
def url_for_version(self, version):
|
def url_for_version(self, version):
|
||||||
url = "https://sourceforge.net/projects/tinyxml/files/tinyxml/{0}/tinyxml_{1}.tar.gz"
|
url = "https://sourceforge.net/projects/tinyxml/files/tinyxml/{0}/tinyxml_{1}.tar.gz"
|
||||||
return url.format(version.dotted, version.underscored)
|
return url.format(version.dotted, version.underscored)
|
||||||
@ -42,3 +44,8 @@ def url_for_version(self, version):
|
|||||||
def patch(self):
|
def patch(self):
|
||||||
copyfile(join_path(os.path.dirname(__file__),
|
copyfile(join_path(os.path.dirname(__file__),
|
||||||
"CMakeLists.txt"), "CMakeLists.txt")
|
"CMakeLists.txt"), "CMakeLists.txt")
|
||||||
|
|
||||||
|
def cmake_args(self):
|
||||||
|
spec = self.spec
|
||||||
|
return [
|
||||||
|
'-DBUILD_SHARED_LIBS=%s' % ('YES' if '+shared' in spec else 'NO')]
|
||||||
|
Loading…
Reference in New Issue
Block a user