Use ${CMAKE_INSTALL_PREFIX} to provide APP_PREFIX

Currently the value of $prefix is hardcoded in the source code.
This is not a good choice given we have switched to CMake and
that CMake provides the builtin variable ${CMAKE_INSTALL_PREFIX}
to provide this information.

This patch uses the value of ${CMAKE_INSTALL_PREFIX} to populate
flameshot's internal variable APP_PREFIX as well as using it
in generating the org.flameshot.Flameshot.service file with
a proper $prefix value (via CMAKE_INSTALL_FULL_BINDIR as provided
by GNUInstallDirs).
This commit is contained in:
Boyuan Yang
2020-09-04 21:05:54 -04:00
committed by borgmanJeremy
parent 5dba3de778
commit a8fb73b668
4 changed files with 4 additions and 21 deletions

View File

@@ -1,3 +1,3 @@
[D-BUS Service]
Name=org.flameshot.Flameshot
Exec=/usr/local/bin/flameshot
Exec=${CMAKE_INSTALL_FULL_BINDIR}/flameshot

View File

@@ -1,14 +0,0 @@
#!/usr/bin/bash
DIR=$(pwd)
TARGET="/usr/bin"
if [ -n "$1" ]
then
TARGET=${1%/}
fi
FILE='[D-BUS Service]\nName=org.dharkael.Flameshot\nExec=##REPLACE##/flameshot'
FILE=${FILE//##REPLACE##/$TARGET}
echo -e $FILE > $DIR/org.dharkael.Flameshot.service

View File

@@ -1,3 +0,0 @@
[D-BUS Service]
Name=org.flameshot.Flameshot
Exec=/usr/bin/flameshot

View File

@@ -102,7 +102,7 @@ target_link_libraries(
Qt5::Network
Qt5::Widgets)
target_compile_definitions(flameshot PRIVATE APP_PREFIX="/usr")
target_compile_definitions(flameshot PRIVATE APP_PREFIX="${CMAKE_INSTALL_PREFIX}")
target_compile_definitions(flameshot PRIVATE APP_VERSION="v0.8.0")
target_compile_definitions(flameshot PRIVATE IMGUR_CLIENT_ID="313baf0c7b4d3ff")
target_compile_definitions(flameshot PRIVATE QAPPLICATION_CLASS=QApplication)
@@ -137,8 +137,8 @@ configure_file(${CMAKE_SOURCE_DIR}/docs/bash-completion/flameshot
configure_file(${CMAKE_SOURCE_DIR}/data/dbus/org.flameshot.Flameshot.xml
${CMAKE_CURRENT_BINARY_DIR}/share/dbus-1/interfaces/org.flameshot.Flameshot.xml COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/data/dbus/package/org.flameshot.Flameshot.service
${CMAKE_CURRENT_BINARY_DIR}/share/dbus-1/services/org.flameshot.Flameshot.service COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/data/dbus/org.flameshot.Flameshot.service.in
${CMAKE_CURRENT_BINARY_DIR}/share/dbus-1/services/org.flameshot.Flameshot.service)
# Install Icons
configure_file(${CMAKE_SOURCE_DIR}/data/img/hicolor/48x48/apps/flameshot.png