• <legend id='6AlXg'><style id='6AlXg'><dir id='6AlXg'><q id='6AlXg'></q></dir></style></legend>

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

    <small id='6AlXg'></small><noframes id='6AlXg'>

  • <tfoot id='6AlXg'></tfoot>
      1. 如何在配置主要项目的同时构建 cmake ExternalProject?

        How to build cmake ExternalProject while configurating main one?(如何在配置主要项目的同时构建 cmake ExternalProject?)
          <bdo id='L3ncb'></bdo><ul id='L3ncb'></ul>
          • <small id='L3ncb'></small><noframes id='L3ncb'>

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

                <tfoot id='L3ncb'></tfoot>
                  <tbody id='L3ncb'></tbody>
                <i id='L3ncb'><tr id='L3ncb'><dt id='L3ncb'><q id='L3ncb'><span id='L3ncb'><b id='L3ncb'><form id='L3ncb'><ins id='L3ncb'></ins><ul id='L3ncb'></ul><sub id='L3ncb'></sub></form><legend id='L3ncb'></legend><bdo id='L3ncb'><pre id='L3ncb'><center id='L3ncb'></center></pre></bdo></b><th id='L3ncb'></th></span></q></dt></tr></i><div id='L3ncb'><tfoot id='L3ncb'></tfoot><dl id='L3ncb'><fieldset id='L3ncb'></fieldset></dl></div>
                1. 本文介绍了如何在配置主要项目的同时构建 cmake ExternalProject?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当他们的安装目标搞砸时,引用 ExternalProjects 可能会很痛苦.因此,在为给定项目生成主项目文件之前,可能需要构建和安装 ExternalProjects 一次.是否可以使用 CMake 以及如何实现?

                  It can be a pain to refrence ExternalProjects when their install targets are messed up. So one may want to build and install ExternalProjects once before generating main project files for given project. Is it possible with CMake and how to do it?

                  推荐答案

                  您可以在 execute_process 中使用 cmake 调用来配置和构建包含 ExternalProject 的 CMake 项目:

                  You may use cmake call within execute_process for configure and build CMake project, which contains ExternalProject:

                  other_project/CMakeLists.txt:

                  project(other_project)
                  include(ExternalProject)
                  
                  ExternalProject_Add(<project_name> <options...>)
                  

                  CMakeLists.txt:

                  # Configure external project
                  execute_process(
                      COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR}/other_project
                      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/other_project
                  )
                  
                  # Build external project
                  execute_process(
                      COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}/other_project
                  )
                  

                  这样的other_project 将在目录${CMAKE_BINARY_DIR}/other_project 中配置和构建.如果您没有在 ExternalProject_Add 调用中禁用安装,那么它会在构建 other_project 时执行.

                  Such a way other_project will be configured and built in directory ${CMAKE_BINARY_DIR}/other_project. If you do not disable installation in ExternalProject_Add call, then it will performed when building other_project.

                  通常,您希望从主项目中的变量推导出 ExternalProject 的一些选项,例如 SOURCE_DIRBINARY_DIRINSTALL_DIR.您有两种方法可以实现:

                  Normally, you want some options to ExternalProject, like SOURCE_DIR, BINARY_DIR, INSTALL_DIR, to be deduced from variables in the main project. You have two ways for achive that:

                  1. 使用 configure_fileother_project 创建 CMakeLists.txt,从主项目调用(在 execute_process 之前)命令).

                  1. Create CMakeLists.txt for other_project with configure_file, called from main project (before execute_process command).

                  将变量从主项目作为 -D 参数传递给 ${CMAKE_COMMAND}.

                  Pass variables from main project as -D parameters to ${CMAKE_COMMAND}.


                  对顺序COMMANDS 进行分离 execute_process 调用很重要.否则,如果将单个 execute_process 与多个 COMMANDS 一起使用,这些命令将只是管道化";(同时执行,但第一个命令的输出被视为第二个命令的输入).


                  Having separated execute_process calls for sequential COMMANDS is important. Otherwise, if use single execute_process with several COMMANDS, these commands will be just "piped" (executed concurrently but with output of the first command being treated as input for the second).

                  这篇关于如何在配置主要项目的同时构建 cmake ExternalProject?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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='MZW9V'></bdo><ul id='MZW9V'></ul>

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

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

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