Browse Source

FindMagnum: provide MAGNUM_APPLICATION_{LIBRARIES,INCLUDE_DIRS} aliases.

Convenience aliases to variables related to one particular *Application
component, defined if and only if exactly one *Application component is
requested and found. Meant to be used to simplify porting when each
platform uses different *Application library.
pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
0c612dee3d
  1. 17
      modules/FindMagnum.cmake

17
modules/FindMagnum.cmake

@ -41,6 +41,10 @@
# MAGNUM_*_FOUND - Whether the component was found
# MAGNUM_*_LIBRARIES - Component library and dependent libraries
# MAGNUM_*_INCLUDE_DIRS - Include dirs of module dependencies
# If exactly one *Application component is requested and found, its
# libraries and include dirs are also available in convenience aliases
# MAGNUM_APPLICATION_LIBRARIES and MAGNUM_APPLICATION_INCLUDE_DIRS to
# simplify porting.
#
# Features of found Magnum library are exposed in these variables:
# MAGNUM_TARGET_GLES - Defined if compiled for OpenGL ES
@ -283,6 +287,19 @@ foreach(component ${Magnum_FIND_COMPONENTS})
# Don't expose variables w/o dependencies to end users
mark_as_advanced(FORCE MAGNUM_${_COMPONENT}_LIBRARY _MAGNUM_${_COMPONENT}_INCLUDE_DIR)
# If this is application library, make it available also in global
# MAGNUM_APPLICATION_LIBRARIES and MAGNUM_APPLICATION_INCLUDE_DIRS. If
# these variables are already set, unset them to avoid ambiguity.
if(${component} MATCHES .+Application)
if(NOT DEFINED MAGNUM_APPLICATION_LIBRARIES AND NOT DEFINED MAGNUM_APPLICATION_INCLUDE_DIRS)
set(MAGNUM_APPLICATION_LIBRARIES ${MAGNUM_${_COMPONENT}_LIBRARIES})
set(MAGNUM_APPLICATION_INCLUDE_DIRS ${MAGNUM_${_COMPONENT}_INCLUDE_DIRS})
else()
unset(MAGNUM_APPLICATION_LIBRARIES)
unset(MAGNUM_APPLICATION_INCLUDE_DIRS)
endif()
endif()
else()
set(Magnum_${component}_FOUND FALSE)
endif()

Loading…
Cancel
Save