英文:
how to specify header file and library path when building a go program which import a cgo package?
问题
我有一个名为A的简单Go程序,它需要将一个名为B的cgo项目作为模块导入。
B需要包含一个头文件并链接一个共享对象。这个头文件和共享对象不在标准路径(/usr/include,/usr/lib),而是在手动编译的工作目录中。
我该如何在A的源代码目录中运行go build,同时为B指定头文件和共享对象文件的路径?
我需要使用CMake来完成。
如果有人能帮忙,我将不胜感激。
谢谢。
英文:
I have a simple go program named A and it needs to import a cgo project named B as a module.
B needs to include a header file and link a shared object. The header file and shared object are not standard paths (/usr/include, /usr/lib) but in a work directory compiled manually.
How I can run go build in A's source directory but specify header/so file path for B?
I need to use CMake to do it.
Appreciated it if someone can help.
Thanks,
答案1
得分: -1
已经使用ExternalProject自定义构建命令解决了这个问题。
英文:
already use ExternalProject custom build command to work around it.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论