From 2b735ac8e6b36c66444986a381cc56cd65a2bf7c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 13 May 2012 19:48:47 +0200 Subject: [PATCH] Use directory property instead of variable to determine target existance. This is more resilient to calling find_package in a scope such as a function. Change-Id: I17e69a416f4aed3102fa6195d239bcf4ce0b306b Reviewed-by: Alexander Neundorf Reviewed-by: Stephen Kelly --- mkspecs/cmake/Qt5BasicConfig.cmake.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mkspecs/cmake/Qt5BasicConfig.cmake.in b/mkspecs/cmake/Qt5BasicConfig.cmake.in index 60024e5af9..a6e39b6e99 100644 --- a/mkspecs/cmake/Qt5BasicConfig.cmake.in +++ b/mkspecs/cmake/Qt5BasicConfig.cmake.in @@ -109,8 +109,9 @@ list(APPEND _Qt5Gui_LIB_DEPENDENCIES ${JPEG_LIBRARIES}) !!ENDIF # Static -if (NOT _Qt5$${CMAKE_MODULE_NAME}_target) - set(_Qt5$${CMAKE_MODULE_NAME}_target 1) +get_property(_qt5$${CMAKE_MODULE_NAME}TargetExists DIRECTORY PROPERTY _Qt5$${CMAKE_MODULE_NAME}_target) +if (NOT _qt5$${CMAKE_MODULE_NAME}TargetExists) + set_property(DIRECTORY PROPERTY _Qt5$${CMAKE_MODULE_NAME}_target TRUE) !!IF !isEmpty(CMAKE_STATIC_TYPE) add_library(Qt5::$${CMAKE_MODULE_NAME} STATIC IMPORTED) !!ELSE