Set include path with environment variable value

前端 未结 4 570
独厮守ぢ
独厮守ぢ 2021-02-03 13:43

We are trying to use the MITK library with Qt on Linux.

Unfortunately MITK has no install functionality and it also depends on ITK and VTK. So we end up with header fil

相关标签:
4条回答
  • 2021-02-03 13:53

    Have you tried adding:

    INCLUDEPATH += <the path to the MITK headers>

    in your project's .pro file ?

    And possibly you'll also need to edit LIBS and DEPENDPATH.

    See QMake Manual

    0 讨论(0)
  • 2021-02-03 14:06

    Just found out the solution myself. Though I granted a point to Aidos and cjhuitt for their answers that put me on the right track and saved me valuable time. A special thanks for the link to the qmake documentation.

    The first point is that I should modify the .pro file and not fiddle with the extended build arguments.

    To get the content of an environment variable when qmake is processed one should use the following syntax

    INCLUDEPATH += $$(MITK_INCLUDE_PATH)

    Note that to get the content of an environment variable when make is processed one should use the following syntax

    INCLUDEPATH += $(MITK_INCLUDE_PATH)

    But this won't have the same effect if the environment variable contains multiple paths. The first form is then preferable.

    Paths in the environment variable must be separated by spaces because the ; is not recognized.

    If a path contain spaces, put quotes around it. Spaces appearing between the quotes will be replaced by '\ '.

    0 讨论(0)
  • 2021-02-03 14:07

    i dont know but maybe you can try to write like

    INCPATH+=%MITK_INCLUDE_PATH%

    in windows, generally it is like that..

    but i did not try.

    0 讨论(0)
  • 2021-02-03 14:08

    I think there's a cleaner way to do this, but I can't remember. Anyway, you could use the system directive:

    INCLUDEPATH += $$system( echo $MITK_INCLUDE_PATH )
    

    You may also want to add it to depend path:

    DEPENDPATH += $$system( echo $MITK_INCLUDE_PATH )
    
    0 讨论(0)
提交回复
热议问题