diff options
author | Mark Mossberg <mark.mossberg@gmail.com> | 2019-12-04 01:27:03 +0300 |
---|---|---|
committer | Mark Mossberg <mark.mossberg@gmail.com> | 2019-12-04 01:27:03 +0300 |
commit | 588c6577dd04a62b3a082702e110b40d5be4e728 (patch) | |
tree | 20a8b088a34fe07783dd8d45e095b666290a0175 /CMakeLists.txt | |
parent | 57cd52b0462864fa3adad13bb1833ed28d797274 (diff) |
cmake: Clarify comment around exported cmake script
The `export()` command purely exports a cmake script into the build
directory; it is not related to find_package at all. It is technically
not necessary. The main use case would be a user copying it into their
internal cmake/ dir in their project, and then using `include()`'ing
that file in their cmake.
The `install(EXPORT...` command is what actually generates a cmake
module that is put on the filesystem in a location that can be found by
`find_package` when in config mode.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f072108..584f02a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,7 +75,8 @@ endif() set(TARGETS_EXPORT_NAME "${CMAKE_PROJECT_NAME}Targets")
-# 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}/${TARGETS_EXPORT_NAME}.cmake)
@@ -139,6 +140,7 @@ install(FILES 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)
|