cmake setup

This commit is contained in:
Artur Mukhamadiev 2025-07-03 21:08:46 +03:00
parent 16bdcb2991
commit ab2a62458d
4 changed files with 29 additions and 6 deletions

View File

@ -9,5 +9,4 @@ target_sources(${PROJECT_NAME} PRIVATE main.cc)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
find_package(Wayland REQUIRED) find_package(Wayland REQUIRED)
include_directories(${WAYLAND_INCLUDE_DIRS}) target_link_libraries(${PROJECT_NAME} Wayland::Wayland)
target_link_libraries(${PROJECT_NAME} ${WAYLAND_LIBRARIES})

17
CMakePresets.json Normal file
View File

@ -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"
}
}
]
}

View File

@ -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 # Handle the QUIETLY and REQUIRED arguments and set WAYLAND_FOUND to TRUE if all listed variables are TRUE
include(FindPackageHandleStandardArgs) 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) if(WAYLAND_FOUND)
add_library(Wayland::Wayland INTERFACE IMPORTED)
set(WAYLAND_LIBRARIES ${WAYLAND_LIBRARY} ${WAYLAND_EGL_LIBRARY}) 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() endif()
mark_as_advanced(WAYLAND_INCLUDE_DIR WAYLAND_LIBRARY) mark_as_advanced(WAYLAND_INCLUDE_DIR WAYLAND_LIBRARY)

View File

@ -14,7 +14,5 @@ int main()
return 0; return 0;
} }
wl_registry* registry = wl_display_get_registry(display);
return 0; return 0;
} }