mirror of https://github.com/AxioDL/tinyxml2.git
Added BUILD_TESTS option to enable/disable building of xmltest
This commit is contained in:
parent
962732fd3e
commit
47c7d70064
|
@ -63,9 +63,12 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
|
||||||
# To build static libs also - Do cmake . -DBUILD_STATIC_LIBS:BOOL=ON
|
# To build static libs also - Do cmake . -DBUILD_STATIC_LIBS:BOOL=ON
|
||||||
# User can choose not to build shared library by using cmake -BUILD_SHARED_LIBS:BOOL:OFF
|
# User can choose not to build shared library by using cmake -BUILD_SHARED_LIBS:BOOL:OFF
|
||||||
# To build only static libs use cmake . -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_STATIC_LIBS:BOOL=ON
|
# To build only static libs use cmake . -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_STATIC_LIBS:BOOL=ON
|
||||||
|
# To build the tests, use cmake . -DBUILD_TESTS:BOOL=ON
|
||||||
|
# To disable the building of the tests, use cmake . -DBUILD_TESTS:BOOL=OFF
|
||||||
|
|
||||||
option(BUILD_SHARED_LIBS "build as shared library" ON)
|
option(BUILD_SHARED_LIBS "build as shared library" ON)
|
||||||
option(BUILD_STATIC_LIBS "build as static library" OFF)
|
option(BUILD_STATIC_LIBS "build as static library" OFF)
|
||||||
|
option(BUILD_TESTS "build xmltest" ON)
|
||||||
|
|
||||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
|
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
|
||||||
|
@ -106,16 +109,21 @@ install(TARGETS tinyxml2_static
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(xmltest xmltest.cpp)
|
if(BUILD_TESTS)
|
||||||
if(BUILD_SHARED_LIBS)
|
add_executable(xmltest xmltest.cpp)
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
add_dependencies(xmltest tinyxml2)
|
add_dependencies(xmltest tinyxml2)
|
||||||
add_dependencies(xmltest ${TARGET_DATA_COPY})
|
add_dependencies(xmltest ${TARGET_DATA_COPY})
|
||||||
target_link_libraries(xmltest tinyxml2)
|
target_link_libraries(xmltest tinyxml2)
|
||||||
else(BUILD_STATIC_LIBS)
|
else(BUILD_STATIC_LIBS)
|
||||||
add_dependencies(xmltest tinyxml2_static)
|
add_dependencies(xmltest tinyxml2_static)
|
||||||
add_dependencies(xmltest ${TARGET_DATA_COPY})
|
add_dependencies(xmltest ${TARGET_DATA_COPY})
|
||||||
target_link_libraries(xmltest tinyxml2_static)
|
target_link_libraries(xmltest tinyxml2_static)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#add_test(xmltest ${SAMPLE_NAME} COMMAND $<TARGET_FILE:${SAMPLE_NAME}>)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(TARGETS DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install(TARGETS DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
|
|
||||||
install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
|
@ -130,8 +138,6 @@ endforeach()
|
||||||
configure_file(tinyxml2.pc.in tinyxml2.pc @ONLY)
|
configure_file(tinyxml2.pc.in tinyxml2.pc @ONLY)
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tinyxml2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tinyxml2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||||
|
|
||||||
#add_test(xmltest ${SAMPLE_NAME} COMMAND $<TARGET_FILE:${SAMPLE_NAME}>)
|
|
||||||
|
|
||||||
# uninstall target
|
# uninstall target
|
||||||
configure_file(
|
configure_file(
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
||||||
|
|
Loading…
Reference in New Issue