Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QT_INSTALL_EXAMPLES] - more discussion please



  • This has been discussed before , so this is sort of re-post.

    I am trying to learn about " make " and its derivatives. My learning style is sort of "in reverse " - in this case I know some stuff about make , however, when I find an item I do not understand and RTFM does not answer my concern I rather ask than guess or "spin my wheels".

    The reason for this post is to clarify "make" QT_INSTALL_EXAMPLES.
    I know what TARGET option does and if not being specified as "TARGET = project " it defaults to name of the project .pro file without the "extension" .pro:. (In this case TARGET = mdi )

    I like to know - where is symbol QT_INSTALL_EXAMPLES actually defined -as being part of the 'target " path. hence system depended.

    Here is the actual usage in mdi.pro:

    target.path = $$[QT_INSTALL_EXAMPLES]/widgets/mainwindows/mdi
    INSTALLS += target

    Actually TARGET is not assigned , only the path is - it defaults to "mdi".
    It seems redundant or is path really needed here ?
    And INSTALLS adds unassigned / default (mdi) TARGET to list?

    Here is the original discussion reference :

    https://forum.qt.io/topic/52831/what-is-target-path-qt_install_examples-widgets-mainwindows-mdi-in-pro


  • Moderators

    @AnneRanch said in QT_INSTALL_EXAMPLES] - more discussion please:

    I like to know - where is symbol QT_INSTALL_EXAMPLES actually defined

    QT_INSTALL_EXAMPLES is a special symbol that is baked into qmake. See Line #61 of the source code: https://code.qt.io/cgit/qt/qtbase.git/tree/qmake/property.cpp?h=v5.15.2#n61 (the code also contains other special symbols)

    qmake reads the path string directly from the Qt libraries (by calling QLibraryInfo::location()), and replaces $$[QT_INSTALL_EXAMPLES] with that path string. You can read the same string from your C++ code:

    qDebug() << QLibraryInfo::location(QLibraryInfo::ExamplesPath);
    

    Note: You probably don't want to use this path in your own project, since you don't want to put your files into Qt's "examples" folder



  • @JKSH said in QT_INSTALL_EXAMPLES] - more discussion please:

    qDebug() << QLibraryInfo::location(QLibraryInfo::ExamplesPath);

    Thanks I guess my next search will be for qMake documentation....

    Am I correct to say QtCreator really uses "qMake" and not "make" ?

    This part of software development - usage of make /makefile/qMake etc. _ still eludes me.
    I guess I am a "victim" of assembly "language" coding where passing the ones and zeroes to the "computer" was much simpler.


  • Moderators

    @AnneRanch said in QT_INSTALL_EXAMPLES] - more discussion please:

    Am I correct to say QtCreator really uses "qMake" and not "make" ?

    No, it uses both.

    • qmake uses the contents of your .pro file to generate a Makefile.
    • make uses the contents of the Makefile to run the tools to build your project (e.g. compiler and linker)

    This part of software development - usage of make /makefile/qMake etc. _ still eludes me.

    make has existed since 1976, and it is still widely involved in software development globally. It is significant enough to win its inventor an ACM Software System Award in 2003.

    I suggest you set aside some time to understand how Makefiles work. It will crystallize many things for you.

    I guess my next search will be for qMake documentation....

    https://doc.qt.io/qt-5/qmake-manual.html


Log in to reply