Skip to content

Commit

Permalink
Improve configurability of CMake install directories
Browse files Browse the repository at this point in the history
Make installation of man pages configurable per section
Use configuration variable TIMEW_BINDIR
Update documentation

Closes #553

Signed-off-by: Thomas Lauf <[email protected]>
  • Loading branch information
lauft committed Aug 10, 2023
1 parent be0243b commit 9499ddb
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 47 deletions.
21 changes: 11 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,18 @@ set (PACKAGE_STRING "${PACKAGE} ${VERSION}")
string (TIMESTAMP PACKAGE_DATE "%Y-%m-%d")

if (FREEBSD OR DRAGONFLY)
set (TIMEW_MANDIR man CACHE STRING "Installation directory for man pages")
set (TIMEW_MAN1DIR man/man1 CACHE STRING "Installation directory for man pages, section 1")
set (TIMEW_MAN5DIR man/man5 CACHE STRING "Installation directory for man pages, section 5")
set (TIMEW_MAN7DIR man/man7 CACHE STRING "Installation directory for man pages, section 7")
set (TIMEW_MANDIR man CACHE STRING "Installation directory for man pages")
set (TIMEW_MAN1DIR ${TIMEW_MANDIR}/man1 CACHE STRING "Installation directory for man pages, section 1")
set (TIMEW_MAN5DIR ${TIMEW_MANDIR}/man5 CACHE STRING "Installation directory for man pages, section 5")
set (TIMEW_MAN7DIR ${TIMEW_MANDIR}/man7 CACHE STRING "Installation directory for man pages, section 7")
else (FREEBSD OR DRAGONFLY)
set (TIMEW_MANDIR share/man CACHE STRING "Installation directory for man pages")
set (TIMEW_MAN1DIR share/man/man1 CACHE STRING "Installation directory for man pages, section 1")
set (TIMEW_MAN5DIR share/man/man5 CACHE STRING "Installation directory for man pages, section 5")
set (TIMEW_MAN7DIR share/man/man7 CACHE STRING "Installation directory for man pages, section 7")
set (TIMEW_MANDIR share/man CACHE STRING "Installation directory for man pages")
set (TIMEW_MAN1DIR ${TIMEW_MANDIR}/man1 CACHE STRING "Installation directory for man pages, section 1")
set (TIMEW_MAN5DIR ${TIMEW_MANDIR}/man5 CACHE STRING "Installation directory for man pages, section 5")
set (TIMEW_MAN7DIR ${TIMEW_MANDIR}/man7 CACHE STRING "Installation directory for man pages, section 7")
endif (FREEBSD OR DRAGONFLY)
set (TIMEW_DOCDIR share/doc/timew CACHE STRING "Installation directory for doc files")
set (TIMEW_DOCDIR share/doc/timew CACHE STRING "Installation directory for doc files")
set (TIMEW_BINDIR bin CACHE STRING "Installation directory for Timewarrior executable")

