@@ -281,24 +281,26 @@ endif ()
281281# Finish find_package call
282282# ----------------------------------------------------------------------------
283283
284- find_package_handle_standard_args (${CMAKE_FIND_PACKAGE_NAME} REQUIRED_VARS SEQAN3_INCLUDE_DIR)
285-
286- # Set SEQAN3_* variables with the content of ${CMAKE_FIND_PACKAGE_NAME}_(FOUND|...|VERSION)
287- # This needs to be done, because `find_package(SeqAn3)` might be called in any case-sensitive way and we want to
288- # guarantee that SEQAN3_* are always set.
289- foreach (package_var
290- FOUND
291- DIR
292- ROOT
293- CONFIG
294- VERSION
295- VERSION_MAJOR
296- VERSION_MINOR
297- VERSION_PATCH
298- VERSION_TWEAK
299- VERSION_COUNT)
300- set (SEQAN3_${package_var} "${${CMAKE_FIND_PACKAGE_NAME} _${package_var} }" )
301- endforeach ()
284+ if (CMAKE_FIND_PACKAGE_NAME )
285+ find_package_handle_standard_args (${CMAKE_FIND_PACKAGE_NAME} REQUIRED_VARS SEQAN3_INCLUDE_DIR)
286+
287+ # Set SEQAN3_* variables with the content of ${CMAKE_FIND_PACKAGE_NAME}_(FOUND|...|VERSION)
288+ # This needs to be done, because `find_package(SeqAn3)` might be called in any case-sensitive way and we want to
289+ # guarantee that SEQAN3_* are always set.
290+ foreach (package_var
291+ FOUND
292+ DIR
293+ ROOT
294+ CONFIG
295+ VERSION
296+ VERSION_MAJOR
297+ VERSION_MINOR
298+ VERSION_PATCH
299+ VERSION_TWEAK
300+ VERSION_COUNT)
301+ set (SEQAN3_${package_var} "${${CMAKE_FIND_PACKAGE_NAME} _${package_var} }" )
302+ endforeach ()
303+ endif ()
302304
303305# propagate SEQAN3_INCLUDE_DIR into SEQAN3_INCLUDE_DIRS
304306set (SEQAN3_INCLUDE_DIRS ${SEQAN3_INCLUDE_DIR} )
@@ -307,7 +309,7 @@ set (SEQAN3_INCLUDE_DIRS ${SEQAN3_INCLUDE_DIR})
307309# Export targets
308310# ----------------------------------------------------------------------------
309311
310- if (SEQAN3_FOUND AND NOT TARGET seqan3::seqan3)
312+ if (NOT TARGET seqan3::seqan3)
311313 add_library (seqan3_seqan3 INTERFACE )
312314 target_compile_definitions (seqan3_seqan3 INTERFACE ${SEQAN3_DEFINITIONS} )
313315 target_compile_features (seqan3_seqan3 INTERFACE cxx_std_23)
0 commit comments