@@ -4,17 +4,35 @@ if(NOT SwiftCore_SIZEOF_POINTER)
44 mark_as_advanced (SwiftCore_SIZEOF_POINTER)
55endif ()
66
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+
716if (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} " )
1617 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" )
1919 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 platform GET "${target_info_json} " "target" "arch" )
34+ set (SwiftCore_PLATFORM_SUBDIR "${platform} " CACHE STRING "Architecture name used for installed swift{doc,module,interface} files" )
35+ mark_as_advanced (SwiftCore_PLATFORM_SUBDIR)
36+
37+ message (CONFIGURE_LOG "Swift platform: ${platform} " )
2038endif ()
0 commit comments