CMake: Don't FATAL_ERROR if GL libraries can not be found.
For Windows builds, the necessary libraries are not found in the sdk if the wrong environment is used, which is quite common. Task-number: QTBUG-34940 Change-Id: I7d844649790cbfacab3154a717d318fd570c4149 Reviewed-by: Brad King <brad.king@kitware.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
parent
6ef8eee8d4
commit
ac10baa2a0
@ -94,7 +94,7 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
|
|||||||
!!ENDIF
|
!!ENDIF
|
||||||
foreach(_lib ${Libs})
|
foreach(_lib ${Libs})
|
||||||
string(REGEX REPLACE "[^_A-Za-z0-9]" "_" _cmake_lib_name ${_lib})
|
string(REGEX REPLACE "[^_A-Za-z0-9]" "_" _cmake_lib_name ${_lib})
|
||||||
if (NOT TARGET Qt5::Gui_${_cmake_lib_name})
|
if (NOT TARGET Qt5::Gui_${_cmake_lib_name} AND NOT _Qt5Gui_${_cmake_lib_name}_LIBRARY_DONE)
|
||||||
find_library(Qt5Gui_${_cmake_lib_name}_LIBRARY ${_lib}
|
find_library(Qt5Gui_${_cmake_lib_name}_LIBRARY ${_lib}
|
||||||
!!IF !isEmpty(CROSS_COMPILE)
|
!!IF !isEmpty(CROSS_COMPILE)
|
||||||
PATHS \"${LibDir}\"
|
PATHS \"${LibDir}\"
|
||||||
@ -106,13 +106,21 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
|
|||||||
!!IF mac
|
!!IF mac
|
||||||
set(Qt5Gui_${_cmake_lib_name}_LIBRARY "${Qt5Gui_${_cmake_lib_name}_LIBRARY}/${_lib}")
|
set(Qt5Gui_${_cmake_lib_name}_LIBRARY "${Qt5Gui_${_cmake_lib_name}_LIBRARY}/${_lib}")
|
||||||
!!ENDIF
|
!!ENDIF
|
||||||
if (NOT Qt5Gui_${_cmake_lib_name}_LIBRARY)
|
if (WIN32 AND NOT Qt5Gui_${_cmake_lib_name}_LIBRARY)
|
||||||
if (\"${ARGN}\" STREQUAL \"OPTIONAL\")
|
# The above find_library call doesn't work for finding
|
||||||
break()
|
# libraries in Windows SDK paths outside of the proper
|
||||||
|
# environment. Just add the library name to the result
|
||||||
|
# variable instead.
|
||||||
|
# We avoid doing this in the first case because Qt may be
|
||||||
|
# compiled with another set of GL libraries (such as coming
|
||||||
|
# from ANGLE). The point of these find calls is to try to
|
||||||
|
# find the same binaries as Qt is compiled with (as they are
|
||||||
|
# in the interface of QtGui), so an effort is made to do so
|
||||||
|
# above with paths known to qmake.
|
||||||
|
set(_Qt5Gui_${_cmake_lib_name}_LIBRARY_DONE TRUE)
|
||||||
|
unset(Qt5Gui_${_cmake_lib_name}_LIBRARY CACHE)
|
||||||
|
list(APPEND Qt5Gui_${Name}_LIBRARIES ${_lib})
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR \"Failed to find \\\"${_lib}\\\" in \\\"${LibDir}\\\" with CMAKE_CXX_LIBRARY_ARCHITECTURE \\\"${CMAKE_CXX_LIBRARY_ARCHITECTURE}\\\".\")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
add_library(Qt5::Gui_${_cmake_lib_name} SHARED IMPORTED)
|
add_library(Qt5::Gui_${_cmake_lib_name} SHARED IMPORTED)
|
||||||
set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_${Name}_INCLUDE_DIRS})
|
set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_${Name}_INCLUDE_DIRS})
|
||||||
|
|
||||||
@ -140,8 +148,9 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
|
|||||||
!!ENDIF
|
!!ENDIF
|
||||||
endif()
|
endif()
|
||||||
unset(Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG CACHE)
|
unset(Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG CACHE)
|
||||||
endif()
|
|
||||||
list(APPEND Qt5Gui_${Name}_LIBRARIES Qt5::Gui_${_cmake_lib_name})
|
list(APPEND Qt5Gui_${Name}_LIBRARIES Qt5::Gui_${_cmake_lib_name})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
if (NOT CMAKE_CROSSCOMPILING)
|
if (NOT CMAKE_CROSSCOMPILING)
|
||||||
foreach(_dir ${Qt5Gui_${Name}_INCLUDE_DIRS})
|
foreach(_dir ${Qt5Gui_${Name}_INCLUDE_DIRS})
|
||||||
@ -152,7 +161,7 @@ endmacro()
|
|||||||
|
|
||||||
|
|
||||||
!!IF !isEmpty(CMAKE_EGL_LIBS)
|
!!IF !isEmpty(CMAKE_EGL_LIBS)
|
||||||
_qt5gui_find_extra_libs(EGL \"$$CMAKE_EGL_LIBS\" \"$$CMAKE_EGL_LIBDIR\" \"$$CMAKE_EGL_INCDIRS\" OPTIONAL)
|
_qt5gui_find_extra_libs(EGL \"$$CMAKE_EGL_LIBS\" \"$$CMAKE_EGL_LIBDIR\" \"$$CMAKE_EGL_INCDIRS\")
|
||||||
!!ENDIF
|
!!ENDIF
|
||||||
|
|
||||||
!!IF !isEmpty(CMAKE_OPENGL_LIBS)
|
!!IF !isEmpty(CMAKE_OPENGL_LIBS)
|
||||||
|
Loading…
Reference in New Issue
Block a user