1
2!!IF !isEmpty(CMAKE_ANGLE_EGL_DLL_RELEASE)
3
4!!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
5set(Qt5Gui_EGL_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR/QtANGLE\")
6!!ELSE
7set(Qt5Gui_EGL_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR/QtANGLE\")
8!!ENDIF
9
10_qt5_Gui_check_file_exists(${Qt5Gui_EGL_INCLUDE_DIRS})
11
12list(APPEND Qt5Gui_INCLUDE_DIRS ${Qt5Gui_EGL_INCLUDE_DIRS})
13set_property(TARGET Qt5::Gui APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_EGL_INCLUDE_DIRS})
14set(Qt5Gui_OPENGL_INCLUDE_DIRS ${Qt5Gui_EGL_INCLUDE_DIRS})
15
16macro(_populate_qt5gui_gl_target_properties TargetName Configuration LIB_LOCATION IMPLIB_LOCATION)
17    set_property(TARGET Qt5::${TargetName} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
18
19!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
20    set(imported_location \"${_qt5Gui_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
21!!ELSE
22    set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
23!!ENDIF
24
25!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
26    set(imported_implib \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
27!!ELSE
28    set(imported_implib \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
29!!ENDIF
30
31    set_target_properties(Qt5::${TargetName} PROPERTIES
32        \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
33        \"IMPORTED_IMPLIB_${Configuration}\" ${imported_implib}
34    )
35endmacro()
36
37add_library(Qt5::Gui_EGL SHARED IMPORTED)
38_populate_qt5gui_gl_target_properties(Gui_EGL RELEASE $${CMAKE_ANGLE_EGL_DLL_RELEASE} $${CMAKE_ANGLE_EGL_IMPLIB_RELEASE})
39add_library(Qt5::Gui_GLESv2 SHARED IMPORTED)
40_populate_qt5gui_gl_target_properties(Gui_GLESv2 RELEASE $${CMAKE_ANGLE_GLES2_DLL_RELEASE} $${CMAKE_ANGLE_GLES2_IMPLIB_RELEASE})
41
42set_property(TARGET Qt5::Gui_EGL APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_EGL_INCLUDE_DIRS})
43set_property(TARGET Qt5::Gui_GLESv2 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_OPENGL_INCLUDE_DIRS})
44
45!!IF !isEmpty(CMAKE_DEBUG_TYPE)
46_populate_qt5gui_gl_target_properties(Gui_EGL DEBUG $${CMAKE_ANGLE_EGL_DLL_DEBUG} $${CMAKE_ANGLE_EGL_IMPLIB_DEBUG})
47_populate_qt5gui_gl_target_properties(Gui_GLESv2 DEBUG $${CMAKE_ANGLE_GLES2_DLL_DEBUG} $${CMAKE_ANGLE_GLES2_IMPLIB_DEBUG})
48!!ENDIF
49
50set(Qt5Gui_EGL_LIBRARIES Qt5::Gui_EGL)
51set(Qt5Gui_OPENGL_LIBRARIES Qt5::Gui_GLESv2)
52
53!!ELSE
54
55!!IF !isEmpty(CMAKE_GL_INCDIRS)
56
57set(_GL_INCDIRS $$CMAKE_GL_INCDIRS)
58find_path(_qt5gui_OPENGL_INCLUDE_DIR $$CMAKE_GL_HEADER_NAME
59    PATHS ${_GL_INCDIRS}
60)
61if (NOT _qt5gui_OPENGL_INCLUDE_DIR)
62    message(FATAL_ERROR \"Failed to find \\\"$$CMAKE_GL_HEADER_NAME\\\" in \\\"${_GL_INCDIRS}\\\".\")
63endif()
64unset(_GL_INCDIRS)
65
66# Don\'t check for existence of the "_qt5gui_OPENGL_INCLUDE_DIR" because it is
67# optional.
68
69list(APPEND Qt5Gui_INCLUDE_DIRS ${_qt5gui_OPENGL_INCLUDE_DIR})
70set_property(TARGET Qt5::Gui APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_qt5gui_OPENGL_INCLUDE_DIR})
71
72unset(_qt5gui_OPENGL_INCLUDE_DIR CACHE)
73
74!!ENDIF
75
76macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
77    set(Qt5Gui_${Name}_LIBRARIES)
78!!IF !mac
79    set(Qt5Gui_${Name}_INCLUDE_DIRS ${IncDirs})
80!!ELSE
81    foreach(_dir ${IncDirs})
82      if (EXISTS ${_dir})
83        list(APPEND Qt5Gui_${Name}_INCLUDE_DIRS ${_dir})
84      else()
85        find_path(_actual_dir ${_dir}) # Look in sdk directories
86        if (_actual_dir)
87          list(APPEND Qt5Gui_${Name}_INCLUDE_DIRS ${_actual_dir})
88        endif()
89        unset(_actual_dir CACHE)
90      endif()
91    endforeach()
92!!ENDIF
93    foreach(_lib ${Libs})
94        if (IS_ABSOLUTE ${_lib})
95            get_filename_component(_libFile ${_lib} NAME_WE)
96            if (_libFile MATCHES \"^${CMAKE_SHARED_LIBRARY_PREFIX}(.*)\")
97                set(_libFile ${CMAKE_MATCH_1})
98            endif()
99        else()
100            set(_libFile ${_lib})
101        endif()
102
103        string(REGEX REPLACE "[^_A-Za-z0-9]" "_" _cmake_lib_name ${_libFile})
104        if (NOT TARGET Qt5::Gui_${_cmake_lib_name} AND NOT _Qt5Gui_${_cmake_lib_name}_LIBRARY_DONE)
105            if (IS_ABSOLUTE ${_lib})
106                set(Qt5Gui_${_cmake_lib_name}_LIBRARY ${_lib})
107            else()
108                find_library(Qt5Gui_${_cmake_lib_name}_LIBRARY ${_lib}
109!!IF !isEmpty(CROSS_COMPILE)
110                    PATHS \"${LibDir}\"
111!!IF !mac
112                    NO_DEFAULT_PATH
113!!ENDIF
114!!ENDIF
115                )
116            endif()
117!!IF mac
118            set(Qt5Gui_${_cmake_lib_name}_LIBRARY "${Qt5Gui_${_cmake_lib_name}_LIBRARY}/${_lib}")
119            if (NOT EXISTS "${Qt5Gui_${_cmake_lib_name}_LIBRARY}")
120                set(Qt5Gui_${_cmake_lib_name}_LIBRARY)
121            endif()
122!!ENDIF
123            if (NOT Qt5Gui_${_cmake_lib_name}_LIBRARY)
124                # The above find_library call doesn\'t work for finding
125                # libraries in Windows SDK paths outside of the proper
126                # environment, even if the libraries are present.  In other
127                # cases it is OK for the libraries to not be found
128                # because they are optional dependencies of Qt5Gui, needed
129                # only if the qopengl.h header is used.
130                # We try to find the libraries in the first place because Qt may be
131                # compiled with another set of GL libraries (such as coming
132                # from ANGLE).  The point of these find calls is to try to
133                # find the same binaries as Qt is compiled with (as they are
134                # in the interface of QtGui), so an effort is made to do so
135                # above with paths known to qmake.
136                set(_Qt5Gui_${_cmake_lib_name}_LIBRARY_DONE TRUE)
137                unset(Qt5Gui_${_cmake_lib_name}_LIBRARY CACHE)
138            else()
139                add_library(Qt5::Gui_${_cmake_lib_name} SHARED IMPORTED)
140                set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_${Name}_INCLUDE_DIRS})
141
142                set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
143                _qt5_Gui_check_file_exists(\"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\")
144                set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_LOCATION_RELEASE \"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\")
145
146!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
147                set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_IMPLIB_RELEASE \"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\")
148!!ENDIF
149                unset(Qt5Gui_${_cmake_lib_name}_LIBRARY CACHE)
150
151                find_library(Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG ${_lib}d
152                    PATHS \"${LibDir}\"
153!!IF !mac
154                    NO_DEFAULT_PATH
155!!ENDIF
156                )
157                if (Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG)
158                    set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
159                    _qt5_Gui_check_file_exists(\"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\")
160                    set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_LOCATION_DEBUG \"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\")
161!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
162                    set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_IMPLIB_DEBUG \"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\")
163!!ENDIF
164                endif()
165                unset(Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG CACHE)
166                list(APPEND Qt5Gui_${Name}_LIBRARIES Qt5::Gui_${_cmake_lib_name})
167            endif()
168        endif()
169    endforeach()
170endmacro()
171
172
173!!IF !isEmpty(CMAKE_EGL_LIBS)
174_qt5gui_find_extra_libs(EGL \"$$CMAKE_EGL_LIBS\" \"$$CMAKE_EGL_LIBDIR\" \"$$CMAKE_EGL_INCDIRS\")
175!!ENDIF
176
177!!IF !isEmpty(CMAKE_OPENGL_LIBS)
178_qt5gui_find_extra_libs(OPENGL \"$$CMAKE_OPENGL_LIBS\" \"$$CMAKE_OPENGL_LIBDIR\" \"$$CMAKE_OPENGL_INCDIRS\")
179
180!!ENDIF
181
182!!ENDIF
183
184set(Qt5Gui_OPENGL_IMPLEMENTATION $$CMAKE_QT_OPENGL_IMPLEMENTATION)
185
186get_target_property(_configs Qt5::Gui IMPORTED_CONFIGURATIONS)
187foreach(_config ${_configs})
188    set_property(TARGET Qt5::Gui APPEND PROPERTY
189        IMPORTED_LINK_DEPENDENT_LIBRARIES_${_config}
190        ${Qt5Gui_EGL_LIBRARIES} ${Qt5Gui_OPENGL_LIBRARIES}
191    )
192endforeach()
193unset(_configs)
194