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

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

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

        如何部分禁用 cmake C/C++ 自定义编译器检查

        How to partially disabling cmake C/C++ custom compiler checking(如何部分禁用 cmake C/C++ 自定义编译器检查)

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

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

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

                  <i id='kRc5z'><tr id='kRc5z'><dt id='kRc5z'><q id='kRc5z'><span id='kRc5z'><b id='kRc5z'><form id='kRc5z'><ins id='kRc5z'></ins><ul id='kRc5z'></ul><sub id='kRc5z'></sub></form><legend id='kRc5z'></legend><bdo id='kRc5z'><pre id='kRc5z'><center id='kRc5z'></center></pre></bdo></b><th id='kRc5z'></th></span></q></dt></tr></i><div id='kRc5z'><tfoot id='kRc5z'></tfoot><dl id='kRc5z'><fieldset id='kRc5z'></fieldset></dl></div>
                    <tbody id='kRc5z'></tbody>
                  本文介绍了如何部分禁用 cmake C/C++ 自定义编译器检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试使用 cmake 进行一些交叉编译.互联网上的所有示例都很容易,我设法在 Linux(x86 和 ARM)、Windows 和 Android 上交叉编译了我的库.但现在我想在自定义平台上进行.

                  I am trying to do some crosscompilation using cmake. Some are easy with all the examples on Internet, I managed to crosscompile my library on Linux (x86 and ARM), Windows and Android. But now I would like to do it on a custom platform.

                  我需要实现的过程:

                  1. 采购我的环境(这会破坏所有以前的 bash 经典环境)
                  2. 用cmake编译
                  3. 执行我想要的

                  但是 Cmake 正在测试我的自定义 C/C++ 库中的符号,这使我的库无法编译.我遇到的错误是 cmake 某些版本的 GLIBCXX 和 CXXABI(没有 C 问题)但不是全部.

                  But Cmake is testing for symbols in my custom C/C++ libraries which make my library unable to compile. The errors I have are that cmake some versions of GLIBCXX and CXXABI (no C issues) but not all of them.

                  有没有办法让 cmake 可以使用它?

                  Is there a way to make cmake ok with it ?

                  我尝试使用:

                  set(CMAKE_C_COMPILER_WORKS TRUE)
                  set(CMAKE_CXX_COMPILER_WORKS TRUE)
                  

                  还有:

                  include(CMakeForceCompiler)
                  ...
                  cmake_force_c_compiler(${ENV_PATH}/bin/${CC})
                  cmake_force_cxx_compiler(${ENV_PATH}/bin/${CXX})
                  

                  但 cmake 仍在检查符号.

                  But cmake is still checking for symbols.

                  推荐答案

                  如果没有您的环境和错误消息,就不容易说出真正的根本原因,但这里有两个常见原因和相应的修复:

                  Without having your environment nor the error message it's not easy to tell the actual root cause but here are two of the common causes and respective fixes:

                  1. 如果您没有完整的为您的自定义环境创建的工具链文件 - 因此 CMake 无法链接简单的测试程序 - 您可以尝试名为 CMAKE_TRY_COMPILE_TARGET_TYPE.

                  1. If you don't have a complete toolchain file created for your custom environment - so CMake can't link a simple test program - you can try the relatively new (version 3.6) global CMake variable named CMAKE_TRY_COMPILE_TARGET_TYPE.

                  所以只需添加以下内容:

                  So just add the following:

                  set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
                  

                  然后 CMake 会尝试构建一个静态库.

                  Then CMake would just try to build a static library.

                  要仅设置最常见的 GCC 编译器变量并仅进行一些基本检查,请尝试:

                  To have only the most common GCC compiler variables set and have only some basic checks, try:

                  SET(CMAKE_SYSTEM_NAME Generic)
                  

                  参见 CMake 交叉编译:设置系统和工具链:

                  如果您的目标是没有操作系统的嵌入式系统,请将 CMAKE_SYSTEM_NAME 设置为通用"

                  If your target is an embedded system without OS set CMAKE_SYSTEM_NAME to "Generic"

                  参考资料

                  • CMake AMRCC + 自定义链接器
                  • cmake 使用特定链接器进行交叉编译不向 armlink 传递参数

                  这篇关于如何部分禁用 cmake C/C++ 自定义编译器检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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?)

                    <bdo id='8PtyX'></bdo><ul id='8PtyX'></ul>

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

                    <legend id='8PtyX'><style id='8PtyX'><dir id='8PtyX'><q id='8PtyX'></q></dir></style></legend>

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