Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/cmake/FindPopplerQt6.cmake
T
torsten cf6d77c030 Add BUILD_RTI conditionals for RTI/DDS dependent libraries
Systematic fix for BUILD_RTI conditional compilation:
- Lts/Common: Wrap all DDS-dependent libraries in IF(BUILD_RTI)
  - LtsAppManager, LtsCoordTrans, LtsCoordinate, LtsLogin
  - LtsMultiMonitor, LtsPluginManager, LtsPrinting
  - LtsProjectionWorkstation, LtsScriptTimeline, LtsSession
  - LtsTimelineClassic, LtsUtilsCore, LtsUtilsGui, LtsUtilsGuiDds
- Lts/DDS: Add BUILD_RTI guards to Core, DDSConnector, DdsUnitTests, FTC, FTS
- Lts/Plugins: Add BUILD_RTI guards to FilterManagement, OperatorManagement, SituationReplayManagement
- Lts/Proxies: Add BUILD_RTI guards to Buildings, CombatNetRadio, ComponentMonitor, GuezNasat, TrainingAreaBase, TrainingAreaBaseOC
- Lts/Services: Add BUILD_RTI guards to all 30+ service modules
- Z/nglwidgets: Add BUILD_RTI guards, fix Poppler Qt6 headers

Qt6 compatibility fixes:
- LtsCoordTrans: QOverload signal signature, QChar constructor
- LtsMultiMonitor: setMargin→setContentsMargins, remove deprecated HighQualityAntialiasing
- nglwidgets: Poppler Qt5→Qt6 header migration
- Add FindPopplerQt6.cmake for Qt6 Poppler detection

Part of Qt5→Qt6 migration with RTI DDS support.
2026-08-19 00:12:28 +02:00

104 lines
3.4 KiB
CMake
Executable File

# FindPopplerQt6.cmake - Find Poppler Qt6 bindings
# Sets: POPPLER_QT6_INCLUDE_DIR, POPPLER_QT6_LIBRARY, PopplerQt6::Poppler target
if(POPPLER_QT6_INCLUDE_DIR AND POPPLER_QT6_LIBRARY)
set(POPPLER_QT6_FOUND TRUE)
else()
set(_poppler_version_bad FALSE)
if(NOT WIN32)
include(FindPkgConfig)
# Prefer poppler-qt6
pkg_check_modules(_pc_poppler poppler-qt6)
if(_pc_poppler_FOUND)
set(_pc_poppler_pkgname poppler-qt6)
if(NOT "${_pc_poppler_VERSION}" VERSION_GREATER 0.24.0)
set(_poppler_version_bad TRUE)
endif()
endif()
endif()
if(NOT _poppler_version_bad)
set(POPPLER_QT6_FOUND FALSE)
# Try library name discovered by pkg-config
if(_pc_poppler_FOUND)
set(_pkg_var "pkgcfg_lib__pc_poppler_${_pc_poppler_pkgname}")
message(STATUS "FindPoppler: pkg-config found ${_pc_poppler_pkgname}, var ${_pkg_var} defined? ${${_pkg_var}}")
if(DEFINED ${_pkg_var})
set(POPPLER_QT6_LIBRARY ${${_pkg_var}})
message(STATUS "FindPoppler: using pkgcfg path ${POPPLER_QT6_LIBRARY}")
endif()
endif()
if(NOT POPPLER_QT6_LIBRARY)
find_library(POPPLER_QT6_LIBRARY ${_pc_poppler_pkgname}
HINTS ${_pc_poppler_LIBRARY_DIRS}
)
endif()
# Fallback: try common library names
if(NOT POPPLER_QT6_LIBRARY)
find_library(POPPLER_QT6_LIBRARY NAMES poppler-qt6 poppler-qt6)
endif()
# Extra fallback paths
if(NOT POPPLER_QT6_LIBRARY)
find_library(POPPLER_QT6_LIBRARY NAMES poppler-qt6 poppler-qt6
PATHS /usr/lib/x86_64-linux-gnu /usr/lib /usr/local/lib)
endif()
# Check for headers (Qt6 layout: poppler/qt6/poppler-qt6.h)
find_path(POPPLER_QT6_INCLUDE_DIR poppler/qt6/poppler-qt6.h
HINTS ${_pc_poppler_INCLUDE_DIRS}
PATH_SUFFIXES poppler
)
if(POPPLER_QT6_LIBRARY AND POPPLER_QT6_INCLUDE_DIR)
set(POPPLER_QT6_FOUND TRUE)
# Expose a modern imported target for consumers
if(NOT TARGET PopplerQt6::Poppler)
add_library(PopplerQt6::Poppler UNKNOWN IMPORTED)
set_target_properties(PopplerQt6::Poppler PROPERTIES
IMPORTED_LOCATION "${POPPLER_QT6_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${POPPLER_QT6_INCLUDE_DIR}"
)
endif()
# Cache the variables
set(POPPLER_QT6_LIBRARY "${POPPLER_QT6_LIBRARY}" CACHE FILEPATH "Path to poppler-qt6 library")
set(POPPLER_QT6_INCLUDE_DIR "${POPPLER_QT6_INCLUDE_DIR}" CACHE PATH "Poppler-Qt6 include dirs")
endif()
endif()
if(POPPLER_QT6_LIBRARY AND POPPLER_QT6_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PopplerQt6 DEFAULT_MSG
POPPLER_QT6_LIBRARY
POPPLER_QT6_INCLUDE_DIR)
else()
message(WARNING "Poppler Qt6 bindings not found. Creating placeholder PopplerQt6::Poppler target.")
set(POPPLER_QT6_LIBRARY "" CACHE STRING "Placeholder poppler library" FORCE)
set(POPPLER_QT6_INCLUDE_DIR "" CACHE STRING "Placeholder poppler include dir" FORCE)
if(NOT TARGET PopplerQt6::Poppler)
add_library(PopplerQt6::Poppler UNKNOWN IMPORTED)
set_property(TARGET PopplerQt6::Poppler PROPERTY INTERFACE_INCLUDE_DIRECTORIES "")
endif()
set(POPPLER_QT6_FOUND TRUE CACHE INTERNAL "Poppler placeholder present")
endif()
endif()