Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/cmake/FindKDReports.cmake
T
torstenandCopilot b6a97c39e5 Fix KDReports detection and add codification support for viewer-only builds
- Update FindKDReports.cmake to always use CONFIG mode first with explicit search paths
- Add --codification/--no-codification CLI options to new_docker_build.sh
- Add BUILD_CODIFICATION to cmake invocation and Docker environment variables
- Fix BUILD_GROUP5=ON when BUILD_VIEWER_ONLY is enabled
- Exclude LtsFileDialog from viewer-only builds (depends on Group 4 services)
- Fix KDReports git clone to use default branch (removed non-existent branch)
- Add KDReports symlink creation to Dockerfile for include path compatibility

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-23 17:37:56 +02:00

53 lines
2.8 KiB
CMake
Executable File

# Qt6 only - no Qt5 fallback
find_package(Qt6 COMPONENTS Core Gui PrintSupport Sql Svg Widgets Xml QUIET)
if(NOT Qt6_FOUND)
set(KDReports_FOUND FALSE)
return()
endif()
set(_qt_prefix "Qt6")
# Prefer KDReports-qt6 package config if installed under standard prefixes
# Search in common installation locations for KDReports cmake config
list(APPEND CMAKE_PREFIX_PATH /usr/local /usr)
find_package(KDReports-qt6 CONFIG QUIET PATHS /usr/local/lib/cmake/KDReports-qt6 /usr/local/lib64/cmake/KDReports-qt6 /usr/lib/cmake/KDReports-qt6 /usr/lib64/cmake/KDReports-qt6)
if(KDReports-qt6_FOUND OR KDReports-qt6_CONFIG)
message(STATUS "Found KDReports-qt6 package config")
set(KDREPORTS_FOUND TRUE)
set(KDReports_FOUND TRUE)
# KDReports-qt6 config provides KDReports::KDReports imported target
# Set variables for compatibility with code that uses them
set(KDREPORTS_INCLUDE_DIR "/usr/local/include/KDReports-qt6")
set(KDREPORTS_KDREPORTS_INCLUDE_DIR "/usr/local/include/KDReports-qt6")
# Check lib64 first, then lib
if(EXISTS "/usr/local/lib64/libkdreports-qt6.so")
set(KDREPORTS_LIBRARY "/usr/local/lib64/libkdreports-qt6.so")
else()
set(KDREPORTS_LIBRARY "/usr/local/lib/libkdreports-qt6.so")
endif()
else()
# Search both /usr and /usr/local for apt-installed or manually built KDReports
FIND_PATH(KDREPORTS_INCLUDE_DIR KDReports/KDReports.h PATHS /usr/include /usr/local/include)
FIND_PATH(KDREPORTS_KDREPORTS_INCLUDE_DIR KDReports.h PATH_SUFFIXES KDReports PATHS /usr/include /usr/local/include)
FIND_LIBRARY(KDREPORTS_LIBRARY NAMES kdreports kdreport kdreports-qt6 PATHS /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(KDReports DEFAULT_MSG
KDREPORTS_LIBRARY
KDREPORTS_INCLUDE_DIR
KDREPORTS_KDREPORTS_INCLUDE_DIR
)
MARK_AS_ADVANCED(KDREPORTS_INCLUDE_DIR KDREPORTS_LIBRARY)
MARK_AS_ADVANCED(KDREPORTS_KDREPORTS_INCLUDE_DIR KDREPORTS_LIBRARY)
endif()
IF(NOT TARGET KDReports::KDReports)
ADD_LIBRARY(KDReports::KDReports UNKNOWN IMPORTED)
SET_PROPERTY(TARGET KDReports::KDReports PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${KDREPORTS_INCLUDE_DIR}" "${KDREPORTS_KDREPORTS_INCLUDE_DIR}")
SET_PROPERTY(TARGET KDReports::KDReports PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${KDREPORTS_INCLUDE_DIR}" "${KDREPORTS_KDREPORTS_INCLUDE_DIR}")
SET_PROPERTY(TARGET KDReports::KDReports PROPERTY IMPORTED_LOCATION "${KDREPORTS_LIBRARY}")
SET_PROPERTY(TARGET KDReports::KDReports APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${_qt_prefix}::Core ${_qt_prefix}::Gui ${_qt_prefix}::PrintSupport ${_qt_prefix}::Widgets)
ENDIF()