Add expansion for QQC2_SOURCE_TREE

Test in QtQuickControls2 rely on this variable, which basically points
to the root of the project. We can't use PROJECT_SOURCE_DIR since it
will vary depending on whether we build tests as stanadlone or part
of the build.

Change-Id: Ic59a79af2b4b62611d6c32391c936e98e469dea0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
This commit is contained in:
Leander Beernaert 2019-09-20 13:37:36 +02:00
parent d8c3375dbd
commit 9e5e98047e

View File

@ -1068,6 +1068,12 @@ class Scope(object):
if not is_same_path:
relative_path = os.path.relpath(self.currentdir, self.basedir)
if key == "QQC2_SOURCE_TREE":
qmake_conf_path = find_qmake_conf(os.path.abspath(self.currentdir))
qmake_conf_dir_path = os.path.dirname(qmake_conf_path)
project_relative_path = os.path.relpath(qmake_conf_dir_path, self.currentdir)
return ['${CMAKE_CURRENT_SOURCE_DIR}/'+ project_relative_path]
if key == "_PRO_FILE_PWD_":
return ["${CMAKE_CURRENT_SOURCE_DIR}"]
if key == "PWD":