diff --git a/CMakeLists.txt b/CMakeLists.txt index 939a29e4..5931546d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,14 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift) set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY MultiThreadedDLL) +if(NOT SWIFT_SYSTEM_NAME) + if(CMAKE_SYSTEM_NAME STREQUAL Darwin) + set(SWIFT_SYSTEM_NAME macosx) + else() + set(SWIFT_SYSTEM_NAME "$") + endif() +endif() + set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift) set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY MultiThreadedDLL) diff --git a/cmake/modules/SwiftSupport.cmake b/cmake/modules/SwiftSupport.cmake index 21b9d693..508bb62b 100644 --- a/cmake/modules/SwiftSupport.cmake +++ b/cmake/modules/SwiftSupport.cmake @@ -63,12 +63,7 @@ endfunction() # Sets ${result_var_name} with the converted OS name derived from # CMAKE_SYSTEM_NAME. function(get_swift_host_os result_var_name) - if(CMAKE_SYSTEM_NAME STREQUAL Darwin) - set(${result_var_name} macosx PARENT_SCOPE) - else() - string(TOLOWER ${CMAKE_SYSTEM_NAME} cmake_system_name_lc) - set(${result_var_name} ${cmake_system_name_lc} PARENT_SCOPE) - endif() + set(${result_var_name} ${SWIFT_SYSTEM_NAME} PARENT_SCOPE) endfunction() function(_install_target module)