Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/leethomason/tinyxml2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLee Thomason <leethomason@gmail.com>2021-05-16 04:54:24 +0300
committerLee Thomason <leethomason@gmail.com>2021-05-16 04:54:24 +0300
commitefefbb85bc49d709bb966f03a0ae7fd92a5d2df4 (patch)
tree96d2ab8e6aee856b1a27db7bb766e98c33619b72
parentf2db58e65869cfb2c6a2f9f4911d7982056de66f (diff)
parent7df6b3ff4ab3e3cec7a242fa5f8749decd129e13 (diff)
Merge branch 'master' of https://github.com/modern-cmake/tinyxml2 into modern-cmake-master
-rw-r--r--.github/workflows/ci-unixish.yml20
-rw-r--r--.github/workflows/test.yml111
-rw-r--r--.travis.yml15
-rw-r--r--CMakeLists.txt241
-rw-r--r--Config.cmake.in4
-rw-r--r--appveyor.yml10
-rw-r--r--biicode.conf7
-rw-r--r--cmake/tinyxml2-config.cmake57
-rw-r--r--cmake/tinyxml2.pc.in (renamed from tinyxml2.pc.in)4
-rw-r--r--cmake_uninstall.cmake.in21
-rwxr-xr-xsetversion.py29
-rw-r--r--test/CMakeLists.txt20
12 files changed, 309 insertions, 230 deletions
diff --git a/.github/workflows/ci-unixish.yml b/.github/workflows/ci-unixish.yml
deleted file mode 100644
index ab17d94..0000000
--- a/.github/workflows/ci-unixish.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-name: C/C++ CI Unixish
-
-on: [push, pull_request]
-
-jobs:
- build:
- strategy:
- matrix:
- os: [ubuntu-latest, macos-latest]
-
- runs-on: ${{ matrix.os }}
-
- steps:
- - uses: actions/checkout@v2
- - name: make
- run: make
- - name: make check
- run: make check
- - name: Install
- run: sudo make install
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000..049f8cd
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,111 @@
+name: Test
+on: [ push, pull_request ]
+jobs:
+ test:
+ name: ${{ matrix.os }}, ${{ matrix.cmake_name }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ windows-2019, macos-10.15, ubuntu-20.04 ]
+ cmake: [ 3.15, 3.x ]
+ include:
+ - os: windows-2019
+ static_postfix: _static
+ tree: tree /F
+ CXX: cl
+
+ - os: ubuntu-20.04
+ tree: tree
+
+ - os: macos-10.15
+ tree: find
+
+ - cmake: 3.15
+ cmake_name: CMake 3.15
+ - cmake: 3.x
+ cmake_name: Latest CMake
+ env:
+ # CMake 3.15 doesn't detect Visual Studio correctly without these.
+ CXX: ${{ matrix.CXX }}
+ CC: ${{ matrix.CXX }}
+ runs-on: ${{ matrix.os }}
+ steps:
+ # System set-up
+ - uses: actions/checkout@v2
+ - uses: ilammy/msvc-dev-cmd@v1
+ - uses: seanmiddleditch/gha-setup-ninja@master
+ - uses: jwlawson/actions-setup-cmake@v1.8
+ with:
+ cmake-version: ${{ matrix.cmake }}
+
+ # Static Debug
+ - name: "Static Debug: Configure"
+ run: cmake -G Ninja -S . -B build-static-dbg -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_DEBUG_POSTFIX=d${{matrix.static_postfix}}"
+ - name: "Static Debug: Build"
+ run: cmake --build build-static-dbg
+ - name: "Static Debug: Test"
+ run: ctest --output-on-failure
+ working-directory: build-static-dbg
+
+ # Shared Debug
+ - name: "Shared Debug: Configure"
+ run: cmake -G Ninja -S . -B build-shared-dbg -DCMAKE_BUILD_TYPE=Debug -DCMAKE_DEBUG_POSTFIX=d -DBUILD_SHARED_LIBS=ON
+ - name: "Shared Debug: Build"
+ run: cmake --build build-shared-dbg
+ - name: "Shared Debug: Test"
+ run: ctest --output-on-failure
+ working-directory: build-shared-dbg
+
+ # Static Release
+ - name: "Static Release: Configure"
+ run: cmake -G Ninja -S . -B build-static-rel -DCMAKE_BUILD_TYPE=Release "-DCMAKE_RELEASE_POSTFIX=${{matrix.static_postfix}}"
+ - name: "Static Release: Build"
+ run: cmake --build build-static-rel
+ - name: "Static Release: Test"
+ run: ctest --output-on-failure
+ working-directory: build-static-rel
+
+ # Shared Release
+ - name: "Shared Release: Configure"
+ run: cmake -G Ninja -S . -B build-shared-rel -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
+ - name: "Shared Release: Build"
+ run: cmake --build build-shared-rel
+ - name: "Shared Release: Test"
+ run: ctest --output-on-failure
+ working-directory: build-shared-rel
+
+ # Joint install
+ - name: Install
+ run: |
+ cmake --install build-shared-dbg --prefix install
+ cmake --install build-static-dbg --prefix install
+ cmake --install build-shared-rel --prefix install
+ cmake --install build-static-rel --prefix install
+ - name: List install tree
+ run: ${{matrix.tree}} install
+
+ # Test find_package
+ - name: "Test find_package: Static Debug"
+ run: >-
+ ctest --build-and-test test test-static-dbg
+ --build-generator Ninja
+ --build-options -DCMAKE_BUILD_TYPE=Debug -Dtinyxml2_SHARED_LIBS=NO -DCMAKE_PREFIX_PATH=${{github.workspace}}/install
+ --test-command ctest --output-on-failure
+ - name: "Test find_package: Static Release"
+ run: >-
+ ctest --build-and-test test test-static-rel
+ --build-generator Ninja
+ --build-options -DCMAKE_BUILD_TYPE=Release -Dtinyxml2_SHARED_LIBS=NO -DCMAKE_PREFIX_PATH=${{github.workspace}}/install
+ --test-command ctest --output-on-failure
+ - name: "Test find_package: Shared Debug"
+ run: >-
+ ctest --build-and-test test test-shared-dbg
+ --build-generator Ninja
+ --build-options -DCMAKE_BUILD_TYPE=Debug -Dtinyxml2_SHARED_LIBS=YES -DCMAKE_PREFIX_PATH=${{github.workspace}}/install
+ --test-command ctest --output-on-failure
+ - name: "Test find_package: Shared Release"
+ run: >-
+ ctest --build-and-test test test-shared-rel
+ --build-generator Ninja
+ --build-options -DCMAKE_BUILD_TYPE=Release -Dtinyxml2_SHARED_LIBS=YES -DCMAKE_PREFIX_PATH=${{github.workspace}}/install
+ --test-command ctest --output-on-failure
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 0634ccb..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-language: cpp
-
-os:
- - linux
- - osx
-
-compiler:
- - g++
- - clang
-
-before_script: cmake .
-
-script:
- - make -j3
- - make test
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3c13dbe..2b8f790 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,148 +1,129 @@
-IF(BIICODE)
- ADD_BIICODE_TARGETS()
- if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/resources)
- file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/resources DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
- ENDIF()
- RETURN()
-ENDIF(BIICODE)
-cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
-cmake_policy(VERSION 2.6)
-if(POLICY CMP0063)
- cmake_policy(SET CMP0063 OLD)
-endif()
-
-project(tinyxml2)
-include(GNUInstallDirs)
+cmake_minimum_required(VERSION 3.15)
+project(tinyxml2 VERSION 8.0.0)
+
include(CTest)
-#enable_testing()
+option(tinyxml2_BUILD_TESTING "Build tests for tinyxml2" "${BUILD_TESTING}")
-#CMAKE_BUILD_TOOL
+##
+## Honor tinyxml2_SHARED_LIBS to match install interface
+##
-################################
-# set lib version here
+if (DEFINED tinyxml2_SHARED_LIBS)
+ set(BUILD_SHARED_LIBS "${tinyxml2_SHARED_LIBS}")
+endif ()
-set(GENERIC_LIB_VERSION "8.0.0")
-set(GENERIC_LIB_SOVERSION "8")
+##
+## Main library build
+##
-################################
-# Add definitions
+set(CMAKE_CXX_VISIBILITY_PRESET hidden)
+set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
-################################
-# Add targets
-# By Default shared library is being built
-# User can choose to build static library by using cmake -DBUILD_SHARED_LIBS:BOOL=OFF
-# To build the tests, use cmake . -DBUILD_TESTS:BOOL=ON
-# To disable the building of the tests, use cmake . -DBUILD_TESTS:BOOL=OFF
+add_library(tinyxml2 tinyxml2.cpp tinyxml2.h)
+add_library(tinyxml2::tinyxml2 ALIAS tinyxml2)
-option(BUILD_SHARED_LIBS "build as shared library" ON)
-option(BUILD_TESTS "build xmltest (deprecated: Use BUILD_TESTING)" ON)
+# Uncomment the following line to require C++11 (or greater) to use tinyxml2
+# target_compile_features(tinyxml2 PUBLIC cxx_std_11)
+target_include_directories(tinyxml2 PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
-# To allow using tinyxml in another shared library
-set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+target_compile_definitions(
+ tinyxml2
+ PUBLIC $<$<CONFIG:Debug>:TINYXML2_DEBUG>
+ INTERFACE $<$<BOOL:${BUILD_SHARED_LIBS}>:TINYXML2_IMPORT>
+ PRIVATE $<$<CXX_COMPILER_ID:MSVC>:_CRT_SECURE_NO_WARNINGS>
+)
-set(CMAKE_CXX_VISIBILITY_PRESET hidden)
-set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
+set_target_properties(
+ tinyxml2
+ PROPERTIES
+ DEFINE_SYMBOL "TINYXML2_EXPORT"
+ VERSION "${tinyxml2_VERSION}"
+ SOVERSION "${tinyxml2_VERSION_MAJOR}"
+)
-# to distinguish between debug and release lib
-set(CMAKE_DEBUG_POSTFIX "d")
+if (tinyxml2_BUILD_TESTING)
+ add_executable(xmltest xmltest.cpp)
+ target_link_libraries(xmltest PRIVATE tinyxml2::tinyxml2)
-set(TARGETS_EXPORT_NAME "${CMAKE_PROJECT_NAME}Targets")
+ add_test(
+ NAME xmltest
+ COMMAND xmltest
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+ )
-add_library(tinyxml2 tinyxml2.cpp tinyxml2.h)
+ set_tests_properties(xmltest PROPERTIES PASS_REGULAR_EXPRESSION ", Fail 0")
+endif ()
-set_target_properties(tinyxml2 PROPERTIES
- DEFINE_SYMBOL "TINYXML2_EXPORT"
- VERSION "${GENERIC_LIB_VERSION}"
- SOVERSION "${GENERIC_LIB_SOVERSION}")
-
-target_compile_definitions(tinyxml2 PUBLIC $<$<CONFIG:Debug>:TINYXML2_DEBUG>)
-
-if(DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
- target_include_directories(tinyxml2 PUBLIC
- $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
-
- if(MSVC)
- target_compile_definitions(tinyxml2 PUBLIC -D_CRT_SECURE_NO_WARNINGS)
- endif(MSVC)
-else()
- include_directories(${PROJECT_SOURCE_DIR})
-
- if(MSVC)
- add_definitions(-D_CRT_SECURE_NO_WARNINGS)
- endif(MSVC)
-endif()
-
-# Export cmake script that can be used by downstream project
-# via `include()`
-export(TARGETS tinyxml2
- NAMESPACE tinyxml2::
- FILE ${CMAKE_BINARY_DIR}/${TARGETS_EXPORT_NAME}.cmake)
-
-install(TARGETS tinyxml2
- EXPORT ${TARGETS_EXPORT_NAME}
- RUNTIME
- DESTINATION ${CMAKE_INSTALL_BINDIR}
- COMPONENT tinyxml2_runtime
- LIBRARY
- DESTINATION ${CMAKE_INSTALL_LIBDIR}
- COMPONENT tinyxml2_libraries
- ARCHIVE
- DESTINATION ${CMAKE_INSTALL_LIBDIR}
- COMPONENT tinyxml2_libraries)
-
-if(BUILD_TESTING AND BUILD_TESTS)
- add_executable(xmltest xmltest.cpp)
- add_dependencies(xmltest tinyxml2)
- target_link_libraries(xmltest tinyxml2)
-
- # Copy test resources and create test output directory
- add_custom_command(TARGET xmltest POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/resources $<TARGET_FILE_DIR:xmltest>/resources
- COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:xmltest>/resources/out
- COMMENT "Configuring xmltest resources directory: ${CMAKE_CURRENT_BINARY_DIR}/resources"
- )
-
- add_test(NAME xmltest COMMAND xmltest WORKING_DIRECTORY $<TARGET_FILE_DIR:xmltest>)
-endif()
-
-install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT tinyxml2_headers)
-
-if(CMAKE_BUILD_TYPE MATCHES Debug)
- set(LIB_POSTFIX ${CMAKE_DEBUG_POSTFIX})
-endif()
-configure_file(tinyxml2.pc.in tinyxml2.pc @ONLY)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tinyxml2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT tinyxml2_config)
-
-# uninstall target
-if(NOT TARGET uninstall)
- configure_file(
- "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
- "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
- IMMEDIATE @ONLY)
-
- add_custom_target(uninstall
- COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
-endif()
+##
+## Installation
+##
+## Standard modules
+include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
-configure_package_config_file(
- "Config.cmake.in"
- "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake"
- INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME}"
+
+## Custom locations
+set(tinyxml2_INSTALL_PKGCONFIGDIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
+ CACHE PATH "Directory for pkgconfig files")
+
+set(tinyxml2_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/tinyxml2"
+ CACHE STRING "Path to tinyxml2 CMake files")
+
+## CMake targets and export scripts
+
+install(
+ TARGETS tinyxml2 EXPORT tinyxml2-targets
+ RUNTIME COMPONENT tinyxml2_runtime
+ LIBRARY COMPONENT tinyxml2_runtime
+ NAMELINK_COMPONENT tinyxml2_development
+ ARCHIVE COMPONENT tinyxml2_development
+ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
+
+# Type-specific targets
+
+if (BUILD_SHARED_LIBS)
+ set(type shared)
+else ()
+ set(type static)
+endif ()
+
+install(
+ EXPORT tinyxml2-targets
+ DESTINATION "${tinyxml2_INSTALL_CMAKEDIR}"
+ NAMESPACE tinyxml2::
+ FILE tinyxml2-${type}-targets.cmake
+ COMPONENT tinyxml2_development
+)
+
+# Auto-generated version compatibility file
write_basic_package_version_file(
- "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake"
- VERSION ${GENERIC_LIB_VERSION}
- COMPATIBILITY SameMajorVersion
+ tinyxml2-config-version.cmake
+ COMPATIBILITY SameMajorVersion
+)
+
+install(
+ FILES
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/tinyxml2-config.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/tinyxml2-config-version.cmake"
+ DESTINATION "${tinyxml2_INSTALL_CMAKEDIR}"
+ COMPONENT tinyxml2_development
+)
+
+## Headers
+
+install(
+ FILES tinyxml2.h
+ TYPE INCLUDE
+ COMPONENT tinyxml2_development
+)
+
+## pkg-config
+
+configure_file(cmake/tinyxml2.pc.in tinyxml2.pc.gen @ONLY)
+file(GENERATE OUTPUT tinyxml2.pc INPUT "${CMAKE_CURRENT_BINARY_DIR}/tinyxml2.pc.gen")
+install(
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/tinyxml2.pc"
+ DESTINATION "${tinyxml2_INSTALL_PKGCONFIGDIR}"
+ COMPONENT tinyxml2_development
)
-install(FILES
- ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake
- ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME}
- COMPONENT tinyxml2_config)
-
-# Export targets for find_package config mode
-install(EXPORT ${TARGETS_EXPORT_NAME} NAMESPACE tinyxml2::
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME}
- COMPONENT tinyxml2_config)
diff --git a/Config.cmake.in b/Config.cmake.in
deleted file mode 100644
index 38bbde7..0000000
--- a/Config.cmake.in
+++ /dev/null
@@ -1,4 +0,0 @@
-@PACKAGE_INIT@
-
-include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
-check_required_components("@PROJECT_NAME@")
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index 0d5e86b..0000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-before_build:
- - cmake .
-
-build_script:
- - msbuild tinyxml2.sln /m /p:Configuration=Debug /t:ALL_BUILD
- - msbuild tinyxml2.sln /m /p:Configuration=Release /t:ALL_BUILD
- - cd %APPVEYOR_BUILD_FOLDER%\Debug
- - xmltest.exe
- - cd %APPVEYOR_BUILD_FOLDER%\Release
- - xmltest.exe
diff --git a/biicode.conf b/biicode.conf
deleted file mode 100644
index 5dca6b1..0000000
--- a/biicode.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-# Biicode configuration file
-
-[paths]
- /
-
-[dependencies]
- xmltest.cpp + resources/*.xml \ No newline at end of file
diff --git a/cmake/tinyxml2-config.cmake b/cmake/tinyxml2-config.cmake
new file mode 100644
index 0000000..5baa364
--- /dev/null
+++ b/cmake/tinyxml2-config.cmake
@@ -0,0 +1,57 @@
+cmake_minimum_required(VERSION 3.15)
+
+set(tinyxml2_known_comps static shared)
+set(tinyxml2_comp_static NO)
+set(tinyxml2_comp_shared NO)
+foreach (tinyxml2_comp IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
+ if (tinyxml2_comp IN_LIST tinyxml2_known_comps)
+ set(tinyxml2_comp_${tinyxml2_comp} YES)
+ else ()
+ set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
+ "tinyxml2 does not recognize component `${tinyxml2_comp}`.")
+ set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
+ return()
+ endif ()
+endforeach ()
+
+if (tinyxml2_comp_static AND tinyxml2_comp_shared)
+ set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
+ "tinyxml2 `static` and `shared` components are mutually exclusive.")
+ set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
+ return()
+endif ()
+
+set(tinyxml2_static_targets "${CMAKE_CURRENT_LIST_DIR}/tinyxml2-static-targets.cmake")
+set(tinyxml2_shared_targets "${CMAKE_CURRENT_LIST_DIR}/tinyxml2-shared-targets.cmake")
+
+macro(tinyxml2_load_targets type)
+ if (NOT EXISTS "${tinyxml2_${type}_targets}")
+ set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
+ "tinyxml2 `${type}` libraries were requested but not found.")
+ set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
+ return()
+ endif ()
+ include("${tinyxml2_${type}_targets}")
+endmacro()
+
+if (tinyxml2_comp_static)
+ tinyxml2_load_targets(static)
+elseif (tinyxml2_comp_shared)
+ tinyxml2_load_targets(shared)
+elseif (DEFINED tinyxml2_SHARED_LIBS AND tinyxml2_SHARED_LIBS)
+ tinyxml2_load_targets(shared)
+elseif (DEFINED tinyxml2_SHARED_LIBS AND NOT tinyxml2_SHARED_LIBS)
+ tinyxml2_load_targets(static)
+elseif (BUILD_SHARED_LIBS)
+ if (EXISTS "${tinyxml2_shared_targets}")
+ tinyxml2_load_targets(shared)
+ else ()
+ tinyxml2_load_targets(static)
+ endif ()
+else ()
+ if (EXISTS "${tinyxml2_static_targets}")
+ tinyxml2_load_targets(static)
+ else ()
+ tinyxml2_load_targets(shared)
+ endif ()
+endif ()
diff --git a/tinyxml2.pc.in b/cmake/tinyxml2.pc.in
index b100f60..a4fe22f 100644
--- a/tinyxml2.pc.in
+++ b/cmake/tinyxml2.pc.in
@@ -5,6 +5,6 @@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
Name: TinyXML2
Description: simple, small, C++ XML parser
-Version: @GENERIC_LIB_VERSION@
-Libs: -L${libdir} -ltinyxml2@LIB_POSTFIX@
+Version: @tinyxml2_VERSION@
+Libs: -L${libdir} -l$<TARGET_FILE_BASE_NAME:tinyxml2::tinyxml2>
Cflags: -I${includedir}
diff --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in
deleted file mode 100644
index 2c34c81..0000000
--- a/cmake_uninstall.cmake.in
+++ /dev/null
@@ -1,21 +0,0 @@
-if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
- message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
-endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
-
-file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
-string(REGEX REPLACE "\n" ";" files "${files}")
-foreach(file ${files})
- message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
- if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
- exec_program(
- "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
- OUTPUT_VARIABLE rm_out
- RETURN_VALUE rm_retval
- )
- if(NOT "${rm_retval}" STREQUAL 0)
- message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
- endif(NOT "${rm_retval}" STREQUAL 0)
- else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
- message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
- endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
-endforeach(file) \ No newline at end of file
diff --git a/setversion.py b/setversion.py
index 31d124f..ad30369 100755
--- a/setversion.py
+++ b/setversion.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python3
# Python program to set the version.
##############################################
@@ -18,14 +19,14 @@ def fileProcess( name, lineFunction ):
if not line: break
output += lineFunction( line )
filestream.close()
-
+
if not output: return # basic error checking
-
+
print( "Writing file " + name )
filestream = open( name, "w" );
filestream.write( output );
filestream.close()
-
+
def echoInput( line ):
return line
@@ -108,31 +109,19 @@ fileProcess( "dox", doxRule )
#### Write the CMakeLists.txt ####
-def cmakeRule1( line ):
+def cmakeRule( line ):
- matchVersion = "set(GENERIC_LIB_VERSION"
+ matchVersion = "project(tinyxml2 VERSION"
if line[0:len(matchVersion)] == matchVersion:
print( "1)tinyxml2.h Major found" )
- return matchVersion + " \"" + major + "." + minor + "." + build + "\")" + "\n"
+ return matchVersion + " " + major + "." + minor + "." + build + ")\n"
else:
return line;
-fileProcess( "CMakeLists.txt", cmakeRule1 )
+fileProcess( "CMakeLists.txt", cmakeRule )
-def cmakeRule2( line ):
-
- matchSoversion = "set(GENERIC_LIB_SOVERSION"
-
- if line[0:len(matchSoversion)] == matchSoversion:
- print( "1)tinyxml2.h Major found" )
- return matchSoversion + " \"" + major + "\")" + "\n"
-
- else:
- return line;
-
-fileProcess( "CMakeLists.txt", cmakeRule2 )
def mesonRule(line):
match = re.search(r"(\s*version) : '(\d+.\d+.\d+)',", line)
@@ -150,5 +139,3 @@ print( '3. Tag. git tag ' + versionStr )
print( ' OR git tag -a ' + versionStr + ' -m [tag message]' )
print( 'Remember to "git push" both code and tag. For the tag:' )
print( 'git push origin [tagname]')
-
- \ No newline at end of file
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 0000000..bf3a61f
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,20 @@
+cmake_minimum_required(VERSION 3.15)
+project(tinyxml2-test)
+
+enable_testing()
+
+find_package(tinyxml2 REQUIRED)
+
+add_executable(xmltest ../xmltest.cpp)
+target_link_libraries(xmltest PRIVATE tinyxml2::tinyxml2)
+
+add_test(
+ NAME xmltest
+ COMMAND xmltest
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.."
+)
+
+set_tests_properties(xmltest
+ PROPERTIES
+ PASS_REGULAR_EXPRESSION ", Fail 0"
+ ENVIRONMENT "PATH=$<TARGET_FILE_DIR:tinyxml2::tinyxml2>")