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

    1. <legend id='SCyIY'><style id='SCyIY'><dir id='SCyIY'><q id='SCyIY'></q></dir></style></legend>
    2. <small id='SCyIY'></small><noframes id='SCyIY'>

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

        CMake ExternalProject_Add() 和 FindPackage()

        CMake ExternalProject_Add() and FindPackage()(CMake ExternalProject_Add() 和 FindPackage())
          <tbody id='Fs9bE'></tbody>
      1. <i id='Fs9bE'><tr id='Fs9bE'><dt id='Fs9bE'><q id='Fs9bE'><span id='Fs9bE'><b id='Fs9bE'><form id='Fs9bE'><ins id='Fs9bE'></ins><ul id='Fs9bE'></ul><sub id='Fs9bE'></sub></form><legend id='Fs9bE'></legend><bdo id='Fs9bE'><pre id='Fs9bE'><center id='Fs9bE'></center></pre></bdo></b><th id='Fs9bE'></th></span></q></dt></tr></i><div id='Fs9bE'><tfoot id='Fs9bE'></tfoot><dl id='Fs9bE'><fieldset id='Fs9bE'></fieldset></dl></div>
        <legend id='Fs9bE'><style id='Fs9bE'><dir id='Fs9bE'><q id='Fs9bE'></q></dir></style></legend>
          • <bdo id='Fs9bE'></bdo><ul id='Fs9bE'></ul>
            1. <tfoot id='Fs9bE'></tfoot>

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

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

                  问题描述

                  是否有正确的方法可以找到使用 ExternalProject_Add() 构建的库(通过 FindPackage())?

                  Is there are proper way to find a library (via FindPackage()) which was built with ExternalProject_Add()?

                  问题是 CMake 在 CMake 时找不到库,因为外部库是在编译时构建的.我知道在超级构建中构建库和项目时可以组合这两个 CMake 函数,但我想在普通的 CMake 项目中使用它.

                  The problem is that CMake cannot find the library at CMake-time because the external library gets build at compile time. I know that it is possible to combine these two CMake function when building the library and the project in a superbuild but I want to use it in a normal CMake project.

                  事实上,我想使用 ExternalProject_Add 构建 VTK 6,并在我的 CMake 项目中使用 FindPackage 找到它.

                  In fact I would like to build VTK 6 with ExternalProject_Add and find it with FindPackage all inside my CMake project.

                  推荐答案

                  有一种方法可以做到这一点.但它有点hackish.您基本上添加了一个自定义目标,在构建期间重新运行 cmake.

                  there is a way to do this. but its kind of hackish. you basically add a custom target, that reruns cmake during build.

                  你必须在一个小型测试项目中尝试这个,以确定它是否适合你

                  you will have to try this in a small test project, to decide if it works for you

                  find_package(Beaengine)
                  
                  
                  ############################################
                  #
                  #    BeaEngine
                  #
                  include(ExternalProject)
                  externalproject_add(BeaEngine
                      SOURCE_DIR            ${PROJECT_SOURCE_DIR}/beaengine   
                      SVN_REPOSITORY        http://beaengine.googlecode.com/svn/trunk/
                      CMAKE_ARGS            -DoptHAS_OPTIMIZED=TRUE -DoptHAS_SYMBOLS=FALSE -DoptBUILD_64BIT=FALSE -DoptBUILD_DLL=FALSE -DoptBUILD_LITE=FALSE
                      INSTALL_COMMAND       ""
                   )
                  
                  
                  if(NOT ${Beaengine_FOUND})
                      #rerun cmake in initial build
                      #will update cmakecache/project files on first build
                      #so you may have to reload project after first build
                      add_custom_target(Rescan ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} DEPENDS BeaEngine)
                  else()
                      #Rescan becomes a dummy target after first build
                      #this prevents cmake from rebuilding cache/projects on subsequent builds
                      add_custom_target(Rescan)
                  endif()
                  
                  
                  
                  
                  add_executable(testapp testapp.cpp )
                  add_dependencies(testapp Rescan)
                  if(${Beaengine_FOUND})
                      target_link_libraries(testapp ${Beaengine_LIBRARY})
                  endif()
                  

                  这似乎适用于 mingw makefiles/eclipse makefile 项目.vs 会在第一次构建后请求重新加载所有项目.

                  this seems to work well for mingw makefiles / eclipse makefile projects. vs will request to reload all projects after first build.

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

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

                  相关文档推荐

                  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='crfy1'></tbody>

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

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

                      1. <tfoot id='crfy1'></tfoot>