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