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) ...@@ -340,26 +340,20 @@ if(NOT MARBLE_FOUND)
set(MARBLE_INCLUDE_DIR "") set(MARBLE_INCLUDE_DIR "")
else() else()
set(CAN_USE_MARBLE TRUE) set(CAN_USE_MARBLE TRUE)
endif() add_definitions( -DCAN_USE_MARBLE )
if( MARBLE_FOUND ) ##
if(${MARBLE_VERSION} VERSION_LESS ${MARBLE_MIN_VERSION} ) ## Marble changed addMarbleWidget to setMarbleWidget in MarbleControlBox.h
set(MARBLE_FOUND FALSE) ## with commit ea177ca. This is for compatibility with older versions.
else() ##
add_definitions( -DCAN_USE_MARBLE ) find_file(MARBLECONTROLBOX_H MarbleControlBox.h ${MARBLE_INCLUDE_DIR} PATH_SUFFIXES marble)
## if( MARBLECONTROLBOX_H )
## Marble changed addMarbleWidget to setMarbleWidget in MarbleControlBox.h file(READ ${MARBLECONTROLBOX_H} MARBLECONTROLBOX_H_CONTENT)
## with commit ea177ca. This is for compatibility with older versions. string(REGEX MATCH "setMarbleWidget" SETMARBLEWIDGET ${MARBLECONTROLBOX_H_CONTENT})
## if( SETMARBLEWIDGET )
find_file(MARBLECONTROLBOX_H MarbleControlBox.h ${MARBLE_INCLUDE_DIR} PATH_SUFFIXES marble) add_definitions(-DHAVE_SETMARBLEWIDGET)
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()
else()
message( WARNING "MarbleControlBox.h not found, could not properly set the SETMARBLEWIDGET define." )
endif() endif()
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") 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 @@ ...@@ -4,10 +4,9 @@
# MARBLE_FOUND - system has Marble # MARBLE_FOUND - system has Marble
# MARBLE_INCLUDE_DIR - the Marble include directory # MARBLE_INCLUDE_DIR - the Marble include directory
# MARBLE_LIBRARIES - Libraries needed to use Marble # MARBLE_LIBRARIES - Libraries needed to use Marble
# MARBLE_VERSION - This contains combined MAJOR.MINOR.PATCH (eg. 0.19.2) # MARBLE_VERSION - This contains combined MAJOR.MINOR.PATCH version (eg. 0.19.2);
# MARBLE_VERSION_MAJOR - Major version # Can be missing if version could not be found
# MARBLE_VERSION_MINOR - Minor version #
# MARBLE_VERSION_PATCH - Patch level
# Versions mapping can be found at: https://marble.kde.org/changelog.php # 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. # Redistribution and use is allowed according to the terms of the BSD license.
...@@ -58,7 +57,7 @@ function(from_hex HEX DEC) ...@@ -58,7 +57,7 @@ function(from_hex HEX DEC)
set(${DEC} ${_res} PARENT_SCOPE) set(${DEC} ${_res} PARENT_SCOPE)
endfunction() endfunction()
if ( MARBLE_INCLUDE_DIR AND MARBLE_LIBRARIES ) if ( MARBLE_INCLUDE_DIR AND MARBLE_GLOBAL_HEADER AND MARBLE_LIBRARIES )
# in cache already # in cache already
set( MARBLE_FIND_QUIETLY TRUE ) set( MARBLE_FIND_QUIETLY TRUE )
endif () endif ()
...@@ -85,26 +84,32 @@ if(MARBLE_GLOBAL_HEADER) ...@@ -85,26 +84,32 @@ if(MARBLE_GLOBAL_HEADER)
list(GET marble_version_list 2 MARBLE_VERSION_PATCH) list(GET marble_version_list 2 MARBLE_VERSION_PATCH)
from_hex("${MARBLE_VERSION_PATCH}" 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() endif()
include( FindPackageHandleStandardArgs ) include( FindPackageHandleStandardArgs )
if(MARBLE_VERSION) if(MARBLE_VERSION)
find_package_handle_standard_args( Marble if(DEFINED MARBLE_MIN_VERSION AND ${MARBLE_VERSION} VERSION_LESS ${MARBLE_MIN_VERSION})
REQUIRED_VARS set(MARBLE_FOUND FALSE)
MARBLE_INCLUDE_DIR unset(MARBLE_INCLUDE_DIR)
MARBLE_LIBRARIES unset(MARBLE_LIBRARIES)
VERSION_VAR else()
MARBLE_VERSION find_package_handle_standard_args( Marble
FAIL_MESSAGE REQUIRED_VARS
"Could not find Marble" MARBLE_INCLUDE_DIR
) MARBLE_LIBRARIES
VERSION_VAR
MARBLE_VERSION
FAIL_MESSAGE
"Could not find Marble"
)
endif()
else() else()
find_package_handle_standard_args( marble find_package_handle_standard_args( marble
DEFAULT_MSG DEFAULT_MSG
MARBLE_INCLUDE_DIR MARBLE_INCLUDE_DIR
MARBLE_LIBRARIES ) MARBLE_LIBRARIES )
endif() 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