@@ -56,26 +56,37 @@ if(ENABLE_SWIFT)
56
56
string (TOLOWER ${CMAKE_SYSTEM_NAME} SWIFT_OS )
57
57
get_swift_host_arch (SWIFT_HOST_ARCH )
58
58
59
- set (SWIFT_RUNTIME_LIBDIR ${SWIFT_TOOLCHAIN} /${SWIFT_LIBDIR}/swift/${SWIFT_OS}/${SWIFT_HOST_ARCH} )
59
+ if (BUILD_SHARED_LIBS )
60
+ set (swift_dir swift )
61
+ set (runtime_kind SHARED )
62
+ else ()
63
+ set (swift_dir swift_static )
64
+ set (runtime_kind STATIC )
65
+ endif ()
66
+
67
+ set (prefix ${CMAKE_${runtime_kind}_LIBRARY_PREFIX} )
68
+ set (suffix ${CMAKE_${runtime_kind}_LIBRARY_SUFFIX} )
69
+
70
+ set (SWIFT_RUNTIME_LIBDIR ${SWIFT_TOOLCHAIN} /${SWIFT_LIBDIR}/${swift_dir}/${SWIFT_OS}/${SWIFT_HOST_ARCH} )
60
71
61
72
add_library (swiftCore
62
- SHARED IMPORTED GLOBAL )
73
+ ${runtime_kind} IMPORTED GLOBAL )
63
74
set_target_properties (swiftCore
64
75
PROPERTIES
65
76
IMPORTED_LOCATION
66
- ${SWIFT_RUNTIME_LIBDIR} /${CMAKE_SHARED_LIBRARY_PREFIX }swiftCore${CMAKE_SHARED_LIBRARY_SUFFIX } )
77
+ ${SWIFT_RUNTIME_LIBDIR} /${prefix }swiftCore${suffix } )
67
78
68
79
add_library (swiftSwiftOnoneSupport
69
- SHARED IMPORTED GLOBAL )
80
+ ${runtime_kind} IMPORTED GLOBAL )
70
81
set_target_properties (swiftSwiftOnoneSupport
71
82
PROPERTIES
72
83
IMPORTED_LOCATION
73
- ${SWIFT_RUNTIME_LIBDIR} /${CMAKE_SHARED_LIBRARY_PREFIX }swiftSwiftOnoneSupport${CMAKE_SHARED_LIBRARY_SUFFIX } )
84
+ ${SWIFT_RUNTIME_LIBDIR} /${prefix }swiftSwiftOnoneSupport${suffix } )
74
85
75
- set (INSTALL_TARGET_DIR "${INSTALL_LIBDIR} /swift /${SWIFT_OS} " CACHE PATH "Path where the libraries will be installed" )
76
- set (INSTALL_DISPATCH_HEADERS_DIR "${INSTALL_LIBDIR} /swift /dispatch" CACHE PATH "Path where the headers will be installed for libdispatch" )
77
- set (INSTALL_BLOCK_HEADERS_DIR "${INSTALL_LIBDIR} /swift /Block" CACHE PATH "Path where the headers will be installed for the blocks runtime" )
78
- set (INSTALL_OS_HEADERS_DIR "${INSTALL_LIBDIR} /swift /os" CACHE PATH "Path where the os/ headers will be installed" )
86
+ set (INSTALL_TARGET_DIR "${INSTALL_LIBDIR} /${swift_dir} /${SWIFT_OS} " CACHE PATH "Path where the libraries will be installed" )
87
+ set (INSTALL_DISPATCH_HEADERS_DIR "${INSTALL_LIBDIR} /${swift_dir} /dispatch" CACHE PATH "Path where the headers will be installed for libdispatch" )
88
+ set (INSTALL_BLOCK_HEADERS_DIR "${INSTALL_LIBDIR} /${swift_dir} /Block" CACHE PATH "Path where the headers will be installed for the blocks runtime" )
89
+ set (INSTALL_OS_HEADERS_DIR "${INSTALL_LIBDIR} /${swift_dir} /os" CACHE PATH "Path where the os/ headers will be installed" )
79
90
endif ()
80
91
81
92
if (NOT ENABLE_SWIFT )
0 commit comments