Trying to understand the .Pro File



  • I am trying to understand how to include files based on the target Platform using the .pro file

    I wish to create a program on the Win, Linux and MacOS.

    But when I use this code in the .pro file it seems to include the files twice.

    if (win32){
    
        isEmpty(QTITANDIR):QTITANDIR = '$$PWD/../resources/thirdparty/Win/Developer Machines/QtitanRibbon'
    }
    
    if (mac) {
        QMAKE_MAC_SDK = macosx10.12
        isEmpty(QTITANDIR):QTITANDIR = '/Users/eatoncode/Documents/QtitanRibbon'
    }
    
    if (linux)
    {
        isEmpty(QTITANDIR):QTITANDIR = 'I:/Program Files (x86)/Developer Machines/QtitanRibbon'
    }
    

    it compiles without error but it seems to include 2 times.., the win32 and linux paths are the same the windows machine.. on is absolute and the other is relative. Even so on windows 10 it should only match 1 time.

    What am I doing wrong ?


  • Moderators

    @EatonCode Please read http://doc.qt.io/qt-5/qmake-project-files.html
    You're doing it wrong:

    win32:INCLUDEPATH += "C:/mylibs/extra headers"
    


  • hi, friend, I shared the code from my project for you.

    win32 {
        CONFIG(debug, debug|release) {
            DEFINES += DEBUG
        }
    
        CONFIG(release, debug|release) {
        }
        INCLUDEPATH  += "other include directory"
    }
    
    linux {
        CONFIG(debug, debug|release) {        
        }
    
        CONFIG(release, debug|release) {
        }
    }
    
    mac {
        CONFIG(debug, debug|release) {        
        }
    
        CONFIG(release, debug|release) {
        }
    }
    


  • @jsulm Thanks for the link I think I understand.....

    If I want to include one line I can use this method..

    win32:INCLUDEPATH += "C:/mylibs/extra headers"
    

    @joeQ Also thanks for the code snippet.

    I assume I can use this code to include many lines of code to include.. Also include debug or release code . This is very handy when including libs from a third party..

    win32 {
        CONFIG(debug, debug|release) {
            DEFINES += DEBUG
    	isEmpty(QTITANDIR):QTITANDIR = '$$PWD/../resources/thirdparty/Win/Debug/Developer Machines/QtitanRibbon'
        }
    
        CONFIG(release, debug|release) {
    	isEmpty(QTITANDIR):QTITANDIR = '$$PWD/../resources/thirdparty/Win/Release/Developer Machines/QtitanRibbon'
        }
    
            
    }
    
    linux {
        CONFIG(debug, debug|release) {
            DEFINES += DEBUG
    	isEmpty(QTITANDIR):QTITANDIR = '$$PWD/../resources/thirdparty/Linux/Release/Developer Machines/QtitanRibbon'
        }
    
        CONFIG(release, debug|release) {
    	isEmpty(QTITANDIR):QTITANDIR = '$$PWD/../resources/thirdparty/Linux/Debug/Developer Machines/QtitanRibbon'
        }
    
    }
    
    mac {
        QMAKE_MAC_SDK = macosx10.12
    
        CONFIG(debug, debug|release) {
            DEFINES += DEBUG
    	isEmpty(QTITANDIR):QTITANDIR = '$$PWD/../resources/thirdparty/OSX/Release/Developer Machines/QtitanRibbon'
        }
    
        CONFIG(release, debug|release) {
    	isEmpty(QTITANDIR):QTITANDIR = '$$PWD/../resources/thirdparty/OSX/Debug/Developer Machines/QtitanRibbon'
        }
    }
    

    Thanks.



  • @EatonCode

    ^_^, Don't forget to set the topic state to 'SOLVED'


Log in to reply
 

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