• <bdo id='nHYrk'></bdo><ul id='nHYrk'></ul>

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

  1. <legend id='nHYrk'><style id='nHYrk'><dir id='nHYrk'><q id='nHYrk'></q></dir></style></legend>
    1. <tfoot id='nHYrk'></tfoot>
      <i id='nHYrk'><tr id='nHYrk'><dt id='nHYrk'><q id='nHYrk'><span id='nHYrk'><b id='nHYrk'><form id='nHYrk'><ins id='nHYrk'></ins><ul id='nHYrk'></ul><sub id='nHYrk'></sub></form><legend id='nHYrk'></legend><bdo id='nHYrk'><pre id='nHYrk'><center id='nHYrk'></center></pre></bdo></b><th id='nHYrk'></th></span></q></dt></tr></i><div id='nHYrk'><tfoot id='nHYrk'></tfoot><dl id='nHYrk'><fieldset id='nHYrk'></fieldset></dl></div>
    2. 附加到 CMAKE_C_FLAGS

      Appending to CMAKE_C_FLAGS(附加到 CMAKE_C_FLAGS)
            <tbody id='aLBOW'></tbody>
        • <i id='aLBOW'><tr id='aLBOW'><dt id='aLBOW'><q id='aLBOW'><span id='aLBOW'><b id='aLBOW'><form id='aLBOW'><ins id='aLBOW'></ins><ul id='aLBOW'></ul><sub id='aLBOW'></sub></form><legend id='aLBOW'></legend><bdo id='aLBOW'><pre id='aLBOW'><center id='aLBOW'></center></pre></bdo></b><th id='aLBOW'></th></span></q></dt></tr></i><div id='aLBOW'><tfoot id='aLBOW'></tfoot><dl id='aLBOW'><fieldset id='aLBOW'></fieldset></dl></div>

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

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

              <tfoot id='aLBOW'></tfoot>

                本文介绍了附加到 CMAKE_C_FLAGS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我将 CMake 用于一个有两个版本的项目,其中一个需要 -lglapi,另一个不需要.

                I'm using CMake for a project that comes in two versions, one of which requires -lglapi and the other does not.

                到目前为止,我们使用的行看起来像这样:

                So far the lines we used look like that:

                SET(CMAKE_C_FLAGS "-O3 -xSSE3 -restrict -lpthread -lX11 -ldrm")
                SET(CMAKE_CXX_FLAGS "-O3 -xSSE3 -restrict -lpthread -lX11 -ldrm")
                

                我在 CMakeList.txt 的这些行之后添加了一个 if 语句:

                I added an if statement in my CMakeList.txt exactly after those lines:

                if(SINGLE_MODE)
                    SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} " -lglapi")
                    SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} " -lglapi")
                endif(SINGLE_MODE)
                

                SINGLE_MODE 变量的定义稍微高一些.当我使用 message 命令显示标志变量的内容时,它看起来没问题:

                The SINGLE_MODE variable is defined a little up. When I use the message command to display the content of the flag variables it looks alright:

                -O3 -xSSE3 -restrict -lpthread -lX11 -ldrm -lglapi
                

                但是当我开始编译时,我遇到了编译错误.使用详细模式我意识到在编译器调用中它看起来像这样:

                But when I start compiling I am running into a compile error. Using the verbose mode I realized that in the compiler call it looks like that:

                -O3 -xSSE3 -restrict -lpthread -lX11 -ldrm; -lglapi
                

                即在将 -lglapi 添加到列表之前,以某种方式添加了分号.

                I.e. somehow a semicolon got added before adding the -lglapi to the list.

                这里有没有人遇到过类似的问题并且知道解决这个问题的方法?我已经用谷歌搜索了一段时间并研究了 CMake 手册,但看不到我在这里做错了什么.

                Did anyone here encounter a similar issue and knows a way to fix this issue? I've googled quite a while and studied the CMake manual but couldn't see what I did wrong here.

                谢谢,托比亚斯

                推荐答案

                尝试这样做:

                if(SINGLE_MODE)
                    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -lglapi")
                    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lglapi")
                endif(SINGLE_MODE)
                

                然后,您确定将 -lglapi 附加到现有的 ${CMAKE_CXX_FLAGS} 字符串.否则,看起来像是正在创建 CMake 列表.

                Then, you are sure you append -lglapi to the existing ${CMAKE_CXX_FLAGS} string. Else, looks like something like a CMake list is being created.

                这篇关于附加到 CMAKE_C_FLAGS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                Unable to access non-const member functions of objects in C++ std::set(无法访问 C++ std::set 中对象的非常量成员函数)
                Constructing std::function argument from lambda(从 lambda 构造 std::function 参数)
                STL BigInt class implementation(STL BigInt 类实现)
                Sync is unreliable using std::atomic and std::condition_variable(使用 std::atomic 和 std::condition_variable 同步不可靠)
                Move list element to the end in STL(在 STL 中将列表元素移动到末尾)
                Why is overloading operatoramp;() prohibited for classes stored in STL containers?(为什么禁止对存储在 STL 容器中的类重载 operatoramp;()?)

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

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

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

                            <tbody id='WyFxO'></tbody>