<tfoot id='gcMvi'></tfoot>
      <bdo id='gcMvi'></bdo><ul id='gcMvi'></ul>

    <legend id='gcMvi'><style id='gcMvi'><dir id='gcMvi'><q id='gcMvi'></q></dir></style></legend>

    1. <small id='gcMvi'></small><noframes id='gcMvi'>

    2. <i id='gcMvi'><tr id='gcMvi'><dt id='gcMvi'><q id='gcMvi'><span id='gcMvi'><b id='gcMvi'><form id='gcMvi'><ins id='gcMvi'></ins><ul id='gcMvi'></ul><sub id='gcMvi'></sub></form><legend id='gcMvi'></legend><bdo id='gcMvi'><pre id='gcMvi'><center id='gcMvi'></center></pre></bdo></b><th id='gcMvi'></th></span></q></dt></tr></i><div id='gcMvi'><tfoot id='gcMvi'></tfoot><dl id='gcMvi'><fieldset id='gcMvi'></fieldset></dl></div>
    3. #ifdef DEBUG 与 CMake 独立于平台

      时间:2023-08-27
      • <tfoot id='8c31W'></tfoot>

        <small id='8c31W'></small><noframes id='8c31W'>

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

            <bdo id='8c31W'></bdo><ul id='8c31W'></ul>
          • <legend id='8c31W'><style id='8c31W'><dir id='8c31W'><q id='8c31W'></q></dir></style></legend>
                  <tbody id='8c31W'></tbody>
                本文介绍了#ifdef DEBUG 与 CMake 独立于平台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在使用 CMake 在 Windows (Visual Studio) 以及 Linux 机器 (gcc) 上构建我的项目.我想将一些代码标记为仅调试",例如

                I am using CMake for building my projects on Windows (Visual Studio) as well as on Linux machines(gcc). I'd like to mark some code as "debugging only", like with

                #ifdef DEBUG
                //some logging here
                #endif
                

                问题是:CMake调试"构建类型的所有平台上都有哪些编译器定义?DEBUG 好像不存在.(我只想在构建类型为 Debug 时进行日志记录或其他任何操作.)

                The question is: what compiler definition is available on all platforms in the CMake "Debug" build type? DEBUG seems not to exist. (I want to have the logging or whatever only when the build type is Debug.)

                推荐答案

                CMake 默认将 -DNDEBUG 添加到 CMAKE_C_FLAGS_{RELEASE, MINSIZEREL} 中.因此,您可以使用 #ifndef NDEBUG.

                CMake adds -DNDEBUG to the CMAKE_C_FLAGS_{RELEASE, MINSIZEREL} by default. So, you can use #ifndef NDEBUG.

                这篇关于#ifdef DEBUG 与 CMake 独立于平台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:Cmake 生成器表达式 下一篇:如何让 cmake 找到 CUDA

                相关文章

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

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

                    <bdo id='n3Edv'></bdo><ul id='n3Edv'></ul>

                2. <tfoot id='n3Edv'></tfoot>
                  <legend id='n3Edv'><style id='n3Edv'><dir id='n3Edv'><q id='n3Edv'></q></dir></style></legend>