Commit 6ceb710d authored by Jarosław Staniek's avatar Jarosław Staniek

Fix cmake error when configuring Calligra - Marble related

- Move handling of minimum version check to FindCalligraMarble.cmake
- Make marble not found if 'minimum version' constraint isn't met
- Cache variables detected for marble

BUG:345318
parent 818c0a7e
......@@ -340,26 +340,20 @@ if(NOT MARBLE_FOUND)
set(MARBLE_INCLUDE_DIR "")
else()
set(CAN_USE_MARBLE TRUE)
endif()
if( MARBLE_FOUND )
if(${MARBLE_VERSION} VERSION_LESS ${MARBLE_MIN_VERSION} )
set(MARBLE_FOUND FALSE)
else()
add_definitions( -DCAN_USE_MARBLE )
##
## Marble changed addMarbleWidget to setMarbleWidget in MarbleControlBox.h
## with commit ea177ca. This is for compatibility with older versions.
##
find_file(MARBLECONTROLBOX_H MarbleControlBox.h ${MARBLE_INCLUDE_DIR} PATH_SUFFIXES marble)
if( MARBLECONTROLBOX_H )
file(READ ${MARBLECONTROLBOX_H} MARBLECONTROLBOX_H_CONTENT)
string(REGEX MATCH "setMarbleWidget" SETMARBLEWIDGET ${MARBLECONTROLBOX_H_CONTENT})
if( SETMARBLEWIDGET )
add_definitions(-DHAVE_SETMARBLEWIDGET)
endif()
else()
message( WARNING "MarbleControlBox.h not found, could not properly set the SETMARBLEWIDGET define." )
add_definitions( -DCAN_USE_MARBLE )
##
## Marble changed addMarbleWidget to setMarbleWidget in MarbleControlBox.h
## with commit ea177ca. This is for compatibility with older versions.
##
find_file(MARBLECONTROLBOX_H MarbleControlBox.h ${MARBLE_INCLUDE_DIR} PATH_SUFFIXES marble)
if( MARBLECONTROLBOX_H )
file(READ ${MARBLECONTROLBOX_H} MARBLECONTROLBOX_H_CONTENT)
string(REGEX MATCH "setMarbleWidget" SETMARBLEWIDGET ${MARBLECONTROLBOX_H_CONTENT})
if( SETMARBLEWIDGET )
add_definitions(-DHAVE_SETMARBLEWIDGET)
endif()
else()
message( WARNING "MarbleControlBox.h not found, could not properly set the SETMARBLEWIDGET define." )
endif()
endif()
macro_log_feature(MARBLE_FOUND "Marble" "KDE4 World Globe Widget library" "http://techbase.kde.org/Projects/Marble/" FALSE "${MARBLE_MIN_VERSION}" "Required by RDF, Kexi Forms and Reports to show locations on a map")
......
......@@ -4,10 +4,9 @@
# 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 (eg. 0.19.2)
# MARBLE_VERSION_MAJOR - Major version
# MARBLE_VERSION_MINOR - Minor version
# MARBLE_VERSION_PATCH - Patch level
# 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.
......@@ -58,7 +57,7 @@ function(from_hex HEX DEC)
set(${DEC} ${_res} PARENT_SCOPE)
endfunction()
if ( MARBLE_INCLUDE_DIR AND MARBLE_LIBRARIES )
if ( MARBLE_INCLUDE_DIR AND MARBLE_GLOBAL_HEADER AND MARBLE_LIBRARIES )
# in cache already
set( MARBLE_FIND_QUIETLY TRUE )
endif ()
......@@ -85,26 +84,32 @@ if(MARBLE_GLOBAL_HEADER)
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}")
set(MARBLE_VERSION "${MARBLE_VERSION_MAJOR}.${MARBLE_VERSION_MINOR}.${MARBLE_VERSION_PATCH}" CACHE STRING "Found Marble version")
endif()
include( FindPackageHandleStandardArgs )
if(MARBLE_VERSION)
find_package_handle_standard_args( Marble
REQUIRED_VARS
MARBLE_INCLUDE_DIR
MARBLE_LIBRARIES
VERSION_VAR
MARBLE_VERSION
FAIL_MESSAGE
"Could not find Marble"
)
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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment