From 3f874806f1e752c81d0f44c59479407fff3dee74 Mon Sep 17 00:00:00 2001 From: Orivej Desh Date: Thu, 28 May 2020 13:36:23 +0000 Subject: [PATCH] Put headers into FMT_INC_DIR/fmt rather than directly into FMT_INC_DIR This makes FMT_INC_DIR an alias for CMAKE_INSTALL_INCLUDEDIR and simplifies generation of pkgconfig and cmake configs. --- CMakeLists.txt | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d025fb66..989e6b5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -249,7 +249,7 @@ if (FMT_INSTALL) "Installation directory for libraries, a relative path " "that will be joined to ${CMAKE_INSTALL_PREFIX}, or an arbitrary absolute path.") - set_verbose(FMT_INC_DIR ${CMAKE_INSTALL_INCLUDEDIR}/fmt CACHE STRING + set_verbose(FMT_INC_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE STRING "Installation directory for include files, a relative path " "that will be joined to ${CMAKE_INSTALL_PREFIX}, or an arbitrary absolute path.") @@ -257,13 +257,11 @@ if (FMT_INSTALL) "Installation directory for pkgconfig (.pc) files, a relative path " "that will be joined to ${CMAKE_INSTALL_PREFIX}, or an arbitrary absolute path.") - get_filename_component(FMT_INC_DIR_PARENT "${FMT_INC_DIR}" DIRECTORY) - set(INSTALL_TARGETS fmt fmt-header-only) target_include_directories(fmt PUBLIC - $) + $) target_include_directories(fmt-header-only INTERFACE - $) + $) # Generate the version, config and target files into the build directory. write_basic_package_version_file( @@ -272,7 +270,7 @@ if (FMT_INSTALL) COMPATIBILITY AnyNewerVersion) join_paths(libdir_for_pc_file "\${exec_prefix}" "${FMT_LIB_DIR}") - join_paths(includedir_for_pc_file "\${prefix}" "${FMT_INC_DIR_PARENT}") + join_paths(includedir_for_pc_file "\${prefix}" "${FMT_INC_DIR}") configure_file( "${PROJECT_SOURCE_DIR}/support/cmake/fmt.pc.in" @@ -302,7 +300,7 @@ if (FMT_INSTALL) install(FILES $ DESTINATION ${FMT_LIB_DIR} OPTIONAL) - install(FILES ${FMT_HEADERS} DESTINATION ${FMT_INC_DIR}) + install(FILES ${FMT_HEADERS} DESTINATION "${FMT_INC_DIR}/fmt") install(FILES "${pkgconfig}" DESTINATION "${FMT_PKGCONFIG_DIR}") endif ()