summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/Qt5Config.cmake.in43
-rw-r--r--src/corelib/corelib.pro10
2 files changed, 51 insertions, 2 deletions
diff --git a/src/corelib/Qt5Config.cmake.in b/src/corelib/Qt5Config.cmake.in
new file mode 100644
index 0000000000..408dd64496
--- /dev/null
+++ b/src/corelib/Qt5Config.cmake.in
@@ -0,0 +1,43 @@
+
+if (CMAKE_VERSION VERSION_LESS 2.8.9)
+ message(FATAL_ERROR \"Qt5 requires at least CMake version 2.8.9\")
+endif()
+
+if (NOT Qt5_FIND_COMPONENTS)
+ set(Qt5_NOT_FOUND_MESSAGE \"The Qt5 package requires at least one component\")
+ set(Qt5_FOUND False)
+ return()
+endif()
+
+set(_Qt5_FIND_PARTS_REQUIRED)
+if (Qt5_FIND_REQUIRED)
+ set(_Qt5_FIND_PARTS_REQUIRED REQUIRED)
+endif()
+set(_Qt5_FIND_PARTS_QUIET)
+if (Qt5_FIND_QUIETLY)
+ set(_Qt5_FIND_PARTS_QUIET QUIET)
+endif()
+
+get_filename_component(_qt5_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+
+set(_Qt5_NOTFOUND_MESSAGE)
+
+foreach(module ${Qt5_FIND_COMPONENTS})
+ find_package(Qt5${module}
+ ${_Qt5_FIND_PARTS_QUIET}
+ ${_Qt5_FIND_PARTS_REQUIRED}
+ PATHS \"${_qt5_install_prefix}\" NO_DEFAULT_PATH
+ )
+ if (NOT Qt5${module}_FOUND)
+ if (Qt5_FIND_REQUIRED_${module})
+ set(_Qt5_NOTFOUND_MESSAGE \"${_Qt5_NOTFOUND_MESSAGE}Failed to find Qt5 component \\\"${module}\\\" config file at \\\"${_qt5_install_prefix}/lib/cmake/Qt5${module}/Qt5${module}Config.cmake\\\"\\n\")
+ elseif(NOT Qt5_FIND_QUIETLY)
+ message(WARNING \"Failed to find Qt5 component \\\"${module}\\\" config file at \\\"${_qt5_install_prefix}/lib/cmake/Qt5${module}/Qt5${module}Config.cmake\\\"\")
+ endif()
+ endif()
+endforeach()
+
+if (_Qt5_NOTFOUND_MESSAGE)
+ set(Qt5_NOT_FOUND_MESSAGE \"${_Qt5_NOTFOUND_MESSAGE}\")
+ set(Qt5_FOUND False)
+endif()
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index bf2fd3c84a..2bac1bcbef 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -60,10 +60,16 @@ ctest_macros_file.input = $$PWD/Qt5CTestMacros.cmake
ctest_macros_file.output = $$DESTDIR/cmake/Qt5Core/Qt5CTestMacros.cmake
ctest_macros_file.CONFIG = verbatim
-QMAKE_SUBSTITUTES += ctest_macros_file
+cmake_umbrella_config_file.input = $$PWD/Qt5Config.cmake.in
+cmake_umbrella_config_file.output = $$DESTDIR/cmake/Qt5/Qt5Config.cmake
+
+cmake_qt5_umbrella_module_files.files = $$cmake_umbrella_config_file.output
+cmake_qt5_umbrella_module_files.path = $$[QT_INSTALL_LIBS]/cmake/Qt5
+
+QMAKE_SUBSTITUTES += ctest_macros_file cmake_umbrella_config_file
ctest_qt5_module_files.files += $$ctest_macros_file.output
ctest_qt5_module_files.path = $$[QT_INSTALL_LIBS]/cmake/Qt5Core
-INSTALLS += ctest_qt5_module_files
+INSTALLS += ctest_qt5_module_files cmake_qt5_umbrella_module_files