diff options
author | Oliver Wolff <oliver.wolff@qt.io> | 2019-10-21 15:39:50 +0200 |
---|---|---|
committer | Oliver Wolff <oliver.wolff@qt.io> | 2019-10-24 10:41:29 +0200 |
commit | c686e885c004a48c90cff300c0ad1e817e43fb99 (patch) | |
tree | 31f00ce51b36bcb06354e7477a3fae9b5e0c858f /mkspecs | |
parent | 31a971f727ecf0c6651689f052b9fb4c67872b58 (diff) |
qmake: Disallow building Qt examples inside the source tree
Building examples inside a Qt source tree is considered unsupported.
Instead of checking, whether the build is done "in source" inside the
source directory, we also have to check for "shadowed example builds" as
they are done by Creator. An example would be:
qtbase/examples/widgets/widgets/build-wiggly as a shadow build for
qtbase/examples/widgets/widgets/wiggly.
Fixes: QTBUG-76237
Change-Id: Iceb88af006fad249a4c13fa0b0345cf3f7086252
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'mkspecs')
-rw-r--r-- | mkspecs/features/qt_example_installs.prf | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mkspecs/features/qt_example_installs.prf b/mkspecs/features/qt_example_installs.prf index 43b58817fe..72b47bce27 100644 --- a/mkspecs/features/qt_example_installs.prf +++ b/mkspecs/features/qt_example_installs.prf @@ -25,14 +25,16 @@ defineTest(addInstallFiles) { export($$1) } -probase = $$relative_path($$_PRO_FILE_PWD_, $$dirname(_QMAKE_CONF_)/examples) +moduleRoot = $$dirname(_QMAKE_CONF_) +probase = $$relative_path($$_PRO_FILE_PWD_, $$moduleRoot/examples) isEmpty(probase)|contains(probase, ^\\..*): \ return() isEmpty(_QMAKE_CACHE_) { - !equals(OUT_PWD, $$_PRO_FILE_PWD_): \ - return() - error("You cannot build examples inside the Qt source tree, except as part of a proper Qt build.") + moduleRootRelativeToBuildDir = $$relative_path($$moduleRoot, $$OUT_PWD) + # Check if OUT_PWD is inside module root + equals(moduleRootRelativeToBuildDir, .)|contains(moduleRootRelativeToBuildDir, \(\.\./\)+\(\.\.\)?): \ + error("You cannot build examples inside the Qt source tree, except as part of a proper Qt build.") } contains(TEMPLATE, "vc.*"): \ |