Skip to content

Commit ea6d723

Browse files
committed
packaging capability added.
fix `find_package(Format.cmake xy.z.w)` version determination
1 parent 969284a commit ea6d723

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
build*
1+
build*
2+
Format.cmakeConfigVersion.cmake

packaging/CMakeLists.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
3+
set(Format.cmake_VERSION 1.8.3)
4+
5+
include(GNUInstallDirs)
6+
7+
set(CMAKEDIR
8+
${CMAKE_INSTALL_DATADIR}/cmake/Format.cmake/
9+
CACHE
10+
PATH
11+
"Path to a folder to which install the script Format.cmake . By default: ${CMAKE_INSTALL_DATADIR}/cmake/Format.cmake/"
12+
)
13+
14+
include(CMakePackageConfigHelpers)
15+
16+
include(GNUInstallDirs)
17+
18+
write_basic_package_version_file(${CMAKE_CURRENT_LIST_DIR}/../Format.cmakeConfigVersion.cmake VERSION ${Format.cmake_VERSION} COMPATIBILITY AnyNewerVersion ARCH_INDEPENDENT)
19+
20+
install(FILES "${CMAKE_CURRENT_LIST_DIR}/../CMakeLists.txt"
21+
DESTINATION "${CMAKEDIR}" RENAME "Format.cmakeConfig.cmake"
22+
)
23+
24+
install(FILES "${CMAKE_CURRENT_LIST_DIR}/../Format.cmakeConfigVersion.cmake"
25+
DESTINATION "${CMAKEDIR}"
26+
)
27+
install(FILES "${CMAKE_CURRENT_LIST_DIR}/../cmake-format.cmake"
28+
DESTINATION "${CMAKEDIR}"
29+
)
30+
31+
install(FILES "${CMAKE_CURRENT_LIST_DIR}/../git-clang-format.py"
32+
DESTINATION "${CMAKEDIR}"
33+
)
34+
35+
message(STATUS "Use `find_package(Format.cmake)` to use it")

0 commit comments

Comments
 (0)