From 4be5c747987d2c2530c41c332c679fbe2392a8e2 Mon Sep 17 00:00:00 2001 From: rexim Date: Fri, 1 Nov 2024 18:58:58 +0700 Subject: [PATCH] Relative DESTINATION path when installing man page This makes the install() function install the file with respect to `CMAKE_INSTALL_PREFIX` which may not always be `/usr/local/` especially when some people install the compiler locally in their `$HOME` folder. https://cmake.org/cmake/help/latest/command/install.html --- CMakeLists.txt | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4e4924c9..6019c083a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -526,14 +526,8 @@ install(TARGETS c3c DESTINATION bin) install(DIRECTORY lib/ DESTINATION lib/c3) # Man page install (OSX/Linux only) -set(MAN_PAGE_DIR "/usr/local/share/man/man1") -message(STATUS "installing man page to ${MAN_PAGE_DIR}") - -if (NOT WIN32 AND EXISTS "${MAN_PAGE_DIR}") - install(FILES c3c.1 DESTINATION ${MAN_PAGE_DIR}) -elseif (NOT WIN32) - # won't create MAN_PAGE_DIR if it doesn't already exist - message(WARNING "Man page directory ${MAN_PAGE_DIR} does not exist, skipping man page installation") +if (NOT WIN32) + install(FILES c3c.1 DESTINATION "share/man/man1") endif() if (C3_WITH_LLVM AND DEFINED sanitizer_runtime_libraries)