• <legend id='35Ame'><style id='35Ame'><dir id='35Ame'><q id='35Ame'></q></dir></style></legend>

  • <i id='35Ame'><tr id='35Ame'><dt id='35Ame'><q id='35Ame'><span id='35Ame'><b id='35Ame'><form id='35Ame'><ins id='35Ame'></ins><ul id='35Ame'></ul><sub id='35Ame'></sub></form><legend id='35Ame'></legend><bdo id='35Ame'><pre id='35Ame'><center id='35Ame'></center></pre></bdo></b><th id='35Ame'></th></span></q></dt></tr></i><div id='35Ame'><tfoot id='35Ame'></tfoot><dl id='35Ame'><fieldset id='35Ame'></fieldset></dl></div>

        • <bdo id='35Ame'></bdo><ul id='35Ame'></ul>

      1. <small id='35Ame'></small><noframes id='35Ame'>

        <tfoot id='35Ame'></tfoot>
      2. 使用 qmake 查找编译器供应商/版本

        Finding compiler vendor / version using qmake(使用 qmake 查找编译器供应商/版本)
            <tfoot id='TvIW6'></tfoot>

            <small id='TvIW6'></small><noframes id='TvIW6'>

            • <legend id='TvIW6'><style id='TvIW6'><dir id='TvIW6'><q id='TvIW6'></q></dir></style></legend>

                  <tbody id='TvIW6'></tbody>
                • <bdo id='TvIW6'></bdo><ul id='TvIW6'></ul>
                  <i id='TvIW6'><tr id='TvIW6'><dt id='TvIW6'><q id='TvIW6'><span id='TvIW6'><b id='TvIW6'><form id='TvIW6'><ins id='TvIW6'></ins><ul id='TvIW6'></ul><sub id='TvIW6'></sub></form><legend id='TvIW6'></legend><bdo id='TvIW6'><pre id='TvIW6'><center id='TvIW6'></center></pre></bdo></b><th id='TvIW6'></th></span></q></dt></tr></i><div id='TvIW6'><tfoot id='TvIW6'></tfoot><dl id='TvIW6'><fieldset id='TvIW6'></fieldset></dl></div>
                  本文介绍了使用 qmake 查找编译器供应商/版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  有什么办法可以通过qmake获取用户使用的编译器的版本和厂商吗?我需要的是在使用 g++ 3.x 时禁用构建我的项目的某些目标,并在使用 g++ 4.x 时启用它们.

                  Is there any way to get the version and vendor of the compiler used by the user through qmake? What I need is to disable building some targets of my project when g++ 3.x is used and enable them when g++ 4.x is used.

                  更新:大多数答案都针对预处理器.这是我想要避免的.我不希望为特定的编译器版本构建目标,我希望由构建系统做出这个决定.

                  Update: Most answers targeted the preprocessor. This is something that I want to avoid. I don't want a target to be build for a specific compiler version and I want this decision to be made by the build system.

                  推荐答案

                  除了 ashcatch 的答案,qmake 允许您查询命令行 并将响应作为变量返回.所以你可以这样做:

                  In addition to ashcatch's answer, qmake allows you to query the command line and get the response back as a variable. So you could to something like this:

                  linux-g++ {
                      system( g++ --version | grep -e "<4.[0-9]" ) {
                          message( "g++ version 4.x found" )
                          CONFIG += g++4
                      }
                      else system( g++ --version | grep -e "<3.[0-9]" ) {
                          message( "g++ version 3.x found" )
                          CONFIG += g++3
                      }
                      else {
                          error( "Unknown system/compiler configuration" )
                      }
                  }
                  

                  然后,当你想用它来指定目标时,你可以使用配置范围规则:

                  Then later, when you want to use it to specify targets, you can use the config scoping rules:

                  SOURCES += blah blah2 blah3
                  g++4: SOURCES += blah4 blah5
                  

                  这篇关于使用 qmake 查找编译器供应商/版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What is inside .lib file of Static library, Statically linked dynamic library and dynamically linked dynamic library?(静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么?)
                  How do I load a C DLL from the SXS in Python?(如何从 Python 中的 SXS 加载 C DLL?)
                  Can Cython code be compiled to a dll so C++ application can call it?(Cython 代码可以编译成 dll 以便 C++ 应用程序可以调用它吗?)
                  Delay Loading DLLs(延迟加载 DLL)
                  Throwing C++ exceptions across DLL boundaries(跨 DLL 边界抛出 C++ 异常)
                  Loading a dll from a dll?(从 dll 加载 dll?)
                    <tbody id='NuwYd'></tbody>

                      • <bdo id='NuwYd'></bdo><ul id='NuwYd'></ul>
                      • <legend id='NuwYd'><style id='NuwYd'><dir id='NuwYd'><q id='NuwYd'></q></dir></style></legend>
                        <tfoot id='NuwYd'></tfoot>

                        <small id='NuwYd'></small><noframes id='NuwYd'>

                            <i id='NuwYd'><tr id='NuwYd'><dt id='NuwYd'><q id='NuwYd'><span id='NuwYd'><b id='NuwYd'><form id='NuwYd'><ins id='NuwYd'></ins><ul id='NuwYd'></ul><sub id='NuwYd'></sub></form><legend id='NuwYd'></legend><bdo id='NuwYd'><pre id='NuwYd'><center id='NuwYd'></center></pre></bdo></b><th id='NuwYd'></th></span></q></dt></tr></i><div id='NuwYd'><tfoot id='NuwYd'></tfoot><dl id='NuwYd'><fieldset id='NuwYd'></fieldset></dl></div>