But I am unable to import CppAdPlugSO to the CAdPlugAPI target. The CAdPlugAPI target may be C or C++, however not Objective-C since I need this to work on other platforms.
You should be able to make your CAdPlugAPI target depend on your system library, just like any other target, as long as they are both within the same package. For an example, see the GtkCHelpers target that depends on the CGtk system library in SwiftGtk. For your CAdPlugAPI to import C++ headers, it would need to be C++ (but it can, of course, expose a C wrapper API).
mikolas@mikolas-desktop:~/Developer/SwiftAdPlug$ swift build
Building for debugging...
In file included from /home/mikolas/Developer/SwiftAdPlug/Sources/CAdPlug/CAdPlug.cpp:2:
In file included from /usr/include/adplug/adplug.h:27:
In file included from /usr/include/adplug/player.h:27:
/usr/include/adplug/fprovide.h:26:10: fatal error: 'binio.h' file not found
^~~~~~~~~
1 error generated.
[0/1] Compiling CAdPlug CAdPlug.cpp
macOS
mikolasstuchlik@10 SwiftAdPlug % swift build
In file included from /Users/mikolasstuchlik/Developer/SwiftAdPlug/Sources/CAdPlug/CAdPlug.cpp:2:
In file included from /usr/local/include/adplug/adplug.h:27:
In file included from /usr/local/include/adplug/player.h:27:
/usr/local/include/adplug/fprovide.h:26:10: fatal error: 'binio.h' file not found
#include <binio.h>
^~~~~~~~~
1 error generated.
[0/1] Compiling CAdPlug CAdPlug.cpp
This is the same error I have encountered previously. It looks like I am able to import libbinio from the
SPM, but unlike the adplug, I am using prefix libbinio/ in my include: #include <libbinio/binio.h>.
I have assumed, that there is an issue in the adplug and created symbolic link on my Linux system: