hyprwayland-scanner/CMakeLists.txt

63 lines
2.1 KiB
Text
Raw Normal View History

2024-04-20 02:06:51 +02:00
cmake_minimum_required(VERSION 3.19)
2024-07-18 19:33:36 +02:00
file(READ "${CMAKE_SOURCE_DIR}/VERSION" VER_RAW)
2024-07-18 19:23:36 +02:00
string(STRIP ${VER_RAW} VERSION)
2024-04-20 02:06:51 +02:00
2024-07-18 19:30:13 +02:00
project(
hyprwayland-scanner
DESCRIPTION "A hyprland version of wayland-scanner in and for C++"
VERSION ${VERSION})
2024-04-20 02:06:51 +02:00
2024-04-20 12:56:27 +02:00
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
2024-04-20 12:56:27 +02:00
set(PREFIX ${CMAKE_INSTALL_PREFIX})
2024-04-20 02:06:51 +02:00
set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
2024-07-18 19:30:13 +02:00
message(STATUS "Configuring hyprwayland-scanner in Debug with CMake")
add_compile_definitions(HYPRLAND_DEBUG)
2024-04-20 02:06:51 +02:00
else()
2024-07-18 19:30:13 +02:00
add_compile_options(-O3)
message(STATUS "Configuring hyprwayland-scanner in Release with CMake")
2024-04-20 02:06:51 +02:00
endif()
# configure
set(CMAKE_CXX_STANDARD 23)
add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value
2024-07-18 19:30:13 +02:00
-Wno-missing-field-initializers -Wno-narrowing)
2024-04-20 02:06:51 +02:00
add_compile_definitions(SCANNER_VERSION="${VERSION}")
2024-04-20 12:56:27 +02:00
configure_file(hyprwayland-scanner.pc.in hyprwayland-scanner.pc @ONLY)
2024-04-20 02:06:51 +02:00
# dependencies
message(STATUS "Checking deps...")
find_package(Threads REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(deps REQUIRED IMPORTED_TARGET pugixml)
file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp")
add_executable(hyprwayland-scanner ${SRCFILES})
2024-07-18 19:30:13 +02:00
target_link_libraries(hyprwayland-scanner PRIVATE rt Threads::Threads
PkgConfig::deps)
2024-04-20 02:06:51 +02:00
configure_package_config_file(
2024-07-18 19:30:13 +02:00
hyprwayland-scanner-config.cmake.in hyprwayland-scanner-config.cmake
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/hyprwayland-scanner"
PATH_VARS CMAKE_INSTALL_BINDIR)
write_basic_package_version_file(
2024-07-18 19:30:13 +02:00
"hyprwayland-scanner-config-version.cmake"
VERSION "${VERSION}"
COMPATIBILITY AnyNewerVersion)
2024-04-20 02:06:51 +02:00
# Installation
install(TARGETS hyprwayland-scanner)
2024-07-18 19:30:13 +02:00
install(FILES ${CMAKE_BINARY_DIR}/hyprwayland-scanner.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(FILES ${CMAKE_BINARY_DIR}/hyprwayland-scanner-config.cmake
${CMAKE_BINARY_DIR}/hyprwayland-scanner-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/hyprwayland-scanner)