qmake.exe нюансы

qmake.exe это утилита, которая по содержанию файла pro (и pri) в каталоге генерирует там настроечные Makefile файлы для последующей сборки проекта.

При первоначальной установке Qt SDK 1.2.1 qmake.exe файлы НЕ создаются в директориях bin и qmake каталога QtSources\4.8.1.

qmake.exe после установки располагается только в декстопной части QtSdk примерно здесь: D:\QtSDK1.2.1\Desktop\Qt\4.8.1\msvc2010.

В Qt Creator 2.4.1 можно выбрать сборку проекта на основании любого из этих qmake.exe, а также можно выбрать qmake.exe и из любого другого места, так как их может быть вообще говоря сколько угодно.

qmake.exe хранит в себе переменные настройки (очень своеобразный подход в программировании). То есть переменные прошиты прямо в бинарнике qmake.exe. Их даже можно увидеть через hex редактор.

Также qmake.exe использует глобалные настройки, смотрите Где настраиваются ключи компиляции и сборки.

Таким образом qmake.exe будет работать НЕ относительно каталога, в котором он расположен. То есть если его скопировать из дубликата QtSdk, то он будет строить пути (к каталогу lib собираемых библиотек Qt) НЕ относительно своего каталога расположения, а относительно каталога в котором его создавали(собирали). Это очнь прикольно. Смотрите внимательно на картинке ниже. qmake.exe перенесли из Desktop в QtSources, но qmake.exe все пути строит на Desktop:

фотка 1

Таким образом пока вы не собирете qmake.exe в своих исходниках (QtSources) вы не сможете собирать сами исходники!

Сборка qmake.exe в составе исходников Qt

При сборке qmake.exe из каталога исходников qmake.exe сначала собирается в каталоге /qmake/, а потом в /bin/ каталог помещается копия собранного qmake.exe.

При конфигурировании исходников через утилиту config.exe с ключом -qmake в каталоге исходников /qmake/ собирается утилита qmake.exe. Конфигурирование среды.

Как собрать qmake.exe через config.exe смотрите здесь: сборка qmake.exe через config.exe.

Также ничто не мешает собрать qmake.exe из под Qt Creator, смотрите проект qmake.pro.

Ключи qmake.exe при запуске из командной строки:


Usage: qmake [mode] [options] [files]

QMake has two modes, one mode for generating project files based on
some heuristics, and the other for generating makefiles. Normally you
shouldn't need to specify a mode, as makefile generation is the default
mode for qmake, but you may use this to test qmake on an existing project

Mode:
  -project       Put qmake into project file generation mode
                 In this mode qmake interprets files as files to
                 be built,
                 defaults to *.c; *.ui; *.y; *.l; *.ts; *.xlf; *.qrc; *.h; *.hpp; *.hh; *.hxx; *.cpp; *.cc; *.cxx
                 Note: The created .pro file probably will
                 need to be edited. For example add the QT variable to
                 specify what modules are required.
  -makefile      Put qmake into makefile generation mode (default)
                 In this mode qmake interprets files as project files to
                 be processed, if skipped qmake will try to find a project
                 file in your current working directory

Warnings Options:
  -Wnone         Turn off all warnings; specific ones may be re-enabled by
                 later -W options
  -Wall          Turn on all warnings
  -Wparser       Turn on parser warnings
  -Wlogic        Turn on logic warnings (on by default)
  -Wdeprecated   Turn on deprecation warnings (on by default)

Options:
   * You can place any variable assignment in options and it will be     *
   * processed as if it was in [files]. These assignments will be parsed *
   * before [files].                                                     *
  -o file        Write output to file
  -d             Increase debug level
  -t templ       Overrides TEMPLATE as templ
  -tp prefix     Overrides TEMPLATE so that prefix is prefixed into the value
  -help          This help
  -v             Version information
  -after         All variable assignments after this will be
                 parsed after [files]
  -norecursive   Don't do a recursive search
  -recursive     Do a recursive search
  -set   Set persistent property
  -unset   Unset persistent property
  -query   Query persistent property. Show all if  is empty.
  -cache file    Use file as cache           [makefile mode only]
  -spec spec     Use spec as QMAKESPEC       [makefile mode only]
  -nocache       Don't use a cache file      [makefile mode only]
  -nodepend      Don't generate dependencies [makefile mode only]
  -nomoc         Don't generate moc targets  [makefile mode only]
  -nopwd         Don't look for files in pwd [project mode only]

Будьте острожны со сборкой qmake.exe из исходников: Symbol file could not be found, кривой qmake.exe.