Swift: improve Swift install flow
When building a Swift library, there are "auxiliary" files that must be dealt with. A swiftmodule
and swiftdoc
file will be generated and placed into the location specified by the Swift_MODULE_DIRECTORY
property (which defaults to CMAKE_Swift_MODULE_DIRECTORY
). When installing this target, these files must be propagated to the installed image. Currently, this requires manually installing the files as well as computing the location for the installation. The way that the destination path for these file is calculated is as follows:
lib/$<OR:$<$<BOOL:$<BUILD_SHARED_LIBS>>:swift>,swift_static>/$<LOWER_CASE:CMAKE_SYSTEM_NAME>/$<LOWER_CASE:CMAKE_SYSTEM_PROCESSOR>
This is not entirely accurate as the CMAKE_SYSTEM_PROCESSOR
is sometimes renamed as follows:
- ppc64 -> powerpc64
- ppc64le -> powerpc64le
- armv6l -> armv6
- armv7l -> armv7
- AMD64 -> x86_64
- IA64 -> itanium
- x86 -> i686
Having these be installed much like interface libraries on Windows would make the install step definition much more concise and easy.