From 3dfb999c651b6dd668103b41c7ed1c0aae049dd4 Mon Sep 17 00:00:00 2001 From: Arthus Date: Thu, 14 Apr 2022 17:15:19 -0400 Subject: [PATCH] cmake: Fix compilation of targets using FindWayland If WAYLAND_DEFINITIONS is set to "-I/usr/include/wayland", setting its value as INTERFACE_COMPILE_DEFINITION leads to CMake emitting "-D-I/usr/include/wayland" in the compiler flags. This breaks the compilation of targets that call find_package(Wayland), such as libobs and libobs-opengl, in gcc. To avoid this, rename WAYLAND_DEFINITIONS to WAYLAND_COMPILE_FLAGS to reflect that it contains ready-to-use compiler flags. Use WAYLAND_COMPILE_FLAGS as INTERFACE_COMPILE_OPTIONS so it just gets appended without adding the superfluous "-D". --- cmake/Modules/FindWayland.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/Modules/FindWayland.cmake b/cmake/Modules/FindWayland.cmake index 31983a8a7..ef827ea72 100644 --- a/cmake/Modules/FindWayland.cmake +++ b/cmake/Modules/FindWayland.cmake @@ -4,7 +4,7 @@ # # WAYLAND_FOUND - True if Wayland is found WAYLAND_LIBRARIES - Link # these to use Wayland WAYLAND_INCLUDE_DIRS - Include directory for Wayland -# WAYLAND_DEFINITIONS - Compiler flags for using Wayland +# WAYLAND_COMPILE_FLAGS - Compiler flags for using Wayland # # In addition the following more fine grained variables will be defined: # @@ -25,7 +25,7 @@ find_package(PkgConfig) pkg_check_modules(PKG_WAYLAND QUIET wayland-client wayland-server wayland-egl wayland-cursor) -set(WAYLAND_DEFINITIONS ${PKG_WAYLAND_CFLAGS}) +set(WAYLAND_COMPILE_FLAGS ${PKG_WAYLAND_CFLAGS}) find_path( WAYLAND_CLIENT_INCLUDE_DIRS @@ -125,8 +125,8 @@ foreach(component "Client" "Server" "EGL" "Cursor") "${WAYLAND_${component_u}_INCLUDE_DIRS}") set_target_properties( - Wayland::${component} PROPERTIES INTERFACE_COMPILE_DEFINITIONS - "${WAYLAND_DEFINITIONS}") + Wayland::${component} PROPERTIES INTERFACE_COMPILE_OPTIONS + "${WAYLAND_COMPILE_FLAGS}") endif() endif() endforeach()