Resources are loaded from the current working directory. By setting the
current working directory to the source dir, rather than the out of tree
build dir, we can easily pick up the original resources without copying
them around during configuration.
Meson is a build system somewhat like cmake, but without all of the
rough edges. It supports many OSes, including all of the major ones, and
a large number of C++ compilers.
My interest isn't really in convincing people to use meson as the
default here, but meson provides a subproject mechanism that can fetch
external projects and build them along with the main project in a single
configure/compile invocation. This is extremely useful for platforms
that lack a (competent) package manager.
As far as I know the meson build does everything the cmake build does,
with one exception: generate the cmake config/version files. meson can
generate these files, but only in simple cases, and not when using
export targets like tinyxml2 does.
Previously in the locally (cmake build dir) exported cmake script,
there was no namespace, so the targets would directly be available
in the global namespace. Users would do something like:
include(cmake/tinyxml2Targets.cmake)
target_link_libraries(main tinyxml2)
Now, a namespace is used (just like the cmake export that is exported
to the system at the `install(EXPORT...)` command at the bottom of this
file. Uses will now look like:
include(cmake/tinyxml2Targets.cmake)
target_link_libraries(main tinyxml2::tinyxml2)
This is technically a minor breaking change. It will only affect users
that actually use the *locally* export cmake targets script, which I
expect to be fairly few (note that this is different from the system
exported script). Also, it will only affect users that freshly
build at this commit of tinyxml2, and have the cmake for their
downstream project configured to load it. That cmake will need to be
changed from the first snippet to the second snippet above.
CMakeLists.txt uses set(CMAKE_DEBUG_POSTFIX "d") to distinguish
between debug and release lib. Use this postfix also in the
generated tinyxml2.pc file in case of a CMake Debug build.
This results in the following contents of tinyxml2.pc
- Release:
Libs: -L${libdir} -ltinyxml2
- Debug:
Libs: -L${libdir} -ltinyxml2d