@@ -4,17 +4,35 @@ if(NOT SwiftCore_SIZEOF_POINTER)
4
4
mark_as_advanced (SwiftCore_SIZEOF_POINTER)
5
5
endif ()
6
6
7
+ # TODO: This logic should migrate to CMake once CMake supports installing swiftmodules
8
+ set (module_triple_command "${CMAKE_Swift_COMPILER} " -print-target -info)
9
+ if (CMAKE_Swift_COMPILER_TARGET)
10
+ list (APPEND module_triple_command -target ${CMAKE_Swift_COMPILER_TARGET} )
11
+ endif ()
12
+ execute_process (COMMAND ${module_triple_command} OUTPUT_VARIABLE target_info_json)
13
+ message (CONFIGURE_LOG "Swift target info: ${module_triple_command} \n "
14
+ "${target_info_json} " )
15
+
7
16
if (NOT SwiftCore_MODULE_TRIPLE)
8
- # TODO: This logic should migrate to CMake once CMake supports installing swiftmodules
9
- set (module_triple_command "${CMAKE_Swift_COMPILER} " -print-target -info)
10
- if (CMAKE_Swift_COMPILER_TARGET)
11
- list (APPEND module_triple_command -target ${CMAKE_Swift_COMPILER_TARGET} )
12
- endif ()
13
- execute_process (COMMAND ${module_triple_command} OUTPUT_VARIABLE target_info_json)
14
- message (CONFIGURE_LOG "Swift target info: ${module_triple_command} \n "
15
- "${target_info_json} " )
16
17
string (JSON module_triple GET "${target_info_json} " "target" "moduleTriple" )
17
- set (SwiftCore_MODULE_TRIPLE "${module_triple} " CACHE STRING "swift module triple used for installed swiftmodule and swiftinterface files" )
18
- message (CONFIGURE_LOG "Swift module triple: ${module_triple} " )
18
+ set (SwiftCore_MODULE_TRIPLE "${module_triple} " CACHE STRING "Triple used for installed swift{doc,module,interface} files" )
19
19
mark_as_advanced (SwiftCore_MODULE_TRIPLE)
20
+
21
+ message (CONFIGURE_LOG "Swift module triple: ${module_triple} " )
22
+ endif ()
23
+
24
+ if (NOT SwiftCore_PLATFORM_SUBDIR)
25
+ string (JSON platform GET "${target_info_json} " "target" "platform" )
26
+ set (SwiftCore_PLATFORM_SUBDIR "${platform} " CACHE STRING "Platform name used for installed swift{doc,module,interface} files" )
27
+ mark_as_advanced (SwiftCore_PLATFORM_SUBDIR)
28
+
29
+ message (CONFIGURE_LOG "Swift platform: ${platform} " )
30
+ endif ()
31
+
32
+ if (NOT SwiftCore_ARCH_SUBDIR)
33
+ string (JSON arch GET "${target_info_json} " "target" "arch" )
34
+ set (SwiftCore_ARCH_SUBDIR "${arch} " CACHE STRING "Architecture used for setting the architecture subdirectory" )
35
+ mark_as_advanced (SwiftCore_ARCH_SUBDIR)
36
+
37
+ message (CONFIGURE_LOG "Swift Arch: ${arch} " )
20
38
endif ()
0 commit comments