Building Qt 5.15.1 from source in a CMD script fails
-
I am trying to write a (Windows 10 CMD) script that builds my Qt 5.15.1 from source. The (unmodified Qt 5.15.1) source code is located in
C:\ThirdParty\src\Qt\5.15.1
and I have abuild_qt.cmd
script inside theC:\ThirdParty\src\Qt
directory for doing an out-of-source build and that script looks as follows:set qt_install_dir=C:\ThirdParty\install\Qt\5.15.1 mkdir build cd build ..\5.15.1\configure -prefix "%qt_install_dir%" ^ -opensource ^ -confirm-license ^ -force-debug-info ^ -nomake examples ^ -nomake tools ^ -nomake tests ^ -skip qt3d ^ -skip qtactiveqt ^ -skip qtandroidextras ^ -skip qtcharts ^ -skip qtconnectivity ^ -skip qtdatavis3d ^ -skip qtdeclarative ^ -skip qtdoc ^ -skip qtgamepad ^ -skip qtgraphicaleffects ^ -skip qtimageformats ^ -skip qtlocation ^ -skip qtlottie ^ -skip qtmacextras ^ -skip qtmultimedia ^ -skip qtnetworkauth ^ -skip qtpurchasing ^ -skip qtquickcontrols ^ -skip qtquickcontrols2 ^ -skip qtremoteobjects ^ -skip qtscript ^ -skip qtscxml ^ -skip qtsensors ^ -skip qtserialbus ^ -skip qtserialport ^ -skip qtspeech ^ -skip qtsvg ^ -skip qttools ^ -skip qttranslations ^ -skip qtvirtualkeyboard ^ -skip qtwayland ^ -skip qtwebchannel ^ -skip qtwebengine ^ -skip qtwebglplugin ^ -skip qtwebsockets ^ -skip qtwebview ^ -no-openssl ^ -no-opengl ^ -qt-libpng ^ -skip qtx11extras ^ -platform win32-msvc ^ -debug-and-release ^ -mp @REM Why aren't these executed automatically ??? nmake nmake install
I run this script inside an "x64 Native Tools Command Prompt for VS 2019" from inside the
C:\ThirdParty\src\Qt
directory:C:\ThirdParty\src\Qt>build_qt.cmd
As you can see from the comment at the end of the script, for some reason, the
nmake
commands do not start, as can be seen from the end of my output (no occurrence ofnmake
being started):... more configure output ... Qt Testlib: Tester for item models ................. yes QtXmlPatterns: XML schema support ..................... yes Qt is now configured for building. Just run 'nmake'. Once everything is built, you must run 'nmake install'. Qt will be installed into 'C:\ThirdParty\install\Qt\5.15.1'. Prior to reconfiguration, make sure you remove any leftovers from the previous build. C:\ThirdParty\src\Qt\build>
When I comment out the
configure
command using@REM
, they do get started:C:\ThirdParty\src\Qt>build_qt.cmd C:\ThirdParty\src\Qt>set qt_install_dir=C:\ThirdParty\install\Qt\5.15.1 C:\ThirdParty\src\Qt>mkdir build C:\ThirdParty\src\Qt>cd build C:\ThirdParty\src\Qt\build>nmake Microsoft (R) Program Maintenance Utility Version 14.29.30143.0 Copyright (C) Microsoft Corporation. All rights reserved. NMAKE : fatal error U1064: MAKEFILE not found and no target specified Stop. C:\ThirdParty\src\Qt\build>nmake install Microsoft (R) Program Maintenance Utility Version 14.29.30143.0 Copyright (C) Microsoft Corporation. All rights reserved. NMAKE : fatal error U1073: don't know how to make 'install' Stop. C:\ThirdParty\src\Qt\build>
so it is most likely the
configure
command that somehow puts my CMD shell in a weird state so that thenmake
commands aren't started. However, I have no idea why and how to fix it.Anyone?
-
Basic batch-programming. Since configure is a batch file you have to use
call ..\5.15.1\configure -prefix "%qt_install_dir%" ...
-
Thanks, @Christian-Ehrlicher, using
CALL
indeed solved the problem!My Windows CMD programming is a bit rusty. I tried using
START
, but that didn't do what I expected and since theconfigure
script did not end in.bat
or.cmd
, I didn't immediately think of usingCALL
...