diff options
author | Mark Mossberg <mark.mossberg@gmail.com> | 2020-09-27 00:50:23 -0400 |
---|---|---|
committer | Mark Mossberg <mark.mossberg@gmail.com> | 2020-09-27 00:50:23 -0400 |
commit | 4001a468b75d9008c564ecead63c24bfe9e4b266 (patch) | |
tree | 18a5eff889b764fd488c7646237cbbcdea73af41 /CMakeLists.txt | |
parent | 1aeb57d26bc303d5cfa1a9ff2a331df7ba278656 (diff) | |
download | tinyxml2-4001a468b75d9008c564ecead63c24bfe9e4b266.tar.gz |
cmake: Use a namespace for the tinyxml2 target in local export
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.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d43809..3c13dbe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,7 +76,8 @@ endif() # Export cmake script that can be used by downstream project
# via `include()`
export(TARGETS tinyxml2
- FILE ${CMAKE_BINARY_DIR}/${TARGETS_EXPORT_NAME}.cmake)
+ NAMESPACE tinyxml2::
+ FILE ${CMAKE_BINARY_DIR}/${TARGETS_EXPORT_NAME}.cmake)
install(TARGETS tinyxml2
EXPORT ${TARGETS_EXPORT_NAME}
|