Questions tagged «external-project»

5
CMake:如何构建外部项目并包括其目标
我有一个将静态库导出为目标的项目A: install(TARGETS alib DESTINATION lib EXPORT project_a-targets) install(EXPORT project_a-targets DESTINATION lib/alib) 现在,我想将Project A用作Project B的外部项目,并包括其构建目标: ExternalProject_Add(project_a URL ...project_a.tar.gz PREFIX ${CMAKE_CURRENT_BINARY_DIR}/project_a CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> ) include(${CMAKE_CURRENT_BINARY_DIR}/lib/project_a/project_a-targets.cmake) 问题是,当运行项目B的CMakeLists时,包含文件尚不存在。 有没有办法使include依赖于正在构建的外部项目? 更新:我基于此问题和遇到的其他常见问题编写了一个简短的 CMake by Example教程。
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.