Commit 37f55713 authored by Michael Palimaka's avatar Michael Palimaka
Browse files

Make automagic dependencies controllable.

Instead of building plugins unconditionally if the required dependency
is found, make it possible to choose at configure time.

The macro macro_optional_find_package is bundled to support Qt-only builds,
but is conditionally defined in that circumstance.

REVIEW: 105598
parent 3ebbe648
......@@ -142,3 +142,55 @@ endmacro( marble_add_test TEST_NAME )
macro( marble_add_project_resources resources )
add_custom_target( ${PROJECT_NAME}_Resources ALL SOURCES ${ARGN} )
endmacro()
# - MACRO_OPTIONAL_FIND_PACKAGE() combines FIND_PACKAGE() with an OPTION()
# MACRO_OPTIONAL_FIND_PACKAGE( <name> [QUIT] )
# This macro is a combination of OPTION() and FIND_PACKAGE(), it
# works like FIND_PACKAGE(), but additionally it automatically creates
# an option name WITH_<name>, which can be disabled via the cmake GUI.
# or via -DWITH_<name>=OFF
# The standard <name>_FOUND variables can be used in the same way
# as when using the normal FIND_PACKAGE()
# Copyright (c) 2006-2010 Alexander Neundorf, <neundorf@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
# This is just a helper macro to set a bunch of variables empty.
# We don't know whether the package uses UPPERCASENAME or CamelCaseName, so we try both:
if(QTONLY)
macro(_MOFP_SET_EMPTY_IF_DEFINED _name _var)
if(DEFINED ${_name}_${_var})
set(${_name}_${_var} "")
endif(DEFINED ${_name}_${_var})
string(TOUPPER ${_name} _nameUpper)
if(DEFINED ${_nameUpper}_${_var})
set(${_nameUpper}_${_var} "")
endif(DEFINED ${_nameUpper}_${_var})
endmacro(_MOFP_SET_EMPTY_IF_DEFINED _package _var)
macro (MACRO_OPTIONAL_FIND_PACKAGE _name )
option(WITH_${_name} "Search for ${_name} package" ON)
if (WITH_${_name})
find_package(${_name} ${ARGN})
else (WITH_${_name})
string(TOUPPER ${_name} _nameUpper)
set(${_name}_FOUND FALSE)
set(${_nameUpper}_FOUND FALSE)
_mofp_set_empty_if_defined(${_name} INCLUDE_DIRS)
_mofp_set_empty_if_defined(${_name} INCLUDE_DIR)
_mofp_set_empty_if_defined(${_name} INCLUDES)
_mofp_set_empty_if_defined(${_name} LIBRARY)
_mofp_set_empty_if_defined(${_name} LIBRARIES)
_mofp_set_empty_if_defined(${_name} LIBS)
_mofp_set_empty_if_defined(${_name} FLAGS)
_mofp_set_empty_if_defined(${_name} DEFINITIONS)
endif (WITH_${_name})
endmacro (MACRO_OPTIONAL_FIND_PACKAGE)
endif(QTONLY)
ADD_SUBDIRECTORY( flightgear )
FIND_PACKAGE(libgps)
macro_optional_find_package(libgps)
IF(LIBGPS_FOUND)
MESSAGE( STATUS "Building with gpsd position provider")
ADD_SUBDIRECTORY( gpsd )
......@@ -8,13 +8,13 @@ ELSE(LIBGPS_FOUND)
MESSAGE( STATUS "Not building with gpsd position provider")
ENDIF(LIBGPS_FOUND)
FIND_PACKAGE(liblocation)
macro_optional_find_package(liblocation)
IF(liblocation_FOUND)
MESSAGE( STATUS "Building with Maemo GPS support")
ADD_SUBDIRECTORY( maemo )
ENDIF(liblocation_FOUND)
FIND_PACKAGE(QtLocation)
macro_optional_find_package(QtLocation)
IF(QTLOCATION_FOUND)
MESSAGE( STATUS "Building with QtLocation support")
ADD_SUBDIRECTORY( qtmobility )
......
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