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:
Stephen Kelly 2014-05-16 12:03:16 +02:00 committed by The Qt Project
parent 6ef8eee8d4
commit ac10baa2a0

View File

@ -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,42 +106,51 @@ 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
else() # environment. Just add the library name to the result
message(FATAL_ERROR \"Failed to find \\\"${_lib}\\\" in \\\"${LibDir}\\\" with CMAKE_CXX_LIBRARY_ARCHITECTURE \\\"${CMAKE_CXX_LIBRARY_ARCHITECTURE}\\\".\") # variable instead.
endif() # We avoid doing this in the first case because Qt may be
endif() # compiled with another set of GL libraries (such as coming
add_library(Qt5::Gui_${_cmake_lib_name} SHARED IMPORTED) # from ANGLE). The point of these find calls is to try to
set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_${Name}_INCLUDE_DIRS}) # 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()
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 IMPORTED_CONFIGURATIONS RELEASE) set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
_qt5_Gui_check_file_exists(\"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\") _qt5_Gui_check_file_exists(\"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\")
set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_LOCATION_RELEASE \"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\") set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_LOCATION_RELEASE \"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\")
!!IF !isEmpty(CMAKE_WINDOWS_BUILD) !!IF !isEmpty(CMAKE_WINDOWS_BUILD)
set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_IMPLIB_RELEASE \"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\") set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_IMPLIB_RELEASE \"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\")
!!ENDIF !!ENDIF
unset(Qt5Gui_${_cmake_lib_name}_LIBRARY CACHE) unset(Qt5Gui_${_cmake_lib_name}_LIBRARY CACHE)
find_library(Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG ${_lib}d find_library(Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG ${_lib}d
PATHS \"${LibDir}\" PATHS \"${LibDir}\"
!!IF !mac !!IF !mac
NO_DEFAULT_PATH NO_DEFAULT_PATH
!!ENDIF !!ENDIF
) )
if (Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG) if (Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG)
set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
_qt5_Gui_check_file_exists(\"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\") _qt5_Gui_check_file_exists(\"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\")
set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_LOCATION_DEBUG \"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\") set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_LOCATION_DEBUG \"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\")
!!IF !isEmpty(CMAKE_WINDOWS_BUILD) !!IF !isEmpty(CMAKE_WINDOWS_BUILD)
set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_IMPLIB_DEBUG \"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\") set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_IMPLIB_DEBUG \"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\")
!!ENDIF !!ENDIF
endif()
unset(Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG CACHE)
list(APPEND Qt5Gui_${Name}_LIBRARIES Qt5::Gui_${_cmake_lib_name})
endif() endif()
unset(Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG CACHE)
endif() endif()
list(APPEND Qt5Gui_${Name}_LIBRARIES Qt5::Gui_${_cmake_lib_name})
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)