Saturday, November 13, 2021

[SOLVED] how to specify header file and library path when building a go program which import a cgo package?

Issue

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,


Solution

already use ExternalProject custom build command to work around it.



Answered By - Shuduo