From 3835b72e2faefc4ace3784805630a885d5921042 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Mon, 10 Apr 2023 16:19:09 +0200 Subject: 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. --- src/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') 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 () -- cgit v1.2.3