I am trying to integrate a library using cocoapods...
# multiplatform
t
I am trying to integrate a library using cocoapods into my project. However, when building the project, I am getting compilation errors. It turns out that this pod has to be compiled using c++17. I verified this as I simply run the command that failed in the console and appended -std=c++17, and it succeeded. Is there any way I can set the c++ version in my gradle build file, or in any other way?
f
t
The cinterop task is not the problem, but the podBuild task fails
I just tried your suggestion, but it only seems to apply to the cinterop task
f
Yes, it’s for cinterop. But, for Pod compilation, you can add/inject some code from the Podfile used by xcode.
Something like this https://stackoverflow.com/a/31804504/16543788 But, It’s not a Kotlin issue.
t
Are you thinking of injecting something like this into the podfile?
s.pod_target_xcconfig = {
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17'
}
f
This snippet is for the podspec, not the podfile, the podspec can’t be modified because it was rewritten by the plugin.
look at the link
t
While I was not able to follow your approach, I was able to find a solution. If PodBuildTask had a mechanism to supply extra command line arguments, adding the argument
"CLANG_CXX_LANGUAGE_STANDARD=c++17"
would make the code compile and the remaining code run.
🙌 1
I will try to create an issue for this. Maybe a mechanism to supply extra command line arguments when building pods could be added to the kotlin gradle plugin. It would be a quite straight forward solution.
f
I don’t expect too much about CocoaPods, the end of life of the tool is soon.
t
What will the replacement look like?
f
FYI, the end of Cocoapods is end of 2026, there will be no new updated pod; read the blog’s articles for the details. For the replacement, currently, it’s Swift Package Manager, I made a plugin to support it on KMP. But I don’t know about an official replacement for KMP iOS.
👍 2
SPM is now mainstream on Swift iOS, and Cocoapods is more and more abandoned by the devs.