diff --git a/CMakeLists.txt b/CMakeLists.txt index a467b14..c85af83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,5 +9,4 @@ target_sources(${PROJECT_NAME} PRIVATE main.cc) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") find_package(Wayland REQUIRED) -include_directories(${WAYLAND_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} ${WAYLAND_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} Wayland::Wayland) diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..bc83fa6 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,17 @@ +{ + "version": 8, + "configurePresets": [ + { + "name": "base-gcc", + "displayName": "Basic gcc preset", + "description": "Using compilers: C = /usr/bin/gcc, CXX = /usr/bin/g++", + "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}", + "CMAKE_C_COMPILER": "/usr/bin/gcc", + "CMAKE_CXX_COMPILER": "/usr/bin/g++", + "CMAKE_BUILD_TYPE": "Debug" + } + } + ] +} \ No newline at end of file diff --git a/cmake/FindWayland.cmake b/cmake/FindWayland.cmake index 7201d92..567c3a9 100644 --- a/cmake/FindWayland.cmake +++ b/cmake/FindWayland.cmake @@ -14,11 +14,20 @@ find_library(WAYLAND_EGL_LIBRARY # Handle the QUIETLY and REQUIRED arguments and set WAYLAND_FOUND to TRUE if all listed variables are TRUE include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Wayland DEFAULT_MSG WAYLAND_LIBRARY WAYLAND_INCLUDE_DIR) +find_package_handle_standard_args(Wayland + DEFAULT_MSG + WAYLAND_LIBRARY + WAYLAND_EGL_LIBRARY + WAYLAND_INCLUDE_DIR) if(WAYLAND_FOUND) + add_library(Wayland::Wayland INTERFACE IMPORTED) + set(WAYLAND_LIBRARIES ${WAYLAND_LIBRARY} ${WAYLAND_EGL_LIBRARY}) - set(WAYLAND_INCLUDE_DIRS ${WAYLAND_INCLUDE_DIR}) + set_target_properties(Wayland::Wayland PROPERTIES + INTERFACE_LINK_LIBRARIES "${WAYLAND_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${WAYLAND_INCLUDE_DIR}" + ) endif() mark_as_advanced(WAYLAND_INCLUDE_DIR WAYLAND_LIBRARY) \ No newline at end of file diff --git a/main.cc b/main.cc index 083b7f8..273d4b8 100644 --- a/main.cc +++ b/main.cc @@ -14,7 +14,5 @@ int main() return 0; } - wl_registry* registry = wl_display_get_registry(display); - return 0; } \ No newline at end of file