--- tinyxml2-4.0.1/CMakeLists.txt +++ tinyxml2-4.0.1/CMakeLists.txt @@ -100,15 +100,18 @@ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -add_executable(xmltest xmltest.cpp) -if(BUILD_SHARED_LIBS) - add_dependencies(xmltest tinyxml2) - add_dependencies(xmltest ${TARGET_DATA_COPY}) - target_link_libraries(xmltest tinyxml2) -else(BUILD_STATIC_LIBS) - add_dependencies(xmltest tinyxml2_static) - add_dependencies(xmltest ${TARGET_DATA_COPY}) - target_link_libraries(xmltest tinyxml2_static) +set(BUILD_TEST OFF CACHE BOOL "Set to ON to build tests") +if(BUILD_TEST) + add_executable(xmltest xmltest.cpp) + if(BUILD_SHARED_LIBS) + add_dependencies(xmltest tinyxml2) + add_dependencies(xmltest ${TARGET_DATA_COPY}) + target_link_libraries(xmltest tinyxml2) + else(BUILD_STATIC_LIBS) + add_dependencies(xmltest tinyxml2_static) + add_dependencies(xmltest ${TARGET_DATA_COPY}) + target_link_libraries(xmltest tinyxml2_static) + endif() endif() install(TARGETS DESTINATION ${CMAKE_INSTALL_BINDIR})