message ("-- Configuring cmake.h")
configure_file (${CMAKE_SOURCE_DIR}/cmake.h.in
Expand All @@ -58,7 +59,7 @@ endif (EXISTS ${CMAKE_SOURCE_DIR}/test)

set (doc_FILES ChangeLog README.md INSTALL AUTHORS LICENSE)
foreach (doc_FILE ${doc_FILES})
install (FILES ${doc_FILE} DESTINATION ${TIMEW_DOCDIR})
install (FILES ${doc_FILE} DESTINATION ${TIMEW_DOCDIR})
endforeach (doc_FILE)

# ---
Expand Down
38 changes: 16 additions & 22 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -48,41 +48,35 @@ These commands are explained below:
# Build and configurations options

You can customize the configuration run with CMake variables.
This will modify the installation process:
CMake configuration variables are applied with the `-D` option and consist of a `<name>` and a `<value>`:

To change the installation directory you use the following configuration variable:
$ cmake -D<name>=<value> .

To change the installation directory, use the `CMAKE_INSTALL_PREFIX` variable:

$ cmake -DCMAKE_INSTALL_PREFIX=<path-to-installation-dir> .

CMake configuration variables are applied with the -D option and consist of a <name> and a <value>:

$ cmake -D<name>=<value> .
This variable defaults to `/usr/local` on UNIX/Linux systems.

Five more variables can customize the installation process.
The following table lists them and their defaults plus the `CMAKE_INSTALL_PREFIX`:
The following table lists them and their default values:

CMAKE_INSTALL_PREFIX /usr/local
TIMEW_BINDIR bin
TIMEW_DOCDIR share/doc/timew
TIMEW_MAN1DIR share/man/man1
TIMEW_MAN5DIR share/man/man5
TIMEW_MAN7DIR share/man/man7
| Variable | Default Value |
|-----------------|-------------------|
| `TIMEW_BINDIR` | `bin` |
| `TIMEW_DOCDIR` | `share/doc/timew` |
| `TIMEW_MANDIR` | `share/man` |
| `TIMEW_MAN1DIR` | `share/man/man1` |
| `TIMEW_MAN7DIR` | `share/man/man7` |

The corresponding `TIMEW_*` variables will be combined with `CMAKE_INSTALL_PREFIX` to get absolute installation directories:
On FreeBSD or DragonFly BSD systems, the `share/` directory is omitted for the `TIMEW_MAN*DIR` variables.

CMAKE_INSTALL_PREFIX/TIMEW_BINDIR /usr/local/bin
CMAKE_INSTALL_PREFIX/TIMEW_DOCDIR /usr/local/share/doc/timew
CMAKE_INSTALL_PREFIX/TIMEW_MAN1DIR /usr/local/share/man/man1
CMAKE_INSTALL_PREFIX/TIMEW_MAN5DIR /usr/local/share/man/man5
CMAKE_INSTALL_PREFIX/TIMEW_MAN7DIR /usr/local/share/man/man7
The `TIMEW_*` variables are combined with the value of `CMAKE_INSTALL_PREFIX` to get the absolute paths.


# Updating Timewarrior build

This section concerns itself with the description of the procedure needed to update the local Timewarrior build from the 'timew' Git repository.

To update the local Timewarrior build, you need to update the Git repository, including the `src/libshared` submodule.
To do that, run:
To update the local Timewarrior build, you need to update the Git repository, including the `src/libshared` submodule, run:

$ git pull --recurse-submodules
$ git submodule update
Expand Down
6 changes: 3 additions & 3 deletions doc/holidays/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ cmake_minimum_required (VERSION 3.8)

message ("-- Configuring holiday documentation")

install (FILES README DESTINATION ${TIMEW_DOCDIR}/doc/holidays)
install (FILES holidays.en-US DESTINATION ${TIMEW_DOCDIR}/doc/holidays)
install (FILES refresh DESTINATION ${TIMEW_DOCDIR}/doc/holidays)
install (FILES README DESTINATION ${TIMEW_DOCDIR}/holidays)
install (FILES holidays.en-US DESTINATION ${TIMEW_DOCDIR}/holidays)
install (FILES refresh DESTINATION ${TIMEW_DOCDIR}/holidays)
4 changes: 1 addition & 3 deletions doc/man1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,4 @@ endforeach (SRC)

add_custom_target (man1 DEPENDS ${DOC_FILES})

install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DESTINATION ${TIMEW_MANDIR}
FILES_MATCHING PATTERN "*.1")
install (FILES ${DOC_FILES} DESTINATION ${TIMEW_MAN1DIR})
4 changes: 1 addition & 3 deletions doc/man7/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,4 @@ endforeach (SRC)

add_custom_target (man7 DEPENDS ${DOC_FILES})

install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DESTINATION ${TIMEW_MANDIR}
FILES_MATCHING PATTERN "*.7")
install (FILES ${DOC_FILES} DESTINATION ${TIMEW_MAN7DIR})
10 changes: 5 additions & 5 deletions doc/themes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cmake_minimum_required (VERSION 3.8)

message ("-- Configuring theme documentation")

install (FILES README DESTINATION ${TIMEW_DOCDIR}/doc/themes)
install (FILES dark.theme DESTINATION ${TIMEW_DOCDIR}/doc/themes)
install (FILES dark_blue.theme DESTINATION ${TIMEW_DOCDIR}/doc/themes)
install (FILES dark_green.theme DESTINATION ${TIMEW_DOCDIR}/doc/themes)
install (FILES dark_red.theme DESTINATION ${TIMEW_DOCDIR}/doc/themes)
install (FILES README DESTINATION ${TIMEW_DOCDIR}/themes)
install (FILES dark.theme DESTINATION ${TIMEW_DOCDIR}/themes)
install (FILES dark_blue.theme DESTINATION ${TIMEW_DOCDIR}/themes)
install (FILES dark_green.theme DESTINATION ${TIMEW_DOCDIR}/themes)
install (FILES dark_red.theme DESTINATION ${TIMEW_DOCDIR}/themes)
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ target_link_libraries (lex_executable timew libshared libshared
set_property (TARGET timew_executable PROPERTY OUTPUT_NAME "timew")
set_property (TARGET lex_executable PROPERTY OUTPUT_NAME "lex")

install (TARGETS timew_executable DESTINATION bin)
install (TARGETS timew_executable DESTINATION ${TIMEW_BINDIR})

0 comments on commit 9499ddb

Please sign in to comment.