Skip to content

Commit 3117060

Browse files
authored
Merge pull request #14 from fenglc/master
Added cmake install support, thanks for the PR.
2 parents 38b9192 + 71a50bb commit 3117060

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

CMakeLists.txt

+16
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,19 @@ if(NOT hasParent)
3232
add_subdirectory(test)
3333
add_subdirectory(examples)
3434
endif()
35+
36+
include(CMakePackageConfigHelpers)
37+
include(GNUInstallDirs)
38+
39+
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
40+
41+
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR})
42+
set(PACKAGECONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
43+
44+
configure_package_config_file(cmake/config.cmake.in
45+
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
46+
INSTALL_DESTINATION ${PACKAGECONFIG_INSTALL_DIR}
47+
PATH_VARS INCLUDE_INSTALL_DIR)
48+
49+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
50+
DESTINATION ${PACKAGECONFIG_INSTALL_DIR})

cmake/config.cmake.in

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@PACKAGE_INIT@
2+
3+
set_and_check(ghcfilesystem_INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIR@")
4+
5+
check_required_components(ghcfilesystem)

0 commit comments

Comments
 (0)