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 <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
Stephen Kelly 2012-05-13 19:48:47 +02:00 committed by Qt by Nokia
parent c18a41197f
commit 2b735ac8e6

View File

@ -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