summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2023-04-10 16:19:09 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2023-04-10 16:19:09 +0200
commit3835b72e2faefc4ace3784805630a885d5921042 (patch)
treec42204fe4f0ae7294630eed98ac0d6ed26fb1668 /src
parent027e7386555f8b1ce98ff35bd6edc27595c97e3e (diff)
Fix CMake generation for minimal CMake version (3.2.3)
Unfortunately `execute_process(COMMAND pkg-config ...)` used for CMake versions lower than 3.4 appends a trailing newline ('\n') to the output variable which must be removed. Replace double slash '//' returned by pkg-config with a single '/' for consistency (applies to all CMake versions). Tested with CMake 3.2.3 but we should probably raise the minimal CMake version to a more recent version in the future.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 920488e89..e39fea044 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -646,7 +646,11 @@ if (UNIX AND OPTION_USE_WAYLAND)
else()
execute_process(COMMAND pkg-config --variable=pkgdatadir wayland-protocols
OUTPUT_VARIABLE PROTOCOLS)
+ # strip trailing newline
+ string (REPLACE "\n" "" PROTOCOLS ${PROTOCOLS})
endif (NOT (CMAKE_VERSION VERSION_LESS 3.4))
+ # replace "//" with "/"
+ string (REPLACE "//" "/" PROTOCOLS ${PROTOCOLS})
if (NOT(EXISTS ${PROTOCOLS}/stable/xdg-shell/xdg-shell.xml))
message(WARNING "Install necessary file ${PROTOCOLS}/stable/xdg-shell/xdg-shell.xml")
endif ()