From 2bcc7b94d39c9a4545e89d4f1c2f3455599b14a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 18 Dec 2024 16:44:37 +0100 Subject: [PATCH] modules: create MagnumBindings targets only once they're actually found. --- modules/FindMagnumBindings.cmake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/FindMagnumBindings.cmake b/modules/FindMagnumBindings.cmake index 622b96d..788eb66 100644 --- a/modules/FindMagnumBindings.cmake +++ b/modules/FindMagnumBindings.cmake @@ -142,16 +142,14 @@ foreach(_component ${MagnumBindings_FIND_COMPONENTS}) else() # Header-only components if(_component IN_LIST _MAGNUMBINDINGS_HEADER_ONLY_COMPONENTS) - add_library(MagnumBindings::${_component} INTERFACE IMPORTED) - # Include path names to find, unless specified above if(NOT _MAGNUMBINDINGS_${_COMPONENT}_INCLUDE_PATH_NAMES) set(_MAGNUMBINDINGS_${_COMPONENT}_INCLUDE_PATH_NAMES ${_component}Bindings.h) endif() endif() + # Find library includes if(_component IN_LIST _MAGNUMBINDINGS_HEADER_ONLY_COMPONENTS) - # Find includes find_path(_MAGNUMBINDINGS_${_COMPONENT}_INCLUDE_DIR NAMES ${_MAGNUMBINDINGS_${_COMPONENT}_INCLUDE_PATH_NAMES} HINTS ${MAGNUMBINDINGS_INCLUDE_DIR}) @@ -167,6 +165,11 @@ foreach(_component ${MagnumBindings_FIND_COMPONENTS}) continue() endif() + # Target for header-only library components + if(_component IN_LIST _MAGNUMBINDINGS_HEADER_ONLY_COMPONENTS) + add_library(MagnumBindings::${_component} INTERFACE IMPORTED) + endif() + # No special setup for Python bindings if(_component IN_LIST _MAGNUMBINDINGS_HEADER_ONLY_COMPONENTS)