libragephoto/examples/ragephoto-qtviewer/CMakeLists.txt
Syping 728a3dff6c libragephoto 0.8.1 release
- CMakeLists.txt: update version to 0.8.1
- doc: depend on CMake >= 3.16
- ragephoto-gtkviewer: depend on CMake >= 3.16 and ragephoto >= 0.8
- ragephoto-qtviewer: depend on CMake >= 3.16 and ragephoto >= 0.8
- src/dotnet: update version to 0.8.1
2025-11-11 19:22:47 +01:00

56 lines
2.2 KiB
CMake

#[[**************************************************************************
* libragephoto RAGE Photo Parser
* Copyright (C) 2021-2025 Syping
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* This software is provided as-is, no warranties are given to you, we are not
* responsible for anything with use of the software, you are self responsible.
****************************************************************************]]
cmake_minimum_required(VERSION 3.16)
cmake_policy(VERSION 3.16...3.28)
project(ragephoto-qtviewer LANGUAGES CXX)
include(GNUInstallDirs)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(FORCE_QT_VERSION "" CACHE STRING "Force Qt Version")
if(FORCE_QT_VERSION)
set(QT_VERSION_MAJOR ${FORCE_QT_VERSION})
else()
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
endif()
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
set(QTVIEWER_SOURCES
src/main.cpp
)
if (TARGET ragephoto)
set(RAGEPHOTO_LIBRARIES ragephoto)
set(RAGEPHOTO_LIBRARY_DIRS ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(RAGEPHOTO REQUIRED ragephoto>=0.8)
endif()
add_executable(ragephoto-qtviewer WIN32 ${QTVIEWER_SOURCES})
set_target_properties(ragephoto-qtviewer PROPERTIES
INSTALL_RPATH "${RAGEPHOTO_LIBRARY_DIRS}"
)
target_compile_options(ragephoto-qtviewer PRIVATE ${RAGEPHOTO_CFLAGS})
target_link_libraries(ragephoto-qtviewer PRIVATE Qt${QT_VERSION_MAJOR}::Widgets ${RAGEPHOTO_LIBRARIES})
target_link_directories(ragephoto-qtviewer PRIVATE ${RAGEPHOTO_LIBRARY_DIRS})
target_include_directories(ragephoto-qtviewer PRIVATE ${RAGEPHOTO_INCLUDE_DIRS})
install(TARGETS ragephoto-qtviewer DESTINATION ${CMAKE_INSTALL_BINDIR})