Merge pull request #228 from xantares/shared

Use BUILD_SHARED_LIBS cmake standard.
This commit is contained in:
Lee Thomason 2014-11-15 17:55:04 -08:00
commit c82446c81e
1 changed files with 9 additions and 18 deletions

View File

@ -46,12 +46,8 @@ endif(MSVC)
################################ ################################
# Add targets # Add targets
set(BUILD_STATIC_LIBS ON CACHE BOOL "Set to ON to build static libraries") option(BUILD_SHARED_LIBS "build shared or static libraries" ON)
if(BUILD_STATIC_LIBS) add_library(tinyxml2 tinyxml2.cpp tinyxml2.h)
add_library(tinyxml2static STATIC tinyxml2.cpp tinyxml2.h)
set_target_properties(tinyxml2static PROPERTIES OUTPUT_NAME tinyxml2)
endif(BUILD_STATIC_LIBS)
add_library(tinyxml2 SHARED tinyxml2.cpp tinyxml2.h)
set_target_properties(tinyxml2 PROPERTIES set_target_properties(tinyxml2 PROPERTIES
COMPILE_DEFINITIONS "TINYXML2_EXPORT" COMPILE_DEFINITIONS "TINYXML2_EXPORT"
VERSION "${GENERIC_LIB_VERSION}" VERSION "${GENERIC_LIB_VERSION}"
@ -63,16 +59,11 @@ add_dependencies(test ${TARGET_DATA_COPY})
target_link_libraries(test tinyxml2) target_link_libraries(test tinyxml2)
if(BUILD_STATIC_LIBS) install(TARGETS tinyxml2
install(TARGETS tinyxml2 tinyxml2static
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
else(BUILD_STATIC_LIBS)
install(TARGETS tinyxml2
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(BUILD_STATIC_LIBS)
install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
foreach(p LIB INCLUDE) foreach(p LIB INCLUDE)