Skip to content

Commit 6c82f58

Browse files
committed
Generate and install man pages with CMake
Closes #351
1 parent 5ef5d3e commit 6c82f58

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

CMakeLists.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,33 @@ if (MAXMINDDB_BUILD_BINARIES)
107107
add_subdirectory(bin)
108108
endif()
109109

110+
# Check if man pages exist, if not, generate them
111+
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/man")
112+
find_program(PERL perl)
113+
if(PERL)
114+
message(STATUS "Generating man pages")
115+
execute_process(
116+
COMMAND ${PERL} ${CMAKE_CURRENT_SOURCE_DIR}/dev-bin/make-man-pages.pl
117+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
118+
)
119+
else()
120+
message(WARNING "Perl not found. Unable to generate man pages.")
121+
endif()
122+
endif()
123+
124+
# Install man pages if they exist
125+
if(MAXMINDDB_INSTALL AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/man")
126+
install(
127+
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/man/man1
128+
DESTINATION ${CMAKE_INSTALL_MANDIR}
129+
)
130+
131+
install(
132+
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/man/man3
133+
DESTINATION ${CMAKE_INSTALL_MANDIR}
134+
)
135+
endif()
136+
110137
if (BUILD_TESTING)
111138
enable_testing()
112139
add_subdirectory(t)

Changes.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.11.0
2+
3+
* When building with CMake, the man pages will now be generated and installed.
4+
Requested by Thomas Klausner. GitHub #351.
5+
16
## 1.10.0 - 2024-06-10
27

38
* When building with CMake, it is now possible to disable the building

0 commit comments

Comments
 (0)