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>2020-09-17 23:28:16 +0300
committerGitHub <noreply@github.com>2020-09-17 23:28:16 +0300
commita0ce5527ab0e0f52fde52394aa18e60ecc9d5e88 (patch)
tree311782db4f7a25d8af6065b40a530469aef0e1b5 /CMakeLists.txt
parent54e1d6b2faea72d88db5d5506147de4762d22d61 (diff)
parent60e96163cad7e38ee03e89cb00451f9f3d8b76b1 (diff)
Merge pull request #789 from offlinemark/mark/cmake-clean
cmake: Refactor targets export variable and improve comments
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt13
1 files changed, 8 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2963fb6..2eeefdb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,6 +46,8 @@ set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
# to distinguish between debug and release lib
set(CMAKE_DEBUG_POSTFIX "d")
+set(TARGETS_EXPORT_NAME "${CMAKE_PROJECT_NAME}Targets")
+
add_library(tinyxml2 tinyxml2.cpp tinyxml2.h)
set_target_properties(tinyxml2 PROPERTIES
@@ -71,12 +73,13 @@ else()
endif(MSVC)
endif()
-# export targets for find_package config mode
+# Export cmake script that can be used by downstream project
+# via `include()`
export(TARGETS tinyxml2
- FILE ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}Targets.cmake)
+ FILE ${CMAKE_BINARY_DIR}/${TARGETS_EXPORT_NAME}.cmake)
install(TARGETS tinyxml2
- EXPORT ${CMAKE_PROJECT_NAME}Targets
+ EXPORT ${TARGETS_EXPORT_NAME}
RUNTIME
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT tinyxml2_runtime
@@ -119,7 +122,6 @@ if(NOT TARGET uninstall)
endif()
include(CMakePackageConfigHelpers)
-set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
configure_package_config_file(
"Config.cmake.in"
"${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake"
@@ -136,6 +138,7 @@ install(FILES
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME}
COMPONENT tinyxml2_config)
-install(EXPORT ${CMAKE_PROJECT_NAME}Targets NAMESPACE tinyxml2::
+# 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)