diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-10-24 15:20:27 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2018-11-01 11:48:46 +0000 |
commit | e9c45bbdddd4df005bdaa5eea9740d351e6eaea2 (patch) | |
tree | 23765d4650f8f349d1f32e0fe4b1bc678cae7568 /cmake/QtConfig.cmake.in | |
parent | 345e6b0213b1273b698163064f80d33bc7ce64a9 (diff) |
Begin port of qtbase to CMake
Done-by: Alexandru Croitor <alexandru.croitor@qt.io>
Done-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Done-by: Kevin Funk <kevin.funk@kdab.com>
Done-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Done-by: Simon Hausmann <simon.hausmann@qt.io>
Done-by: Tobias Hunger <tobias.hunger@qt.io>
Done-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Done-by: Volker Krause <volker.krause@kdab.com>
Change-Id: Ida4f8bd190f9a4849a1af7b5b7981337a5df5310
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Diffstat (limited to 'cmake/QtConfig.cmake.in')
-rw-r--r-- | cmake/QtConfig.cmake.in | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/cmake/QtConfig.cmake.in b/cmake/QtConfig.cmake.in new file mode 100644 index 0000000000..ad618b7acc --- /dev/null +++ b/cmake/QtConfig.cmake.in @@ -0,0 +1,43 @@ +@PACKAGE_INIT@ + +# Slightly amended version of ./src/corelib/Qt5Config.cmake.in +if (CMAKE_VERSION VERSION_LESS 3.1.0) + message(FATAL_ERROR "Qt requires at least CMake version 3.1.0") +endif() + +get_filename_component(_qt5_install_prefix "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE) + +include("${CMAKE_CURRENT_LIST_DIR}/Qt5Targets.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/Qt5ToolsTargets.cmake") + +# if (NOT Qt_FIND_COMPONENTS) +# set(Qt_NOT_FOUND_MESSAGE "The Qt package requires at least one component") +# set(Qt_FOUND False) +# return() +# endif() + +foreach(module ${Qt_FIND_COMPONENTS}) + find_package(Qt${module} + ${_Qt_FIND_PARTS_QUIET} + ${_Qt_FIND_PARTS_REQUIRED} + PATHS ${_qt_install_prefix} NO_DEFAULT_PATH + ) + if (NOT Qt${module}_FOUND) + string(CONFIGURE ${_qt5_module_location_template} _expected_module_location @ONLY) + + if (Qt_FIND_REQUIRED_${module}) + set(_Qt_NOTFOUND_MESSAGE "${_Qt_NOTFOUND_MESSAGE}Failed to find Qt component \"${module}\" config file at \"${_expected_module_location}\"\n") + elseif(NOT Qt_FIND_QUIETLY) + message(WARNING "Failed to find Qt component \"${module}\" config file at \"${_expected_module_location}\"") + endif() + + unset(_expected_module_location) + endif() +endforeach() + +set(QT_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@) + +if (_Qt_NOTFOUND_MESSAGE) + set(Qt_NOT_FOUND_MESSAGE "${_Qt_NOTFOUND_MESSAGE}") + set(Qt_FOUND False) +endif() |