Qmake in release and debug mode

后端 未结 1 2050
别跟我提以往
别跟我提以往 2021-01-22 02:52

I have a library and I would like it to copy itself to a directory depending upon what configuration i\'m in (debug or release). Here is my project file.

#------         


        
相关标签:
1条回答
  • 2021-01-22 03:08

    The opening brace should be on the same line as the condition:

    CONFIG(debug, debug|release) {
        DLLDESTDIR += $$quote(../../../Jane/Jane/Build/debug)
        message("Copying to Jane Debug Directory.")
    }
    CONFIG(release, debug|release) {
        DLLDESTDIR += $$quote(../../../Jane/Jane/Build/release)
        message("Copying to Jane Release Directory.")
    }
    

    or

    CONFIG(debug, debug|release) {
        DLLDESTDIR += $$quote(../../../Jane/Jane/Build/debug)
        message("Copying to Jane Debug Directory.")
    } else {
        DLLDESTDIR += $$quote(../../../Jane/Jane/Build/release)
        message("Copying to Jane Release Directory.")
    }
    

    But both messages will be displayed, because the files Makefile.Debug and Makefile.Release are both created when you run qmake (on Windows, or if you add debug_and_release to the CONFIG variable on other OSes).

    0 讨论(0)
提交回复
热议问题