@@ -50,32 +50,21 @@ if(ENABLE_SWIFT)
50
50
message (FATAL_ERROR "CMAKE_SWIFT_COMPILER must be defined to enable swift" )
51
51
endif ()
52
52
53
- get_filename_component (SWIFT_TOOLCHAIN ${CMAKE_SWIFT_COMPILER} DIRECTORY )
54
- get_filename_component (SWIFT_TOOLCHAIN ${SWIFT_TOOLCHAIN} DIRECTORY )
53
+ find_package (Swift REQUIRED CONFIG )
55
54
56
- string (TOLOWER ${CMAKE_SYSTEM_NAME} SWIFT_OS )
57
- get_swift_host_arch (SWIFT_HOST_ARCH )
55
+ string (TOLOWER ${CMAKE_SYSTEM_NAME} swift_os )
56
+ get_swift_host_arch (swift_arch )
58
57
59
- set (SWIFT_RUNTIME_LIBDIR ${SWIFT_TOOLCHAIN} /${SWIFT_LIBDIR}/swift/${SWIFT_OS}/${SWIFT_HOST_ARCH} )
60
-
61
- add_library (swiftCore
62
- SHARED IMPORTED GLOBAL )
63
- set_target_properties (swiftCore
64
- PROPERTIES
65
- IMPORTED_LOCATION
66
- ${SWIFT_RUNTIME_LIBDIR} /${CMAKE_SHARED_LIBRARY_PREFIX}swiftCore${CMAKE_SHARED_LIBRARY_SUFFIX} )
67
-
68
- add_library (swiftSwiftOnoneSupport
69
- SHARED IMPORTED GLOBAL )
70
- set_target_properties (swiftSwiftOnoneSupport
71
- PROPERTIES
72
- IMPORTED_LOCATION
73
- ${SWIFT_RUNTIME_LIBDIR} /${CMAKE_SHARED_LIBRARY_PREFIX}swiftSwiftOnoneSupport${CMAKE_SHARED_LIBRARY_SUFFIX} )
58
+ if (BUILD_SHARED_LIBS )
59
+ set (swift_dir swift )
60
+ else ()
61
+ set (swift_dir swift_static )
62
+ endif ()
74
63
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" )
64
+ set (INSTALL_TARGET_DIR "${INSTALL_LIBDIR} /${swift_dir} /${swift_os } " CACHE PATH "Path where the libraries will be installed" )
65
+ set (INSTALL_DISPATCH_HEADERS_DIR "${INSTALL_LIBDIR} /${swift_dir} /dispatch" CACHE PATH "Path where the headers will be installed for libdispatch" )
66
+ set (INSTALL_BLOCK_HEADERS_DIR "${INSTALL_LIBDIR} /${swift_dir} /Block" CACHE PATH "Path where the headers will be installed for the blocks runtime" )
67
+ set (INSTALL_OS_HEADERS_DIR "${INSTALL_LIBDIR} /${swift_dir} /os" CACHE PATH "Path where the os/ headers will be installed" )
79
68
endif ()
80
69
81
70
if (NOT ENABLE_SWIFT )
0 commit comments