Use correct paths in Qt5CoreConfigExtrasMkspecDir

Before we generated the following content:
  set(_qt5_corelib_extra_includes "${_qt5Core_install_prefix}/X:/src/qt5.9/qtbase/mkspecs/win32-msvc")

Which lead to the following error when used:
  CMake Error at Z:/build/qt59/qtbase/lib/cmake/Qt5Core/Qt5CoreConfig.cmake:15 (message):
  The imported target "Qt5::Core" references the file
      "Z:/build/qt59/qtbase/X:/src/qt5.9/qtbase//mkspecs/win32-msvc"

=> We prefixed an absolute path with another absolute path which is
obviously wrong

After the patch we generate this content:
  set(_qt5_corelib_extra_includes "X:/src/qt5.9/qtbase/mkspecs/win32-msvc")

This patch ensures we never prefix an absolute path additionally

Patch by Konstantin Tokarev

Change-Id: I05dab7f681958723594ceb78064be41798e83fb8
Task-number: QTBUG-61768
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
This commit is contained in:
Kevin Funk 2017-07-27 21:51:33 +02:00 committed by Konstantin Tokarev
parent aca9c93fa0
commit 5978be3129

View File

@ -104,11 +104,17 @@ cmake_umbrella_config_version_file.output = $$DESTDIR/cmake/Qt5/Qt5ConfigVersion
load(cmake_functions)
defineTest(pathIsAbsolute) {
p = $$clean_path($$1)
!isEmpty(p):isEqual(p, $$absolute_path($$p)): return(true)
return(false)
}
##### This requires fixing, so that the feature system works with cmake as well
CMAKE_DISABLED_FEATURES = $$join(QT_DISABLED_FEATURES, "$$escape_expand(\\n) ")
CMAKE_HOST_DATA_DIR = $$cmakeRelativePath($$[QT_HOST_DATA/src], $$[QT_INSTALL_PREFIX])
contains(CMAKE_HOST_DATA_DIR, "^\\.\\./.*"):!isEmpty(CMAKE_HOST_DATA_DIR) {
pathIsAbsolute($$CMAKE_HOST_DATA_DIR) {
CMAKE_HOST_DATA_DIR = $$[QT_HOST_DATA/src]/
CMAKE_HOST_DATA_DIR_IS_ABSOLUTE = True
}
@ -117,7 +123,7 @@ cmake_extras_mkspec_dir.input = $$PWD/Qt5CoreConfigExtrasMkspecDir.cmake.in
cmake_extras_mkspec_dir.output = $$DESTDIR/cmake/Qt5Core/Qt5CoreConfigExtrasMkspecDir.cmake
CMAKE_INSTALL_DATA_DIR = $$cmakeRelativePath($$[QT_HOST_DATA], $$[QT_INSTALL_PREFIX])
contains(CMAKE_INSTALL_DATA_DIR, "^\\.\\./.*"):!isEmpty(CMAKE_INSTALL_DATA_DIR) {
pathIsAbsolute($$CMAKE_INSTALL_DATA_DIR) {
CMAKE_INSTALL_DATA_DIR = $$[QT_HOST_DATA]/
CMAKE_INSTALL_DATA_DIR_IS_ABSOLUTE = True
}