Skip to content

Commit

Permalink
Fix config installation (#93)
Browse files Browse the repository at this point in the history
* Export and install targets and config file

* Add alias

* Fix install dir

* Install config file

* Switch to a searchable path
  • Loading branch information
SoilRos committed Feb 8, 2021
1 parent 3d3c02c commit 0f6f0af
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
13 changes: 11 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ 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/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/ghc_filesystem"
PATH_VARS CMAKE_INSTALL_INCLUDEDIR)
install(FILES "${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghc_filesystem")
add_library(ghcFilesystem::ghc_filesystem ALIAS ghc_filesystem)
endif()
5 changes: 3 additions & 2 deletions cmake/config.cmake.in
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 0f6f0af

Please sign in to comment.