From 4001a468b75d9008c564ecead63c24bfe9e4b266 Mon Sep 17 00:00:00 2001 From: Mark Mossberg Date: Sun, 27 Sep 2020 00:50:23 -0400 Subject: 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. --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') 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} -- cgit v1.2.3