[Solved] My first solution with QMAKE



  • Hi,

    I have just registred to the forum after some months just reading your interesting posts.
    I'l try to explain you what problem do I have and let's see...

    I usually work in Windows using QT (and Visual Studio) but at home I have a mac (MacBook Pro with Snow Leopard 10.6.8) and I want to be able to work with it too.
    I want to use QT and CMake to create the solution of the project we are working. In my Mac I have installed Xcode, the full QT application framework and CMake. I'm trying to create the solution via QT and CMake trougth a CMakeLists.txt.

    When I try to configure and generate the solutuion, I get this:

    @
    CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 (MESSAGE):
    Could NOT find Qt4 (missing: QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE
    QT_RCC_EXECUTABLE QT_UIC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR
    QT_QTCORE_LIBRARY)
    Call Stack (most recent call first):
    /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:288 (_FPHSA_FAILURE_MESSAGE)
    /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/FindQt4.cmake:1172 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
    commonLib/CMakeLists.txt:17 (find_package)
    @

    QT is not able to find QT_QMAKE_EXECUTABLE, QT_MOC_EXECUTABLE, QT_RCC_EXECUTABLE, QT_UIC_EXECUTABLE, QT_INCLUDE_DIR, QT_LIBRARY_DIR and QT_QTCORE_LIBRARY.

    I read that to solve this I have to configure the Environment Variables of my system but in all the posts I read they add to $HOME/.profile:

    @
    PATH=/usr/local/Trolltech/Qt-4.7/bin:$PATH
    export PATH
    @

    In my Mac the folder /usr/local/Trolltech doesn't exist so I have no idea what I have to do. What should the content of that folder be? I have installed the last and full QT package so I don't understand why I don't have that directory. I have installed the SDK in $HOME/QtSDK (by default it is installed there).

    Anybody know how can I solve it to be able to run cmake and generate the solution for QT?

    Thanks in advance.


  • Moderators

    CMake needs the "qmake" exectuable to figure out where the Qt installation is.

    Being able to find that file is what "PATH=/INSTALL/DIR/bin:$PATH; export PATH" is all about: It makes sure the qmake of the Qt version installed in "/INSTALL/DIR" (replace with whatever matches your system) is found.


  • Moderators

    @
    PATH=/Developer/Tools/Qt:$PATH
    export PATH
    @



  • First of all thanks for your fast answer.

    By Install Dir you mean Qt creator directory? qmake directory?
    I found diferent qmake executables in my system in:

    $HOME/QtSDK/Desktop/Qt/474/gcc/bin
    $HOME/QtSDK/Madde/tools/qt-tools_snow-leopard_2011-10-07_UnivBin_qt4.7.4-m0.22.12/bin
    $HOME/QtSDK/Simulator/Qt/gcc/bin
    $HOME/QtSDK/Madde/tools/qt-tools_snow-leopard_2011-10-07_UnivBin_qt4.7.4-m0.22.12/bin

    I have tried them and nothing.
    What I'm doing wrong?



  • More things... when I write:

    bq.
    echo $PATH

    I get this:

    bq.
    /Users/ricard/Applications/bin:/Users/ricard/Applications/sbin:/opt/subversion/bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/X11R6/bin

    Nothing related with QT or CMake


  • Moderators

    Which qmake to use depends entirely on which Qt you want to use.

    $HOME/QtSDK/Desktop/Qt/474/gcc/bin is a desktop Qt, Madde/... is for harmattan development, Simulator/... is the one if you want to use the Qt simulator.



  • Ok, thanks for your answers but the problem is still present. What I'm doing wrong? Maybe it is not Environment Variables fault, or maybe I have to put them in another place.

    In $HOME/.profile I have:

    bq.
    PATH=Users/ricard/QtSDK/Desktop/Qt/474/gcc/bin:$PATH
    export PATH

    But as I said, if I write:

    bq.
    echo $PATH

    I get this:

    bq.
    /Users/ricard/Applications/bin:/Users/ricard/Applications/sbin:/opt/subversion/bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/X11R6/bin

    All this Environment Variables are not in the ".profile" that I'm editing to add the path to qmake, Where are them defined? Is there somwhere else where I can put the Environment Variables? Or anyway do you know how can I solve the problem I descrived in the first post?

    Thanks for your pacience.



  • No one had the same problem?

    After adding the Environment Vars I have restarted and everything, I'm thinking in reinstalling everything...

    I'm really lost, I don't understand why the QT installer doesn't add its own default Environment Variables on its right place automaticly.



  • Well, finally I nearly solved.

    I had to add the Environment Vars in ".bash_profile" and not in the ".profile". I have been looking for more information and I found this:

    bq. When a "login shell" starts up, it reads the file "/etc/profile" and then "$HOME/.bash_profile" or "$HOME/.bash_login" or "$HOME/.profile" (whichever one exists - it only reads one of these)

    I had the ".bash_profile" so the ".profile" was ignored, I didn't know that...

    I start the post saying that "I nearly solved" couse now I have other problems but I think they are not related with the same, let's see if I can mannage to get the solution.

    Thanks!

    PD: If someone want to know more, there is a very good page "here...":http://hayne.net/MacDev/Notes/unixFAQ.html


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.