Introduce QMAKE_CD to enable us to cd from one Windows drive to another

On Windows cd does not change the drive. So when you are on drive C:
and type "cd D:\data" it will change the directory on drive D: but not
affect your current working directory.

To also change your drive you have to provide the parameter /d on
Windows, so "cd /d D:\data" will also change the drive.

Task-number: QTBUG-57080
Change-Id: Ib629879534523982eec693cef725f20a535a1a74
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Hannah von Reth 2016-11-11 10:02:34 +01:00
parent 104e6d0f54
commit aeb2768a7c
7 changed files with 9 additions and 7 deletions

View File

@ -31,7 +31,7 @@ defineTest(qtCompileTest) {
test_dir = $$QMAKE_CONFIG_TESTS_DIR/$$1
test_out_dir = $$shadowed($$test_dir)
test_cmd_base = "cd $$system_quote($$system_path($$test_out_dir)) &&"
test_cmd_base = "$$QMAKE_CD $$system_quote($$system_path($$test_out_dir)) &&"
# Disable qmake features which are typically counterproductive for tests
qmake_configs = "\"CONFIG -= qt debug_and_release app_bundle lib_bundle\""

View File

@ -86,7 +86,7 @@ for (MODULE_UNDER_TEST, CMAKE_QT_MODULES_UNDER_TEST) {
CMAKE_MODULES_UNDER_TEST = $$join(CMAKE_MODULES_UNDER_TEST, ;)
check.commands = \
$(MKDIR) $$BUILD_DIR && cd $$BUILD_DIR && \
$(MKDIR) $$BUILD_DIR && $$QMAKE_CD $$BUILD_DIR && \
cmake $$CMAKE_TEST_LOCATION $$CMAKE_GENERATOR \
-DCMAKE_C_COMPILER=$$QMAKE_CC \
-DCMAKE_CXX_COMPILER=$$QMAKE_CXX \

View File

@ -324,7 +324,7 @@ defineTest(qtConfParseCommandLine) {
defineReplace(qtConfToolchainSupportsFlag) {
test_out_dir = $$shadowed($$QMAKE_CONFIG_TESTS_DIR)
test_cmd_base = "cd $$system_quote($$system_path($$test_out_dir)) &&"
test_cmd_base = "$$QMAKE_CD $$system_quote($$system_path($$test_out_dir)) &&"
conftest = "int main() { return 0; }"
write_file("$$test_out_dir/conftest.cpp", conftest)|error()
@ -696,7 +696,7 @@ defineTest(qtConfTest_compile) {
test_out_dir = $$shadowed($$test_dir)
!isEmpty($${1}.pro): \
test_dir = $$test_dir/$$eval($${1}.pro)
test_cmd_base = "cd $$system_quote($$system_path($$test_out_dir)) &&"
test_cmd_base = "$$QMAKE_CD $$system_quote($$system_path($$test_out_dir)) &&"
qmake_args = $$qtConfPkgConfigEnv()$$system_quote($$system_path($$QMAKE_QMAKE))
!isEmpty(QMAKE_QTCONF): \

View File

@ -88,7 +88,7 @@ for (t, tests): \
testdirs = $$unique(testdirs)
for (td, testdirs) {
t = $$basename(td)-distclean
$${t}.commands = -cd $$shell_path($$td) && $(MAKE) distclean
$${t}.commands = -$$QMAKE_CD $$shell_path($$td) && $(MAKE) distclean
QMAKE_EXTRA_TARGETS += $$t
DISTCLEAN_DEPS += $$t
}

View File

@ -67,6 +67,7 @@ equals(MAKEFILE_GENERATOR, MSBUILD) \
|isEmpty(QMAKE_SH) {
QMAKE_ZIP = zip -r -9
QMAKE_CD = cd /d
QMAKE_COPY = copy /y
QMAKE_COPY_FILE = $$QMAKE_COPY
QMAKE_COPY_DIR = xcopy /s /q /y /i
@ -87,6 +88,7 @@ equals(MAKEFILE_GENERATOR, MSBUILD) \
QMAKE_TAR = tar -cf
QMAKE_GZIP = gzip -9f
QMAKE_CD = cd
QMAKE_COPY = cp -f
QMAKE_COPY_FILE = $$QMAKE_COPY
QMAKE_COPY_DIR = $$QMAKE_COPY -R

View File

@ -49,7 +49,7 @@ unix {
$${type}.commands += $(TESTARGS)
!isEmpty(TESTRUN_CWD):!contains(TESTRUN_CWD, ^\\./?): \
$${type}.commands = cd $$shell_path($$TESTRUN_CWD) && $$eval($${type}.commands)
$${type}.commands = $$QMAKE_CD $$shell_path($$TESTRUN_CWD) && $$eval($${type}.commands)
# If the test is marked as insignificant, discard the exit code
insignificant_test: $${type}.commands = -$$eval($${type}.commands)

View File

@ -27,7 +27,7 @@ for(arg, QMAKE_ARGS) {
cmd = "$$QMAKE_QMAKE $$system_quote($$_PRO_FILE_) -spec macx-xcode $$args"
debug(1, "Generating Xcode project in $$OUT_PWD using '$$cmd'")
system("cd $$system_quote($$OUT_PWD) && $$cmd")
system("$$QMAKE_CD $$system_quote($$OUT_PWD) && $$cmd")
# Subtargets