Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved Trying to understand the .Pro File

    General and Desktop
    3
    5
    1533
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • EatonCode
      EatonCode last edited by

      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 ?

      jsulm 1 Reply Last reply Reply Quote 0
      • jsulm
        jsulm Lifetime Qt Champion @EatonCode last edited by

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

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

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 3
        • joeQ
          joeQ last edited by joeQ

          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) {
              }
          }
          

          Just do it!

          1 Reply Last reply Reply Quote 3
          • EatonCode
            EatonCode last edited by EatonCode

            @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.

            joeQ 1 Reply Last reply Reply Quote 0
            • joeQ
              joeQ @EatonCode last edited by

              @EatonCode

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

              Just do it!

              1 Reply Last reply Reply Quote 0
              • First post
                Last post