Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Trying to understand the .Pro File
QtWS25 Last Chance

Trying to understand the .Pro File

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.8k Views
  • 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.
  • EatonCodeE Offline
    EatonCodeE Offline
    EatonCode
    wrote on last edited by
    #1

    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 ?

    jsulmJ 1 Reply Last reply
    0
    • EatonCodeE EatonCode

      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 ?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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
      3
      • joeQJ Offline
        joeQJ Offline
        joeQ
        wrote on last edited by joeQ
        #3

        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
        3
        • EatonCodeE Offline
          EatonCodeE Offline
          EatonCode
          wrote on last edited by EatonCode
          #4

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

          joeQJ 1 Reply Last reply
          0
          • EatonCodeE 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.

            joeQJ Offline
            joeQJ Offline
            joeQ
            wrote on last edited by
            #5

            @EatonCode

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

            Just do it!

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved