From 29b0c32d7c9e77b86c9a7870f298f952a8271834 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Fri, 25 Aug 2023 09:59:50 +0300 Subject: [PATCH] Add ECM naming to aliases ECM FindWayland[0] naming is used by quite a few apps for almost a decade. [0] https://invent.kde.org/frameworks/extra-cmake-modules/-/blob/master/find-modules/FindWayland.cmake --- recipes/wayland/all/conanfile.py | 5 +++++ recipes/wayland/all/test_package/CMakeLists.txt | 5 ++++- recipes/wayland/all/test_package/test_package.c | 9 +++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/recipes/wayland/all/conanfile.py b/recipes/wayland/all/conanfile.py index 4deb10375518e..f1adf94d84b85 100644 --- a/recipes/wayland/all/conanfile.py +++ b/recipes/wayland/all/conanfile.py @@ -131,6 +131,7 @@ def package_info(self): if self.options.enable_libraries: self.cpp_info.components["wayland-server"].libs = ["wayland-server"] + self.cpp_info.components["wayland-server"].set_property("cmake_target_aliases", ["Wayland::Server"]) self.cpp_info.components["wayland-server"].set_property("pkg_config_name", "wayland-server") self.cpp_info.components["wayland-server"].requires = ["libffi::libffi"] self.cpp_info.components["wayland-server"].system_libs = ["pthread", "m"] @@ -147,6 +148,7 @@ def package_info(self): "\n".join(f"{key}={value}" for key, value in pkgconfig_variables.items())) self.cpp_info.components["wayland-client"].libs = ["wayland-client"] + self.cpp_info.components["wayland-client"].set_property("cmake_target_aliases", ["Wayland::Client"]) self.cpp_info.components["wayland-client"].set_property("pkg_config_name", "wayland-client") self.cpp_info.components["wayland-client"].requires = ["libffi::libffi"] self.cpp_info.components["wayland-client"].system_libs = ["pthread", "m"] @@ -164,15 +166,18 @@ def package_info(self): self.cpp_info.components["wayland-cursor"].libs = ["wayland-cursor"] self.cpp_info.components["wayland-cursor"].set_property("pkg_config_name", "wayland-cursor") + self.cpp_info.components["wayland-cursor"].set_property("cmake_target_aliases", ["Wayland::Cursor"]) self.cpp_info.components["wayland-cursor"].requires = ["wayland-client"] self.cpp_info.components["wayland-cursor"].set_property("component_version", self.version) self.cpp_info.components["wayland-egl"].libs = ["wayland-egl"] self.cpp_info.components["wayland-egl"].set_property("pkg_config_name", "wayland-egl") + self.cpp_info.components["wayland-egl"].set_property("cmake_target_aliases", "Wayland::Egl") self.cpp_info.components["wayland-egl"].requires = ["wayland-client"] self.cpp_info.components["wayland-egl"].set_property("component_version", "18.1.0") self.cpp_info.components["wayland-egl-backend"].set_property("pkg_config_name", "wayland-egl-backend") + self.cpp_info.components["wayland-egl-backend"].set_property("cmake_target_aliases", ["Wayland::Egl::Backend"]) self.cpp_info.components["wayland-egl-backend"].set_property("component_version", "3") # TODO: to remove in conan v2 diff --git a/recipes/wayland/all/test_package/CMakeLists.txt b/recipes/wayland/all/test_package/CMakeLists.txt index fa5ae025fbfc7..f366814cf5ce6 100644 --- a/recipes/wayland/all/test_package/CMakeLists.txt +++ b/recipes/wayland/all/test_package/CMakeLists.txt @@ -3,5 +3,8 @@ project(test_package LANGUAGES C) find_package(wayland COMPONENTS wayland-client REQUIRED) +# Test ECM FindWayland way +find_package(Wayland COMPONENTS Cursor REQUIRED) + add_executable(test_package test_package.c) -target_link_libraries(test_package PRIVATE wayland::wayland-client) +target_link_libraries(test_package PRIVATE wayland::wayland-client Wayland::Cursor) diff --git a/recipes/wayland/all/test_package/test_package.c b/recipes/wayland/all/test_package/test_package.c index 226d3b4a4a73a..3499d039540cc 100644 --- a/recipes/wayland/all/test_package/test_package.c +++ b/recipes/wayland/all/test_package/test_package.c @@ -1,12 +1,13 @@ #include #include #include +#include -int main(int argc, char **argv) { - +int main(int argc, char **argv) +{ struct wl_display *display = wl_display_connect(NULL); if (display == NULL) { - fprintf(stderr, "Can't connect to display\n"); + fprintf(stderr, "Can't connect to display\n"); } else { @@ -15,6 +16,6 @@ int main(int argc, char **argv) { wl_display_disconnect(display); printf("disconnected from display\n"); } - + exit(0); }