Fix $$_PRO_FILE_PWD substitution

PRO_FILE_PWD should return CMAKE_CURRENT_SOURCE dir without any
compenstation for mistmatching directory locations as we are doing with
PWD.

There are test that use a shared .pri project file which gets included
into the .pro file of test. In this .pri file we have a statement such
as DEFINES += QT_QMLTEST_DATADIR=\\\"$${_PRO_FILE_PWD_}/data\\\".
Since the .pri project file is located in ../../shared/shared.pri the
substitution would result in
${CMAKE_CURRENT_SOURCE_DIR}/../../shared/data instead of the expected
${CMAKE_CURRENT_SOURCE_DIR}/data.

Change-Id: Id899d6a624acc45425af47ca9aa1b332cf63e659
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Leander Beernaert 2019-08-05 13:51:25 +02:00
parent 0ceed231b4
commit 5d88ba001e

View File

@ -645,7 +645,9 @@ class Scope(object):
is_same_path = self.currentdir == self.basedir
if key == '_PRO_FILE_PWD_' or key == 'PWD':
if key == '_PRO_FILE_PWD_':
return ['${CMAKE_CURRENT_SOURCE_DIR}']
if key == 'PWD':
if is_same_path:
return ['${CMAKE_CURRENT_SOURCE_DIR}']
else: