File Use-plain-Marble-package-instead-of-KexiMarble.patch of Package kexi

From 3280c5ec9940f329dc75b2b8d9a52285b20209f0 Mon Sep 17 00:00:00 2001
From: Johannes Zarl-Zierl <johannes@zarl-zierl.at>
Date: Wed, 5 May 2021 00:09:49 +0200
Subject: [PATCH] Use plain Marble package instead of KexiMarble

Marble has shipped with a MarbleConfig.cmake file since ~2016. Kexi
already depends on KF5 versions that are much newer than that.
---
 CMakeLists.txt                                |   8 +-
 cmake/modules/FindKexiMarble.cmake            | 115 ------------------
 src/plugins/forms/widgets/CMakeLists.txt      |   2 +-
 .../forms/widgets/mapbrowser/CMakeLists.txt   |   3 +-
 4 files changed, 5 insertions(+), 123 deletions(-)
 delete mode 100644 cmake/modules/FindKexiMarble.cmake

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 97c58fa10..548b2708f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -196,17 +196,14 @@ endif()
 ##
 ## Test for marble
 ##
-set(MARBLE_MIN_VERSION "0.19.2")
-find_package(KexiMarble ${MARBLE_MIN_VERSION})
-set_package_properties(KexiMarble PROPERTIES
+find_package(Marble CONFIG)
+set_package_properties(Marble PROPERTIES
     DESCRIPTION "KDE World Globe Widget library"
     URL "https://marble.kde.org"
     TYPE RECOMMENDED
     PURPOSE "Required by Kexi form map widget"
 )
-if(NOT MARBLE_FOUND)
-    set(MARBLE_INCLUDE_DIR "")
-else()
+if(Marble_FOUND)
     set(HAVE_MARBLE TRUE)
 endif()
 set_package_properties(GLIB2 PROPERTIES TYPE RECOMMENDED PURPOSE "${_REQUIRED_BY_MDB}")
diff --git a/cmake/modules/FindKexiMarble.cmake b/cmake/modules/FindKexiMarble.cmake
deleted file mode 100644
index 4ec1c5195..000000000
--- a/cmake/modules/FindKexiMarble.cmake
+++ /dev/null
@@ -1,115 +0,0 @@
-# - Try to find the Marble Library
-# Once done this will define
-#
-#  MARBLE_FOUND - system has Marble
-#  MARBLE_INCLUDE_DIR - the Marble include directory
-#  MARBLE_LIBRARIES - Libraries needed to use Marble
-#  MARBLE_VERSION - This contains combined MAJOR.MINOR.PATCH version (eg. 0.19.2);
-#                   Can be missing if version could not be found
-#
-#  Versions mapping can be found at: https://marble.kde.org/changelog.php
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-#
-
-#=============================================================================
-# Copyright 2006-2009 Kitware, Inc.
-# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
-# Copyright 2009-2011 Mathieu Malaterre <mathieu.malaterre@gmail.com>
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-
-function(from_hex HEX DEC)
-  string(TOUPPER "${HEX}" HEX)
-  set(_res 0)
-  string(LENGTH "${HEX}" _strlen)
-
-  while (_strlen GREATER 0)
-    math(EXPR _res "${_res} * 16")
-    string(SUBSTRING "${HEX}" 0 1 NIBBLE)
-    string(SUBSTRING "${HEX}" 1 -1 HEX)
-    if (NIBBLE STREQUAL "A")
-      math(EXPR _res "${_res} + 10")
-    elseif (NIBBLE STREQUAL "B")
-      math(EXPR _res "${_res} + 11")
-    elseif (NIBBLE STREQUAL "C")
-      math(EXPR _res "${_res} + 12")
-    elseif (NIBBLE STREQUAL "D")
-      math(EXPR _res "${_res} + 13")
-    elseif (NIBBLE STREQUAL "E")
-      math(EXPR _res "${_res} + 14")
-    elseif (NIBBLE STREQUAL "F")
-      math(EXPR _res "${_res} + 15")
-    else()
-      math(EXPR _res "${_res} + ${NIBBLE}")
-    endif()
-
-    string(LENGTH "${HEX}" _strlen)
-  endwhile()
-
-  set(${DEC} ${_res} PARENT_SCOPE)
-endfunction()
-
-if ( MARBLE_INCLUDE_DIR AND MARBLE_GLOBAL_HEADER AND MARBLE_LIBRARIES )
-   # in cache already
-   set( MARBLE_FIND_QUIETLY TRUE )
-endif ()
-
-find_path( MARBLE_INCLUDE_DIR NAMES marble/MarbleMap.h PATH_SUFFIXES marble)
-find_file( MARBLE_GLOBAL_HEADER NAMES marble/MarbleGlobal.h PATH_SUFFIXES marble)
-find_library( MARBLE_LIBRARIES NAMES marblewidget-qt5 )
-
-if(MARBLE_GLOBAL_HEADER)
-    file(STRINGS ${MARBLE_GLOBAL_HEADER}
-         marble_version_line
-         REGEX "^#define[\t ]+MARBLE_VERSION[\t ]+0x([0-9a-fA-F])+.*")
-
-    string(REGEX REPLACE
-            "^.*MARBLE_VERSION[\t ]+0x([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F]).*$"
-            "\\1;\\2;\\3" marble_version_list "${marble_version_line}")
-
-    list(GET marble_version_list 0 MARBLE_VERSION_MAJOR)
-    from_hex("${MARBLE_VERSION_MAJOR}" MARBLE_VERSION_MAJOR)
-
-    list(GET marble_version_list 1 MARBLE_VERSION_MINOR)
-    from_hex("${MARBLE_VERSION_MINOR}" MARBLE_VERSION_MINOR)
-
-    list(GET marble_version_list 2 MARBLE_VERSION_PATCH)
-    from_hex("${MARBLE_VERSION_PATCH}" MARBLE_VERSION_PATCH)
-
-    set(MARBLE_VERSION "${MARBLE_VERSION_MAJOR}.${MARBLE_VERSION_MINOR}.${MARBLE_VERSION_PATCH}" CACHE STRING "Found Marble version")
-endif()
-
-include( FindPackageHandleStandardArgs )
-
-if(MARBLE_VERSION)
-    if(DEFINED MARBLE_MIN_VERSION AND ${MARBLE_VERSION} VERSION_LESS ${MARBLE_MIN_VERSION})
-        set(MARBLE_FOUND FALSE)
-        unset(MARBLE_INCLUDE_DIR)
-        unset(MARBLE_LIBRARIES)
-    else()
-        find_package_handle_standard_args( Marble
-            REQUIRED_VARS
-                MARBLE_INCLUDE_DIR
-                MARBLE_LIBRARIES
-            VERSION_VAR
-                MARBLE_VERSION
-            FAIL_MESSAGE
-                "Could not find Marble"
-        )
-    endif()
-else()
-    find_package_handle_standard_args( marble
-            DEFAULT_MSG
-            MARBLE_INCLUDE_DIR
-            MARBLE_LIBRARIES )
-endif()
-
-mark_as_advanced(MARBLE_GLOBAL_HEADER MARBLE_VERSION_MAJOR MARBLE_VERSION_MINOR MARBLE_VERSION_PATCH)
diff --git a/src/plugins/forms/widgets/CMakeLists.txt b/src/plugins/forms/widgets/CMakeLists.txt
index 107d578a8..109341fe0 100644
--- a/src/plugins/forms/widgets/CMakeLists.txt
+++ b/src/plugins/forms/widgets/CMakeLists.txt
@@ -11,7 +11,7 @@ endmacro()
 # the main widgets plugin
 add_subdirectory(main)
 
-if(MARBLE_FOUND)
+if(Marble_FOUND)
 #TODO  add_subdirectory(mapbrowser)
 endif()
 
diff --git a/src/plugins/forms/widgets/mapbrowser/CMakeLists.txt b/src/plugins/forms/widgets/mapbrowser/CMakeLists.txt
index 3ff7f4fc8..f5be7fd02 100644
--- a/src/plugins/forms/widgets/mapbrowser/CMakeLists.txt
+++ b/src/plugins/forms/widgets/mapbrowser/CMakeLists.txt
@@ -1,7 +1,6 @@
 include_directories(
     ${CMAKE_SOURCE_DIR}/src/formeditor
     ${CMAKE_SOURCE_DIR}/src/core
-    ${MARBLE_INCLUDE_DIR}
 )
 
 set(kexiforms_mapwidgetplugin_SRCS
@@ -20,8 +19,8 @@ target_link_libraries(kexiforms_mapwidgetplugin
     kexiextendedwidgets
     kexiformutils
     kexidataviewcommon
-    ${MARBLE_LIBRARIES}
 
+    Marble
     Qt5::Xml
 )
 
-- 
GitLab

openSUSE Build Service is sponsored by