diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index 35c635118..ceae0e368 100644 --- a/modules/FindMagnum.cmake +++ b/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()