diff options
author | Victor Zverovich <victor.zverovich@gmail.com> | 2018-03-13 13:03:18 -0400 |
---|---|---|
committer | Victor Zverovich <victor.zverovich@gmail.com> | 2018-03-13 13:03:18 -0400 |
commit | e02aacc6343a3db64a5963dea51bb8b64a555bae (patch) | |
tree | 5886de533552e95e075fe2d9d5a1a1f389e15749 /CMakeLists.txt | |
parent | aee4512cc5bec007673ebdab10fc1d38e2f164f8 (diff) | |
download | fmtlib-e02aacc6343a3db64a5963dea51bb8b64a555bae.tar.gz |
Add CMake namespace (#511)
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ddbb73e8..95556539 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,6 +104,7 @@ if (HAVE_OPEN) endif () add_library(fmt ${FMT_SOURCES} ${FMT_HEADERS} README.rst ChangeLog.rst) +add_library(fmt::fmt ALIAS fmt) # Starting with CMake 3.1 the CXX_STANDARD property can be used instead. # Don't export -std since it may break projects that use other standards. @@ -170,14 +171,17 @@ if (FMT_INSTALL) ${PROJECT_SOURCE_DIR}/support/cmake/fmt-config.cmake.in ${project_config} INSTALL_DESTINATION ${FMT_CMAKE_DIR}) - export(TARGETS ${INSTALL_TARGETS} + # Use a namespace because CMake provides better diagnostics for namespaced + # imported targets. + export(TARGETS ${INSTALL_TARGETS} NAMESPACE fmt:: FILE ${PROJECT_BINARY_DIR}/${targets_export_name}.cmake) # Install version, config and target files. install( FILES ${project_config} ${version_config} DESTINATION ${FMT_CMAKE_DIR}) - install(EXPORT ${targets_export_name} DESTINATION ${FMT_CMAKE_DIR}) + install(EXPORT ${targets_export_name} DESTINATION ${FMT_CMAKE_DIR}, + NAMESPACE fmt::) # Install the library and headers. install(TARGETS ${INSTALL_TARGETS} EXPORT ${targets_export_name} |