Browse Source

modules: skip all setup in FindMagnumBindings if the component isn't found.

Matching the change in FindMagnum.
next
Vladimír Vondruš 2 years ago
parent
commit
3d8066afec
  1. 34
      modules/FindMagnumBindings.cmake

34
modules/FindMagnumBindings.cmake

@ -100,6 +100,10 @@ if(MagnumBindings_FIND_COMPONENTS)
list(REMOVE_DUPLICATES MagnumBindings_FIND_COMPONENTS) list(REMOVE_DUPLICATES MagnumBindings_FIND_COMPONENTS)
endif() endif()
# Special cases of include paths. Libraries not listed here have a path suffix
# and include name derived from the library name in the loop below. (So far no
# special cases.)
# Find all components # Find all components
foreach(_component ${MagnumBindings_FIND_COMPONENTS}) foreach(_component ${MagnumBindings_FIND_COMPONENTS})
string(TOUPPER ${_component} _COMPONENT) string(TOUPPER ${_component} _COMPONENT)
@ -112,12 +116,12 @@ foreach(_component ${MagnumBindings_FIND_COMPONENTS})
else() else()
# Header-only components # Header-only components
if(_component IN_LIST _MAGNUMBINDINGS_HEADER_ONLY_COMPONENTS) if(_component IN_LIST _MAGNUMBINDINGS_HEADER_ONLY_COMPONENTS)
add_library(MagnumBindings::${_component} INTERFACE IMPORTED) add_library(MagnumBindings::${_component} INTERFACE IMPORTED)
endif()
# Python bindings # Include path names to find, unless specified above
if(_component STREQUAL Python) if(NOT _MAGNUMBINDINGS_${_COMPONENT}_INCLUDE_PATH_NAMES)
set(_MAGNUMBINDINGS_${_COMPONENT}_INCLUDE_PATH_NAMES Magnum/SceneGraph/PythonBindings.h) set(_MAGNUMBINDINGS_${_COMPONENT}_INCLUDE_PATH_NAMES ${_component}Bindings.h)
endif()
endif() endif()
if(_component IN_LIST _MAGNUMBINDINGS_HEADER_ONLY_COMPONENTS) if(_component IN_LIST _MAGNUMBINDINGS_HEADER_ONLY_COMPONENTS)
@ -126,7 +130,20 @@ foreach(_component ${MagnumBindings_FIND_COMPONENTS})
NAMES ${_MAGNUMBINDINGS_${_COMPONENT}_INCLUDE_PATH_NAMES} NAMES ${_MAGNUMBINDINGS_${_COMPONENT}_INCLUDE_PATH_NAMES}
HINTS ${MAGNUMBINDINGS_INCLUDE_DIR}) HINTS ${MAGNUMBINDINGS_INCLUDE_DIR})
mark_as_advanced(_MAGNUMBINDINGS_${_COMPONENT}_INCLUDE_DIR) mark_as_advanced(_MAGNUMBINDINGS_${_COMPONENT}_INCLUDE_DIR)
endif()
# Decide if the component was found. If not, skip the rest, which
# populates the target properties and finds additional dependencies.
if(_component IN_LIST _MAGNUMBINDINGS_HEADER_ONLY_COMPONENTS AND _MAGNUMBINDINGS_${_COMPONENT}_INCLUDE_DIR)
set(MagnumBindings_${_component}_FOUND TRUE)
else()
set(MagnumBindings_${_component}_FOUND FALSE)
continue()
endif()
# No special setup for Python bindings
if(_component IN_LIST _MAGNUMBINDINGS_HEADER_ONLY_COMPONENTS)
# Link to core Magnum library # Link to core Magnum library
set_property(TARGET MagnumBindings::${_component} APPEND PROPERTY set_property(TARGET MagnumBindings::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Magnum::Magnum) INTERFACE_LINK_LIBRARIES Magnum::Magnum)
@ -135,13 +152,6 @@ foreach(_component ${MagnumBindings_FIND_COMPONENTS})
set_property(TARGET MagnumBindings::${_component} APPEND PROPERTY set_property(TARGET MagnumBindings::${_component} APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${MAGNUMBINDINGS_INCLUDE_DIR}) INTERFACE_INCLUDE_DIRECTORIES ${MAGNUMBINDINGS_INCLUDE_DIR})
endif() endif()
# Decide if the component was found
if(_component IN_LIST _MAGNUMBINDINGS_HEADER_ONLY_COMPONENTS AND _MAGNUMBINDINGS_${_COMPONENT}_INCLUDE_DIR)
set(MagnumBindings_${_component}_FOUND TRUE)
else()
set(MagnumBindings_${_component}_FOUND FALSE)
endif()
endif() endif()
endforeach() endforeach()

Loading…
Cancel
Save