From 7bcc66be0d3224c6971143143eace7e3c0864a12 Mon Sep 17 00:00:00 2001 From: Martchus Date: Thu, 6 Jul 2023 00:50:45 +0200 Subject: [PATCH] Avoid warning "current scope has no parent" --- cmake/modules/LibraryTarget.cmake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmake/modules/LibraryTarget.cmake b/cmake/modules/LibraryTarget.cmake index 118beb1..e955e53 100644 --- a/cmake/modules/LibraryTarget.cmake +++ b/cmake/modules/LibraryTarget.cmake @@ -530,9 +530,12 @@ if (NOT META_NO_INSTALL_TARGETS AND ENABLE_INSTALL_TARGETS) COMPONENT cmake-config) # allow checking for the export in subsequent sibling projects/directories - set("EXPORT_${NAMESPACE_PREFIX}${META_PROJECT_NAME}${META_CONFIG_SUFFIX}" - ON - PARENT_SCOPE) + get_directory_property(HAS_PARENT_DIRECTORY PARENT_DIRECTORY) + if (HAS_PARENT_DIRECTORY) + set("EXPORT_${NAMESPACE_PREFIX}${META_PROJECT_NAME}${META_CONFIG_SUFFIX}" + ON + PARENT_SCOPE) + endif () # add install target for header files if (NOT META_IS_PLUGIN)