Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Panel Plugins
xfce4-whiskermenu-plugin
Commits
f6125622
Commit
f6125622
authored
Jun 13, 2022
by
Graeme Gott
Browse files
Clean up fetching version string
parent
ffb80f58
Changes
6
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
f6125622
cmake_minimum_required
(
VERSION 3.16
)
# SPDX-FileCopyrightText: 2013-2022 Graeme Gott <graeme@gottcode.org>
#
# SPDX-License-Identifier: GPL-2.0-or-later
project
(
whiskermenu
)
cmake_minimum_required
(
VERSION 3.16
)
# version number
set
(
whiskermenu_version_major
"2"
)
set
(
whiskermenu_version_minor
"7"
)
set
(
whiskermenu_version_micro
"0"
)
set
(
whiskermenu_version_tag
"git"
)
set
(
whiskermenu_version
"
${
whiskermenu_version_major
}
.
${
whiskermenu_version_minor
}
.
${
whiskermenu_version_micro
}
"
)
if
(
${
whiskermenu_version_tag
}
MATCHES
"git"
)
if
(
NOT DEFINED whiskermenu_version_build
)
execute_process
(
COMMAND git describe
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
OUTPUT_VARIABLE whiskermenu_version_build
)
string
(
REGEX REPLACE
"^.*-g"
""
whiskermenu_version_build
"
${
whiskermenu_version_build
}
"
)
string
(
REGEX REPLACE
"
\n
"
""
whiskermenu_version_build
"
${
whiskermenu_version_build
}
"
)
endif
()
set
(
whiskermenu_version
"
${
whiskermenu_version
}
.
${
whiskermenu_version_tag
}
-
${
whiskermenu_version_build
}
"
)
endif
()
project
(
whiskermenu VERSION 2.7.0
)
# options
string
(
TOLOWER
"
${
CMAKE_BUILD_TYPE
}
"
CMAKE_BUILD_TYPE_TOLOWER
)
...
...
cmake/AddVersionCompileDefinition.cmake
0 → 100644
View file @
f6125622
# SPDX-FileCopyrightText: 2022 Graeme Gott <graeme@gottcode.org>
#
# SPDX-License-Identifier: GPL-2.0-or-later
function
(
add_version_compile_definition versionstr_file versionstr_def
)
# Use project's VERSION by default
set
(
versionstr
${
PROJECT_VERSION
}
)
find_package
(
Git QUIET
)
if
(
Git_FOUND
)
# Find git repository
execute_process
(
COMMAND
${
GIT_EXECUTABLE
}
rev-parse --absolute-git-dir
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
RESULT_VARIABLE git_dir_result
OUTPUT_VARIABLE git_dir
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if
(
git_dir_result EQUAL 0
)
# Find version number from git
execute_process
(
COMMAND
${
GIT_EXECUTABLE
}
describe --tags --match
"v*"
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
OUTPUT_VARIABLE versionstr
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string
(
REGEX REPLACE
"^v"
""
versionstr
"
${
versionstr
}
"
)
# Rerun CMake when git repository changes
if
(
EXISTS
${
git_dir
}
/logs/HEAD
)
set_property
(
DIRECTORY
APPEND
PROPERTY CMAKE_CONFIGURE_DEPENDS
${
git_dir
}
/logs/HEAD
)
endif
()
endif
()
endif
()
# Pass version as compile definition to file
set_property
(
SOURCE
${
versionstr_file
}
APPEND
PROPERTY COMPILE_DEFINITIONS
${
versionstr_def
}
=
"
${
versionstr
}
"
)
endfunction
()
cmake/uninstall.cmake.in
View file @
f6125622
...
...
@@ -11,11 +11,11 @@ string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_pro
gram
(
exec
ute
_pro
cess
(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif()
...
...
icons/CMakeLists.txt
View file @
f6125622
# SPDX-FileCopyrightText: 2013 Graeme Gott <graeme@gottcode.org>
#
# SPDX-License-Identifier: GPL-2.0-or-later
set
(
INSTALL_ICONDIR
${
CMAKE_INSTALL_DATADIR
}
/icons/hicolor
)
install
(
FILES hi16-app-whiskermenu.png
...
...
panel-plugin/CMakeLists.txt
View file @
f6125622
# SPDX-FileCopyrightText: 2013-2022 Graeme Gott <graeme@gottcode.org>
#
# SPDX-License-Identifier: GPL-2.0-or-later
include
(
../cmake/AddVersionCompileDefinition.cmake
)
add_version_compile_definition
(
plugin.cpp PACKAGE_VERSION
)
find_package
(
PkgConfig REQUIRED
)
pkg_check_modules
(
GTK3 REQUIRED IMPORTED_TARGET gtk+-3.0>=3.22
)
pkg_check_modules
(
exo REQUIRED IMPORTED_TARGET exo-2>=0.12
)
...
...
@@ -52,7 +59,6 @@ target_compile_definitions(whiskermenu PRIVATE
GETTEXT_PACKAGE=
"xfce4-whiskermenu-plugin"
PACKAGE_LOCALE_DIR=
"
${
CMAKE_INSTALL_FULL_LOCALEDIR
}
"
PACKAGE_NAME=
"xfce4-whiskermenu-plugin"
PACKAGE_VERSION=
"
${
whiskermenu_version
}
"
BINDIR=
"
${
CMAKE_INSTALL_FULL_BINDIR
}
"
DATADIR=
"
${
CMAKE_INSTALL_FULL_DATADIR
}
"
SETTINGS_MENUFILE=
"
${
CMAKE_INSTALL_FULL_SYSCONFDIR
}
/xdg/menus/xfce-settings-manager.menu"
...
...
po/CMakeLists.txt
View file @
f6125622
# SPDX-FileCopyrightText: 2013-2020 Graeme Gott <graeme@gottcode.org>
#
# SPDX-License-Identifier: GPL-2.0-or-later
find_package
(
Gettext 0.19.1 REQUIRED
)
# Generate translations
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment