From dd651307a59cba515cc053122dcbf598b27d421f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santiago=20Ospina=20De=20Los=20R=C3=ADos?= Date: Mon, 8 Feb 2021 04:35:41 +0100 Subject: [PATCH 1/5] Export and install targets and config file --- CMakeLists.txt | 10 ++++++++-- cmake/config.cmake.in | 5 +++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 52c1e2f..f7ee1ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,12 @@ if(GHC_FILESYSTEM_WITH_INSTALL) include(CMakePackageConfigHelpers) include(GNUInstallDirs) install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) - install(TARGETS ghc_filesystem EXPORT ghcFilesystemConfig) - install(EXPORT ghcFilesystemConfig NAMESPACE ghcFilesystem:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ghcFilesystem) + install(TARGETS ghc_filesystem EXPORT ghc_filesystem-targets) + install(EXPORT ghc_filesystem-targets NAMESPACE ghcFilesystem:: DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghcFilesystem") + export(EXPORT ghc_filesystem-targets NAMESPACE ghcFilesystem:: FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/ghc_filesystem-targets.cmake") + configure_package_config_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.cmake.in" + "${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config.cmake" + INSTALL_DESTINATION "${DUNE_INSTALL_LIBDIR}/cmake/ghcFilesystem" + PATH_VARS CMAKE_INSTALL_INCLUDEDIR) endif() diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in index 3d25f9f..ace9761 100644 --- a/cmake/config.cmake.in +++ b/cmake/config.cmake.in @@ -1,5 +1,6 @@ @PACKAGE_INIT@ -set_and_check(ghcfilesystem_INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIR@") +# import targets +include("${CMAKE_CURRENT_LIST_DIR}/ghc_filesystem-targets.cmake") -check_required_components(ghcfilesystem) +check_required_components(ghcfilesystem) \ No newline at end of file From da4b554a29ee7f09e318305621968486e23c85e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santiago=20Ospina=20De=20Los=20R=C3=ADos?= Date: Mon, 8 Feb 2021 04:43:19 +0100 Subject: [PATCH 2/5] Add alias --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f7ee1ea..195fee3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,4 +61,5 @@ if(GHC_FILESYSTEM_WITH_INSTALL) "${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config.cmake" INSTALL_DESTINATION "${DUNE_INSTALL_LIBDIR}/cmake/ghcFilesystem" PATH_VARS CMAKE_INSTALL_INCLUDEDIR) + add_library(ghcFilesystem::ghc_filesystem ALIAS ghc_filesystem) endif() From 54bcf10d42899067e4c46c17561389c8884741af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santiago=20Ospina=20De=20Los=20R=C3=ADos?= Date: Mon, 8 Feb 2021 04:52:56 +0100 Subject: [PATCH 3/5] Fix install dir --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 195fee3..cc15e88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,7 +59,7 @@ if(GHC_FILESYSTEM_WITH_INSTALL) configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.cmake.in" "${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config.cmake" - INSTALL_DESTINATION "${DUNE_INSTALL_LIBDIR}/cmake/ghcFilesystem" + INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghcFilesystem" PATH_VARS CMAKE_INSTALL_INCLUDEDIR) add_library(ghcFilesystem::ghc_filesystem ALIAS ghc_filesystem) endif() From 89b6db10d668ce2ff7e6ca758ceae04505750ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santiago=20Ospina=20De=20Los=20R=C3=ADos?= Date: Mon, 8 Feb 2021 05:00:00 +0100 Subject: [PATCH 4/5] Install config file --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc15e88..d0ea307 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,5 +61,7 @@ if(GHC_FILESYSTEM_WITH_INSTALL) "${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config.cmake" INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghcFilesystem" PATH_VARS CMAKE_INSTALL_INCLUDEDIR) + install(FILES "${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghcFilesystem") add_library(ghcFilesystem::ghc_filesystem ALIAS ghc_filesystem) endif() From b028be7434bb8309a25717402672d1c3c15cef3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santiago=20Ospina=20De=20Los=20R=C3=ADos?= Date: Mon, 8 Feb 2021 05:05:58 +0100 Subject: [PATCH 5/5] Switch to a searchable path --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d0ea307..54742e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,14 +54,14 @@ if(GHC_FILESYSTEM_WITH_INSTALL) include(GNUInstallDirs) install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(TARGETS ghc_filesystem EXPORT ghc_filesystem-targets) - install(EXPORT ghc_filesystem-targets NAMESPACE ghcFilesystem:: DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghcFilesystem") + install(EXPORT ghc_filesystem-targets NAMESPACE ghcFilesystem:: DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghc_filesystem") export(EXPORT ghc_filesystem-targets NAMESPACE ghcFilesystem:: FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/ghc_filesystem-targets.cmake") configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.cmake.in" "${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config.cmake" - INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghcFilesystem" + INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghc_filesystem" PATH_VARS CMAKE_INSTALL_INCLUDEDIR) install(FILES "${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config.cmake" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghcFilesystem") + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghc_filesystem") add_library(ghcFilesystem::ghc_filesystem ALIAS ghc_filesystem) endif()