Skip to content

Commit

Permalink
Add ECM naming to aliases
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bog-dan-ro committed Sep 21, 2023
1 parent 1ede4d1 commit 29b0c32
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
5 changes: 5 additions & 0 deletions recipes/wayland/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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"]
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion recipes/wayland/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
9 changes: 5 additions & 4 deletions recipes/wayland/all/test_package/test_package.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <wayland-client.h>
#include <wayland-cursor.h>

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
{
Expand All @@ -15,6 +16,6 @@ int main(int argc, char **argv) {
wl_display_disconnect(display);
printf("disconnected from display\n");
}

exit(0);
}

0 comments on commit 29b0c32

Please sign in to comment.