使用CMake调用外部程序
我尝试搜索 CMake 文档,但不知道如何从 CMake 调用外部程序。
我想做的事情很少。
另一个问题是,处理这些情况的好方法是什么?当 CMake 中的“C”代表跨平台时,感觉直接从 CMake 调用 shell 脚本感觉不太干净。
编辑:我有一些额外的问题。之前,在我的构建中,我预先构建了依赖项,项目本身使用 FIND_PACKAGE(...) 来查找依赖项的标头/库。
现在,我使用ExternalProject_Add() 来编译依赖项,但问题是,当我运行cmake .
时,我所有的FindXYZ() 函数都会失败,因为执行CMake 时依赖项不存在。
在这种情况下,我应该如何在我的项目中包含第三方库?
I tried to search the CMake documentation, but I couldn't figure out how to call external programs from CMake.
There are few things I want to do.
- Compile other third-party dependencies that uses a makefile
- Compile Thrift definition files to C++ / Python stubs.
- Compile Cython definition files.
Another question is, what is a good way to handle those cases anyway? It feels like calling a shell script directly from CMake doesn't feel so clean, when "C" in CMake stands for Cross Platform.
EDIT: I have few extra questions. Before, in my build, I prebuilt my dependencies, and the project itself used FIND_PACKAGE(...) to find the header / libraries for the dependencies.
Now, I'm ExternalProject_Add() to compile the dependencies, but the problem is, all my FindXYZ() functions fails when I run cmake .
, because the dependencies aren't present when CMake gets executed.
How should I include the third-party libraries in my project in this case?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
。可以使用 CONFIGURE_COMMAND/BUILD_COMMAND/INSTALL_COMMAND 进行黑客攻击
2+3. can be hacked with CONFIGURE_COMMAND/BUILD_COMMAND/INSTALL_COMMAND