Hi,
I am trying to incorporate our go code into our existing cmake build. We currently have extensive use of generator expressions and other cmake features that make it not ideal to just use custom commands/custom actions.
I am trying to integrate go natively into cmake. Cmake has support for additional languages but they have to follow the existing pattern which basically boils down to first compile into object file then link to executable.
Looking at the go compiler it uses go build which does the both steps at once. I did come across go tool compile -o main.go but when I run this on windows I cannot seem to get it to find standard packages like fmt. I tried to add the -std option but it does not seem to do anything from what I can tell. The lack of documentation here is also causing me to not be able to get this resolved. My understanding is that with current versions the standard packages are not on disk but compiled as needed but I cannot seem to get go tool compile to figure this out.
I have also read some forums saying that go tool compile is no longer supported. Is this true or is there a way to make this create an object file that I can then link in separate step?
I am able to work around this slightly by running go build as the compile command and then in the link command just copy what it thinks is the object file to the output but this seems like a big hack that will come back to cause problems later. I really would like to just compile to object file and link object file in separate step.
Can anyone help me figure out how to get go tool compile to work with standard libraries these days?