Make building a .desktop file optional.

This commit is contained in:
tastytea 2019-12-30 04:42:59 +01:00
parent 47106d85c8
commit 226170b547
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 12 additions and 5 deletions

View File

@ -19,6 +19,7 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
# Project build options. # Project build options.
option(WITH_MAN "Compile and install manpage." YES) option(WITH_MAN "Compile and install manpage." YES)
option(WITH_DESKTOP "Build and install a .desktop file." NO)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -37,10 +38,12 @@ endif()
install(FILES watchwords.json install(FILES watchwords.json
DESTINATION "${CMAKE_INSTALL_DATADIR}/mastorss") DESTINATION "${CMAKE_INSTALL_DATADIR}/mastorss")
# Needed for AppImage. if(WITH_DESKTOP)
configure_file("de.tastytea.${PROJECT_NAME}.desktop.in" # Needed for AppImage.
"${CMAKE_CURRENT_BINARY_DIR}/de.tastytea.${PROJECT_NAME}.desktop" @ONLY) configure_file("de.tastytea.${PROJECT_NAME}.desktop.in"
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/de.tastytea.${PROJECT_NAME}.desktop" "${CMAKE_CURRENT_BINARY_DIR}/de.tastytea.${PROJECT_NAME}.desktop" @ONLY)
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/de.tastytea.${PROJECT_NAME}.desktop"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
endif()
# include(cmake/packages.cmake) # include(cmake/packages.cmake)

View File

@ -55,6 +55,10 @@ cmake ..
cmake --build . cmake --build .
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
.CMake options:
* `-DWITH_MAN=NO` to not compile the manpage (default is `YES`).
* `-DWITH_DESKTOP=YES` to build the .desktop file (default is `NO`).
Install with `make install`. Install with `make install`.
== Usage == Usage